org.modeshape.graph.query
Class QueryResults.Statistics

java.lang.Object
  extended by org.modeshape.graph.query.QueryResults.Statistics
All Implemented Interfaces:
Serializable, Comparable<QueryResults.Statistics>
Enclosing interface:
QueryResults

@Immutable
public static class QueryResults.Statistics
extends Object
implements Comparable<QueryResults.Statistics>, Serializable

See Also:
Serialized Form

Field Summary
protected static QueryResults.Statistics EMPTY_STATISTICS
           
 
Constructor Summary
QueryResults.Statistics()
           
QueryResults.Statistics(long planningNanos)
           
QueryResults.Statistics(long planningNanos, long optimizationNanos, long resultFormulationNanos, long executionNanos)
           
 
Method Summary
 int compareTo(QueryResults.Statistics that)
          
 long getExecutionTime(TimeUnit unit)
          Get the time required to execute the query.
 long getOptimizationTime(TimeUnit unit)
          Get the time required to determine or select a (more) optimal plan.
 long getPlanningTime(TimeUnit unit)
          Get the time required to come up with the canonical plan.
 long getResultFormulationTime(TimeUnit unit)
          Get the time required to formulate the structure of the results.
 long getTotalTime(TimeUnit unit)
          Get the time required to execute the query.
protected  void readable(long nanos, StringBuilder sb)
           
 String toString()
          
protected  long totalTime()
           
 QueryResults.Statistics withExecutionTime(long executionNanos)
          Create a new statistics object that has the supplied execution time.
 QueryResults.Statistics withExecutionTime(long execution, TimeUnit unit)
          Create a new statistics object that has the supplied execution time.
 QueryResults.Statistics withOptimizationTime(long optimizationNanos)
          Create a new statistics object that has the supplied optimization time.
 QueryResults.Statistics withOptimizationTime(long optimization, TimeUnit unit)
          Create a new statistics object that has the supplied optimization time.
 QueryResults.Statistics withPlanningTime(long planningNanos)
          Create a new statistics object that has the supplied planning time.
 QueryResults.Statistics withPlanningTime(long planning, TimeUnit unit)
          Create a new statistics object that has the supplied planning time.
 QueryResults.Statistics withResultsFormulationTime(long resultFormulationNanos)
          Create a new statistics object that has the supplied result formulation time.
 QueryResults.Statistics withResultsFormulationTime(long resultFormulation, TimeUnit unit)
          Create a new statistics object that has the supplied result formulation time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_STATISTICS

protected static final QueryResults.Statistics EMPTY_STATISTICS
Constructor Detail

QueryResults.Statistics

public QueryResults.Statistics()

QueryResults.Statistics

public QueryResults.Statistics(long planningNanos)

QueryResults.Statistics

public QueryResults.Statistics(long planningNanos,
                               long optimizationNanos,
                               long resultFormulationNanos,
                               long executionNanos)
Method Detail

getPlanningTime

public long getPlanningTime(TimeUnit unit)
Get the time required to come up with the canonical plan.

Parameters:
unit - the time unit that should be used
Returns:
the time to plan, in the desired units
Throws:
IllegalArgumentException - if the unit is null

getOptimizationTime

public long getOptimizationTime(TimeUnit unit)
Get the time required to determine or select a (more) optimal plan.

Parameters:
unit - the time unit that should be used
Returns:
the time to determine an optimal plan, in the desired units
Throws:
IllegalArgumentException - if the unit is null

getResultFormulationTime

public long getResultFormulationTime(TimeUnit unit)
Get the time required to formulate the structure of the results.

Parameters:
unit - the time unit that should be used
Returns:
the time to formulate the results, in the desired units
Throws:
IllegalArgumentException - if the unit is null

getExecutionTime

public long getExecutionTime(TimeUnit unit)
Get the time required to execute the query.

Parameters:
unit - the time unit that should be used
Returns:
the time to execute the query, in the desired units
Throws:
IllegalArgumentException - if the unit is null

getTotalTime

public long getTotalTime(TimeUnit unit)
Get the time required to execute the query.

Parameters:
unit - the time unit that should be used
Returns:
the time to execute the query, in the desired units
Throws:
IllegalArgumentException - if the unit is null

totalTime

protected long totalTime()

withPlanningTime

public QueryResults.Statistics withPlanningTime(long planningNanos)
Create a new statistics object that has the supplied planning time.

Parameters:
planningNanos - the number of nanoseconds required by planning
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the time value is negative

withOptimizationTime

public QueryResults.Statistics withOptimizationTime(long optimizationNanos)
Create a new statistics object that has the supplied optimization time.

Parameters:
optimizationNanos - the number of nanoseconds required by optimization
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the time value is negative

withResultsFormulationTime

public QueryResults.Statistics withResultsFormulationTime(long resultFormulationNanos)
Create a new statistics object that has the supplied result formulation time.

Parameters:
resultFormulationNanos - the number of nanoseconds required by result formulation
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the time value is negative

withExecutionTime

public QueryResults.Statistics withExecutionTime(long executionNanos)
Create a new statistics object that has the supplied execution time.

Parameters:
executionNanos - the number of nanoseconds required to execute the query
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the time value is negative

withPlanningTime

public QueryResults.Statistics withPlanningTime(long planning,
                                                TimeUnit unit)
Create a new statistics object that has the supplied planning time.

Parameters:
planning - the time required to plan the query
unit - the time unit
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the unit is null or if the time value is negative

withOptimizationTime

public QueryResults.Statistics withOptimizationTime(long optimization,
                                                    TimeUnit unit)
Create a new statistics object that has the supplied optimization time.

Parameters:
optimization - the time required by optimization
unit - the time unit
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the unit is null or if the time value is negative

withResultsFormulationTime

public QueryResults.Statistics withResultsFormulationTime(long resultFormulation,
                                                          TimeUnit unit)
Create a new statistics object that has the supplied result formulation time.

Parameters:
resultFormulation - the time required to formulate the results
unit - the time unit
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the unit is null or if the time value is negative

withExecutionTime

public QueryResults.Statistics withExecutionTime(long execution,
                                                 TimeUnit unit)
Create a new statistics object that has the supplied execution time.

Parameters:
execution - the time required to execute the query
unit - the time unit
Returns:
the new statistics object; never null
Throws:
IllegalArgumentException - if the unit is null or if the time value is negative

compareTo

public int compareTo(QueryResults.Statistics that)

Specified by:
compareTo in interface Comparable<QueryResults.Statistics>
See Also:
Comparable.compareTo(java.lang.Object)

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

readable

protected void readable(long nanos,
                        StringBuilder sb)


Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.