Skip to content
Snippets Groups Projects
Commit 0cf84d28 authored by Anian Bühler's avatar Anian Bühler
Browse files

removed const-var -> replaced by #defines

parent 0584c82a
No related branches found
No related tags found
1 merge request!1dev_prefereences to master
...@@ -4,7 +4,6 @@ import com.ardublock.translator.Translator; ...@@ -4,7 +4,6 @@ import com.ardublock.translator.Translator;
import com.ardublock.translator.block.TranslatorBlock; import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.SocketNullException; import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;
import com.ardublock.translator.block.numbers.StringBlock;
public class PsnSetInterval extends TranslatorBlock public class PsnSetInterval extends TranslatorBlock
......
...@@ -35,7 +35,7 @@ public class SetterVariableDigitalBlock extends TranslatorBlock ...@@ -35,7 +35,7 @@ public class SetterVariableDigitalBlock extends TranslatorBlock
TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1); TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1);
String value = tb_Value.toCode().replaceAll(regex, ""); String value = tb_Value.toCode().replaceAll(regex, "");
if (!(tb_Name instanceof VariableDigitalBlock) && !(tb_Name instanceof LocalVariableDigitalBlock) && !(tb_Name instanceof ConstantDigitalBlock)) { if (!(tb_Name instanceof VariableDigitalBlock) && !(tb_Name instanceof LocalVariableDigitalBlock)) {// && !(tb_Name instanceof ConstantDigitalBlock)) {
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.digital_var_slot")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.digital_var_slot"));
} }
...@@ -57,7 +57,7 @@ public class SetterVariableDigitalBlock extends TranslatorBlock ...@@ -57,7 +57,7 @@ public class SetterVariableDigitalBlock extends TranslatorBlock
} }
} }
//CONSTANT //CONSTANT
else if ((tb_Name instanceof ConstantDigitalBlock) ){ /*else if ((tb_Name instanceof ConstantDigitalBlock) ){
if(variableName.contains(newMarker)){ if(variableName.contains(newMarker)){
variableName = variableName.replaceAll(regex, ""); variableName = variableName.replaceAll(regex, "");
translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration
...@@ -71,7 +71,7 @@ public class SetterVariableDigitalBlock extends TranslatorBlock ...@@ -71,7 +71,7 @@ public class SetterVariableDigitalBlock extends TranslatorBlock
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write"));
} }
return ""; //Break without return value if CONST is used return ""; //Break without return value if CONST is used
} }*/
return variableName + " = " + value + suffix + ";\n"; return variableName + " = " + value + suffix + ";\n";
} }
......
...@@ -35,7 +35,7 @@ public class SetterVariableNumberBlock extends TranslatorBlock ...@@ -35,7 +35,7 @@ public class SetterVariableNumberBlock extends TranslatorBlock
TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1); TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1);
String value = tb_Value.toCode().replaceAll(regex, ""); String value = tb_Value.toCode().replaceAll(regex, "");
if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock) && !(tb_Name instanceof ConstantNumberBlock)) { if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock)){// && !(tb_Name instanceof ConstantNumberBlock)) {
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot"));
} }
...@@ -56,7 +56,7 @@ public class SetterVariableNumberBlock extends TranslatorBlock ...@@ -56,7 +56,7 @@ public class SetterVariableNumberBlock extends TranslatorBlock
} }
} }
//CONSTANT //CONSTANT
else if ((tb_Name instanceof ConstantNumberBlock) ){ /*else if ((tb_Name instanceof ConstantNumberBlock) ){
if(variableName.contains(newMarker)){ if(variableName.contains(newMarker)){
variableName = variableName.replaceAll(regex, ""); variableName = variableName.replaceAll(regex, "");
translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration
...@@ -66,7 +66,7 @@ public class SetterVariableNumberBlock extends TranslatorBlock ...@@ -66,7 +66,7 @@ public class SetterVariableNumberBlock extends TranslatorBlock
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write"));
} }
return ""; //Break without return value if CONST is used return ""; //Break without return value if CONST is used
} }*/
return variableName + " = " + value + suffix + ";\n"; return variableName + " = " + value + suffix + ";\n";
} }
......
...@@ -30,7 +30,7 @@ public class SetterVariableNumberByteBlock extends TranslatorBlock ...@@ -30,7 +30,7 @@ public class SetterVariableNumberByteBlock extends TranslatorBlock
TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1); TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1);
String value = tb_Value.toCode().replaceAll(regex, ""); String value = tb_Value.toCode().replaceAll(regex, "");
if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock) && !(tb_Name instanceof ConstantNumberBlock)) { if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock)){// && !(tb_Name instanceof ConstantNumberBlock)) {
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot"));
} }
...@@ -52,7 +52,7 @@ public class SetterVariableNumberByteBlock extends TranslatorBlock ...@@ -52,7 +52,7 @@ public class SetterVariableNumberByteBlock extends TranslatorBlock
} }
} }
//CONSTANT //CONSTANT
else if ((tb_Name instanceof ConstantNumberBlock) ){ /*else if ((tb_Name instanceof ConstantNumberBlock) ){
if(variableName.contains(newMarker)){ if(variableName.contains(newMarker)){
variableName = variableName.replaceAll(regex, ""); variableName = variableName.replaceAll(regex, "");
translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration
...@@ -62,7 +62,7 @@ public class SetterVariableNumberByteBlock extends TranslatorBlock ...@@ -62,7 +62,7 @@ public class SetterVariableNumberByteBlock extends TranslatorBlock
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write"));
} }
return ""; //Break without return value if CONST is used return ""; //Break without return value if CONST is used
} }*/
return variableName + " = " + value + suffix + ";\n"; return variableName + " = " + value + suffix + ";\n";
} }
......
...@@ -31,7 +31,7 @@ public class SetterVariableNumberFloatBlock extends TranslatorBlock ...@@ -31,7 +31,7 @@ public class SetterVariableNumberFloatBlock extends TranslatorBlock
TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1); TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1);
String value = tb_Value.toCode().replaceAll(regex, ""); String value = tb_Value.toCode().replaceAll(regex, "");
if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock) && !(tb_Name instanceof ConstantNumberBlock)) { if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock)){// && !(tb_Name instanceof ConstantNumberBlock)) {
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot"));
} }
...@@ -53,7 +53,7 @@ public class SetterVariableNumberFloatBlock extends TranslatorBlock ...@@ -53,7 +53,7 @@ public class SetterVariableNumberFloatBlock extends TranslatorBlock
} }
} }
//CONSTANT //CONSTANT
else if ((tb_Name instanceof ConstantNumberBlock) ){ /*else if ((tb_Name instanceof ConstantNumberBlock) ){
if(variableName.contains(newMarker)){ if(variableName.contains(newMarker)){
variableName = variableName.replaceAll(regex, ""); variableName = variableName.replaceAll(regex, "");
translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration
...@@ -63,7 +63,7 @@ public class SetterVariableNumberFloatBlock extends TranslatorBlock ...@@ -63,7 +63,7 @@ public class SetterVariableNumberFloatBlock extends TranslatorBlock
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write"));
} }
return ""; //Break without return value if CONST is used return ""; //Break without return value if CONST is used
} }*/
return variableName + " = " + value + suffix + ";\n"; return variableName + " = " + value + suffix + ";\n";
} }
......
...@@ -31,7 +31,7 @@ public class SetterVariableNumberLongBlock extends TranslatorBlock ...@@ -31,7 +31,7 @@ public class SetterVariableNumberLongBlock extends TranslatorBlock
TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1); TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1);
String value = tb_Value.toCode().replaceAll(regex, ""); String value = tb_Value.toCode().replaceAll(regex, "");
if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock) && !(tb_Name instanceof ConstantNumberBlock)) { if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock)){// && !(tb_Name instanceof ConstantNumberBlock)) {
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot"));
} }
...@@ -52,7 +52,7 @@ public class SetterVariableNumberLongBlock extends TranslatorBlock ...@@ -52,7 +52,7 @@ public class SetterVariableNumberLongBlock extends TranslatorBlock
} }
} }
//CONSTANT //CONSTANT
else if ((tb_Name instanceof ConstantNumberBlock) ){ /*else if ((tb_Name instanceof ConstantNumberBlock) ){
if(variableName.contains(newMarker)){ if(variableName.contains(newMarker)){
variableName = variableName.replaceAll(regex, ""); variableName = variableName.replaceAll(regex, "");
translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration
...@@ -62,7 +62,7 @@ public class SetterVariableNumberLongBlock extends TranslatorBlock ...@@ -62,7 +62,7 @@ public class SetterVariableNumberLongBlock extends TranslatorBlock
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write"));
} }
return ""; //Break without return value if CONST is used return ""; //Break without return value if CONST is used
} }*/
return variableName + " = " + value + suffix + ";\n"; return variableName + " = " + value + suffix + ";\n";
} }
......
...@@ -31,7 +31,7 @@ public class SetterVariableNumberUnsignedLongBlock extends TranslatorBlock ...@@ -31,7 +31,7 @@ public class SetterVariableNumberUnsignedLongBlock extends TranslatorBlock
TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1); TranslatorBlock tb_Value = this.getRequiredTranslatorBlockAtSocket(1);
String value = tb_Value.toCode().replaceAll(regex, ""); String value = tb_Value.toCode().replaceAll(regex, "");
if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock) && !(tb_Name instanceof ConstantNumberBlock)) { if (!(tb_Name instanceof VariableNumberBlock) && !(tb_Name instanceof LocalVariableNumberBlock)){// && !(tb_Name instanceof ConstantNumberBlock)) {
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot"));
} }
...@@ -53,7 +53,7 @@ public class SetterVariableNumberUnsignedLongBlock extends TranslatorBlock ...@@ -53,7 +53,7 @@ public class SetterVariableNumberUnsignedLongBlock extends TranslatorBlock
} }
} }
//CONSTANT //CONSTANT
else if ((tb_Name instanceof ConstantNumberBlock) ){ /*else if ((tb_Name instanceof ConstantNumberBlock) ){
if(variableName.contains(newMarker)){ if(variableName.contains(newMarker)){
variableName = variableName.replaceAll(regex, ""); variableName = variableName.replaceAll(regex, "");
translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration translator.addNumberVariable(variableName, variableName); //remove the "new" Tag after declaration
...@@ -63,7 +63,7 @@ public class SetterVariableNumberUnsignedLongBlock extends TranslatorBlock ...@@ -63,7 +63,7 @@ public class SetterVariableNumberUnsignedLongBlock extends TranslatorBlock
throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write")); throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_const_write"));
} }
return ""; //Break without return value if CONST is used return ""; //Break without return value if CONST is used
} }*/
return variableName + " = " + value + suffix + ";\n"; return variableName + " = " + value + suffix + ";\n";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment