Class TruffleString.WithMask
java.lang.Object
com.oracle.truffle.api.strings.TruffleString.WithMask
- Enclosing class:
TruffleString
Extended parameter type for the operations
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;
}
- Since:
- 22.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNode to create a newTruffleString.WithMaskfrom a string and a byte array.static classNode to create a newTruffleString.WithMaskfrom a UTF-16 string and a char array.static classNode to create a newTruffleString.WithMaskfrom a UTF-32 string and an int array. -
Method Summary
Modifier and TypeMethodDescriptionstatic TruffleString.WithMaskcreateUncached(AbstractTruffleString a, byte[] mask, TruffleString.Encoding expectedEncoding) Shorthand for calling the uncached version ofTruffleString.WithMask.CreateNode.static TruffleString.WithMaskcreateUTF16Uncached(AbstractTruffleString a, char[] mask) Shorthand for calling the uncached version ofTruffleString.WithMask.CreateUTF16Node.static TruffleString.WithMaskcreateUTF32Uncached(AbstractTruffleString a, int[] mask) Shorthand for calling the uncached version ofTruffleString.WithMask.CreateUTF32Node.
-
Method Details
-
createUncached
public static TruffleString.WithMask createUncached(AbstractTruffleString a, byte[] mask, TruffleString.Encoding expectedEncoding) Shorthand for calling the uncached version ofTruffleString.WithMask.CreateNode.- Since:
- 22.1
-
createUTF16Uncached
Shorthand for calling the uncached version ofTruffleString.WithMask.CreateUTF16Node.- Since:
- 22.1
-
createUTF32Uncached
Shorthand for calling the uncached version ofTruffleString.WithMask.CreateUTF32Node.- Since:
- 22.1
-