it.unimi.dsi.util
Class PermutedFrontCodedStringList

java.lang.Object
  extended by java.util.AbstractCollection<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractObjectCollection<K>
          extended by it.unimi.dsi.fastutil.objects.AbstractObjectList<CharSequence>
              extended by it.unimi.dsi.util.PermutedFrontCodedStringList
All Implemented Interfaces:
ObjectCollection<CharSequence>, ObjectIterable<CharSequence>, ObjectList<CharSequence>, Stack<CharSequence>, Serializable, Comparable<List<? extends CharSequence>>, Iterable<CharSequence>, Collection<CharSequence>, List<CharSequence>

public class PermutedFrontCodedStringList
extends AbstractObjectList<CharSequence>
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

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectList
AbstractObjectList.ObjectSubList<K>
 
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
 CharSequence 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.
 ObjectListIterator<CharSequence> listIterator(int k)
           
static void main(String[] arg)
           
 int size()
           
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectList
add, add, addAll, addAll, addElements, addElements, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, getElements, hashCode, indexOf, iterator, lastIndexOf, listIterator, objectListIterator, objectListIterator, objectSubList, peek, pop, push, remove, removeElements, set, size, subList, top, toString
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
containsAll, isEmpty, objectIterator, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.util.AbstractCollection
clear, remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
clear, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectCollection
objectIterator, 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 CharSequence get(int index)
Specified by:
get in interface List<CharSequence>

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 Collection<CharSequence>
Specified by:
size in interface List<CharSequence>
Specified by:
size in class AbstractCollection<CharSequence>

listIterator

public ObjectListIterator<CharSequence> listIterator(int k)
Specified by:
listIterator in interface ObjectList<CharSequence>
Specified by:
listIterator in interface List<CharSequence>
Overrides:
listIterator in class AbstractObjectList<CharSequence>

main

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