org.gcube.data.trees.patterns
Class TreePattern

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

public class TreePattern
extends AbstractPattern

A Pattern over InnerNodes.

Author:
Fabio Simeoni
See Also:
Serialized Form

Constructor Summary
TreePattern(List<EdgePattern> patterns)
          Creates and instance with a list of EdgePatterns.
 
Method Summary
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean matches(Node n)
          Indicates whether a node matches a pattern.
 EdgePattern pattern(QName label)
          Returns a pattern with a given label, if one exists.
 List<EdgePattern> patterns()
          Return the patterns.
 void prune(Node n)
          Prunes a node of all the descendants that are not required to match the pattern.
 String toString()
          
 
Methods inherited from class org.gcube.data.trees.patterns.AbstractPattern
idPattern, setIdPattern
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreePattern

public TreePattern(List<EdgePattern> patterns)
Creates and instance with a list of EdgePatterns.

Parameters:
patterns - the patterns
Method Detail

matches

public boolean matches(Node n)
Indicates whether a node matches a pattern.

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

prune

public void prune(Node n)
           throws Exception
Prunes a node of all the descendants that are not required to match the pattern.

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

patterns

public List<EdgePattern> patterns()
Return the patterns.

Returns:
the patterns.

pattern

public EdgePattern pattern(QName label)
Returns a pattern with a given label, if one exists.

Parameters:
label - the label.
Returns:
the pattern, or null.

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractPattern

equals

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


Copyright © 2012. All Rights Reserved.