|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjas.io.ParametersBag
public class ParametersBag
A container for parameters. Each parameter consists of a ParameterField object.
Title: JAS
Description: Java Agent-based Simulation library
Copyright (C) 2002 Michele Sonnessa
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
| Field Summary | |
|---|---|
static java.lang.String |
TAG_CHOOSE
The XML tag of the parameter section node. |
static java.lang.String |
TAG_FOLDER
The XML tag of the root parameter node. |
static java.lang.String |
TAG_NAME
The XML tag of the parameter section node. |
static java.lang.String |
TAG_PARAMETER
The XML tag of the parameter section node. |
static java.lang.String |
TAG_PARAMETER_DESCR
The XML tag of the parameter section node. |
static java.lang.String |
TAG_PARAMETER_MAX
The XML tag of the parameter section node. |
static java.lang.String |
TAG_PARAMETER_MIN
The XML tag of the parameter section node. |
static java.lang.String |
TAG_PARAMETER_ORDER
The XML tag of the parameter section node. |
static java.lang.String |
TAG_PARAMETER_TYPE
The XML tag of the parameter section node. |
static java.lang.String |
TAG_PARAMS
The XML tag of the root parameter node. |
static java.lang.String |
TAG_SECTION
The XML tag of the parameter section node. |
| Constructor Summary | |
|---|---|
ParametersBag()
Create a new parameter container. |
|
ParametersBag(java.io.File descriptor)
Create a parameter container from an XML file descriptor. |
|
ParametersBag(java.lang.String filePath)
Create a parameter container from an XML file descriptor. |
|
| Method Summary | |
|---|---|
void |
addParameter(java.lang.String section,
ParameterField field)
Add a parameter into the given section with the given name. |
void |
addParameter(java.lang.String section,
java.lang.String name,
int parameterType)
Add a parameter into the given section with the given name. |
void |
addSection(java.lang.String name)
|
java.util.ArrayList |
getOrderedList(java.lang.String section)
|
ParameterField |
getParameter(java.lang.String section,
java.lang.String name)
Add a parameter into the given section with the given name. |
void |
getParameters(java.lang.Object targetObject)
Load parameters from the given target object. |
java.util.HashMap |
getSection(java.lang.String name)
|
java.util.HashMap |
getSections()
|
void |
loadParameters(java.io.File fromFile)
Load parameters from the given file. |
void |
mapToObject(java.lang.Object o)
Set the parameters value to the corresponding fields name of the Object. |
void |
mapToObject(java.lang.String sectionName,
java.lang.Object o)
Set the parameters value contained into a section to the corresponding fields name of the Object. |
void |
removeParameter(java.lang.String name)
Remove a parameter from where it is. |
void |
removeParameter(java.lang.String section,
java.lang.String name)
Remove a parameter into the given section with the given name. |
void |
removeSection(java.lang.String name)
|
void |
saveDescriptor(java.io.File toFile)
Save parameters descriptor to the given file in XML format. |
void |
saveParameters(java.io.File toFile)
Save parameters to the given file. |
void |
setField(ParameterField field,
java.lang.String val)
|
void |
setParameters(java.lang.String section,
java.lang.Object o)
Set the parameters value contained into a section to the corresponding fields name of the Object. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String TAG_CHOOSE
public static final java.lang.String TAG_FOLDER
public static final java.lang.String TAG_NAME
public static final java.lang.String TAG_PARAMETER
public static final java.lang.String TAG_PARAMETER_DESCR
public static final java.lang.String TAG_PARAMETER_MAX
public static final java.lang.String TAG_PARAMETER_MIN
public static final java.lang.String TAG_PARAMETER_ORDER
public static final java.lang.String TAG_PARAMETER_TYPE
public static final java.lang.String TAG_PARAMS
public static final java.lang.String TAG_SECTION
| Constructor Detail |
|---|
public ParametersBag()
public ParametersBag(java.io.File descriptor)
descriptor - The source XML descriptor file.public ParametersBag(java.lang.String filePath)
filePath - The path of the XML descriptor file.| Method Detail |
|---|
public void addParameter(java.lang.String section,
ParameterField field)
section - The parameter section.field - The ParameterField variable representing the parameter.
public void addParameter(java.lang.String section,
java.lang.String name,
int parameterType)
section - The section for the parameter.name - The parameter name.parameterType - The parameter type.public void addSection(java.lang.String name)
public java.util.ArrayList getOrderedList(java.lang.String section)
public ParameterField getParameter(java.lang.String section,
java.lang.String name)
section - The parameter section.name - The parameter name.
public void getParameters(java.lang.Object targetObject)
targetObject - The object from which parameters have to be read.public java.util.HashMap getSection(java.lang.String name)
public java.util.HashMap getSections()
public void loadParameters(java.io.File fromFile)
fromFile - The source XML file.public void mapToObject(java.lang.Object o)
o - The object to be attached to parameter bag.
public void mapToObject(java.lang.String sectionName,
java.lang.Object o)
sectionName - The section containing the values to be mapped on o.o - The object to be mapped.public void removeParameter(java.lang.String name)
name - The name of the ParameterField variable representing the parameter.
public void removeParameter(java.lang.String section,
java.lang.String name)
section - The parameter section.name - The parameter name.public void removeSection(java.lang.String name)
public void saveDescriptor(java.io.File toFile)
toFile - The target XML file.public void saveParameters(java.io.File toFile)
toFile - The target XML file.
public void setField(ParameterField field,
java.lang.String val)
public void setParameters(java.lang.String section,
java.lang.Object o)
section - The parameter section.o - The object to be updated.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||