org.eclipse.ocl.examples.pivot.values.impl
Class AbstractCollectionValue<C extends java.util.Collection<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<C>
All Implemented Interfaces:
java.lang.Iterable<Value>, CollectionValue, Value
Direct Known Subclasses:
AbstractSequenceValue, BagValueImpl, OrderedSetValueImpl, SetValueImpl

public abstract class AbstractCollectionValue<C extends java.util.Collection<Value>>
extends AbstractedCollectionValue


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
protected  C 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
protected AbstractCollectionValue(ValueFactory valueFactory, C elements)
           
 
Method Summary
 IntegerValue count(Value value)
          Implementation of the OCL Collection::count(object : T) : Integer operation.
 BooleanValue excludes(Value value)
          Implementation of the OCL Collection::excludes(object : T) : Boolean operation.
 BooleanValue excludesAll(CollectionValue c)
          Implementation of the OCL Collection::excludesAll(c : Collection(T)) : Boolean operation.
 boolean flatten(java.util.Collection<Value> flattenedElements)
          Returns true if any element flattened.
protected  java.util.Collection<Value> getElements()
           
 int hashCode()
           
 BooleanValue includes(Value value)
           
 BooleanValue includesAll(CollectionValue c)
          Implementation of the OCL Collection::includesAll(c : Collection(T)) : Boolean operation.
 CollectionValue intersection(CollectionValue c)
           
 int intSize()
           
 java.util.Iterator<Value> iterator()
           
 Value maxMin(Value.BinaryOperation binaryOperation)
           
 java.util.Set<TupleValue> product(CollectionValue c, TupleType tupleType)
           
 Value sum(Value.BinaryOperation binaryOperation, Value zero)
           
 CollectionValue union(CollectionValue c)
           
 
Methods inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractedCollectionValue
asBagValue, asCollection, asCollectionValue, asList, asObject, asOrderedSetValue, asSequenceValue, asSetValue, asValidValue, isCollectionValue, isEmpty, notEmpty, size, toString, toString
 
Methods inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractValue
asBoolean, asBooleanValue, asDouble, asElement, asElementValue, asInteger, asIntegerValue, asObjectValue, asOrderedCollectionValue, 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, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.values.CollectionValue
excluding, flatten, getKind, including, sort, toOrderedCollectionValue
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.values.Value
asBoolean, asBooleanValue, asDouble, asElement, asElementValue, asInteger, asIntegerValue, asObjectValue, asOrderedCollectionValue, asRealValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, getType, getValueFactory, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toRealValue
 

Field Detail

elements

protected final C extends java.util.Collection<Value> elements
Constructor Detail

AbstractCollectionValue

protected AbstractCollectionValue(ValueFactory valueFactory,
                                  C elements)
Method Detail

count

public IntegerValue count(Value value)
                   throws InvalidValueException
Implementation of the OCL Collection::count(object : T) : Integer operation.

Parameters:
self - the source collection
object - an object
Returns:
the number of occurrences of the object in the collection
Throws:
InvalidValueException

excludes

public BooleanValue excludes(Value value)
Implementation of the OCL Collection::excludes(object : T) : Boolean operation.

Parameters:
self - the source collection
object - an object
Returns:
whether the collection does not include the object

excludesAll

public BooleanValue excludesAll(CollectionValue c)
Implementation of the OCL Collection::excludesAll(c : Collection(T)) : Boolean operation.

Parameters:
self - the source collection
c - another collection
Returns:
whether the source collection does not contain any of the elements of the other

flatten

public boolean flatten(java.util.Collection<Value> flattenedElements)
                throws InvalidValueException
Returns true if any element flattened.

Throws:
InvalidValueException

getElements

protected java.util.Collection<Value> getElements()
Specified by:
getElements in class AbstractedCollectionValue

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

includes

public BooleanValue includes(Value value)

includesAll

public BooleanValue includesAll(CollectionValue c)
Implementation of the OCL Collection::includesAll(c : Collection(T)) : Boolean operation.

Parameters:
self - the source collection
c - another collection
Returns:
whether the source collection includes all of the elements of the other

intSize

public int intSize()

intersection

public CollectionValue intersection(CollectionValue c)
                             throws InvalidValueException
Throws:
InvalidValueException

iterator

public java.util.Iterator<Value> iterator()

maxMin

public Value maxMin(Value.BinaryOperation binaryOperation)
             throws InvalidValueException
Throws:
InvalidValueException

product

public java.util.Set<TupleValue> product(CollectionValue c,
                                         TupleType tupleType)

sum

public Value sum(Value.BinaryOperation binaryOperation,
                 Value zero)
          throws InvalidValueException
Throws:
InvalidValueException

union

public CollectionValue union(CollectionValue c)
                      throws InvalidValueException
Throws:
InvalidValueException