org.eclipse.ocl.examples.pivot.values.impl
Class TupleValueImpl

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.values.impl.AbstractValue
      extended by org.eclipse.ocl.examples.pivot.values.impl.TupleValueImpl
All Implemented Interfaces:
TupleValue, Value

public class TupleValueImpl
extends AbstractValue
implements TupleValue

UML implementation of a tuple value.

Author:
Christian W. Damus (cdamus)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.examples.pivot.values.Value
Value.BinaryOperation
 
Field Summary
 
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
TupleValueImpl(ValueFactory valueFactory, TupleType type, java.util.Map<? extends TypedElement,Value> values)
          Initializes me with a map of part values.
TupleValueImpl(ValueFactory valueFactory, TupleType type, Value firstValue, Value secondValue)
          Convenience constructor to initialize me with a pair of part values as required by the Collection::product() operation.
 
Method Summary
 java.lang.Object asObject()
           
 Value asValidValue()
           
 boolean equals(java.lang.Object o)
           
 TupleType getTupleType()
          Obtains the tuple's type.
 Type getType(TypeManager typeManager, Type staticType)
           
 Value getValue(Property part)
          Queries the value of the specified tuple part.
 Value getValue(java.lang.String partName)
          Queries the value of the specified tuple part.
 int hashCode()
           
 java.lang.String toString()
           
static java.lang.String toString(CollectionValue c)
          Computes the string representation of a collection value using syntax like OCL's collection literals (e.g., OrderedSet{...}) instead of Java's default (i.e., [...]).
 
Methods inherited from class org.eclipse.ocl.examples.pivot.values.impl.AbstractValue
asBagValue, asBoolean, asBooleanValue, asCollectionValue, asDouble, asElement, asElementValue, asInteger, asIntegerValue, asObjectValue, asOrderedCollectionValue, asOrderedSetValue, asRealValue, asSequenceValue, asSetValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, getValueFactory, isCollectionValue, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toRealValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.values.Value
asBagValue, asBoolean, asBooleanValue, asCollectionValue, asDouble, asElement, asElementValue, asInteger, asIntegerValue, asObjectValue, asOrderedCollectionValue, asOrderedSetValue, asRealValue, asSequenceValue, asSetValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, getValueFactory, isCollectionValue, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toRealValue, toString
 

Constructor Detail

TupleValueImpl

public TupleValueImpl(ValueFactory valueFactory,
                      TupleType type,
                      java.util.Map<? extends TypedElement,Value> values)
Initializes me with a map of part values.

Parameters:
type - my type
values - my parts

TupleValueImpl

public TupleValueImpl(ValueFactory valueFactory,
                      TupleType type,
                      Value firstValue,
                      Value secondValue)
Convenience constructor to initialize me with a pair of part values as required by the Collection::product() operation.

Parameters:
type - my type
firstValue - my first value
secondValue - my second value
Method Detail

asObject

public java.lang.Object asObject()
Specified by:
asObject in interface Value

asValidValue

public Value asValidValue()
Specified by:
asValidValue in interface Value

getTupleType

public TupleType getTupleType()
Description copied from interface: TupleValue
Obtains the tuple's type.

Specified by:
getTupleType in interface TupleValue
Returns:
its type

getValue

public Value getValue(java.lang.String partName)
Description copied from interface: TupleValue
Queries the value of the specified tuple part.

Specified by:
getValue in interface TupleValue
Parameters:
partName - the name of the part
Returns:
the corresponding value

getValue

public Value getValue(Property part)
Description copied from interface: TupleValue
Queries the value of the specified tuple part.

Specified by:
getValue in interface TupleValue
Parameters:
part - the tuple part (as an attribute)
Returns:
the corresponding value

equals

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

getType

public Type getType(TypeManager typeManager,
                    Type staticType)
Specified by:
getType in interface Value

hashCode

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public static java.lang.String toString(CollectionValue c)
Computes the string representation of a collection value using syntax like OCL's collection literals (e.g., OrderedSet{...}) instead of Java's default (i.e., [...]).

Parameters:
c - a collection (not null)
Returns:
the string representation of the specified collection
Since:
1.2