use of nl.tue.buildingsmart.schema.SelectType in project BIMserver by opensourceBIM.
the class Express2EMF method addSelects.
private void addSelects() {
Iterator<DefinedType> typeIter = schema.getTypes().iterator();
while (typeIter.hasNext()) {
DefinedType type = typeIter.next();
if (type instanceof SelectType) {
EClass selectType = getOrCreateEClass(type.getName());
selectType.setInterface(true);
selectType.setAbstract(true);
Iterator<NamedType> entIter = ((SelectType) type).getSelections().iterator();
while (entIter.hasNext()) {
NamedType nt = entIter.next();
if (nt instanceof EntityDefinition) {
EClass choice = getOrCreateEClass(nt.getName());
choice.getESuperTypes().add(selectType);
} else if (nt instanceof DefinedType) {
UnderlyingType domain = ((DefinedType) nt).getDomain();
if (domain instanceof RealType || domain instanceof StringType || domain instanceof IntegerType || domain instanceof NumberType || domain instanceof LogicalType) {
EClass choice = getOrCreateEClass(nt.getName());
choice.getESuperTypes().add(selectType);
} else if (domain instanceof DefinedType) {
DefinedType dt2 = (DefinedType) (domain);
if (dt2.getDomain() instanceof RealType) {
EClass choice = getOrCreateEClass(nt.getName());
choice.getESuperTypes().add(selectType);
}
} else if (nt instanceof SelectType) {
} else {
if (nt.getName().equals("IfcComplexNumber") || nt.getName().equals("IfcCompoundPlaneAngleMeasure") || nt.getName().equals("IfcBoolean") || nt.getName().equals("IfcNullStyle")) {
EClass choice = getOrCreateEClass(nt.getName());
choice.getESuperTypes().add(selectType);
} else {
System.out.println("The domain is null for " + selectType.getName() + " " + nt.getName());
}
}
}
}
}
}
typeIter = schema.getTypes().iterator();
while (typeIter.hasNext()) {
DefinedType type = typeIter.next();
if (type instanceof SelectType) {
EClass selectType = (EClass) schemaPack.getEClassifier(type.getName());
Iterator<NamedType> entIter = ((SelectType) type).getSelections().iterator();
while (entIter.hasNext()) {
NamedType nt = entIter.next();
if (nt instanceof SelectType) {
EClass choice = getOrCreateEClass(nt.getName());
choice.getESuperTypes().add(selectType);
}
}
}
}
}
Aggregations