/** * Creates a deep copy of this feature map using the given string objects. This method is usually * called form another deepCopy-method. * * @param stringObjs The string objects to be used. * @return A deep copy. */ FeatureMap deepCopy(HashMap<Integer, StringObject> stringObjs) { FeatureMap fm = new FeatureMap(); for (String feature : features.keySet()) { StringRef s = features.get(feature); StringObject se = stringObjs.get(s.getID()); if (se != null) { fm.setFeature(feature, se.newStringRef()); } else { StringRef sr = new StringRef(s.getString()); fm.setFeature(feature, sr); stringObjs.put(s.getID(), sr.getStringObject()); } } return fm; }