uk.ac.bbk.dcs.automed.qproc
Class Cell

java.lang.Object
  |
  +--uk.ac.bbk.dcs.automed.qproc.Cell

public class Cell
extends java.lang.Object

Every node in an ASG is a Cell, so one has to use this class in order to perform any operations on an ASG


Field Summary
static int apply
           
static int constant
           
static int constructor
           
static int function
           
static int lambda
           
static int scheme
           
static int special
           
static int sysvariable
           
static int variable
           
 
Constructor Summary
Cell(int snum, java.lang.Object sdata)
           
Cell(int snum, java.lang.Object lRef, java.lang.Object rRef)
           
Cell(int snum, java.lang.Object lRef, java.lang.Object rRef, java.lang.Object sdata)
           
Cell(java.lang.Object lRef, java.lang.Object rRef)
           
Cell(java.lang.String sdata)
           
 
Method Summary
 Cell copyOfGraph()
          Returns an exact copy of the ASG
 java.lang.Object data()
          Returns the Object contained in the Cell
 double getDouble()
          Returns the value of the double contained in the Cell
 boolean isApply()
          Returns true if tag is apply
 boolean isConsConstructor()
          Returns true if tag is "Cons"
 boolean isConstant()
          Returns true if tag is constant
 boolean isConstructor()
          Returns true if tag is constructor
 boolean isFunction()
          Returns true if tag is function
 boolean isLambda()
          Returns true if tag is lambda
 boolean isNilConstructor()
          Returns true if tag is "Nil"
 boolean isNum()
          Returns true if the Cell contains a double
 boolean isScheme()
          Returns true if tag is scheme
 boolean isSpecial()
          Returns true if tag is special
 boolean isSysVariable()
          Returns true if tag is sysvariable
 boolean isVariable()
          Returns true if tag is variable
 Cell l()
          Returns a reference to the left child of the Cell
 void mimicThisCell(Cell n)
          Returns an exact copy of the input Cell
 boolean newScope()
           
 Cell r()
          Returns a reference to the right child of the Cell
 boolean representsComprehension()
          Returns true if the Cell is the root of an ASG representing a comprehension
 boolean representsGenerator()
          Returns true if the Cell is the root of an ASG representing a generator
 boolean representsList()
          Returns true if the Cell is the root of an ASG representing a list
 boolean representsPair()
          Returns true if tag is "Tuple2"
 boolean representsSingleton()
           
 boolean representsTuple()
          Returns true if the Cell is the root of an ASG representing a Tuple
 void set_l(Cell n)
          Sets the reference to the left child of the Cell to n
 void set_r(Cell n)
          Sets the reference to the left child of the Cell to n
 void setData(java.lang.Object newData)
          Sets the Cell's data
 void setNewScope()
           
 Cell singleton()
          Returns the root of an ASG representing an empty list
 int tag()
          Returns the Cell's tag
 java.lang.String text()
          Returns the string representation of the object contained in the Cell
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

apply

public static int apply

lambda

public static int lambda

constant

public static int constant

scheme

public static int scheme

constructor

public static int constructor

variable

public static int variable

function

public static int function

special

public static int special

sysvariable

public static int sysvariable
Constructor Detail

Cell

public Cell(int snum,
            java.lang.Object lRef,
            java.lang.Object rRef,
            java.lang.Object sdata)
Parameters:
snum - designates the type of the Cell. Possible values: apply, lambda, constant, identifier, scheme, constructor, variable, function, special, sysvariable
lRef - reference to the Cell's left child
rRef - reference to the Cell's right child
sdata - Object container, whose value depends on snum. Possible values: apply:null, lambda:lambda, constant:(integer, String, ...), scheme:(String), constructor:(String, for example Cons, Tuple2, ...), variable:(String, e.g. x, y, ...), function:(function name), special:Let, sysvariable:(wrapper object)

Cell

public Cell(int snum,
            java.lang.Object lRef,
            java.lang.Object rRef)

Cell

public Cell(int snum,
            java.lang.Object sdata)

Cell

public Cell(java.lang.Object lRef,
            java.lang.Object rRef)

Cell

public Cell(java.lang.String sdata)
Method Detail

text

public java.lang.String text()
Returns the string representation of the object contained in the Cell


data

public java.lang.Object data()
Returns the Object contained in the Cell


isNum

public boolean isNum()
Returns true if the Cell contains a double


getDouble

public double getDouble()
Returns the value of the double contained in the Cell


tag

public int tag()
Returns the Cell's tag


l

public Cell l()
Returns a reference to the left child of the Cell


r

public Cell r()
Returns a reference to the right child of the Cell


set_l

public void set_l(Cell n)
Sets the reference to the left child of the Cell to n


set_r

public void set_r(Cell n)
Sets the reference to the left child of the Cell to n


setData

public void setData(java.lang.Object newData)
Sets the Cell's data


mimicThisCell

public void mimicThisCell(Cell n)
Returns an exact copy of the input Cell


copyOfGraph

public Cell copyOfGraph()
Returns an exact copy of the ASG


singleton

public Cell singleton()
Returns the root of an ASG representing an empty list


isApply

public boolean isApply()
Returns true if tag is apply


isLambda

public boolean isLambda()
Returns true if tag is lambda


isConstant

public boolean isConstant()
Returns true if tag is constant


isScheme

public boolean isScheme()
Returns true if tag is scheme


isConstructor

public boolean isConstructor()
Returns true if tag is constructor


isVariable

public boolean isVariable()
Returns true if tag is variable


isSpecial

public boolean isSpecial()
Returns true if tag is special


isFunction

public boolean isFunction()
Returns true if tag is function


isSysVariable

public boolean isSysVariable()
Returns true if tag is sysvariable


isNilConstructor

public boolean isNilConstructor()
Returns true if tag is "Nil"


isConsConstructor

public boolean isConsConstructor()
Returns true if tag is "Cons"


representsComprehension

public boolean representsComprehension()
Returns true if the Cell is the root of an ASG representing a comprehension


representsGenerator

public boolean representsGenerator()
Returns true if the Cell is the root of an ASG representing a generator


representsPair

public boolean representsPair()
Returns true if tag is "Tuple2"


representsTuple

public boolean representsTuple()
Returns true if the Cell is the root of an ASG representing a Tuple


representsList

public boolean representsList()
Returns true if the Cell is the root of an ASG representing a list


representsSingleton

public boolean representsSingleton()

setNewScope

public void setNewScope()

newScope

public boolean newScope()