Rule Execution Server API

ilog.rules.factory
Class IlrHasher

java.lang.Object
  extended by ilog.rules.factory.IlrHasher
All Implemented Interfaces:
Serializable

public final class IlrHasher
extends Object
implements Serializable

The class defines a hasher of the ruleset. A hasher is a way to optimize the join test of a rule by activating an internal hash table. A hasher is composed of a formal variable defining on which class the hasher is applied, a hashing expression, and a set of properties.

The properties are the size of the internal hash table, an accuracy flag to indicate which internal structure should be used, a constant flag indicating whether the hasher class instances are constant or not, and an ordered flag activating the hasher on relation orders. These properties may have an important influence on the performance of the engine.

By default, a hasher is activated only on an equality relation, is not accurate, and not constant.

There are additional constraints on the properties and the hashing expressions. Please refer to the reference manual.

See Also:
Serialized Form

Field Summary
static int DEFAULT_SIZE
           
 
Constructor Summary
IlrHasher(IlrVariable formalVariable, IlrValue hashingExpr)
          Builds a hasher given its formal parameter and hashing expression.
 
Method Summary
 IlrVariable getFormalVariable()
          Gets the formal variable of the hasher.
 IlrValue getHashingExpression()
          Gets the hashing expression of the hasher.
 String getIdentifier()
          Gets the identifier of the hasher.
 int getSize()
          Gets the size of the internal hash table.
 boolean isAccurate()
          Indicates whether the hasher is accurate or not.
 boolean isConstant()
          Indicates whether the hasher is constant or not.
 boolean isOrdered()
          Indicates whether the hasher is ordered or not.
 void setAccurate(boolean accurate)
          Sets the accuracy of the hasher.
 void setConstant(boolean constant)
          Sets the constant quality of the hasher.
 void setOrdered(boolean ordered)
          Sets the ordered quality of the hasher.
 void setSize(int size)
          Sets the size of the internal hash table dedicated to this hasher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final int DEFAULT_SIZE
See Also:
Constant Field Values
Constructor Detail

IlrHasher

public IlrHasher(IlrVariable formalVariable,
                 IlrValue hashingExpr)
Builds a hasher given its formal parameter and hashing expression.

Parameters:
formalVariable - The formal parameter.
hashingExpr - The hashing expression.
Method Detail

setAccurate

public void setAccurate(boolean accurate)
Sets the accuracy of the hasher. An accurate hasher is related to an internal hash map where the key provided by the hashing expression exactly identifies the set of corresponding instances.

Parameters:
accurate - true to set the hasher accuracy property.

setConstant

public void setConstant(boolean constant)
Sets the constant quality of the hasher. A constant hasher assumes that the cardinality of its related class is constant when the rules are fired in the engine. Adding a new instance is then time consuming compared to a nonconstant hasher.

Parameters:
constant - true to set the hasher constant property.

setOrdered

public void setOrdered(boolean ordered)
Sets the ordered quality of the hasher. An ordered hasher could be activated with an equality or an ordered relation. The hashing expression must be consistent with this ordered relation.

Parameters:
ordered - true to set the hasher ordered property.

getIdentifier

public String getIdentifier()
Gets the identifier of the hasher. This identifier is composed of the formal variable.


isAccurate

public boolean isAccurate()
Indicates whether the hasher is accurate or not.

Returns:
true if accurate.

isConstant

public boolean isConstant()
Indicates whether the hasher is constant or not.

Returns:
true if constant.

isOrdered

public boolean isOrdered()
Indicates whether the hasher is ordered or not.

Returns:
true if ordered.

setSize

public void setSize(int size)
Sets the size of the internal hash table dedicated to this hasher.

Parameters:
size - The size to be set.

getSize

public int getSize()
Gets the size of the internal hash table.

Returns:
The size.

getFormalVariable

public IlrVariable getFormalVariable()
Gets the formal variable of the hasher.

Returns:
The formal variable.

getHashingExpression

public IlrValue getHashingExpression()
Gets the hashing expression of the hasher.

Returns:
The expression.

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013