OpenNMS API 1.2.3

org.opennms.netmgt.eventd.datablock
Class EventMaskValueList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended byorg.opennms.netmgt.eventd.datablock.EventMaskValueList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

public class EventMaskValueList
extends java.util.ArrayList

The maskelement values in a 'EventKey' are stored in this ArrayList subclass This list is pretty much constant once it constructed - so the hashcode is evaluated once at construction and reused(if new values are added or values changed, hashcode is re-evaluated)

Author:
Sowmya Nataraj , OpenNMS.org
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
private  int m_hashCode
          The hash code calculated from the elements
 
Fields inherited from class java.util.ArrayList
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
EventMaskValueList()
          Default constructor for this class
EventMaskValueList(java.util.Collection c)
          constructor for this class
EventMaskValueList(int initCapacity)
          constructor for this class
EventMaskValueList(java.lang.String value)
          the constructor for this class
 
Method Summary
 void add(int index, java.lang.Object o)
          Override to re-evaluate hashcode
 boolean add(java.lang.Object o)
          Override to re-evaluate hashcode
 boolean addAll(java.util.Collection o)
          Override to re-evaluate hashcode
 boolean addAll(int index, java.util.Collection o)
          Override to re-evaluate hashcode
 void clear()
          Override to re-evaluate hashcode
 void evaluateHashCode()
          Evaluate the hash code for this object
private  int evaluateHashCode(java.lang.String value)
           Handling the mask values ending with '%' is a pain since the hashcodes will need to work in reverse!
 int hashCode()
          Overrides the 'hashCode()' method in the superclass.
 java.lang.Object remove(int index)
          Override to re-evaluate hashcode
 boolean remove(java.lang.Object o)
          Override to re-evaluate hashcode
 boolean removeAll(java.util.Collection o)
          Override to re-evaluate hashcode
protected  void removeRange(int from, int to)
          Override to re-evaluate hashcode
 java.lang.Object set(int index, java.lang.Object o)
          Override to re-evaluate hashcode
 
Methods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, iterator, listIterator, listIterator, retainAll, subList
 

Field Detail

m_hashCode

private int m_hashCode
The hash code calculated from the elements

Constructor Detail

EventMaskValueList

public EventMaskValueList()
Default constructor for this class


EventMaskValueList

public EventMaskValueList(java.util.Collection c)
constructor for this class


EventMaskValueList

public EventMaskValueList(int initCapacity)
constructor for this class


EventMaskValueList

public EventMaskValueList(java.lang.String value)
the constructor for this class

Parameters:
value - the string to be added to this list.
Method Detail

add

public boolean add(java.lang.Object o)
Override to re-evaluate hashcode

See Also:
ArrayList.add(Object)

add

public void add(int index,
                java.lang.Object o)
Override to re-evaluate hashcode

See Also:
ArrayList.add(int, Object)

addAll

public boolean addAll(java.util.Collection o)
Override to re-evaluate hashcode

See Also:
ArrayList.addAll(Collection)

addAll

public boolean addAll(int index,
                      java.util.Collection o)
Override to re-evaluate hashcode

See Also:
ArrayList.addAll(int, Collection)

clear

public void clear()
Override to re-evaluate hashcode

See Also:
ArrayList.clear()

remove

public java.lang.Object remove(int index)
Override to re-evaluate hashcode

See Also:
ArrayList.remove(int)

removeRange

protected void removeRange(int from,
                           int to)
Override to re-evaluate hashcode

See Also:
ArrayList.removeRange(int,int)

remove

public boolean remove(java.lang.Object o)
Override to re-evaluate hashcode

See Also:
AbstractCollection.remove(Object)

removeAll

public boolean removeAll(java.util.Collection o)
Override to re-evaluate hashcode

See Also:
AbstractCollection.removeAll(Collection)

set

public java.lang.Object set(int index,
                            java.lang.Object o)
Override to re-evaluate hashcode

See Also:
ArrayList.set(int,Object)

evaluateHashCode

private int evaluateHashCode(java.lang.String value)

Handling the mask values ending with '%' is a pain since the hashcodes will need to work in reverse!

For e.g. consider mask values '.1.3.6.1.4.1.9%' and '.1.3.6.1.4.1.%' normal hashcodes will mean '.1.3.6.1.4.1.9%' will have a larger hashcode. However when we try a match in the eventconf(which uses a treemap of eventkeys to get the event keys in an ordered fashion), we want '.1.3.6.1.4.1.9%' to be a better match than '.1.3.6.1.4.1.%' - i.e.we want '.1.3.6.1.4.1.9%' to have a lesser hashcode than '.1.3.6.1.4.1.%' - hence this method. Only a lot of testing will reveal conflicts etc. though


evaluateHashCode

public void evaluateHashCode()
Evaluate the hash code for this object


hashCode

public int hashCode()
Overrides the 'hashCode()' method in the superclass.

Returns:
a hash code for this object

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.