Tabnine Logo
Reference2ReferenceMaps
Code IndexAdd Tabnine to your IDE (free)

How to use
Reference2ReferenceMaps
in
it.unimi.dsi.fastutil.objects

Best Java code snippets using it.unimi.dsi.fastutil.objects.Reference2ReferenceMaps (Showing top 20 results out of 315)

origin: it.unimi.dsi/mg4j

public Reference2ReferenceMap<Index, IntervalIterator> intervalIterators() {
  return Reference2ReferenceMaps.singleton( soleIndex, IntervalIterators.TRUE );
}
origin: it.unimi.dsi/fastutil

/**
 * Returns a hash code for this map.
 *
 * The hash code of a map is computed by summing the hash codes of its entries.
 *
 * @return a hash code for this map.
 */
@Override
public int hashCode() {
  int h = 0, n = size();
  final ObjectIterator<Reference2ReferenceMap.Entry<K, V>> i = Reference2ReferenceMaps.fastIterator(this);
  while (n-- != 0)
    h += i.next().hashCode();
  return h;
}
@Override
origin: it.unimi.di/mg4j-big

/** Creates a new remapping document iterator wrapping a given document iterator and remapping interval-iterator requests
 * through a given mapping from external to internal indices.
 * 
 * @param documentIterator the underlying document iterator.
 * @param indexInverseRemapping the mapping from external to internal indices.
 */
public RemappingDocumentIterator( final DocumentIterator documentIterator, final Reference2ReferenceMap<? extends Index, ? extends Index> indexInverseRemapping ) {
  this.documentIterator = documentIterator;
  this.indexInverseRemapping = indexInverseRemapping;
  final int n = documentIterator.indices().size();
  this.currentIterators = new Index2IntervalIteratorMap( n );
  this.unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
  indices = new ReferenceArraySet<Index>( documentIterator.indices().size() );
  final ReferenceArraySet<Index> nonIndices = new ReferenceArraySet<Index>();
  for( Map.Entry<? extends Index, ? extends Index> e : indexInverseRemapping.entrySet() ) {
    if ( documentIterator.indices().contains( e.getKey() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the latter already belongs to the document iterator" );
    if ( ! documentIterator.indices().contains( e.getValue() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the former does not belong to the document iterator" );
    nonIndices.add( e.getValue() );
    indices.add( e.getKey() );
  }
  
  for( Index index: documentIterator.indices() ) if ( ! nonIndices.contains( index ) ) indices.add( index );
  soleIndex = n == 1 ? indices.iterator().next() : null;
}

origin: it.unimi.dsi/mg4j

/** Creates a new remapping document iterator wrapping a given document iterator and remapping interval-iterator requests
 * through a given mapping from external to internal indices.
 * 
 * @param documentIterator the underlying document iterator.
 * @param indexInverseRemapping the mapping from external to internal indices.
 */
public RemappingDocumentIterator( final DocumentIterator documentIterator, final Reference2ReferenceMap<? extends Index, ? extends Index> indexInverseRemapping ) {
  this.documentIterator = documentIterator;
  this.indexInverseRemapping = indexInverseRemapping;
  final int n = documentIterator.indices().size();
  this.currentIterators = new Reference2ReferenceArrayMap<Index,IntervalIterator>( new Index[ n ], new IntervalIterator[ n ] );
  this.unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
  indices = new ReferenceArraySet<Index>( documentIterator.indices().size() );
  final ReferenceArraySet<Index> nonIndices = new ReferenceArraySet<Index>();
  for( Map.Entry<? extends Index, ? extends Index> e : indexInverseRemapping.entrySet() ) {
    if ( documentIterator.indices().contains( e.getKey() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the latter already belongs to the document iterator" );
    if ( ! documentIterator.indices().contains( e.getValue() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the former does not belong to the document iterator" );
    nonIndices.add( e.getValue() );
    indices.add( e.getKey() );
  }
  
  for( Index index: documentIterator.indices() ) if ( ! nonIndices.contains( index ) ) indices.add( index );
  soleIndex = n == 1 ? indices.iterator().next() : null;
}

origin: it.unimi.di/mg4j

/** Creates a new remapping document iterator wrapping a given document iterator and remapping interval-iterator requests
 * through a given mapping from external to internal indices.
 * 
 * @param documentIterator the underlying document iterator.
 * @param indexInverseRemapping the mapping from external to internal indices.
 */
public RemappingDocumentIterator( final DocumentIterator documentIterator, final Reference2ReferenceMap<? extends Index, ? extends Index> indexInverseRemapping ) {
  this.documentIterator = documentIterator;
  this.indexInverseRemapping = indexInverseRemapping;
  final int n = documentIterator.indices().size();
  this.currentIterators = new Index2IntervalIteratorMap( n );
  this.unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
  indices = new ReferenceArraySet<Index>( documentIterator.indices().size() );
  final ReferenceArraySet<Index> nonIndices = new ReferenceArraySet<Index>();
  for( Map.Entry<? extends Index, ? extends Index> e : indexInverseRemapping.entrySet() ) {
    if ( documentIterator.indices().contains( e.getKey() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the latter already belongs to the document iterator" );
    if ( ! documentIterator.indices().contains( e.getValue() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the former does not belong to the document iterator" );
    nonIndices.add( e.getValue() );
    indices.add( e.getKey() );
  }
  
  for( Index index: documentIterator.indices() ) if ( ! nonIndices.contains( index ) ) indices.add( index );
  soleIndex = n == 1 ? indices.iterator().next() : null;
}

origin: it.unimi.dsi/mg4j-big

public Reference2ReferenceMap<Index, IntervalIterator> intervalIterators() {
  return Reference2ReferenceMaps.singleton( soleIndex, IntervalIterators.TRUE );
}
origin: it.unimi.dsi/fastutil

  @Override
  public String toString() {
    final StringBuilder s = new StringBuilder();
    final ObjectIterator<Reference2ReferenceMap.Entry<K, V>> i = Reference2ReferenceMaps.fastIterator(this);
    int n = size();
    Reference2ReferenceMap.Entry<K, V> e;
    boolean first = true;
    s.append("{");
    while (n-- != 0) {
      if (first)
        first = false;
      else
        s.append(", ");
      e = i.next();
      if (this == e.getKey())
        s.append("(this map)");
      else
        s.append(String.valueOf(e.getKey()));
      s.append("=>");
      if (this == e.getValue())
        s.append("(this map)");
      else
        s.append(String.valueOf(e.getValue()));
    }
    s.append("}");
    return s.toString();
  }
}
origin: it.unimi.dsi/mg4j-big

protected AlignDocumentIterator( final DocumentIterator firstIterator, final DocumentIterator secondIterator ) {
  this.firstIterator = firstIterator;
  this.secondIterator = secondIterator;
  if ( firstIterator instanceof IndexIterator && secondIterator instanceof IndexIterator ) {
    firstIndexIterator = (IndexIterator)firstIterator; 
    secondIndexIterator = (IndexIterator)secondIterator;
  }
  else firstIndexIterator = secondIndexIterator = null;
  if ( firstIterator.indices().size() != 1 || secondIterator.indices().size() != 1 ) throw new IllegalArgumentException( "You can align single-index iterators only" );
  index = firstIterator.indices().iterator().next();
  currentIterators = new Reference2ReferenceArrayMap<Index,IntervalIterator>( 1 );
  unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
}
origin: it.unimi.di/mg4j-big

protected TrueDocumentIterator( final Index index ) {
  indices = ReferenceSets.singleton( soleIndex = index );
  intervalIterators = Reference2ReferenceMaps.singleton( soleIndex, IntervalIterators.TRUE );
}
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "deprecation"})
@Override
public void putAll(final Map<? extends K, ? extends V> m) {
  if (m instanceof Reference2ReferenceMap) {
    ObjectIterator<Reference2ReferenceMap.Entry<K, V>> i = Reference2ReferenceMaps
        .fastIterator((Reference2ReferenceMap<K, V>) m);
    while (i.hasNext()) {
      final Reference2ReferenceMap.Entry<? extends K, ? extends V> e = i.next();
      put(e.getKey(), e.getValue());
    }
  } else {
    int n = m.size();
    final Iterator<? extends Map.Entry<? extends K, ? extends V>> i = m.entrySet().iterator();
    Map.Entry<? extends K, ? extends V> e;
    while (n-- != 0) {
      e = i.next();
      put(e.getKey(), e.getValue());
    }
  }
}
/**
origin: it.unimi.dsi/mg4j-big

/** Creates a new remapping document iterator wrapping a given document iterator and remapping interval-iterator requests
 * through a given mapping from external to internal indices.
 * 
 * @param documentIterator the underlying document iterator.
 * @param indexInverseRemapping the mapping from external to internal indices.
 */
public RemappingDocumentIterator( final DocumentIterator documentIterator, final Reference2ReferenceMap<? extends Index, ? extends Index> indexInverseRemapping ) {
  this.documentIterator = documentIterator;
  this.indexInverseRemapping = indexInverseRemapping;
  final int n = documentIterator.indices().size();
  this.currentIterators = new Reference2ReferenceArrayMap<Index,IntervalIterator>( new Index[ n ], new IntervalIterator[ n ] );
  this.unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
  indices = new ReferenceArraySet<Index>( documentIterator.indices().size() );
  final ReferenceArraySet<Index> nonIndices = new ReferenceArraySet<Index>();
  for( Map.Entry<? extends Index, ? extends Index> e : indexInverseRemapping.entrySet() ) {
    if ( documentIterator.indices().contains( e.getKey() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the latter already belongs to the document iterator" );
    if ( ! documentIterator.indices().contains( e.getValue() ) ) throw new IllegalArgumentException( "You cannot remap index " + e.getValue() + " to index " + e.getKey() + " as the former does not belong to the document iterator" );
    nonIndices.add( e.getValue() );
    indices.add( e.getKey() );
  }
  
  for( Index index: documentIterator.indices() ) if ( ! nonIndices.contains( index ) ) indices.add( index );
  soleIndex = n == 1 ? indices.iterator().next() : null;
}

origin: it.unimi.di/mg4j-big

protected AbstractQuasiSuccinctIndexIterator( final QuasiSuccinctIndexReader indexReader ) {
  this.indexReader = indexReader;
  index = indexReader.index;
  keyIndex = index.keyIndex;
  hasPositions = index.hasPositions;
  hasCounts = index.hasCounts;
  numberOfDocuments = index.numberOfDocuments;
  pointersList = indexReader.pointersList;
  countsList = indexReader.countsList;
  positionsList = indexReader.positionsList;
  intervalIterator = hasPositions ? new IndexIntervalIterator( this ) : IntervalIterators.FALSE; 
  singletonIntervalIterator = Reference2ReferenceMaps.singleton( keyIndex, hasPositions ? intervalIterator : IntervalIterators.FALSE );
  currentTerm = frequency = -1;
}
origin: it.unimi.dsi/mg4j

protected AlignDocumentIterator( final DocumentIterator firstIterator, final DocumentIterator secondIterator ) {
  this.firstIterator = firstIterator;
  this.secondIterator = secondIterator;
  if ( firstIterator instanceof IndexIterator && secondIterator instanceof IndexIterator ) {
    firstIndexIterator = (IndexIterator)firstIterator; 
    secondIndexIterator = (IndexIterator)secondIterator;
  }
  else firstIndexIterator = secondIndexIterator = null;
  if ( firstIterator.indices().size() != 1 || secondIterator.indices().size() != 1 ) throw new IllegalArgumentException( "You can align single-index iterators only" );
  index = firstIterator.indices().iterator().next();
  currentIterators = new Reference2ReferenceArrayMap<Index,IntervalIterator>( 1 );
  unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
}
origin: it.unimi.di/mg4j

protected TrueDocumentIterator( final Index index ) {
  indices = ReferenceSets.singleton( soleIndex = index );
  intervalIterators = Reference2ReferenceMaps.singleton( soleIndex, IntervalIterators.TRUE );
}
origin: it.unimi.dsi/mg4j-big

unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
origin: it.unimi.di/mg4j

protected AbstractQuasiSuccinctIndexIterator( final QuasiSuccinctIndexReader indexReader ) {
  this.indexReader = indexReader;
  index = indexReader.index;
  keyIndex = index.keyIndex;
  hasPositions = index.hasPositions;
  hasCounts = index.hasCounts;
  numberOfDocuments = index.numberOfDocuments;
  pointersList = indexReader.pointersList;
  countsList = indexReader.countsList;
  positionsList = indexReader.positionsList;
  intervalIterator = hasPositions ? new IndexIntervalIterator( this ) : null;
  singletonIntervalIterator = hasPositions ? Reference2ReferenceMaps.singleton( keyIndex, (IntervalIterator)intervalIterator ) : null;
  currentTerm = frequency = -1;
}
origin: it.unimi.dsi/mg4j

/** Creates a new difference document iterator given a minuend and a subtrahend iterator.
 * @param minuendIterator the minuend.
 * @param subtrahendIterator the subtrahend.
 */
protected DifferenceDocumentIterator( final DocumentIterator minuendIterator, final DocumentIterator subtrahendIterator, final int leftMargin, final int rightMargin ) {
  if ( leftMargin < 0 || rightMargin < 0 ) throw new IllegalArgumentException( "Illegal margins: " + leftMargin + ", " + rightMargin );
  this.minuendIterator = minuendIterator;
  this.subtrahendIterator = subtrahendIterator;
  this.leftMargin = leftMargin;
  this.rightMargin = rightMargin;
  final int n = minuendIterator.indices().size();
  soleIndex = n == 1 ? indices().iterator().next() : null;
  // If the subtrahend is empty, the result is equal to the minuend.
  nonEmptySubtrahend = subtrahendIterator.hasNext();
  intervalIterators = new Reference2ReferenceArrayMap<Index,IntervalIterator>( n );
  currentIterators = new Reference2ReferenceArrayMap<Index,IntervalIterator>( n );
  unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
}
origin: it.unimi.di/mg4j-big

public BitStreamIndexReaderIndexIterator( final GammaDeltaGammaDeltaBitStreamIndexReader parent, final InputBitStream ibs ) {
 this.parent = parent;
 this.ibs = ibs;
 index = parent.index;
 keyIndex = index.keyIndex;
 pointerCoding = index.pointerCoding;
 if ( index.hasPayloads ) throw new IllegalStateException();
 if ( ! index.hasCounts ) throw new IllegalStateException();
 countCoding = index.countCoding;
 if ( ! index.hasPositions ) throw new IllegalStateException();
 positionCoding = index.positionCoding;
 positionCache = new int[ POSITION_CACHE_INITIAL_SIZE ];
 intervalIterator = index.hasPositions ? new it.unimi.di.big.mg4j.index.IndexIntervalIterator( this ) : null;
 singletonIntervalIterator = index.hasPositions ? Reference2ReferenceMaps.singleton( keyIndex, (IntervalIterator)intervalIterator ) : null;
}
origin: it.unimi.di/mg4j-big

public CachingDocumentIterator( final DocumentIterator documentIterator ) {
  this.documentIterator = documentIterator;
  final int n = documentIterator.indices().size();
  soleIndex = n == 1 ? indices().iterator().next() : null;
  this.currentIterators = new Index2IntervalIteratorMap( n );
  this.cachingIterators = new Index2IntervalIteratorMap( n );
  this.unmodifiableCurrentIterators = Reference2ReferenceMaps.unmodifiable( currentIterators );
}

origin: it.unimi.di/mg4j

public BitStreamIndexReaderIndexIterator( final GammaDeltaGammaDeltaBitStreamIndexReader parent, final InputBitStream ibs ) {
 this.parent = parent;
 this.ibs = ibs;
 index = parent.index;
 keyIndex = index.keyIndex;
 pointerCoding = index.pointerCoding;
 if ( index.hasPayloads ) throw new IllegalStateException();
 if ( ! index.hasCounts ) throw new IllegalStateException();
 countCoding = index.countCoding;
 if ( ! index.hasPositions ) throw new IllegalStateException();
 positionCoding = index.positionCoding;
 positionCache = new int[ POSITION_CACHE_INITIAL_SIZE ];
 intervalIterator = index.hasPositions ? new it.unimi.di.mg4j.index.IndexIntervalIterator( this ) : null;
 singletonIntervalIterator = index.hasPositions ? Reference2ReferenceMaps.singleton( keyIndex, (IntervalIterator)intervalIterator ) : null;
}
/** Positions the index on the inverted list of a given term.
it.unimi.dsi.fastutil.objectsReference2ReferenceMaps

Javadoc

A class providing static methods and objects that do useful things with type-specific maps.

Most used methods

  • singleton
    Returns a type-specific immutable map containing only the specified pair. The returned map is serial
  • unmodifiable
    Returns an unmodifiable type-specific map backed by the given type-specific map.
  • fastIterator
    Returns an iterator that will be FastEntrySet, if possible, on the Map#entrySet() of the provided ma

Popular in Java

  • Finding current android device location
  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • compareTo (BigDecimal)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now