1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 /* This file was generated by SableCC (http://www.sablecc.org/). */
\r
14 package org.simantics.spreadsheet.common.expression.node;
\r
18 @SuppressWarnings("nls")
\r
19 public abstract class Node implements Switchable, Cloneable
\r
21 private Node parent;
\r
24 public abstract Object clone();
\r
26 public Node parent()
\r
31 void parent(@SuppressWarnings("hiding") Node parent)
\r
33 this.parent = parent;
\r
36 abstract void removeChild(Node child);
\r
37 abstract void replaceChild(Node oldChild, Node newChild);
\r
39 public void replaceBy(Node node)
\r
41 this.parent.replaceChild(this, node);
\r
44 protected String toString(Node node)
\r
48 return node.toString();
\r
54 protected String toString(List list)
\r
56 StringBuffer s = new StringBuffer();
\r
58 for(Iterator i = list.iterator(); i.hasNext();)
\r
63 return s.toString();
\r
66 @SuppressWarnings("unchecked")
\r
67 protected <T extends Node> T cloneNode(T node)
\r
71 return (T) node.clone();
\r
77 protected <T> List<T> cloneList(List<T> list)
\r
79 List<T> clone = new LinkedList<T>();
\r