Skip to content

Commit

Permalink
表达式所属包按mapbox文档调整
Browse files Browse the repository at this point in the history
  • Loading branch information
codingmiao committed Jul 28, 2022
1 parent 9d70c16 commit 6d05c1a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
package org.wowtools.giscat.vector.mbexpression.decision;
package org.wowtools.giscat.vector.mbexpression.lookup;

import org.wowtools.giscat.vector.mbexpression.Expression;
import org.wowtools.giscat.vector.mbexpression.ExpressionName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
package org.wowtools.giscat.vector.mbexpression.decision;
package org.wowtools.giscat.vector.mbexpression.lookup;

import org.wowtools.giscat.vector.mbexpression.Expression;
import org.wowtools.giscat.vector.mbexpression.ExpressionName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
package org.wowtools.giscat.vector.mbexpression.decision;
package org.wowtools.giscat.vector.mbexpression.lookup;

import org.wowtools.giscat.vector.mbexpression.Expression;
import org.wowtools.giscat.vector.mbexpression.ExpressionName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
package org.wowtools.giscat.vector.mbexpression.decision;
package org.wowtools.giscat.vector.mbexpression.lookup;

import org.wowtools.giscat.vector.mbexpression.Expression;
import org.wowtools.giscat.vector.mbexpression.ExpressionName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
****************************************************************/
package org.wowtools.giscat.vector.mbexpression.decision;
package org.wowtools.giscat.vector.mbexpression.lookup;

import org.wowtools.giscat.vector.mbexpression.Expression;
import org.wowtools.giscat.vector.mbexpression.ExpressionName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,46 +108,7 @@ public void decision() {
Assert.assertEquals(false,
getValue(feature, "[\">\", 1.0,1.0]")
);
//has
Assert.assertEquals(true,
getValue(feature, "[\"has\", \"int1\"]")
);
Assert.assertEquals(false,
getValue(feature, "[\"has\", \"int3\"]")
);
//in
Assert.assertEquals(true,
getValue(feature, "[\"in\", 1,[0,1]]")
);
Assert.assertEquals(false,
getValue(feature, "[\"in\", 1,[0,2]]")
);
Assert.assertEquals(true,
getValue(feature, "[\"in\", \"a\",\"abc\"]")
);
Assert.assertEquals(false,
getValue(feature, "[\"in\", \"a\",\"bbc\"]")
);
//index-of
Assert.assertEquals(2,
getValue(feature, "[\"index-of\", \"a\",\"ihas\"]")
);
Assert.assertEquals(-1,
getValue(feature, "[\"index-of\", \"a\",\"ihs\"]")
);
Assert.assertEquals(1,
getValue(feature, "[\"index-of\", \"a\",[\"i\",\"a\",\"a\"]]")
);
Assert.assertEquals(2,
getValue(feature, "[\"index-of\", \"a\",[\"i\",\"a\",\"a\"],2]")
);
//length
Assert.assertEquals(4,
getValue(feature, "[\"length\", \"ihas\"]")
);
Assert.assertEquals(3,
getValue(feature, "[\"length\", [\"i\",\"a\",\"a\"]]")
);

//<=
Assert.assertEquals(true,
getValue(feature, "[\"<=\", 1,2]")
Expand Down Expand Up @@ -192,19 +153,6 @@ public void decision() {
Assert.assertEquals(true,
getValue(feature, "[\"!=\",1.0,1.2]")
);
//slice
Assert.assertArrayEquals(new Object[]{2, 3, 4},
((ArrayList) getValue(feature, "[\"slice\",[1,2,3,4],1]")).toArray()
);
Assert.assertArrayEquals(new Object[]{2, 3},
((ArrayList) getValue(feature, "[\"slice\",[1,2,3,4],1,3]")).toArray()
);
Assert.assertEquals("bcd",
getValue(feature, "[\"slice\",\"abcd\",1]")
);
Assert.assertEquals("bc",
getValue(feature, "[\"slice\",\"abcd\",1,3]")
);
//组合测试
Assert.assertEquals(true,
getValue(feature, "[\"all\", [\"==\", [\"get\", \"int1\"], [\"get\", \"int1\"]]]")
Expand All @@ -228,6 +176,59 @@ public void lookup() {
Assert.assertEquals("1",
getValue(feature, "[\"get\",\"str1\"]")
);
//has
Assert.assertEquals(true,
getValue(feature, "[\"has\", \"int1\"]")
);
Assert.assertEquals(false,
getValue(feature, "[\"has\", \"int3\"]")
);
//in
Assert.assertEquals(true,
getValue(feature, "[\"in\", 1,[0,1]]")
);
Assert.assertEquals(false,
getValue(feature, "[\"in\", 1,[0,2]]")
);
Assert.assertEquals(true,
getValue(feature, "[\"in\", \"a\",\"abc\"]")
);
Assert.assertEquals(false,
getValue(feature, "[\"in\", \"a\",\"bbc\"]")
);
//index-of
Assert.assertEquals(2,
getValue(feature, "[\"index-of\", \"a\",\"ihas\"]")
);
Assert.assertEquals(-1,
getValue(feature, "[\"index-of\", \"a\",\"ihs\"]")
);
Assert.assertEquals(1,
getValue(feature, "[\"index-of\", \"a\",[\"i\",\"a\",\"a\"]]")
);
Assert.assertEquals(2,
getValue(feature, "[\"index-of\", \"a\",[\"i\",\"a\",\"a\"],2]")
);
//length
Assert.assertEquals(4,
getValue(feature, "[\"length\", \"ihas\"]")
);
Assert.assertEquals(3,
getValue(feature, "[\"length\", [\"i\",\"a\",\"a\"]]")
);
//slice
Assert.assertArrayEquals(new Object[]{2, 3, 4},
((ArrayList) getValue(feature, "[\"slice\",[1,2,3,4],1]")).toArray()
);
Assert.assertArrayEquals(new Object[]{2, 3},
((ArrayList) getValue(feature, "[\"slice\",[1,2,3,4],1,3]")).toArray()
);
Assert.assertEquals("bcd",
getValue(feature, "[\"slice\",\"abcd\",1]")
);
Assert.assertEquals("bc",
getValue(feature, "[\"slice\",\"abcd\",1,3]")
);
}

@org.junit.Test
Expand Down

0 comments on commit 6d05c1a

Please sign in to comment.