use of org.eclipse.titan.designer.AST.ASN1.IObjectSet_Element in project titan.EclipsePlug-ins by eclipse.
the class ObjectSet_definition method getRefdLast.
@Override
public final /**
* {@inheritDoc}
*/
ObjectSet_definition getRefdLast(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
if (1 != objectSetElements.size()) {
return this;
}
final IObjectSet_Element element = objectSetElements.get(0);
if (!(element instanceof Referenced_ObjectSet)) {
return this;
}
final boolean newChain = null == referenceChain;
IReferenceChain temporalReferenceChain;
if (newChain) {
temporalReferenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
} else {
temporalReferenceChain = referenceChain;
}
temporalReferenceChain.add(this);
final ObjectSet_definition result = ((Referenced_ObjectSet) element).getRefdLast(timestamp, temporalReferenceChain);
if (newChain) {
temporalReferenceChain.release();
}
return result;
}
use of org.eclipse.titan.designer.AST.ASN1.IObjectSet_Element in project titan.EclipsePlug-ins by eclipse.
the class TableConstraint method collectTypesOfOpenType.
private void collectTypesOfOpenType(final CompilationTimeStamp aTimestamp, ObjectSet aObjectSet, final Open_Type aOpenType, final Identifier aObjectSetId) {
if (aObjectSet instanceof Referenced_ObjectSet) {
if (((Referenced_ObjectSet) aObjectSet).isReferencedDefinedReference()) {
aObjectSet = aObjectSet.getRefdLast(aTimestamp, null);
} else if (((Referenced_ObjectSet) aObjectSet).isReferencedInformationFromObj()) {
// TODO: How to handle this?
return;
} else {
// impossible, try it
return;
}
}
// now aObjectSet is instanceof ObjectSet_definition:
List<IObjectSet_Element> oses = ((ObjectSet_definition) aObjectSet).getObjectSetElements();
for (IObjectSet_Element ose : oses) {
if (ose instanceof ReferencedObject) {
// fspec
ose = ((ReferencedObject) ose).getRefdLast(aTimestamp);
}
if (ose instanceof Object_Definition) {
final Object_Definition od = (Object_Definition) ose;
FieldSetting fs = od.getFieldSettingWithNameDefault(objectClassFieldname, false);
if (fs != null) {
// TODO: handle FieldSetting options: FieldSetting_Type, FieldSetting_ObjectSet, FieldSetting_Value
if (fs instanceof FieldSetting_Type) {
final FieldSetting_Type fst = (FieldSetting_Type) fs;
final IASN1Type type = fst.getSetting();
final AtomicBoolean isStrange = new AtomicBoolean();
Identifier id = getOpenTypeAlternativeName(aTimestamp, (Type) type, isStrange);
if (!aOpenType.hasComponentWithName(id)) {
aOpenType.addComponent(new CompField(id, (Type) type, false, null));
if (isStrange.get()) {
aOpenType.getLocation().reportSemanticWarning(MessageFormat.format("Strange alternative name (`{0}') was added to open type `{1}'", id.getDisplayName(), aOpenType.getFullName()));
}
}
} else {
// TODO: is it possible FieldSetting_ObjectSet, FieldSetting_Value ??
continue;
}
} else {
fs = od.getFieldSettingWithNameDefault(aObjectSetId, false);
if (fs == null) {
continue;
}
if (fs instanceof FieldSetting_ObjectSet) {
final ISetting objectSet1 = fs.getSetting();
ObjectSet objectSet2;
if (objectSet1 instanceof ObjectSet) {
objectSet2 = (ObjectSet) objectSet1;
} else {
// unexpected case
continue;
}
if (objectSet2 == aObjectSet) {
// to prevent infinite loop
continue;
}
collectTypesOfOpenType(aTimestamp, objectSet2, aOpenType, aObjectSetId);
} else {
// TODO: is it possible??
continue;
}
}
}
}
// for
aOpenType.check(aTimestamp);
}
use of org.eclipse.titan.designer.AST.ASN1.IObjectSet_Element in project titan.EclipsePlug-ins by eclipse.
the class ObjectSet_definition method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
isErroneous = false;
if (null != mBlock) {
parseBlockObjectSetSpecifications();
}
final ObjectSetElementVisitor_checker checker = new ObjectSetElementVisitor_checker(timestamp, location, myGovernor);
for (final IObjectSet_Element element : objectSetElements) {
element.accept(checker);
}
lastTimeChecked = timestamp;
createObjects(true);
}
Aggregations