1 36 37 package jnlp.sample.util; 38 import java.util.ArrayList ; 39 import java.util.StringTokenizer ; 40 41 48 public class VersionString { 49 private ArrayList _versionIds; 50 51 52 public VersionString(String vs) { 53 _versionIds = new ArrayList (); 54 if (vs != null) { 55 StringTokenizer st = new StringTokenizer (vs, " ", false); 56 while(st.hasMoreElements()) { 57 _versionIds.add(new VersionID(st.nextToken())); 59 } 60 } 61 } 62 63 64 public boolean contains(VersionID m) { 65 for(int i = 0; i < _versionIds.size(); i++) { 66 VersionID vi = (VersionID)_versionIds.get(i); 67 boolean check = vi.match(m); 68 if (check) return true; 69 } 70 return false; 71 } 72 73 74 public boolean contains(String versionid) { 75 return contains(new VersionID(versionid)); 76 } 77 78 79 public boolean containsGreaterThan(VersionID m) { 80 for(int i = 0; i < _versionIds.size(); i++) { 81 VersionID vi = (VersionID)_versionIds.get(i); 82 boolean check = vi.isGreaterThan(m); 83 if (check) return true; 84 } 85 return false; 86 } 87 88 89 public boolean containsGreaterThan(String versionid) { 90 return containsGreaterThan(new VersionID(versionid)); 91 } 92 93 94 static public boolean contains(String vs, String vi) { 95 return (new VersionString(vs)).contains(vi); 96 } 97 98 99 public String toString() { 100 StringBuffer sb = new StringBuffer (); 101 for(int i = 0; i < _versionIds.size(); i++) { 102 sb.append(_versionIds.get(i).toString()); 103 sb.append(' '); 104 } 105 return sb.toString(); 106 } 107 } 108 109 110 111 | Popular Tags |