Package org.nodes.util

Examples of org.nodes.util.Pair


    List<DTNode<StringLabel,StringLabel>> commonChilds = new ArrayList<DTNode<StringLabel,StringLabel>>();

    Set<Pair> childsA = new TreeSet<Pair>();
    Set<Pair> childsB = new TreeSet<Pair>();
    Map<Pair, DTNode<StringLabel,StringLabel>> pairMap = new TreeMap<Pair, DTNode<StringLabel,StringLabel>>();
    Pair pair;

    // We need common edge label pairs to find common children
    for (DTLink<StringLabel,StringLabel> edge : rootA.linksOut()) {
      pair = new Pair(Integer.parseInt(edge.tag().toString()), Integer.parseInt(edge.to().label().toString()));
      childsA.add(pair);
      pairMap.put(pair, edge.to());
    }

    for (DTLink<StringLabel,StringLabel> edge : rootB.linksOut()) {
      pair = new Pair(Integer.parseInt(edge.tag().toString()), Integer.parseInt(edge.to().label().toString()));
      childsB.add(pair);
      pairMap.put(pair, edge.to());
    }

    // If root nodes have an equivalence like relation
    for (Pair childA : childsA) {
      if (childA.getSecond() == Integer.parseInt(rootB.label().toString()) && childsB.contains(new Pair(childA.getFirst(), Integer.parseInt(rootA.label().toString())))) {
        commonChilds.add(null);
      }
    }

    childsA.retainAll(childsB); // intersect the sets
View Full Code Here


    List<DTNode<String,String>> commonChilds = new ArrayList<DTNode<String,String>>();

    Set<Pair> childsA = new TreeSet<Pair>();
    Set<Pair> childsB = new TreeSet<Pair>();
    Map<Pair, DTNode<String,String>> pairMap = new TreeMap<Pair, DTNode<String,String>>();
    Pair pair;

    // We need common edge label pairs to find common children
    for (DTLink<String,String> edge : rootA.linksOut()) {
      pair = new Pair(Integer.parseInt(edge.tag().toString()), Integer.parseInt(edge.to().label().toString()));
      childsA.add(pair);
      pairMap.put(pair, edge.to());
    }

    for (DTLink<String,String> edge : rootB.linksOut()) {
      pair = new Pair(Integer.parseInt(edge.tag().toString()), Integer.parseInt(edge.to().label().toString()));
      childsB.add(pair);
      pairMap.put(pair, edge.to());
    }

    // If root nodes have an equivalence like relation
    for (Pair childA : childsA) {
      if (childA.getSecond() == Integer.parseInt(rootB.label().toString()) && childsB.contains(new Pair(childA.getFirst(), Integer.parseInt(rootA.label().toString())))) {
        commonChilds.add(null);
      }
    }

    childsA.retainAll(childsB); // intersect the sets
View Full Code Here

TOP

Related Classes of org.nodes.util.Pair

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.