se.liu.ida.critiquer.mics
Class Utils

java.lang.Object
  extended by se.liu.ida.critiquer.mics.Utils

public class Utils
extends Object


Constructor Summary
Utils()
           
 
Method Summary
static
<T> T
find(Collection<T> c, Predicate<T> comp)
           
static
<T> ArrayList<T>
findAll(Collection<T> c, Predicate<T> comp)
           
static List<Class> getAllInterfaces(Class constraintClass)
           
static Point getCenter(Shape shape)
           
 Point getPointInRectangle(int x, int y, Rectangle2D area)
          Returns a point based on (x, y) but constrained to be within the bounds of the given rectangle.
static
<In,Out> List<Out>
map(UnaryFunction<In,Out> fn, Collection<In> l)
           
static
<T> Vector<T>
toVector(Collection<T> c)
           
static
<T> Vector<T>
toVector(T[] c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

getPointInRectangle

public Point getPointInRectangle(int x,
                                 int y,
                                 Rectangle2D area)
Returns a point based on (x, y) but constrained to be within the bounds of the given rectangle. Borrowed from ChartPanel in JFreeChart.

Parameters:
x - the x-coordinate.
y - the y-coordinate.
area - the rectangle (null not permitted).
Returns:
A point within the rectangle.

getCenter

public static Point getCenter(Shape shape)

getAllInterfaces

public static List<Class> getAllInterfaces(Class constraintClass)

toVector

public static <T> Vector<T> toVector(Collection<T> c)

toVector

public static <T> Vector<T> toVector(T[] c)

find

public static <T> T find(Collection<T> c,
                         Predicate<T> comp)

findAll

public static <T> ArrayList<T> findAll(Collection<T> c,
                                       Predicate<T> comp)

map

public static <In,Out> List<Out> map(UnaryFunction<In,Out> fn,
                                     Collection<In> l)