Operator

public class Operator

An operator of Abstract Syntax Trees.

Fields

ATOM_INT_ARITY

public static final int ATOM_INT_ARITY

For atomic operator with an int.

ATOM_STRING_ARITY

public static final int ATOM_STRING_ARITY

For atomic operator with a String.

LIST_ARITY

public static final int LIST_ARITY

For list arity operator.

arity

public final int arity

The arity of this operator.

Convention: normal fixed arities range in [0,+inf[;
Arity LIST_ARITY = -1 stands for list arity;
Arity ATOM_INT_ARITY = -2 stands for atomic operator with an int;
Arity ATOM_STRING_ARITY = -3 stands for atomic operator with a String.

childrenPhyla

protected final int[] childrenPhyla

The required phyla for the children.

code

public final int code

A unique integer code for this Operator, which is its rank in the list of all the language’s Operator’s.

name

public final String name

The name of this Operator.

Constructors

Operator

public Operator(String nameStr, int code, int arity, int[] phyla)

Methods

isAtom

public boolean isAtom()
Returns

True when this Operator is an atom.

isFixed

public boolean isFixed()
Returns

True when this is a fixed-arity Operator.

isIntAtom

public boolean isIntAtom()
Returns

True when this Operator is an integer-valued atom.

isList

public boolean isList()
Returns

True when this is a list-arity Operator.

isStringAtom

public boolean isStringAtom()
Returns

True when this Operator is a String-valued atom.

toString

public String toString()

tree

public Tree tree()

Build a Tree with this Operator.

Returns

a new, empty, Tree node with this Operator.

writeToILFile

public void writeToILFile(BufferedWriter fileWriter)