1 package org.objectweb.jac.core.parsers.acc; 2 3 6 public class SyntaxElement { 7 8 String name; 9 10 int left; 11 12 int right; 13 14 SyntaxElement parent; 15 16 public SyntaxElement(String name, int left, int right) { 17 this.name = name; 18 this.left = left; 19 this.right = right; 20 } 21 public String getName() { 22 return name; 23 } 24 public int getLeft() { 25 return left; 26 } 27 public int getRight() { 28 return right; 29 } 30 public void setParent(SyntaxElement parent) { 31 this.parent = parent; 32 } 33 34 public SyntaxElement getParent() { 35 return parent; 36 } 37 38 43 public SyntaxElement findParent(String searchedName) { 44 if (name.equals(searchedName)) 45 return this; 46 else if (parent==null) 47 return null; 48 else 49 return parent.findParent(searchedName); 50 } 51 52 public String toString() { 53 return name+":"+left+"-"+right; 54 } 55 } 56 | Popular Tags |