-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTree.java
62 lines (45 loc) · 1.5 KB
/
Tree.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package creek;
import java.util.*;
public interface Tree {
public Tree create ();
public String value ();
public Tree value ( String value );
public Map<String,Tree> map ();
public Tree map ( Map<String,Tree> branches );
// Array style
public Tree add ( List<String> values );
public Tree add ( String value );
public Tree add ( Tree value );
// Map/Object style
public Tree add ( Map<String,String> map );
public Tree add ( String key, String value );
public Tree add ( String key, Tree value );
public Tree get ( String key );
public Tree get ( List<String> path );
public Tree auto ( String key );
public Tree auto ( List<String> path );
public Set<String> keys ();
public List<String> values ();
public Collection<Tree> branches ();
public int size ();
// numerical keys
public boolean integerKeys ();
public String integerKey();
// numerical values
public int integerValue ();
public double doubleValue ();
public Tree increment ();
public Tree decrement ();
// I/O
public String serialize ();
public String serialize ( boolean readableText );
public Tree deserialize ( String serial ) throws Exception;
// Flattening
public Set<Set<Tree>> routes ();
public boolean routes ( Set<Set<Tree>> allRoutes, Set<Tree> startingPoint ); // true if no loops
public List<List<String>> paths ();
public void paths ( List<List<String>> allPaths, List<String> startingPoint );
// data
public Tree data ( List<List<String>> data );
public void synchronize ( Tree toUpdate );
}