Jalog 1.4


io.github.JalogTeam.jalog
Class Pro_TermData_String

java.lang.Object
  extended by io.github.JalogTeam.jalog.Pro_TermData
    extended by io.github.JalogTeam.jalog.Pro_TermData_String
Direct Known Subclasses:
Pro_TermData_String_concat, Pro_TermData_String_simple, Pro_TermData_String_substring

public abstract class Pro_TermData_String

Note: Don't use this class unless you need some operations or fields that the class Pro_Term does not provide.

String constants are represented as Pro_TermData_String objects.

All character indices start from 0.


Field Summary
long len
           Number of characters
String typename
           The type of this term. This is always set to Jalog.STRING. Do not change! (Inherited from parent.)
 
Method Summary
static int compare_strings(Pro_TermData_String s1, Pro_TermData_String s2)
           Compares the strings.
static boolean contains_at(Pro_TermData_String s1, long pos, Pro_TermData_String s2)
           Returns true if the string s1 contains at pos a substring that is equal to s2.
Pro_TermData copy(Hashtable variable_map)
           Returns this object. (Inherited from parent.)
abstract String image()
           Returns human readable string representation of this term, i.e. the value of this as a Java String object.
String substring(long start, long len)
           Returns the selected part of the string as a Java String.
String toString()
           Returns Jalog syntax representation of this term.
 

Field Detail

len

public long len
Number of characters.

Method Detail

compare_strings

public static int compare_strings(Pro_TermData_String s1, Pro_TermData_String s2)

Compares the strings.

Strings are compared from the beginning by character codes. If the strings are equal zero is returned. A negative integer is returned if the first string precedes the second string in the character code order. Otherwise a positive integer is returned.

Parameters:
s1 - the first string
s2 - the second string
Returns:
the comparison result

contains_at

public static boolean contains_at(Pro_TermData_String s1, long pos, Pro_TermData_String s2)

Returns true if the string s1 contains at pos a substring that is equal to s2.

Parameters:
s1 - possibly containing string
pos - zero based position index
s2 - possible substring
Returns:
true if contains

image

public String image()
Returns human readable string representation of this term, i.e. the value of this as a Java String object. Used by built-in predicate write.

Returns:
contents of the string as a Java String

substring

public abstract String substring(long start, long len)
Returns the selected part of the string as a Java String. If start is negative or len is too large, the result string is shorter than len.

Parameters:
start - zero based index to first character to include
len - number of characters to include
Returns:
the specified substring as a Java String.

toString

public String toString()
Returns Jalog syntax representation of this term. The result is enclosed in quotes. Non-ASCII and special characters are escaped with the backslash character ‟\”.

Returns:
Jalog syntax representation of this term.

Authors: Mikko Levanto, Ari Okkonen