KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > chaperon > model > extended > UniversalCharacter


1 /*
2  * Copyright (C) Chaperon. All rights reserved.
3  * -------------------------------------------------------------------------
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE file.
7  */

8
9 package net.sourceforge.chaperon.model.extended;
10
11 import net.sourceforge.chaperon.model.Violations;
12
13 /**
14  * This class describes an universal character. This pattern matches against all characters.
15  *
16  * @author <a HREF="mailto:stephan@apache.org">Stephan Michels</a>
17  * @version CVS $Id: UniversalCharacter.java,v 1.4 2004/01/07 08:28:49 benedikta Exp $
18  */

19 public class UniversalCharacter extends Pattern
20 {
21   /**
22    * Create a pattern for an universal character.
23    */

24   public UniversalCharacter() {}
25
26   public boolean isNullable()
27   {
28     return false;
29   }
30
31   public PatternSet getFirstSet()
32   {
33     PatternSet set = new PatternSet();
34     set.addPattern(this);
35     return set;
36   }
37
38   public PatternSet getLastSet()
39   {
40     PatternSet set = new PatternSet();
41     set.addPattern(this);
42     return set;
43   }
44
45   public char[] getLimits()
46   {
47     return new char[0];
48   }
49
50   public boolean contains(char minimum, char maximum)
51   {
52     return true;
53   }
54
55   public boolean contains(char c)
56   {
57     return true;
58   }
59
60   public String JavaDoc getSymbol()
61   {
62     return null;
63   }
64
65   /**
66    * Return a string representation of this pattern
67    *
68    * @return String representation of the pattern.
69    */

70   public String JavaDoc toString()
71   {
72     return ".";
73   }
74
75   /**
76    * Create a clone this pattern.
77    *
78    * @return Clone of this pattern.
79    *
80    * @throws CloneNotSupportedException If an exception occurs during the cloning.
81    */

82   public Object JavaDoc clone()
83   {
84     UniversalCharacter clone = new UniversalCharacter();
85     return clone;
86   }
87
88   /**
89    * Validates this pattern.
90    *
91    * @return Return a list of violations, if this pattern isn't valid.
92    */

93   public Violations validate()
94   {
95     return null;
96   }
97 }
98
Popular Tags