Class TruffleString.WithMask

java.lang.Object
com.oracle.truffle.api.strings.TruffleString.WithMask
Enclosing class:
TruffleString

public static final class TruffleString.WithMask extends Object
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: