示例#1
0
 @Override
 public int hashCode() {
   int result = 1;
   result = 31 * result + (values != null ? Lng.hashCode(0, end, values) : 0);
   result = 31 * result + end;
   return result;
 }
示例#2
0
 /**
  * Add a new value to the list but don't employ a wrapper.
  *
  * @param integer new value
  * @return was able to add.
  */
 public boolean addLong(long integer) {
   if (end + 1 >= values.length) {
     values = Lng.grow(values);
   }
   values[end] = integer;
   end++;
   return true;
 }
示例#3
0
  /**
   * Add a new array to the list.
   *
   * @param newValues new values
   * @return was able to add.
   */
  public boolean addArray(long... newValues) {
    if (end + newValues.length >= values.length) {
      values = Lng.grow(values, (values.length + newValues.length) * 2);
    }

    System.arraycopy(newValues, 0, values, end, newValues.length);
    end += newValues.length;
    return true;
  }
示例#4
0
 /**
  * Add a new value to the list but don't employ a wrapper.
  *
  * @param integer new value
  * @return was able to add.
  */
 @SuppressWarnings("UnusedReturnValue")
 public StatList add(int integer) {
   if (end + 1 >= values.length) {
     values = Lng.grow(values);
   }
   values[end] = integer;
   end++;
   return this;
 }
示例#5
0
  @SuppressWarnings("SimplifiableIfStatement")
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    StatList integers = (StatList) o;

    //noinspection SimplifiableIfStatement
    if (end != integers.end) return false;
    return Lng.equals(0, end, values, integers.values);
  }
示例#6
0
 /**
  * median
  *
  * @return median
  */
 public long median() {
   return Lng.median(values, end);
 }
示例#7
0
 /**
  * min
  *
  * @return min
  */
 public long min() {
   return Lng.min(values, end);
 }
示例#8
0
 /**
  * max
  *
  * @return max
  */
 public long max() {
   return Lng.max(values, end);
 }
示例#9
0
 /**
  * @param reduceBy reduceBy function
  * @return the reduction
  */
 public long reduceBy(Lng.ReduceBy reduceBy) {
   return Lng.reduceBy(values, end, reduceBy);
 }
示例#10
0
 /**
  * This would be a good opportunity to reintroduce dynamic invoke
  *
  * @param function function
  * @param name name
  * @return result
  */
 public long reduceBy(Object function, String name) {
   return Lng.reduceBy(values, end, function, name);
 }
示例#11
0
 /**
  * This would be a good opportunity to reintroduce dynamic invoke
  *
  * @param function function
  * @return array
  */
 public long reduceBy(Object function) {
   return Lng.reduceBy(values, end, function);
 }
示例#12
0
  /**
   * Sums the values with bounds checking.
   *
   * @return sum
   */
  public long sum() {

    return Lng.sum(values, end);
  }