com.amazon.carbonado.qe
Class OrderingList<S extends Storable>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<OrderedProperty<S>>
          extended by com.amazon.carbonado.qe.OrderingList<S>
All Implemented Interfaces:
Serializable, Iterable<OrderedProperty<S>>, Collection<OrderedProperty<S>>, List<OrderedProperty<S>>

public class OrderingList<S extends Storable>
extends AbstractList<OrderedProperty<S>>
implements Serializable

Produces unmodifiable lists of orderings. Instances are immutable, canonical and cached. Calls to "equals" and "hashCode" are fast.

Author:
Brian S O'Neill
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Method Summary
 OrderingList<S> concat(Class<S> type, String property)
          Returns a list which concatenates this one with the given property.
 OrderingList<S> concat(OrderedProperty<S> property)
          Returns a list which concatenates this one with the given property.
 OrderingList<S> concat(OrderingList<S> other)
          Returns a list which concatenates this one with the other one.
static
<S extends Storable>
OrderingList<S>
emptyList()
          Returns a canonical empty instance.
 boolean equals(Object other)
           
static
<S extends Storable>
OrderingList<S>
get(Class<S> type, String... orderings)
          Returns a canonical instance composed of the given orderings.
static
<S extends Storable>
OrderingList<S>
get(Class<S> type, String property)
          Returns a canonical instance composed of the given ordering.
 OrderedProperty<S> get(int index)
           
static
<S extends Storable>
OrderingList<S>
get(List<OrderedProperty<S>> orderings)
          Returns a canonical instance composed of the given orderings.
static
<S extends Storable>
OrderingList<S>
get(OrderedProperty<S>... orderings)
          Returns a canonical instance composed of the given orderings.
 int hashCode()
           
 OrderingList<S> reduce()
          Eliminates redundant ordering properties.
 OrderingList<S> replace(int index, OrderedProperty<S> property)
          Returns a list with the given element replaced.
 OrderingList<S> reverseDirections()
          Returns this list with all orderings in reverse.
 int size()
           
 OrderingList<S> subList(int fromIndex, int toIndex)
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Method Detail

emptyList

public static <S extends Storable> OrderingList<S> emptyList()
Returns a canonical empty instance.


get

public static <S extends Storable> OrderingList<S> get(Class<S> type,
                                                       String property)
Returns a canonical instance composed of the given ordering.

Throws:
IllegalArgumentException - if ordering property is not in S

get

public static <S extends Storable> OrderingList<S> get(Class<S> type,
                                                       String... orderings)
Returns a canonical instance composed of the given orderings.

Throws:
IllegalArgumentException - if any ordering property is not in S

get

public static <S extends Storable> OrderingList<S> get(OrderedProperty<S>... orderings)
Returns a canonical instance composed of the given orderings.


get

public static <S extends Storable> OrderingList<S> get(List<OrderedProperty<S>> orderings)
Returns a canonical instance composed of the given orderings.


size

public int size()
Specified by:
size in interface Collection<OrderedProperty<S extends Storable>>
Specified by:
size in interface List<OrderedProperty<S extends Storable>>
Specified by:
size in class AbstractCollection<OrderedProperty<S extends Storable>>

get

public OrderedProperty<S> get(int index)
Specified by:
get in interface List<OrderedProperty<S extends Storable>>
Specified by:
get in class AbstractList<OrderedProperty<S extends Storable>>

concat

public OrderingList<S> concat(Class<S> type,
                              String property)
Returns a list which concatenates this one with the given property.


concat

public OrderingList<S> concat(OrderedProperty<S> property)
Returns a list which concatenates this one with the given property.


concat

public OrderingList<S> concat(OrderingList<S> other)
Returns a list which concatenates this one with the other one.


reduce

public OrderingList<S> reduce()
Eliminates redundant ordering properties.


reverseDirections

public OrderingList<S> reverseDirections()
Returns this list with all orderings in reverse.


replace

public OrderingList<S> replace(int index,
                               OrderedProperty<S> property)
Returns a list with the given element replaced.


subList

public OrderingList<S> subList(int fromIndex,
                               int toIndex)
Specified by:
subList in interface List<OrderedProperty<S extends Storable>>
Overrides:
subList in class AbstractList<OrderedProperty<S extends Storable>>

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<OrderedProperty<S extends Storable>>
Specified by:
hashCode in interface List<OrderedProperty<S extends Storable>>
Overrides:
hashCode in class AbstractList<OrderedProperty<S extends Storable>>

equals

public boolean equals(Object other)
Specified by:
equals in interface Collection<OrderedProperty<S extends Storable>>
Specified by:
equals in interface List<OrderedProperty<S extends Storable>>
Overrides:
equals in class AbstractList<OrderedProperty<S extends Storable>>


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.