Sha256: 541f0d02bf6844b7645b35f376fd1f120417d19496d566b34b35fa6b2b4afcf1
Contents?: true
Size: 974 Bytes
Versions: 75
Compression:
Stored size: 974 Bytes
Contents
package sh.calaba.instrumentationbackend.query.ast; public class ContainsRelation implements UIQueryASTPredicateRelation { private final boolean caseSensitive; public ContainsRelation(boolean isCaseSensitive) { super(); this.caseSensitive = isCaseSensitive; } public boolean isCaseSensitive() { return caseSensitive; } /** * Does firstValue CONTAIN secondValue? */ @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.indexOf(secondStr) != -1; } else { return false; } } }
Version data entries
75 entries across 75 versions & 2 rubygems