it.unimi.dsi.mg4j.util
Class PermutedFrontCodedStringList

java.lang.Object
  extended byit.unimi.dsi.fastutil.objects.AbstractObjectCollection
      extended byit.unimi.dsi.fastutil.objects.AbstractObjectList
          extended byit.unimi.dsi.mg4j.util.PermutedFrontCodedStringList
All Implemented Interfaces:
Collection, Comparable, List, ObjectCollection, ObjectList, Serializable, Stack

public class PermutedFrontCodedStringList
extends AbstractObjectList
implements Serializable

A FrontCodedStringList whose indices are permuted.

It may happen that a list of strings compresses very well using front coding, but unfortunately alphabetical order is not the right order for the strings in the list. Instances of this class wrap an instance of FrontCodedStringList together with a permutation π: inquiries with index i will actually return the string with index πi.

See Also:
Serialized Form

Field Summary
protected  FrontCodedStringList frontCodedStringList
          The underlying front-coded string list.
protected  int[] permutation
          The permutation.
static long serialVersionUID
           
 
Constructor Summary
PermutedFrontCodedStringList(FrontCodedStringList frontCodedStringList, int[] permutation)
          Creates a new permuted front-coded string list using a given front-coded string list and permutation.
 
Method Summary
 Object get(int index)
           
 void get(int index, MutableString s)
          Returns the element at the specified position in this front-coded list by storing it in a mutable string.
static void main(String[] arg)
           
 ObjectListIterator objectListIterator(int k)
           
 int size()
           
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectList
add, addAll, addAll, addAll, addAll, addAll, addAll, addElements, addElements, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, getElements, hashCode, indexOf, lastIndexOf, listIterator, listIterator, objectIterator, objectListIterator, objectSubList, peek, pop, push, rem, remove, removeElements, set, size, subList, top, toString
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
add, clear, containsAll, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, clear, containsAll, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

frontCodedStringList

protected final FrontCodedStringList frontCodedStringList
The underlying front-coded string list.


permutation

protected final int[] permutation
The permutation.

Constructor Detail

PermutedFrontCodedStringList

public PermutedFrontCodedStringList(FrontCodedStringList frontCodedStringList,
                                    int[] permutation)
Creates a new permuted front-coded string list using a given front-coded string list and permutation.

Parameters:
frontCodedStringList - the underlying front-coded string list.
permutation - the underlying permutation.
Method Detail

get

public Object get(int index)
Specified by:
get in interface List

get

public void get(int index,
                MutableString s)
Returns the element at the specified position in this front-coded list by storing it in a mutable string.

Parameters:
index - an index in the list.
s - a mutable string that will contain the string at the specified position.

size

public int size()
Specified by:
size in interface List

objectListIterator

public ObjectListIterator objectListIterator(int k)
Specified by:
objectListIterator in interface ObjectList

main

public static void main(String[] arg)
                 throws FileNotFoundException,
                        IOException,
                        ClassNotFoundException
Throws:
FileNotFoundException
IOException
ClassNotFoundException