|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.bbk.dcs.automed.qproc.iql.ASG
public class ASG
Every IQL query is internally represented as an Abstract Syntax Graph (ASG).
Field Summary | |
---|---|
private static java.lang.String[] |
indents
|
private static int |
MAX_INDENT
|
protected Cell |
root
|
Constructor Summary | |
---|---|
protected |
ASG()
|
|
ASG(Cell n)
|
|
ASG(Cell n,
boolean copy)
Creates a new ASG object. |
|
ASG(java.io.File f)
|
|
ASG(java.lang.String s)
|
Method Summary | |
---|---|
void |
annotate()
|
ASG |
copyOfASG()
Creates and returns an exact copy of the ASG. |
static ASG |
emptyBag()
Returns the ASG representation of the empty Bag - a BNil constructor. |
static ASG |
emptyCollection(java.lang.String colType)
|
static ASG |
emptyList()
Returns the ASG representation of the empty List - a Nil constructor. |
static ASG |
emptySet()
Returns the ASG representation of the empty Set - an SNil constructor. |
boolean |
equals(java.lang.Object o)
|
boolean |
equalsButForConstants(java.lang.Object o)
|
void |
explore()
|
private void |
explore(Cell c,
int indent,
java.io.PrintStream ps)
|
private void |
explore(Cell c,
int indent,
java.lang.StringBuffer sb)
|
void |
explore(java.io.PrintStream ps)
|
java.lang.String |
exploreAsString()
|
void |
finalize()
|
java.lang.String |
formattedString()
Given that the ASG represents a list the string returned has each element separated by carriage returns for more legible output. |
static java.lang.String |
fromASG(ASG g)
Returns the text IQL of g. |
static java.lang.String |
fromASG(Cell n)
Returns the text IQL of the abstract syntax graph of which n is the root. |
static java.util.ArrayList |
fromASGCollection(ASG g)
If g represents a list/set/bag this returns an ArrayList of its Cells. |
static java.util.ArrayList |
fromASGCollection(Cell n)
If n is the root of an ASG that represents a list, this returns an ArrayList of its Cells. |
static java.util.ArrayList |
fromASGList(ASG g)
If g represents a list this returns an ArrayList of its Cells. |
static java.util.ArrayList |
fromASGList(Cell n)
If n is the root of an ASG that represents a list, this returns an ArrayList of its Cells. |
static java.util.ArrayList |
fromASGTuple(ASG g)
If g represents a tuple this returns an ArrayList of its Cells. |
static java.util.ArrayList |
fromASGTuple(Cell n)
If n is the root of an ASG that represents a tuple, this returns an ArrayList of its Cells. |
static java.lang.String |
getColType(Cell c)
|
static java.lang.String |
getCompType(Cell c)
|
static java.util.List |
getGenerators(Cell c)
|
static java.util.List |
getGenerators(Cell c,
boolean copy)
|
static void |
getGenerators(Cell c,
java.util.LinkedList l,
boolean deep,
boolean copy)
|
static Cell |
getHead(Cell c)
|
static Cell |
getHead(Cell c,
boolean copy)
|
static java.util.LinkedList |
getPredicates(Cell c)
|
static java.util.LinkedList |
getPredicates(Cell c,
boolean copy)
|
static java.util.LinkedList |
getQualifiers(Cell c)
|
static java.util.LinkedList |
getQualifiers(Cell c,
boolean copy)
|
static java.util.LinkedList |
getSchemeInfoObjects(Cell c)
|
static java.util.LinkedList |
getSchemeInfoObjects(Cell c,
boolean copy)
|
private static void |
getSchemeInfoObjects(Cell c,
java.util.LinkedList schemes,
boolean copy)
|
static java.util.Collection |
getSchemes(Cell root,
java.util.Collection col)
|
static java.util.List |
getTupleItems(ASG g)
|
static java.util.List |
getVars(Cell c)
|
static java.util.List |
getVars(Cell c,
boolean copy)
|
java.util.List |
listOfSchemeObjects()
Return SchemeInfo objects instead of scheme strings |
static java.util.ArrayList |
listOfSchemes(ASG g,
boolean full)
Returns a list of the schemes used in the ASG as String objects. |
java.util.ArrayList |
listOfSchemes(boolean full)
Returns a list of the schemes used in the ASG as String objects. |
private static java.util.ArrayList |
listOfSchemes(Cell n,
boolean full)
|
static java.util.ArrayList |
listOfVars(Cell n)
|
private void |
makeListOfSchemeObjects(java.util.List list,
Cell n)
|
private static void |
makeListOfSchemes(java.util.ArrayList list,
Cell n,
boolean full)
|
private static void |
makeListOfVars(java.util.ArrayList list,
Cell n)
|
void |
print(boolean formatted)
Prints g in System.out |
void |
print(java.io.PrintStream ps,
boolean formatted)
|
private void |
printIndent(java.io.PrintStream ps,
int indent)
|
private void |
printIndent(java.lang.StringBuffer sb,
int indent)
|
void |
println(boolean formatted)
|
Cell |
root()
Returns the root of the ASG |
static ASG |
toASGCollection(java.util.List collection,
java.lang.String type)
Generates an ASG list from a Java List. |
static ASG |
toASGList(java.util.ArrayList list)
Generates an ASG list from an ArrayList. |
static ASG |
toASGTuple(java.util.ArrayList list)
Generates an ASG tuple from an ArrayList. |
static java.lang.String |
toIQLDateTime(java.util.Calendar c)
|
java.lang.String |
toString()
|
java.lang.String |
toStringOBID()
Use only for printing purposes in debug settings: works just like toString() , but schemes has an OBID suffix. |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Cell root
private static final int MAX_INDENT
private static final java.lang.String[] indents
Constructor Detail |
---|
protected ASG()
public ASG(Cell n)
n
- the root cell of a graph. This graph will be copied and packaged as an ASG.public ASG(Cell n, boolean copy)
n
- the Cell that is to be the root of the ASGcopy
- whether a copy of the tree of is to be created or notpublic ASG(java.lang.String s) throws ParseException
s
- text IQL query
java.lang.Exception
ParseException
public ASG(java.io.File f)
f
- text file containing the text of an IQL query.Method Detail |
---|
public static ASG toASGList(java.util.ArrayList list)
public static ASG toASGCollection(java.util.List collection, java.lang.String type)
public static ASG toASGTuple(java.util.ArrayList list)
public static java.util.ArrayList fromASGCollection(ASG g)
QProcException
public static java.util.ArrayList fromASGCollection(Cell n)
public static java.util.ArrayList fromASGList(ASG g)
public static java.util.ArrayList fromASGList(Cell n)
public static java.util.ArrayList fromASGTuple(ASG g)
QProcException
public static java.util.ArrayList fromASGTuple(Cell n)
QProcException
public static java.util.List getGenerators(Cell c)
c
- input Cell - assumes it is the root of a comprehension
public static java.util.List getGenerators(Cell c, boolean copy)
c
- input Cell - assumes it is the root of a comprehensioncopy
- true if copies instead of pointers are needed
public static void getGenerators(Cell c, java.util.LinkedList l, boolean deep, boolean copy)
c
- input Cell - assumes it is the root of a comprehensioncopy
- true if copies instead of pointers are neededpublic static java.util.LinkedList getPredicates(Cell c)
c
- input Cell - assumes it is the root of a comprehension
public static java.util.LinkedList getPredicates(Cell c, boolean copy)
c
- input Cell - assumes it is the root of a comprehensioncopy
- true if copies instead of pointers are needed
public static java.util.LinkedList getQualifiers(Cell c)
c
- input Cell - assumes it is the root of a comprehension
public static java.util.LinkedList getQualifiers(Cell c, boolean copy)
c
- input Cell - assumes it is the root of a comprehensioncopy
- true if copies instead of pointers are needed
public static Cell getHead(Cell c)
c
- input Cell
public static Cell getHead(Cell c, boolean copy)
c
- input Cellcopy
- true if a copy instead of a pointer is needed
public static java.util.LinkedList getSchemeInfoObjects(Cell c)
c
- input Cell
public static java.util.LinkedList getSchemeInfoObjects(Cell c, boolean copy)
c
- input Cellcopy
- true if a copy instead of a pointer is needed
private static void getSchemeInfoObjects(Cell c, java.util.LinkedList schemes, boolean copy)
public static java.util.List getVars(Cell c)
c
- input Cell
public static java.util.List getVars(Cell c, boolean copy)
c
- input Cellcopy
- true if a copy instead of a pointer is needed
public static java.util.List getTupleItems(ASG g) throws QProcException
QProcException
public static java.util.Collection getSchemes(Cell root, java.util.Collection col)
public java.util.ArrayList listOfSchemes(boolean full)
full
- true if the format :P:S:M:C:<<...>>:T is needed, false if the simple <<...>> format is
neededpublic java.util.List listOfSchemeObjects()
SchemeInfo
objects instead of scheme strings
full
-
private void makeListOfSchemeObjects(java.util.List list, Cell n)
public static java.util.ArrayList listOfSchemes(ASG g, boolean full)
private static java.util.ArrayList listOfSchemes(Cell n, boolean full)
private static void makeListOfSchemes(java.util.ArrayList list, Cell n, boolean full)
public static java.util.ArrayList listOfVars(Cell n)
private static void makeListOfVars(java.util.ArrayList list, Cell n)
public Cell root()
public static ASG emptyList()
public static ASG emptySet()
public static ASG emptyBag()
public static ASG emptyCollection(java.lang.String colType) throws IQLException
IQLException
public static java.lang.String getColType(Cell c) throws QProcException
QProcException
public static java.lang.String getCompType(Cell c) throws IQLException
IQLException
public ASG copyOfASG()
public void println(boolean formatted)
public void print(boolean formatted)
public void print(java.io.PrintStream ps, boolean formatted)
public java.lang.String toStringOBID()
toString()
, but schemes has an OBID suffix.
public static java.lang.String fromASG(ASG g)
public static java.lang.String fromASG(Cell n)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String formattedString()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean equalsButForConstants(java.lang.Object o)
public void annotate()
private void printIndent(java.lang.StringBuffer sb, int indent)
private void printIndent(java.io.PrintStream ps, int indent)
public void explore()
public void explore(java.io.PrintStream ps)
public java.lang.String exploreAsString()
private void explore(Cell c, int indent, java.lang.StringBuffer sb)
private void explore(Cell c, int indent, java.io.PrintStream ps)
public void finalize()
finalize
in class java.lang.Object
public static java.lang.String toIQLDateTime(java.util.Calendar c)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |