JIVE Platform
Release 0.3.1

edu.buffalo.cse.jive.ui.search.queries
Class MethodReturnedSearchQuery

java.lang.Object
  extended by edu.buffalo.cse.jive.ui.search.AbstractJiveSearchQuery
      extended by edu.buffalo.cse.jive.ui.search.ExecutionHistorySearchQuery
          extended by edu.buffalo.cse.jive.ui.search.queries.MethodReturnedSearchQuery
All Implemented Interfaces:
SequenceModel.EventVisitor, IJiveSearchQuery, ISearchQuery

public class MethodReturnedSearchQuery
extends ExecutionHistorySearchQuery

An IJiveSearchQuery that is used to check method returns and optionally conditions on return values. The query is capable of checking for method returns on a single instance or over all instances of a class (if an instance number is not provided).


Nested Class Summary
protected  class MethodReturnedSearchQuery.ReturnEventExporter
          An exporter used to examine ReturnEvents and to determine if the event is a return from a method represented by a JiveSearchPattern.
 
Field Summary
protected  MethodReturnedSearchQuery.ReturnEventExporter exporter
          An exporter used to examine ReturnEvents.
protected  RelationalOperator operator
          A relational operator for a condition on the method return value.
protected  JiveSearchPattern pattern
          A search pattern for the method return.
protected  String rightValue
          A value to be used on the right side of the operator.
 
Constructor Summary
MethodReturnedSearchQuery(JiveSearchPattern pattern, RelationalOperator operator, String rightValue)
          Constructs a new search query with the supplied pattern and relational operator.
 
Method Summary
protected  boolean checkForMatch(ReturnEvent event)
          Checks if the supplied event matches the search pattern.
 ImageDescriptor getImageDescriptor()
          Returns an ImageDescriptor used to represent the search query's result in the Search view's 'Show Previous Searches' tool bar action.
 String getResultLabel(int matchCount)
          Returns a label describing the search result used in the Search view.
 Class<? extends Object> getResultType()
          Returns the type of search result matches collected by the search query.
 void visit(EventOccurrence event)
          Visits an EventOccurrernce (other than a MessageSend).
 void visit(MessageSend event)
          Visits an occurrence of a MessageSend event.
 
Methods inherited from class edu.buffalo.cse.jive.ui.search.ExecutionHistorySearchQuery
addMatch, performSearch
 
Methods inherited from class edu.buffalo.cse.jive.ui.search.AbstractJiveSearchQuery
canRerun, canRunInBackground, createSearchResult, getLabel, getSearchResult, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exporter

protected MethodReturnedSearchQuery.ReturnEventExporter exporter
An exporter used to examine ReturnEvents.


pattern

protected JiveSearchPattern pattern
A search pattern for the method return.


operator

protected RelationalOperator operator
A relational operator for a condition on the method return value.


rightValue

protected String rightValue
A value to be used on the right side of the operator.

Constructor Detail

MethodReturnedSearchQuery

public MethodReturnedSearchQuery(JiveSearchPattern pattern,
                                 RelationalOperator operator,
                                 String rightValue)
Constructs a new search query with the supplied pattern and relational operator. The variable name provided by the pattern is ignored. An instance number is optional.

Parameters:
pattern - the search pattern
operator - the relational operator
rightValue - the right operand
Method Detail

getResultType

public Class<? extends Object> getResultType()
Description copied from interface: IJiveSearchQuery
Returns the type of search result matches collected by the search query. This is used by the Search view to determine how to display the search result tabularly.

NOTE: This will be changed in the future. For now, return Event.class for a result containing matches of mixed event types or return the specific class literal for a result containing matches of a single event type (e.g., AssignEvent.class).

Specified by:
getResultType in interface IJiveSearchQuery
Overrides:
getResultType in class ExecutionHistorySearchQuery
Returns:
the type of search result matches

getResultLabel

public String getResultLabel(int matchCount)
Description copied from interface: IJiveSearchQuery
Returns a label describing the search result used in the Search view. Typically, this describes what is being searched for and the number of matches, as supplied by matchCount.

Parameters:
matchCount - the number of matches thus far
Returns:
a description of what is being searched

getImageDescriptor

public ImageDescriptor getImageDescriptor()
Description copied from interface: IJiveSearchQuery
Returns an ImageDescriptor used to represent the search query's result in the Search view's 'Show Previous Searches' tool bar action.

Returns:
an image descriptor representing the result

visit

public void visit(EventOccurrence event)
Description copied from interface: SequenceModel.EventVisitor
Visits an EventOccurrernce (other than a MessageSend).

Parameters:
event - the event occurrence being visited

visit

public void visit(MessageSend event)
Description copied from interface: SequenceModel.EventVisitor
Visits an occurrence of a MessageSend event.

Parameters:
event - the message send being visited

checkForMatch

protected boolean checkForMatch(ReturnEvent event)
Checks if the supplied event matches the search pattern.

Parameters:
event - the return event
Returns:
true if the event matches the pattern, false otherwise

JIVE Platform
Release 0.3.1