Class CbusFilter


  • public class CbusFilter
    extends java.lang.Object
    Class to implement filtering of CBUS frames. Long event OPCs are not altered for a node number of 0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CFMAX_NODES  
      static int CFMAXCATS  
    • Constructor Summary

      Constructors 
      Constructor Description
      CbusFilter​(CbusFilterFrame filterFrame)
      Creates a new instance of CbusFilter
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static int checknode​(int node, CbusFilter cf)
      Perform Node checks for a given node number.
      int filter​(AbstractMessage test)
      Filter CanMessage or CanReply.
      protected java.util.HashMap<java.lang.Integer,​java.lang.Boolean> getActiveFilters()
      Get Map of Filters.
      protected CbusFilterFrame getCbusFilterFrame()
      Get the main Filter Frame.
      int getEvMax()
      Get Maximum Event Number.
      int getEvMin()
      Get Minimum Event Number.
      static int getHMapSize​(int reqdCapacity)
      Get optimum HashMap Size.
      int getNdMax()
      Get Maximum Node Number.
      int getNdMin()
      Get Minimum Node Number.
      protected java.util.HashMap<java.lang.Integer,​java.lang.Integer> getNodes()
      Get Map of Nodes.
      protected static void incrementCount​(int filternum, CbusFilter cf)
      Increment Filter count for a given filter ID.
      void setFilter​(int id, boolean trueorfalse)
      Set a single Filter to pass or filter.
      void setMinMax​(CbusFilterType filter, int val)
      Set the event or node min and max values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CbusFilter

        public CbusFilter​(CbusFilterFrame filterFrame)
        Creates a new instance of CbusFilter
        Parameters:
        filterFrame - The Instance Frame
    • Method Detail

      • filter

        public int filter​(@Nonnull
                          AbstractMessage test)
        Filter CanMessage or CanReply.
        Parameters:
        test - Message to Test
        Returns:
        Filter number which failed, else -1
      • getActiveFilters

        protected final java.util.HashMap<java.lang.Integer,​java.lang.Boolean> getActiveFilters()
        Get Map of Filters.
        Returns:
        Map of Boolean values.
      • getNodes

        protected final java.util.HashMap<java.lang.Integer,​java.lang.Integer> getNodes()
        Get Map of Nodes.
        Returns:
        Map of Node Numbers.
      • checknode

        protected static int checknode​(int node,
                                       @Nonnull
                                       CbusFilter cf)
        Perform Node checks for a given node number. If a new Node Number is found, is added to the main Node List and a new filter created.
        Parameters:
        node - Node Number
        cf - CbusFilter instance
        Returns:
        Filter number which failed, else -1
      • incrementCount

        protected static void incrementCount​(int filternum,
                                             @Nonnull
                                             CbusFilter cf)
        Increment Filter count for a given filter ID.
        Parameters:
        filternum - Filter ID
        cf - CbusFilter instance
      • setFilter

        public void setFilter​(int id,
                              boolean trueorfalse)
        Set a single Filter to pass or filter.
        Parameters:
        id - Filter ID
        trueorfalse - true to filter, false to pass through.
      • setMinMax

        public void setMinMax​(@Nonnull
                              CbusFilterType filter,
                              int val)
        Set the event or node min and max values.
        Parameters:
        filter - CFEVENTMIN, CFEVENTMAX, CFNODEMIN or CFNODEMAX
        val - min or max value
      • getEvMin

        public int getEvMin()
        Get Minimum Event Number.
        Returns:
        Minimum Event
      • getEvMax

        public int getEvMax()
        Get Maximum Event Number.
        Returns:
        Maximum Event
      • getNdMin

        public int getNdMin()
        Get Minimum Node Number.
        Returns:
        Minimum Node
      • getNdMax

        public int getNdMax()
        Get Maximum Node Number.
        Returns:
        Maximum Node
      • getHMapSize

        public static final int getHMapSize​(int reqdCapacity)
        Get optimum HashMap Size.
        Parameters:
        reqdCapacity - Required finite capacity
        Returns:
        value to use on creation