public class Utilities
extends java.lang.Object
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkAttributeName(java.lang.String name)
Check if the given name meet the attribute name convention.
|
static boolean |
checkFileExists(java.lang.String filePath)
Check whether the given file exists.
|
static boolean |
checkModelName(java.lang.String name)
Check if the given name meet the model name convention.
|
static java.lang.String |
generateId(java.lang.String name)
Create new Id by appending a timestamp to the given name.
|
static java.lang.String |
getDocumentXMLString(org.w3c.dom.Document document)
Convert the document node to string.
|
static java.lang.String |
getIdFromModel(NamedObj model)
Extra the PTDB model id from a given Ptolemy model.
|
static java.lang.String |
getPropertyString(java.lang.String propertyName,
java.lang.String propertyValue)
Create the property node string to add to a MOML with
the class as StringConstantParameter.
|
static java.lang.String |
getValueForAttribute(org.w3c.dom.Node currentNode,
java.lang.String attributeName)
Get the value for the given attribute.
|
static java.lang.String |
insertIdTagToModelBody(java.lang.String modelBody,
java.lang.String modelId)
Add a parameter tag called DBModelId to the given model body.
|
static java.util.ArrayList<XMLDBModel> |
intersectResults(java.util.ArrayList<XMLDBModel> previousResults,
java.util.ArrayList<XMLDBModel> currentResults)
Intersect the XMLDBModels results from two list, and take the common
ones and return them in a new list.
|
static boolean |
modelReferenceExists(java.lang.String modelName,
java.lang.String referenceString)
Check if the model name exists in the given reference string.
|
static org.w3c.dom.Node |
parseXML(java.lang.String xmlString)
Parse the xml string that is passed to it and return the upper node of
that xml.
|
public static boolean checkModelName(java.lang.String name) throws IllegalNameException
name
- The name to be verified.IllegalNameException
- Thrown if the verifying name is invalid.public static boolean checkAttributeName(java.lang.String name) throws IllegalNameException
name
- The name to be verified.IllegalNameException
- Thrown if the verifying name is invalid.public static boolean checkFileExists(java.lang.String filePath)
filePath
- Path for the file.public static java.lang.String generateId(java.lang.String name)
name
- The name that will be used to generate the id.public static java.lang.String getDocumentXMLString(org.w3c.dom.Document document)
document
- Document which needs to be converted to String.public static java.lang.String getIdFromModel(NamedObj model)
model
- The model to be extracted the id.public static java.lang.String getPropertyString(java.lang.String propertyName, java.lang.String propertyValue)
propertyName
- Name for the property.propertyValue
- Value for the property.public static java.lang.String getValueForAttribute(org.w3c.dom.Node currentNode, java.lang.String attributeName)
currentNode
- Node for which attribute value needs to be determined.attributeName
- Name of the attribute.public static java.lang.String insertIdTagToModelBody(java.lang.String modelBody, java.lang.String modelId)
modelBody
- The XML model body where the Id parameter will be added.modelId
- The Id of the model that needs to be inserted.public static java.util.ArrayList<XMLDBModel> intersectResults(java.util.ArrayList<XMLDBModel> previousResults, java.util.ArrayList<XMLDBModel> currentResults)
previousResults
- The list of the first batch of models.currentResults
- The list of the second batch of models.public static boolean modelReferenceExists(java.lang.String modelName, java.lang.String referenceString)
modelName
- Model name to check.referenceString
- Reference string to check within.public static org.w3c.dom.Node parseXML(java.lang.String xmlString) throws XMLDBModelParsingException
xmlString
- The xml string that needs to be parsedXMLDBModelParsingException
- Thrown if a parser exceptions was thrown