org.inria.ns.reflex.processor.xcl
Class ReversedResult

java.lang.Object
  extended by org.inria.ns.reflex.processor.xcl.ReversedResult
All Implemented Interfaces:
Comparable, Iterable, Collection, List

public class ReversedResult
extends Object
implements List, Comparable

A reversed list or a reversed sorting criterion is returned by the xcl:reverse() function.

The behaviour of an instance vary according to how it is used :

Author:
Philippe Poulard
See Also:
ReverseFunction, SortFunction

Constructor Summary
ReversedResult(XPathContext context, DeferredArgument arg)
          Create a new reversed list/criterion.
 
Method Summary
 void add(int index, Object element)
          Add an item.
 boolean add(Object o)
          Add an item.
 boolean addAll(Collection c)
          Add some items.
 boolean addAll(int index, Collection c)
          Add some items.
 void clear()
          Clear this list.
 int compareTo(Object o)
          Compare to an object by reversing a sorting criterion.
 boolean contains(Object o)
          Indicates whether an item exists or not.
 boolean containsAll(Collection c)
          Indicates whether some items exists or not.
 Object get(int index)
          Get an item.
 int indexOf(Object o)
          Get the position of an item.
 boolean isEmpty()
          Indicates whether this list is empty or not.
 Iterator iterator()
          Return an iterator on this list.
 int lastIndexOf(Object o)
          Get the last position of an item.
 ListIterator listIterator()
          Return an iterator on this list.
 ListIterator listIterator(int index)
          Return an iterator on this list.
 Object remove(int index)
          Remove an item.
 boolean remove(Object o)
          Remove an item.
 boolean removeAll(Collection c)
          Remove some items.
 boolean retainAll(Collection c)
          Retain some items.
 Object set(int index, Object element)
          Set an item.
 int size()
          Return the size of this list.
 List subList(int fromIndex, int toIndex)
          Return a sublist.
 Object[] toArray()
          Cast this list to an array.
 Object[] toArray(Object[] a)
          Cast this list to an array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

ReversedResult

public ReversedResult(XPathContext context,
                      DeferredArgument arg)
Create a new reversed list/criterion.

Parameters:
context - The context used for evaluation.
arg - The argument of the function.
Method Detail

compareTo

public int compareTo(Object o)
Compare to an object by reversing a sorting criterion.

Specified by:
compareTo in interface Comparable
Parameters:
o - The object to compare.
Returns:
The reversed comparison of this sorting criterion.
See Also:
Comparable.compareTo(java.lang.Object)

add

public void add(int index,
                Object element)
Add an item.

Specified by:
add in interface List
Parameters:
index - The index.
element - The item.

add

public boolean add(Object o)
Add an item.

Specified by:
add in interface Collection
Specified by:
add in interface List
Parameters:
o -
Returns:
true

addAll

public boolean addAll(int index,
                      Collection c)
Add some items.

Specified by:
addAll in interface List
Parameters:
index - The index.
c - The items
Returns:
true

addAll

public boolean addAll(Collection c)
Add some items.

Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Parameters:
c - The items
Returns:
true

clear

public void clear()
Clear this list.

Specified by:
clear in interface Collection
Specified by:
clear in interface List

contains

public boolean contains(Object o)
Indicates whether an item exists or not.

Specified by:
contains in interface Collection
Specified by:
contains in interface List
Parameters:
o - The item.
Returns:
true or false.

containsAll

public boolean containsAll(Collection c)
Indicates whether some items exists or not.

Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List
Parameters:
o - The items.
Returns:
true or false.

get

public Object get(int index)
Get an item.

Specified by:
get in interface List
Parameters:
index - The index.

indexOf

public int indexOf(Object o)
Get the position of an item.

Specified by:
indexOf in interface List
Parameters:
o - The item.
Returns:
Its index.

isEmpty

public boolean isEmpty()
Indicates whether this list is empty or not.

Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List
Returns:
true or false.

iterator

public Iterator iterator()
Return an iterator on this list.

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Returns:
An iterator on this list.

lastIndexOf

public int lastIndexOf(Object o)
Get the last position of an item.

Specified by:
lastIndexOf in interface List
Parameters:
o - The item.
Returns:
Its last index.

listIterator

public ListIterator listIterator()
Return an iterator on this list.

Specified by:
listIterator in interface List
Returns:
An iterator on this list.

listIterator

public ListIterator listIterator(int index)
Return an iterator on this list.

Specified by:
listIterator in interface List
Parameters:
index - The index.
Returns:
An iterator on this list.

remove

public Object remove(int index)
Remove an item.

Specified by:
remove in interface List
Parameters:
index - The index.
Returns:
The removed item.

remove

public boolean remove(Object o)
Remove an item.

Specified by:
remove in interface Collection
Specified by:
remove in interface List
Parameters:
o - The item.
Returns:
true or false.

removeAll

public boolean removeAll(Collection c)
Remove some items.

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Parameters:
c - The items.
Returns:
true or false.

retainAll

public boolean retainAll(Collection c)
Retain some items.

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Parameters:
c - The items.
Returns:
true or false.

set

public Object set(int index,
                  Object element)
Set an item.

Specified by:
set in interface List
Parameters:
index - The index.
element - The item.
Returns:
The previous item.

size

public int size()
Return the size of this list.

Specified by:
size in interface Collection
Specified by:
size in interface List
Returns:
The size.

subList

public List subList(int fromIndex,
                    int toIndex)
Return a sublist.

Specified by:
subList in interface List
Parameters:
fromIndex - Start index.
toIndex - End index.
Returns:
A sublist.

toArray

public Object[] toArray()
Cast this list to an array.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Returns:
An array.

toArray

public Object[] toArray(Object[] a)
Cast this list to an array.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Parameters:
a - The array.
Returns:
An array.