001 package sysModel.parser; 002 003 /** 004 * Default token visitor, all cases call the defaultCase method. 005 * 006 * @author Mathias Ricken 007 */ 008 public abstract class DefaultTokenVisitor implements ITokenVisitor { 009 /** 010 * Default case to be called of other methods are not overridden. 011 * 012 * @return visitor-specific return value 013 */ 014 public abstract Object defaultCase(); 015 016 /** 017 * Case to be called if end of file is reached. 018 * 019 * @return visitor-specific return value 020 */ 021 public Object endCase() { 022 return defaultCase(); 023 } 024 025 /** 026 * Case to be called if a word is read. 027 * 028 * @param word word 029 * @return visitor-specific return value 030 */ 031 public Object wordCase(String word) { 032 return defaultCase(); 033 } 034 035 /** 036 * Case to be called if a number is read. 037 * 038 * @param num number 039 * @return visitor-specific return value 040 */ 041 public Object numCase(double num) { 042 return defaultCase(); 043 } 044 045 /** 046 * Case to be called if an open parenthesis is read. 047 * 048 * @return visitor-specific return value 049 */ 050 public Object openCase() { 051 return defaultCase(); 052 } 053 054 /** 055 * Case to be called if a closed parenthesis is read. 056 * 057 * @return visitor-specific return value 058 */ 059 public Object closeCase() { 060 return defaultCase(); 061 } 062 063 /** 064 * Case to be called if a comma is read. 065 * 066 * @return visitor-specific return value 067 */ 068 public Object commaCase() { 069 return defaultCase(); 070 } 071 }