コード例 #1
0
ファイル: FeatureMap.java プロジェクト: Kaljurand/AceWiki
 /**
  * Unifies this feature map with another feature map. Two feature maps can unify if and only if
  * all values of common feature name unify. If the unification fails, a UnificationFailedException
  * is thrown. In this case, the two feature maps remain partly unified, i.e. no backtracking is
  * done. Thus, this operation should be perfomed only if it is certain that the unification
  * succeeds, or if the operation is performed on copies of objects that are not used anymore
  * afterwards.
  *
  * @param featureMap The feature map to be unified with this feature map.
  * @throws UnificationFailedException If unification fails.
  */
 public void unify(FeatureMap featureMap) throws UnificationFailedException {
   for (String f : features.keySet()) {
     getFeature(f).unify(featureMap.getFeature(f));
   }
   for (String f : featureMap.features.keySet()) {
     getFeature(f).unify(featureMap.getFeature(f));
   }
 }
コード例 #2
0
ファイル: FeatureMap.java プロジェクト: Kaljurand/AceWiki
 /**
  * Tries to unify this feature map with another feature map. If unification is not possible, an
  * exception is thrown. In the case unification would be possible, the unification is not
  * performed completely. In any case the two feature maps remain in an unconsistent state
  * afterwards. Thus, this operation should be performed only on copies of objects that are not
  * used anymore afterwards.
  *
  * @param featureMap The feature map to be unified with this feature map.
  * @throws UnificationFailedException If unification fails.
  */
 public void tryToUnify(FeatureMap featureMap) throws UnificationFailedException {
   if (featureMap == null) {
     throw new UnificationFailedException();
   }
   for (String f : features.keySet()) {
     features.get(f).unify(featureMap.getFeature(f));
   }
 }