anvil.core
Class AnyString

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

public class AnyString
extends AnySequence

class AnyString

Author:
Jani Lehtimäki

Field Summary
static NativeClass _class
           
protected  double _double
           
protected  int _hashcode
           
protected  long _long
           
protected  java.lang.String _string
           
protected  int _type
           
static java.lang.Object[] newInstance
           
static java.lang.Object[] p_charAt
           
static java.lang.Object[] p_charCodeAt
           
static java.lang.Object[] p_chop
           
static java.lang.Object[] p_compareToIgnoreCase
           
static java.lang.Object[] p_contains
           
static java.lang.Object[] p_divide
           
static java.lang.Object[] p_eat
           
static java.lang.Object[] p_endsWith
           
static java.lang.Object[] p_equalsIgnoreCase
           
static java.lang.Object[] p_explode
           
static java.lang.Object[] p_find
           
static java.lang.Object[] p_indexOf
           
static java.lang.Object[] p_lastIndexOf
           
static java.lang.Object[] p_matches
           
static java.lang.Object[] p_pad
           
static java.lang.Object[] p_repeat
           
static java.lang.Object[] p_replace
           
static java.lang.Object[] p_split
           
static java.lang.Object[] p_startsWith
           
static java.lang.Object[] p_substitute
           
static java.lang.Object[] p_substituteFirst
           
static java.lang.Object[] p_substring
           
static java.lang.Object[] p_translate
           
static java.lang.Object[] p_unescape
           
 
Fields inherited from class anvil.core.AnySequence
p_append, p_concat, p_count, p_crop, p_cut, p_fill, p_first, p_get, p_grep, p_insert, p_join, p_last, p_pop, p_push, p_resize, p_reverse, p_search, p_set, p_slice, p_sort, p_swap, p_unshift
 
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
 
Constructor Summary
AnyString(boolean bool)
           
AnyString(double dbl)
           
AnyString(int integer)
           
AnyString(java.lang.String string)
           
 
Method Summary
 Any add(Any other)
          Adds two Any's together.
 AnySequence append(Any element)
           
 AnySequence append(AnySequence sequence)
           
 ClassType classOf()
          Returns the type of this Any.
 AnySequence clear()
           
 Any coerce()
           
protected  int compare(Any other)
           
 int compareAt(Any element, int start)
           
 int compareAt(AnySequence sequence, int start, int length)
           
 AnySequence createEmptySequence()
           
 AnySequence createSequence(Any element)
           
 AnySequence crop(int start, int length)
           
 Any decrease()
          Decrease the value by one.
 AnySequence deleteSlice(int start, int length)
           
 boolean equals(java.lang.Object obj)
          Tests for equality.
 AnySequence fill(Any fill, int start, int length)
           
 Any getElement(int index)
           
 int getSize()
           
 AnySequence getSlice(int start, int length)
           
 int hashCode()
           
 Any increase()
          Increase the value by one.
 boolean isCompatible(Any element)
           
 boolean isMutable()
           
 boolean isString()
          Checks if this any is string.
 BindingIterator iterator()
           
 Any m_capitalize()
           
 Any m_capitalizeFirst()
           
 Any m_charAt(int index)
           
 Any m_charCodeAt(int index)
           
 Any m_chop(java.lang.String suffix)
           
 Any m_compareToIgnoreCase(java.lang.String str)
           
 Any m_compress()
           
 Any m_contains(Context context, Any pattern, Any matches)
           
 Any m_decode()
           
 Any m_decodeURL()
           
 Any m_divide(java.lang.String delim, Any dir)
           
 Any m_eat(java.lang.String prefix)
           
 Any m_encode()
           
 Any m_encodeURL()
           
 Any m_endsWith(java.lang.String suffix)
           
 Any m_equalsIgnoreCase(java.lang.String str)
           
 Any m_escape()
           
 Any m_explode(java.lang.String delimiters, boolean returnEmpty)
           
 Any m_find(Context context, Any pattern_)
           
 Any m_hexToBinary()
           
 Any m_indexOf(java.lang.String needle, int fromIndex)
           
 Any m_lastIndexOf(java.lang.String needle, Any fromIndex)
           
 Any m_length()
          Exposed methods
 Any m_matches(Context context, Any pattern, Any matches)
           
 Any m_nl2br()
           
 Any m_nowrap()
           
 Any m_pad(int length, java.lang.String pad)
           
 Any m_quote()
           
 Any m_quoteMeta()
           
 Any m_quoteText()
           
 Any m_repeat(int count)
           
 Any m_replace(java.lang.String from, java.lang.String to)
           
 Any m_split(Context context, Any pattern_)
           
 Any m_startsWith(java.lang.String prefix)
           
 Any m_substitute(Context context, Any pattern_, Any substitution, Any limit_)
           
 Any m_substituteFirst(Context context, Any pattern_, Any substitution)
           
 Any m_substring(int start, Any end_)
           
 Any m_toLower()
           
 Any m_toUpper()
           
 Any m_translate(java.lang.String from, java.lang.String to)
           
 Any m_trim()
           
 Any m_trimLeft()
           
 Any m_trimRight()
           
 Any m_unescape(boolean hasQuotes)
           
 Any m_unquote()
           
 Any m_unserialize(Context context)
           
 Any minus()
          Negate the sign.
static Any newInstance(Any value)
           
 Any plus()
          Remove the sign.
 AnySequence resize(int size)
           
 AnySequence reverse()
           
 int search(Any element, java.util.Comparator comparator)
           
 void serialize(Serializer serializer)
           
 AnySequence setElement(int index, Any element)
           
 AnySequence setSlice(int start, int length, Any element)
           
 AnySequence setSlice(int start, int length, AnySequence sequence)
           
 int sizeOf()
          Returns the logical size of this any.
 AnySequence sort(int start, int length, java.util.Comparator comparator)
           
 AnySequence swap(int index1, int index2)
           
 java.io.Writer toAnvil(java.io.Writer writer)
           
 Any toAnyString()
          Converts contained value into AnyString.
 byte[] toBinary()
          Gets the contained value as byte[].
 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.AnySequence
compareTo, contains, deleteReference, equalsTo, getAttribute, getReference, getReference, indexOf, isSequence, lastIndexOf, m_append, m_clear, m_concat, m_count, m_crop, m_cut, m_endsWith, m_fill, m_first, m_get, m_grep, m_indexOf, m_insert, m_join, m_last, m_lastIndexOf, m_minmax, m_pop, m_push, m_resize, m_reverse, m_search, m_set, m_shift, m_slice, m_sort, m_startsWith, m_swap, m_unshift, reverse, setReference, setReference
 
Methods inherited from class anvil.core.Any
_clone, _copy, _invoke, _invoke, _invoke, _invoke, _invoke, _invoke, _serialize, _unserialize, _wakeup, classNameOf, clone, compareTo, concat, copy, create, create, create, create, create, create, create, create, create, create, create, create, create, create, deleteAttribute, divide, execute, execute, execute, execute, execute, execute, getRef, has, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, isArray, isBinary, isBoolean, isBuffer, isDefined, isDouble, isInstanceOf, isInt, isIterator, isList, isMap, isNull, isPattern, isRange, isRef, isTuple, isUndefined, m_clone, m_compareTo, m_copy, m_each, m_equals, m_hashCode, m_pipe, m_select, m_toBoolean, m_toString, modulo, multiply, not, setAttribute, setRef, subtract, toAnvil, toAnyBoolean, toAnyDouble, toAnyInt, toArray, 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

_string

protected java.lang.String _string

_hashcode

protected int _hashcode

_type

protected int _type

_long

protected long _long

_double

protected double _double

p_unescape

public static final java.lang.Object[] p_unescape

p_substring

public static final java.lang.Object[] p_substring

p_charAt

public static final java.lang.Object[] p_charAt

p_charCodeAt

public static final java.lang.Object[] p_charCodeAt

p_indexOf

public static final java.lang.Object[] p_indexOf

p_lastIndexOf

public static final java.lang.Object[] p_lastIndexOf

p_startsWith

public static final java.lang.Object[] p_startsWith

p_endsWith

public static final java.lang.Object[] p_endsWith

p_compareToIgnoreCase

public static final java.lang.Object[] p_compareToIgnoreCase

p_equalsIgnoreCase

public static final java.lang.Object[] p_equalsIgnoreCase

p_explode

public static final java.lang.Object[] p_explode

p_repeat

public static final java.lang.Object[] p_repeat

p_translate

public static final java.lang.Object[] p_translate

p_replace

public static final java.lang.Object[] p_replace

p_matches

public static final java.lang.Object[] p_matches

p_contains

public static final java.lang.Object[] p_contains

p_find

public static final java.lang.Object[] p_find

p_split

public static final java.lang.Object[] p_split

p_divide

public static final java.lang.Object[] p_divide

p_substitute

public static final java.lang.Object[] p_substitute

p_substituteFirst

public static final java.lang.Object[] p_substituteFirst

p_pad

public static final java.lang.Object[] p_pad

p_chop

public static final java.lang.Object[] p_chop

p_eat

public static final java.lang.Object[] p_eat

_class

public static final transient NativeClass _class
Constructor Detail

AnyString

public AnyString(boolean bool)

AnyString

public AnyString(int integer)

AnyString

public AnyString(double dbl)

AnyString

public AnyString(java.lang.String string)
Method Detail

newInstance

public static final Any newInstance(Any value)

isCompatible

public boolean isCompatible(Any element)
Specified by:
isCompatible in class AnySequence

getSize

public int getSize()
Specified by:
getSize in class AnySequence

resize

public AnySequence resize(int size)
Specified by:
resize in class AnySequence

clear

public AnySequence clear()
Specified by:
clear in class AnySequence

getElement

public Any getElement(int index)
Specified by:
getElement in class AnySequence

setElement

public AnySequence setElement(int index,
                              Any element)
Specified by:
setElement in class AnySequence

crop

public AnySequence crop(int start,
                        int length)
Specified by:
crop in class AnySequence

getSlice

public AnySequence getSlice(int start,
                            int length)
Specified by:
getSlice in class AnySequence

deleteSlice

public AnySequence deleteSlice(int start,
                               int length)
Specified by:
deleteSlice in class AnySequence

setSlice

public AnySequence setSlice(int start,
                            int length,
                            Any element)
Specified by:
setSlice in class AnySequence

setSlice

public AnySequence setSlice(int start,
                            int length,
                            AnySequence sequence)
Specified by:
setSlice in class AnySequence

append

public AnySequence append(AnySequence sequence)
Specified by:
append in class AnySequence

append

public AnySequence append(Any element)
Specified by:
append in class AnySequence

createSequence

public AnySequence createSequence(Any element)
Specified by:
createSequence in class AnySequence

createEmptySequence

public AnySequence createEmptySequence()
Specified by:
createEmptySequence in class AnySequence

compareAt

public int compareAt(AnySequence sequence,
                     int start,
                     int length)
Specified by:
compareAt in class AnySequence

compareAt

public int compareAt(Any element,
                     int start)
Specified by:
compareAt in class AnySequence

fill

public AnySequence fill(Any fill,
                        int start,
                        int length)
Specified by:
fill in class AnySequence

sort

public AnySequence sort(int start,
                        int length,
                        java.util.Comparator comparator)
Specified by:
sort in class AnySequence

search

public int search(Any element,
                  java.util.Comparator comparator)
Specified by:
search in class AnySequence

swap

public AnySequence swap(int index1,
                        int index2)
Specified by:
swap in class AnySequence

reverse

public AnySequence reverse()

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.

sizeOf

public int sizeOf()
Description copied from class: Any
Returns the logical size of this any.

Overrides:
sizeOf in class AnySequence
Returns:
Logical size

isMutable

public boolean isMutable()
Overrides:
isMutable in class AnySequence

isString

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

Overrides:
isString in class Any
Returns:
true if this is string

classOf

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

Overrides:
classOf in class AnySequence

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 AnySequence
Returns:
Value as boolean or false if it can't be transformed.

coerce

public Any coerce()
Overrides:
coerce in class Any

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.

toBinary

public byte[] toBinary()
Description copied from class: Any
Gets the contained value as byte[].

Overrides:
toBinary in class Any
Returns:
Value as byte[] or null if this instance isn't AnyBinary.

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.

toAnyString

public Any toAnyString()
Description copied from class: Any
Converts contained value into AnyString.

Overrides:
toAnyString in class Any
Returns:
Value as AnyString.

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 AnySequence
Returns:
Calculated value

equals

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

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

compare

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

serialize

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

iterator

public BindingIterator iterator()
Overrides:
iterator in class AnySequence

m_length

public Any m_length()
Exposed methods

Overrides:
m_length in class AnySequence

m_unquote

public Any m_unquote()

m_quote

public Any m_quote()

m_quoteMeta

public Any m_quoteMeta()

m_quoteText

public Any m_quoteText()

m_compress

public Any m_compress()

m_capitalize

public Any m_capitalize()

m_capitalizeFirst

public Any m_capitalizeFirst()

m_nowrap

public Any m_nowrap()

m_encodeURL

public Any m_encodeURL()

m_decodeURL

public Any m_decodeURL()

m_encode

public Any m_encode()

m_decode

public Any m_decode()

m_escape

public Any m_escape()

m_unescape

public Any m_unescape(boolean hasQuotes)

m_nl2br

public Any m_nl2br()

m_toUpper

public Any m_toUpper()

m_toLower

public Any m_toLower()

m_trim

public Any m_trim()

m_trimLeft

public Any m_trimLeft()

m_trimRight

public Any m_trimRight()

m_substring

public Any m_substring(int start,
                       Any end_)

m_charAt

public Any m_charAt(int index)

m_charCodeAt

public Any m_charCodeAt(int index)

m_indexOf

public Any m_indexOf(java.lang.String needle,
                     int fromIndex)

m_lastIndexOf

public Any m_lastIndexOf(java.lang.String needle,
                         Any fromIndex)

m_startsWith

public Any m_startsWith(java.lang.String prefix)

m_endsWith

public Any m_endsWith(java.lang.String suffix)

m_compareToIgnoreCase

public Any m_compareToIgnoreCase(java.lang.String str)

m_equalsIgnoreCase

public Any m_equalsIgnoreCase(java.lang.String str)

m_explode

public Any m_explode(java.lang.String delimiters,
                     boolean returnEmpty)

m_repeat

public Any m_repeat(int count)
Overrides:
m_repeat in class AnySequence

m_translate

public Any m_translate(java.lang.String from,
                       java.lang.String to)

m_replace

public Any m_replace(java.lang.String from,
                     java.lang.String to)

m_unserialize

public Any m_unserialize(Context context)

m_matches

public Any m_matches(Context context,
                     Any pattern,
                     Any matches)

m_contains

public Any m_contains(Context context,
                      Any pattern,
                      Any matches)

m_find

public Any m_find(Context context,
                  Any pattern_)

m_split

public Any m_split(Context context,
                   Any pattern_)

m_divide

public Any m_divide(java.lang.String delim,
                    Any dir)

m_substitute

public Any m_substitute(Context context,
                        Any pattern_,
                        Any substitution,
                        Any limit_)

m_substituteFirst

public Any m_substituteFirst(Context context,
                             Any pattern_,
                             Any substitution)

m_hexToBinary

public Any m_hexToBinary()

m_pad

public Any m_pad(int length,
                 java.lang.String pad)

m_chop

public Any m_chop(java.lang.String suffix)

m_eat

public Any m_eat(java.lang.String prefix)