Atavism Version 2018.1AGIS API

atavism.msgsys
Class FilterTable

java.lang.Object
  extended by atavism.msgsys.FilterTable
Direct Known Subclasses:
DefaultFilterTable

public abstract class FilterTable
extends java.lang.Object

Collection of filters with optimized message matching. Implement a sub-class to provide custom optimization for certain kinds of filters. If a filter does not provide a FilterTable, then a DefaultFilterTable is used.

A filter table is used by MessageAgent to collect filters together so message matching can be optimized. Filters are placed into one of four filter table instances:

  • send: filters matched when agent sends a message
  • receive: filter matched when message received from another agent
  • responder send: filters matched when agent sends an RPC
  • responder receive: filters matched when RPC received from another agent

    Each Filter instance can provide FilterTables to use. If none are provided (they return 'null'), then a DefaultFilterTable is used.


    Constructor Summary
    FilterTable()
               
     
    Method Summary
    abstract  void addFilter(Subscription sub, java.lang.Object object)
              Add subscription to filter table.
    abstract  int match(Message message, java.util.Set<java.lang.Object> matches, java.util.List<Subscription> triggers)
              Match message against filters.
    abstract  void removeFilter(Subscription sub, java.lang.Object object)
              Remove subscription from filter table.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    FilterTable

    public FilterTable()
    Method Detail

    addFilter

    public abstract void addFilter(Subscription sub,
                                   java.lang.Object object)
    Add subscription to filter table.


    removeFilter

    public abstract void removeFilter(Subscription sub,
                                      java.lang.Object object)
    Remove subscription from filter table.


    match

    public abstract int match(Message message,
                              java.util.Set<java.lang.Object> matches,
                              java.util.List<Subscription> triggers)
    Match message against filters.

    Parameters:
    message - Message to match.
    matches - Will be populated with subscription's associated objects.
    triggers - Will be populated with subscriptions whose triggers should be run.
    Returns:
    Number of unique values in matches.


    Copyright © 2018 Dragonsan Studios Sp. z o.o.