本文整理汇总了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("<","<").replaceAll(">", ">").replaceAll("&", "&");
// if there was a well-formed char sequence "&", after replacement it will transform to &amp;
// the following line of code will remove these type of typos
elementBody = elementBody.replaceAll("&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;
}
}