Dresden OCL Toolkit

tudresden.ocl.lib
Class OclSequence

java.lang.Object
  extended bytudresden.ocl.lib.OclCollection
      extended bytudresden.ocl.lib.OclSequence
All Implemented Interfaces:
Cloneable, OclRoot, OclSizable

public class OclSequence
extends OclCollection

A OclSequence is a ordered collection of elements that may contain duplicates. See documentation of OclCollection for more information.

Indexing within an OclSequence begins with 1 for the first element.

Author:
Frank Finger
See Also:
OclCollection

Field Summary
 
Fields inherited from class tudresden.ocl.lib.OclCollection
collection, STRICT_VALUE_TYPES
 
Constructor Summary
OclSequence(int dummy, String reason)
          constructor for undefined OclSequence
OclSequence(List list)
          public constructor for valid OclSequences; it should be considered to use Ocl.getOclSequenceFor(Object o) instead of calling this constructor directly
 
Method Summary
 OclSequence append(OclRoot obj)
          Ocl.STRICT_VALUE_TYPES determines whether the returned OclSequence is a newly constructed one, or if this OclSequence is changed appropriately and then returned.
 OclRoot at(OclInteger index)
           
 OclCollection collect(OclIterator iter, OclRootEvaluatable eval)
           
 OclCollection excluding(OclRoot obj)
          remove obj form this collection and return the result
 OclRoot first()
           
static OclSequence getEmptyOclSequence()
          static factory method for an OclSequence containg no elements
 OclRoot getFeature(String name)
          If a feature of a collection is queried then this is interpreted to be the shorthand for collect (e.g.
 OclCollection including(OclRoot obj)
          add obj to this collection and return the result
 OclBoolean isEqualTo(Object o)
          two OclSequences are equal if they contain the same elements in the same order
 OclRoot last()
           
 OclSequence prepend(OclRoot obj)
          Ocl.STRICT_VALUE_TYPES determines whether the returned OclSequence is a newly constructed one, or if this OclSequence is changed appropriately and then returned.
 OclCollection select(OclIterator iter, OclBooleanEvaluatable eval)
           
 OclSequence subSequence(OclInteger lower, OclInteger upper)
          Ocl.STRICT_VALUE_TYPES determines whether the resulting OclSequence will be backed by the same java.lang.Collection as this OclSequence
 String toString()
           
 OclCollection union(OclCollection col)
          This method calls union(OclSequence seq) if the argument col is of type OclSequence.
 OclSequence union(OclSequence seq)
           
 
Methods inherited from class tudresden.ocl.lib.OclCollection
asBag, asSequence, asSet, becomeUndefined, collectToList, count, equals, excludes, exists, forAll, getFeatureAsCollection, getIterator, getUndefinedReason, includes, includesAll, isEmpty, isNotEqualTo, isUndefined, isUnique, iterate, notEmpty, reject, selectToList, setToInclude, setToRange, size, sortedBy, sum
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OclSequence

public OclSequence(List list)
public constructor for valid OclSequences; it should be considered to use Ocl.getOclSequenceFor(Object o) instead of calling this constructor directly

See Also:
Ocl.getOclSequenceFor(Object o)

OclSequence

public OclSequence(int dummy,
                   String reason)
constructor for undefined OclSequence

Method Detail

getEmptyOclSequence

public static OclSequence getEmptyOclSequence()
static factory method for an OclSequence containg no elements


isEqualTo

public OclBoolean isEqualTo(Object o)
two OclSequences are equal if they contain the same elements in the same order

Specified by:
isEqualTo in interface OclRoot
Specified by:
isEqualTo in class OclCollection

getFeature

public OclRoot getFeature(String name)
Description copied from class: OclCollection
If a feature of a collection is queried then this is interpreted to be the shorthand for collect (e.g. employee.name as short for employee.collect(name)). Therefore, this method is implemented to call collect appropriately.

Specified by:
getFeature in interface OclRoot
Specified by:
getFeature in class OclCollection
Returns:
an OclSequence according to the shorthand notation for collect
See Also:
OclCollection.getFeature(String name)

select

public OclCollection select(OclIterator iter,
                            OclBooleanEvaluatable eval)
Specified by:
select in class OclCollection
Returns:
an instance of OclSequence
See Also:
OclCollection.select(OclIterator iter, OclBooleanEvaluatable eval), OclCollection.selectToList(OclIterator iter, OclBooleanEvaluatable eval)

collect

public OclCollection collect(OclIterator iter,
                             OclRootEvaluatable eval)
Specified by:
collect in class OclCollection
Returns:
an instance of OclSequence
See Also:
OclCollection.collect(OclIterator iter, OclRootEvaluatable eval), OclCollection.collectToList(OclIterator iter, OclRootEvaluatable eval)

union

public OclCollection union(OclCollection col)
This method calls union(OclSequence seq) if the argument col is of type OclSequence. Return an undefined value, if not.

Specified by:
union in class OclCollection
Returns:
a collection containing all elements found in this collection or the collection given as parameter; for details see implementations in subclasses
See Also:
union(OclSequence seq)

union

public OclSequence union(OclSequence seq)
Returns:
the OclSequence consisting of all elements of this OclSequence, followed by all elements of the OclSequence given as argument

append

public OclSequence append(OclRoot obj)
Ocl.STRICT_VALUE_TYPES determines whether the returned OclSequence is a newly constructed one, or if this OclSequence is changed appropriately and then returned. If the java.util.Collection backing this OclSequence is not a java.util.List, a new OclSequence is created independent of Ocl.STRICT_VALUE_TYPES.

Returns:
the OclSequence consisting of all elements of this OclSequence, followes by the object given as argument

prepend

public OclSequence prepend(OclRoot obj)
Ocl.STRICT_VALUE_TYPES determines whether the returned OclSequence is a newly constructed one, or if this OclSequence is changed appropriately and then returned. If the java.util.Collection backing this OclSequence is not a java.util.List, a new OclSequence is created independent of Ocl.STRICT_VALUE_TYPES.

Returns:
the OclSequence consisting of the object given as argument followed by all elements of this OclSequence

subSequence

public OclSequence subSequence(OclInteger lower,
                               OclInteger upper)
Ocl.STRICT_VALUE_TYPES determines whether the resulting OclSequence will be backed by the same java.lang.Collection as this OclSequence

Parameters:
lower - needs to be greater than or equal to 1 and less than or equal to upper
upper - needs to be less than or equal to the OclSequences size()
Returns:
the sub-sequence of this OclSequence starting at lower, up to and including upper; the first element of this sequence has the number 1
See Also:
OclCollection.size()

at

public OclRoot at(OclInteger index)
Parameters:
index - needs to be greater than 0 and less than or equal to size()
Returns:
the OclRoot object with the index index

first

public OclRoot first()
Returns:
the first element of this OclSequence; this method is implemented to call at( OclInteger<1> )

last

public OclRoot last()
Returns:
the last element of this OclSequence; this method is implemented to call at( size() )

including

public OclCollection including(OclRoot obj)
Description copied from class: OclCollection
add obj to this collection and return the result

Specified by:
including in class OclCollection
Returns:
an OclSequence containing all elements of this OclSequence, followed by the object given as parameter; this method is implemented to call append(obj)
See Also:
Ocl.STRICT_VALUE_TYPES

excluding

public OclCollection excluding(OclRoot obj)
Description copied from class: OclCollection
remove obj form this collection and return the result

Specified by:
excluding in class OclCollection
Returns:
an OclSequence containing all elements of this OclSequence that are not equal to obj, in the same order as in this OclSequence
See Also:
Ocl.STRICT_VALUE_TYPES

toString

public String toString()
Overrides:
toString in class OclCollection

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.