本文整理了Java中org.apache.calcite.util.Util.startsWith()
方法的一些代码示例,展示了Util.startsWith()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.startsWith()
方法的具体详情如下:
包路径:org.apache.calcite.util.Util
类名称:Util
方法名:startsWith
[英]Returns whether one list is a prefix of another.
[中]返回一个列表是否是另一个列表的前缀。
代码示例来源:origin: Qihoo360/Quicksql
public boolean satisfies(RelTrait trait) {
return this == trait
|| trait instanceof RelCollationImpl
&& Util.startsWith(fieldCollations,
((RelCollationImpl) trait).fieldCollations);
}
代码示例来源:origin: org.apache.calcite/calcite-core
public boolean satisfies(RelTrait trait) {
return this == trait
|| trait instanceof RelCollationImpl
&& Util.startsWith(fieldCollations,
((RelCollationImpl) trait).fieldCollations);
}
代码示例来源:origin: Qihoo360/Quicksql
@Override protected void matched(List<String> prefixNames,
List<String> names) {
matchedNames = ImmutableList.copyOf(
Util.startsWith(names, prefixNames)
? Util.skip(names, prefixNames.size())
: names);
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Override protected void matched(List<String> prefixNames,
List<String> names) {
matchedNames = ImmutableList.copyOf(
Util.startsWith(names, prefixNames)
? Util.skip(names, prefixNames.size())
: names);
}
代码示例来源:origin: Qihoo360/Quicksql
public boolean satisfies(RelTrait trait) {
if (trait == this || trait == ANY) {
return true;
}
if (trait instanceof RelDistributionImpl) {
RelDistributionImpl distribution = (RelDistributionImpl) trait;
if (type == distribution.type) {
switch (type) {
case HASH_DISTRIBUTED:
// The "leading edge" property of Range does not apply to Hash.
// Only Hash[x, y] satisfies Hash[x, y].
return keys.equals(distribution.keys);
case RANGE_DISTRIBUTED:
// Range[x, y] satisfies Range[x, y, z] but not Range[x]
return Util.startsWith(distribution.keys, keys);
default:
return true;
}
}
}
if (trait == RANDOM_DISTRIBUTED) {
// RANDOM is satisfied by HASH, ROUND-ROBIN, RANDOM, RANGE;
// we've already checked RANDOM
return type == Type.HASH_DISTRIBUTED
|| type == Type.ROUND_ROBIN_DISTRIBUTED
|| type == Type.RANGE_DISTRIBUTED;
}
return false;
}
代码示例来源:origin: org.apache.calcite/calcite-core
public boolean satisfies(RelTrait trait) {
if (trait == this || trait == ANY) {
return true;
}
if (trait instanceof RelDistributionImpl) {
RelDistributionImpl distribution = (RelDistributionImpl) trait;
if (type == distribution.type) {
switch (type) {
case HASH_DISTRIBUTED:
// The "leading edge" property of Range does not apply to Hash.
// Only Hash[x, y] satisfies Hash[x, y].
return keys.equals(distribution.keys);
case RANGE_DISTRIBUTED:
// Range[x, y] satisfies Range[x, y, z] but not Range[x]
return Util.startsWith(distribution.keys, keys);
default:
return true;
}
}
}
if (trait == RANDOM_DISTRIBUTED) {
// RANDOM is satisfied by HASH, ROUND-ROBIN, RANDOM, RANGE;
// we've already checked RANDOM
return type == Type.HASH_DISTRIBUTED
|| type == Type.ROUND_ROBIN_DISTRIBUTED
|| type == Type.RANGE_DISTRIBUTED;
}
return false;
}
代码示例来源:origin: Qihoo360/Quicksql
/** Unit test for {@link Util#startsWith}. */
@Test public void testStartsWithList() {
assertThat(Util.startsWith(list("x"), list()), is(true));
assertThat(Util.startsWith(list("x"), list("x")), is(true));
assertThat(Util.startsWith(list("x"), list("y")), is(false));
assertThat(Util.startsWith(list("x"), list("x", "y")), is(false));
assertThat(Util.startsWith(list("x", "y"), list("x")), is(true));
assertThat(Util.startsWith(list(), list()), is(true));
assertThat(Util.startsWith(list(), list("x")), is(false));
}
代码示例来源:origin: org.apache.calcite/calcite-core
/** Unit test for {@link Util#startsWith}. */
@Test public void testStartsWithList() {
assertThat(Util.startsWith(list("x"), list()), is(true));
assertThat(Util.startsWith(list("x"), list("x")), is(true));
assertThat(Util.startsWith(list("x"), list("y")), is(false));
assertThat(Util.startsWith(list("x"), list("x", "y")), is(false));
assertThat(Util.startsWith(list("x", "y"), list("x")), is(true));
assertThat(Util.startsWith(list(), list()), is(true));
assertThat(Util.startsWith(list(), list("x")), is(false));
}
内容来源于网络,如有侵权,请联系作者删除!