Algorithmic Sets
(Unterschied zwischen Versionen)
				
																
				
				
								
				Mkurz  (Diskussion | Beiträge)  (→Algorithmic sets and Notifications)  | 
		Mkurz  (Diskussion | Beiträge)   (→Algorithmic sets and Notifications)  | 
		||
| Zeile 28: | Zeile 28: | ||
     public User getUser(); // Including the role.  |      public User getUser(); // Including the role.  | ||
     ... // Will grow in the future.  |      ... // Will grow in the future.  | ||
| + | }  | ||
| + | </pre>  | ||
| + | * So the Predicate for Notification receivers would have the form:  | ||
| + | <pre>  | ||
| + | public interface NotificationReceiverPredicate extends Predicate<ConnectedClientTupel>  | ||
| + | {  | ||
}  | }  | ||
</pre>  | </pre>  | ||
* Every connected client queries its notifications via a REST interface.  | * Every connected client queries its notifications via a REST interface.  | ||
| + | |||
* If the amount of different algorithmic sets is relatively low (this is often the case), it makes sense to group  | * If the amount of different algorithmic sets is relatively low (this is often the case), it makes sense to group  | ||
Version vom 8. November 2014, 10:12 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 its predicate instance.
 
Performance considerations
- This approach is only reasonable if all tested elements are in memory, querying them from a database would be at least suboptimal.
 
Algorithmic sets and Notifications
- We want to define the receivers of a notification with an algorithmic set.
 - This means every Notification has an algorithmic set of receivers attached to it.
 - How this algorithmic set of receivers is attached is not part of this article.
 - For identifying a receiver, we introduce a ConnectedClientTupel of the form:
 
public class ConnectedClientTupel{
    public Computer getComputer(); // Including the Platz.
    public User getUser(); // Including the role.
    ... // Will grow in the future.
}
- So the Predicate for Notification receivers would have the form:
 
public interface NotificationReceiverPredicate extends Predicate<ConnectedClientTupel>
{
}
- Every connected client queries its notifications via a REST interface.
 
- If the amount of different algorithmic sets is relatively low (this is often the case), it makes sense to group