it.unimi.di.mg4j.query.nodes
Class Remap

java.lang.Object
  extended by it.unimi.di.mg4j.query.nodes.Remap
All Implemented Interfaces:
Query, Serializable

public class Remap
extends Object
implements Query

A node representing an index remapping.

A remapping takes results of the underlying Query for an internal index (which must be one of the indices for which the query provides results) and exhibits them as results of an external index. The map provided at construction time under the form of two parallel arrays should remap internal indices to external indices.

Author:
Sebastiano Vigna
See Also:
RemappingDocumentIterator, Serialized Form

Field Summary
 Object2ObjectLinkedOpenHashMap<String,String> indexInverseRemapping
          The remapping from external to internal indices.
 Object2ObjectLinkedOpenHashMap<String,String> indexRemapping
          The remapping from internal to external indices.
 Query query
          The only underlying node.
 
Constructor Summary
Remap(Query query, CharSequence[] internalIndex, CharSequence[] externalIndex)
          Creates a new index remapping query node given explicit lists external and internal indices.
Remap(Query query, Object2ObjectMap<String,String> indexRemapping)
          Creates a new index remapping query node given an index remapping.
 
Method Summary
<T> T
accept(QueryBuilderVisitor<T> visitor)
          Accepts a visitor.
 boolean equals(Object o)
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

query

public final Query query
The only underlying node.


indexRemapping

public final Object2ObjectLinkedOpenHashMap<String,String> indexRemapping
The remapping from internal to external indices.


indexInverseRemapping

public final Object2ObjectLinkedOpenHashMap<String,String> indexInverseRemapping
The remapping from external to internal indices.

Constructor Detail

Remap

public Remap(Query query,
             CharSequence[] internalIndex,
             CharSequence[] externalIndex)
Creates a new index remapping query node given explicit lists external and internal indices.

Parameters:
query - the underlying query.
internalIndex - the array of internal index names.
externalIndex - the array of external index names, parallel to internalIndex.

Remap

public Remap(Query query,
             Object2ObjectMap<String,String> indexRemapping)
Creates a new index remapping query node given an index remapping.

Parameters:
query - the underlying query.
indexRemapping - a map from internal to external indices, which will be copied internally.
Method Detail

toString

public String toString()
Overrides:
toString in class Object

accept

public <T> T accept(QueryBuilderVisitor<T> visitor)
         throws QueryBuilderVisitorException
Description copied from interface: Query
Accepts a visitor.

Specified by:
accept in interface Query
Parameters:
visitor - the visitor.
Returns:
the result of the visit, or null if the visit should stop.
Throws:
QueryBuilderVisitorException
See Also:
Query

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object