Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

org.openquark.cal.valuenode
Class AbstractRecordValueNode

java.lang.Object
  extended by org.openquark.cal.valuenode.ValueNode
      extended by org.openquark.cal.valuenode.AlgebraicValueNode
          extended by org.openquark.cal.valuenode.AbstractRecordValueNode
Direct Known Subclasses:
NTupleValueNode, RecordValueNode

public abstract class AbstractRecordValueNode
extends AlgebraicValueNode

Abstract AlgebraicValueNode for handling values whose type expr is a RecordType.

Author:
Edward Lam

Constructor Summary
AbstractRecordValueNode(TypeExpr typeExpr)
          Constructor for an AbstractRecordValueNode.
 
Method Summary
abstract  FieldName getFieldName(int i)
          Get the name of the ith field in the record Note: Fields are indexed by the ordering on the FieldName class.
abstract  List<FieldName> getFieldNames()
           
abstract  TypeExpr getFieldTypeExpr(FieldName fieldName)
          Get the type expression of the ith field
abstract  int getNFieldNames()
           
protected  TypeExpr getNonParametricType()
          this returns the type of the record as a non parametric type.
static RecordType getRecordTypeForRenamedField(TypeExpr typeExpr, FieldName oldFieldName, FieldName newFieldName)
          Create a new record type from the current type, but having extra field newFieldName, and missing the field oldFieldName.
abstract  ValueNode getValueAt(int n)
          Retrieve the value node representing the nth field in the record.
 AbstractRecordValueNode renameField(FieldName fieldName, FieldName newFieldName, ValueNodeBuilderHelper builderHelper, ValueNodeTransformer transformer)
          Renames a field of this value node.
abstract  void setValueNodeAt(int i, ValueNode valueNode)
          Set the value node of the ith field.
 
Methods inherited from class org.openquark.cal.valuenode.AlgebraicValueNode
transmuteValueNode
 
Methods inherited from class org.openquark.cal.valuenode.ValueNode
checkCopyType, checkTypeConstructorName, containsParametricValue, copyValueNode, copyValueNode, getCALSourceModel, getCALValue, getInputJavaValues, getInputPolicy, getOutputPolicy, getTextValue, getTypeExpr, getValue, sameValue, setOutputJavaValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractRecordValueNode

public AbstractRecordValueNode(TypeExpr typeExpr)
Constructor for an AbstractRecordValueNode.

Parameters:
typeExpr - the TypeExpr of the data value which this ValueNode represents.
Method Detail

getValueAt

public abstract ValueNode getValueAt(int n)
Retrieve the value node representing the nth field in the record. Note: Fields are indexed alphabetically

Parameters:
n - number of field
Returns:
ValueNode

getNFieldNames

public abstract int getNFieldNames()
Returns:
the number of fields that the record is asserted to have.

getFieldName

public abstract FieldName getFieldName(int i)
Get the name of the ith field in the record Note: Fields are indexed by the ordering on the FieldName class.

Parameters:
i - index of field to retrieve
Returns:
FieldName

getFieldNames

public abstract List<FieldName> getFieldNames()
Returns:
of record field names

getFieldTypeExpr

public abstract TypeExpr getFieldTypeExpr(FieldName fieldName)
Get the type expression of the ith field

Parameters:
fieldName -
Returns:
TypeExpr

setValueNodeAt

public abstract void setValueNodeAt(int i,
                                    ValueNode valueNode)
Set the value node of the ith field.

Parameters:
i - the index for the field within the record.
valueNode - the new value node for the ith field in the record.

renameField

public AbstractRecordValueNode renameField(FieldName fieldName,
                                           FieldName newFieldName,
                                           ValueNodeBuilderHelper builderHelper,
                                           ValueNodeTransformer transformer)
Renames a field of this value node. This function transmutes the record value node to a new type which contains the new field but not the old. The value of this field is preserved in the process. Ex: Rename field "age" to "height" in record {age=1.0, code="Ras"} produces record {code="Ras", height=1.0}

Parameters:
fieldName - name of field to rename
newFieldName - new name of field
builderHelper -
transformer -
Returns:
RecordValueNode with the field renamed

getNonParametricType

protected final TypeExpr getNonParametricType()
this returns the type of the record as a non parametric type. It is used for the value node input policies, as there is no reason to input a parametric input

Returns:
non parametric record type

getRecordTypeForRenamedField

public static RecordType getRecordTypeForRenamedField(TypeExpr typeExpr,
                                                      FieldName oldFieldName,
                                                      FieldName newFieldName)
Create a new record type from the current type, but having extra field newFieldName, and missing the field oldFieldName.

Parameters:
typeExpr - the record type on which the new type will be based.
oldFieldName - the field name to be replaced.
newFieldName - the field name with which to replace the old field name.
Returns:
the new record type.

Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.