Class Percent

java.lang.Object
io.github.srcimon.screwbox.core.Percent
All Implemented Interfaces:
Serializable

public class Percent extends Object implements Serializable
See Also:
  • Method Details

    • of

      public static Percent of(double value)
    • quater

      public static Percent quater()
      Returns 25 percent.
    • half

      public static Percent half()
      Returns 50 percent.
    • threeQuarter

      public static Percent threeQuarter()
      Returns 75 percent.
    • min

      public static Percent min()
      Returns 0 percent.
    • max

      public static Percent max()
      Returns 100 percent.
    • value

      public double value()
    • isMinValue

      public boolean isMinValue()
    • isMaxValue

      public boolean isMaxValue()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • invert

      public Percent invert()
    • add

      public Percent add(double value)
      Returns a new instance with the sum of both values. Returns max() when the sum is above 100 percent.
    • substract

      public Percent substract(double value)
      Returns a new instance with the current value minus the given value. Returns min() when the sum is below 0 percent.
    • multiply

      public Percent multiply(double value)
      Returns a new instance with the current value multiplied with the given value.