1 8 9 package net.sourceforge.chaperon.model.pattern; 10 11 import net.sourceforge.chaperon.model.Violations; 12 13 19 public class UniversalCharacter extends Pattern 20 { 21 24 public UniversalCharacter() {} 25 26 31 public String toString() 32 { 33 StringBuffer buffer = new StringBuffer (); 34 35 buffer.append("."); 36 37 if ((getMinOccurs()==1) && (getMaxOccurs()==1)) 38 { 39 } 41 else if ((getMinOccurs()==0) && (getMaxOccurs()==1)) 42 buffer.append("?"); 43 else if ((getMinOccurs()==0) && (getMaxOccurs()==Integer.MAX_VALUE)) 44 buffer.append("*"); 45 else if ((getMinOccurs()==1) && (getMaxOccurs()==Integer.MAX_VALUE)) 46 buffer.append("+"); 47 else 48 { 49 buffer.append("{"); 50 buffer.append(String.valueOf(getMinOccurs())); 51 buffer.append(","); 52 buffer.append(String.valueOf(getMaxOccurs())); 53 buffer.append("}"); 54 } 55 56 return buffer.toString(); 57 } 58 59 66 public Object clone() 67 { 68 UniversalCharacter clone = new UniversalCharacter(); 69 70 clone.setMinOccurs(getMinOccurs()); 71 clone.setMaxOccurs(getMaxOccurs()); 72 73 return clone; 74 } 75 76 81 public Violations validate() 82 { 83 return null; 84 } 85 } 86 | Popular Tags |