public abstract class PetalObject extends Object implements PetalNode
Modifier and Type | Field and Description |
---|---|
static ArrayList |
EMPTY |
protected static Logger |
LOGGER |
protected ArrayList |
params |
static boolean |
strict |
Modifier | Constructor and Description |
---|---|
protected |
PetalObject(PetalNode parent,
String name,
ArrayList params) |
protected |
PetalObject(PetalNode parent,
String name,
Collection params) |
protected |
PetalObject(String name) |
Modifier and Type | Method and Description |
---|---|
abstract void |
accept(Visitor v)
accept the given visitor
|
int |
addProperty(String name,
PetalNode value)
Add a property (which may already exist, Petal files allow to define
properties multiply).
|
protected void |
addToList(String prop_name,
String list_name,
PetalObject o)
Add object to some given list and create the list if necessary.
|
Object |
clone() |
void |
defineProperty(String name,
boolean value)
Override property if exists already or add it if not.
|
void |
defineProperty(String name,
double value)
Override property if exists already or add it if not.
|
void |
defineProperty(String name,
int value)
Override property if exists already or add it if not.
|
int |
defineProperty(String name,
PetalNode value)
Override property if exists already or add it if not.
|
void |
defineProperty(String name,
String value)
Override property if exists already or add it if not.
|
boolean |
equals(Object o) |
int |
getChildCount()
get the number of child nodes
|
String |
getKind()
get the kind of this PetalNode
|
String |
getLongestName() |
String |
getName() |
ArrayList<String> |
getNames() |
int |
getNoProperties() |
ArrayList |
getParameterList() |
PetalNode |
getParent() |
ArrayList<PetalNode> |
getProperties(String name)
get the properties with the given name
|
PetalNode |
getProperty(int i) |
PetalNode |
getProperty(String name) |
boolean |
getPropertyAsBoolean(String name) |
double |
getPropertyAsFloat(String name) |
int |
getPropertyAsInteger(String name) |
String |
getPropertyAsString(String name) |
ArrayList<PetalNode> |
getPropertyList() |
String |
getPropertyName(PetalNode value)
This method uses the strict indexOf method to find the value.
|
Object[][] |
getPropertyTuples() |
String |
getQualifiedName()
Get fully qualified name for an object that must implement the Named
interface
and is contained by further Named objects.
|
PetalFile |
getRoot() |
int |
indexOf(PetalNode value)
This method is strict in that it does not use equals() to search
the list of properties but ==, since values, in particular
literals may occur more than once.
|
void |
init()
Perform any initial actions after all properties have been set up.
|
void |
moveProperty(int from,
int to)
Move property within list of properties, i.e. change order.
|
protected void |
removeFromList(String prop_name,
PetalObject o)
Remove object from some given list.
|
void |
removeProperty(int index)
Remove property at given index
|
void |
removeProperty(String name)
Remove property with given name
|
void |
setName(String n) |
void |
setParameterList(ArrayList params) |
void |
setParent(PetalNode p) |
void |
setProperty(int i,
String name,
PetalNode value)
Override property at i, value's "parent" reference points to
this object afterwards
|
String |
toString() |
protected static Logger LOGGER
public static final ArrayList EMPTY
protected ArrayList params
public static boolean strict
protected PetalObject(PetalNode parent, String name, ArrayList params)
parent
- node in the petal tree, either another PetalObject or PetalFilename
- of the object, e.g., "ClassCategory"params
- list of parameters, e.g., "Class" "Logical View::templates::Class"protected PetalObject(PetalNode parent, String name, Collection params)
parent
- node in the petal tree, either another PetalObject or PetalFilename
- of the object, e.g., "ClassCategory"params
- list of parameters, e.g., "Class" "Logical View::templates::Class"protected PetalObject(String name)
name
- of the object, e.g., "ClassCategory"public Object clone()
public boolean equals(Object o)
public void init()
public void setParent(PetalNode p)
public PetalNode getParent()
public String getKind()
PetalNode
public void setName(String n)
public String getName()
public final PetalFile getRoot()
public final void setProperty(int i, String name, PetalNode value)
public final int addProperty(String name, PetalNode value)
public final int indexOf(PetalNode value)
public final String getPropertyName(PetalNode value)
public int getNoProperties()
public int getChildCount()
PetalNode
getChildCount
in interface PetalNode
public final int defineProperty(String name, PetalNode value)
public final PetalNode getProperty(int i)
public final PetalNode getProperty(String name)
public final void defineProperty(String name, String value)
name
- value
- public String getPropertyAsString(String name)
public int getPropertyAsInteger(String name)
public void defineProperty(String name, int value)
public boolean getPropertyAsBoolean(String name)
public void defineProperty(String name, boolean value)
public double getPropertyAsFloat(String name)
public void defineProperty(String name, double value)
public void removeProperty(String name)
public void removeProperty(int index)
public void moveProperty(int from, int to)
public String getLongestName()
public ArrayList<PetalNode> getProperties(String name)
name
- public Object[][] getPropertyTuples()
public ArrayList getParameterList()
public void setParameterList(ArrayList params)
protected void addToList(String prop_name, String list_name, PetalObject o)
protected void removeFromList(String prop_name, PetalObject o)
public String getQualifiedName()
Copyright © 2018 BITPlan GmbH. All rights reserved.