Klasse SafeFraction

java.lang.Object
io.jenkins.plugins.coverage.model.SafeFraction

public class SafeFraction extends Object
A small wrapper for Fraction instances that avoids an arithmetic overflow by using double based operations in case of an exception.
Autor:
Ullrich Hafner
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    SafeFraction(org.apache.commons.lang3.math.Fraction fraction)
    Creates a new fraction instance that wraps the specified fraction with safe operations.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    org.apache.commons.lang3.math.Fraction
    add(org.apache.commons.lang3.math.Fraction summand)
    Adds the value of another fraction to the value of this one, returning the result in reduced form.
    org.apache.commons.lang3.math.Fraction
    multiplyBy(org.apache.commons.lang3.math.Fraction multiplicator)
    Multiplies the value of this fraction by another, returning the result in reduced form.
    org.apache.commons.lang3.math.Fraction
    subtract(org.apache.commons.lang3.math.Fraction subtrahend)
    Subtracts the value of another fraction from the value of this one, returning the result in reduced form.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Konstruktordetails

    • SafeFraction

      public SafeFraction(org.apache.commons.lang3.math.Fraction fraction)
      Creates a new fraction instance that wraps the specified fraction with safe operations.
      Parameter:
      fraction - the fraction to wrap
  • Methodendetails

    • multiplyBy

      public org.apache.commons.lang3.math.Fraction multiplyBy(org.apache.commons.lang3.math.Fraction multiplicator)
      Multiplies the value of this fraction by another, returning the result in reduced form. Since there might be an arithmetic exception due to an overflow, this method will handle this situation by calculating the multiplication based on the double values of the fractions.
      Parameter:
      multiplicator - the fraction to multiply by
      Gibt zurück:
      a Fraction instance with the resulting values
    • subtract

      public org.apache.commons.lang3.math.Fraction subtract(org.apache.commons.lang3.math.Fraction subtrahend)
      Subtracts the value of another fraction from the value of this one, returning the result in reduced form. Since there might be an arithmetic exception due to an overflow, this method will handle this situation by calculating the subtraction based on the double values of the fractions.
      Parameter:
      subtrahend - the fraction to subtract
      Gibt zurück:
      a Fraction instance with the resulting values
    • add

      public org.apache.commons.lang3.math.Fraction add(org.apache.commons.lang3.math.Fraction summand)
      Adds the value of another fraction to the value of this one, returning the result in reduced form. Since there might be an arithmetic exception due to an overflow, this method will handle this situation by calculating the addition based on the double values of the fractions.
      Parameter:
      summand - the fraction to add
      Gibt zurück:
      a Fraction instance with the resulting values