Package it.unimi.dsi.law.warc.util
Class RemappedStringMap
java.lang.Object
it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction<CharSequence>
it.unimi.dsi.law.warc.util.RemappedStringMap
- All Implemented Interfaces:
StringMap<CharSequence>
,Function<CharSequence,Long>
,Object2LongFunction<CharSequence>
,Size64
,Serializable
,Function<CharSequence,Long>
,ToLongFunction<CharSequence>
public class RemappedStringMap extends AbstractObject2LongFunction<CharSequence> implements StringMap<CharSequence>, Serializable
A
StringMap
that remaps values returned by another StringMap
.
Instances of this class wrap a given minimal perfect hash
and a given map (an integer array). Queries to getLong(Object)
are
solved by first inquiring the given map.
If the result is -1, it is returned; otherwise, we use the result to index
the map and return the corresponding element.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_BUFFER_SIZE
Fields inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defRetValue
-
Constructor Summary
Constructors Constructor Description RemappedStringMap(StringMap<? extends CharSequence> stringMap, int[] map)
Creates a new remapped minimal perfect hash. -
Method Summary
Modifier and Type Method Description boolean
containsKey(Object o)
long
getLong(Object o)
ObjectBigList<CharSequence>
list()
static void
main(String[] arg)
static void
run(String duplicateURLs, String archetypeURLs, StringMap<? extends CharSequence> resolver, String remappedFilename, int bufferSize)
int
size()
long
size64()
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2LongFunction
defaultReturnValue, defaultReturnValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.unimi.dsi.fastutil.objects.Object2LongFunction
andThenByte, andThenChar, andThenDouble, andThenFloat, andThenInt, andThenLong, andThenObject, andThenReference, andThenShort, applyAsLong, composeByte, composeChar, composeDouble, composeFloat, composeInt, composeLong, composeObject, composeReference, composeShort, defaultReturnValue, defaultReturnValue, get, put, put, remove, removeLong
-
Field Details
-
DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Details
-
RemappedStringMap
Creates a new remapped minimal perfect hash.- Parameters:
stringMap
- the underlying minimal perfect hash.map
- a map that will be used to remap the numbers returned bymph
.
-
-
Method Details
-
getLong
- Specified by:
getLong
in interfaceObject2LongFunction<CharSequence>
-
size64
public long size64()- Specified by:
size64
in interfaceSize64
- Specified by:
size64
in interfaceStringMap<CharSequence>
-
size
public int size()- Specified by:
size
in interfaceFunction<CharSequence,Long>
- Specified by:
size
in interfaceSize64
- Specified by:
size
in interfaceStringMap<CharSequence>
-
run
public static void run(String duplicateURLs, String archetypeURLs, StringMap<? extends CharSequence> resolver, String remappedFilename, int bufferSize) throws IOException- Throws:
IOException
-
list
- Specified by:
list
in interfaceStringMap<CharSequence>
-
containsKey
- Specified by:
containsKey
in interfaceFunction<CharSequence,Long>
-
main
- Throws:
Exception
-