01: /*
02: * Copyright (C) Chaperon. All rights reserved.
03: * -------------------------------------------------------------------------
04: * This software is published under the terms of the Apache Software License
05: * version 1.1, a copy of which has been included with this distribution in
06: * the LICENSE file.
07: */
08:
09: 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: * Create a pattern for an universal character.
22: */
23: public UniversalCharacter() {
24: }
25:
26: public boolean isNullable() {
27: return false;
28: }
29:
30: public PatternSet getFirstSet() {
31: PatternSet set = new PatternSet();
32: set.addPattern(this );
33: return set;
34: }
35:
36: public PatternSet getLastSet() {
37: PatternSet set = new PatternSet();
38: set.addPattern(this );
39: return set;
40: }
41:
42: public char[] getLimits() {
43: return new char[0];
44: }
45:
46: public boolean contains(char minimum, char maximum) {
47: return true;
48: }
49:
50: public boolean contains(char c) {
51: return true;
52: }
53:
54: public String getSymbol() {
55: return null;
56: }
57:
58: /**
59: * Return a string representation of this pattern
60: *
61: * @return String representation of the pattern.
62: */
63: public String toString() {
64: return ".";
65: }
66:
67: /**
68: * Create a clone this pattern.
69: *
70: * @return Clone of this pattern.
71: *
72: * @throws CloneNotSupportedException If an exception occurs during the cloning.
73: */
74: public Object clone() {
75: UniversalCharacter clone = new UniversalCharacter();
76: return clone;
77: }
78:
79: /**
80: * Validates this pattern.
81: *
82: * @return Return a list of violations, if this pattern isn't valid.
83: */
84: public Violations validate() {
85: return null;
86: }
87: }
|