class xform_operator

Enumeration class: an operator that can be used in a transform query with step_xform.query().

This class is used when implementing step visitors. When you implement step_state.transition() as part of the overall task of subclassing step_state , you will use step_xform.query() invocations to inspect its step_xform arguments; these query invocations take xform_operator arguments.

xform_operator Details

class cs.xform_operator

Enumeration class: an operator that can be used in a transform query with step_xform.query().

static from_integer(_inner)

Construct an instance from an integer representation.

Parameters:_inner (int) – The integer representation, as returned by xform_operator.as_integer().
Return type:xform_operator
Raises:result.ERROR_INVALID_ARGUMENT if _inner is not a valid integer representation for a xform_operator instance.

Invariant: For xform_operator x, xform_operator.from_integer(x.as_integer()) == x

>>> xo = xform_operator.LESS_THAN_OR_EQUAL.as_integer()
>>> xo
3
>>> xform_operator.from_integer(xo)
<cs.xform_operator less_than_or_equal>
__cmp__(other)

Comparison function for xform_operator , with respect to a stable overall ordering.

Parameters:other (xform_operator) – The xform_operator object to compare against.
Return type:int
Returns:An integer N such that:
  • N==0 if the two objects compare equal
  • N<0 if self < other
  • N>0 if self > other
>>> xform_operator.LESS_THAN_OR_EQUAL.__cmp__(xform_operator.NOT_EQUAL)
1
__eq__(b)

Equality operator for xform_operator .

Parameters:b (xform_operator) – The xform_operator object to compare against.
Return type:bool
Returns:True if self and b compare equal, False otherwise.
>>> xform_operator.GREATER_THAN_OR_EQUAL == xform_operator.EQUAL
False
__ge__(b)

Greater-than-or-equal operator for xform_operator .

Parameters:b (xform_operator) – The xform_operator object to compare against.
Return type:bool
Returns:True if self >= b , False otherwise.
>>> xform_operator.GREATER_THAN_OR_EQUAL >= xform_operator.LESS_THAN_OR_EQUAL
False
__gt__(b)

Greater-than operator for xform_operator .

Parameters:b (xform_operator) – The xform_operator object to compare against.
Return type:bool
Returns:True if self > b , False otherwise.
>>> xform_operator.NOT_EQUAL > xform_operator.GREATER_THAN_OR_EQUAL
False
__hash__()

Hash function for xform_operator .

Return type:int
>>> hash(xform_operator.NOT_EQUAL)
1
__le__(b)

Less-than-or-equal operator for xform_operator .

Parameters:b (xform_operator) – The xform_operator object to compare against.
Return type:bool
Returns:True if self <= b , False otherwise.
>>> xform_operator.LESS_THAN_OR_EQUAL <= xform_operator.EQUAL
False
__lt__(b)

Less-than operator for xform_operator .

Parameters:b (xform_operator) – The xform_operator object to compare against.
Return type:bool
Returns:True if self < b , False otherwise.
>>> xform_operator.NOT_EQUAL < xform_operator.EQUAL
False
__ne__(b)

Inequality operator for xform_operator .

Parameters:b (xform_operator) – The xform_operator object to compare against.
Return type:bool
Returns:False if self and b compare equal, True otherwise.
>>> xform_operator.LESS_THAN_OR_EQUAL != xform_operator.GREATER_THAN_OR_EQUAL
True
__repr__()

Get a representation of a xform_operator object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> repr(xform_operator.EQUAL)
'<cs.xform_operator equal>'
__str__()

Get a simple string representation of a xform_operator object.

Return type:str
Returns:The string representation.
>>> str(xform_operator.NOT_EQUAL)
'not_equal'
as_integer()

Get an integer representation of self.

Return type:int
Returns:An integer suitable for use with xform_operator.from_integer().

Invariant: For xform_operator x, xform_operator.from_integer(x.as_integer()) == x

>>> xo = xform_operator.LESS_THAN_OR_EQUAL.as_integer()
>>> xo
3
>>> xform_operator.from_integer(xo)
<cs.xform_operator less_than_or_equal>
name()

Get the name of a xform_operator object.

Return type:str
Returns:The name.
>>> xform_operator.LESS_THAN_OR_EQUAL.name()
'less_than_or_equal'
EQUAL

the == operator

>>> xform_operator.EQUAL
<cs.xform_operator equal>
GREATER_THAN_OR_EQUAL

the >= operator

>>> xform_operator.GREATER_THAN_OR_EQUAL
<cs.xform_operator greater_than_or_equal>
LESS_THAN_OR_EQUAL

the <= operator

>>> xform_operator.LESS_THAN_OR_EQUAL
<cs.xform_operator less_than_or_equal>
NOT_EQUAL

the != operator

>>> xform_operator.NOT_EQUAL
<cs.xform_operator not_equal>