/** * Gets the built in type description. * * @param td the td * @return the built in type description */ // ******************************** public TypeDescription getBuiltInTypeDescription(TypeDescription td) { return (TypeDescription) BuiltInTypes.typeDescriptions.get(td.getName()); }
/** * @see TypeSystemDescription#getType(java.lang.String) */ public TypeDescription getType(String aTypeName) { for (int i = 0; i < mTypes.length; i++) { if (aTypeName.equals(mTypes[i].getName())) return mTypes[i]; } return null; }
/** * Gets the pkg. * * @param td the td * @return the pkg */ String getPkg(TypeDescription td) { return getPkg(td.getName()); }
/** * Gets the java name. * * @param td the td * @return the java name */ String getJavaName(TypeDescription td) { return getJavaName(td.getName()); }
public TreeSet<String> getImportedTypeNames() { TreeSet<String> typeNames = new TreeSet<>(); for (TypeDescription typeDescription : typeSystemDescription.getTypes()) { typeNames.add(typeDescription.getName()); } return typeNames; }
/** * Checks if is feature used in index. * * @param td the td * @param featureName the feature name * @return true, if is feature used in index */ private boolean isFeatureUsedInIndex(TypeDescription td, String featureName) { return isFeatureUsedInIndex(td.getName() + ":" + featureName); }
private boolean fillTypeNameMap(Map<String, String> typeNameMap, TypeSystemDescription desc) { boolean contained = false; for (TypeDescription each : desc.getTypes()) { String name = each.getName(); int lastIndexOf = name.lastIndexOf("."); String shortName = name.substring(lastIndexOf + 1, name.length()); typeNameMap.put(shortName, name); } return contained; }
/** * Checks if is feature in use elsewhere. * * @param td the td * @param featureName the feature name * @return true, if is feature in use elsewhere */ private boolean isFeatureInUseElsewhere(TypeDescription td, String featureName) { return isFeatureInUseElsewhere(td.getName() + ':' + featureName); }
/** * Checks if is built in feature. * * @param name the name * @param td the td * @return true, if is built in feature */ protected boolean isBuiltInFeature(String name, TypeDescription td) { TypeDescription builtInTd = (TypeDescription) BuiltInTypes.typeDescriptions.get(td.getName()); if (null == builtInTd) return false; return null != getFeatureFromTypeDescription(name, builtInTd); }
private List<String> checkOnAmbiguousShortNames(TypeSystemDescription tsDesc) { List<String> checkDuplicateShortNames = new ArrayList<String>(); for (TypeDescription each : tsDesc.getTypes()) { String longName = each.getName(); String shortName = getShortName(longName); Set<String> set = ambiguousTypeAlias.get(shortName); if (set != null && set.size() > 1) { checkDuplicateShortNames.addAll(set); } } return checkDuplicateShortNames; }
/** * Gets the java pkg. * * @param td the td * @return the java pkg */ String getJavaPkg(TypeDescription td) { TypeInfo bi = Jg.builtInTypes.get(td.getName()); if (null == bi) return getPkg(td); return getPkg(bi.javaNameWithPkg); }
String getJavaPkg(TypeDescription td) { TypeInfo bi = (TypeInfo) JcasGen.builtInTypes.get(td.getName()); if (null == bi) return getPkg(td); return getPkg(bi.javaNameWithPkg); }
/** * Checks if is imported type. * * @param td the td * @return true, if is imported type */ protected boolean isImportedType(TypeDescription td) { return null != editor.getImportedTypeSystemDesription().getType(td.getName()); }
/** * Gets the local type definition. * * @param td the td * @return the local type definition */ protected TypeDescription getLocalTypeDefinition(TypeDescription td) { TypeSystemDescription tsdLocal = getTypeSystemDescription(); if (null == tsdLocal) return null; return tsdLocal.getType(td.getName()); }
boolean isSubTypeOfAnnotation(TypeDescription td) { if (null == cas) return false; Type type = typeSystem.getType(td.getName()); if (null == type) // happens when type hasn't been defined return false; return typeSystem.subsumes(tcasAnnotationType, type); }
/** * Checks if is imported feature. * * @param name the name * @param td the td * @return true, if is imported feature */ protected boolean isImportedFeature(String name, TypeDescription td) { TypeDescription importedTd = editor.getImportedTypeSystemDesription().getType(td.getName()); if (null == importedTd) return false; return null != getFeatureFromTypeDescription(name, importedTd); }
private void inferFeatureMap(TypeDescription type) { // 1 - Recursively add features of the super type TypeDescription superType = typeSystemDescription.getType(type.getSupertypeName()); if(superType != null) inferFeatureMap(superType); // 2 - Add features of this type for(FeatureDescription feature:type.getFeatures()) { String featureFQN = type.getName() + ":" + feature.getName(); featureMap.put(feature.getName(), featureFQN); featureMap.put(featureFQN, featureFQN); } }
/** * Update gui type. * * @param item the item * @param td the td */ private void updateGuiType(TableTreeItem item, TypeDescription td) { item.setText(NAME_COL, formatName(td.getName())); item.setText(SUPER_COL, formatName(td.getSupertypeName())); }
/** * Type update. * * @param td the td * @param dialog the dialog */ private void typeUpdate(TypeDescription td, AddTypeDialog dialog) { td.setName(setValueChanged(dialog.typeName, td.getName())); td.setDescription(setValueChanged(multiLineFix(dialog.description), td.getDescription())); td.setSupertypeName(setValueChanged(dialog.supertypeName, td.getSupertypeName())); }
@Override public void generateFeature(TypeSystemDescription aTSD, TypeDescription aTD, AnnotationFeature aFeature) { // Link type TypeDescription linkTD = aTSD.addType(aFeature.getLinkTypeName(), "", CAS.TYPE_NAME_TOP); linkTD.addFeature(aFeature.getLinkTypeRoleFeatureName(), "", CAS.TYPE_NAME_STRING); linkTD.addFeature(aFeature.getLinkTypeTargetFeatureName(), "", aFeature.getType()); // Link feature aTD.addFeature(aFeature.getName(), "", CAS.TYPE_NAME_FS_ARRAY, linkTD.getName(), false); }