Context { public Context(HashSet<ContextualDatum> sample, boolean densityPruning, boolean dependencyPruning, double alpha) { this.sample = sample; this.globalSample = sample; this.densityPruning = densityPruning; this.dependencyPruning = dependencyPruning; this.alpha = alpha; } Context(HashSet<ContextualDatum> sample, boolean densityPruning, boolean dependencyPruning, double alpha);  Context(int dimension, Interval interval, Context parent);  Context(List<Integer> dimensions, List<Interval> intervals, Context parent1, Context parent2); BitSet getContextualBitSet(List<ContextualDatum> data, Map<Context, BitSet> context2BitSet); boolean containDatum(ContextualDatum datum); Context join(Context other, List<ContextualDatum> data, double tau); String print(DatumEncoder encoder); @Override String toString(); int getSize(); void setSize(int size); HashSet<ContextualDatum> getSample(); List<Interval> getIntervals(); List<Context> getParents(); BatchTrainScore getDetector(); void setDetector(BatchTrainScore detector);  }
@Test public void contextTest() { ContextualDatum d1 = new ContextualDatum(Arrays.asList(1),1.0); ContextualDatum d2 = new ContextualDatum(Arrays.asList(2),2.0); ContextualDatum d3 = new ContextualDatum(Arrays.asList(3),3.0); ContextualDatum d4 = new ContextualDatum(Arrays.asList(4),4.0); ContextualDatum d5 = new ContextualDatum(Arrays.asList(5),5.0); List<ContextualDatum> data = new ArrayList<>(); data.add(d1); data.add(d2); data.add(d3); data.add(d4); data.add(d5); HashSet<ContextualDatum> sample = new HashSet<>(); sample.add(d1); sample.add(d3); sample.add(d5); Context globalContext = new Context(sample, false, false, 0.05); Interval interval0 = new IntervalDiscrete(0, "C0", 0); Interval interval1 = new IntervalDiscrete(0, "C0", 1); Interval interval2 = new IntervalDiscrete(0, "C0", 2); Interval interval3 = new IntervalDouble(1, "C1", 0, 6); Context c0 = new Context(0,interval0,globalContext); Context c1 = new Context(0,interval1,globalContext); Context c2 = new Context(0,interval2,globalContext); Context c3 = new Context(0,interval3,globalContext); Context c03 = c0.join(c3, data, 0); assertEquals(c03.getParents().contains(c0),true); assertEquals(c03.getParents().contains(c3),true); Context c13 = c1.join(c3, data, 0); assertEquals(c13.getParents().contains(c1),true); assertEquals(c03.getParents().contains(c3),true); Context c03_13 = c03.join(c13, data, 0); assertEquals(c03_13,null); Context c03_3 = c03.join(c3, data, 0); assertEquals(c03_3,null); }