Java Code Examples for com.google.common.math.IntMath#pow()

The following examples show how to use com.google.common.math.IntMath#pow() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Aggregate.java    From Quicksql with MIT License 6 votes vote down vote up
public static Group induce(ImmutableBitSet groupSet,
    List<ImmutableBitSet> groupSets) {
  if (!ImmutableBitSet.ORDERING.isStrictlyOrdered(groupSets)) {
    throw new IllegalArgumentException("must be sorted: " + groupSets);
  }
  if (groupSets.size() == 1 && groupSets.get(0).equals(groupSet)) {
    return SIMPLE;
  }
  if (groupSets.size() == IntMath.pow(2, groupSet.cardinality())) {
    return CUBE;
  }
  if (isRollup(groupSet, groupSets)) {
    return ROLLUP;
  }
  return OTHER;
}
 
Example 2
Source File: Aggregate.java    From calcite with Apache License 2.0 6 votes vote down vote up
public static Group induce(ImmutableBitSet groupSet,
    List<ImmutableBitSet> groupSets) {
  if (!ImmutableBitSet.ORDERING.isStrictlyOrdered(groupSets)) {
    throw new IllegalArgumentException("must be sorted: " + groupSets);
  }
  if (groupSets.size() == 1 && groupSets.get(0).equals(groupSet)) {
    return SIMPLE;
  }
  if (groupSets.size() == IntMath.pow(2, groupSet.cardinality())) {
    return CUBE;
  }
  if (isRollup(groupSet, groupSets)) {
    return ROLLUP;
  }
  return OTHER;
}
 
Example 3
Source File: UcteRecordWriter.java    From powsybl-core with Mozilla Public License 2.0 4 votes vote down vote up
private int maxLimitInt(int numberOfChars) {
    return IntMath.pow(10, numberOfChars);
}
 
Example 4
Source File: UcteRecordWriter.java    From powsybl-core with Mozilla Public License 2.0 4 votes vote down vote up
private int minLimitInt(int numberOfChars) {
    return -IntMath.pow(10, numberOfChars - 1);
}
 
Example 5
Source File: GuavaIntMathUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
public void whenPowTwoIntegerValues_shouldPowThemAndReturnTheResult() {
    int result = IntMath.pow(6, 4);
    assertEquals(1296, result);
}
 
Example 6
Source File: MathUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 平方
 * 
 * @param k 平方次数, 不能为负数, k=0时返回1.
 */
public static int pow(int b, int k) {
	return IntMath.pow(b, k);
}
 
Example 7
Source File: MathUtil.java    From vjtools with Apache License 2.0 2 votes vote down vote up
/**
 * 平方
 * 
 * @param k 平方次数, 不能为负数, k=0时返回1.
 */
public static int pow(int b, int k) {
	return IntMath.pow(b, k);
}
 
Example 8
Source File: MathUtil.java    From j360-dubbo-app-all with Apache License 2.0 2 votes vote down vote up
/**
 * 平方
 * 
 * @param k 平方次数,不能为负数, k=0时返回1.
 */
public static int pow(int b, int k) {
	return IntMath.pow(b, k);
}