Skip to Content.
Sympa Menu

perfsonar-dev - nmwg: r353 - trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie

Subject: perfsonar development work

List archive

nmwg: r353 - trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie


Chronological Thread 
  • From:
  • To: ,
  • Subject: nmwg: r353 - trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie
  • Date: Tue, 27 May 2008 07:55:41 -0400

Author: swany
Date: 2008-05-27 07:55:41 -0400 (Tue, 27 May 2008)
New Revision: 353

Modified:
trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/SummarizeIpAddrs.java
trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/Trie.java
trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/TrieNode.java
Log:
new classes to wrap generic trie with ip-specific functionality (re-assembly
of addresses from partial keys and computation of mask from position.)

Also a method to generate non-overlapping summaries.

Modified:
trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/SummarizeIpAddrs.java
===================================================================
--- trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/SummarizeIpAddrs.java
2008-05-25 02:11:34 UTC (rev 352)
+++ trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/SummarizeIpAddrs.java
2008-05-27 11:55:41 UTC (rev 353)
@@ -2,6 +2,7 @@

import java.io.IOException;
import java.util.ArrayList;
+import java.util.Iterator;

public class SummarizeIpAddrs {
/**
@@ -29,12 +30,16 @@
trie = trie.Add(aLongValue, Constants.MAX_KEY_LENGTH,
newIp);
}

- trie.printDot("graph.dot");
+ String dotFilename = inputFile.replace(".txt", ".dot");
+ trie.printDot(dotFilename);

- for (String intNode: trie.listSummaryNodes() ) {
- System.out.println(intNode);
+ IpTrie ipTrie = new IpTrie(trie);
+ ArrayList<IpTrieNode> nodelist = ipTrie.getSummary();
+ Iterator<IpTrieNode> it = nodelist.iterator();
+ for ( IpTrieNode node; it.hasNext(); ) {
+ node = it.next();
+ System.out.println(node.addrString);
}
-
}

}

Modified: trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/Trie.java
===================================================================
--- trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/Trie.java 2008-05-25
02:11:34 UTC (rev 352)
+++ trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/Trie.java 2008-05-27
11:55:41 UTC (rev 353)
@@ -21,6 +21,10 @@
rootNode = rootnode;
}

+ public TrieNode getRootNode() {
+ return rootNode;
+ }
+
private long firstDigit(long key, long keyLength) {
return ((key >> (keyLength - 1)) & 1);
}

Modified: trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/TrieNode.java
===================================================================
--- trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/TrieNode.java
2008-05-25 02:11:34 UTC (rev 352)
+++ trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie/TrieNode.java
2008-05-27 11:55:41 UTC (rev 353)
@@ -328,7 +328,8 @@
c0Key = c0Key | currentKey;
p.println(addrString + " -> \""
+ helper.longToIP(c0Key) + "/" + c0Mask
- + "\";" + "// kl: " + c0.getKeyLength() + "
pos: " + position);
+ + "\"" + "[label=" + (c0Mask - mask)
+ + "];" + "// kl: " + c0.getKeyLength() + "
pos: " + position);
printDotNode(p, c0, c0Position, c0Key);
}
if (c1 != null) {
@@ -338,7 +339,8 @@
c1Key = c1Key | currentKey;
p.println(addrString + " -> \""
+ helper.longToIP(c1Key) + "/" + c1Mask
- + "\";" + "// kl: " + c1.getKeyLength() + "
pos: " + position);
+ + "\"" + "[label=" + (c1Mask - mask)
+ + "];" + "// kl: " + c1.getKeyLength() + "
pos: " + position);
printDotNode(p, c1, c1Position, c1Key);
}
}
@@ -384,7 +386,7 @@

/**
*
- * This method returns on the nodes which are necessary to summarize all
inputs.
+ * This method returns all the nodes which are necessary to summarize
all inputs.
*
* @param listOfNodes
* @param position



  • nmwg: r353 - trunk/nmwg/doc/dLS/gLS/examples/java/src/iptrie, svnlog, 05/27/2008

Archive powered by MHonArc 2.6.16.

Top of Page