1 15 package org.apache.hivemind; 16 17 22 public abstract class Occurances 23 { 24 27 public static final Occurances UNBOUNDED = new Occurances("UNBOUNDED") 28 { 29 public boolean inRange(int count) 30 { 31 return true; 32 } 33 }; 34 35 38 39 public static final Occurances OPTIONAL = new Occurances("OPTIONAL") 40 { 41 public boolean inRange(int count) 42 { 43 return count < 2; 44 } 45 }; 46 47 50 51 public static final Occurances REQUIRED = new Occurances("REQUIRED") 52 { 53 public boolean inRange(int count) 54 { 55 return count == 1; 56 } 57 }; 58 59 62 63 public static final Occurances ONE_PLUS = new Occurances("ONE_PLUS") 64 { 65 public boolean inRange(int count) 66 { 67 return count > 0; 68 } 69 }; 70 71 public static final Occurances NONE = new Occurances("NONE") 72 { 73 public boolean inRange(int count) 74 { 75 return count == 0; 76 } 77 }; 78 79 private String _name; 80 81 private Occurances(String name) 82 { 83 _name = name; 84 } 85 86 public String getName() 87 { 88 return _name; 89 } 90 91 public String toString() 92 { 93 return "Occurances[" + _name + "]"; 94 } 95 96 103 public abstract boolean inRange(int count); 104 105 } | Popular Tags |