ModeShape Distribution 3.0.0.Beta4

org.infinispan.schematic.internal.document
Class IndexSequence

java.lang.Object
  extended by org.infinispan.schematic.internal.document.IndexSequence
All Implemented Interfaces:
Iterable<String>, Collection<String>, Set<String>

public class IndexSequence
extends Object
implements Set<String>

An IndexSequence is a lightweight ordered sequence of string representing array indexes. It is lightweight because it shares and reuses the strings for indexes less than the maximum key count.

Since:
5.1

Field Summary
protected static String[] EMPTY_ARRAY
           
protected static String[] INDEX_VALUES
           
protected static int MAXIMUM_KEY_COUNT
           
protected  int size
           
 
Constructor Summary
IndexSequence(int size)
           
 
Method Summary
 boolean add(String e)
           
 boolean addAll(Collection<? extends String> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
static Iterator<String> indexesTo(int size)
          Obtain an iterator for the indexes up to the specified size.
static Iterator<String> infiniteSequence()
          Obtain an iterator for the indexes up the largest integer.
 boolean isEmpty()
           
 Iterator<String> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Field Detail

EMPTY_ARRAY

protected static final String[] EMPTY_ARRAY

INDEX_VALUES

protected static final String[] INDEX_VALUES

MAXIMUM_KEY_COUNT

protected static final int MAXIMUM_KEY_COUNT
See Also:
Constant Field Values

size

protected final int size
Constructor Detail

IndexSequence

public IndexSequence(int size)
Method Detail

indexesTo

public static Iterator<String> indexesTo(int size)
Obtain an iterator for the indexes up to the specified size.

Parameters:
size - the number of indexes
Returns:
the iterator of string indexes; never null

infiniteSequence

public static Iterator<String> infiniteSequence()
Obtain an iterator for the indexes up the largest integer. This is efficient, because it only builds strings as needed.

Returns:
the iterator of string indexes; never null

add

public boolean add(String e)
Specified by:
add in interface Collection<String>
Specified by:
add in interface Set<String>

addAll

public boolean addAll(Collection<? extends String> c)
Specified by:
addAll in interface Collection<String>
Specified by:
addAll in interface Set<String>

clear

public void clear()
Specified by:
clear in interface Collection<String>
Specified by:
clear in interface Set<String>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<String>
Specified by:
contains in interface Set<String>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<String>
Specified by:
containsAll in interface Set<String>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<String>
Specified by:
isEmpty in interface Set<String>

iterator

public Iterator<String> iterator()
Specified by:
iterator in interface Iterable<String>
Specified by:
iterator in interface Collection<String>
Specified by:
iterator in interface Set<String>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<String>
Specified by:
remove in interface Set<String>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<String>
Specified by:
removeAll in interface Set<String>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<String>
Specified by:
retainAll in interface Set<String>

size

public int size()
Specified by:
size in interface Collection<String>
Specified by:
size in interface Set<String>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<String>
Specified by:
toArray in interface Set<String>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<String>
Specified by:
toArray in interface Set<String>

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.