Last change
on this file since 8256 was 7937, checked in by bastiK, 9 years ago |
add subversion property svn:eol=native
|
-
Property svn:eol-style
set to
native
|
File size:
837 bytes
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.mappaint.mapcss;
|
---|
3 |
|
---|
4 | import java.util.Arrays;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.gui.mappaint.Environment;
|
---|
7 | import org.openstreetmap.josm.tools.CheckParameterUtil;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Simple literal value, that does not depend on other expressions.
|
---|
11 | */
|
---|
12 | public class LiteralExpression implements Expression {
|
---|
13 | Object literal;
|
---|
14 |
|
---|
15 | public LiteralExpression(Object literal) {
|
---|
16 | CheckParameterUtil.ensureParameterNotNull(literal);
|
---|
17 | this.literal = literal;
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public Object evaluate(Environment env) {
|
---|
22 | return literal;
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public String toString() {
|
---|
27 | if (literal instanceof float[]) {
|
---|
28 | return Arrays.toString((float[]) literal);
|
---|
29 | }
|
---|
30 | return "<" + literal.toString() + ">";
|
---|
31 | }
|
---|
32 |
|
---|
33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.