use of org.bouncycastle.asn1.x509.Attribute in project JMRI by JMRI.
the class VariableTableModel method setDefaultValue.
/**
* If there's a "default" attribute, set that value to start
*
* @return true if the value was set
*/
protected boolean setDefaultValue(Element e, VariableValue v) {
Attribute a;
if ((a = e.getAttribute("default")) != null) {
String val = a.getValue();
v.setIntValue(Integer.valueOf(val).intValue());
return true;
}
return false;
}
use of org.bouncycastle.asn1.x509.Attribute in project JMRI by JMRI.
the class VariableTableModel method processIndexedVal.
protected VariableValue processIndexedVal(Element child, String name, String comment, String cvName, boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly, String cv, String mask, String item) throws NumberFormatException {
VariableValue iv;
int minVal = 0;
int maxVal = 255;
Attribute a;
if ((a = child.getAttribute("min")) != null) {
minVal = Integer.valueOf(a.getValue()).intValue();
}
if ((a = child.getAttribute("max")) != null) {
maxVal = Integer.valueOf(a.getValue()).intValue();
}
iv = new IndexedVariableValue(name, comment, cvName, readOnly, infoOnly, writeOnly, opsOnly, cv, mask, minVal, maxVal, _indxCvModel.allIndxCvMap(), _status, item);
return iv;
}
use of org.bouncycastle.asn1.x509.Attribute in project JMRI by JMRI.
the class PositionFile method getReceiverMax.
/**
* Get the nth receiver max time.
*
* @return 0 if not present
*/
public int getReceiverMax(int n) {
List<Element> kids = root.getChildren("receiver");
for (int i = 0; i < kids.size(); i++) {
Element e = kids.get(i);
Attribute a = e.getAttribute("number");
if (a == null) {
continue;
}
int num = -1;
try {
num = a.getIntValue();
} catch (org.jdom2.DataConversionException ex1) {
log.error("in getReceiverMax", ex1);
}
if (num != n) {
continue;
}
a = e.getAttribute("maxtime");
if (a == null) {
// default value
return 99999;
}
try {
return a.getIntValue();
} catch (org.jdom2.DataConversionException ex2) {
return 99999;
}
}
return 99999;
}
use of org.bouncycastle.asn1.x509.Attribute in project JMRI by JMRI.
the class PositionFile method getReceiverPosition.
/**
* Get the nth receiver position in the file.
*
* @return null if not present
*/
public Point3d getReceiverPosition(int n) {
List<Element> kids = root.getChildren("receiver");
for (int i = 0; i < kids.size(); i++) {
Element e = kids.get(i);
Attribute a = e.getAttribute("number");
if (a == null) {
continue;
}
int num = -1;
try {
num = a.getIntValue();
} catch (org.jdom2.DataConversionException ex) {
log.error("in getReceiverPosition", ex);
}
if (num == n) {
return positionFromElement(e.getChild("position"));
}
}
return null;
}
use of org.bouncycastle.asn1.x509.Attribute in project JMRI by JMRI.
the class PositionFile method getReceiverActive.
/**
* Get the nth receiver active state in the file.
*
* @return true if not present
*/
public boolean getReceiverActive(int n) {
List<Element> kids = root.getChildren("receiver");
for (int i = 0; i < kids.size(); i++) {
Element e = kids.get(i);
Attribute a = e.getAttribute("number");
if (a == null) {
continue;
}
int num = -1;
try {
num = a.getIntValue();
} catch (org.jdom2.DataConversionException ex) {
log.error("in getReceiverActive", ex);
}
if (num != n) {
continue;
}
a = e.getAttribute("active");
if (a == null) {
// default value
return true;
}
if (a.getValue().equals("false")) {
return false;
}
return true;
}
return true;
}
Aggregations