Business Objects
Quark Platform Documentation
Version 1.7.1_0
Business Objects

org.openquark.cal.foreignsupport.module.Prelude
Class AlgebraicValue

java.lang.Object
  extended by org.openquark.cal.foreignsupport.module.Prelude.AlgebraicValue

public abstract class AlgebraicValue
extends Object

Base class for supporting CAL types with derived instances of Prelude.Inputable or Prelude.Outputable. Values of such types will output to a Java object of type AlgebraicValue.

Author:
Bo Ilic

Method Summary
 String getDataConstructorName()
           
 int getDataConstructorOrdinal()
           
 QualifiedName getName()
           
abstract  int getNArguments()
           
abstract  Object getNthArgument(int argN)
           
static AlgebraicValue makeGeneralAlgebraicValue(QualifiedName dataConstructorName, int dataConstructorOrdinal, List<?> argumentValuesList)
          Factory method for general AlgebraicValue objects.
static AlgebraicValue makeGeneralAlgebraicValue(String dataConstructorName, int dataConstructorOrdinal, List<?> argumentValues)
          Factory method for general AlgebraicValue objects.
static AlgebraicValue makeSingleArgumentAlgebraicValue(QualifiedName dataConstructorName, int dataConstructorOrdinal, Object argumentValue)
          Single-argument-datacons factory method for AlgebraicValue objects.
static AlgebraicValue makeSingleArgumentAlgebraicValue(String dataConstructorName, int dataConstructorOrdinal, Object argumentValue)
          Single-argument-datacons factory method for AlgebraicValue objects.
static AlgebraicValue makeZeroArgumentAlgebraicValue(QualifiedName dataConstructorName, int dataConstructorOrdinal)
          Zero-argument-datacons factory method for AlgebraicValue objects.
static AlgebraicValue makeZeroArgumentAlgebraicValue(String dataConstructorName, int dataConstructorOrdinal)
          Zero-argument-datacons factory method for AlgebraicValue objects.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

makeZeroArgumentAlgebraicValue

public static AlgebraicValue makeZeroArgumentAlgebraicValue(QualifiedName dataConstructorName,
                                                            int dataConstructorOrdinal)
Zero-argument-datacons factory method for AlgebraicValue objects.

Parameters:
dataConstructorName - QualifiedName of the data constructor that constructs this value
dataConstructorOrdinal - Index of the data constructor that constructs this value
Returns:
An AlgebraicValue object that represents the value returned by the specified data constructor

makeZeroArgumentAlgebraicValue

public static AlgebraicValue makeZeroArgumentAlgebraicValue(String dataConstructorName,
                                                            int dataConstructorOrdinal)
Zero-argument-datacons factory method for AlgebraicValue objects.

Parameters:
dataConstructorName - Fully-qualified name of the data constructor (that constructs this value (eg "Cal.Core.Prelude.Just")
dataConstructorOrdinal - Ordinal of the data constructor that constructs this value
Returns:
An AlgebraicValue object that represents the value returned by the specified data constructor

makeSingleArgumentAlgebraicValue

public static AlgebraicValue makeSingleArgumentAlgebraicValue(QualifiedName dataConstructorName,
                                                              int dataConstructorOrdinal,
                                                              Object argumentValue)
Single-argument-datacons factory method for AlgebraicValue objects.

Parameters:
dataConstructorName - QualifiedName of the data constructor that constructs this value
dataConstructorOrdinal - Index of the data constructor that constructs this value
argumentValue - The single argument to the data constructor
Returns:
An AlgebraicValue object that represents the value returned by applying the specified argument to the specified data constructor

makeSingleArgumentAlgebraicValue

public static AlgebraicValue makeSingleArgumentAlgebraicValue(String dataConstructorName,
                                                              int dataConstructorOrdinal,
                                                              Object argumentValue)
Single-argument-datacons factory method for AlgebraicValue objects.

Parameters:
dataConstructorName - Fully-qualified name of the data constructor (that constructs this value (eg "Cal.Core.Prelude.Just")
dataConstructorOrdinal - Ordinal of the data constructor that constructs this value
argumentValue - The single argument to the data constructor
Returns:
An AlgebraicValue object that represents the value returned by applying the specified argument to the specified data constructor

makeGeneralAlgebraicValue

public static AlgebraicValue makeGeneralAlgebraicValue(QualifiedName dataConstructorName,
                                                       int dataConstructorOrdinal,
                                                       List<?> argumentValuesList)
Factory method for general AlgebraicValue objects.

Parameters:
dataConstructorName - QualifiedName of the data constructor that constructs this value
dataConstructorOrdinal - Index of the data constructor that constructs this value
argumentValuesList - List (Object) of arguments to the data constructor
Returns:
An AlgebraicValue object that represents the value returns by applying the specified arguments to the specified data constructor

makeGeneralAlgebraicValue

public static AlgebraicValue makeGeneralAlgebraicValue(String dataConstructorName,
                                                       int dataConstructorOrdinal,
                                                       List<?> argumentValues)
Factory method for general AlgebraicValue objects.

Parameters:
dataConstructorName - Fully-qualified name of the data constructor (that constructs this value (eg "Cal.Core.Prelude.Just")
dataConstructorOrdinal - Ordinal of the data constructor that constructs this value
argumentValues - List (Object) of arguments to the data constructor
Returns:
An AlgebraicValue object that represents the value returned by applying the specified arguments to the specified data constructor

getName

public final QualifiedName getName()
Returns:
name of the data constructor corresponding to this algebraic value.

getDataConstructorName

public final String getDataConstructorName()
Returns:
name of the data constructor corresponding to this value expanded to a String.

getDataConstructorOrdinal

public final int getDataConstructorOrdinal()
Returns:
ordinal of the data constructor corresponding to this value

getNArguments

public abstract int getNArguments()
Returns:
number of arguments that this data constructor is holding.

getNthArgument

public abstract Object getNthArgument(int argN)
Parameters:
argN - zero-based index to an argument held by this data constructor.
Returns:
argument value corresponding the argNth argument.

toString

public final String toString()

Overrides:
toString in class Object

Business Objects
Quark Platform Documentation
Version 1.7.1_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.