コード例 #1
0
 public String toString() {
   String rVal = "Add ";
   String varName = "";
   String varType = "";
   DeclareVariable var = getVariable();
   if (var != null) {
     if (var.getName() != null) {
       varName = var.getName();
     }
     if (var.getType() != null) {
       varType = var.getType().toString();
     }
   }
   rVal = rVal + varType + " variable: " + varName;
   return (rVal);
 }
コード例 #2
0
 public VariableType getVariableType() {
   if (variable == null) {
     return (null);
   } else {
     return (variable.getType());
   }
 }
コード例 #3
0
 public boolean equals(InstructionAndValues comp, ValueMapPath myPath) {
   Object obj = comp.getInstruction().getEnclosingInstructionProvider();
   if (obj instanceof AddVariableAction) {
     int rVal =
         variable.equalDeclaration(((AddVariableAction) obj).variable, comp.getValues(), myPath);
     if (rVal == DeclareVariable.DECLARATION_EQUAL) return (true);
     else if (rVal == DeclareVariable.DECLARATION_CONFLICTS) {
       // TODO: notify user here of conflicting declaration
       //      bring up both code bundles, and StatementBundles
       return (false);
     } else return (false);
   } else return (false);
 }
コード例 #4
0
 /*	public void writeDeclarationSection(Writer writer) throws IOException
 	{
 //		writer.write("//DECLARE_VARIABLE " + getVariable().getName() + "\n");
 		StatementBundle sb = this.getCodeBundleContainingMe().getStatementTemplateContainingMe().getStatementBundleImplementingMe();
 		getVariable().writeDeclarationSection(writer, sb);
 //		writer.write("//END_DECLARE_VARIABLE" + "\n");
 	}
 	public void writeMethodSection(Writer writer) throws IOException
 	{
 		StatementBundle sb = this.getCodeBundleContainingMe().getStatementTemplateContainingMe().getStatementBundleImplementingMe();
 		getVariable().writeMethodSection(writer, sb);
 	}*/
 public void setStatementBundleUsingMe(StatementBundle sb) {
   super.setStatementBundleUsingMe(sb);
   variable.setStatementBundleUsingMe(sb);
 }
コード例 #5
0
 public String getName() {
   if (variable != null) return variable.getName();
   else return "unknown_variable";
 }