/** * Create a unique id. * @param state The state. * @param type The object type. * @return The new id. */ public Object createId(IOAVState state, OAVObjectType type) { long start = nextid; Object ret = iscontentid? new OAVContentId(nextid++): new OAVObjectId(nextid++); if(state.containsObject(ret)) System.out.println("Warning, id overflow."); while(state.containsObject(ret) && nextid!=start) ret = new OAVObjectId(nextid++); if(state.containsObject(ret)) throw new RuntimeException("No free id available."); return ret; }
/** * Create a unique id. * @param state The state. * @param type The object type. * @return The new id. */ public Object createId(IOAVState state, OAVObjectType type) { long start = nextid; Object ret = iscontentid? new OAVContentId(nextid++): new OAVObjectId(nextid++); if(state.containsObject(ret)) System.out.println("Warning, id overflow."); while(state.containsObject(ret) && nextid!=start) ret = new OAVObjectId(nextid++); if(state.containsObject(ret)) throw new RuntimeException("No free id available."); return ret; }