01: /*
02: * $Id: UnaryParent.java,v 1.4 2002/09/16 08:05:05 jkl Exp $
03: *
04: * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
05: *
06: * Use is subject to license terms, as defined in
07: * Anvil Sofware License, Version 1.1. See LICENSE
08: * file, or http://njet.org/license-1.1.txt
09: */
10: package anvil.script.expression;
11:
12: import anvil.codec.Code;
13: import anvil.script.compiler.ByteCompiler;
14:
15: /**
16: * class UnaryParent
17: *
18: * @author: Jani Lehtimäki
19: */
20: public abstract class UnaryParent extends Parent {
21:
22: protected Node _child;
23:
24: public UnaryParent() {
25: super ();
26: _child = null;
27: }
28:
29: public UnaryParent(Node child) {
30: _child = child;
31: }
32:
33: public final int childs() {
34: return 1;
35: }
36:
37: public final Node getChild() {
38: return _child;
39: }
40:
41: public final Node getChild(int i) {
42: if (i == 0) {
43: return _child;
44: } else {
45: return null;
46: }
47: }
48:
49: public final void setChild(int i, Node child) {
50: if (i == 0) {
51: _child = child;
52: }
53: }
54:
55: public void compile(ByteCompiler context, int operation) {
56: _child.compile(context, operation);
57: }
58:
59: }
|