Coverage Report - org.apache.giraph.types.ops.NumericTypeOps
 
Classes in this File Line Coverage Branch Coverage Complexity
NumericTypeOps
N/A
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.giraph.types.ops;
 19  
 
 20  
 /**
 21  
  * Numeric type operations, allowing working generically with types,
 22  
  * but still having efficient code.
 23  
  *
 24  
  * Using any of the provided operations should lead to no boxing/unboxing.
 25  
  *
 26  
  * @param <T> Type
 27  
  */
 28  
 public interface NumericTypeOps<T> extends TypeOps<T> {
 29  
   /**
 30  
    * Value of zero
 31  
    * @return New object with value of zero
 32  
    */
 33  
   T createZero();
 34  
   /**
 35  
    * Value of one
 36  
    * @return New object with value of one
 37  
    */
 38  
   T createOne();
 39  
 
 40  
   /**
 41  
    * Minimal negative value representable via current type.
 42  
    * Negative infinity for floating point numbers.
 43  
    * @return New object with min negative value
 44  
    */
 45  
   T createMinNegativeValue();
 46  
   /**
 47  
    * Maximal positive value representable via current type.
 48  
    * Positive infinity for floating point numbers.
 49  
    * @return New object with max positive value
 50  
    */
 51  
   T createMaxPositiveValue();
 52  
 
 53  
 
 54  
   /**
 55  
    * value+=adder
 56  
    *
 57  
    * @param value Value to modify
 58  
    * @param increment Increment
 59  
    */
 60  
   void plusInto(T value, T increment);
 61  
   /**
 62  
    * value*=multiplier
 63  
    *
 64  
    * @param value Value to modify
 65  
    * @param multiplier Multiplier
 66  
    */
 67  
   void multiplyInto(T value, T multiplier);
 68  
 
 69  
   /**
 70  
    * -value
 71  
    * @param value Value to negate
 72  
    */
 73  
   void negate(T value);
 74  
 
 75  
   /**
 76  
    * Compare two values
 77  
    *
 78  
    * @param value1 First value
 79  
    * @param value2 Second value
 80  
    * @return 0 if values are equal, negative value if value1&lt;value2 and
 81  
    *         positive value if value1&gt;value2
 82  
    */
 83  
   int compare(T value1, T value2);
 84  
 }