~ubuntu-branches/ubuntu/oneiric/weka/oneiric

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner, Soeren Sonnenburg, Torsten Werner
  • Date: 2008-08-10 21:27:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080810212705-tr8etpnkdx2ziktp
Tags: 3.5.8-1
[ Soeren Sonnenburg ]
* Bump Standards Version to 3.8.0.
* Remove references to non-free Java in debian/copyright.

[ Torsten Werner ]
* new upstream release
* Switch to openjdk-6.
* Move package to main.

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 class represents a transition in an LALR viable prefix recognition 
 
36
 *  machine.  Transitions can be under terminals for non-terminals.  They are
 
37
 *  internally linked together into singly linked lists containing all the 
 
38
 *  transitions out of a single state via the _next field.
 
39
 *
 
40
 * @see     weka.core.parser.java_cup.lalr_state
 
41
 * @version last updated: 11/25/95
 
42
 * @author  Scott Hudson
 
43
 *
 
44
 */
 
45
public class lalr_transition {
 
46
 
 
47
  /*-----------------------------------------------------------*/
 
48
  /*--- Constructor(s) ----------------------------------------*/
 
49
  /*-----------------------------------------------------------*/
 
50
 
 
51
  /** Full constructor.
 
52
   * @param on_sym  symbol we are transitioning on.
 
53
   * @param to_st   state we transition to.
 
54
   * @param nxt     next transition in linked list.
 
55
   */
 
56
  public lalr_transition(symbol on_sym, lalr_state to_st, lalr_transition nxt)
 
57
    throws internal_error
 
58
    {
 
59
      /* sanity checks */
 
60
      if (on_sym == null)
 
61
        throw new internal_error("Attempt to create transition on null symbol");
 
62
      if (to_st == null)
 
63
        throw new internal_error("Attempt to create transition to null state");
 
64
 
 
65
      /* initialize */
 
66
      _on_symbol = on_sym;
 
67
      _to_state  = to_st;
 
68
      _next      = nxt;
 
69
    }
 
70
 
 
71
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
 
72
 
 
73
  /** Constructor with null next. 
 
74
   * @param on_sym  symbol we are transitioning on.
 
75
   * @param to_st   state we transition to.
 
76
   */
 
77
  public lalr_transition(symbol on_sym, lalr_state to_st) throws internal_error
 
78
    {
 
79
      this(on_sym, to_st, null);
 
80
    }
 
81
 
 
82
  /*-----------------------------------------------------------*/
 
83
  /*--- (Access to) Instance Variables ------------------------*/
 
84
  /*-----------------------------------------------------------*/
 
85
 
 
86
  /** The symbol we make the transition on. */
 
87
  protected symbol _on_symbol;
 
88
 
 
89
  /** The symbol we make the transition on. */
 
90
  public symbol on_symbol() {return _on_symbol;}
 
91
 
 
92
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
 
93
 
 
94
  /** The state we transition to. */
 
95
  protected lalr_state _to_state;
 
96
 
 
97
  /** The state we transition to. */
 
98
  public lalr_state to_state() {return _to_state;}
 
99
 
 
100
  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
 
101
 
 
102
  /** Next transition in linked list of transitions out of a state */
 
103
  protected lalr_transition _next;
 
104
 
 
105
  /** Next transition in linked list of transitions out of a state */
 
106
  public lalr_transition next() {return _next;}
 
107
 
 
108
  /*-----------------------------------------------------------*/
 
109
  /*--- General Methods ---------------------------------------*/
 
110
  /*-----------------------------------------------------------*/
 
111
 
 
112
  /** Convert to a string. */
 
113
  public String toString()
 
114
    {
 
115
      String result;
 
116
 
 
117
      result = "transition on " + on_symbol().name() + " to state [";
 
118
      result += _to_state.index();
 
119
      result += "]";
 
120
 
 
121
      return result;
 
122
    }
 
123
 
 
124
  /*-----------------------------------------------------------*/
 
125
}