~ubuntu-branches/ubuntu/vivid/sablecc/vivid

« back to all changes in this revision

Viewing changes to src/org/sablecc/sablecc/node/Prods1.java

  • Committer: Bazaar Package Importer
  • Author(s): Etienne M. Gagnon
  • Date: 2004-01-25 13:28:01 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040125132801-0so74ui506b30b1q
Tags: 2.18.2-1
* New upstream release.
* Keep the org.sablecc.ant.taskdef.Sablecc ant task of the upstream
  package, closes: #213020.
* Improve man page.
* Update Standards-Version to 3.6.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
 
 * This file is part of SableCC.                             *
3
 
 * See the file "LICENSE" for copyright information and the  *
4
 
 * terms and conditions for copying, distribution and        *
5
 
 * modification of SableCC.                                  *
6
 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
7
 
 
8
 
package org.sablecc.sablecc.node;
9
 
 
10
 
import org.sablecc.sablecc.Switch;
11
 
import org.sablecc.sablecc.analysis.Analysis;
12
 
 
13
 
public final class Prods1 extends Prods
14
 
{
15
 
    public void apply(Switch sw)
16
 
    {
17
 
        ((Analysis) sw).caseProds1(this);
18
 
    }
19
 
 
20
 
    public String toString()
21
 
    {
22
 
        return ""
23
 
            + node1
24
 
            + node2;
25
 
    }
26
 
 
27
 
    private Prod node1;
28
 
 
29
 
    public Prod getNode1()
30
 
    {
31
 
        return node1;
32
 
    }
33
 
 
34
 
    public void setNode1(Prod node)
35
 
    {
36
 
        if(node1 != null)
37
 
        {
38
 
            node1.setParent(null);
39
 
        }
40
 
 
41
 
        if(node.getParent() != null)
42
 
        {
43
 
            node.getParent().removeChild(node);
44
 
        }
45
 
 
46
 
        node.setParent(this);
47
 
 
48
 
        node1 = node;
49
 
    }
50
 
 
51
 
    private Prods node2;
52
 
 
53
 
    public Prods getNode2()
54
 
    {
55
 
        return node2;
56
 
    }
57
 
 
58
 
    public void setNode2(Prods node)
59
 
    {
60
 
        if(node2 != null)
61
 
        {
62
 
            node2.setParent(null);
63
 
        }
64
 
 
65
 
        if(node.getParent() != null)
66
 
        {
67
 
            node.getParent().removeChild(node);
68
 
        }
69
 
 
70
 
        node.setParent(this);
71
 
 
72
 
        node2 = node;
73
 
    }
74
 
 
75
 
    void removeChild(Node child)
76
 
    {
77
 
        if(node1 == child)
78
 
        {
79
 
            node1 = null;
80
 
        }
81
 
 
82
 
        if(node2 == child)
83
 
        {
84
 
            node2 = null;
85
 
        }
86
 
 
87
 
    }
88
 
}
89