Package repast.simphony.integration
Class DataFileUtils
- java.lang.Object
-
- repast.simphony.integration.DataFileUtils
-
public class DataFileUtils extends Object
Class with some functions that can be used for working with data files.- Author:
- Jerry Vos
-
-
Field Summary
Fields Modifier and Type Field Description static String
GENERATED_SCHEMA_FILE_NAME
static String
IGNORE_DATA_TARGET
static String
SCHEMA_FILE_NAME
-
Constructor Summary
Constructors Constructor Description DataFileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
findBestValue(Queryable queryable, org.jdom.Element element, String attributeName)
Same asfindBestValue(queryable, element, attributeName, true)
static String
findBestValue(Queryable queryable, org.jdom.Element nodeToHandle, String attributeName, boolean useXPath)
Tries to retrieve an attribute from the nodeToHandle based on the target.static Object
findExplicitTargetParent(Queryable queryable, String targetPath)
static String
getName(String targetPath)
static boolean
isGarbage(String string)
Checks if a string is null or "".static org.jdom.Document
loadDescriptor(String fileName)
Loads in a descriptor file and returns the resulting Document.static void
main(String[] args)
-
-
-
Field Detail
-
IGNORE_DATA_TARGET
public static final String IGNORE_DATA_TARGET
- See Also:
- Constant Field Values
-
SCHEMA_FILE_NAME
public static final String SCHEMA_FILE_NAME
- See Also:
- Constant Field Values
-
GENERATED_SCHEMA_FILE_NAME
public static final String GENERATED_SCHEMA_FILE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
loadDescriptor
public static org.jdom.Document loadDescriptor(String fileName) throws org.jdom.JDOMException, IOException
Loads in a descriptor file and returns the resulting Document. This will set the schema explicitly to the one found in the current package calledSCHEMA_FILE_NAME
, so the file need not have the schema specified.- Parameters:
fileName
- the name of the descriptor file- Returns:
- a Document object corresponding to the specified descriptor file
- Throws:
org.jdom.JDOMException
- if there was an error inside JDOMIOException
- if there was an error readingRunTimeException
- if the file cannot be found
-
findBestValue
public static String findBestValue(Queryable queryable, org.jdom.Element nodeToHandle, String attributeName, boolean useXPath)
Tries to retrieve an attribute from the nodeToHandle based on the target. If useXPath is true it then will query the Queryable using it's selectNode function and return the result of the Queryable's getValue on that result (or null if the result is null). If useXPath is false it will skip the XPath/Queryable steps and just return the toString of the attribute's value.- Parameters:
queryable
- the queryable source for fetching values fromelement
- the element to fetch the target fromattributeName
- the attribute's name.- Returns:
- a value as speciied
-
findExplicitTargetParent
public static Object findExplicitTargetParent(Queryable queryable, String targetPath)
- Parameters:
queryable
- the queryable source for fetching values fromtargetPath
-- Returns:
- a value as speciied
-
getName
public static String getName(String targetPath)
- Parameters:
targetPath
-- Returns:
- a value as speciied
-
isGarbage
public static boolean isGarbage(String string)
Checks if a string is null or "".- Parameters:
string
- a string to check- Returns:
- true if the string is either null or equal to ""
-
findBestValue
public static String findBestValue(Queryable queryable, org.jdom.Element element, String attributeName)
Same asfindBestValue(queryable, element, attributeName, true)
-
main
public static void main(String[] args)
-
-