mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 00:34:20 +03:00
Константа ZERO вынесена в класс NumberValue
This commit is contained in:
parent
7756e36179
commit
ebed2615d5
@ -9,7 +9,6 @@ import java.util.Map;
|
||||
*/
|
||||
public final class Functions {
|
||||
|
||||
private static final NumberValue ZERO = new NumberValue(0);
|
||||
private static final Map<String, Function> functions;
|
||||
|
||||
static {
|
||||
@ -30,7 +29,7 @@ public final class Functions {
|
||||
for (Value arg : args) {
|
||||
System.out.println(arg.asString());
|
||||
}
|
||||
return ZERO;
|
||||
return NumberValue.ZERO;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@ package com.annimon.ownlang.lib;
|
||||
*/
|
||||
public final class NumberValue implements Value {
|
||||
|
||||
public static final NumberValue ZERO = new NumberValue(0);
|
||||
|
||||
private final double value;
|
||||
|
||||
public NumberValue(boolean value) {
|
||||
|
@ -9,7 +9,6 @@ import java.util.Map;
|
||||
*/
|
||||
public final class Variables {
|
||||
|
||||
private static final NumberValue ZERO = new NumberValue(0);
|
||||
private static final Map<String, Value> variables;
|
||||
|
||||
static {
|
||||
@ -25,7 +24,7 @@ public final class Variables {
|
||||
}
|
||||
|
||||
public static Value get(String key) {
|
||||
if (!isExists(key)) return ZERO;
|
||||
if (!isExists(key)) return NumberValue.ZERO;
|
||||
return variables.get(key);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user