use of org.jdom.DataConversionException in project intellij-community by JetBrains.
the class ReplaceOptions method readExternal.
public void readExternal(Element element) {
matchOptions.readExternal(element);
Attribute attribute = element.getAttribute(REFORMAT_ATTR_NAME);
try {
myToReformatAccordingToStyle = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
attribute = element.getAttribute(SHORTEN_FQN_ATTR_NAME);
try {
toShortenFQN = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
attribute = element.getAttribute(USE_STATIC_IMPORT_ATTR_NAME);
if (attribute != null) {
// old saved configurations without this attribute present
try {
myToUseStaticImport = attribute.getBooleanValue();
} catch (DataConversionException ignore) {
}
}
replacement = element.getAttributeValue(REPLACEMENT_ATTR_NAME);
List<Element> elements = element.getChildren(VARIABLE_DEFINITION_TAG_NAME);
if (elements != null && elements.size() > 0) {
for (final Element element1 : elements) {
final ReplacementVariableDefinition variableDefinition = new ReplacementVariableDefinition();
variableDefinition.readExternal(element1);
addVariableDefinition(variableDefinition);
}
}
}
use of org.jdom.DataConversionException in project intellij-community by JetBrains.
the class MatchVariableConstraint method readExternal.
public void readExternal(Element element) {
super.readExternal(element);
Attribute attribute;
attribute = element.getAttribute(REGEXP);
if (attribute != null) {
regExp = attribute.getValue();
}
attribute = element.getAttribute(NAME_OF_EXPRTYPE);
if (attribute != null) {
nameOfExprType = attribute.getValue();
}
attribute = element.getAttribute(NAME_OF_FORMALTYPE);
if (attribute != null) {
nameOfFormalArgType = attribute.getValue();
}
attribute = element.getAttribute(NAME_OF_REFEENCE_VAR);
if (attribute != null) {
nameOfReferenceVar = attribute.getValue();
}
attribute = element.getAttribute(WITHIN_HIERARCHY);
if (attribute != null) {
try {
withinHierarchy = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(EXPRTYPE_WITHIN_HIERARCHY);
if (attribute != null) {
try {
exprTypeWithinHierarchy = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(FORMALTYPE_WITHIN_HIERARCHY);
if (attribute != null) {
try {
formalArgTypeWithinHierarchy = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(NEGATE_NAME_CONDITION);
if (attribute != null) {
try {
invertRegExp = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(NEGATE_EXPRTYPE_CONDITION);
if (attribute != null) {
try {
invertExprType = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(NEGATE_FORMALTYPE_CONDITION);
if (attribute != null) {
try {
invertFormalType = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(NEGATE_READ_CONDITION);
if (attribute != null) {
try {
invertReadAccess = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(NEGATE_WRITE_CONDITION);
if (attribute != null) {
try {
invertWriteAccess = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(READ);
if (attribute != null) {
try {
readAccess = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(WRITE);
if (attribute != null) {
try {
writeAccess = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(TARGET);
if (attribute != null) {
try {
partOfSearchResults = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(MIN_OCCURS);
if (attribute != null) {
try {
minCount = attribute.getIntValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(MAX_OCCURS);
if (attribute != null) {
try {
maxCount = attribute.getIntValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(WHOLE_WORDS_ONLY);
if (attribute != null) {
try {
wholeWordsOnly = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(NEGATE_WITHIN_CONDITION);
if (attribute != null) {
try {
invertWithinConstraint = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(NEGATE_CONTAINS_CONDITION);
if (attribute != null) {
try {
invertContainsConstraint = attribute.getBooleanValue();
} catch (DataConversionException ex) {
}
}
attribute = element.getAttribute(CONTAINS_CONDITION);
if (attribute != null)
containsConstraint = attribute.getValue();
attribute = element.getAttribute(WITHIN_CONDITION);
if (attribute != null)
withinConstraint = attribute.getValue();
}
use of org.jdom.DataConversionException in project vcell by virtualcell.
the class OptXmlReader method getOptimizationResultSet.
public static OptSolverResultSet getOptimizationResultSet(String xmlString) {
Element optResultSetElement = stringToXML(xmlString);
if (!optResultSetElement.getName().equals(OptXmlTags.OptSolverResultSet_Tag)) {
throw new RuntimeException("unexpected element '" + optResultSetElement.getName() + "', expecting " + OptXmlTags.OptSolverResultSet_Tag);
}
List<Element> paramElementList = optResultSetElement.getChildren(OptXmlTags.Parameter_Tag);
String[] parameterNames = new String[paramElementList.size()];
int count = 0;
for (Element parameterElement : paramElementList) {
parameterNames[count] = parameterElement.getAttributeValue(OptXmlTags.ParameterName_Attr);
count++;
}
Element bestRunElement = optResultSetElement.getChild(OptXmlTags.bestOptRunResultSet_Tag);
try {
OptRunResultSet bestResultSet = getOptRunResultSet(bestRunElement);
OptSolverResultSet optResultSet = new OptSolverResultSet(parameterNames, bestResultSet);
return optResultSet;
} catch (DataConversionException e) {
e.printStackTrace(System.out);
throw new RuntimeException(e.getMessage());
}
}
use of org.jdom.DataConversionException in project vcell by virtualcell.
the class XmlReader method getMathOverrides.
/**
* This method returns a MathOverrides object from a XML Element.
* Creation date: (5/21/2001 3:05:17 PM)
* @return cbit.vcell.solver.MathOverrides
* @param param org.jdom.Element
*/
private MathOverrides getMathOverrides(Element param, Simulation simulation) throws XmlParseException {
MathOverrides mathOverrides = null;
try {
// Get the constants
Object[] elements = param.getChildren().toArray();
Vector<ConstantArraySpec> v1 = new Vector<ConstantArraySpec>();
Vector<Constant> v2 = new Vector<Constant>();
for (int i = 0; i < elements.length; i++) {
Element e = (Element) elements[i];
Attribute array = e.getAttribute(XMLTags.ConstantArraySpec);
if (array != null) {
// collect scan overrides
String name = e.getAttributeValue(XMLTags.NameAttrTag);
int type = array.getIntValue();
v1.add(ConstantArraySpec.createFromString(name, e.getText(), type));
} else {
// collect regular overrides
v2.add(getConstant(e));
}
}
Constant[] constants = (Constant[]) BeanUtils.getArray(v2, Constant.class);
ConstantArraySpec[] specs = (ConstantArraySpec[]) BeanUtils.getArray(v1, ConstantArraySpec.class);
// create new MathOverrides object
mathOverrides = new MathOverrides(simulation, constants, specs);
} catch (ExpressionException e) {
e.printStackTrace();
throw new XmlParseException("A ExpressionException was fired when adding a Constant to the MathOverrides", e);
} catch (DataConversionException e2) {
e2.printStackTrace();
throw new XmlParseException("A DataConversionException occured when reading a ConstantArraySpec type", e2);
}
return mathOverrides;
}
Aggregations