NamedNumber number;
int value;
// Check for minimum number of components
if (components.size() < 1) {
throw new ParseException(
ParseException.ANALYSIS_ERROR,
"object identifier must contain at least one component",
node.getStartLine(),
node.getStartColumn());
}
// Analyze components
for (int i = 0; i < components.size(); i++) {
number = (NamedNumber) components.get(i);
if (number.hasNumber()) {
value = number.getNumber().intValue();
if (parent == null && value == 0) {
parent = new ValueReference(getLocation(node),
getContext(),
DefaultContext.CCITT);
} else if (parent == null && value == 1) {
parent = new ValueReference(getLocation(node),
getContext(),
DefaultContext.ISO);
} else if (parent == null && value == 2) {
parent = new ValueReference(getLocation(node),
getContext(),
DefaultContext.JOINT_ISO_CCITT);
} else if (parent instanceof ObjectIdentifierValue) {
try {
parent = new ObjectIdentifierValue(
getLocation(node),
(ObjectIdentifierValue) parent,
number.getName(),
value);
} catch (MibException e) {
log.addError(e.getLocation(), e.getMessage());
parent = null;
}
} else {
parent = new ObjectIdentifierValue(
getLocation(node),
(ValueReference) parent,
number.getName(),
value);
}
} else if (parent != null) {
throw new ParseException(
ParseException.ANALYSIS_ERROR,
"object identifier component '" + number.getName() +
"' has been previously defined, remove any " +
"components to the left",
node.getStartLine(),