rafa.math
Class MathUtil

java.lang.Object
  extended by rafa.math.MathUtil

public class MathUtil
extends java.lang.Object

Static utility methods for math objects.

Author:
rafa

Constructor Summary
MathUtil()
           
 
Method Summary
static java.lang.Number cast(double d, java.lang.Class<? extends java.lang.Number> c)
          Casts a double primitive value into an object of the specified class.
static Segment intersection(Segment s1, Segment s2)
          Calculates the intersection between two segments.
static java.lang.Number max(java.util.Collection<java.lang.Number> numbers)
           
static java.lang.Number max(java.lang.Number a, java.lang.Number b)
           
static java.lang.Number min(java.util.Collection<java.lang.Number> numbers)
           
static java.lang.Number min(java.lang.Number a, java.lang.Number b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathUtil

public MathUtil()
Method Detail

max

public static java.lang.Number max(java.lang.Number a,
                                   java.lang.Number b)

min

public static java.lang.Number min(java.lang.Number a,
                                   java.lang.Number b)

max

public static java.lang.Number max(java.util.Collection<java.lang.Number> numbers)

min

public static java.lang.Number min(java.util.Collection<java.lang.Number> numbers)

intersection

public static Segment intersection(Segment s1,
                                   Segment s2)
Calculates the intersection between two segments.

Parameters:
s1 - a segment
s2 - another segment
Returns:
a segment which is the intersection between both, or null if they don't intersect.

cast

public static java.lang.Number cast(double d,
                                    java.lang.Class<? extends java.lang.Number> c)
Casts a double primitive value into an object of the specified class.

Parameters:
d - a double primitive value
c - a Number subclass
Returns:
an Object of class c with the value of d, or null if c is not a subclass of Number within the package java.lang.


Copyright © 2008-2009. All Rights Reserved.