public abstract class CollectionValueImpl extends ValueImpl implements CollectionValue, java.lang.Iterable<java.lang.Object>
CollectionValue.Accumulator
Modifier and Type | Field and Description |
---|---|
protected java.util.Collection<? extends java.lang.Object> |
elements |
static org.eclipse.ocl.pivot.internal.values.CollectionValueImpl.NullIterator |
EMPTY_ITERATOR |
protected CollectionTypeId |
typeId |
EMPTY_BAG, EMPTY_SET, FALSE_VALUE, INTEGER_MAX_VALUE, INTEGER_MIN_VALUE, INVALID_VALUE, LONG_MAX_VALUE, LONG_MIN_VALUE, NULL_STRING, NULL_VALUE, ONE_VALUE, TRUE_VALUE, UNLIMITED_ONE_VALUE, UNLIMITED_VALUE, ZERO_VALUE
INVALID_NAME
Modifier | Constructor and Description |
---|---|
protected |
CollectionValueImpl(CollectionTypeId typeId,
java.util.Collection<? extends java.lang.Object> values) |
Modifier and Type | Method and Description |
---|---|
BagValue |
asBagValue()
Add a value to a working collection, returning true if the working
collection is changed by the addition.
|
java.util.Collection<? extends java.lang.Object> |
asCollection() |
CollectionValue |
asCollectionValue() |
java.util.List<java.lang.Object> |
asEcoreObject(IdResolver idResolver,
java.lang.Class<?> instanceClass)
Return the Ecore representation of this value, which should be fully compatible with the Ecore return
from a similarly typed eGet().
|
<T> java.util.List<T> |
asEcoreObjects(IdResolver idResolver,
java.lang.Class<T> instanceClass) |
java.util.List<? extends java.lang.Object> |
asList() |
java.lang.Object |
asObject() |
OrderedSetValue |
asOrderedSetValue() |
SequenceValue |
asSequenceValue() |
SetValue |
asSetValue() |
protected boolean |
checkElementsAreUnique(java.lang.Iterable<? extends java.lang.Object> elements) |
IntegerValue |
count(java.lang.Object value)
Implementation of the OCL
Collection::count(object : T) : Integer
operation.
|
protected org.eclipse.emf.ecore.EClass |
eStaticClass() |
java.lang.Boolean |
excludes(java.lang.Object value)
Implementation of the OCL
Collection::excludes(object : T) : Boolean
operation.
|
java.lang.Boolean |
excludesAll(CollectionValue c)
Implementation of the OCL
Collection::excludesAll(c : Collection(T)) : Boolean
operation.
|
boolean |
flatten(java.util.Collection<java.lang.Object> flattenedElements)
Returns true if any element flattened.
|
CollectionTypeId |
getBagTypeId() |
java.util.Collection<? extends java.lang.Object> |
getElements() |
TypeId |
getElementTypeId() |
java.util.Collection<? extends java.lang.Object> |
getObject() |
CollectionTypeId |
getOrderedSetTypeId() |
CollectionTypeId |
getSequenceTypeId() |
CollectionTypeId |
getSetTypeId() |
CollectionTypeId |
getTypeId()
Return the type of this value determined from its construction context.
|
int |
hashCode() |
java.lang.Boolean |
includes(java.lang.Object value) |
java.lang.Boolean |
includesAll(CollectionValue c)
Implementation of the OCL
Collection::includesAll(c : Collection(T)) : Boolean
operation.
|
static void |
initStatics()
A simple public static method that may be used to force class initialization.
|
CollectionValue |
intersection(CollectionValue that) |
int |
intSize() |
java.lang.Boolean |
isEmpty() |
java.lang.Iterable<? extends java.lang.Object> |
iterable() |
java.util.Iterator<java.lang.Object> |
iterator() |
java.lang.Boolean |
notEmpty() |
java.util.Set<TupleValue> |
product(CollectionValue c,
TupleTypeId tupleTypeId) |
IntegerValue |
size() |
java.lang.String |
toString() |
void |
toString(java.lang.StringBuilder s,
int lengthLimit) |
CollectionValue |
union(CollectionValue that) |
asDouble, asElement, asInteger, asIntegerValue, asMapValue, asNavigableObject, asObjectValue, asOrderedCollectionValue, asRealValue, asTupleValue, asUnboxedObject, asUniqueCollectionValue, asUnlimitedNaturalValue, getTypeName, isInvalid, isUndefined
asBagValue, asBoolean, asClass, asCollectionType, asCollectionValue, asInteger, asIntegerValue, asMapType, asMapValue, asNavigableObject, asNavigableObject, asObject, asOrderedCollectionValue, asOrderedSetValue, asRealValue, asSequenceValue, asSetValue, asString, asTupleValue, asType, asUniqueCollectionValue, asUnlimitedNaturalValue, asValue, bigDecimalValueOf, bigIntegerValueOf, byteValueOf, characterValueOf, computeCollectionHashCode, createBagAccumulatorValue, createBagOfEach, createBagRange, createBagValue, createCollectionAccumulatorValue, createInvalidValue, createMapEntry, createMapOfEach, createMapValue, createObjectValue, createOrderedSetAccumulatorValue, createOrderedSetOfEach, createOrderedSetRange, createOrderedSetValue, createRange, createSequenceAccumulatorValue, createSequenceOfEach, createSequenceRange, createSequenceRange, createSequenceValue, createSetAccumulatorValue, createSetOfEach, createSetRange, createSetValue, createTupleOfEach, createTupleValue, doubleValueOf, floatValueOf, getElementIdName, getExecutor, getTypeName, initAllStatics, integerValueOf, integerValueOf, integerValueOf, integerValueOf, integerValueOf, intValueOf, isBoxed, isCollectionValue, isEcore, isIntegerNumber, isIntegerValue, isRealNumber, isUnboxed, isUnlimited, longValueOf, numberValueOf, oclToString, realValueOf, realValueOf, realValueOf, realValueOf, realValueOf, shortValueOf, stringValueOf, throwBooleanInvalidValueException, throwInvalidValueException, throwUnsupportedCompareTo, toString, typedIterable, unlimitedNaturalValueOf, unlimitedNaturalValueOf, unlimitedNaturalValueOf, unlimitedNaturalValueOf, unlimitedNaturalValueOf
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
excluding, excludingAll, flatten, getKind, including, includingAll, isOrdered, isUnique, sort, toSequenceValue
asDouble, asElement, asInteger, asIntegerValue, asMapValue, asNavigableObject, asObjectValue, asOrderedCollectionValue, asRealValue, asTupleValue, asUnboxedObject, asUniqueCollectionValue, asUnlimitedNaturalValue, isInvalid, isUndefined
@NonNull public static org.eclipse.ocl.pivot.internal.values.CollectionValueImpl.NullIterator EMPTY_ITERATOR
@NonNull protected final CollectionTypeId typeId
@NonNull protected final java.util.Collection<? extends java.lang.Object> elements
protected CollectionValueImpl(@NonNull CollectionTypeId typeId, @NonNull java.util.Collection<? extends java.lang.Object> values)
public static void initStatics()
protected org.eclipse.emf.ecore.EClass eStaticClass()
eStaticClass
in class ValueImpl
protected boolean checkElementsAreUnique(java.lang.Iterable<? extends java.lang.Object> elements)
@NonNull public BagValue asBagValue()
The default implementation is appropriate for non-unique collections and must be overridden to support OCL rather than Java uniqueness semantics.
asBagValue
in interface Value
asBagValue
in class ValueImpl
@NonNull public java.util.Collection<? extends java.lang.Object> asCollection()
asCollection
in interface CollectionValue
@NonNull public CollectionValue asCollectionValue()
asCollectionValue
in interface Value
asCollectionValue
in class ValueImpl
@NonNull public java.util.List<java.lang.Object> asEcoreObject(@NonNull IdResolver idResolver, @Nullable java.lang.Class<?> instanceClass)
Value
A thrown exception for an invalid OCL value.
Java-null for a null OCL value
Objects for other things, List<?> for collections
asEcoreObject
in interface CollectionValue
asEcoreObject
in interface Value
asEcoreObject
in class ValueImpl
@Nullable public <T> java.util.List<T> asEcoreObjects(@NonNull IdResolver idResolver, @Nullable java.lang.Class<T> instanceClass)
asEcoreObjects
in interface CollectionValue
@NonNull public java.util.List<? extends java.lang.Object> asList()
@NonNull public OrderedSetValue asOrderedSetValue()
asOrderedSetValue
in interface Value
asOrderedSetValue
in class ValueImpl
@NonNull public SequenceValue asSequenceValue()
asSequenceValue
in interface Value
asSequenceValue
in class ValueImpl
@NonNull public SetValue asSetValue()
asSetValue
in interface Value
asSetValue
in class ValueImpl
@NonNull public IntegerValue count(@Nullable java.lang.Object value)
count
in interface CollectionValue
value
- an objectInvalidValueException
@NonNull public java.lang.Boolean excludes(@Nullable java.lang.Object value)
excludes
in interface CollectionValue
value
- an object@NonNull public java.lang.Boolean excludesAll(@NonNull CollectionValue c)
excludesAll
in interface CollectionValue
c
- another collectionpublic boolean flatten(@NonNull java.util.Collection<java.lang.Object> flattenedElements)
flatten
in interface CollectionValue
InvalidValueException
@NonNull public CollectionTypeId getBagTypeId()
@NonNull public TypeId getElementTypeId()
@NonNull public java.util.Collection<? extends java.lang.Object> getElements()
getElements
in interface CollectionValue
@NonNull public java.util.Collection<? extends java.lang.Object> getObject()
@NonNull public CollectionTypeId getOrderedSetTypeId()
@NonNull public CollectionTypeId getSequenceTypeId()
@NonNull public CollectionTypeId getSetTypeId()
@NonNull public CollectionTypeId getTypeId()
Value
getTypeId
in interface CollectionValue
getTypeId
in interface Value
public final int hashCode()
hashCode
in class java.lang.Object
@NonNull public java.lang.Boolean includes(@Nullable java.lang.Object value)
includes
in interface CollectionValue
@NonNull public java.lang.Boolean includesAll(@NonNull CollectionValue c)
includesAll
in interface CollectionValue
c
- another collectionpublic int intSize()
intSize
in interface CollectionValue
@NonNull public CollectionValue intersection(@NonNull CollectionValue that)
intersection
in interface CollectionValue
@NonNull public java.lang.Boolean isEmpty()
isEmpty
in interface CollectionValue
@NonNull public java.lang.Iterable<? extends java.lang.Object> iterable()
iterable
in interface CollectionValue
@NonNull public java.util.Iterator<java.lang.Object> iterator()
iterator
in interface java.lang.Iterable<java.lang.Object>
iterator
in interface CollectionValue
@NonNull public java.lang.Boolean notEmpty()
notEmpty
in interface CollectionValue
@NonNull public java.util.Set<TupleValue> product(@NonNull CollectionValue c, @NonNull TupleTypeId tupleTypeId)
product
in interface CollectionValue
@NonNull public IntegerValue size()
size
in interface CollectionValue
public java.lang.String toString()
toString
in class java.lang.Object
public void toString(@NonNull java.lang.StringBuilder s, int lengthLimit)
@NonNull public CollectionValue union(@NonNull CollectionValue that)
union
in interface CollectionValue