/* -------------------------------------------------------------------------- */ /* */ /* SCRIPT FUNCTION STRUCTURE CLASS */ /* */ /* Frans Coenen */ /* */ /* Thursday 4 October 2007 */ /* */ /* Department of Computer Science */ /* The University of Liverpool */ /* */ /* -------------------------------------------------------------------------- */ /** Structure in which to store details of functions located in script fragments. */ class ScriptFunctionStruct { /** The function name (lable) typically contained between keyword 'function' and a following '(' (but not necessarily so). */ private String label= null; /** The line on which the function starts. */ private int startLineNum=0; /** The line on which the function ends (may be same as start line). */ private int endLineNum=0; /** Array of function arguments (if any). */ private String[] arguments = null; /** The type or language field. */ private String typeOrLanguage = "NA"; /** Comment flag, set to true if commented out. */ private boolean commentedOutFlag = false; /** Short text explaning what the function does. */ private String note = "No information"; /* --------------------------- */ /* */ /* SET METHODS */ /* */ /* --------------------------- */ /** Sets the start line number field of the function. @param n the given line number value. */ public void setStartLineNum(int n) { startLineNum = n; } /** Sets the end line number field of the function. @param n the given line number value. */ public void setEndLineNum(int n) { endLineNum = n; } /** Sets the label field. @param s the given label. */ public void setLabel(String s) { label = s; } /** Sets the type/langauge field. @param s the given label. */ public void setTypeOrLang(String s) { typeOrLanguage = s; } /** Sets commented out flag to given value. @param the given value. */ public void setCommentedOutFlag(boolean value) { commentedOutFlag = value; } /** Sets the note label with the given string. @param s the given string. */ public void setNote(String s) { note = s; } /** Adds an argument to the arguments array. @param arg the given argument. */ public void setArguments(String[] args) { if (args!=null) { arguments = new String[args.length]; // Populate array for (int i=0;i" + (endLineNum+1) + "" + typeOrLanguage + "" + "" + label + " ("; // Add argumemnts if any if (arguments!=null) { for(int i=0;i0) s = s + ", "; s = s + arguments[i]; } } // End and return s = s + ")"; if (commentedOutFlag) s = s + "Commented out! "; s = s + note + ""; return(s); } }