Package com.ibatis.sqlmap.engine.mapper.matcher

Examples of com.ibatis.sqlmap.engine.mapper.matcher.Match


    List matchList = buildMatchList(canonicalProperties, canonicalFields);

    Map matchedNames = new HashMap();
    Iterator matches = matchList.iterator();
    while(matches.hasNext()) {
      Match match = (Match)matches.next();
      String property = (String) propertyMap.get(match.getProperty());
      String field = (String) fieldMap.get(match.getField());
      matchedNames.put(property, field);
    }
    return matchedNames;
  }
View Full Code Here


    for (int i = 0; i < canonicalProperties.length; i++) {
      for (int j = 0; j < canonicalFields.length; j++) {
        String prop = canonicalProperties[i];
        String field = canonicalFields[j];
        double score = calc.calculateMatch(prop, field);
        Match match = new Match(prop, field, score);
        matchList.add(match);
      }
    }
    sortMatches(matchList);
    removeDuplicatesAndLowScores (matchList);
View Full Code Here

  private void removeDuplicatesAndLowScores(List matchList) {
    Set usedProperties = new HashSet();
    Set usedFields = new HashSet();
    Iterator i = matchList.iterator();
    while (i.hasNext()) {
      Match m = (Match)i.next();
      if (usedProperties.contains(m.getProperty()) || usedFields.contains(m.getField()) || m.getMatchScore() < 0.40) {
        i.remove();
      } else {
        usedProperties.add(m.getProperty());
        usedFields.add(m.getField());
      }
    }

  }
View Full Code Here

  }

  private void sortMatches(List matchList) {
    Collections.sort(matchList, new Comparator () {
      public int compare(Object o1, Object o2) {
        Match m1 = (Match) o1;
        Match m2 = (Match) o2;
        return m1.getMatchScore() < m2.getMatchScore() ? 1 : m1.getMatchScore() > m2.getMatchScore() ? -1 : 0;
      }
    });
  }
View Full Code Here

TOP

Related Classes of com.ibatis.sqlmap.engine.mapper.matcher.Match

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.