Jalog 1.4


io.github.JalogTeam.jalog
Class Pro_TermData

java.lang.Object
  extended by io.github.JalogTeam.jalog.Pro_TermData
Direct Known Subclasses:
Pro_TermData_Char, Pro_TermData_Compound, Pro_TermData_Integer, Pro_TermData_List, Pro_TermData_Real, Pro_TermData_String, Pro_TermData_Unified

public abstract class Pro_TermData

All data and programs are represented as Pro_Term objects. Every Pro_Term object has a pointer to a Pro_TermData object that contains the associated data.

For each data type there is a subclass of this class. In addition there is the subclass Pro_TermData_Unified to indicate that the data is the same as in another term.


 

Field Summary
String typename
           Type of the term
 
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.
abstract String toString()
           Returns Jalog syntax representation of this term.
 

Field Detail

typename

public String typename
The type of this term. Type is one of the fields of the class Jalog. This is set in the subclass constructor. Do not change!


Method Detail

copy

public static Pro_Term 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 must be overridden in subclass if the data value may contain subterms. In the overridden method the possible subterms must be copied using the parameter variable_map, e.g.

    if (t1 != null) {
      new_t1 = t1.copy(variable_map);
    }
The copy method of Pro_Term may return the original object. If this happens for all subterms the original Pro_TermData object this should be returned. Otherwise a new Pro_TermData object must be 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()
A subclass may override this method to return a human readable string representation of this term. By default the Jalog syntax representation returned by toString is used. Used by built-in predicate write.


toString

public abstract String toString()
Every subclass must override this method to return the Jalog syntax representation of this term.

Returns:
Jalog syntax representation of this term.

Authors: Mikko Levanto, Ari Okkonen