public class FrameAstKey
extends java.lang.Object
FrameAstKey
will be equals
. If the keys are different, then the two
frames belong to different partitions.
The matching algorithm takes into consideration:
Modifier and Type | Field and Description |
---|---|
private Aast |
fAst
The Progress AST contained.
|
private java.lang.String |
frameName
The name of the FRAME.
|
private int |
hash
Cached value of hash.
|
Constructor and Description |
---|
FrameAstKey(Aast ast,
java.lang.String frameName)
The single constructor.
|
Modifier and Type | Method and Description |
---|---|
private int |
computeHash()
Compute the hashing value for the FRAME component.
|
boolean |
equals(java.lang.Object obj)
Check if another object
obj and this are identical (represent FRAMES with compatible
structure, which can be SHARED). |
private static Aast |
getNextSignificantNode(Aast frameDefNode)
Utility method that searches next relevant item from a frame definition, starting from a
current node, iterating its right siblings, until one is found or teh list ends.
|
int |
hashCode()
Obtain the hashing value for this container.
|
private final Aast fAst
KW_FORM
or DEFINE_FRAME
node.private final int hash
FrameAstKey
is imutabil so once computed in constructor it
remains unchanged during the lifetime of the container.private final java.lang.String frameName
public FrameAstKey(Aast ast, java.lang.String frameName)
ast
- The content node. Must be a KW_FORM
or DEFINE_FRAME
frameName
- The name of the frame. It cannot be always extracted directly form ast
.java.lang.NullPointerException
- if any argument is null
.java.lang.RuntimeException
- on parameter validation failure: the first argument is not a FRAME definition
(KW_FORM
or DEFINE_FRAME
).private int computeHash()
Iterate all nodes and create a hashing value for all relevant sub-nodes (the ones that are
needed for frame matching). Only FORM_ITEM
that contains accessible information
are taken into consideration (fields and variables). The constants also add to hashing value
but their actual value is not important. Spacers are totally ignored.
The order is also important but it is not enforced directly. However, because of the way the items are added and shifted sequentially, the result value should be sufficient for a hashing key.
java.lang.RuntimeException
- if some unexpected children are encountered.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
obj
and this are identical (represent FRAMES with compatible
structure, which can be SHARED). The algorithm iterates all relevant nodes from both
containers and try to match them. Like the hashing algorithm, only FORM_ITEM
that
contains accessible information are taken into consideration (fields and variables). The
constants also add to hashing value but their actual value is not important. Spacers are
completely ignored.equals
in class java.lang.Object
obj
- A second object to test for item structure.true
if the obj
and this contain compatible frame definitions.private static Aast getNextSignificantNode(Aast frameDefNode)
frameDefNode
- the starting point for relevant node search.null
otherwise.