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

org.uqbar.geodds.NumberUtils.xtend Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package org.uqbar.geodds

/**
 * Clase helper para números.
 * 
* Se debe importar como static extension methods, eso permite incorporar mensajes * a los números de la forma
*
    *
  • 2.max(5)
    *
  • 6.even
    *
* etc.

* * @author DDS */ class NumberUtils { /** * Devuelve el menor valor entre dos números */ static def double min(double x, double y) { if(x < y) x else y } /** * Devuelve el mayor valor entre dos números */ static def max(double x, double y) { if(x > y) x else y } /** * Indica si un número es par */ static def even(int x) { x % 2 == 0 } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy