public int storeAlias(int sessionId, int newStructId) { if (!IntHashTable.setItem(aliasStructIdTable, sessionId, newStructId)) { aliasStructIdTable = IntHashTable.doubleSize(aliasStructIdTable); if (!IntHashTable.setItem(aliasStructIdTable, sessionId, newStructId)) { logger.warn("internal error, unable to store new struct id for reuse.", new Exception()); } } return newStructId; }
public int storeAlias(int sessionId, int newStructId) { if (!IntHashTable.setItem(aliasStructIdTable, sessionId, newStructId)) { aliasStructIdTable = IntHashTable.doubleSize(aliasStructIdTable); if (!IntHashTable.setItem(aliasStructIdTable, sessionId, newStructId)) { logger.warn("internal error, unable to store new struct id for reuse.", new Exception()); } } return newStructId; }
public void registerStructAssociation(int structId, Object associatedObject) { int key = associatedObject.hashCode(); assert(!IntHashTable.hasItem(structTable, key)) : "These objects are too similar or was attached twice, Hash must be unique. Choose different objects"; if (IntHashTable.hasItem(structTable, key)) { logger.warn("Unable to add object {} as an association, Another object with an identical Hash is already held. Try a different object.", associatedObject); return; } if (!IntHashTable.setItem(structTable, key, structId)) { structTable = IntHashTable.doubleSize(structTable); if (!IntHashTable.setItem(structTable, key, structId)) { throw new RuntimeException("internal error"); }; } }
public void registerRouteAssociation(int routeId, Object associatedObject) { int key = associatedObject.hashCode(); assert(!IntHashTable.hasItem(routeIdTable, key)) : "These objects are too similar or was attached twice, Hash must be unique. Choose different objects"; if (IntHashTable.hasItem(routeIdTable, key)) { logger.warn("Unable to add object {} as an association, Another object with an identical Hash is already held. Try a different object.", associatedObject); return; } if (!IntHashTable.setItem(routeIdTable, key, routeId)) { routeIdTable = IntHashTable.doubleSize(routeIdTable); if (!IntHashTable.setItem(routeIdTable, key, routeId)) { throw new RuntimeException("internal error"); }; } }
public void registerStructAssociation(int structId, Object associatedObject) { int key = associatedObject.hashCode(); assert(!IntHashTable.hasItem(structTable, key)) : "These objects are too similar or was attached twice, Hash must be unique. Choose different objects"; if (IntHashTable.hasItem(structTable, key)) { logger.warn("Unable to add object {} as an association, Another object with an identical Hash is already held. Try a different object.", associatedObject); return; } if (!IntHashTable.setItem(structTable, key, structId)) { structTable = IntHashTable.doubleSize(structTable); if (!IntHashTable.setItem(structTable, key, structId)) { throw new RuntimeException("internal error"); }; } structLocals[structId&STRUCT_MASK] = associatedObject; }
public void registerStructAssociation(int structId, Object associatedObject) { int key = associatedObject.hashCode(); assert(!IntHashTable.hasItem(structTable, key)) : "These objects are too similar or was attached twice, Hash must be unique. Choose different objects"; if (IntHashTable.hasItem(structTable, key)) { logger.warn("Unable to add object {} as an association, Another object with an identical Hash is already held. Try a different object.", associatedObject); return; } if (!IntHashTable.setItem(structTable, key, structId)) { structTable = IntHashTable.doubleSize(structTable); if (!IntHashTable.setItem(structTable, key, structId)) { throw new RuntimeException("internal error"); }; } structLocals[structId&STRUCT_MASK] = associatedObject; }
private boolean addAssocHashToTable(Object localObject, int structIdx, int fieldIdx) { if (null==this.fieldAttachedIndex[structIdx]) { this.fieldAttachedIndex[structIdx] = new IntHashTable( IntHashTable.computeBits(this.fieldLocals[structIdx].length*2) ); } int hashCode = localObject.hashCode(); assert(0!=hashCode) : "can not insert null"; assert(!IntHashTable.hasItem(this.fieldAttachedIndex[structIdx], hashCode)) : "These objects are too similar or was attached twice, Hash must be unique. Choose different objects"; if (IntHashTable.hasItem(this.fieldAttachedIndex[structIdx], hashCode)) { logger.warn("Unable to add object {} as an association, Another object with an identical Hash is already held. Try a different object.", localObject); return false; } else { if (!IntHashTable.setItem(this.fieldAttachedIndex[structIdx], hashCode, fieldIdx)) { //we are out of space this.fieldAttachedIndex[structIdx] = IntHashTable.doubleSize(this.fieldAttachedIndex[structIdx]); if (!IntHashTable.setItem(this.fieldAttachedIndex[structIdx], hashCode, fieldIdx)) { throw new RuntimeException("internal error"); } } else { //logger.info("{} set object {} to index {}",structIdx, localObject, fieldIdx); } assert(fieldIdx == IntHashTable.getItem(this.fieldAttachedIndex[structIdx], hashCode)); return true; } }
private boolean addAssocHashToTable(Object localObject, int structIdx, int fieldIdx) { if (null==this.fieldAttachedIndex[structIdx]) { this.fieldAttachedIndex[structIdx] = new IntHashTable( IntHashTable.computeBits(this.fieldLocals[structIdx].length*2) ); } int hashCode = localObject.hashCode(); assert(0!=hashCode) : "can not insert null"; assert(!IntHashTable.hasItem(this.fieldAttachedIndex[structIdx], hashCode)) : "These objects are too similar or was attached twice, Hash must be unique. Choose different objects"; if (IntHashTable.hasItem(this.fieldAttachedIndex[structIdx], hashCode)) { logger.warn("Unable to add object {} as an association, Another object with an identical Hash is already held. Try a different object.", localObject); return false; } else { if (!IntHashTable.setItem(this.fieldAttachedIndex[structIdx], hashCode, fieldIdx)) { //we are out of space this.fieldAttachedIndex[structIdx] = IntHashTable.doubleSize(this.fieldAttachedIndex[structIdx]); if (!IntHashTable.setItem(this.fieldAttachedIndex[structIdx], hashCode, fieldIdx)) { throw new RuntimeException("internal error"); } } else { //logger.info("{} set object {} to index {}",structIdx, localObject, fieldIdx); } assert(fieldIdx == IntHashTable.getItem(this.fieldAttachedIndex[structIdx], hashCode)); return true; } }
if (!IntHashTable.setItem(this.fieldAttachedIndex[structIdx], hashCode, fieldIdx)) { this.fieldAttachedIndex[structIdx] = IntHashTable.doubleSize(this.fieldAttachedIndex[structIdx]); if (!IntHashTable.setItem(this.fieldAttachedIndex[structIdx], hashCode, fieldIdx)) { throw new RuntimeException("internal error");