~ubuntu-branches/ubuntu/vivid/weka/vivid

« back to all changes in this revision

Viewing changes to weka/core/parser/java_cup/symbol.java

  • Committer: Bazaar Package Importer
  • Author(s): Soeren Sonnenburg, Torsten Werner, Soeren Sonnenburg
  • Date: 2008-10-30 06:42:46 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081030064246-648zj038l155host
Tags: 3.5.8+cup1-1
[ Torsten Werner ]
* Update Section field in doc-base file.
* Add Class-Path attribute to jar file.

[ Soeren Sonnenburg ]
* Update my email address to sonne@debian.org.
* Update copyright.
* Remove build, java cup and jflex from orig.tar.gz.
* Add cup and jflex as build dependency.
* Patch weka source to use cup from debian.
* Patch weka shell wrapper to use java-6-sun or openjdk.
* Obtain documentation from svn.
* Build depend on texlive-latex-extra (required to generate documentation).
* Add javadoc as build target.
* Use java-wrappers to start weka.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * STANDARD ML OF NEW JERSEY COPYRIGHT NOTICE, LICENSE AND DISCLAIMER.
3
 
 * 
4
 
 * Copyright (c) 1989-1998 by Lucent Technologies
5
 
 * 
6
 
 * Permission to use, copy, modify, and distribute this software and its
7
 
 * documentation for any purpose and without fee is hereby granted, provided
8
 
 * that the above copyright notice appear in all copies and that both the
9
 
 * copyright notice and this permission notice and warranty disclaimer appear
10
 
 * in supporting documentation, and that the name of Lucent Technologies, Bell
11
 
 * Labs or any Lucent entity not be used in advertising or publicity pertaining
12
 
 * to distribution of the software without specific, written prior permission.
13
 
 *
14
 
 * Lucent disclaims all warranties with regard to this software, including all
15
 
 * implied warranties of merchantability and fitness. In no event shall Lucent
16
 
 * be liable for any special, indirect or consequential damages or any damages
17
 
 * whatsoever resulting from loss of use, data or profits, whether in an action
18
 
 * of contract, negligence or other tortious action, arising out of or in
19
 
 * connection with the use or performance of this software. 
20
 
 *
21
 
 * Taken from this URL:
22
 
 * http://www.smlnj.org/license.html
23
 
 * 
24
 
 * This license is compatible with the GNU GPL (see section "Standard ML of New
25
 
 * Jersey Copyright License"):
26
 
 * http://www.gnu.org/licenses/license-list.html#StandardMLofNJ
27
 
 */
28
 
 
29
 
/*
30
 
 * Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
31
 
 */
32
 
 
33
 
package weka.core.parser.java_cup;
34
 
 
35
 
/** This abstract class serves as the base class for grammar symbols (i.e.,
36
 
 * both terminals and non-terminals).  Each symbol has a name string, and
37
 
 * a string giving the type of object that the symbol will be represented by
38
 
 * on the runtime parse stack.  In addition, each symbol maintains a use count
39
 
 * in order to detect symbols that are declared but never used, and an index
40
 
 * number that indicates where it appears in parse tables (index numbers are
41
 
 * unique within terminals or non terminals, but not across both).
42
 
 *
43
 
 * @see     weka.core.parser.java_cup.terminal
44
 
 * @see     weka.core.parser.java_cup.non_terminal
45
 
 * @version last updated: 7/3/96
46
 
 * @author  Frank Flannery
47
 
 */
48
 
public abstract class symbol {
49
 
   /*-----------------------------------------------------------*/
50
 
   /*--- Constructor(s) ----------------------------------------*/
51
 
   /*-----------------------------------------------------------*/
52
 
 
53
 
   /** Full constructor.
54
 
    * @param nm the name of the symbol.
55
 
    * @param tp a string with the type name.
56
 
    */
57
 
   public symbol(String nm, String tp)
58
 
     {
59
 
       /* sanity check */
60
 
       if (nm == null) nm = "";
61
 
 
62
 
       /* apply default if no type given */
63
 
       if (tp == null) tp = "Object";
64
 
 
65
 
       _name = nm;
66
 
       _stack_type = tp;
67
 
     }
68
 
 
69
 
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
70
 
 
71
 
   /** Constructor with default type. 
72
 
    * @param nm the name of the symbol.
73
 
    */
74
 
   public symbol(String nm)
75
 
     {
76
 
       this(nm, null);
77
 
     }
78
 
 
79
 
   /*-----------------------------------------------------------*/
80
 
   /*--- (Access to) Instance Variables ------------------------*/
81
 
   /*-----------------------------------------------------------*/
82
 
 
83
 
   /** String for the human readable name of the symbol. */
84
 
   protected String _name; 
85
 
 
86
 
   /** String for the human readable name of the symbol. */
87
 
   public String name() {return _name;}
88
 
 
89
 
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
90
 
 
91
 
   /** String for the type of object used for the symbol on the parse stack. */
92
 
   protected String _stack_type;
93
 
 
94
 
   /** String for the type of object used for the symbol on the parse stack. */
95
 
   public String stack_type() {return _stack_type;}
96
 
 
97
 
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
98
 
 
99
 
   /** Count of how many times the symbol appears in productions. */
100
 
   protected int _use_count = 0;
101
 
 
102
 
   /** Count of how many times the symbol appears in productions. */
103
 
   public int use_count() {return _use_count;}
104
 
 
105
 
   /** Increment the use count. */ 
106
 
   public void note_use() {_use_count++;}
107
 
 
108
 
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
109
 
 
110
 
  /** Index of this symbol (terminal or non terminal) in the parse tables.
111
 
   *  Note: indexes are unique among terminals and unique among non terminals,
112
 
   *  however, a terminal may have the same index as a non-terminal, etc. 
113
 
   */
114
 
   protected int _index;
115
 
 
116
 
  /** Index of this symbol (terminal or non terminal) in the parse tables.
117
 
   *  Note: indexes are unique among terminals and unique among non terminals,
118
 
   *  however, a terminal may have the same index as a non-terminal, etc. 
119
 
   */
120
 
   public int index() {return _index;}
121
 
 
122
 
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
123
 
 
124
 
  /** Indicate if this is a non-terminal.  Here in the base class we
125
 
   *  don't know, so this is abstract.  
126
 
   */
127
 
  public abstract boolean is_non_term();
128
 
 
129
 
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
130
 
 
131
 
  /** Convert to a string. */
132
 
  public String toString()
133
 
    {
134
 
      return name();
135
 
    }
136
 
 
137
 
  /*-----------------------------------------------------------*/
138
 
 
139
 
}