Jalog 1.4


io.github.JalogTeam.jalog
Class Pro_TermData_Compound

java.lang.Object
  extended by io.github.JalogTeam.jalog.Pro_TermData
    extended by io.github.JalogTeam.jalog.Pro_TermData_Compound

public class Pro_TermData_Compound

Rules, mathematical operations, compound objects and symbols are represented as Pro_TermData_Compound objects.


Field Summary
byte arity
           Number of subterms. 0 for symbols
String name
           Functor
Pro_Term[] subterm
           Array of subterms
String typename
           Type of the term
 
Constructor Summary
Pro_TermData_Compound(String iniName)
           Constructs a Pro_TermData_Compound object without subterms (a symbol).
Pro_TermData_Compound(String iniName, Pro_Term[] iniSubterm)
           Constructs a Pro_TermData_Compound object.
Pro_TermData_Compound(String iniName, Pro_Term sub)
           Constructs a Pro_TermData_Compound object.
Pro_TermData_Compound(String iniName, Pro_Term left, Pro_Term right)
           Constructs a Pro_TermData_Compound object.
 
Method Summary
Pro_TermData copy(Hashtable variable_map)
           Returns an independent copy this of term using variable_map.
String image()
           Returns human readable string representation of this term.
String toString()
           Returns Jalog syntax representation of this term.
 

Field Detail

arity

public byte arity
Number of subterms. 0 for symbols. Set in constructor. Usually no need to change. Must equal to the length of subterm array.

name

public String name
Functor of the term. Set in constructor. Usually no need to change.

subterm

public String subterm
Array for subterms. Set in constructor. Usually no need to change. Length of the array must match arity

typename

public String typename
The type of this term. Type is one of the fields of the class Jalog: Jalog.SYMBOL if there are no subterms or Jalog.COMPOUND otherwise. This is set in the subclass constructor. Do not change!
Constructor Detail

Pro_TermData_Compound

public Pro_TermData_Compound(String iniName)
Constructs a Pro_TermData_Compound object representing the symbol iniName.

Parameters:
iniName - the functor.

Pro_TermData_Compound

public Pro_TermData_Compound(String iniName, Pro_Term[] iniSubterm)
Constructs a Pro_TermData_Compound object with subterms from iniSubterm array. If iniSubterm is null or an empty array then a SYMBOL with iniName is constructed.

Parameters:
iniName - the functor.
iniSubterm - array of subterms or null.

Pro_TermData_Compound

public Pro_TermData_Compound(String iniName, Pro_Term sub)
Constructs a Pro_TermData_Compound object with subterm sub.

Parameters:
iniName - the functor.
sub - the subterm. Must not be null.

Pro_TermData_Compound

public Pro_TermData_Compound(String iniName, Pro_Term left, Pro_Term right)
Constructs a Pro_TermData_Compound object with subterms left and right.

Parameters:
iniName - the functor.
left - the first subterm. Must not be null.
right - the the second subterm. Must not be null.
Method Detail

copy

public Pro_TermData copy(Hashtable variable_map)
Returns a copy this term data using variable_map. Hashtable is used to map repeated open terms to repeated open terms. Hashtable is updated for new open terms. Used in database asserting and fetching.

This method copies all subterms using the copy method of Pro_Term. The copy method of Pro_Term may return the original object. If this happens for all subterms the original Pro_TermData_Compound object then this is returned. Otherwise a new Pro_TermData_Compound object is created and returned.

Parameters:
variable_map - contains open variable mapping for this term.
Returns:
a copy this term data using variable_map.

image

public String image()
Returns human readable string representation of this term. Used by built-in predicate write.


toString

public String toString()
Returns Jalog syntax representation of this term.

Returns:
Jalog syntax representation of this term.

Authors: Mikko Levanto, Ari Okkonen