Sha256: 24907cd674b1236f0dce2818fefcaea31a36eb09f81a08dd334114d952190b6a
Contents?: true
Size: 1.03 KB
Versions: 75
Compression:
Stored size: 1.03 KB
Contents
package sh.calaba.instrumentationbackend.query.ast; import android.annotation.SuppressLint; public class BeginsWithRelation implements UIQueryASTPredicateRelation { private final boolean caseSensitive; public BeginsWithRelation(boolean isCaseSensitive) { super(); this.caseSensitive = isCaseSensitive; } public boolean isCaseSensitive() { return caseSensitive; } /** * Does firstValue BEGIN WITH secondValue? */ @SuppressLint("DefaultLocale") @Override public boolean areRelated(Object firstValue, Object secondValue) { if (firstValue == secondValue) { return true; } if (firstValue == null || secondValue == null) { return false; } if (firstValue instanceof CharSequence && secondValue instanceof CharSequence) { String firstStr = firstValue.toString(); String secondStr = secondValue.toString(); if (!isCaseSensitive()) { firstStr = firstStr.toLowerCase(); secondStr = secondStr.toLowerCase(); } return firstStr.startsWith(secondStr); } else { return false; } } }
Version data entries
75 entries across 75 versions & 2 rubygems