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

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.values.impl.AbstractValue
      extended by org.eclipse.ocl.examples.pivot.values.impl.AbstractedCollectionValue
          extended by org.eclipse.ocl.examples.pivot.values.impl.AbstractCollectionValue<L>
              extended by org.eclipse.ocl.examples.pivot.values.impl.AbstractSequenceValue<L>
All Implemented Interfaces:
java.lang.Iterable<Value>, CollectionValue, NonUniqueCollectionValue, OrderedCollectionValue, SequenceValue, Value
Direct Known Subclasses:
IntegerRangeValueImpl, 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.pivot.values.CollectionValue
CollectionValue.Accumulator
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.examples.pivot.values.Value
Value.BinaryOperation
 
Field Summary
 
Fields inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractCollectionValue
elements
 
Fields inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractValue
valueFactory
 
Fields inherited from interface org.eclipse.ocl.examples.pivot.values.Value
INVALID_NAME
 
Constructor Summary
AbstractSequenceValue(ValueFactory valueFactory, L elements)
           
 
Method Summary
 SequenceValue append(Value object)
           
 java.util.List<Value> asList()
           
 OrderedCollectionValue asOrderedCollectionValue()
           
 SequenceValue asSequenceValue()
           
 Value at(int index)
           
 boolean equals(java.lang.Object obj)
           
 SequenceValue excluding(Value value)
           
 Value first()
           
 SequenceValue flatten()
           
 CollectionKind 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.
 OrderedCollectionValue toOrderedCollectionValue()
           
 void toString(java.lang.StringBuffer s, int lengthLimit)
           
 
Methods inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractCollectionValue
count, excludes, excludesAll, flatten, getElements, hashCode, includes, includesAll, intersection, intSize, iterator, maxMin, product, sum, union
 
Methods inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractedCollectionValue
asBagValue, asCollection, asCollectionValue, asObject, asOrderedSetValue, asSetValue, asValidValue, isCollectionValue, isEmpty, notEmpty, size, toString
 
Methods inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractValue
asBoolean, asBooleanValue, asDouble, asElement, asElementValue, asInteger, asIntegerValue, asObjectValue, asRealValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, getValueFactory, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toRealValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.values.CollectionValue
asCollection, count, excludes, excludesAll, flatten, includes, includesAll, intersection, intSize, isEmpty, iterator, maxMin, notEmpty, product, size, sum, union
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.values.Value
asBagValue, asBoolean, asBooleanValue, asCollectionValue, asDouble, asElement, asElementValue, asInteger, asIntegerValue, asObject, asObjectValue, asOrderedSetValue, asRealValue, asSetValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, asValidValue, getType, getValueFactory, isCollectionValue, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toRealValue
 

Constructor Detail

AbstractSequenceValue

public AbstractSequenceValue(ValueFactory valueFactory,
                             L elements)
Method Detail

asList

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

asOrderedCollectionValue

public OrderedCollectionValue asOrderedCollectionValue()
Specified by:
asOrderedCollectionValue in interface Value
Overrides:
asOrderedCollectionValue in class AbstractValue

asSequenceValue

public SequenceValue asSequenceValue()
Specified by:
asSequenceValue in interface Value
Overrides:
asSequenceValue in class AbstractedCollectionValue

append

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

at

public Value at(int index)
         throws InvalidValueException
Specified by:
at in interface OrderedCollectionValue
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 OrderedCollectionValue
Throws:
InvalidValueException

flatten

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

getKind

public CollectionKind 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 OrderedCollectionValue
Throws:
InvalidValueException

insertAt

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

last

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

prepend

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

reverse

public SequenceValue reverse()
Specified by:
reverse in interface OrderedCollectionValue

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

toOrderedCollectionValue

public OrderedCollectionValue toOrderedCollectionValue()
Specified by:
toOrderedCollectionValue in interface CollectionValue

toString

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