All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scalqa.lang.long.g.Math.scala Maven / Gradle / Ivy

There is a newer version: 1.0
Show newest version
package scalqa; package lang; package long; package g; import language.implicitConversions

/**
* ### Generic Math 
*  
* Math is an implementation of scala.math.Numeric, an instance required for generic calculations on underlying type. 
* 
*/
abstract class Math[A<:RAW] extends Math.Ordering[A] with Gen.Math[A]:
  final override def compare(x:A,y:A): Int = java.lang.Long.compare(x,y)

object Math:

  trait Ordering[A<:RAW] extends Gen.Math.Ordering[A]:
    /**/     def compare(x:A,y:A): Int
    override def reverse         : Ordering[A] = new zReversedOrdering(this);

  // *******************************************************************************
  private class zReversedOrdering[A<:RAW](c: Ordering[A]) extends Ordering[A]:
    /**/     def compare(x:A,y:A): Int         = c.compare(y,x)
    override def reverse         : Ordering[A] = c

/*___________________________________________________________________________
    __________ ____   __   ______  ____
   /  __/ ___// _  | / /  / __  / / _  |             Scala Quick API
 __\  \/ /___/ __  |/ /__/ /_/ /_/ __  |   (c) 2021, Scalqa.org Inc
/_____/\____/_/  |_/____/\______/_/  |_|             github.com/scalqa
___________________________________________________________________________*/




© 2015 - 2024 Weber Informatics LLC | Privacy Policy