Search in sources :

Example 1 with SelectType

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);
                }
            }
        }
    }
}
Also used : StringType(nl.tue.buildingsmart.schema.StringType) NamedType(nl.tue.buildingsmart.schema.NamedType) SelectType(nl.tue.buildingsmart.schema.SelectType) LogicalType(nl.tue.buildingsmart.schema.LogicalType) DefinedType(nl.tue.buildingsmart.schema.DefinedType) RealType(nl.tue.buildingsmart.schema.RealType) IntegerType(nl.tue.buildingsmart.schema.IntegerType) EntityDefinition(nl.tue.buildingsmart.schema.EntityDefinition) EClass(org.eclipse.emf.ecore.EClass) NumberType(nl.tue.buildingsmart.schema.NumberType) UnderlyingType(nl.tue.buildingsmart.schema.UnderlyingType)

Aggregations

DefinedType (nl.tue.buildingsmart.schema.DefinedType)1 EntityDefinition (nl.tue.buildingsmart.schema.EntityDefinition)1 IntegerType (nl.tue.buildingsmart.schema.IntegerType)1 LogicalType (nl.tue.buildingsmart.schema.LogicalType)1 NamedType (nl.tue.buildingsmart.schema.NamedType)1 NumberType (nl.tue.buildingsmart.schema.NumberType)1 RealType (nl.tue.buildingsmart.schema.RealType)1 SelectType (nl.tue.buildingsmart.schema.SelectType)1 StringType (nl.tue.buildingsmart.schema.StringType)1 UnderlyingType (nl.tue.buildingsmart.schema.UnderlyingType)1 EClass (org.eclipse.emf.ecore.EClass)1