/** * {@inheritDoc} * * @throws IndexOutOfBoundsException if no more allowed indices exist */ @Override public int generate(byte type) { IntProvider ig = generators.get(type); if (ig == null) throw new IndexOutOfBoundsException("No allowed indices with specified type: " + IndexType.getType(type)); return setType(type, ig.getNext()); }
void update(int pointer, TByteObjectHashMap<MaxType> maxTypeValues) { int previousPointer = 0, current; byte type; while (previousPointer < dummies.length) { type = IndicesUtils.getType(dummies[previousPointer]); current = binarySearchAbs(Arrays.binarySearch(dummies, previousPointer, dummies.length, (type + 1) << 24)); final int count = current - previousPointer; final MaxType typeInfo = maxTypeValues.get(type); if (typeInfo == null) maxTypeValues.put(type, new MaxType(count, pointer)); else if (typeInfo.count < count) { typeInfo.count = count; typeInfo.pointer = pointer; } previousPointer = current; } }
@Override public boolean execute(byte a, IntGenerator b) { IntGenerator thisGenerator = generators.get(a); if (thisGenerator == null) generators.put(a, b.clone()); else thisGenerator.mergeFrom(b); return true; } }
/** * Returns true if index contains in engaged data or already was generated. * * @param index index * @return true if index contains in engaged data or already was generated */ public boolean contains(int index) { byte type = getType(index); IntGenerator intGen; if ((intGen = generators.get(type)) == null) return false; return intGen.contains(getNameWithoutType(index)); }
/** * Generates new index of a particular type. * * @param type index type * @return new index of a particular type */ @Override public int generate(byte type) { IntGenerator ig = generators.get(type); if (ig == null) generators.put(type, ig = new IntGenerator()); return setType(type, ig.getNext()); }