Algorithmic Sets
(Unterschied zwischen Versionen)
Mkurz (Diskussion | Beiträge) (→Definition Algorithmic Set) |
Mkurz (Diskussion | Beiträge) |
||
Zeile 9: | Zeile 9: | ||
</pre> | </pre> | ||
+ | * Such a simple definition allows a polymorphic approach for defining set predicates. | ||
+ | * So if a new predicate is needed only a new implementation of Preidacte<T> needs to be implemented. | ||
+ | * These Predicate<T> implementations can introduce configurable properties, for a more flexible solution. |
Version vom 8. November 2014, 10:51 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 Preidacte<T> needs to be implemented.
- These Predicate<T> implementations can introduce configurable properties, for a more flexible solution.