org.gcube.contentmanagement.contentmanager.stubs.model.predicates
Class One

java.lang.Object
  extended by org.gcube.contentmanagement.contentmanager.stubs.model.predicates.EdgePredicate
      extended by org.gcube.contentmanagement.contentmanager.stubs.model.predicates.One
All Implemented Interfaces:
java.io.Serializable

public class One
extends EdgePredicate

Asserts the existence of a single edge that has a given label and targets a node that satisfies a given predicate.

Nodes that have many edges with the given label do not satisfy this predicate, even if there is at least one edge whose target satisfies the given predicate.

Author:
Fabio Simeoni (University of Strathclyde)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.contentmanagement.contentmanager.stubs.model.predicates.EdgePredicate
EdgePredicate.Range
 
Constructor Summary
One(javax.xml.namespace.QName l, Predicate predicate)
          Creates an instance for a given label and predicate.
 
Method Summary
 boolean matches(java.util.List<Edge> edges)
          Indicates whether the predicate matches some of the edges in a given list.
 java.util.List<Edge> prune(java.util.List<Edge> edges)
          Returns the edges from a given list which match the predicate.
 EdgePredicate.Range range()
          
 
Methods inherited from class org.gcube.contentmanagement.contentmanager.stubs.model.predicates.EdgePredicate
equals, hashCode, isCondition, label, predicate, setAsCondition, setPredicate, toString, unsetAsCondition
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

One

public One(javax.xml.namespace.QName l,
           Predicate predicate)
Creates an instance for a given label and predicate.

Parameters:
l - the label.
predicate - the predicate.
Method Detail

matches

public boolean matches(java.util.List<Edge> edges)
Indicates whether the predicate matches some of the edges in a given list.

Parameters:
edges - the list.
Returns:
true if it does, false otherwise.

prune

public java.util.List<Edge> prune(java.util.List<Edge> edges)
                           throws java.lang.Exception
Returns the edges from a given list which match the predicate.

Parameters:
edges - the list.
Returns:
the matching edges.
Throws:
java.lang.Exception - if an attempt to match an edge fails with an error.

range

public EdgePredicate.Range range()

Specified by:
range in class EdgePredicate