cb.parser
Class ObjectFactory

java.lang.Object
  |
  +--cb.parser.ObjectFactory

public class ObjectFactory
extends java.lang.Object

This factory is used by the parser to create PetalNode objects . Subclass it and overwrite the "instance" if you don't like the way this is done.

Version:
$Id: ObjectFactory.java,v 1.16 2001/07/09 07:48:52 dahm Exp $
Author:
M. Dahm

Constructor Summary
protected ObjectFactory()
           
 
Method Summary
 BooleanLiteral createBoolean(java.lang.String value)
           
 FloatLiteral createFloat(java.lang.String value)
           
 IntegerLiteral createInteger(java.lang.String value)
           
 List createList(java.lang.String name)
           
 Location createLocation(java.lang.String value1, java.lang.String value2)
           
 PetalObject createObject(PetalNode parent, java.lang.String id, java.util.ArrayList params, java.lang.String tag)
          Create PetalObject like (object Class "Professor" ...).
 StringLiteral createString(java.lang.String value, boolean multi)
          There are two kinds of string encodings in Rose: Either the usual "foo bar", or a multi line string where each line starts with a |.
 Tag createTag(java.lang.String ref)
           
 Tuple createTuple(java.lang.String first, java.lang.String second)
           
 Value createValue(java.lang.String name, StringLiteral value)
           
static ObjectFactory getInstance()
           
static void setInstance(ObjectFactory o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectFactory

protected ObjectFactory()
Method Detail

getInstance

public static ObjectFactory getInstance()

setInstance

public static void setInstance(ObjectFactory o)

createObject

public PetalObject createObject(PetalNode parent,
                                java.lang.String id,
                                java.util.ArrayList params,
                                java.lang.String tag)
Create PetalObject like (object Class "Professor" ...). In case there is no corresponding class (yet), return SimpleObject, or SimpleViewObject respectively.
Parameters:
parent - the parent of the object in the tree, either another PetalObject or the root node (PetalFile)
id - the Rose identifier for the node like "Class_Category" which is mapped to a name like "ClassCategory"
params - the parameter list for the object
tag - some objects have a "tag", like @12

createList

public List createList(java.lang.String name)
Returns:
list like (list RoleViews ...) with given name

createValue

public Value createValue(java.lang.String name,
                         StringLiteral value)
Returns:
value literal like (value cardinality "1..n")

createTuple

public Tuple createTuple(java.lang.String first,
                         java.lang.String second)
Returns:
tuple literal like ("DataBaseSet" 800)

createLocation

public Location createLocation(java.lang.String value1,
                               java.lang.String value2)
Returns:
location literal which is a tuple of integers like (1520, 96)

createString

public StringLiteral createString(java.lang.String value,
                                  boolean multi)
There are two kinds of string encodings in Rose: Either the usual "foo bar", or a multi line string where each line starts with a |.
Returns:
string literal which may contain multiple lines

createBoolean

public BooleanLiteral createBoolean(java.lang.String value)
Returns:
new BooleanLiteral for either "TRUE" or "FALSE"

createInteger

public IntegerLiteral createInteger(java.lang.String value)
Returns:
new IntegerLiteral

createFloat

public FloatLiteral createFloat(java.lang.String value)
Returns:
new FloatLiteral (which contains in fact a double)

createTag

public Tag createTag(java.lang.String ref)
Returns:
new tag attached to view objects