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

java.lang.Object
  extended by org.eclipse.ocl.examples.domain.values.impl.AbstractValue
      extended by org.eclipse.ocl.examples.domain.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)

Field Summary
protected  DomainTupleType 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
TupleValueImpl(ValueFactory valueFactory, DomainTupleType type, java.util.Map<? extends DomainTypedElement,Value> values)
          Initializes me with a map of part values.
TupleValueImpl(ValueFactory valueFactory, DomainTupleType 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)
           
 DomainTupleType getType()
          Obtains the tuple's type.
 Value getValue(DomainTypedElement 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()
           
 
Methods inherited from class org.eclipse.ocl.examples.domain.values.impl.AbstractValue
asBagValue, asBoolean, asBooleanValue, asCollectionValue, asDouble, asEcoreObject, asElement, asElementValue, asInteger, asIntegerValue, asNavigableObject, asObjectValue, asOrderedSetValue, asRealValue, asSequenceValue, asSetValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, getActualType, getValueFactory, isCollectionValue, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toIteratorValue, 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.domain.values.Value
asBagValue, asBoolean, asBooleanValue, asCollectionValue, asDouble, asEcoreObject, asElement, asElementValue, asInteger, asIntegerValue, asNavigableObject, asObjectValue, asOrderedSetValue, asRealValue, asSequenceValue, asSetValue, asString, asStringValue, asTypeValue, asUniqueCollectionValue, getActualType, getValueFactory, isCollectionValue, isFalse, isIntegerValue, isInvalid, isNull, isRealValue, isTrue, isUndefined, isUnlimited, isUnlimitedNatural, oclToString, toIntegerValue, toIteratorValue, toRealValue, toString
 

Field Detail

type

protected final DomainTupleType type
Constructor Detail

TupleValueImpl

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

Parameters:
type - my type
values - my parts

TupleValueImpl

public TupleValueImpl(ValueFactory valueFactory,
                      DomainTupleType 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

equals

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

getType

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

Specified by:
getType in interface TupleValue
Specified by:
getType in interface Value
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(DomainTypedElement 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

hashCode

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

toString

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