예제 #1
0
 @Override
 public Leaf deserialize(JsonParser jp, DeserializationContext ctxt)
     throws IOException, JsonProcessingException {
   JsonNode tree = (JsonNode) jp.readValueAsTree();
   Leaf leaf = new Leaf();
   leaf.value = tree.get("value").intValue();
   return leaf;
 }
예제 #2
0
 /**
  * testing leaf
  *
  * @author Sam Whitlock (cs61b-eo)
  * @param void
  * @return void
  */
 @Test
 public void leafTest1() {
   QuadPoint qp = new QuadPoint(13, 19);
   Leaf<QuadTree.QuadPoint> myPt = new Leaf<QuadTree.QuadPoint>(qp, null, null);
   assertTrue(myPt.x() == 13);
   assertTrue(myPt.y() == 19);
   assertEquals(qp, myPt.leaf);
   LeafNode<QuadPoint> lfnd = new LeafNode<QuadPoint>(null, null, 0, 0, 100, 100);
   myPt.parent = lfnd;
   assertEquals(myPt.parent = lfnd);
   QuadTree<QuadPoint> tree = new QuadTree<QuadPoint>(0, 0, 100, 100, .01);
   myPt.tree = tree;
   assertEquals(myPt.tree, tree);
 }