@Deprecated
public final class Intern
extends java.lang.Object
Object.equals(java.lang.Object)
the object, and the client
discards the argument and uses the result instead. Since only one object exists for every set of
equal objects, space usage is reduced. Time may also be reduced, since it is possible to use
==
instead of .equals()
for comparisons.
Java builds in interning for Strings, but not for other objects. The methods in this class extend interning to all Java objects.
Modifier and Type | Method and Description |
---|---|
static java.util.Iterator<double[]> |
doubleArrays()
Deprecated.
|
static java.util.Iterator<java.lang.Double> |
doubles()
Deprecated.
|
static java.util.Iterator<int[]> |
intArrays()
Deprecated.
|
static java.util.Iterator<java.lang.Integer> |
integers()
Deprecated.
|
static double |
intern(double d)
Deprecated.
Interns a double A no-op.
|
static java.lang.Double |
intern(java.lang.Double a)
Deprecated.
Intern (canonicalize) a Double.
|
static double[] |
intern(double[] a)
Deprecated.
Intern (canonicalize) a double[].
|
static int[] |
intern(int[] a)
Deprecated.
Intern (canonicalize) an int[].
|
static java.lang.Integer |
intern(java.lang.Integer a)
Deprecated.
Intern (canonicalize) an Integer.
|
static long |
intern(long l)
Deprecated.
Interns a long.
|
static java.lang.Long |
intern(java.lang.Long a)
Deprecated.
Intern (canonicalize) a Long.
|
static long[] |
intern(long[] a)
Deprecated.
Intern (canonicalize) a long[].
|
static java.lang.Object |
intern(java.lang.Object a)
Deprecated.
Convenince method to intern an Object when we don't know its runtime type.
|
static java.lang.Object[] |
intern(java.lang.Object[] a)
Deprecated.
Intern (canonicalize) an Object[].
|
static java.lang.String |
intern(java.lang.String a)
Deprecated.
Interns a String.
|
static java.lang.String[] |
intern(java.lang.String[] a)
Deprecated.
Intern (canonicalize) an String[].
|
static java.lang.Double |
internedDouble(double d)
Deprecated.
Returns an interned Double with value i.
|
static java.lang.Double |
internedDouble(java.lang.String s)
Deprecated.
Returns an interned Double with value parsed from the string.
|
static java.lang.Integer |
internedInteger(int i)
Deprecated.
Returns an interned Integer with value i.
|
static java.lang.Integer |
internedInteger(java.lang.String s)
Deprecated.
Returns an interned Integer with value parsed from the string.
|
static java.lang.Long |
internedLong(long i)
Deprecated.
Returns an interned Long with value i.
|
static java.lang.Long |
internedLong(java.lang.String s)
Deprecated.
Returns an interned Long with value parsed from the string.
|
static java.lang.String[] |
internStrings(java.lang.String[] a)
Deprecated.
Replace each element of the array by its interned version.
|
static double[] |
internSubsequence(double[] seq,
int start,
int end)
Deprecated.
|
static int[] |
internSubsequence(int[] seq,
int start,
int end)
Deprecated.
Return an interned subsequence of seq from start (inclusive) to end (exclusive).
|
static long[] |
internSubsequence(long[] seq,
int start,
int end)
Deprecated.
|
static java.lang.Object[] |
internSubsequence(java.lang.Object[] seq,
int start,
int end)
Deprecated.
|
static java.lang.String[] |
internSubsequence(java.lang.String[] seq,
int start,
int end)
Deprecated.
|
static boolean |
isInterned(java.lang.Object value)
Deprecated.
Return true if the argument is interned (is canonical among all objects equal to itself).
|
static java.util.Iterator<long[]> |
longArrays()
Deprecated.
|
static java.util.Iterator<java.lang.Long> |
longs()
Deprecated.
|
static int |
numDoubleArrays()
Deprecated.
|
static int |
numDoubles()
Deprecated.
|
static int |
numIntArrays()
Deprecated.
|
static int |
numIntegers()
Deprecated.
|
static int |
numLongArrays()
Deprecated.
|
static int |
numLongs()
Deprecated.
|
static int |
numObjectArrays()
Deprecated.
|
static int |
numStringArrays()
Deprecated.
|
static java.util.Iterator<java.lang.Object[]> |
objectArrays()
Deprecated.
|
static java.util.Iterator<java.lang.String[]> |
stringArrays()
Deprecated.
|
public static java.lang.String[] internStrings(java.lang.String[] a)
a
- the array whose elements to intern in placeString.intern()
public static boolean isInterned(java.lang.Object value)
value
- the value to test for interningpublic static int numIntegers()
public static int numLongs()
public static int numIntArrays()
public static int numLongArrays()
public static int numDoubles()
public static int numDoubleArrays()
public static int numStringArrays()
public static int numObjectArrays()
public static java.util.Iterator<java.lang.Integer> integers()
public static java.util.Iterator<java.lang.Long> longs()
public static java.util.Iterator<int[]> intArrays()
public static java.util.Iterator<long[]> longArrays()
public static java.util.Iterator<java.lang.Double> doubles()
public static java.util.Iterator<double[]> doubleArrays()
public static java.util.Iterator<java.lang.String[]> stringArrays()
public static java.util.Iterator<java.lang.Object[]> objectArrays()
public static java.lang.String intern(java.lang.String a)
null
.a
- the string to intern; may be nullpublic static long intern(long l)
l
- the long to internpublic static double intern(double d)
d
- the double to internpublic static java.lang.Integer intern(java.lang.Integer a)
a
- an Integer to canonicalizepublic static java.lang.Integer internedInteger(int i)
i
- the value to internpublic static java.lang.Integer internedInteger(java.lang.String s)
s
- the string to parsepublic static java.lang.Long intern(java.lang.Long a)
a
- the value to internpublic static java.lang.Long internedLong(long i)
i
- the value to internpublic static java.lang.Long internedLong(java.lang.String s)
s
- the string to parsepublic static int[] intern(int[] a)
a
- the array to canonicalizepublic static long[] intern(long[] a)
a
- the array to canonicalizepublic static java.lang.Double intern(java.lang.Double a)
a
- the Double to canonicalizepublic static java.lang.Double internedDouble(double d)
d
- the value to internpublic static java.lang.Double internedDouble(java.lang.String s)
s
- the string to parsepublic static double[] intern(double[] a)
a
- the array to canonicalizepublic static java.lang.String[] intern(java.lang.String[] a)
a
- the array to canonicalize. Its elements should already be interned.public static java.lang.Object[] intern(java.lang.Object[] a)
a
- the array to canonicalizepublic static java.lang.Object intern(java.lang.Object a)
a
- an Object to canonicalizepublic static int[] internSubsequence(int[] seq, int start, int end)
The result is the same as computing the subsequence and then interning it, but this method is more efficient: if the subsequence is already interned, it avoids computing the subsequence.
For example, since derived variables in Daikon compute the subsequence many times, this shortcut saves quite a bit of computation. It saves even more when there may be many derived variables that are non-canonical, since they are guaranteed to be ==.
seq
- the interned sequence whose subsequence should be computed and internedstart
- the index of the start of the subsequence to compute and internend
- the index of the end of the subsequence to compute and internpublic static long[] internSubsequence(long[] seq, int start, int end)
seq
- the interned sequence whose subsequence should be computed and internedstart
- the index of the start of the subsequence to compute and internend
- the index of the end of the subsequence to compute and interninternSubsequence(int[], int, int)
public static double[] internSubsequence(double[] seq, int start, int end)
seq
- the interned sequence whose subsequence should be computed and internedstart
- the index of the start of the subsequence to compute and internend
- the index of the end of the subsequence to compute and interninternSubsequence(int[], int, int)
public static java.lang.Object[] internSubsequence(java.lang.Object[] seq, int start, int end)
seq
- the interned sequence whose subsequence should be computed and internedstart
- the index of the start of the subsequence to compute and internend
- the index of the end of the subsequence to compute and interninternSubsequence(int[], int, int)
public static java.lang.String[] internSubsequence(java.lang.String[] seq, int start, int end)
seq
- the interned sequence whose subsequence should be computed and internedstart
- the index of the start of the subsequence to compute and internend
- the index of the end of the subsequence to compute and interninternSubsequence(int[], int, int)