本文整理汇总了Java中com.googlecode.concurrenttrees.common.PrettyPrinter类的典型用法代码示例。如果您正苦于以下问题:Java PrettyPrinter类的具体用法?Java PrettyPrinter怎么用?Java PrettyPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrettyPrinter类属于com.googlecode.concurrenttrees.common包,在下文中一共展示了PrettyPrinter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) {
ReversedRadixTree<Integer> tree = new ConcurrentReversedRadixTree<Integer>(new DefaultCharArrayNodeFactory());
tree.put("TEST", 1);
tree.put("TOAST", 2);
tree.put("TEAM", 3);
System.out.println("Tree structure:");
// PrettyPrintable is a non-public API for testing, prints semi-graphical representations of trees...
PrettyPrinter.prettyPrint((PrettyPrintable) tree, System.out);
System.out.println();
System.out.println("Value for 'TEST' (exact match): " + tree.getValueForExactKey("TEST"));
System.out.println("Value for 'TOAST' (exact match): " + tree.getValueForExactKey("TOAST"));
System.out.println();
System.out.println("Keys ending with 'ST': " + Iterables.toString(tree.getKeysEndingWith("ST")));
System.out.println("Keys ending with 'M': " + Iterables.toString(tree.getKeysEndingWith("M")));
System.out.println();
System.out.println("Values for keys ending with 'ST': " + Iterables.toString(tree.getValuesForKeysEndingWith("ST")));
System.out.println("Key-Value pairs for keys ending with 'ST': " + Iterables.toString(tree.getKeyValuePairsForKeysEndingWith("ST")));
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:22,代码来源:ReversedRadixTreeUsage.java
示例2: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) {
InvertedRadixTree<Integer> tree = new ConcurrentInvertedRadixTree<Integer>(new DefaultCharArrayNodeFactory());
tree.put("TEST", 1);
tree.put("TOAST", 2);
tree.put("TEAM", 3);
System.out.println("Tree structure:");
// PrettyPrintable is a non-public API for testing, prints semi-graphical representations of trees...
PrettyPrinter.prettyPrint((PrettyPrintable) tree, System.out);
System.out.println();
System.out.println("Value for 'TEST' (exact match): " + tree.getValueForExactKey("TEST"));
System.out.println("Value for 'TOAST' (exact match): " + tree.getValueForExactKey("TOAST"));
System.out.println();
System.out.println("Keys contained in 'MY TEAM LIKES TOAST': " + Iterables.toString(tree.getKeysContainedIn("MY TEAM LIKES TOAST")));
System.out.println("Keys contained in 'MY TEAM LIKES TOASTERS': " + Iterables.toString(tree.getKeysContainedIn("MY TEAM LIKES TOASTERS")));
System.out.println("Values for keys contained in 'MY TEAM LIKES TOAST': " + Iterables.toString(tree.getValuesForKeysContainedIn("MY TEAM LIKES TOAST")));
System.out.println("Key-value pairs for keys contained in 'MY TEAM LIKES TOAST': " + Iterables.toString(tree.getKeyValuePairsForKeysContainedIn("MY TEAM LIKES TOAST")));
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:21,代码来源:InvertedRadixTreeUsage.java
示例3: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) {
RadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(new DefaultCharArrayNodeFactory());
tree.put("TEST", 1);
tree.put("TOAST", 2);
tree.put("TEAM", 3);
System.out.println("Tree structure:");
// PrettyPrintable is a non-public API for testing, prints semi-graphical representations of trees...
PrettyPrinter.prettyPrint((PrettyPrintable) tree, System.out);
System.out.println();
System.out.println("Value for 'TEST' (exact match): " + tree.getValueForExactKey("TEST"));
System.out.println("Value for 'TOAST' (exact match): " + tree.getValueForExactKey("TOAST"));
System.out.println();
System.out.println("Keys starting with 'T': " + Iterables.toString(tree.getKeysStartingWith("T")));
System.out.println("Keys starting with 'TE': " + Iterables.toString(tree.getKeysStartingWith("TE")));
System.out.println();
System.out.println("Values for keys starting with 'TE': " + Iterables.toString(tree.getValuesForKeysStartingWith("TE")));
System.out.println("Key-Value pairs for keys starting with 'TE': " + Iterables.toString(tree.getKeyValuePairsForKeysStartingWith("TE")));
System.out.println();
System.out.println("Keys closest to 'TEMPLE': " + Iterables.toString(tree.getClosestKeys("TEMPLE")));
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:24,代码来源:RadixTreeUsage.java
示例4: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
ConcurrentSuffixTree<String> tree = new ConcurrentSuffixTree<String>(new DefaultCharSequenceNodeFactory());
for (String file : files) {
String manuscript = IOUtil.loadTextFileFromClasspath(file, true, true, true); // true = convert to lowercase
String manuscriptName = file.replaceAll("/.*/.*/", "").replace(".txt", "");
tree.put(manuscript, manuscriptName);
System.out.println("Added " + manuscriptName);
}
System.out.println("Built Suffix Tree. Estimating size on disk...");
Thread.sleep(30000);
DummyAppendable dummyAppendable = new DummyAppendable();
PrettyPrinter.prettyPrint(tree, dummyAppendable);
System.out.println("Done. Size on disk estimate:");
System.out.println("Lines: " + dummyAppendable.lineCount);
System.out.println("Characters: " + dummyAppendable.charCount);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:17,代码来源:BuildShakespeareTragediesSuffixTree.java
示例5: testPut_SplitAndMove
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testPut_SplitAndMove() {
ConcurrentRadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(getNodeFactory());
tree.put("TEST", 1);
tree.put("TEAM", 2);
tree.put("TOAST", 3);
String expected =
"○\n" +
"└── ○ T\n" + // implicit node added automatically
" ├── ○ E\n" + // implicit node added automatically
" │ ├── ○ AM (2)\n" +
" │ └── ○ ST (1)\n" +
" └── ○ OAST (3)\n";
String actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:18,代码来源:ConcurrentRadixTreeTest.java
示例6: testRemove_LastRemainingKey
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testRemove_LastRemainingKey() {
ConcurrentRadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(getNodeFactory());
tree.put("FOO", 1);
// ○
// └── ○ FOO (1)
String expected, actual;
expected =
"○\n" +
"└── ○ FOO (1)\n";
actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
boolean removed = tree.remove("FOO");
assertTrue(removed);
// ○ // FOO removed, which involved recreating the root with no remaining edges
expected =
"○\n";
actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:26,代码来源:ConcurrentRadixTreeTest.java
示例7: testRemove_NoSuchKey
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testRemove_NoSuchKey() {
ConcurrentRadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(getNodeFactory());
tree.put("FOO", 1);
tree.put("BAR", 2);
String expected, actual;
expected =
"○\n" +
"├── ○ BAR (2)\n" +
"└── ○ FOO (1)\n";
actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
boolean removed = tree.remove("BAZ");
assertFalse(removed);
expected =
"○\n" + // we expect no change
"├── ○ BAR (2)\n" +
"└── ○ FOO (1)\n";
actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:25,代码来源:ConcurrentRadixTreeTest.java
示例8: testPut_ReplaceValue
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testPut_ReplaceValue() throws Exception {
ConcurrentSuffixTree<Integer> tree = newConcurrentSuffixTreeForUnitTests();
tree.put("BANANA", 1);
tree.put("BANANA", 2);
String expected =
"○\n" +
"├── ○ A ([BANANA])\n" +
"│ └── ○ NA ([BANANA])\n" +
"│ └── ○ NA ([BANANA])\n" +
"├── ○ BANANA ([BANANA])\n" +
"└── ○ NA ([BANANA])\n" +
" └── ○ NA ([BANANA])\n";
String actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
assertEquals(Integer.valueOf(2), tree.getValueForExactKey("BANANA"));
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:19,代码来源:ConcurrentSuffixTreeTest.java
示例9: testPutIfAbsent
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testPutIfAbsent() throws Exception {
ConcurrentSuffixTree<Integer> tree = newConcurrentSuffixTreeForUnitTests();
tree.putIfAbsent("BANANA", 1);
tree.putIfAbsent("BANANA", 2); // should be ignored
String expected =
"○\n" +
"├── ○ A ([BANANA])\n" +
"│ └── ○ NA ([BANANA])\n" +
"│ └── ○ NA ([BANANA])\n" +
"├── ○ BANANA ([BANANA])\n" +
"└── ○ NA ([BANANA])\n" +
" └── ○ NA ([BANANA])\n";
String actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
assertEquals(Integer.valueOf(1), tree.getValueForExactKey("BANANA"));
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:19,代码来源:ConcurrentSuffixTreeTest.java
示例10: testPut
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testPut() throws Exception {
ConcurrentReversedRadixTree<Integer> tree = new ConcurrentReversedRadixTree<Integer>(getNodeFactory());
tree.put("TEST", 1);
tree.put("TEAM", 2);
tree.put("TOAST", 3);
String expected =
"○\n" +
"├── ○ MAET (2)\n" +
"└── ○ TS\n" +
" ├── ○ AOT (3)\n" +
" └── ○ ET (1)\n";
String actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:17,代码来源:ConcurrentReversedRadixTreeTest.java
示例11: testPutIfAbsent
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testPutIfAbsent() throws Exception {
ConcurrentReversedRadixTree<Integer> tree = new ConcurrentReversedRadixTree<Integer>(getNodeFactory());
tree.putIfAbsent("TEST", 1);
tree.putIfAbsent("TEAM", 2);
tree.putIfAbsent("TOAST", 3);
tree.putIfAbsent("TEAM", 4); // should be ignored
String expected =
"○\n" +
"├── ○ MAET (2)\n" +
"└── ○ TS\n" +
" ├── ○ AOT (3)\n" +
" └── ○ ET (1)\n";
String actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:18,代码来源:ConcurrentReversedRadixTreeTest.java
示例12: testRemove
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testRemove() throws Exception {
ConcurrentReversedRadixTree<Integer> tree = new ConcurrentReversedRadixTree<Integer>(getNodeFactory());
tree.put("TEST", 1);
tree.put("TEAM", 2);
tree.put("TOAST", 3);
String expected, actual;
expected =
"○\n" +
"├── ○ MAET (2)\n" +
"└── ○ TS\n" +
" ├── ○ AOT (3)\n" +
" └── ○ ET (1)\n";
actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
tree.remove("TEST");
expected =
"○\n" +
"├── ○ MAET (2)\n" +
"└── ○ TSAOT (3)\n";
actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:27,代码来源:ConcurrentReversedRadixTreeTest.java
示例13: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) {
// A file system to store Brochure objects...
InMemoryFileSystem<Brochure> fileSystem = new ConcurrentRadixTreeInMemoryFileSystem<Brochure>();
Brochure fordFocusBrochure = new Brochure("Marketing stuff for Ford Focus");
Brochure fordF150Brochure = new Brochure("Marketing stuff for Ford F150");
Brochure hondaCivicBrochure = new Brochure("Marketing stuff for Honda Civic");
fileSystem.addFile("/brochures/ford/", "ford_focus_brochure.txt", fordFocusBrochure);
fileSystem.addFile("/brochures/ford/", "ford_f150_brochure.txt", fordF150Brochure);
fileSystem.addFile("/brochures/honda/", "honda_civic_brochure.txt", hondaCivicBrochure);
System.out.println("Internal file system representation (not public):-");
PrettyPrinter.prettyPrint((PrettyPrintable) fileSystem, System.out);
System.out.println();
System.out.println("Retrieve Ford brochure names in directory: " + fileSystem.getFileNamesInDirectory("/brochures/ford/"));
System.out.println("Retrieve Honda brochure names in directory: " + fileSystem.getFileNamesInDirectory("/brochures/honda/"));
System.out.println("Retrieve All brochure names recursively: " + fileSystem.getFileNamesInDirectoryRecursive("/brochures/"));
System.out.println();
Brochure fordF150BrochureRetrieved = fileSystem.getFile("/brochures/ford/", "ford_f150_brochure.txt");
System.out.println("Retrieve Ford F150 brochure contents using exact file name: " + fordF150BrochureRetrieved);
System.out.println();
System.out.println("Retrieve all Ford brochure contents in directory:-");
Collection<Brochure> fordBrochuresRetrieved = fileSystem.getFilesInDirectory("/brochures/ford/");
for (Brochure fordBrochure : fordBrochuresRetrieved) {
System.out.println(fordBrochure);
}
System.out.println();
System.out.println("Retrieve contents from entire file system recursively:-");
Collection<Brochure> allFiles = fileSystem.getFilesInDirectoryRecursive("/");
for (Brochure file : allFiles) {
System.out.println(file);
}
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:39,代码来源:InMemoryFileSystemUsage.java
示例14: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) {
System.out.println("Suffixes for 'TEST': " + Iterables.toString(CharSequences.generateSuffixes("TEST")));
System.out.println("Suffixes for 'TOAST': " + Iterables.toString(CharSequences.generateSuffixes("TOAST")));
System.out.println("Suffixes for 'TEAM': " + Iterables.toString(CharSequences.generateSuffixes("TEAM")));
SuffixTree<Integer> tree = new ConcurrentSuffixTree<Integer>(new DefaultCharArrayNodeFactory());
tree.put("TEST", 1);
tree.put("TOAST", 2);
tree.put("TEAM", 3);
System.out.println();
System.out.println("Tree structure:");
// PrettyPrintable is a non-public API for testing, prints semi-graphical representations of trees...
PrettyPrinter.prettyPrint((PrettyPrintable) tree, System.out);
System.out.println();
System.out.println("Value for 'TEST' (exact match): " + tree.getValueForExactKey("TEST"));
System.out.println("Value for 'TOAST' (exact match): " + tree.getValueForExactKey("TOAST"));
System.out.println();
System.out.println("Keys ending with 'ST': " + Iterables.toString(tree.getKeysEndingWith("ST")));
System.out.println("Keys ending with 'M': " + Iterables.toString(tree.getKeysEndingWith("M")));
System.out.println("Values for keys ending with 'ST': " + Iterables.toString(tree.getValuesForKeysEndingWith("ST")));
System.out.println("Key-Value pairs for keys ending with 'ST': " + Iterables.toString(tree.getKeyValuePairsForKeysEndingWith("ST")));
System.out.println();
System.out.println("Keys containing 'TE': " + Iterables.toString(tree.getKeysContaining("TE")));
System.out.println("Keys containing 'A': " + Iterables.toString(tree.getKeysContaining("A")));
System.out.println("Values for keys containing 'A': " + Iterables.toString(tree.getValuesForKeysContaining("A")));
System.out.println("Key-Value pairs for keys containing 'A': " + Iterables.toString(tree.getKeyValuePairsForKeysContaining("A")));
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:31,代码来源:SuffixTreeUsage.java
示例15: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
ConcurrentSuffixTree<String> tree = new ConcurrentSuffixTree<String>(new DefaultCharSequenceNodeFactory());
for (String file : files) {
String manuscript = IOUtil.loadTextFileFromClasspath(file, true, true, true); // true = convert to lowercase
String manuscriptName = file.replaceAll("/.*/.*/", "").replace(".txt", "");
tree.put(manuscript, manuscriptName);
System.out.println("Added " + manuscriptName);
}
System.out.println("Built Suffix Tree. Estimating size on disk...");
DummyAppendable dummyAppendable = new DummyAppendable();
PrettyPrinter.prettyPrint(tree, dummyAppendable);
System.out.println("Done. Size on disk estimate:");
System.out.println("Lines: " + dummyAppendable.lineCount);
System.out.println("Characters: " + dummyAppendable.charCount);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:16,代码来源:BuildShakespeareSinglePlaySuffixTree.java
示例16: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) {
ConcurrentRadixTree<WordValue> tree = new ConcurrentRadixTree<WordValue>(new DefaultCharArrayNodeFactory());
for (String file : files) {
Set<String> wordsInFile = IOUtil.loadWordsFromTextFileOnClasspath(file, true); // true = convert to lowercase
for (String word : wordsInFile) {
WordValue wordValue = tree.getValueForExactKey(word);
if (wordValue == null) {
wordValue = new WordValue(word);
tree.put(word, wordValue); // not using concurrency support here
}
wordValue.manuscriptsContainingWord.add(file.replaceAll("/.*/.*/", "").replace(".txt", ""));
}
}
final String radixTreePrinted = PrettyPrinter.prettyPrint(tree);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JTextArea textArea = new JTextArea();
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));
textArea.setText(radixTreePrinted);
JScrollPane scrollPane = new JScrollPane(textArea);
textArea.setEditable(false);
JFrame frame = new JFrame("Shakespeare Radix Tree");
frame.add(scrollPane);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(640, 480);
frame.setVisible(true);
}
});
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:33,代码来源:BuildShakespeareWordRadixTree.java
示例17: main
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
public static void main(String[] args) {
ConcurrentSuffixTree<WordValue> tree = new ConcurrentSuffixTree<WordValue>(new DefaultCharArrayNodeFactory());
for (String file : files) {
Set<String> wordsInFile = IOUtil.loadWordsFromTextFileOnClasspath(file, true); // true = convert to lowercase
for (String word : wordsInFile) {
WordValue wordValue = tree.getValueForExactKey(word);
if (wordValue == null) {
wordValue = new WordValue(word);
tree.put(word, wordValue); // not using concurrency support here
}
wordValue.manuscriptsContainingWord.add(file.replaceAll("/.*/.*/", "").replace(".txt", ""));
}
}
final String radixTreePrinted = PrettyPrinter.prettyPrint(tree);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JTextArea textArea = new JTextArea();
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));
textArea.setText(radixTreePrinted);
JScrollPane scrollPane = new JScrollPane(textArea);
textArea.setEditable(false);
JFrame frame = new JFrame("Shakespeare Suffix Tree");
frame.add(scrollPane);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(640, 480);
frame.setVisible(true);
}
});
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:33,代码来源:BuildShakespeareWordSuffixTree.java
示例18: testAddSuffixesToRadixTree_DuplicateHandling
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testAddSuffixesToRadixTree_DuplicateHandling() {
LCSubstringSolver solver = new LCSubstringSolver(new DefaultCharSequenceNodeFactory());
solver.addSuffixesToRadixTree("FOO");
// This would not really happen since add method prevents duplicates. Simulate adding duplicate to tree...
// Would update existing document references instead of creating new...
solver.addSuffixesToRadixTree("FOO");
String expected =
"○\n" +
"├── ○ FOO ([FOO])\n" +
"└── ○ O ([FOO])\n" +
" └── ○ O ([FOO])\n";
Assert.assertEquals(expected, PrettyPrinter.prettyPrint(solver.suffixTree));
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:15,代码来源:LCSubstringSolverTest.java
示例19: testBuildTreeByHand
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testBuildTreeByHand() {
// Build the tree by hand, as if the following strings were added: B, BA, BAN, BANDANA, BANAN, BANANA
// ○
// └── ○ B (1)
// └── ○ A (2)
// └── ○ N (3)
// ├── ○ AN (5)
// │ └── ○ A (6)
// └── ○ DANA (4)
final Node root, n1, n2, n3, n4, n5, n6;
n6 = getNodeFactory().createNode("A", 6, Collections.<Node>emptyList(), false);
n5 = getNodeFactory().createNode("AN", 5, Arrays.asList(n6), false);
n4 = getNodeFactory().createNode("DANA", 4, Collections.<Node>emptyList(), false);
n3 = getNodeFactory().createNode("N", 3, Arrays.asList(n4, n5), false); // note: it should sort alphabetically such that n5 is first
n2 = getNodeFactory().createNode("A", 2, Arrays.asList(n3), false);
n1 = getNodeFactory().createNode("B", 1, Arrays.asList(n2), false);
//noinspection NullableProblems
root = getNodeFactory().createNode("", null, Arrays.asList(n1), true);
String expected =
"○\n" +
"└── ○ B (1)\n" +
" └── ○ A (2)\n" +
" └── ○ N (3)\n" +
" ├── ○ AN (5)\n" +
" │ └── ○ A (6)\n" +
" └── ○ DANA (4)\n";
String actual = PrettyPrinter.prettyPrint(wrapNodeForPrinting(root));
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:35,代码来源:ConcurrentRadixTreeTest.java
示例20: testPut_AddToRoot
import com.googlecode.concurrenttrees.common.PrettyPrinter; //导入依赖的package包/类
@Test
public void testPut_AddToRoot() {
ConcurrentRadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(getNodeFactory());
tree.put("A", 1);
String expected =
"○\n" +
"└── ○ A (1)\n";
String actual = PrettyPrinter.prettyPrint(tree);
assertEquals(expected, actual);
}
开发者ID:npgall,项目名称:concurrent-trees,代码行数:11,代码来源:ConcurrentRadixTreeTest.java
注:本文中的com.googlecode.concurrenttrees.common.PrettyPrinter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论