it.unimi.di.mg4j.document
Class DispatchingDocumentFactory.StringBasedDispatchingStrategy

java.lang.Object
  extended by it.unimi.di.mg4j.document.DispatchingDocumentFactory.StringBasedDispatchingStrategy
All Implemented Interfaces:
DispatchingDocumentFactory.DispatchingStrategy, Serializable
Enclosing class:
DispatchingDocumentFactory

public static class DispatchingDocumentFactory.StringBasedDispatchingStrategy
extends Object
implements DispatchingDocumentFactory.DispatchingStrategy

A strategy that is based on trying to match the value of the metadata with a given key with respect to a certain set of values.

See Also:
Serialized Form

Constructor Summary
DispatchingDocumentFactory.StringBasedDispatchingStrategy(Enum<?> key, Object2IntMap<String> value)
          The strategy works as follows: the property named key is resolved; if this property is not set, the default return value of value is returned.
 
Method Summary
 int factoryNumber(Reference2ObjectMap<Enum<?>,Object> metadata, PropertyBasedDocumentFactory factory)
          Decides the index of the factory to be used for the given metadata, possibly using a factory to resolve property names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DispatchingDocumentFactory.StringBasedDispatchingStrategy

public DispatchingDocumentFactory.StringBasedDispatchingStrategy(Enum<?> key,
                                                                 Object2IntMap<String> value)
The strategy works as follows: the property named key is resolved; if this property is not set, the default return value of value is returned. Otherwise, its value is compared, using the equals, method with the elements of the value set, and the corresponding integer is returned.

Parameters:
key - the key to be resolved.
value - the map of values.
Method Detail

factoryNumber

public int factoryNumber(Reference2ObjectMap<Enum<?>,Object> metadata,
                         PropertyBasedDocumentFactory factory)
Description copied from interface: DispatchingDocumentFactory.DispatchingStrategy
Decides the index of the factory to be used for the given metadata, possibly using a factory to resolve property names.

Specified by:
factoryNumber in interface DispatchingDocumentFactory.DispatchingStrategy
Parameters:
metadata - the metadata of the document to be produced.
factory - the factory used to resolve metadata names.
Returns:
the factory index.