public class LogicTuple extends java.lang.Object implements TupleTemplate, java.io.Serializable
TupleArgument
,
Tuple
,
TupleTemplate
,
Serialized FormConstructor and Description |
---|
LogicTuple() |
LogicTuple(java.lang.String name)
Constructs the logic tuple providing the tuple name, without arguments
|
LogicTuple(java.lang.String name,
TupleArgument t1)
Constructs the logic tuple providing the tuple name and one argument
|
LogicTuple(java.lang.String name,
TupleArgument[] list)
Constructs a logic tuple providing the tuple name and argument list
|
LogicTuple(java.lang.String name,
TupleArgument t1,
TupleArgument t2)
Constructs the logic tuple providing the tuple name and two arguments
|
LogicTuple(java.lang.String name,
TupleArgument t1,
TupleArgument t2,
TupleArgument t3)
Constructs the logic tuple providing the tuple name and three arguments
|
LogicTuple(java.lang.String name,
TupleArgument t1,
TupleArgument t2,
TupleArgument t3,
TupleArgument t4)
Constructs the logic tuple providing the tuple name and four arguments
|
LogicTuple(java.lang.String name,
TupleArgument t1,
TupleArgument t2,
TupleArgument t3,
TupleArgument t4,
TupleArgument t5)
Constructs the logic tuple providing the tuple name and five arguments
|
LogicTuple(java.lang.String name,
TupleArgument t1,
TupleArgument t2,
TupleArgument t3,
TupleArgument t4,
TupleArgument t5,
TupleArgument t6)
Constructs the logic tuple providing the tuple name and six arguments
|
LogicTuple(java.lang.String name,
TupleArgument t1,
TupleArgument t2,
TupleArgument t3,
TupleArgument t4,
TupleArgument t5,
TupleArgument t6,
TupleArgument t7)
Constructs the logic tuple providing the tuple name and seven arguments
|
LogicTuple(alice.tuprolog.Term t)
Constructs the logic tuple from a tuprolog term
|
LogicTuple(TupleArgument t)
Constructs the logic tuple from a tuple argument (free form of
construction)
|
Modifier and Type | Method and Description |
---|---|
TupleArgument |
getArg(int index)
Gets a argument inside the logic tuple
|
TupleArgument |
getArg(java.lang.String name)
Gets an argument (typically a structured value) given its name
|
int |
getArity()
Gets the number of arguments of this argument supposed to be a structure
|
java.lang.String |
getName()
Gets the name of the logic tuple
|
java.lang.String |
getPredicateIndicator()
Return a string that is the name and arity of the logic tuple in the
following format:
name/arity . |
TupleArgument |
getVarValue(java.lang.String varName)
Gets the argument linked to a variable inside the tuple.
|
boolean |
match(Tuple t)
specifies if the tuple template matches the tuple, or rather if tuples
belongs to the set identified by the template.
|
static LogicTuple |
parse(java.lang.String st)
Static service to get a Logic tuple from a textual representation
|
boolean |
propagate(Tuple t)
tries to change the tuple template object and the tuple argument in order
to meld information
|
java.lang.String |
toString()
Gets the string representation of the logic tuple
|
alice.tuprolog.Term |
toTerm()
Gets the Term representation of the logic tuple
|
public LogicTuple()
public LogicTuple(java.lang.String name)
name
- the name of the tuple (the functor)public LogicTuple(java.lang.String name, TupleArgument t1)
name
- the name of the tuple (the functor)t1
- the tuple argumentpublic LogicTuple(java.lang.String name, TupleArgument t1, TupleArgument t2)
name
- the name of the tuple (the functor)t1
- the first tuple argumentt2
- the second tuple argumentpublic LogicTuple(java.lang.String name, TupleArgument t1, TupleArgument t2, TupleArgument t3)
name
- the name of the tuple (the functor)t1
- the first tuple argumentt2
- the second tuple argumentt3
- the third tuple argumentpublic LogicTuple(java.lang.String name, TupleArgument t1, TupleArgument t2, TupleArgument t3, TupleArgument t4)
name
- the name of the tuple (the functor)t1
- the first tuple argumentt2
- the second tuple argumentt3
- the third tuple argumentt4
- the fourth tuple argumentpublic LogicTuple(java.lang.String name, TupleArgument t1, TupleArgument t2, TupleArgument t3, TupleArgument t4, TupleArgument t5)
name
- the name of the tuple (the functor)t1
- the first tuple argumentt2
- the second tuple argumentt3
- the third tuple argumentt4
- the fourth tuple argumentt5
- the fifth tuple argumentpublic LogicTuple(java.lang.String name, TupleArgument t1, TupleArgument t2, TupleArgument t3, TupleArgument t4, TupleArgument t5, TupleArgument t6)
name
- the name of the tuple (the functor)t1
- the first tuple argumentt2
- the second tuple argumentt3
- the third tuple argumentt4
- the fourth tuple argumentt5
- the fifth tuple argumentt6
- the sixth tuple argumentpublic LogicTuple(java.lang.String name, TupleArgument t1, TupleArgument t2, TupleArgument t3, TupleArgument t4, TupleArgument t5, TupleArgument t6, TupleArgument t7)
name
- the name of the tuple (the functor)t1
- the first tuple argumentt2
- the second tuple argumentt3
- the third tuple argumentt4
- the fourth tuple argumentt5
- the fifth tuple argumentt6
- the sixth tuple argumentt7
- the seventh tuple argumentpublic LogicTuple(java.lang.String name, TupleArgument[] list)
name
- the name of the tuple (the functor)list
- the list of tuple argumentpublic LogicTuple(alice.tuprolog.Term t)
t
- the tuprolog termpublic LogicTuple(TupleArgument t)
t
- the tuple argumentpublic static LogicTuple parse(java.lang.String st) throws InvalidLogicTupleException
st
- the text representing the tupleInvalidLogicTupleException
- if the text does not represent a valid logic tuplepublic TupleArgument getArg(int index)
index
- the position (index) of the argumentnull
otherwisepublic TupleArgument getArg(java.lang.String name)
name
- name of the argumentpublic int getArity()
public java.lang.String getName()
public java.lang.String getPredicateIndicator()
name/arity
. The method is applicable only if
this term is a structure.String
in the form nome/arity.public TupleArgument getVarValue(java.lang.String varName)
varName
- is the name of the variablepublic boolean match(Tuple t)
TupleTemplate
match
in interface TupleTemplate
t
- the tuple subject to matchingpublic boolean propagate(Tuple t)
TupleTemplate
propagate
in interface TupleTemplate
t
- a tuple matching the templatepublic java.lang.String toString()
toString
in class java.lang.Object
public alice.tuprolog.Term toTerm()