Package com.yahoo.vespa.objects
Class Selectable
- java.lang.Object
-
- com.yahoo.vespa.objects.Selectable
-
- Direct Known Subclasses:
Identifiable
public class Selectable extends java.lang.Object
- Author:
- baldersheim
This class acts as an interface for traversing a tree, or a graph.
Every non leaf Object implements
selectMembers(ObjectPredicate, ObjectOperation)
implementing the actual traversal. You can then implement anObjectPredicate
to select which nodes you want to look at with yourObjectOperation
-
-
Constructor Summary
Constructors Constructor Description Selectable()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
select(ObjectPredicate predicate, ObjectOperation operation)
Apply the predicate to this object.static void
select(Selectable selectable, ObjectPredicate predicate, ObjectOperation operation)
void
selectMembers(ObjectPredicate predicate, ObjectOperation operation)
Invokeselect(ObjectPredicate, ObjectOperation)
on any member objects this object wants to expose through the selection mechanism.
-
-
-
Method Detail
-
select
public final void select(ObjectPredicate predicate, ObjectOperation operation)
Apply the predicate to this object. If the predicate returns true, pass this object to the operation, otherwise invoke theselectMembers(ObjectPredicate, ObjectOperation)
method to locate sub-elements that might trigger the predicate.- Parameters:
predicate
- component used to select (sub-)objectsoperation
- component performing some operation on the selected (sub-)objects
-
selectMembers
public void selectMembers(ObjectPredicate predicate, ObjectOperation operation)
Invokeselect(ObjectPredicate, ObjectOperation)
on any member objects this object wants to expose through the selection mechanism. Overriding this method is optional, and which objects to expose is determined by the application logic of the object itself.- Parameters:
predicate
- component used to select (sub-)objectsoperation
- component performing some operation on the selected (sub-)objects
-
select
public static void select(Selectable selectable, ObjectPredicate predicate, ObjectOperation operation)
-
-