test_class.declarator: DEBUG = false
test_class.modifier: private static final
test_class.original_string: private static final boolean DEBUG = false;
test_class.type: boolean
test_class.var_name: DEBUG
test_class.declarator: SCALE = CalciteSystemProperty.TEST_SLOW.value() ? 250 : 50
test_class.modifier: private static final
test_class.original_string: private static final int SCALE = CalciteSystemProperty.TEST_SLOW.value() ? 250 : 50;
test_class.type: int
test_class.var_name: SCALE
test_class.declarator: seed = new Random().nextLong()
test_class.modifier: final
test_class.original_string: final long seed = new Random().nextLong();
test_class.type: long
test_class.var_name: seed
test_class.declarator: random = new Random(seed)
test_class.modifier: final
test_class.original_string: final Random random = new Random(seed);
test_class.type: Random
test_class.var_name: random
test_class.declarator: STRING_SUBSET_ORDERING =
        (e1, e2) -> {
          // e1 < e2 if every char in e1 is also in e2
          for (int i = 0; i < e1.length(); i++) {
            if (e2.indexOf(e1.charAt(i)) < 0) {
              return false;
            }
          }
          return true;
        }
test_class.modifier: static final
test_class.original_string: static final PartiallyOrderedSet.Ordering<String> STRING_SUBSET_ORDERING =
        (e1, e2) -> {
          // e1 < e2 if every char in e1 is also in e2
          for (int i = 0; i < e1.length(); i++) {
            if (e2.indexOf(e1.charAt(i)) < 0) {
              return false;
            }
          }
          return true;
        };
test_class.type: PartiallyOrderedSet.Ordering<String>
test_class.var_name: STRING_SUBSET_ORDERING
test_class.file: parser/src/test/java/com/qihoo/qsql/org/apache/calcite/util/PartiallyOrderedSetTest.java
test_class.identifier: PartiallyOrderedSetTest
test_case.body: @Test public void testPosetBitsLarge2() {
      Assume.assumeTrue("too slow to run every day", CalciteSystemProperty.TEST_SLOW.value());
      final int n = 30000;
      final PartiallyOrderedSet<Integer> poset =
          new PartiallyOrderedSet<>(PartiallyOrderedSetTest::isBitSuperset,
              (Function<Integer, Iterable<Integer>>) i -> {
                int r = Objects.requireNonNull(i); // bits not yet cleared
                final List<Integer> list = new ArrayList<>();
                for (int z = 1; r != 0; z <<= 1) {
                  if ((i & z) != 0) {
                    list.add(i ^ z);
                    r ^= z;
                  }
                }
                return list;
              },
              i -> {
                Objects.requireNonNull(i);
                final List<Integer> list = new ArrayList<>();
                for (int z = 1; z <= n; z <<= 1) {
                  if ((i & z) == 0) {
                    list.add(i | z);
                  }
                }
                return list;
              });
      checkPosetBitsLarge(poset, n, 2921, 11961);
    }
test_case.class_method_signature: PartiallyOrderedSetTest.testPosetBitsLarge2()
test_case.full_signature: @Test public void testPosetBitsLarge2()
test_case.identifier: testPosetBitsLarge2
test_case.invocations: assumeTrue value requireNonNull add requireNonNull add checkPosetBitsLarge
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPosetBitsLarge2()
focal_class.declarator: BIT_SET_INCLUSION_ORDERING =
        ImmutableBitSet::contains
focal_class.modifier: public static final
focal_class.original_string: public static final Ordering<ImmutableBitSet> BIT_SET_INCLUSION_ORDERING =
        ImmutableBitSet::contains;
focal_class.type: Ordering<ImmutableBitSet>
focal_class.var_name: BIT_SET_INCLUSION_ORDERING
focal_class.declarator: map
focal_class.modifier: private final
focal_class.original_string: private final Map<E, Node<E>> map;
focal_class.type: Map<E, Node<E>>
focal_class.var_name: map
focal_class.declarator: parentFunction
focal_class.modifier: private final
focal_class.original_string: private final Function<E, Iterable<E>> parentFunction;
focal_class.type: Function<E, Iterable<E>>
focal_class.var_name: parentFunction
focal_class.declarator: childFunction
focal_class.modifier: private final
focal_class.original_string: private final Function<E, Iterable<E>> childFunction;
focal_class.type: Function<E, Iterable<E>>
focal_class.var_name: childFunction
focal_class.declarator: ordering
focal_class.modifier: private final
focal_class.original_string: private final Ordering<E> ordering;
focal_class.type: Ordering<E>
focal_class.var_name: ordering
focal_class.declarator: topNode
focal_class.modifier: private final
focal_class.original_string: private final Node<E> topNode;
focal_class.type: Node<E>
focal_class.var_name: topNode
focal_class.declarator: bottomNode
focal_class.modifier: private final
focal_class.original_string: private final Node<E> bottomNode;
focal_class.type: Node<E>
focal_class.var_name: bottomNode
focal_class.file: parser/src/main/java/com/qihoo/qsql/org/apache/calcite/util/PartiallyOrderedSet.java
focal_class.identifier: PartiallyOrderedSet
focal_class.class_method_signature: PartiallyOrderedSet.PartiallyOrderedSet(Ordering<E> ordering)
focal_class.full_signature: public  PartiallyOrderedSet(Ordering<E> ordering)
focal_class.identifier: PartiallyOrderedSet
focal_class.modifiers: public
focal_class.parameters: (Ordering<E> ordering)
focal_class.signature:  PartiallyOrderedSet(Ordering<E> ordering)
focal_class.class_method_signature: PartiallyOrderedSet.PartiallyOrderedSet(Ordering<E> ordering,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.full_signature: public  PartiallyOrderedSet(Ordering<E> ordering,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.identifier: PartiallyOrderedSet
focal_class.modifiers: public
focal_class.parameters: (Ordering<E> ordering,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.signature:  PartiallyOrderedSet(Ordering<E> ordering,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.class_method_signature: PartiallyOrderedSet.PartiallyOrderedSet(Ordering<E> ordering,
        com.google.common.base.Function<E, Iterable<E>> childFunction,
        com.google.common.base.Function<E, Iterable<E>> parentFunction)
focal_class.full_signature: @SuppressWarnings("Guava") @Deprecated // to be removed before 2.0 public  PartiallyOrderedSet(Ordering<E> ordering,
        com.google.common.base.Function<E, Iterable<E>> childFunction,
        com.google.common.base.Function<E, Iterable<E>> parentFunction)
focal_class.identifier: PartiallyOrderedSet
focal_class.modifiers: @SuppressWarnings("Guava") @Deprecated // to be removed before 2.0 public
focal_class.parameters: (Ordering<E> ordering,
        com.google.common.base.Function<E, Iterable<E>> childFunction,
        com.google.common.base.Function<E, Iterable<E>> parentFunction)
focal_class.signature:  PartiallyOrderedSet(Ordering<E> ordering,
        com.google.common.base.Function<E, Iterable<E>> childFunction,
        com.google.common.base.Function<E, Iterable<E>> parentFunction)
focal_class.class_method_signature: PartiallyOrderedSet.PartiallyOrderedSet(Ordering<E> ordering, Collection<E> collection)
focal_class.full_signature: public  PartiallyOrderedSet(Ordering<E> ordering, Collection<E> collection)
focal_class.identifier: PartiallyOrderedSet
focal_class.modifiers: public
focal_class.parameters: (Ordering<E> ordering, Collection<E> collection)
focal_class.signature:  PartiallyOrderedSet(Ordering<E> ordering, Collection<E> collection)
focal_class.class_method_signature: PartiallyOrderedSet.PartiallyOrderedSet(Ordering<E> ordering, Map<E, Node<E>> map,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.full_signature: private  PartiallyOrderedSet(Ordering<E> ordering, Map<E, Node<E>> map,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.identifier: PartiallyOrderedSet
focal_class.modifiers: private
focal_class.parameters: (Ordering<E> ordering, Map<E, Node<E>> map,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.signature:  PartiallyOrderedSet(Ordering<E> ordering, Map<E, Node<E>> map,
        Function<E, Iterable<E>> childFunction,
        Function<E, Iterable<E>> parentFunction)
focal_class.class_method_signature: PartiallyOrderedSet.iterator()
focal_class.full_signature: @SuppressWarnings("NullableProblems") @Override public Iterator<E> iterator()
focal_class.identifier: iterator
focal_class.modifiers: @SuppressWarnings("NullableProblems") @Override public
focal_class.parameters: ()
focal_class.return: Iterator<E>
focal_class.signature: Iterator<E> iterator()
focal_class.class_method_signature: PartiallyOrderedSet.size()
focal_class.full_signature: @Override public int size()
focal_class.identifier: size
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int size()
focal_class.class_method_signature: PartiallyOrderedSet.contains(Object o)
focal_class.full_signature: @Override public boolean contains(Object o)
focal_class.identifier: contains
focal_class.modifiers: @Override public
focal_class.parameters: (Object o)
focal_class.return: boolean
focal_class.signature: boolean contains(Object o)
focal_class.class_method_signature: PartiallyOrderedSet.remove(Object o)
focal_class.full_signature: @Override public boolean remove(Object o)
focal_class.identifier: remove
focal_class.modifiers: @Override public
focal_class.parameters: (Object o)
focal_class.return: boolean
focal_class.signature: boolean remove(Object o)
focal_class.class_method_signature: PartiallyOrderedSet.add(E e)
focal_class.full_signature: @Override public boolean add(E e)
focal_class.identifier: add
focal_class.modifiers: @Override public
focal_class.parameters: (E e)
focal_class.return: boolean
focal_class.signature: boolean add(E e)
focal_class.class_method_signature: PartiallyOrderedSet.isDescendantOfAny(
        Node<E> node,
        Set<Node<E>> nodeSet)
focal_class.full_signature: private boolean isDescendantOfAny(
        Node<E> node,
        Set<Node<E>> nodeSet)
focal_class.identifier: isDescendantOfAny
focal_class.modifiers: private
focal_class.parameters: (
        Node<E> node,
        Set<Node<E>> nodeSet)
focal_class.return: boolean
focal_class.signature: boolean isDescendantOfAny(
        Node<E> node,
        Set<Node<E>> nodeSet)
focal_class.class_method_signature: PartiallyOrderedSet.findChildren(E e)
focal_class.full_signature: private Set<Node<E>> findChildren(E e)
focal_class.identifier: findChildren
focal_class.modifiers: private
focal_class.parameters: (E e)
focal_class.return: Set<Node<E>>
focal_class.signature: Set<Node<E>> findChildren(E e)
focal_class.class_method_signature: PartiallyOrderedSet.findParents(E e)
focal_class.full_signature: private Set<Node<E>> findParents(E e)
focal_class.identifier: findParents
focal_class.modifiers: private
focal_class.parameters: (E e)
focal_class.return: Set<Node<E>>
focal_class.signature: Set<Node<E>> findParents(E e)
focal_class.class_method_signature: PartiallyOrderedSet.findParentsChildren(
        E e,
        Deque<Node<E>> ancestors,
        boolean up)
focal_class.full_signature: private Set<Node<E>> findParentsChildren(
        E e,
        Deque<Node<E>> ancestors,
        boolean up)
focal_class.identifier: findParentsChildren
focal_class.modifiers: private
focal_class.parameters: (
        E e,
        Deque<Node<E>> ancestors,
        boolean up)
focal_class.return: Set<Node<E>>
focal_class.signature: Set<Node<E>> findParentsChildren(
        E e,
        Deque<Node<E>> ancestors,
        boolean up)
focal_class.class_method_signature: PartiallyOrderedSet.replace(List<T> list, T remove, T add)
focal_class.full_signature: private void replace(List<T> list, T remove, T add)
focal_class.identifier: replace
focal_class.modifiers: private
focal_class.parameters: (List<T> list, T remove, T add)
focal_class.return: void
focal_class.signature: void replace(List<T> list, T remove, T add)
focal_class.class_method_signature: PartiallyOrderedSet.isValid(boolean fail)
focal_class.full_signature: @SuppressWarnings({"ConstantConditions" }) public boolean isValid(boolean fail)
focal_class.identifier: isValid
focal_class.modifiers: @SuppressWarnings({"ConstantConditions" }) public
focal_class.parameters: (boolean fail)
focal_class.return: boolean
focal_class.signature: boolean isValid(boolean fail)
focal_class.class_method_signature: PartiallyOrderedSet.distanceRecurse(
        Map<Node, Integer> distanceToRoot,
        Node<E> node,
        int distance)
focal_class.full_signature: private void distanceRecurse(
        Map<Node, Integer> distanceToRoot,
        Node<E> node,
        int distance)
focal_class.identifier: distanceRecurse
focal_class.modifiers: private
focal_class.parameters: (
        Map<Node, Integer> distanceToRoot,
        Node<E> node,
        int distance)
focal_class.return: void
focal_class.signature: void distanceRecurse(
        Map<Node, Integer> distanceToRoot,
        Node<E> node,
        int distance)
focal_class.class_method_signature: PartiallyOrderedSet.out(StringBuilder buf)
focal_class.full_signature: public void out(StringBuilder buf)
focal_class.identifier: out
focal_class.modifiers: public
focal_class.parameters: (StringBuilder buf)
focal_class.return: void
focal_class.signature: void out(StringBuilder buf)
focal_class.class_method_signature: PartiallyOrderedSet.getChildren(E e)
focal_class.full_signature: public List<E> getChildren(E e)
focal_class.identifier: getChildren
focal_class.modifiers: public
focal_class.parameters: (E e)
focal_class.return: List<E>
focal_class.signature: List<E> getChildren(E e)
focal_class.class_method_signature: PartiallyOrderedSet.getChildren(E e, boolean hypothetical)
focal_class.full_signature: public List<E> getChildren(E e, boolean hypothetical)
focal_class.identifier: getChildren
focal_class.modifiers: public
focal_class.parameters: (E e, boolean hypothetical)
focal_class.return: List<E>
focal_class.signature: List<E> getChildren(E e, boolean hypothetical)
focal_class.class_method_signature: PartiallyOrderedSet.getParents(E e)
focal_class.full_signature: public List<E> getParents(E e)
focal_class.identifier: getParents
focal_class.modifiers: public
focal_class.parameters: (E e)
focal_class.return: List<E>
focal_class.signature: List<E> getParents(E e)
focal_class.class_method_signature: PartiallyOrderedSet.getParents(E e, boolean hypothetical)
focal_class.full_signature: public List<E> getParents(E e, boolean hypothetical)
focal_class.identifier: getParents
focal_class.modifiers: public
focal_class.parameters: (E e, boolean hypothetical)
focal_class.return: List<E>
focal_class.signature: List<E> getParents(E e, boolean hypothetical)
focal_class.class_method_signature: PartiallyOrderedSet.closure(Function<E, Iterable<E>> generator, E e, List<E> list,
        Set<E> set)
focal_class.full_signature: private void closure(Function<E, Iterable<E>> generator, E e, List<E> list,
        Set<E> set)
focal_class.identifier: closure
focal_class.modifiers: private
focal_class.parameters: (Function<E, Iterable<E>> generator, E e, List<E> list,
        Set<E> set)
focal_class.return: void
focal_class.signature: void closure(Function<E, Iterable<E>> generator, E e, List<E> list,
        Set<E> set)
focal_class.class_method_signature: PartiallyOrderedSet.getNonChildren()
focal_class.full_signature: public List<E> getNonChildren()
focal_class.identifier: getNonChildren
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<E>
focal_class.signature: List<E> getNonChildren()
focal_class.class_method_signature: PartiallyOrderedSet.getNonParents()
focal_class.full_signature: public List<E> getNonParents()
focal_class.identifier: getNonParents
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<E>
focal_class.signature: List<E> getNonParents()
focal_class.class_method_signature: PartiallyOrderedSet.clear()
focal_class.full_signature: @Override public void clear()
focal_class.identifier: clear
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clear()
focal_class.class_method_signature: PartiallyOrderedSet.getDescendants(E e)
focal_class.full_signature: public List<E> getDescendants(E e)
focal_class.identifier: getDescendants
focal_class.modifiers: public
focal_class.parameters: (E e)
focal_class.return: List<E>
focal_class.signature: List<E> getDescendants(E e)
focal_class.class_method_signature: PartiallyOrderedSet.strip(List<Node<E>> list)
focal_class.full_signature: public static List<E> strip(List<Node<E>> list)
focal_class.identifier: strip
focal_class.modifiers: public static
focal_class.parameters: (List<Node<E>> list)
focal_class.return: List<E>
focal_class.signature: List<E> strip(List<Node<E>> list)
focal_class.class_method_signature: PartiallyOrderedSet.strip(Iterable<Node<E>> iterable)
focal_class.full_signature: private static ImmutableList<E> strip(Iterable<Node<E>> iterable)
focal_class.identifier: strip
focal_class.modifiers: private static
focal_class.parameters: (Iterable<Node<E>> iterable)
focal_class.return: ImmutableList<E>
focal_class.signature: ImmutableList<E> strip(Iterable<Node<E>> iterable)
focal_class.class_method_signature: PartiallyOrderedSet.getAncestors(E e)
focal_class.full_signature: public List<E> getAncestors(E e)
focal_class.identifier: getAncestors
focal_class.modifiers: public
focal_class.parameters: (E e)
focal_class.return: List<E>
focal_class.signature: List<E> getAncestors(E e)
focal_class.class_method_signature: PartiallyOrderedSet.descendants(E e, boolean up)
focal_class.full_signature: private List<E> descendants(E e, boolean up)
focal_class.identifier: descendants
focal_class.modifiers: private
focal_class.parameters: (E e, boolean up)
focal_class.return: List<E>
focal_class.signature: List<E> descendants(E e, boolean up)
focal_class.superclass: extends AbstractSet<E>
focal_method.body: @Override public boolean add(E e) {
      assert e != null;
      assert !CalciteSystemProperty.DEBUG.value() || isValid(true);
      Node<E> node = map.get(e);
      if (node != null) {
        // already present
        return false;
      }
      Set<Node<E>> parents = findParents(e);
      Set<Node<E>> children = findChildren(e);
  
      node = new Node<>(e);
  
      for (Node<E> parent : parents) {
        node.parentList.add(parent);
        int n = 0;
        for (int i = 0; i < parent.childList.size(); i++) {
          Node<E> child = parent.childList.get(i);
          if (child.e == null || ordering.lessThan(child.e, e)) {
            if (parent.childList.contains(node)) {
              parent.childList.remove(i);
              --i;
            } else {
              parent.childList.set(i, node);
            }
            replace(child.parentList, parent, node);
            if (!node.childList.contains(child)) {
              node.childList.add(child);
            }
            ++n;
          }
        }
        if (n == 0) {
          parent.childList.add(node);
        }
      }
  
      // Nodes reachable from parents.
      final Set<Node<E>> childSet = new HashSet<>(node.childList);
      for (Node<E> child : children) {
        if (!isDescendantOfAny(child, childSet)) {
          node.childList.add(child);
          if (!child.parentList.contains(node)) {
            child.parentList.add(node);
          }
        }
      }
  
      map.put(node.e, node);
      assert !CalciteSystemProperty.DEBUG.value() || isValid(true);
      return true;
    }
focal_method.class_method_signature: PartiallyOrderedSet.add(E e)
focal_method.full_signature: @Override public boolean add(E e)
focal_method.identifier: add
focal_method.invocations: value isValid get findParents findChildren add size get lessThan contains remove set replace contains add add isDescendantOfAny add contains add put value isValid
focal_method.modifiers: @Override public
focal_method.parameters: (E e)
focal_method.return: boolean
focal_method.signature: boolean add(E e)