com.bigdata.bop
Class CoreBaseBOp

java.lang.Object
  extended by com.bigdata.bop.CoreBaseBOp
All Implemented Interfaces:
BOp, IPropertySet, Serializable, Cloneable
Direct Known Subclasses:
BOpBase, ModifiableBOpBase

public abstract class CoreBaseBOp
extends Object
implements BOp

Base class with some common methods for mutable and copy-on-write BOp s.

Version:
$Id: CoreBaseBOp.java 6226 2012-03-30 15:10:38Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bigdata.bop.BOp
BOp.Annotations
 
Field Summary
protected static int DEFAULT_INITIAL_CAPACITY
          The default initial capacity used for an empty annotation map -- empty maps use the minimum initial capacity to avoid waste since we create a large number of BOps during query evaluation.
 
Fields inherited from interface com.bigdata.bop.BOp
NOANNS, NOARGS
 
Constructor Summary
CoreBaseBOp()
           
 
Method Summary
protected  boolean annotationsEqual(BOp o)
          Return true iff the annotations of this BOp and the other BOp are equals.
protected static boolean annotationsEqual(Map<String,Object> m1, Map<String,Object> m2)
          Compares two maps.
protected  void annotationsToString(StringBuilder sb)
           
protected  void checkArgs(BOp[] args)
          Check the operator argument.
 CoreBaseBOp clone()
          Deep copy clone semantics.
 boolean equals(Object other)
          true if all arguments and annotations are the same.
 BOpEvaluationContext getEvaluationContext()
          Return the evaluation context for the operator as specified by BOp.Annotations.EVALUATION_CONTEXT.
 int getId()
          Return the BOp.Annotations.BOP_ID.
<T> T
getProperty(String name, T defaultValue)
          Return the value of the named annotation.
 Object getRequiredProperty(String name)
          Return the value of the named annotation.
 int hashCode()
          The hash code is based on the hash of the operands (cached).
static String indent(int depth)
          Returns a string that may be used to indent a dump of the nodes in the tree.
 boolean isController()
          Return true iff this operator is a controller.
 String toShortString()
          General contract is a short (non-recursive) representation of the BOp.
 String toString()
          Return a non-recursive representation of the arguments and annotations for this BOp.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bigdata.bop.BOp
annotations, argIterator, args, arity, get, setProperty, toArray, toArray
 
Methods inherited from interface cutthecrap.utils.striterators.IPropertySet
getProperty
 

Field Detail

DEFAULT_INITIAL_CAPACITY

protected static final transient int DEFAULT_INITIAL_CAPACITY
The default initial capacity used for an empty annotation map -- empty maps use the minimum initial capacity to avoid waste since we create a large number of BOps during query evaluation.

See Also:
Constant Field Values
Constructor Detail

CoreBaseBOp

public CoreBaseBOp()
Method Detail

checkArgs

protected void checkArgs(BOp[] args)
Check the operator argument.

Parameters:
args - The arguments.
Throws:
IllegalArgumentException - if the arguments are not valid for the operator.

clone

public CoreBaseBOp clone()
Deep copy clone semantics.

Deep copy clone of the operator.

Specified by:
clone in interface BOp
Overrides:
clone in class Object

toShortString

public String toShortString()
General contract is a short (non-recursive) representation of the BOp.

Specified by:
toShortString in interface BOp

toString

public String toString()
Return a non-recursive representation of the arguments and annotations for this BOp.

Specified by:
toString in interface BOp
Overrides:
toString in class Object

annotationsToString

protected void annotationsToString(StringBuilder sb)

getRequiredProperty

public final Object getRequiredProperty(String name)
Description copied from interface: BOp
Return the value of the named annotation.

Specified by:
getRequiredProperty in interface BOp
Parameters:
name - The name of the annotation.
Returns:
The value of the annotation.
See Also:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302954

getProperty

public final <T> T getProperty(String name,
                               T defaultValue)
Description copied from interface: BOp
Return the value of the named annotation.

Specified by:
getProperty in interface BOp
Type Parameters:
T - The generic type of the annotation value.
Parameters:
name - The name of the annotation.
defaultValue - The default value.
Returns:
The annotation value -or- the defaultValue if the annotation was not bound.

getId

public final int getId()
Description copied from interface: BOp
Return the BOp.Annotations.BOP_ID.

Specified by:
getId in interface BOp

isController

public final boolean isController()
Description copied from interface: BOp
Return true iff this operator is a controller.

Specified by:
isController in interface BOp
See Also:
BOp.Annotations.CONTROLLER

getEvaluationContext

public final BOpEvaluationContext getEvaluationContext()
Description copied from interface: BOp
Return the evaluation context for the operator as specified by BOp.Annotations.EVALUATION_CONTEXT.

Specified by:
getEvaluationContext in interface BOp

equals

public boolean equals(Object other)
true if all arguments and annotations are the same.

Overrides:
equals in class Object

annotationsEqual

protected boolean annotationsEqual(BOp o)
Return true iff the annotations of this BOp and the other BOp are equals.

Note: This method permits override by subclasses with direct access to the maps to be compared.

See Also:
annotationsEqual(Map, Map)

annotationsEqual

protected static final boolean annotationsEqual(Map<String,Object> m1,
                                                Map<String,Object> m2)
Compares two maps. If the value under a key is an array, then uses Arrays.equals(Object[], Object[]) to compare the values rather than Object.equals(Object). Without this, two bops having array annotation values which have the same data but different array instances will not compare as equal.

Parameters:
m1 - One set of annotations.
m2 - Another set of annotations.
Returns:
true iff the annotations have the same data.

hashCode

public int hashCode()
The hash code is based on the hash of the operands (cached).

Overrides:
hashCode in class Object

indent

public static String indent(int depth)
Returns a string that may be used to indent a dump of the nodes in the tree.

Note: The string is capped out after a maximum supported depth.

Parameters:
depth - The indentation depth.
Returns:
A string suitable for indent at that height.


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.