Class PerformanceLoggingRing<E>

java.lang.Object
dk.jonaslindstrom.ruffini.common.helpers.PerformanceLoggingRing<E>
All Implemented Interfaces:
AdditiveGroup<E>, CommutativeMonoid<E>, Monoid<E>, Ring<E>, Semigroup<E>, SemiRing<E>, Set<E>
Direct Known Subclasses:
PerformanceLoggingField

public class PerformanceLoggingRing<E> extends Object implements Ring<E>
Wrapper for the ring class which logs the number of operations performed in this ring.
  • Field Details

    • multiplications

      protected int multiplications
    • additions

      protected int additions
    • negations

      protected int negations
    • equalities

      protected int equalities
  • Constructor Details

    • PerformanceLoggingRing

      public PerformanceLoggingRing(Ring<E> ring)
  • Method Details

    • negate

      public E negate(E a)
      Description copied from interface: AdditiveGroup
      Return -a.
      Specified by:
      negate in interface AdditiveGroup<E>
    • add

      public E add(E a, E b)
      Description copied from interface: CommutativeMonoid
      Return the result of a+b.
      Specified by:
      add in interface CommutativeMonoid<E>
    • zero

      public E zero()
      Description copied from interface: CommutativeMonoid
      Return the zero element.
      Specified by:
      zero in interface CommutativeMonoid<E>
    • identity

      public E identity()
      Description copied from interface: Monoid
      Return the identity element of this monoid.
      Specified by:
      identity in interface Monoid<E>
    • multiply

      public E multiply(E a, E b)
      Description copied from interface: Semigroup
      Return the result of the product ab in this group.
      Specified by:
      multiply in interface Semigroup<E>
    • toString

      public String toString(E a)
      Description copied from interface: Set
      Returns a human-readable string representation of an element in this set.
      Specified by:
      toString in interface Set<E>
    • equals

      public boolean equals(E a, E b)
      Description copied from interface: Set
      Returns true if and only if a = b as elements of this set.
      Specified by:
      equals in interface Set<E>
    • getMultiplications

      public int getMultiplications()
    • getAdditions

      public int getAdditions()
    • getNegations

      public int getNegations()
    • getEqualities

      public int getEqualities()
    • toString

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

      public void reset()