main.test
Class DebugStringer

java.lang.Object
  extended bymain.test.DebugStringer

public class DebugStringer
extends Object

Author:
cbishop TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Constructor Summary
DebugStringer(LinkedHashMap inputMap, String var)
          Constructor for DebugStringer
 
Method Summary
 String arrayAssignInLoop()
          State that variable appears to be array filled in loop
 String assignBeforeUse()
          State that variable is not assigned before use in a loop
 String assignedInFor(boolean is)
          Show if variable assigned in for loop statement
 String bothSides(ArrayList onBothSides, boolean is)
          Show that variable appears on both side of assignment statement
 String conditionForAssignBranch()
          State that variable is not assigned in branch, or condition for assignment branch
 String conditionForAssignBranch(HashMap conditionalAssignmentBranch)
          Show that variable is condition for its assignment branch
 String directUse()
          State that variable is used directly in program
 String incDec()
          State that variable is not incremented or decremented within loop
 String incDec(ArrayList incDecStatements)
          Show that variable is incremented/decremented in loop
 String isOrganizer(ArrayList organizerStatements)
          Show that variable appears in organizer type statements
 String isTransformation(ArrayList transformations)
          Show that variable is transformation
 String loopUseNoAssign()
          State that variable is used for loop condition outside of loop in which it is assigned
 String methodAssigns(ArrayList methodAssigns)
          Show that variable appears to be assigned with return from method call
 String nestedBooleanAssign()
          State that variable does appear to be indirectly toggled within loop
 String nestedBooleanAssign(ArrayList nestedAssigns)
          Show that variable appears to be indirectly toggled within loop
 String noDirectUse()
          Show whether there is any direct use of the variable in teh program
 String notArray()
          State that variable does not appear to be array
 String notAssignedInLoop()
          State that variable is not assigned within a loop
 String notMethodAssign()
          State that variable is only assigned directly with value of other variable
 String notOrganizer()
          State that there appear to be no organizer statements for variable
 String notTransform()
          State that variable does not appear to be transformation
 String notUsedForAssignLoopCondition()
          State that variable is not used for condition of assignment loop
 String notUsedInAssign()
          State that variable is not used in assignment loop
 String showFoundInAssignmentLoop(HashMap foundInLoop, String what)
          Show statements found in loop in which variable is assigned
 String showFoundInLoop(HashMap foundInLoop, String what)
          Show statement for variable found in loop
 String temporary(ArrayList assignBeforeUse)
          Show that variable is assigned before use in loop
 String toggle()
          Show that variable is not toggled within loop
 String toggle(ArrayList toggleStatements)
          Show when toggle statement is found in loop
 String usedOutsideAssign()
          State that variable is used outside of loop in which it is assigned
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugStringer

public DebugStringer(LinkedHashMap inputMap,
                     String var)
Constructor for DebugStringer

Parameters:
inputMap - LinkedHashMap containing analysed statements
var - String variable for which string to be generated
Method Detail

showFoundInLoop

public String showFoundInLoop(HashMap foundInLoop,
                              String what)
Show statement for variable found in loop

Parameters:
foundInLoop - HashMap containing all statements for a given variable found in a loop
what - String specifying what sort of statement to look for
Returns:
String giving statement and its location in the program slice

showFoundInAssignmentLoop

public String showFoundInAssignmentLoop(HashMap foundInLoop,
                                        String what)
Show statements found in loop in which variable is assigned

Parameters:
foundInLoop - HashMap containing all statements found in assignment loop
what - String The sort of statemen to look for
Returns:
String giving statement and its location in the program slice

assignedInFor

public String assignedInFor(boolean is)
Show if variable assigned in for loop statement

Parameters:
is - boolean Whether statement is assigned in for loop statement
Returns:
String stating whether statement is assigned in for loop statement

noDirectUse

public String noDirectUse()
Show whether there is any direct use of the variable in teh program

Returns:
String indicating that there is no direct use of variable in the program

toggle

public String toggle(ArrayList toggleStatements)
Show when toggle statement is found in loop

Parameters:
toggleStatements - ArrayList of toggleStatements for variable
Returns:
String givin toggle statement found in a loop

toggle

public String toggle()
Show that variable is not toggled within loop

Returns:
String

conditionForAssignBranch

public String conditionForAssignBranch(HashMap conditionalAssignmentBranch)
Show that variable is condition for its assignment branch

Parameters:
conditionalAssignmentBranch - HashMap containing assignmentBranch condition statements
Returns:
String giving offending statement and whereabouts in program slice

conditionForAssignBranch

public String conditionForAssignBranch()
State that variable is not assigned in branch, or condition for assignment branch

Returns:
Message to that effect

bothSides

public String bothSides(ArrayList onBothSides,
                        boolean is)
Show that variable appears on both side of assignment statement

Parameters:
onBothSides - ArrayList containing statements in question
is - whether variable does appear on both sides or not
Returns:
String stating whether variable appears on both sides and if so giving offending statement

incDec

public String incDec(ArrayList incDecStatements)
Show that variable is incremented/decremented in loop

Parameters:
incDecStatements - ArrayList of incDec statements
Returns:
String giving offending statements

incDec

public String incDec()
State that variable is not incremented or decremented within loop

Returns:
String to that effect

notArray

public String notArray()
State that variable does not appear to be array

Returns:
String to that effect

notAssignedInLoop

public String notAssignedInLoop()
State that variable is not assigned within a loop

Returns:
String to that effect

notOrganizer

public String notOrganizer()
State that there appear to be no organizer statements for variable

Returns:
String to that effect

isOrganizer

public String isOrganizer(ArrayList organizerStatements)
Show that variable appears in organizer type statements

Parameters:
organizerStatements - ArrayList of organizer statements
Returns:
String confirming this and giving organizer statements in question

notTransform

public String notTransform()
State that variable does not appear to be transformation

Returns:
String to that effect

isTransformation

public String isTransformation(ArrayList transformations)
Show that variable is transformation

Parameters:
transformations - ArrayList containing transformation statements
Returns:
String showing transformation type statement for variable

nestedBooleanAssign

public String nestedBooleanAssign()
State that variable does appear to be indirectly toggled within loop

Returns:
String to that effect

nestedBooleanAssign

public String nestedBooleanAssign(ArrayList nestedAssigns)
Show that variable appears to be indirectly toggled within loop

Parameters:
nestedAssigns - ArrayList of nested boolean assignments
Returns:
String showing statements in question

methodAssigns

public String methodAssigns(ArrayList methodAssigns)
Show that variable appears to be assigned with return from method call

Parameters:
methodAssigns - ArrayList of assignment statements within method calls on right hand side
Returns:
String showing variable and statements in question

notUsedInAssign

public String notUsedInAssign()
State that variable is not used in assignment loop

Returns:
String to that effect

temporary

public String temporary(ArrayList assignBeforeUse)
Show that variable is assigned before use in loop

Parameters:
assignBeforeUse - ArrayList of statements
Returns:
String showing specific statements and fact that variable not used outside of loop

usedOutsideAssign

public String usedOutsideAssign()
State that variable is used outside of loop in which it is assigned

Returns:
String to that effect

assignBeforeUse

public String assignBeforeUse()
State that variable is not assigned before use in a loop

Returns:
String to that effect

notMethodAssign

public String notMethodAssign()
State that variable is only assigned directly with value of other variable

Returns:
String to that effect

arrayAssignInLoop

public String arrayAssignInLoop()
State that variable appears to be array filled in loop

Returns:
String to that effect

directUse

public String directUse()
State that variable is used directly in program

Returns:
String to that effect

notUsedForAssignLoopCondition

public String notUsedForAssignLoopCondition()
State that variable is not used for condition of assignment loop

Returns:
String to that effect

loopUseNoAssign

public String loopUseNoAssign()
State that variable is used for loop condition outside of loop in which it is assigned

Returns:
String to that effect