ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/testResidueSelectionString.java
Revision: 419
Committed: Thu Nov 22 14:09:18 2007 UTC (16 years, 11 months ago) by duarte
Original Path: branches/aglappe-jung/testResidueSelectionString.java
File size: 1098 byte(s)
Log Message:
Re-branching for JUNG2 development
Line User Rev File contents
1 stehr 351 import proteinstructure.NodeSet;
2    
3     /**
4     * Program to test parsing of a residue selection string (e.g. 1-3,5,7-8)
5     */
6     public class testResidueSelectionString {
7    
8     public static void main(String[] args) {
9    
10     String[] tp = {"1","10","10,1","10-9","10-10,5","1,6-7,8-9"};
11     String[] tn = {"", "-",",","1,1,","1,-2","10-9-7",",4","4--5","1.5","1,,2"," "};
12     int fp = 0, fn = 0;
13    
14     System.out.println("Positives:");
15     for(String selStr:tp) {
16     System.out.print(selStr + "\t\t");
17     if(NodeSet.isValidSelectionString(selStr)) {
18     System.out.println("ok");
19     } else {
20     System.out.println("error");
21     fn++;
22     }
23     }
24     System.out.println("Negatives:");
25     for(String selStr:tn) {
26     System.out.print(selStr + "\t\t");
27     if(!NodeSet.isValidSelectionString(selStr)) {
28     System.out.println("ok");
29     } else {
30     System.out.println("error");
31     fn++;
32     }
33     }
34     assert(fp == 0);
35     assert(fn == 0);
36    
37     System.out.println("Parsing:");
38     for(String selStr:tp) {
39     System.out.print(selStr + "\t\t");
40     NodeSet nodeSet = NodeSet.parseSelectionString(selStr);
41     System.out.println(nodeSet);
42     }
43     }
44    
45     }