Пример #1
0
 /**
  * insert an item which is known to be contained in the tree rooted at the given QuadNode root.
  * Lower levels of the tree will be created if necessary to hold the item.
  */
 private void insertContained(ExitEarlyNode tree, Envelope itemEnv, Object item) {
   Assert.isTrue(tree.getEnvelope().contains(itemEnv));
   /**
    * Do NOT create a new quad for zero-area envelopes - this would lead to infinite recursion.
    * Instead, use a heuristic of simply returning the smallest existing quad containing the query
    */
   boolean isZeroX = IntervalSize.isZeroWidth(itemEnv.getMinX(), itemEnv.getMaxX());
   boolean isZeroY = IntervalSize.isZeroWidth(itemEnv.getMinY(), itemEnv.getMaxY());
   ExitEarlyNodeBase node;
   if (isZeroX || isZeroY) node = tree.find(itemEnv);
   else node = tree.getNode(itemEnv);
   node.add(item);
 }
Пример #2
0
 @operator(
     value = {"="},
     can_be_const = true,
     category = {IOperatorCategory.COMPARISON},
     concept = {IConcept.COMPARISON})
 @doc(
     value = "returns true if both operands are equal, false otherwise",
     masterDoc = true,
     examples = {@example(value = "4.5 = 4.7", equals = "false")},
     see = {GT, LT, GTE, LTE, "!="})
 public static Boolean equal(final Double a, final Double b) {
   return a == null ? b == null : IntervalSize.isZeroWidth(a, b);
   // return !(a < b) && !(a > b);
 }
Пример #3
0
 @operator(
     value = {"!=", "<>"},
     can_be_const = true,
     category = {IOperatorCategory.COMPARISON},
     concept = {IConcept.COMPARISON})
 @doc(
     value = "true if both operands are different, false otherwise",
     masterDoc = true,
     examples = {
       @example(value = "3.0 != 3.0", equals = "false"),
       @example(value = "4.0 != 4.7", equals = "true")
     },
     see = {"=", GT, LT, GTE, LTE, "="})
 public static Boolean different(final Double a, final Double b) {
   if (a == null) {
     return b != null;
   }
   if (b == null) {
     return false;
   }
   return !IntervalSize.isZeroWidth(a, b);
   // return a < b || a > b;
 }