Class Mult<A extends Unit<A>,​B extends Unit<B>>

java.lang.Object
edu.wpi.first.units.Unit<Mult<A,​B>>
edu.wpi.first.units.Mult<A,​B>
Type Parameters:
A - the type of the first unit in the result
B - the type of the second unit in the result

public class Mult<A extends Unit<A>,​B extends Unit<B>>
extends Unit<Mult<A,​B>>
A combinatory unit type that is equivalent to the product of two other others. Note that algebraic reduction is not possible in Java's generic type system, so Mult<A, B> is not type-compatible with Mult<B, A>!
  • Constructor Details

    • Mult

      protected Mult​(Class<? extends Mult<A,​B>> baseType, A a, B b)
      Creates a new product unit. Consider using combine(A, B) instead of manually calling this constructor.
      Parameters:
      baseType - the base type representing the unit product
      a - the first unit of the product
      b - the second unit of the product
  • Method Details

    • combine

      public static <A extends Unit<A>,​ B extends Unit<B>> Mult<A,​B> combine​(A a, B b)
      Creates a new Mult unit derived from two arbitrary units multiplied together.
         Mult.combine(Volts, Meters) // Volt-Meters
       

      It's recommended to use the convenience function Unit.mult(Unit) instead of calling this factory directly.

      Type Parameters:
      A - the type of the first unit
      B - the type of the second unit
      Parameters:
      a - the first unit
      b - the second unit
      Returns:
      the combined unit
    • unitA

      public A unitA()
      Gets the first unit of the product.
      Returns:
      the first unit
    • unitB

      public B unitB()
      Gets the second unit of the product.
      Returns:
      the second unit
    • toString

      public String toString()
      Overrides:
      toString in class Unit<Mult<A extends Unit<A>,​B extends Unit<B>>>
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Unit<Mult<A extends Unit<A>,​B extends Unit<B>>>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Unit<Mult<A extends Unit<A>,​B extends Unit<B>>>