Package repast.simphony.integration
Class DataFileUtils
java.lang.Object
repast.simphony.integration.DataFileUtils
Class with some functions that can be used for working with data files.
- Author:
- Jerry Vos
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
static boolean
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
-
Field Details
-
IGNORE_DATA_TARGET
- See Also:
-
SCHEMA_FILE_NAME
- See Also:
-
GENERATED_SCHEMA_FILE_NAME
- See Also:
-
-
Constructor Details
-
DataFileUtils
public DataFileUtils()
-
-
Method Details
-
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
- Parameters:
queryable
- the queryable source for fetching values fromtargetPath
-- Returns:
- a value as speciied
-
getName
- Parameters:
targetPath
-- Returns:
- a value as speciied
-
isGarbage
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
-