View Javadoc
1 /* FOREGEJ - FOrmatting REfactoring GEnerating Java 2 * 3 * Copyright (C) 2003 Andreas Arrgard 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 package com.octagroup.foregej.antlr; 20 import antlr.CommonHiddenStreamToken; 21 /*** 22 * The base representation of a token in the FOREGEJ system. 23 */ 24 public class BaseToken extends CommonHiddenStreamToken 25 { 26 /*** 27 * this flag states if there has been an AST created for this token 28 */ 29 private BaseAST ast_=null; 30 /*** 31 * Sets the token hidden before this one 32 * 33 * @param hiddenBefore 34 */ 35 public void setHiddenBefore(CommonHiddenStreamToken hiddenBefore) 36 { 37 super.setHiddenBefore(hiddenBefore); 38 } 39 /*** 40 * Sets the token hidden after this one 41 * 42 * @param hiddenAfter 43 */ 44 public void setHiddenAfter(CommonHiddenStreamToken hiddenAfter) 45 { 46 super.setHiddenAfter(hiddenAfter); 47 } 48 /*** 49 * Signals that an ast has been created. 50 * 51 * @param ast 52 */ 53 public void setCreatedAst(BaseAST ast) 54 { 55 ast_=ast; 56 } 57 /*** 58 * Signals if an ast has been created for this token. This flag is 59 * updated when the 60 * 61 * @return 62 */ 63 public boolean isAstCreated() 64 { 65 return ast_!=null; 66 } 67 /*** 68 * Returns the created ast. 69 * 70 * @return 71 */ 72 public BaseAST getCreatedAst() 73 { 74 return ast_; 75 } 76 /*** 77 * Returns true if this token is after the supplied token. 78 * 79 * @param token 80 * @return 81 */ 82 public boolean isAfter(BaseToken token) 83 { 84 if(getLine()<token.getLine()) return false; 85 if(getLine()==token.getLine()&& 86 getColumn()<=token.getColumn()) return false; 87 return true; 88 } 89 /*** 90 * Returns true if this token is after the supplied token. 91 * 92 * @param token 93 * @return 94 */ 95 public boolean isBefore(BaseToken token) 96 { 97 if(getLine()>token.getLine()) return false; 98 if(getLine()==token.getLine()&& 99 getColumn()>=token.getColumn()) return false; 100 return true; 101 } 102 }

This page was automatically generated by Maven