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

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

public class SetValueImpl
extends AbstractCollectionValue<java.util.Set<Value>>
implements SetValue


Nested Class Summary
static class SetValueImpl.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
SetValueImpl(ValueFactory valueFactory, DomainCollectionType type, java.util.Collection<? extends Value> elements)
           
SetValueImpl(ValueFactory valueFactory, DomainCollectionType type, java.util.Set<Value> elements)
           
SetValueImpl(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.
 SetValue asSetValue()
           
 UniqueCollectionValue asUniqueCollectionValue()
           
 boolean equals(java.lang.Object obj)
           
 SetValue excluding(Value value)
           
 SetValue flatten()
           
 java.lang.String getKind()
           
 SetValue including(Value value)
           
static SetValue intersection(ValueFactory valueFactory, DomainCollectionType type, CollectionValue left, CollectionValue right)
           
 SetValue minus(UniqueCollectionValue set)
           
 OrderedSetValue sort(java.util.Comparator<Value> comparator)
           
 SetValue symmetricDifference(UniqueCollectionValue set)
           
 SequenceValue toSequenceValue()
           
 void toString(java.lang.StringBuilder s, int lengthLimit)
           
static SetValue union(ValueFactory valueFactory, DomainCollectionType type, CollectionValue left, CollectionValue right)
           
 
Methods inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractCollectionValue
asEcoreObject, asOrderedSetValue, asSequenceValue, 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, 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, asString, asStringValue, asTypeValue, asValidValue, getActualType, getType, getValueFactory, isCollectionValue, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toIteratorValue, toRealValue
 

Constructor Detail

SetValueImpl

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

SetValueImpl

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

SetValueImpl

public SetValueImpl(ValueFactory valueFactory,
                    DomainCollectionType type,
                    java.util.Set<Value> elements)
Method Detail

intersection

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

union

public static SetValue 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<java.util.Set<Value>>

asUniqueCollectionValue

public UniqueCollectionValue asUniqueCollectionValue()
Specified by:
asUniqueCollectionValue in interface Value
Overrides:
asUniqueCollectionValue in class AbstractValue

asSetValue

public SetValue asSetValue()
Specified by:
asSetValue in interface Value
Overrides:
asSetValue in class AbstractCollectionValue<java.util.Set<Value>>

equals

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

excluding

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

flatten

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

minus

public SetValue minus(UniqueCollectionValue set)
               throws InvalidValueException
Specified by:
minus in interface UniqueCollectionValue
Throws:
InvalidValueException

sort

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

symmetricDifference

public SetValue symmetricDifference(UniqueCollectionValue set)
Specified by:
symmetricDifference in interface UniqueCollectionValue

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