View Javadoc

1   ////////////////////////////////////////////////////////////////////////////////
2   // MillScript-XML: an Open Spice interpreter and batch website creation tool
3   // Copyright (C) 2005 Kevin Rogers
4   //
5   // This file is part of MillScript-XML.
6   //
7   // MillScript-XML is free software; you can redistribute it and/or modify it under
8   // the terms of the GNU General Public License as published by the Free
9   // Software Foundation; either version 2 of the License, or (at your option)
10  // any later version.
11  //
12  // MillScript-XML is distributed in the hope that it will be useful, but WITHOUT
13  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  // more details.
16  //
17  // You should have received a copy of the GNU General Public License along with
18  // MillScript-XML; if not, write to the Free Software Foundation, Inc., 59 Temple
19  // Place, Suite 330, Boston, MA  02111-1307  USA
20  ////////////////////////////////////////////////////////////////////////////////
21  package org.millscript.commons.xml.token;
22  
23  import org.millscript.commons.alert.Alert;
24  import org.millscript.commons.alert.AlertDecorator;
25  import org.millscript.commons.xml.api.token.NotationDeclToken;
26  import org.millscript.commons.xml.api.token.TokenVisitor;
27  
28  /**
29   * This class provides a default implementation of the notation declaration
30   * token.
31   */
32  public class NotationDeclTokenImpl implements AlertDecorator, NotationDeclToken {
33  
34      /**
35       * The notation name.
36       */
37      private final String name;
38  
39      /**
40       * The public identifier.
41       */
42      private final String publicIdentifier;
43  
44      /**
45       * The system identifier.
46       */
47      private final String systemIdentifier;
48  
49      /**
50       * Constructs a new notation declaration token with the specified notation
51       * name, public and system identifiers.
52       *
53       * @param n the notation name
54       * @param p the public identifier
55       * @param s the system identifier
56       */
57      public NotationDeclTokenImpl( final String n, final String p, final String s ) {
58          this.name = n;
59          this.publicIdentifier = p;
60          this.systemIdentifier = s;
61      }
62  
63      /**
64       * @see org.millscript.commons.alert.AlertDecorator#decorate(org.millscript.commons.alert.Alert)
65       */
66      public Alert decorate( final Alert alert ) {
67          return alert.culprit(
68              "notationdecl",
69              "<!NOTATION " + this.name + " ..."
70          );
71      }
72  
73      /**
74       * @see org.millscript.commons.xml.api.token.NotationDeclToken#getName()
75       */
76      public String getName() {
77          return this.name;
78      }
79  
80      /**
81       * @see org.millscript.commons.xml.api.token.NotationDeclToken#getPubidLiteral()
82       */
83      public String getPubidLiteral() {
84          return this.publicIdentifier;
85      }
86  
87      /**
88       * @see org.millscript.commons.xml.api.token.NotationDeclToken#getSystemLiteral()
89       */
90      public String getSystemLiteral() {
91          return this.systemIdentifier;
92      }
93  
94      /**
95       * @see org.millscript.commons.xml.api.token.Token#visit(org.millscript.commons.xml.api.token.TokenVisitor)
96       */
97      public void visit( final TokenVisitor tokenVisitor ) {
98          tokenVisitor.visit( this );
99      }
100 
101 }