public class FrameAstKey
extends java.lang.Object
implements java.io.Externalizable
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()
Default c'tor, used for (de)serialization.
|
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 void |
initialize(Aast ast,
java.lang.String frameName)
Initialize this instance from the backing AST.
|
void |
readExternal(java.io.ObjectInput in)
Restore this instance by re-loading the AST with the given ID and
initialize(com.goldencode.ast.Aast, java.lang.String) it. |
void |
writeExternal(java.io.ObjectOutput out)
Write this instance to stream.
|
private Aast fAst
KW_FORM or DEFINE_FRAME node.private int hash
FrameAstKey is imutabil so once computed in constructor it
remains unchanged during the lifetime of the container.private java.lang.String frameName
public FrameAstKey()
public FrameAstKey(Aast ast, java.lang.String frameName)
ast - The content node. Must be a KW_FORM or DEFINE_FRAMEframeName - 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).public int hashCode()
hashCode in class java.lang.Objectpublic 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.Objectobj - A second object to test for item structure.true if the obj and this contain compatible frame definitions.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizableout - The object output stream.java.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
initialize(com.goldencode.ast.Aast, java.lang.String) it.readExternal in interface java.io.Externalizablein - The object input stream.java.io.IOExceptionjava.lang.ClassNotFoundExceptionprivate static Aast getNextSignificantNode(Aast frameDefNode)
frameDefNode - the starting point for relevant node search.null otherwise.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.private void initialize(Aast ast, java.lang.String frameName)
ast - The content node. Must be a KW_FORM or DEFINE_FRAMEframeName - 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).