cleanup and added requirement for floats to start with 0.2
This commit is contained in:
1 parent
974aa51e2a
commit
dab9c5debe
4 files changed
+6
-17
No files matched your search
@@ -1900,7 +1900,7 @@ public class Expression implements Cloneable
|
|||||||
|
|
||||||
addUnaryFunction("pairs", v -> {
|
addUnaryFunction("pairs", v -> {
|
||||||
if (v instanceof MapValue)
|
if (v instanceof MapValue)
|
||||||
return new ListValue(((MapValue) v).getMap().entrySet().stream().map(
|
return ListValue.wrap(((MapValue) v).getMap().entrySet().stream().map(
|
||||||
(p) -> ListValue.of(p.getKey(), p.getValue())
|
(p) -> ListValue.of(p.getKey(), p.getValue())
|
||||||
).collect(Collectors.toList()));
|
).collect(Collectors.toList()));
|
||||||
throw new InternalExpressionException("pairs applies only to maps");
|
throw new InternalExpressionException("pairs applies only to maps");
|
||||||
@@ -1920,7 +1920,7 @@ public class Expression implements Cloneable
|
|||||||
throw new InternalExpressionException("Cannot access elements of a non-container");
|
throw new InternalExpressionException("Cannot access elements of a non-container");
|
||||||
});
|
});
|
||||||
|
|
||||||
//Deprecated, use "get" instead
|
//Deprecated, use "get" instead, or . operator
|
||||||
addBinaryFunction("element", (v1, v2) ->
|
addBinaryFunction("element", (v1, v2) ->
|
||||||
{
|
{
|
||||||
if (!(v1 instanceof ListValue))
|
if (!(v1 instanceof ListValue))
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ public class Tokenizer implements Iterator<Tokenizer.Token>
|
|||||||
|
|
||||||
boolean isHex = false;
|
boolean isHex = false;
|
||||||
|
|
||||||
if (Character.isDigit(ch) || (ch == decimalSeparator && Character.isDigit(peekNextChar())))
|
if (Character.isDigit(ch)) // || (ch == decimalSeparator && Character.isDigit(peekNextChar())))
|
||||||
|
// decided to no support this notation to favour element access via . operator
|
||||||
{
|
{
|
||||||
if (ch == '0' && (peekNextChar() == 'x' || peekNextChar() == 'X'))
|
if (ch == '0' && (peekNextChar() == 'x' || peekNextChar() == 'X'))
|
||||||
isHex = true;
|
isHex = true;
|
||||||
|
|||||||
@@ -216,14 +216,7 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
|
|||||||
{
|
{
|
||||||
if (o instanceof ListValue)
|
if (o instanceof ListValue)
|
||||||
{
|
{
|
||||||
ListValue ol = (ListValue)o;
|
return getItems().equals(((ListValue) o).getItems());
|
||||||
int this_size = this.getItems().size();
|
|
||||||
int o_size = ol.getItems().size();
|
|
||||||
if (this_size != o_size) return false;
|
|
||||||
if (this_size == 0) return true;
|
|
||||||
for (int i = 0; i < this_size; i++)
|
|
||||||
if (!this.items.get(i).equals(ol.items.get(i))) return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,12 +124,7 @@ public class MapValue extends AbstractListValue implements ContainerValueInterfa
|
|||||||
{
|
{
|
||||||
if (o instanceof MapValue)
|
if (o instanceof MapValue)
|
||||||
{
|
{
|
||||||
MapValue ol = (MapValue)o;
|
return map.equals(((MapValue) o).map);
|
||||||
int this_size = this.map.keySet().size();
|
|
||||||
int o_size = ol.map.keySet().size();
|
|
||||||
if (this_size != o_size) return false;
|
|
||||||
if (this_size == 0) return true;
|
|
||||||
return this.map.keySet().equals(ol.map.keySet());
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user