org.eclipse.ocl.examples.domain.values.impl
Class AbstractCollectionValue<C extends java.util.Collection<Value>>
java.lang.Object
org.eclipse.ocl.examples.domain.values.impl.AbstractValue
org.eclipse.ocl.examples.domain.values.impl.AbstractedCollectionValue
org.eclipse.ocl.examples.domain.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
Fields inherited from interface org.eclipse.ocl.examples.domain.values.Value |
INVALID_NAME |
Methods inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractedCollectionValue |
asCollection, asCollectionValue, asList, asObject, asValidValue, getActualType, getType, isCollectionValue, isEmpty, notEmpty, size, toString, 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, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.ocl.examples.domain.values.Value |
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 |
elements
protected final C extends java.util.Collection<Value> elements
AbstractCollectionValue
protected AbstractCollectionValue(ValueFactory valueFactory,
DomainCollectionType type,
C elements)
asBagValue
public BagValue asBagValue()
- Add a value to a working collection, returning true if the working
collection is changed by the addition.
The default implementation is appropriate for non-unique collections and
must be overridden to support OCL rather than Java uniqueness semantics.
- Specified by:
asBagValue
in interface Value
- Overrides:
asBagValue
in class AbstractValue
asEcoreObject
public java.lang.Object asEcoreObject()
- Description copied from interface:
Value
- Return the Ecore representation of this value.
- Specified by:
asEcoreObject
in interface Value
- Overrides:
asEcoreObject
in class AbstractValue
asOrderedSetValue
public OrderedSetValue asOrderedSetValue()
- Specified by:
asOrderedSetValue
in interface Value
- Overrides:
asOrderedSetValue
in class AbstractValue
asSequenceValue
public SequenceValue asSequenceValue()
- Specified by:
asSequenceValue
in interface Value
- Overrides:
asSequenceValue
in class AbstractValue
asSetValue
public SetValue asSetValue()
- Specified by:
asSetValue
in interface Value
- Overrides:
asSetValue
in class AbstractValue
count
public IntegerValue count(Value value)
throws InvalidValueException
- Implementation of the OCL
Collection::count(object : T) : Integer
operation.
- Parameters:
self
- the source collectionobject
- 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 collectionobject
- 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 collectionc
- 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
getBagType
public DomainCollectionType getBagType()
getCollectionType
public DomainCollectionType getCollectionType()
getElementType
protected DomainType getElementType()
getElements
protected java.util.Collection<Value> getElements()
- Specified by:
getElements
in class AbstractedCollectionValue
getOrderedSetType
public DomainCollectionType getOrderedSetType()
getSequenceType
public DomainCollectionType getSequenceType()
getSetType
public DomainCollectionType getSetType()
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 collectionc
- 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(DomainEvaluator evaluator,
DomainType returnType,
LibraryBinaryOperation binaryOperation)
throws InvalidValueException
- Throws:
InvalidValueException
product
public java.util.Set<TupleValue> product(CollectionValue c,
DomainTupleType tupleType)
selectByKind
public CollectionValue selectByKind(DomainType requiredElementType)
throws InvalidValueException
- Throws:
InvalidValueException
selectByType
public CollectionValue selectByType(DomainType requiredElementType)
throws InvalidValueException
- Throws:
InvalidValueException
sum
public Value sum(DomainEvaluator evaluator,
DomainType returnType,
LibraryBinaryOperation binaryOperation,
Value zero)
throws InvalidValueException
- Throws:
InvalidValueException
union
public CollectionValue union(CollectionValue c)
throws InvalidValueException
- Throws:
InvalidValueException