cz.cuni.amis.pogamut.usar2004.samples.AirScanner
Class ToolBox

Package class diagram package ToolBox
java.lang.Object
  extended by cz.cuni.amis.pogamut.usar2004.samples.AirScanner.ToolBox

public class ToolBox
extends Object

ToolBox class covers methods that help solve comon/easy tasks.

Author:
vejmanm

Constructor Summary
ToolBox()
           
 
Method Summary
static double getAngle(double sx, double cx)
          Determines an angle in degrees based on sin and cos of the angle.
static int getMax(int[] array)
          Returns maximum value from the input array.
static int getMin(int i, int j, int k, int l)
          Uses Math.min method to determine the minimum of the four input values.
static String getTime(long elapsed)
          Uses DateFormat to format the input value to hours, minutes, seconds and mili seconds.
static String getTwoDecimalPlaces(double value)
          Uses DecimalFormat to format the value.
static double[][] initArray(int width, int height)
          Initial value will be Double.MIN_VALUE.
static double[][] resizeArray(double[][] original, int x, int y, int offsetX, int offsetY)
          Creates new array enlongated by x and y and fills it with old walues at offsetX, offsetY.
static BufferedImage resizeImage(Image original, int x, int y, int offsetX, int offsetY)
          Creates new a image enlarged by x and y and draws old image at offsetX, offsetY.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolBox

public ToolBox()
Method Detail

getMax

public static int getMax(int[] array)
Returns maximum value from the input array.

Parameters:
array - Input array.
Returns:
Returns maximum value within the array.

getTime

public static String getTime(long elapsed)
Uses DateFormat to format the input value to hours, minutes, seconds and mili seconds.

Parameters:
elapsed - Elapsed time in miliseconds.
Returns:
Returns string time formated as HH:mm:ss.SSS.

getMin

public static int getMin(int i,
                         int j,
                         int k,
                         int l)
Uses Math.min method to determine the minimum of the four input values.

Parameters:
i - first number
j - second number
k - third nubmer
l - fourth number
Returns:
Returns minimal value from the four input integers

getAngle

public static double getAngle(double sx,
                              double cx)
Determines an angle in degrees based on sin and cos of the angle.

Parameters:
sx - Sinus x
cx - Cosinus x
Returns:
Returns angle in degrees.

getTwoDecimalPlaces

public static String getTwoDecimalPlaces(double value)
Uses DecimalFormat to format the value.

Parameters:
value - Double value to convert to string.
Returns:
Returns string representation of the value formated to two decimal places.

resizeImage

public static BufferedImage resizeImage(Image original,
                                        int x,
                                        int y,
                                        int offsetX,
                                        int offsetY)
Creates new a image enlarged by x and y and draws old image at offsetX, offsetY.

Parameters:
original - Original image to be stretched.
x - Widht enlargement.
y - Height enlargement.
offsetX - Offset for original picture to be drawn at x-axis.
offsetY - Offset for original picture to be drawn at y-axis.
Returns:
Returns narger image with black background.

resizeArray

public static double[][] resizeArray(double[][] original,
                                     int x,
                                     int y,
                                     int offsetX,
                                     int offsetY)
Creates new array enlongated by x and y and fills it with old walues at offsetX, offsetY.

Parameters:
original - Original array to be lengthened.
x - Width enlargement.
y - Height enlargement.
offsetX - Offset for original data at x-axis.
offsetY - Offset for original data at y-axis.
Returns:
Returns resized array.

initArray

public static double[][] initArray(int width,
                                   int height)
Initial value will be Double.MIN_VALUE. Zeroes would be missunderstood while creating an image.



Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.