Package ru.ispras.fortress.solver.xml
Class XmlConstraintSaver
- java.lang.Object
-
- ru.ispras.fortress.solver.xml.XmlConstraintSaver
-
public final class XmlConstraintSaver extends java.lang.Object
TheXmlConstraintSaver
class provides functionality to save a constraint with all its attributes to an XML file.
-
-
Constructor Summary
Constructors Constructor Description XmlConstraintSaver(Constraint constraint)
Constructs an XMLConstraintSaver object that saves the specified constraint to the specified XML document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
save(java.io.OutputStream output)
Saves the constraint object to anOutputStream
.void
saveToFile(java.lang.String fileName)
Saves the constraint object to an XML file.java.lang.String
saveToString()
Saves the constraint object to an XML string.
-
-
-
Constructor Detail
-
XmlConstraintSaver
public XmlConstraintSaver(Constraint constraint)
Constructs an XMLConstraintSaver object that saves the specified constraint to the specified XML document.- Parameters:
constraint
- Constraint to be save.- Throws:
java.lang.IllegalArgumentException
- if the parameter equalsnull
; if the constraint is not formula-based (its type is not FORMULA_BASED). Currently, the possibility of saving other constraint types is not implemented.
-
-
Method Detail
-
saveToString
public java.lang.String saveToString() throws XmlNotSavedException
Saves the constraint object to an XML string.- Returns:
- XML text for the constraint.
- Throws:
XmlNotSavedException
- if failed to save the constraint to a string.
-
saveToFile
public void saveToFile(java.lang.String fileName) throws XmlNotSavedException
Saves the constraint object to an XML file.- Parameters:
fileName
- Target XML document file name.- Throws:
java.lang.IllegalArgumentException
- if the parameter equalsnull
.XmlNotSavedException
- if failed to save the constraint to a file.
-
save
public void save(java.io.OutputStream output) throws XmlNotSavedException
Saves the constraint object to anOutputStream
.- Parameters:
output
-OutputStream
to store constraint.- Throws:
java.lang.IllegalArgumentException
- if the parameter equalsnull
.XmlNotSavedException
- if failed to save the constraint to a file.
-
-