Refine search
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case ColorPackage.DOCUMENT_ROOT: return createDocumentRoot(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } }
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getCalendar_Id() { return (EAttribute)calendarEClass.getEStructuralFeatures().get(1); }
/** * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ protected T doSwitch(EClass theEClass, EObject theEObject) { if (theEClass.eContainer() == modelPackage) { return doSwitch(theEClass.getClassifierID(), theEObject); } else { List<EClass> eSuperTypes = theEClass.getESuperTypes(); return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject); } }
public RecordIdentifierPlusType(EClass eClass, int pid, long oid, int rid) { this.packageName = eClass.getEPackage().getName(); this.className = eClass.getName(); this.pid = pid; this.oid = oid; this.rid = rid; }
public EAttribute createEAttribute(EClass eClass, String name, EDataType eDataType, Multiplicity multiplicity) { EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute(); eAttribute.setName(name); if (multiplicity == Multiplicity.MANY) { eAttribute.setUpperBound(-1); } if (!isNew(eClass)) { changes.add(new NewAttributeChange(this, eClass.getEAllStructuralFeatures().size(), eAttribute)); } eAttribute.setEType(eDataType); eClass.getEStructuralFeatures().add(eAttribute); return eAttribute; }
private void writeEmbedded(IdEObject object) throws IOException { print("{"); print("\"_t\":\"" + object.eClass().getName() + "\","); for (EStructuralFeature eStructuralFeature : object.eClass().getEAllStructuralFeatures()) { print("\"" + eStructuralFeature.getName() + "\":"); writePrimitive(eStructuralFeature, object.eGet(eStructuralFeature)); if (object.eClass().getEAllStructuralFeatures().get(object.eClass().getEAllStructuralFeatures().size()-1) != eStructuralFeature) { print(","); } } print("}"); }
betaDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); binomialDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); booleanParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); constantParameterEClass.getESuperTypes().add(this.getParameterValue()); dateTimeParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); distributionParameterEClass.getESuperTypes().add(this.getParameterValue()); durationParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); elementParametersTypeEClass.getESuperTypes().add(this.getElementParameters()); enumParameterTypeEClass.getESuperTypes().add(this.getParameterValue()); erlangDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); expressionParameterTypeEClass.getESuperTypes().add(this.getParameterValue()); floatingParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); gammaDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); logNormalDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); negativeExponentialDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); normalDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); numericParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); poissonDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); propertyTypeEClass.getESuperTypes().add(this.getParameter()); scenarioParametersTypeEClass.getESuperTypes().add(this.getScenarioParameters()); stringParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); triangularDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); truncatedNormalDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); uniformDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); userDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); weibullDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter());
private void compareEClass(EClass eClass1, EClass eClass2) throws SchemaCompareException { if (eClass1.getEAllStructuralFeatures().size() != eClass2.getEAllStructuralFeatures().size()) { throw new SchemaCompareException("Not the same amount of features in " + eClass1.getName()); } Iterator<EStructuralFeature> iterator1 = eClass1.getEAllStructuralFeatures().iterator(); Iterator<EStructuralFeature> iterator2 = eClass2.getEAllStructuralFeatures().iterator(); while (iterator1.hasNext()) { EStructuralFeature structuralFeature1 = iterator1.next(); EStructuralFeature structuralFeature2 = iterator2.next(); if (!structuralFeature1.getName().equals(structuralFeature2.getName())) { throw new SchemaCompareException("Features not the same name"); } if (!structuralFeature1.getEType().getName().equals(structuralFeature2.getEType().getName())) { throw new SchemaCompareException("Features not of the same type"); } } }
private void clean() { Iterator<EClassifier> iterator = schemaPack.getEClassifiers().iterator(); while (iterator.hasNext()) { EClassifier eClassifier = iterator.next(); if (eClassifier instanceof EClass) { EClass eClass = (EClass) eClassifier; if (eClass.getEAnnotation("wrapped") != null) { if (eClass.getESuperTypes().size() == 1) { // iterator.remove(); } } } } }
public EClass createEClass(EPackage ePackage, String name, EClass... superClasses) { EClass eClass = EcoreFactory.eINSTANCE.createEClass(); eClass.setName(name); changes.add(new NewClassChange(eClass)); for (EClass superClass : superClasses) { eClass.getESuperTypes().add(superClass); } ePackage.getEClassifiers().add(eClass); return eClass; }
private void write(IdEObject object) throws IOException { if (object.eClass().getEAnnotation("wrapped") != null) { EStructuralFeature wrappedFeature = object.eClass().getEStructuralFeature("wrappedValue"); print("{"); print("\"_t\":\"" + object.eClass().getName() + "\","); print("\"_v\":"); writePrimitive(wrappedFeature, object.eGet(wrappedFeature)); print("}"); } else { print("" + object.getOid()); } }
private void buildUseForSerializationSet(EClass eClass) { if (this.getSchemaDefinition() != null) { if (!useForSerialization.containsKey(eClass)) { HashSet<EStructuralFeature> set = new HashSet<>(); for (EStructuralFeature eStructuralFeature : eClass.getEAllStructuralFeatures()) { EntityDefinition entityBN = this.getSchemaDefinition().getEntityBN(eClass.getName()); // if (eStructuralFeature.getEAnnotation("hidden") != null) { // if (eStructuralFeature.getEAnnotation("asstring") == null) { // } else { // if (entityBN.isDerived(eStructuralFeature.getName().substring(0, eStructuralFeature.getName().length() - 8))) { // } else { // set.add(eStructuralFeature); // } // } // } if (entityBN != null) { Attribute attribute = entityBN.getAttributeBNWithSuper(eStructuralFeature.getName()); if (attribute != null && attribute instanceof ExplicitAttribute) { if (!entityBN.isDerived(eStructuralFeature.getName()) || entityBN.isDerivedOverride(eStructuralFeature.getName())) { set.add(eStructuralFeature); } } } } useForSerialization.put(eClass, set); } } }
@Override public void set(String name, Object value) throws BimserverDatabaseException { EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(name); map.put(eStructuralFeature, value); }
/** * Method which looks up a structure feature of an eobject, first doing an exact name match, * then a case insensitive one. * * @param eobject The eobject. * @param property The property * @return The structure feature, or <code>null</code> if not found. */ public static EStructuralFeature feature(EObject eobject, String property) { EStructuralFeature feature = eobject.eClass().getEStructuralFeature(property); if (feature != null) { return feature; } // do a case insentive check, need to do the walk up the type hierarchy for (Iterator itr = eobject.eClass().getEAllStructuralFeatures().iterator(); itr.hasNext(); ) { feature = (EStructuralFeature) itr.next(); if (feature.getName().equalsIgnoreCase(property)) { return feature; } } return null; }
@Override public void getEClassRequirements(Set<EClass> classRequirements) { EClass eClass = attribute.getEContainingClass(); classRequirements.add(eClass); for (EClassifier subClass : eClass.getEPackage().getEClassifiers()) { if (subClass instanceof EClass && eClass.isSuperTypeOf((EClass) subClass)) { classRequirements.add((EClass) subClass); } } }
private boolean superTypeIsWrapped(EClass eType) { if (eType.getEAnnotation("wrapped") != null) { return true; } for (EClass superClass : eType.getESuperTypes()) { if (superTypeIsWrapped(superClass)) { return true; } } return false; }
@SuppressWarnings("unchecked") private void buildIndexWithSuperTypes(IdEObject eObject, EClass eClass) { if (!indexPerClassWithSubTypes.containsKey(eClass)) { indexPerClassWithSubTypes.put(eClass, new ArrayList<IdEObject>()); } ((List<IdEObject>) indexPerClassWithSubTypes.get(eClass)).add(eObject); for (EClass superClass : eClass.getESuperTypes()) { buildIndexWithSuperTypes(eObject, superClass); } }
protected void log(Object obj, int level, StringBuffer log) { EObject object = (EObject) obj; List properties = object.eClass().getEAllStructuralFeatures(); for (Iterator p = properties.iterator(); p.hasNext(); ) { EStructuralFeature property = (EStructuralFeature) p.next(); Object value = object.eGet(property); // skip empty properties if (value == null || (value instanceof Collection && ((Collection) value).isEmpty()) || (value instanceof Map && ((Map) value).isEmpty())) { continue; } log.append("\n"); for (int i = 0; i < level; i++) log.append(" "); if (value instanceof EObject && (level < 3)) { log.append(property.getName()); log.append(":"); log((EObject) value, level + 1, log); } else if (value instanceof Collection) { log(property.getName(), (Collection) value, level + 1, log); } else { log.append(property.getName()); log.append(" = " + value); } } }