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


Java BasicFeatureMap类代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.util.BasicFeatureMap的典型用法代码示例。如果您正苦于以下问题:Java BasicFeatureMap类的具体用法?Java BasicFeatureMap怎么用?Java BasicFeatureMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicFeatureMap类属于org.eclipse.emf.ecore.util包,在下文中一共展示了BasicFeatureMap类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tStrucDocText2String

import org.eclipse.emf.ecore.util.BasicFeatureMap; //导入依赖的package包/类
/**
 * Transforms A CDA StructDocText instance to a Java String containing the transformed text.
 * Since the method is a recursive one and handles with different types of object, parameter is taken as Object. However, parameters of type StructDocText should be given by the caller.
 * @param param A CDA StructDocText instance
 * @return A Java String containing the transformed text
 */
private String tStrucDocText2String(Object param) {
	if(param instanceof org.openhealthtools.mdht.uml.cda.StrucDocText) {
		org.openhealthtools.mdht.uml.cda.StrucDocText paramStrucDocText = (org.openhealthtools.mdht.uml.cda.StrucDocText)param;
		return "<div>" +tStrucDocText2String(paramStrucDocText.getMixed()) + "</div>";
	} 
	else if(param instanceof BasicFeatureMap) {
		String returnValue = "";
		for(Object object : (BasicFeatureMap)param){
			String pieceOfReturn = tStrucDocText2String(object);
			if(pieceOfReturn != null && !pieceOfReturn.isEmpty()) {
				returnValue = returnValue + pieceOfReturn;
			}
		}
		return returnValue;
	} 
	else if(param instanceof EStructuralFeatureImpl.SimpleFeatureMapEntry) {
		String elementBody = ((EStructuralFeatureImpl.SimpleFeatureMapEntry)param).getValue().toString();
		// deletion of unnecessary content (\n, \t)
		elementBody = elementBody.replaceAll("\n", "").replaceAll("\t", "");
		
		// replacement of special characters
		elementBody = elementBody.replaceAll("<","&lt;").replaceAll(">", "&gt;").replaceAll("&", "&amp;");
		// if there was a well-formed char sequence "&amp;", after replacement it will transform to &amp;amp;
		// the following line of code will remove these type of typos
		elementBody = elementBody.replaceAll("&amp;amp;", "&amp;");
		
		String typeName = ((EStructuralFeatureImpl.SimpleFeatureMapEntry) param).getEStructuralFeature().getName();
		typeName = typeName.toLowerCase();
		if(typeName.equals("comment")) {
			return "<!-- "+elementBody +" -->";
		} else if(typeName.equals("text")){
			return elementBody;
		} else {
			logger.warn("Unknown element type was found while transforming a StrucDocText instance to Narrative. Returning the value of the element");
			return elementBody;
		}
	} 
	else if(param instanceof EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry) {
		EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry entry = (EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry)param;
		List<String> tagList = getTagsHelperForTStructDocText2String(entry);
		return tagList.get(0) + tStrucDocText2String(entry.getValue()) + tagList.get(1);
	} 
	else if(param instanceof org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl) {
		// since the name and the attributes are taken already, we just send the mixed of anyTypeImpl
		return tStrucDocText2String(((org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl)param).getMixed());
	}
	else {
		logger.warn("Parameter for the method tStrucDocText2String is unknown. Returning null", param.getClass());
		return null;
	}
}
 
开发者ID:srdc,项目名称:cda2fhir,代码行数:58,代码来源:DataTypesTransformerImpl.java


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