@Override public int put(String value) { int id = _valueToIdMap.getInt(value); if (id == INVALID_KEY) { id = _idToValueMap.size(); _valueToIdMap.put(value, id); _idToValueMap.add(value); } return id; }
@Override public void add(final int i, final K k) { synchronized (sync) { list.add(i, k); } } @Override
@Override public boolean add(K key) { return list.add(key); } @Override
protected void addElement(K element) { touchedElements.add(element); } }
public void addRemovalListener(RemovalListener removalListener) { removalListeners.add(removalListener); }
protected void addElement(K element) { touchedElements.add(element); } }
@Override public boolean add(final K k) { l.add(to, k); to++; assert assertRange(); return true; } @Override
@Override public void add(long index, K key) { list.add(intIndex(index), key); } @Override
@Override public void add(final int index, final K k) { ensureIndex(index); l.add(from + index, k); to++; assert assertRange(); } @Override
public TableDiffImpl(Column[] currentColumns, Column[] columnCache, int[] columnHashCache) { addedColumns = new ObjectArrayList<Column>(); removedColumns = new ObjectArrayList<Column>(); modifiedColumns = new ObjectArrayList<Column>(); for (Column currentColumn : currentColumns) { if (!isContained(currentColumn, columnCache)) { addedColumns.add(currentColumn); } } for (int i = 0; i < columnCache.length; i++) { Column cachedColumn = columnCache[i]; if (!isContained(cachedColumn, currentColumns)) { removedColumns.add(cachedColumn); } else if (((ColumnImpl) cachedColumn).deepHashCode() != columnHashCache[i]) { modifiedColumns.add(cachedColumn); } } }
public TableDiffImpl(Column[] currentColumns, Column[] columnCache, int[] columnHashCache) { addedColumns = new ObjectArrayList<Column>(); removedColumns = new ObjectArrayList<Column>(); modifiedColumns = new ObjectArrayList<Column>(); for (Column currentColumn : currentColumns) { if (!isContained(currentColumn, columnCache)) { addedColumns.add(currentColumn); } } for (int i = 0; i < columnCache.length; i++) { Column cachedColumn = columnCache[i]; if (!isContained(cachedColumn, currentColumns)) { removedColumns.add(cachedColumn); } else if (((ColumnImpl) cachedColumn).deepHashCode() != columnHashCache[i]) { modifiedColumns.add(cachedColumn); } } }
/** Creates a trie from a set of elements. * * @param elements a set of elements * @param transformationStrategy a transformation strategy that must turn <code>elements</code> into a list of * distinct, lexicographically increasing (in iteration order) binary words. */ public ImmutableBinaryTrie(final Iterable<? extends T> elements, final TransformationStrategy<? super T> transformationStrategy) { this.transformationStrategy = transformationStrategy; defRetValue = -1; // Check order final Iterator<? extends T> iterator = elements.iterator(); final ObjectList<LongArrayBitVector> words = new ObjectArrayList<>(); int cmp; if (iterator.hasNext()) { final LongArrayBitVector prev = LongArrayBitVector.copy(transformationStrategy.toBitVector(iterator.next())); words.add(prev.copy()); BitVector curr; while(iterator.hasNext()) { curr = transformationStrategy.toBitVector(iterator.next()); cmp = prev.compareTo(curr); if (cmp == 0) throw new IllegalArgumentException("The trie elements are not unique"); if (cmp > 0) throw new IllegalArgumentException("The trie elements are not sorted"); prev.replace(curr); words.add(prev.copy()); } } root = buildTrie(words, 0); }
/** Creates a trie from a set of elements. * * @param elements a set of elements * @param transformationStrategy a transformation strategy that must turn <code>elements</code> into a list of * distinct, lexicographically increasing (in iteration order) binary words. */ public ImmutableBinaryTrie( final Iterable<? extends T> elements, final TransformationStrategy<? super T> transformationStrategy ) { this.transformationStrategy = transformationStrategy; defRetValue = -1; // Check order final Iterator<? extends T> iterator = elements.iterator(); final ObjectList<LongArrayBitVector> words = new ObjectArrayList<LongArrayBitVector>(); int cmp; if ( iterator.hasNext() ) { final LongArrayBitVector prev = LongArrayBitVector.copy( transformationStrategy.toBitVector( iterator.next() ) ); words.add( prev.copy() ); BitVector curr; while( iterator.hasNext() ) { curr = transformationStrategy.toBitVector( iterator.next() ); cmp = prev.compareTo( curr ); if ( cmp == 0 ) throw new IllegalArgumentException( "The trie elements are not unique" ); if ( cmp > 0 ) throw new IllegalArgumentException( "The trie elements are not sorted" ); prev.replace( curr ); words.add( prev.copy() ); } } root = buildTrie( words, 0 ); }
/** Creates a trie from a set of elements. * * @param elements a set of elements * @param transformationStrategy a transformation strategy that must turn <code>elements</code> into a list of * distinct, lexicographically increasing (in iteration order) binary words. */ public ImmutableBinaryTrie( final Iterable<? extends T> elements, final TransformationStrategy<? super T> transformationStrategy ) { this.transformationStrategy = transformationStrategy; defRetValue = -1; // Check order final Iterator<? extends T> iterator = elements.iterator(); final ObjectList<LongArrayBitVector> words = new ObjectArrayList<LongArrayBitVector>(); int cmp; if ( iterator.hasNext() ) { final LongArrayBitVector prev = LongArrayBitVector.copy( transformationStrategy.toBitVector( iterator.next() ) ); words.add( prev.copy() ); BitVector curr; while( iterator.hasNext() ) { curr = transformationStrategy.toBitVector( iterator.next() ); cmp = prev.compareTo( curr ); if ( cmp == 0 ) throw new IllegalArgumentException( "The trie elements are not unique" ); if ( cmp > 0 ) throw new IllegalArgumentException( "The trie elements are not sorted" ); prev.replace( curr ); words.add( prev.copy() ); } } root = buildTrie( words, 0 ); }
/** Creates a trie from a set of elements. * * @param elements a set of elements * @param transformationStrategy a transformation strategy that must turn <code>elements</code> into a list of * distinct, lexicographically increasing (in iteration order) binary words. */ public ImmutableBinaryTrie(final Iterable<? extends T> elements, final TransformationStrategy<? super T> transformationStrategy) { this.transformationStrategy = transformationStrategy; defRetValue = -1; // Check order final Iterator<? extends T> iterator = elements.iterator(); final ObjectList<LongArrayBitVector> words = new ObjectArrayList<>(); int cmp; if (iterator.hasNext()) { final LongArrayBitVector prev = LongArrayBitVector.copy(transformationStrategy.toBitVector(iterator.next())); words.add(prev.copy()); BitVector curr; while(iterator.hasNext()) { curr = transformationStrategy.toBitVector(iterator.next()); cmp = prev.compareTo(curr); if (cmp == 0) throw new IllegalArgumentException("The trie elements are not unique"); if (cmp > 0) throw new IllegalArgumentException("The trie elements are not sorted"); prev.replace(curr); words.add(prev.copy()); } } root = buildTrie(words, 0); }
private void emit() { int posPre, posPost, posAnchor; // Cut pre until the first start of word posPre = 0; if ( preAnchorArray.length > 0 && Character.isLetterOrDigit( preAnchorArray[ posPre ] ) ) // Skip starting non-space for ( ; posPre < preAnchorArray.length && Character.isLetterOrDigit( preAnchorArray[ posPre ] ); posPre++ ); // Same for post char[] postAnchorArray = postAnchor.array(); posPost = postAnchor.length() - 1; if ( posPost >= 0 && Character.isLetterOrDigit( postAnchorArray[ posPost ] ) ) { // Skip ending non-space for ( ; posPost >= 0 && Character.isLetterOrDigit( postAnchorArray[ posPost ] ); posPost-- ); } // Same for anchor char[] anchorArray = anchor.array(); posAnchor = anchor.length() - 1; if ( anchor.length() == maxAnchor && posAnchor >= 0 && Character.isLetterOrDigit( anchorArray[ posAnchor ] ) ) // Skip starting non-space for ( ; posAnchor >= 0 && Character.isLetterOrDigit( anchorArray[ posAnchor ] ); posAnchor-- ); result.setLength( 0 ); result.append( preAnchorArray, posPre, preAnchorArray.length - posPre ).append( anchorArray, 0, posAnchor + 1 ).append( postAnchorArray, 0, posPost + 1 ); anchors.add( new Anchor( url, result.copy() ) ); url = null; } }
private void emit() { int posPre, posPost, posAnchor; // Cut pre until the first start of word posPre = 0; if ( preAnchorArray.length > 0 && Character.isLetterOrDigit( preAnchorArray[ posPre ] ) ) // Skip starting non-space for ( ; posPre < preAnchorArray.length && Character.isLetterOrDigit( preAnchorArray[ posPre ] ); posPre++ ); // Same for post char[] postAnchorArray = postAnchor.array(); posPost = postAnchor.length() - 1; if ( posPost >= 0 && Character.isLetterOrDigit( postAnchorArray[ posPost ] ) ) { // Skip ending non-space for ( ; posPost >= 0 && Character.isLetterOrDigit( postAnchorArray[ posPost ] ); posPost-- ); } // Same for anchor char[] anchorArray = anchor.array(); posAnchor = anchor.length() - 1; if ( anchor.length() == maxAnchor && posAnchor >= 0 && Character.isLetterOrDigit( anchorArray[ posAnchor ] ) ) // Skip starting non-space for ( ; posAnchor >= 0 && Character.isLetterOrDigit( anchorArray[ posAnchor ] ); posAnchor-- ); result.setLength( 0 ); result.append( preAnchorArray, posPre, preAnchorArray.length - posPre ).append( anchorArray, 0, posAnchor + 1 ).append( postAnchorArray, 0, posPost + 1 ); anchors.add( new Anchor( url, result.copy() ) ); url = null; } }
private void emit() { int posPre, posPost, posAnchor; // Cut pre until the first start of word posPre = 0; if ( preAnchorArray.length > 0 && Character.isLetterOrDigit( preAnchorArray[ posPre ] ) ) // Skip starting non-space for ( ; posPre < preAnchorArray.length && Character.isLetterOrDigit( preAnchorArray[ posPre ] ); posPre++ ); // Same for post char[] postAnchorArray = postAnchor.array(); posPost = postAnchor.length() - 1; if ( posPost >= 0 && Character.isLetterOrDigit( postAnchorArray[ posPost ] ) ) { // Skip ending non-space for ( ; posPost >= 0 && Character.isLetterOrDigit( postAnchorArray[ posPost ] ); posPost-- ); } // Same for anchor char[] anchorArray = anchor.array(); posAnchor = anchor.length() - 1; if ( anchor.length() == maxAnchor && posAnchor >= 0 && Character.isLetterOrDigit( anchorArray[ posAnchor ] ) ) // Skip starting non-space for ( ; posAnchor >= 0 && Character.isLetterOrDigit( anchorArray[ posAnchor ] ); posAnchor-- ); result.setLength( 0 ); result.append( preAnchorArray, posPre, preAnchorArray.length - posPre ).append( anchorArray, 0, posAnchor + 1 ).append( postAnchorArray, 0, posPost + 1 ); anchors.add( new Anchor( url, result.copy() ) ); url = null; } }
if (delimiter != null) result.append(' ').append(delimiter); result.append( postAnchorArray, 0, posPost + 1 ); anchors.add( new Anchor( url, result.copy() ) ); url = null;
Binding hit = queryExecutor.nextHit(); while(hit != null) { hits.add(hit); hit = queryExecutor.nextHit();