Top Fields Constructors Methods
org.antlr.misc

public Class Utils

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final int
pack-priv static Integer[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Integer
integer(int x)

Integer objects are immutable so share all Integers with the same value up to some max size.

public static String
replace(String src, String replacee, String replacer)

Given a source string, src, a string to replace, replacee, and a string to replace with, replacer, return a new string w/ the replacing done.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INTEGER_POOL_MAX_VALUEback to summary
public static final int INTEGER_POOL_MAX_VALUE
intsback to summary
pack-priv static Integer[] ints

Constructor Detail

Utilsback to summary
public Utils()

Method Detail

integerback to summary
public static Integer integer(int x)

Integer objects are immutable so share all Integers with the same value up to some max size. Use an array as a perfect hash. Return shared object for 0..INTEGER_POOL_MAX_VALUE or a new Integer object with x in it.

replaceback to summary
public static String replace(String src, String replacee, String replacer)

Given a source string, src, a string to replace, replacee, and a string to replace with, replacer, return a new string w/ the replacing done. You can use replacer==null to remove replacee from the string. This should be faster than Java's String.replaceAll as that one uses regex (I only want to play with strings anyway).