@Test public void testGetLocalValuesOfDerivation() { Derivation deriv = GeneralFeatureTestUtils.createDerivation(nonPrmitiveFormula); Derivation rootDeriv = GeneralFeatureTestUtils.createDerivation(rootFormula); rootDeriv.children.add(deriv); assertEquals(Collections.singletonList(primitiveFormula3.value), GeneralFeatureUtils.getLocalPrimitiveValuesOfDerivation(rootDeriv, true)); }
public static List<Value> getLocalPrimitiveValuesOfDerivation(Derivation deriv, boolean deterministic){ HashMultiset<Value> valuesInChildren = HashMultiset.create(); deriv.children.forEach(child-> valuesInChildren.addAll(getAllPrimitiveValuesInFormula(child.formula))); List<Value> result = getAllPrimitiveValuesInFormula(deriv.formula); result.removeAll(valuesInChildren); Stream<Value> stream = result.stream(); if (deterministic) stream = stream.sorted(); return stream.collect(Collectors.toList()); }
GeneralFeatureUtils { public static List<Value> getLocalPrimitiveValuesOfDerivation(Derivation deriv, boolean deterministic){ HashMultiset<Value> valuesInChildren = HashMultiset.create(); deriv.children.forEach(child-> valuesInChildren.addAll(getAllPrimitiveValuesInFormula(child.formula))); List<Value> result = getAllPrimitiveValuesInFormula(deriv.formula); result.removeAll(valuesInChildren); Stream<Value> stream = result.stream(); if (deterministic) stream = stream.sorted(); return stream.collect(Collectors.toList()); } }
GeneralFeatureUtils { public static List<Value> getLocalPrimitiveValuesOfDerivation(Derivation deriv, boolean deterministic){ HashMultiset<Value> valuesInChildren = HashMultiset.create(); deriv.children.forEach(child-> valuesInChildren.addAll(getAllPrimitiveValuesInFormula(child.formula))); List<Value> result = getAllPrimitiveValuesInFormula(deriv.formula); result.removeAll(valuesInChildren); Stream<Value> stream = result.stream(); if (deterministic) stream = stream.sorted(); return stream.collect(Collectors.toList()); }  }
GeneralFeatureUtils { public static List<Value> getLocalPrimitiveValuesOfDerivation(Derivation deriv, boolean deterministic){ HashMultiset<Value> valuesInChildren = HashMultiset.create(); deriv.children.forEach(child-> valuesInChildren.addAll(getAllPrimitiveValuesInFormula(child.formula))); List<Value> result = getAllPrimitiveValuesInFormula(deriv.formula); result.removeAll(valuesInChildren); Stream<Value> stream = result.stream(); if (deterministic) stream = stream.sorted(); return stream.collect(Collectors.toList()); }  static List<Value> getLocalPrimitiveValuesOfDerivation(Derivation deriv, boolean deterministic); static int calculateFormulaSize(Formula rootFormula); static List<Value> getAllPrimitiveValuesInFormula(Formula formula); }
GeneralFeatureUtils { public static List<Value> getLocalPrimitiveValuesOfDerivation(Derivation deriv, boolean deterministic){ HashMultiset<Value> valuesInChildren = HashMultiset.create(); deriv.children.forEach(child-> valuesInChildren.addAll(getAllPrimitiveValuesInFormula(child.formula))); List<Value> result = getAllPrimitiveValuesInFormula(deriv.formula); result.removeAll(valuesInChildren); Stream<Value> stream = result.stream(); if (deterministic) stream = stream.sorted(); return stream.collect(Collectors.toList()); }  static List<Value> getLocalPrimitiveValuesOfDerivation(Derivation deriv, boolean deterministic); static int calculateFormulaSize(Formula rootFormula); static List<Value> getAllPrimitiveValuesInFormula(Formula formula);  }