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