org.eclipse.ocl.examples.domain.values.impl
Class BagValueImpl

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<Bag<Value>>
              extended by org.eclipse.ocl.examples.domain.values.impl.BagValueImpl
All Implemented Interfaces:
java.lang.Iterable<Value>, BagValue, CollectionValue, Value
Direct Known Subclasses:
BagValueImpl.Accumulator

public class BagValueImpl
extends AbstractCollectionValue<Bag<Value>>
implements BagValue


Nested Class Summary
static class BagValueImpl.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
BagValueImpl(ValueFactory valueFactory, DomainCollectionType type, Bag<Value> elements)
           
BagValueImpl(ValueFactory valueFactory, DomainCollectionType type, java.util.Collection<? extends Value> elements)
           
BagValueImpl(ValueFactory valueFactory, DomainCollectionType type, Value... elements)
           
 
Method Summary
 BagValue asBagValue()
          Add a value to a working collection, returning true if the working collection is changed by the addition.
 boolean equals(java.lang.Object obj)
           
 BagValue excluding(Value value)
           
 BagValue flatten()
           
 java.lang.String getKind()
           
 BagValue including(Value value)
           
static BagValue intersection(ValueFactory valueFactory, DomainCollectionType type, CollectionValue left, CollectionValue right)
           
 SequenceValue sort(java.util.Comparator<Value> comparator)
           
 SequenceValue toSequenceValue()
           
 void toString(java.lang.StringBuilder s, int lengthLimit)
           
static BagValue union(ValueFactory valueFactory, DomainCollectionType type, CollectionValue left, CollectionValue right)
           
 
Methods inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractCollectionValue
asEcoreObject, asOrderedSetValue, asSequenceValue, 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, asList, 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, asList, 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
asBoolean, asBooleanValue, asCollectionValue, asDouble, asEcoreObject, asElement, asElementValue, asInteger, asIntegerValue, asNavigableObject, asObject, asObjectValue, asOrderedSetValue, asRealValue, asSequenceValue, 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

BagValueImpl

public BagValueImpl(ValueFactory valueFactory,
                    DomainCollectionType type,
                    Value... elements)

BagValueImpl

public BagValueImpl(ValueFactory valueFactory,
                    DomainCollectionType type,
                    java.util.Collection<? extends Value> elements)

BagValueImpl

public BagValueImpl(ValueFactory valueFactory,
                    DomainCollectionType type,
                    Bag<Value> elements)
Method Detail

intersection

public static BagValue intersection(ValueFactory valueFactory,
                                    DomainCollectionType type,
                                    CollectionValue left,
                                    CollectionValue right)
                             throws InvalidValueException
Throws:
InvalidValueException

union

public static BagValue union(ValueFactory valueFactory,
                             DomainCollectionType type,
                             CollectionValue left,
                             CollectionValue right)
                      throws InvalidValueException
Throws:
InvalidValueException

asBagValue

public BagValue asBagValue()
Description copied from class: AbstractCollectionValue
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 AbstractCollectionValue<Bag<Value>>

equals

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

excluding

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

flatten

public BagValue 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 BagValue including(Value value)
                   throws InvalidValueException
Specified by:
including in interface CollectionValue
Throws:
InvalidValueException

sort

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

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