Package ru.ispras.fortress.solver.xml
Class XmlConstraintLoader
- java.lang.Object
-
- ru.ispras.fortress.solver.xml.XmlConstraintLoader
-
public final class XmlConstraintLoader extends java.lang.Object
TheXmlConstraintLoader
class provides functionality that loads a constraint from the specified XML file.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Constraint
load(java.io.InputStream input)
Loads a constraint from anInputStream
.static Constraint
loadFromFile(java.lang.String fileName)
Loads a constraint from the specified XML file.static Constraint
loadFromString(java.lang.String text)
Creates a constraint from the specified XML string.static Constraint
loadFromUrl(java.net.URL url)
Loads a constraint from an XML file pointed by the specified URL.
-
-
-
Method Detail
-
loadFromFile
public static Constraint loadFromFile(java.lang.String fileName) throws XmlNotLoadedException
Loads a constraint from the specified XML file.- Parameters:
fileName
- The full name of an XML file storing the constraint.- Returns:
- A constraint object loaded from the file.
- Throws:
java.lang.IllegalArgumentException
- if the parameter equals null.XmlNotLoadedException
- if an issue occurred during parsing the XML document.
-
loadFromString
public static Constraint loadFromString(java.lang.String text) throws XmlNotLoadedException
Creates a constraint from the specified XML string.- Parameters:
text
- XML text describing a constraint.- Returns:
- A constraint object created from the XML text.
- Throws:
java.lang.IllegalArgumentException
- if the parameter equals null.XmlNotLoadedException
- if an issue occurred during parsing the XML text.
-
loadFromUrl
public static Constraint loadFromUrl(java.net.URL url) throws XmlNotLoadedException
Loads a constraint from an XML file pointed by the specified URL.- Parameters:
url
- URL that points to an XML file storing the constraint.- Returns:
- A constraint object loaded from the file.
- Throws:
java.lang.IllegalArgumentException
- if the parameter equals null.XmlNotLoadedException
- if an issue occurred during parsing the XML document.
-
load
public static Constraint load(java.io.InputStream input) throws XmlNotLoadedException
Loads a constraint from anInputStream
.- Parameters:
input
-InputStream
containing constraint in XML form.- Returns:
- A constraint object loaded from the file.
- Throws:
java.lang.IllegalArgumentException
- if the parameter equals null.XmlNotLoadedException
- if an issue occurred during parsing the XML document.
-
-