public void copyFrom(final ORID iSource) { if (iSource == null) throw new IllegalArgumentException("Source is null"); clusterId = iSource.getClusterId(); clusterPosition = iSource.getClusterPosition(); }
private boolean matchesCluster(OCommandContext iCommandContext, Integer clusterId, OIdentifiable origin) { if (clusterId == null) { return true; } if (origin == null) { return false; } if (origin.getIdentity() == null) { return false; } return clusterId.equals(origin.getIdentity().getClusterId()); }
/** * {@inheritDoc} */ @Override public void serializeInByteBufferObject(OIdentifiable object, ByteBuffer buffer, Object... hints) { final ORID r = object.getIdentity(); buffer.putShort((short) r.getClusterId()); // Wrong implementation but needed for binary compatibility byte[] stream = new byte[OLongSerializer.LONG_SIZE]; OLongSerializer.INSTANCE.serialize(r.getClusterPosition(), stream, 0); buffer.put(stream); }
private int getHighLevelDocClusterId() { ORecordElement owner = this.owner; while (owner != null && owner.getOwner() != null) { owner = owner.getOwner(); } if (owner != null) { return ((OIdentifiable) owner).getIdentity().getClusterId(); } return -1; }
public int compareTo(final OIdentifiable iOther) { if (iOther == this) return 0; if (iOther == null) return 1; final int otherClusterId = iOther.getIdentity().getClusterId(); if (clusterId == otherClusterId) { final long otherClusterPos = iOther.getIdentity().getClusterPosition(); return (clusterPosition < otherClusterPos) ? -1 : ((clusterPosition == otherClusterPos) ? 0 : 1); } else if (clusterId > otherClusterId) return 1; return -1; }
private boolean matchesCluster(OEdge edge) { if (targetCluster == null) { return true; } int clusterId = edge.getIdentity().getClusterId(); String clusterName = ctx.getDatabase().getClusterNameById(clusterId); return clusterName.equals(targetCluster.getStringValue()); }
private boolean matchesCluster(OEdge edge) { if (targetCluster == null) { return true; } int clusterId = edge.getIdentity().getClusterId(); String clusterName = ctx.getDatabase().getClusterNameById(clusterId); return clusterName.equals(targetCluster.getStringValue()); }
private boolean alreadyVisited(OResult nextValue) { if (nextValue.isElement()) { ORID identity = nextValue.getElement().get().getIdentity(); int cluster = identity.getClusterId(); long pos = identity.getClusterPosition(); if (cluster >= 0 && pos >= 0) { return pastRids.contains(identity); } } return pastItems.contains(nextValue); }
@Override protected void unTrack(OIdentifiable id) { if (isTrackingChanges() && id.getIdentity().getClusterId() != -2) super.unTrack(id); } }
public void serialize(final OIdentifiable rid, final byte[] stream, final int startPosition, Object... hints) { final ORID r = rid.getIdentity(); short2bytes((short) r.getClusterId(), stream, startPosition); long2bytes(r.getClusterPosition(), stream, startPosition + OShortSerializer.SHORT_SIZE); }
public void serializeNativeObject(OIdentifiable rid, byte[] stream, int startPosition, Object... hints) { final ORID r = rid.getIdentity(); OShortSerializer.INSTANCE.serializeNative((short) r.getClusterId(), stream, startPosition); // Wrong implementation but needed for binary compatibility should be used serializeNative OLongSerializer.INSTANCE.serialize(r.getClusterPosition(), stream, startPosition + OShortSerializer.SHORT_SIZE); }
public void setValue(final ORID value) { setByteValue(NEXT_FREE_POSITION, (byte) 1); setShortValue(NEXT_FREE_POSITION + 1, (short) value.getClusterId()); setLongValue(NEXT_FREE_POSITION + 1 + OShortSerializer.SHORT_SIZE, value.getClusterPosition()); }
boolean addValue(final ORID rid) { final int size = getIntValue(RIDS_SIZE_OFFSET); final int position = size * RID_SIZE + RIDS_OFFSET; if (position + RID_SIZE > MAX_PAGE_SIZE_BYTES) { return false; } setShortValue(position, (short) rid.getClusterId()); setLongValue(position + OShortSerializer.SHORT_SIZE, rid.getClusterPosition()); setIntValue(RIDS_SIZE_OFFSET, size + 1); return true; }
protected static int writeNullLink(final BytesContainer bytes) { final int pos = OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterId()); OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterPosition()); return pos; }
private int writeNullLink(final BytesContainer bytes) { final int pos = OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterId()); OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterPosition()); return pos; }
protected void invalidateCache(final ORecord iRecord) { if (cmdCache.getEvictStrategy() == OCommandCacheSoftRefs.STRATEGY.PER_CLUSTER) cmdCache.invalidateResultsOfCluster(database.getClusterNameById(iRecord.getIdentity().getClusterId())); else cmdCache.invalidateResultsOfCluster(null); }
private int writeNullLink(final BytesContainer bytes) { final int pos = OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterId()); OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterPosition()); return pos; }
private int writeNullLink(final BytesContainer bytes) { final int pos = OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterId()); OVarIntSerializer.write(bytes, NULL_RECORD_ID.getIdentity().getClusterPosition()); return pos; }
private static int getHighLevelDocClusterId(ORidBag ridbag) { ORidBagDelegate delegate = ridbag.getDelegate(); ORecordElement owner = delegate.getOwner(); while (owner != null && owner.getOwner() != null) { owner = owner.getOwner(); } if (owner != null) return ((OIdentifiable) owner).getIdentity().getClusterId(); return -1; }
private int writeOptimizedLink(final BytesContainer bytes, OIdentifiable link) { if (!link.getIdentity().isPersistent()) { final ORecord real = link.getRecord(); if (real != null) link = real; } final int pos = OVarIntSerializer.write(bytes, link.getIdentity().getClusterId()); OVarIntSerializer.write(bytes, link.getIdentity().getClusterPosition()); return pos; }