de.uds.cs.st.dd.core
Class OutcomeCache

java.lang.Object
  |
  +--de.uds.cs.st.dd.core.OutcomeCache

public class OutcomeCache
extends Object

This class holds test outcomes for configurations. This avoids running the same test twice. The outcome cache is implemented as a treap (prefix tree). Each node points to the outcome of the remaining list. -- at least, that is the idea. This class is not yet implemented.

Example: ([1, 2, 3], PASS), ([1, 2], FAIL), ([1, 4, 5], FAIL):

  (2, FAIL)--(3, PASS)
  /
(1, None)
  \
  (4, None)--(5, FAIL)

Author:
Philipp Bouillon TODO (re-)implement OutcomeCache

Constructor Summary
OutcomeCache()
          Creates a new treap.
 
Method Summary
 void add(Collection c, int result)
          Adds the pair (c, result) to the cache.
 void addSorted(Collection c, int result)
          Adds the pair (c, result) to the cache.
 int lookup(Collection c)
          Returns the result of a test case, if it is in the cache.
 int lookupSubset(Collection c)
          Returns the result of a test case c' if there is a test case in the cache with c' being a subset of c or equal to c.
 int lookupSuperset(Collection c)
          Returns the result of a test case c' if there is a test case in the cache with c' being a superset of c or equal to c.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutcomeCache

public OutcomeCache()
Creates a new treap.

Method Detail

add

public void add(Collection c,
                int result)
Adds the pair (c, result) to the cache. c is an index collection of all applied deltas for this test case.

Parameters:
c - the testcase (indexes of the applied deltas). c must be a collection of @see java.util.Comparable. c does not need to be sorted.
result - the outcome of this testcase. Should be one of DD.NONE, DD.PASS, DD.FAIL, or DD.UNRESOLVED.

addSorted

public void addSorted(Collection c,
                      int result)
Adds the pair (c, result) to the cache. c is a sorted index collection of all applied deltas for this test case.

Parameters:
c - the testcase (indexes of the applied deltas). c must be a collection of @see java.util.Comparable. Additionaly, c must be sorted in ascending order. If no knowledge of the sorting of c is available, use @see add instead.
result - the outcome of this testcase. Should be one of DD.NONE, DD.PASS, DD.FAIL, or DD.UNRESOLVED.

lookup

public int lookup(Collection c)
Returns the result of a test case, if it is in the cache. DD.NONE otherwise.

Parameters:
c - the testcase (indexes of the applied deltas). c must be a collection of @see java.util.Comparable. Additionaly, c must be sorted in ascending order.
Returns:
int the result of the test case or DD.NONE, if it the case is not in the cache.

lookupSubset

public int lookupSubset(Collection c)
Returns the result of a test case c' if there is a test case in the cache with c' being a subset of c or equal to c. Returns DD.NONE, otherwise.

Parameters:
c - superset of any previously calculated sets.
Returns:
int calculated test outcome or DD.NONE.

lookupSuperset

public int lookupSuperset(Collection c)
Returns the result of a test case c' if there is a test case in the cache with c' being a superset of c or equal to c. Returns DD.NONE, otherwise.

Parameters:
c - the set that is to be searched in the cache.
Returns:
int the result of any testcase that is a subset of the specified set.