Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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;
  }
Beispiel #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;
 }
Beispiel #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);
  }
Beispiel #6
0
 /**
  * median
  *
  * @return median
  */
 public long median() {
   return Lng.median(values, end);
 }
Beispiel #7
0
 /**
  * min
  *
  * @return min
  */
 public long min() {
   return Lng.min(values, end);
 }
Beispiel #8
0
 /**
  * max
  *
  * @return max
  */
 public long max() {
   return Lng.max(values, end);
 }
Beispiel #9
0
 /**
  * @param reduceBy reduceBy function
  * @return the reduction
  */
 public long reduceBy(Lng.ReduceBy reduceBy) {
   return Lng.reduceBy(values, end, reduceBy);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #12
0
  /**
   * Sums the values with bounds checking.
   *
   * @return sum
   */
  public long sum() {

    return Lng.sum(values, end);
  }