org.zedlib
Interface Sequence

All Superinterfaces:
Collection, Function, Relation, Set, Set
All Known Implementing Classes:
HashSeq

public interface Sequence
extends Function

A sequence is a type of function that maps an integer (usually representing an ordering) to an object.

Example: S = { (1,fred), (2,tom), (3,mary) } is a valid sequence.

Author:
Brad Long

Method Summary
 void add(Seqlet s)
          Adds a maplet to this relation.
 boolean containsKey(int key)
          A convenience function for the alternative domain().contains(new Integer(key)).
 Sequence front()
          Returns a sequence being all but the last element in the sequence.
 Seqlet getSeqlet(int key)
          Returns the maplet that a given key participates in.
 Object head()
          Returns the first element in the sequence.
 Object last()
          Returns the last element in the sequence.
 Sequence tail()
          Returns a sequence being all but the first element in the sequence.
 
Methods inherited from interface org.zedlib.Function
containsKey, containsValue, getMaplet, put
 
Methods inherited from interface org.zedlib.Relation
add, add, addAll, composition, domain, domainAntiRestriction, domainRestriction, image, inverse, isFunction, isInjection, isReflexive, override, range, rangeAntiRestriction, rangeRestriction, transitiveClosure
 
Methods inherited from interface org.zedlib.Set
cartesianProduct, difference, identity, intersection, isSubsetOf, isSupersetOf, union
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

head

public Object head()
Returns the first element in the sequence.


tail

public Sequence tail()
Returns a sequence being all but the first element in the sequence.


last

public Object last()
Returns the last element in the sequence.


front

public Sequence front()
Returns a sequence being all but the last element in the sequence.


getSeqlet

public Seqlet getSeqlet(int key)
Returns the maplet that a given key participates in.

Parameters:
key - the key with which to obtain its corresponding value
Returns:
the maplet that the given key participates in

containsKey

public boolean containsKey(int key)
A convenience function for the alternative domain().contains(new Integer(key)).

Parameters:
key - the key to check
Returns:
true if the key is contained in the domain of this function
See Also:
Relation.domain()

add

public void add(Seqlet s)
Adds a maplet to this relation.

Parameters:
s - the seqlet to add to this sequence
See Also:
Set.add(Object o)


Copyright © 2006 Brad Long. All Rights Reserved.