public static final class TruffleString.WithMask extends Object
TruffleString.ByteIndexOfStringNode,
TruffleString.LastByteIndexOfStringNode and TruffleString.RegionEqualByteIndexNode. These operations can
optionally perform a logical OR operation when matching their string parameters against each
other, in the following way:
Given a parameter TruffleString a and TruffleString.WithMask b, region
equality will be checked as shown in this exemplary method:
boolean regionEquals(TruffleString a, int fromIndexA, TruffleString.WithMask b, int fromIndexB) {
for (int i = 0; i < length; i++) {
if ((readRaw(a, fromIndexA + i) | readRaw(b.mask, i)) != readRaw(b.string, fromIndexB + i)) {
return false;
}
}
return true;
}
| Modifier and Type | Class and Description |
|---|---|
static class |
TruffleString.WithMask.CreateNode
Node to create a new
TruffleString.WithMask from a string and a byte array. |
static class |
TruffleString.WithMask.CreateUTF16Node
Node to create a new
TruffleString.WithMask from a UTF-16 string and a char array. |
static class |
TruffleString.WithMask.CreateUTF32Node
Node to create a new
TruffleString.WithMask from a UTF-32 string and an int array. |
| Modifier and Type | Method and Description |
|---|---|
static TruffleString.WithMask |
createUncached(AbstractTruffleString a,
byte[] mask,
TruffleString.Encoding expectedEncoding)
Shorthand for calling the uncached version of
TruffleString.WithMask.CreateNode. |
static TruffleString.WithMask |
createUTF16Uncached(AbstractTruffleString a,
char[] mask)
Shorthand for calling the uncached version of
TruffleString.WithMask.CreateUTF16Node. |
static TruffleString.WithMask |
createUTF32Uncached(AbstractTruffleString a,
int[] mask)
Shorthand for calling the uncached version of
TruffleString.WithMask.CreateUTF32Node. |
public static TruffleString.WithMask createUncached(AbstractTruffleString a, byte[] mask, TruffleString.Encoding expectedEncoding)
TruffleString.WithMask.CreateNode.public static TruffleString.WithMask createUTF16Uncached(AbstractTruffleString a, char[] mask)
TruffleString.WithMask.CreateUTF16Node.public static TruffleString.WithMask createUTF32Uncached(AbstractTruffleString a, int[] mask)
TruffleString.WithMask.CreateUTF32Node.