org.gcube.data.trees.patterns
Class AbstractPattern

java.lang.Object
  extended by org.gcube.data.trees.patterns.AbstractPattern
All Implemented Interfaces:
Serializable, Pattern
Direct Known Subclasses:
AnyPattern, LeafPattern, TreePattern

public abstract class AbstractPattern
extends Object
implements Pattern

Partial Pattern implementation.

Adds support for pattern for node identifiers.

Author:
Fabio Simeoni
See Also:
Serialized Form

Constructor Summary
AbstractPattern()
           
 
Method Summary
 boolean equals(Object obj)
           
 int hashCode()
           
 LeafPattern<?,?> idPattern()
          Returns the pattern on the node identifier.
 boolean matches(Node node)
          Indicates whether a node matches a pattern.
 void prune(Node node)
          Prunes a node of all the descendants that are not required to match the pattern.
 void setIdPattern(LeafPattern<?,?> idp)
          Set a predicate on the node identifier.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPattern

public AbstractPattern()
Method Detail

setIdPattern

public void setIdPattern(LeafPattern<?,?> idp)
Set a predicate on the node identifier.

Parameters:
idp - the pattern.

idPattern

public LeafPattern<?,?> idPattern()
Returns the pattern on the node identifier.

Returns:
the pattern.

matches

public boolean matches(Node node)
Description copied from interface: Pattern
Indicates whether a node matches a pattern.

Specified by:
matches in interface Pattern
Parameters:
node - the node.
Returns:
true if it does, false otherwise.

prune

public void prune(Node node)
           throws Exception
Description copied from interface: Pattern
Prunes a node of all the descendants that are not required to match the pattern.

Specified by:
prune in interface Pattern
Parameters:
node - the node.
Throws:
Exception - if the node does not match the pattern.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2013. All Rights Reserved.