use of org.eclipse.titan.designer.AST.ASN1.InformationFromObj in project titan.EclipsePlug-ins by eclipse.
the class Referenced_ObjectSet method getRefdObjectClass.
/**
* Returns the referenced ObjectClass. The evaluation depends on the type of the reference
* @param timestamp
* @return the referenced ObjectClass if found. Otherwise returns null.
*/
public ObjectClass getRefdObjectClass(final CompilationTimeStamp timestamp) {
ObjectClass refdClass = null;
if (reference instanceof InformationFromObj) {
final ObjectClass tempGovernor = getRefdLast(timestamp, null).getMyGovernor();
if (tempGovernor == null) {
return null;
}
refdClass = tempGovernor.getRefdLast(timestamp, null);
final FieldName fn = ((InformationFromObj) reference).getFieldName();
if (fn.getNofFields() == 1) {
final Identifier fieldId = fn.getFieldByIndex(0);
final FieldSpecifications fss = refdClass.getFieldSpecifications();
FieldSpecification fs = fss.getFieldSpecificationByIdentifier(fieldId);
if (fs instanceof Undefined_FieldSpecification) {
fs = ((Undefined_FieldSpecification) fs).getRealFieldSpecification();
}
switch(fs.getFieldSpecificationType()) {
case FS_OS:
refdClass = ((ObjectSet_FieldSpecification) fs).getObjectClass().getRefdLast(timestamp, null);
break;
case FS_T:
// TODO: implement the other cases
break;
default:
// TODO: implement the other cases
break;
}
}
} else if (reference instanceof Parameterised_Reference) {
final Defined_Reference dref = ((Parameterised_Reference) reference).getRefDefdSimple();
if (dref == null) {
return null;
}
final Assignment ass = dref.getRefdAssignment(timestamp, false, null);
if (ass instanceof ObjectSet_Assignment) {
ass.check(timestamp);
// experimental
osReferenced = ((ObjectSet_Assignment) ass).getObjectSet(timestamp);
refdClass = ((ObjectSet_Assignment) ass).getObjectSet(timestamp).getMyGovernor().getRefdLast(timestamp, null);
}
} else if (reference instanceof Defined_Reference) {
final Assignment ass = ((Defined_Reference) reference).getRefdAssignment(timestamp, false, null);
if (ass instanceof ObjectSet_Assignment) {
ass.check(timestamp);
// experimental
osReferenced = ((ObjectSet_Assignment) ass).getObjectSet(timestamp);
refdClass = ((ObjectSet_Assignment) ass).getObjectSet(timestamp).getMyGovernor().getRefdLast(timestamp, null);
}
} else {
// to debug
return refdClass;
}
return refdClass;
}
Aggregations