当前位置: 首页>>代码示例>>Java>>正文


Java IdEObject.eGet方法代码示例

本文整理汇总了Java中org.bimserver.emf.IdEObject.eGet方法的典型用法代码示例。如果您正苦于以下问题:Java IdEObject.eGet方法的具体用法?Java IdEObject.eGet怎么用?Java IdEObject.eGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bimserver.emf.IdEObject的用法示例。


在下文中一共展示了IdEObject.eGet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeEClass

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private void writeEClass(IdEObject object, EStructuralFeature feature) throws SerializerException, IOException {
	Object referencedObject = object.eGet(feature);
	if (referencedObject instanceof IdEObject && ((IdEObject)referencedObject).eClass().getEAnnotation("wrapped") != null) {
		writeWrappedValue(object, feature, ((EObject)referencedObject).eClass());
	} else {
		if (referencedObject instanceof EObject && model.contains((IdEObject) referencedObject)) {
			print(DASH);
			print(String.valueOf(getExpressId((IdEObject) referencedObject)));
		} else {
			EntityDefinition entityBN = getPackageMetaData().getSchemaDefinition().getEntityBN(object.eClass().getName());
			if (entityBN != null && entityBN.isDerived(feature.getName())) {
				print(ASTERISK);
			} else if (feature.isMany()) {
				writeList(object, feature);
			} else {
				writeObject(object, feature);
			}
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:IfcPlugins,代码行数:21,代码来源:IfcStepSerializer.java

示例2: setDoubleAsStringValues

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setDoubleAsStringValues(IdEObject idEObject) {
	for (EAttribute eAttribute : idEObject.eClass().getEAllAttributes()) {
		if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEDouble()) {
			EStructuralFeature asStringFeature = idEObject.eClass().getEStructuralFeature(eAttribute.getName() + "AsString");
			if (asStringFeature != null) {
				if (eAttribute.isMany()) {
					List list = (List) idEObject.eGet(eAttribute);
					List listAsString = (List) idEObject.eGet(asStringFeature);
					for (int i = 0; i < list.size(); i++) {
						listAsString.set(i, "" + list.get(i));
					}
				} else {
					idEObject.eSet(asStringFeature, "" + idEObject.eGet(eAttribute));
				}
			}
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:20,代码来源:Scaler.java

示例3: dumpPlusReferences

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private void dumpPlusReferences(Set<IdEObject> done, IdEObject idEObject) {
	if (idEObject == null) {
		return;
	}
	if (done.contains(idEObject)) {
		return;
	}
	done.add(idEObject);
	System.out.println(idEObject.getOid() + ": " + idEObject.eClass().getName());
	for (EReference eReference : idEObject.eClass().getEAllReferences()) {
		Object val = idEObject.eGet(eReference);
		if (eReference.isMany()) {
			List list = (List) val;
			for (Object o : list) {
				dumpPlusReferences(done, (IdEObject) o);
			}
		} else {
			dumpPlusReferences(done, (IdEObject) val);
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:23,代码来源:IfcModel.java

示例4: fixOids

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private void fixOids(IdEObject idEObject, OidProvider oidProvider, BiMap<Long, IdEObject> temp) {
	if (idEObject == null) {
		return;
	}
	if (temp.containsValue(idEObject)) {
		return;
	}
	((IdEObjectImpl) idEObject).setOid(oidProvider.newOid(idEObject.eClass()));
	if (objects.containsValue(idEObject)) {
		temp.put(idEObject.getOid(), idEObject);
	}
	for (EReference eReference : idEObject.eClass().getEAllReferences()) {
		Object val = idEObject.eGet(eReference);
		if (eReference.isMany()) {
			List list = (List) val;
			for (Object o : list) {
				fixOids((IdEObject) o, oidProvider, temp);
			}
		} else {
			fixOids((IdEObject) val, oidProvider, temp);
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:25,代码来源:IfcModel.java

示例5: resetOids

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public void resetOids(IdEObject idEObject, Set<IdEObject> done) {
	if (idEObject == null) {
		return;
	}
	if (done.contains(idEObject)) {
		return;
	}
	((IdEObjectImpl) idEObject).setOid(-1);
	done.add(idEObject);
	for (EReference eReference : idEObject.eClass().getEAllReferences()) {
		Object val = idEObject.eGet(eReference);
		if (eReference.isMany()) {
			List list = (List) val;
			for (Object o : list) {
				resetOids((IdEObject) o, done);
			}
		} else {
			resetOids((IdEObject) val, done);
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:23,代码来源:IfcModel.java

示例6: storeDeep

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private void storeDeep(IdEObject object, Set<IdEObject> done) throws BimserverDatabaseException {
	if (object == null || done.contains(object)) {
		return;
	}
	done.add(object);
	store(object);
	for (EReference eReference : object.eClass().getEAllReferences()) {
		if (eReference.isMany()) {
			List<?> list = (List<?>) object.eGet(eReference);
			for (Object v : list) {
				storeDeep((IdEObject) v, done);
			}
		} else {
			IdEObject reference = (IdEObject) object.eGet(eReference);
			storeDeep(reference, done);
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:19,代码来源:DatabaseSession.java

示例7: getAttributeAtIndex

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private Object getAttributeAtIndex(Long tid, Long oid, String attributeName, int index) throws ServerException, UserException {
	requireAuthenticationAndRunningServer();
	DatabaseSession session = getBimServer().getDatabase().createSession();
	try {
		LongTransaction transaction = getBimServer().getLongTransactionManager().get(tid);
		EClass eClass = session.getEClassForOid(oid);
		IdEObject object = session.get(eClass, oid, new OldQuery(transaction.getPackageMetaData(), transaction.getPid(), transaction.getRid(), transaction.getRoid(), null, Deep.NO));
		if (object == null) {
			throw new UserException("No object of type " + eClass.getName() + " with oid " + oid + " found");
		}
		Object eGet = object.eGet(object.eClass().getEStructuralFeature(attributeName));
		if (eGet instanceof List) {
			List<?> list = (List<?>)eGet;
			return list.get(index);
		}
		return eGet;
	} catch (Exception e) {
		return handleException(e);
	} finally {
		session.close();
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:23,代码来源:LowLevelServiceImpl.java

示例8: getReference

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@Override
public Long getReference(Long tid, Long oid, String referenceName) throws ServerException, UserException {
	DatabaseSession session = getBimServer().getDatabase().createSession();
	try {
		LongTransaction transaction = getBimServer().getLongTransactionManager().get(tid);
		EClass eClass = session.getEClassForOid(oid);
		IdEObject object = session.get(eClass, oid, new OldQuery(transaction.getPackageMetaData(), transaction.getPid(), transaction.getRid(), transaction.getRoid(), null, Deep.NO));
		if (object == null) {
			throw new UserException("No object of type " + eClass.getName() + " with oid " + oid + " found");
		}
		EStructuralFeature eStructuralFeature = object.eClass().getEStructuralFeature(referenceName);
		if (eStructuralFeature == null) {
			throw new UserException("No feature with name " + referenceName + " found on class " + object.eClass().getName());
		}
		IdEObject ref = (IdEObject) object.eGet(eStructuralFeature);
		if (ref == null) {
			return -1L;
		}
		return ref.getOid();
	} catch (Exception e) {
		return handleException(e);
	} finally {
		session.close();
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:26,代码来源:LowLevelServiceImpl.java

示例9: getReferences

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public List<Long> getReferences(Long tid, Long oid, String referenceName) throws ServerException, UserException {
	DatabaseSession session = getBimServer().getDatabase().createSession();
	try {
		LongTransaction transaction = getBimServer().getLongTransactionManager().get(tid);
		EClass eClass = session.getEClassForOid(oid);
		IdEObject object = session.get(eClass, oid, new OldQuery(transaction.getPackageMetaData(), transaction.getPid(), transaction.getRid(), transaction.getRoid(), null, Deep.NO));
		if (object == null) {
			throw new UserException("No object of type " + eClass.getName() + " with oid " + oid + " found");
		}
		List<IdEObject> list = (List<IdEObject>) object.eGet(object.eClass().getEStructuralFeature(referenceName));
		List<Long> oidList = new ArrayList<Long>();
		for (IdEObject idEObject : list) {
			oidList.add(idEObject.getOid());
		}
		return oidList;
	} catch (Exception e) {
		return handleException(e);
	} finally {
		session.close();
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:24,代码来源:LowLevelServiceImpl.java

示例10: matches

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@Override
public boolean matches(IdEObject object) {
	if (object.eClass().isSuperTypeOf(reference.getEContainingClass())) {
		Object other = object.eGet(reference);
		if (other instanceof EList<?>) {
			EList<?> list = (EList<?>)other;
			for (Object eObject : list) {
				if (referencingObjects.contains(eObject)) {
					return true;
				}
			}
			return false;
		} else {
			return referencingObjects.contains(other);
		}
	}
	return false;
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:19,代码来源:HasReferenceToInCondition.java

示例11: matches

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@Override
public boolean matches(IdEObject object) {
	if (object.eClass().isSuperTypeOf(reference.getEContainingClass())) {
		Object other = object.eGet(reference);
		if (other instanceof EList<?>) {
			EList<?> list = (EList<?>)other;
			for (Object eObject : list) {
				// TODO Actually the first test should suffice (object id), the second should always return the same because caching of the objects should allow only 1 per database session
				if (eObject == referencingObject || ((IdEObject)eObject).getOid() == referencingObject.getOid()) {
					return true;
				}
			}
			return false;
		} else {
			return other == referencingObject;
		}
	}
	return false;
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:20,代码来源:HasReferenceToCondition.java

示例12: matches

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@Override
public boolean matches(IdEObject object) {
	if (!attribute.getEContainingClass().isSuperTypeOf(object.eClass())) {
		return false;
	} else {
		if (object.eGet(attribute) == null && literal.getValue() == null) {
			return true;
		}
		if (object.eGet(attribute) == null && literal.getValue() != null) {
			return false;
		}
		if (object.eGet(attribute) != null && literal.getValue() == null) {
			return false;
		}
		return object.eGet(attribute).equals(literal.getValue());
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:18,代码来源:AttributeCondition.java

示例13: useUnsetBit

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private boolean useUnsetBit(EStructuralFeature feature, IdEObject object) {
	// TODO non-unsettable boolean values can also be stored in these bits
	Object value = object.eGet(feature);
	if (feature.isUnsettable()) {
		if (!object.eIsSet(feature)) {
			return true;
		}
		if (feature.isMany() && ((List<?>)value).isEmpty()) {
			return true;
		}
	} else {
		if (feature.isMany() && ((List<?>)value).isEmpty()) {
			return true;
		}
		if (feature.getDefaultValue() == value || (feature.getDefaultValue() != null && feature.getDefaultValue().equals(value))) {
			return true;
		}
	}
	return false;
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:21,代码来源:DatabaseSession.java

示例14: writeObject

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private void writeObject(IdEObject object, EStructuralFeature feature) throws SerializerException, IOException {
	Object ref = object.eGet(feature);
	if (ref == null || (feature.isUnsettable() && !object.eIsSet(feature))) {
		EClassifier type = feature.getEType();
		if (type instanceof EClass) {
			EStructuralFeature structuralFeature = ((EClass) type).getEStructuralFeature(WRAPPED_VALUE);
			if (structuralFeature != null) {
				String name = structuralFeature.getEType().getName();
				if (name.equals(IFC_BOOLEAN) || name.equals(IFC_LOGICAL) || structuralFeature.getEType() == EcorePackage.eINSTANCE.getEBoolean()) {
					print(BOOLEAN_UNDEFINED);
				} else {
					print(DOLLAR);
				}
			} else {
				print(DOLLAR);
			}
		} else {
			if (type == EcorePackage.eINSTANCE.getEBoolean()) {
				print(BOOLEAN_UNDEFINED);
			} else if (feature.isMany()) {
				print("()");
			} else {
				print(DOLLAR);
			}
		}
	} else {
		if (ref instanceof EObject) {
			writeEmbedded((EObject) ref);
		} else if (feature.getEType() == ECORE_PACKAGE_INSTANCE.getEDouble()) {
			writeDoubleValue((Double)ref, object, feature);
		} else {
			IfcParserWriterUtils.writePrimitive(ref, outputStream);
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:IfcPlugins,代码行数:36,代码来源:IfcStepSerializer.java

示例15: comparePrimitives

import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private int comparePrimitives(IdEObject o1, IdEObject o2) {
	EClass eClass = o1.eClass();
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature("wrappedValue");
	Object val1 = o1.eGet(eStructuralFeature);
	Object val2 = o2.eGet(eStructuralFeature);
	if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEString()) {
		return ((String) val1).compareTo((String) val2);
	} else if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEInt()) {
		return ((Integer) val1).compareTo((Integer) val2);
	} else {
		throw new RuntimeException("ni");
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:14,代码来源:IfcModel.java


注:本文中的org.bimserver.emf.IdEObject.eGet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。