org.eclipse.ocl.examples.domain.values.impl
Class AbstractSequenceValue<L extends java.util.List<Value>>

java.lang.Object
  extended by org.eclipse.ocl.examples.domain.values.impl.AbstractValue
      extended by org.eclipse.ocl.examples.domain.values.impl.AbstractedCollectionValue
          extended by org.eclipse.ocl.examples.domain.values.impl.AbstractCollectionValue<L>
              extended by org.eclipse.ocl.examples.domain.values.impl.AbstractSequenceValue<L>
All Implemented Interfaces:
java.lang.Iterable<Value>, CollectionValue, SequenceValue, Value
Direct Known Subclasses:
SequenceRangeImpl, SequenceValueImpl

public abstract class AbstractSequenceValue<L extends java.util.List<Value>>
extends AbstractCollectionValue<L>
implements SequenceValue


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.examples.domain.values.CollectionValue
CollectionValue.Accumulator
 
Field Summary
 
Fields inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractCollectionValue
elements
 
Fields inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractedCollectionValue
type
 
Fields inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractValue
valueFactory
 
Fields inherited from interface org.eclipse.ocl.examples.domain.values.Value
INVALID_NAME
 
Constructor Summary
AbstractSequenceValue(ValueFactory valueFactory, DomainCollectionType type, L elements)
           
 
Method Summary
 SequenceValue append(Value object)
           
 java.util.List<Value> asList()
           
 SequenceValue asSequenceValue()
           
 Value at(int index)
           
 boolean equals(java.lang.Object obj)
           
 SequenceValue excluding(Value value)
           
 Value first()
           
 SequenceValue flatten()
           
 java.lang.String getKind()
           
 SequenceValue including(Value value)
           
 IntegerValue indexOf(Value object)
           
 SequenceValue insertAt(int index, Value object)
           
 Value last()
           
 SequenceValue prepend(Value object)
           
 SequenceValue reverse()
           
 SequenceValue sort(java.util.Comparator<Value> comparator)
           
 SequenceValue subSequence(int lower, int upper)
          Implementation of the OCL Sequence::subSequence(lower : Integer, upper : Integer) : Sequence(T) operation.
 SequenceValue toSequenceValue()
           
 void toString(java.lang.StringBuilder s, int lengthLimit)
           
 
Methods inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractCollectionValue
asBagValue, asEcoreObject, asOrderedSetValue, asSetValue, count, excludes, excludesAll, flatten, getBagType, getCollectionType, getElements, getElementType, getOrderedSetType, getSequenceType, getSetType, hashCode, includes, includesAll, intersection, intSize, iterator, maxMin, product, selectByKind, selectByType, sum, union
 
Methods inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractedCollectionValue
asCollection, asCollectionValue, asObject, asValidValue, getActualType, getType, isCollectionValue, isEmpty, notEmpty, size, toString
 
Methods inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractValue
asBoolean, asBooleanValue, asDouble, asElement, asElementValue, asInteger, asIntegerValue, asNavigableObject, asObjectValue, asRealValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, getValueFactory, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toIteratorValue, toRealValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.domain.values.CollectionValue
asCollection, count, excludes, excludesAll, flatten, getCollectionType, includes, includesAll, intersection, intSize, isEmpty, iterator, maxMin, notEmpty, product, selectByKind, selectByType, size, sum, union
 
Methods inherited from interface org.eclipse.ocl.examples.domain.values.Value
asBagValue, asBoolean, asBooleanValue, asCollectionValue, asDouble, asEcoreObject, asElement, asElementValue, asInteger, asIntegerValue, asNavigableObject, asObject, asObjectValue, asOrderedSetValue, asRealValue, asSetValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, asValidValue, getActualType, getType, getValueFactory, isCollectionValue, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toIteratorValue, toRealValue
 

Constructor Detail

AbstractSequenceValue

public AbstractSequenceValue(ValueFactory valueFactory,
                             DomainCollectionType type,
                             L elements)
Method Detail

asList

public java.util.List<Value> asList()
Specified by:
asList in interface CollectionValue
Overrides:
asList in class AbstractedCollectionValue

asSequenceValue

public SequenceValue asSequenceValue()
Specified by:
asSequenceValue in interface Value
Overrides:
asSequenceValue in class AbstractCollectionValue<L extends java.util.List<Value>>

append

public SequenceValue append(Value object)
                     throws InvalidValueException
Specified by:
append in interface SequenceValue
Throws:
InvalidValueException

at

public Value at(int index)
         throws InvalidValueException
Specified by:
at in interface SequenceValue
Throws:
InvalidValueException

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

excluding

public SequenceValue excluding(Value value)
Specified by:
excluding in interface CollectionValue

first

public Value first()
            throws InvalidValueException
Specified by:
first in interface SequenceValue
Throws:
InvalidValueException

flatten

public SequenceValue flatten()
                      throws InvalidValueException
Specified by:
flatten in interface CollectionValue
Throws:
InvalidValueException

getKind

public java.lang.String getKind()
Specified by:
getKind in interface CollectionValue

including

public SequenceValue including(Value value)
                        throws InvalidValueException
Specified by:
including in interface CollectionValue
Throws:
InvalidValueException

indexOf

public IntegerValue indexOf(Value object)
                     throws InvalidValueException
Specified by:
indexOf in interface SequenceValue
Throws:
InvalidValueException

insertAt

public SequenceValue insertAt(int index,
                              Value object)
                       throws InvalidValueException
Specified by:
insertAt in interface SequenceValue
Throws:
InvalidValueException

last

public Value last()
           throws InvalidValueException
Specified by:
last in interface SequenceValue
Throws:
InvalidValueException

prepend

public SequenceValue prepend(Value object)
                      throws InvalidValueException
Specified by:
prepend in interface SequenceValue
Throws:
InvalidValueException

reverse

public SequenceValue reverse()
                      throws InvalidValueException
Specified by:
reverse in interface SequenceValue
Throws:
InvalidValueException

sort

public SequenceValue sort(java.util.Comparator<Value> comparator)
Specified by:
sort in interface CollectionValue

subSequence

public SequenceValue subSequence(int lower,
                                 int upper)
Implementation of the OCL Sequence::subSequence(lower : Integer, upper : Integer) : Sequence(T) operation.

Specified by:
subSequence in interface SequenceValue
Parameters:
self - the source sequence
lower - the 1-based (in OCL fashion) inclusive lower bound
upper - the 1-based (in OCL fashion) inclusive upper bound
Returns:
the source collection with the object inserted at the index
Throws:
java.lang.IndexOutOfBoundsException - if an index is out of bounds
java.lang.IllegalArgumentException - if the lower bound is greater than the upper

toSequenceValue

public SequenceValue toSequenceValue()
Specified by:
toSequenceValue in interface CollectionValue

toString

public void toString(java.lang.StringBuilder s,
                     int lengthLimit)
Specified by:
toString in interface Value
Overrides:
toString in class AbstractedCollectionValue