alice.logictuple
Class TupleArgument

java.lang.Object
  |
  +--alice.logictuple.TupleArgument
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Value, Var

public class TupleArgument
extends java.lang.Object
implements java.io.Serializable

Defines an argument of logic tuple. The argument can be a value (Value class) or a variable (Var class). The argument can be constructed using Value or Var - which are used only as constructor classes; instead, the services about argument management are provided by this class

See Also:
LogicTuple, Value, Var, Serialized Form

Field Summary
protected  alice.tuprolog.Term value
          the internal representation of the argument is a (tu)Prolog term
 
Constructor Summary
TupleArgument()
           
TupleArgument(java.lang.Object t)
          Constructs an argument using a generic object
TupleArgument(alice.tuprolog.Term t)
          Contructs a tuple argument copying a Prolog term
 
Method Summary
 TupleArgument getArg(int index)
          gets the i-arg Arg of a structured argument
 int getArity()
          gets the number of argument of a structured argument
 float getFloat(int index)
          Helper service to get directly a float argument inside this argument object considered as a compound value
 int getInt(int index)
          Helper service to get directly an integer argument inside this argument object considered as a compound value
 java.lang.String getName()
          gets the name of the arg
 java.lang.String getString(int index)
          Helper service to get directly a string argument inside this argument object considered as a compound value
 boolean isFloat()
          Tests if the argument is a float
 boolean isInt()
          Tests if the argument is an integer
 boolean isNumber()
          Tests if the argument is a number
 boolean isString()
          Tests if the argument is a string
 boolean isStruct()
          Tests if the argument is a structured argument
 boolean isValue()
          Tests if the argument is a value
 boolean isVar()
          Tests if the argument is a variable
 java.lang.String toString()
          Gets the string representation of the argument
 alice.tuprolog.Term toTerm()
          Gets the prolog term representation of the argument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected alice.tuprolog.Term value
the internal representation of the argument is a (tu)Prolog term
Constructor Detail

TupleArgument

public TupleArgument()

TupleArgument

public TupleArgument(alice.tuprolog.Term t)
Contructs a tuple argument copying a Prolog term
Parameters:
t - the Prolog term whose content is used to build the argument

TupleArgument

public TupleArgument(java.lang.Object t)
Constructs an argument using a generic object
Parameters:
t - the object used to construct the argument
Method Detail

isVar

public boolean isVar()
Tests if the argument is a variable

isValue

public boolean isValue()
Tests if the argument is a value

isString

public boolean isString()
Tests if the argument is a string

isNumber

public boolean isNumber()
Tests if the argument is a number

isInt

public boolean isInt()
Tests if the argument is an integer

isFloat

public boolean isFloat()
Tests if the argument is a float

isStruct

public boolean isStruct()
Tests if the argument is a structured argument

toTerm

public alice.tuprolog.Term toTerm()
Gets the prolog term representation of the argument

toString

public java.lang.String toString()
Gets the string representation of the argument
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
gets the name of the arg

getArg

public TupleArgument getArg(int index)
gets the i-arg Arg of a structured argument

getArity

public int getArity()
gets the number of argument of a structured argument

getString

public java.lang.String getString(int index)
Helper service to get directly a string argument inside this argument object considered as a compound value
Parameters:
index - the position (index) of the string argument
Returns:
the argument if it exists, null otherwise

getInt

public int getInt(int index)
Helper service to get directly an integer argument inside this argument object considered as a compound value
Parameters:
index - the position (index) of the integer argument
Returns:
the integer value if it exists

getFloat

public float getFloat(int index)
Helper service to get directly a float argument inside this argument object considered as a compound value
Parameters:
index - the position (index) of the integer argument
Returns:
the float value if it exists