Algorithmic Sets

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 12: Zeile 12:
 
* So if a new predicate is needed only a new implementation of Predicate<T> needs to be implemented.
 
* So if a new predicate is needed only a new implementation of Predicate<T> needs to be implemented.
 
* These Predicate<T> implementations can introduce configurable properties, for a more flexible solution.
 
* These Predicate<T> implementations can introduce configurable properties, for a more flexible solution.
 +
* <b>Definition:</b> An algorithmic set is defined by a predicate.
 +
 +
== Performance considerations ==
 +
* This approach is only reasonable if all tested elements are in memory, querying them from a database would be a suboptimal.
 +
* If the amount of different

Version vom 8. November 2014, 09:57 Uhr

Definition Algorithmic Set

  • We want to define an algorithmic set via a Predicate deciding if an element is part of the set or not.
  • In java we could use the functional interface Predicate<T>
public interface Predicate<T>{
       // If test returns true, we consider the element be part of the algorithmic set.
       boolean test(T element);
}

  • Such a simple definition allows a polymorphic approach for defining set predicates.
  • So if a new predicate is needed only a new implementation of Predicate<T> needs to be implemented.
  • These Predicate<T> implementations can introduce configurable properties, for a more flexible solution.
  • Definition: An algorithmic set is defined by a predicate.

Performance considerations

  • This approach is only reasonable if all tested elements are in memory, querying them from a database would be a suboptimal.
  • If the amount of different
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Werkzeuge
Translate