ilog.rules.brl.util
Class IlrPropertyManager
- java.lang.Object
-
- ilog.rules.brl.util.IlrPropertyManager
-
- Direct Known Subclasses:
- IlrBRLSemanticContextExtension, IlrSyntaxTree.Node
public class IlrPropertyManager extends java.lang.ObjectThis class implements a mechanism of properties that allows storing of custom properties key/value on objects. As properties are stored in a linked list to minimize the memory footprint, this class cannot handle efficiently a large set of properties. This class can manage indexed properties.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classIlrPropertyManager.PropertyThis class represents a property.
-
Constructor Summary
Constructors Constructor and Description IlrPropertyManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.ObjectgetProperty(java.lang.String propertyName)This method returns the value associated with the property.java.lang.ObjectgetProperty(java.lang.String propertyName, int index)This method returns the value associated with the given indexed property.booleanhasProperty(java.lang.String propertyName)This method checks if a property is present on the object.booleanhasProperty(java.lang.String propertyName, int index)This method checks if an indexed property is present on the object.java.util.Iteratorproperties()This method returns an iterator on the properties registered on the object.voidremoveAllProperties()This method removes all properties stored on the object.booleanremoveProperty(java.lang.String key)This method removes a property from the object.booleanremoveProperty(java.lang.String key, int index)This method removes an indexed property from the objectvoidsetProperty(java.lang.String propertyName, int index, java.lang.Object value)This method allows setting an indexed property on the object.voidsetProperty(java.lang.String propertyName, java.lang.Object value)This method allows setting a property on the object.
-
-
-
Method Detail
-
setProperty
public void setProperty(java.lang.String propertyName, java.lang.Object value)This method allows setting a property on the object.- Parameters:
propertyName- The property key.value- The property value.
-
setProperty
public void setProperty(java.lang.String propertyName, int index, java.lang.Object value)This method allows setting an indexed property on the object.- Parameters:
propertyName- The property key.index- The index of the property. A-1index is equivalent to a non-indexed property.value- The property value.
-
removeAllProperties
public void removeAllProperties()
This method removes all properties stored on the object.
-
hasProperty
public boolean hasProperty(java.lang.String propertyName)
This method checks if a property is present on the object.- Parameters:
propertyName- The property key.- Returns:
trueif the property is registered on the object, andfalseotherwise.
-
hasProperty
public boolean hasProperty(java.lang.String propertyName, int index)This method checks if an indexed property is present on the object.- Parameters:
propertyName- The property key.index- The property index. A-1index is equivalent to a non-indexed property.- Returns:
trueif the property is registered on the object, orfalseif it is not.
-
getProperty
public java.lang.Object getProperty(java.lang.String propertyName)
This method returns the value associated with the property.- Parameters:
propertyName- The property key.- Returns:
- The value associated with the property, or
nullif the property is not registered on the object.
-
getProperty
public java.lang.Object getProperty(java.lang.String propertyName, int index)This method returns the value associated with the given indexed property.- Parameters:
propertyName- The property key.index- The index of the property. A-1index is equivalent to a non-indexed property.- Returns:
- The value associated with the property or
nullif the property is not registered on the object.
-
removeProperty
public boolean removeProperty(java.lang.String key)
This method removes a property from the object.- Parameters:
key- The property key.- Returns:
trueif the property was found, orfalseif it was not.
-
removeProperty
public boolean removeProperty(java.lang.String key, int index)This method removes an indexed property from the object- Parameters:
key- The property key.index- The property index. A-1index is equivalent to a non-indexed property.- Returns:
trueif the property was found, orfalseif it was not.
-
properties
public java.util.Iterator properties()
This method returns an iterator on the properties registered on the object. The objects returned by the iterator are instances of theIlrPropertyManager.Propertyclass.- Returns:
- A new iterator.
-
-