Java 类org.apache.commons.collections.MultiHashMap 实例源码

项目:chart-recognition-library    文件:FontAnalyzer.java   
public MultiHashMap getErrors(String message) {
    MultiHashMap result = new MultiHashMap();
    System.out.println("OCR correction tool press >exit to end");
    System.out.println("Symbols recognized may appear in multiple expected value pairs");
    System.out.println(message);
    Scanner input = new Scanner(System.in);
    do {
        System.out.println("Symbols recognized:");

        String actual = input.nextLine();
        if (actual.contains(">exit")) {
            break;
        }
        System.out.println("Expected value  :");
        String expected = input.nextLine();
        result.put(actual, expected);
    } while (true);

    return result;
}
项目:chart-recognition-library    文件:NumberSequenceValidatorTest.java   
public void testSequenceValidation() {
    Vector<Pair<Comparable, Integer>> labels = new Vector<Pair<Comparable, Integer>>();
    labels.add(new Pair<Comparable, Integer>(11.0, 0));
    labels.add(new Pair<Comparable, Integer>(17.0, 30));
    labels.add(new Pair<Comparable, Integer>(19.0, 35));
    labels.add(new Pair<Comparable, Integer>(20.0, 45));

    MultiHashMap errorMap = new MultiHashMap();
    for (int i = 0; i < 10; i++) {
        errorMap.put(i, i);
    }
    errorMap.put(3, 1);
    errorMap.put(3, 7);
    errorMap.put(9, 8);
    errorMap.put(7, 8);
    NumberSequenceValidator validator = new NumberSequenceValidator(labels,
            errorMap);
    Vector<Pair<Comparable, Integer>> seq = validator.getValidSequence();
    for (int i = 0; i < seq.size(); i++) {
        System.out.println(seq.get(i).getFirst() + "   "
                + seq.get(i).getSecond());
    }
}
项目:clickwatch    文件:GraphCollapser.java   
/**
 * INTERNAL METHOD.
 * For a set of vertices, finds all the edges connected to them, indexed (in a MultiMap)
 * to the vertices to which they connect. Thus, in the graph with edges (A-C, A-D, B-C), 
 * with input (A, B), the result will be ( C {A-C, B-C}; D {A-D} )
 * @param rootSet
 * @return
 */
protected MultiMap findEdgesAndVerticesConnectedToRootSet(Set rootSet) {
    // now, let's get a candidate set of edges
    MultiMap vertices_to_edges = new MultiHashMap();

    for (Iterator iter = rootSet.iterator(); iter.hasNext();) {
        Vertex v = (Vertex) iter.next();
        for (Iterator iterator = v.getIncidentEdges().iterator();
            iterator.hasNext();
            ) {
            Edge e = (Edge) iterator.next();
            Vertex other = e.getOpposite(v);
            if (rootSet.contains(other))
                continue;
            vertices_to_edges.put(other, e);
        }
    }
    return vertices_to_edges;
}
项目:chart-recognition-library    文件:FontsDAL.java   
private void createFont() {
    FontAnalyzer analyzer = new FontAnalyzer(fontName);
    MultiHashMap stringErrors = analyzer.getErrors("String recognition");
    MultiHashMap digitErrors = analyzer.getErrors("Digit recognition");

    this.errors = new FontErrors(stringErrors, digitErrors);
    writeToResource(errors.toString());
}
项目:manydesigns.cn    文件:AbstractPageAction.java   
public MultiMap initEmbeddedPageActions() {
    if(embeddedPageActions == null) {
        MultiMap mm = new MultiHashMap();
        Layout layout = pageInstance.getLayout();
        for(ChildPage childPage : layout.getChildPages()) {
            String layoutContainerInParent = childPage.getContainer();
            if(layoutContainerInParent != null) {
                String newPath = context.getActionPath() + "/" + childPage.getName();
                File pageDir = new File(pageInstance.getChildrenDirectory(), childPage.getName());
                try {
                    Page page = DispatcherLogic.getPage(pageDir);
                    EmbeddedPageAction embeddedPageAction =
                        new EmbeddedPageAction(
                                childPage.getName(),
                                childPage.getActualOrder(),
                                newPath,
                                page);

                    mm.put(layoutContainerInParent, embeddedPageAction);
                } catch (PageNotActiveException e) {
                    logger.warn("Embedded page action is not active, skipping! " + pageDir, e);
                }
            }
        }
        for(Object entryObj : mm.entrySet()) {
            Map.Entry entry = (Map.Entry) entryObj;
            List pageActionContainer = (List) entry.getValue();
            Collections.sort(pageActionContainer);
        }
        embeddedPageActions = mm;
    }
    return embeddedPageActions;
}
项目:yajsw    文件:RuntimeController.java   
public void reset()
{
    _listeners = Collections.synchronizedMap(new MultiHashMap());
    setState(STATE_IDLE);

}