anvil.core
Class AnyInt

java.lang.Object
  |
  +--anvil.core.Any
        |
        +--anvil.core.AnyNumber
              |
              +--anvil.core.AnyInt
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable

public class AnyInt
extends AnyNumber

class AnyInt.

Version:
$Revision: 1.33 $
Author:
Jani Lehtimäki

Field Summary
static NativeClass _class
           
protected  long _long
           
static java.lang.Object[] newInstance
           
 
Fields inherited from class anvil.core.AnyNumber
p_format
 
Fields inherited from class anvil.core.Any
ARRAY0, DOUBLE_MINUS_ONE, DOUBLE_ONE, DOUBLE_ZERO, EMPTY_STRING, EMPTY_TUPLE, FALSE, INF, IS_ARRAY, IS_BINARY, IS_BOOLEAN, IS_BUFFER, IS_CLASS, IS_DOUBLE, IS_ENUMERATION, IS_INF, IS_INT, IS_LIST, IS_MAP, IS_NEG_INF, IS_NULL, IS_PATTERN, IS_RANGE, IS_STRING, IS_TUPLE, IS_UNDEFINED, MINUS_ONE, NAN, NEG_INF, NULL, ONE, p_compareTo, p_each, p_equals, p_pipe, p_select, THREE, TRUE, TWO, UNDEFINED, ZERO
 
Method Summary
 Any add(Any other)
          Adds two Any's together.
 ClassType classOf()
          Returns the type of this Any.
 java.lang.Object clone()
          Returns shallow copy from this any.
protected  int compare(Any other)
           
 Any decrease()
          Decrease the value by one.
 Any divide(Any other)
          Divide two Any's.
 boolean equals(java.lang.Object obj)
          Tests for equality.
 int hashCode()
           
 Any increase()
          Increase the value by one.
 boolean isInt()
          Checks if this any is int.
 Any minus()
          Negate the sign.
 Any modulo(Any other)
          Calculate the remainder.
 Any multiply(Any other)
          Multiply two Any's.
static Any newInstance(Any value)
           
 Any plus()
          Remove the sign.
 void serialize(Serializer serializer)
           
 Any subtract(Any other)
          Substract two Any's.
 java.io.Writer toAnvil(java.io.Writer writer)
           
 Any toAnyInt()
          Gets the contained value as AnyInt.
 boolean toBoolean()
          Gets the contained value as boolean.
 char toChar()
          Gets the contained value as char.
 Code toCode(Code code)
           
 double toDouble()
          Gets the contained value as double.
 int toInt()
          Gets the contained value as int.
 long toLong()
          Gets the contained value as long.
 java.lang.Object toObject()
          Gets the contained value as java.lang.Object.
 java.lang.String toString()
          Converts contained value into String.
 int typeOf()
          Returns the type of contained value.
 
Methods inherited from class anvil.core.AnyNumber
m_format
 
Methods inherited from class anvil.core.Any
_clone, _copy, _invoke, _invoke, _invoke, _invoke, _invoke, _invoke, _serialize, _unserialize, _wakeup, classNameOf, coerce, compareTo, concat, contains, copy, create, create, create, create, create, create, create, create, create, create, create, create, create, create, deleteAttribute, deleteReference, execute, execute, execute, execute, execute, execute, getAttribute, getRef, getReference, has, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, isArray, isBinary, isBoolean, isBuffer, isDefined, isDouble, isInstanceOf, isIterator, isList, isMap, isMutable, isNull, isPattern, isRange, isRef, isSequence, isString, isTuple, isUndefined, iterator, m_clone, m_compareTo, m_copy, m_each, m_equals, m_hashCode, m_pipe, m_select, m_toBoolean, m_toString, not, setAttribute, setRef, setReference, setReference, sizeOf, toAnvil, toAnyBoolean, toAnyDouble, toAnyString, toArray, toBinary, toBuffer, toByte, toList, toMap, toPattern, toRange, toTuple, type
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

newInstance

public static final java.lang.Object[] newInstance

_class

public static final transient NativeClass _class

_long

protected long _long
Method Detail

newInstance

public static final Any newInstance(Any value)

clone

public java.lang.Object clone()
Description copied from class: Any
Returns shallow copy from this any.

Overrides:
clone in class Any
Returns:
Shallow copy

typeOf

public int typeOf()
Description copied from class: Any
Returns the type of contained value.

Overrides:
typeOf in class Any
Returns:
Type of this any as int.

isInt

public boolean isInt()
Description copied from class: Any
Checks if this any is int.

Overrides:
isInt in class Any
Returns:
true if this is int

classOf

public final ClassType classOf()
Description copied from class: Any
Returns the type of this Any.

Overrides:
classOf in class AnyNumber

toBoolean

public boolean toBoolean()
Description copied from class: Any
Gets the contained value as boolean. Integer is considered true if it is different from 0. Double is considered true if it is different from 0.0. String is considered true if it contains "true", "on", "yes" or "1".

Overrides:
toBoolean in class Any
Returns:
Value as boolean or false if it can't be transformed.

toInt

public int toInt()
Description copied from class: Any
Gets the contained value as int.

Overrides:
toInt in class Any
Returns:
Value as int or zero if it can't be transformed.

toLong

public long toLong()
Description copied from class: Any
Gets the contained value as long.

Overrides:
toLong in class Any
Returns:
Value as long or zero if it can't be transformed.

toDouble

public double toDouble()
Description copied from class: Any
Gets the contained value as double.

Overrides:
toDouble in class Any
Returns:
Value as double or 0.0 if it can't be transformed.

toChar

public char toChar()
Description copied from class: Any
Gets the contained value as char. Value is converted to string and first character is returned.

Overrides:
toChar in class Any
Returns:
Value as char

toString

public java.lang.String toString()
Description copied from class: Any
Converts contained value into String.

Overrides:
toString in class Any
Returns:
Value as String.

toAnvil

public java.io.Writer toAnvil(java.io.Writer writer)
                       throws java.io.IOException
Overrides:
toAnvil in class Any
java.io.IOException

toCode

public Code toCode(Code code)
Overrides:
toCode in class Any

toObject

public java.lang.Object toObject()
Description copied from class: Any
Gets the contained value as java.lang.Object.

Overrides:
toObject in class Any
Returns:
Value as Object.

toAnyInt

public Any toAnyInt()
Description copied from class: Any
Gets the contained value as AnyInt.

Overrides:
toAnyInt in class Any
Returns:
Value as AnyInt.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

increase

public Any increase()
Description copied from class: Any
Increase the value by one.

Overrides:
increase in class Any
Returns:
Increased value

decrease

public Any decrease()
Description copied from class: Any
Decrease the value by one.

Overrides:
decrease in class Any
Returns:
Decreased value

minus

public Any minus()
Description copied from class: Any
Negate the sign.

Overrides:
minus in class Any
Returns:
Negated value

plus

public Any plus()
Description copied from class: Any
Remove the sign.

Overrides:
plus in class Any
Returns:
Value, with sign removed

add

public Any add(Any other)
Description copied from class: Any
Adds two Any's together.

Overrides:
add in class Any
Returns:
Calculated value

subtract

public Any subtract(Any other)
Description copied from class: Any
Substract two Any's.

Overrides:
subtract in class Any
Returns:
Calculated value

multiply

public Any multiply(Any other)
Description copied from class: Any
Multiply two Any's. Returned type will be the same as of this instance. Will only work with integer and double.

Overrides:
multiply in class Any
Returns:
Calculated value

divide

public Any divide(Any other)
Description copied from class: Any
Divide two Any's.

Overrides:
divide in class Any
Returns:
Calculated value

modulo

public Any modulo(Any other)
Description copied from class: Any
Calculate the remainder.

Overrides:
modulo in class Any
Returns:
Calculated value

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Any
Tests for equality.

Overrides:
equals in class Any
Returns:
true if equal, false otherwise.

compare

protected int compare(Any other)
Overrides:
compare in class Any

serialize

public void serialize(Serializer serializer)
               throws java.io.IOException
Overrides:
serialize in class Any
java.io.IOException