com.steema.teechart.misc
Class Utils

java.lang.Object
  extended by com.steema.teechart.misc.Utils

public class Utils
extends java.lang.Object

Title: misc.Utils class

Description: Chart utility procedures

Copyright (c) 2005-2013 by Steema Software SL. All Rights Reserved.

Company: Steema Software SL


Field Summary
static java.lang.String BuildNumber
           
static int[] functionGalleryPage
           
static int FUNCTIONTYPESCOUNT
          Number of chart Function types.
static java.lang.Class[] functionTypesOf
          List of chart Function types.
static double PISTEP
           
static int[] seriesGalleryCount
           
static int[] seriesGalleryPage
           
static int SERIESTYPESCOUNT
           
static java.lang.Class[] seriesTypesOf
           
static int TOOLTYPESCOUNT
          Number of chart Tool types.
static java.lang.Class[] toolTypesOf
          List of chart Tool classes.
static java.lang.String VersionMode
           
 
Constructor Summary
Utils()
           
 
Method Summary
static java.lang.String arrayToString(java.lang.String[] a)
           
static java.lang.String arrayToString(java.lang.String[] a, char separator)
           
static double atan2(double y, double x)
          Note: This method has been implemented here in Utils class because J2ME Math class does not include it.
static double calcDistance(Point p, int x0, int y0, int x1, int y1)
           
static boolean colorIsEmpty(Color color)
           
static int compareDoubles(double d1, double d2)
          Note: This code has been copied from Java JDK Double.compare method, because J2ME Double class does not include it.
static Color darkenColor(Color AColor, int Percentage)
           
static void drawCheckBox(int x, int y, IGraphics3D g, boolean drawChecked, boolean CheckBox, Color backColor)
           
static Rectangle emptyRectangle()
           
static double exp(double a)
          Note: This method has been implemented here in Utils class because J2ME Math class does not include it.
static java.lang.String formatFloat(double value)
           
static Rectangle fromLTRB(int l, int t, int r, int b)
           
static double getDateTimeStep(int value)
          Evaluates and returns a steema.
static Color getEmptyColor()
           
static boolean intersectWithRect(Rectangle r1, Rectangle r2)
           
static boolean isEmptyRectangle(Rectangle rect)
           
static boolean isNullOrEmpty(java.lang.String str)
           
static double log(double value)
          Note: This function has been added to Utils because J2ME Math class does not include it.
static double log(double x, double numBase)
           
static int MulDiv(int a, int b, int c)
           
static PointDouble offsetPoint(PointDouble value, double x, double y)
           
static Point pointAtDistance(Point aFrom, Point aTo, int aDist)
           
static boolean pointInLineTolerance(Point p, int x0, int y0, int x1, int y1, int tolerance)
           
static double pow(double a, double b)
          Note: This method has been implemented here in Utils class because J2ME Math class does not include it.
static double rad2Deg(double radian)
           
static double[] rationaliseValues(double x, double y, double z)
           
static Point[] rectToPolygon(Rectangle r)
           
static PointDouble[] rectToPolygonDouble(Rectangle r)
           
static java.lang.String replaceAll(java.lang.String source, java.lang.String pattern, java.lang.String replacement)
           
static int round(double value)
          Returns the integer nearest to "value" parameter
static java.lang.Class seriesClass(java.lang.String style)
           
static int seriesTypesIndex(java.lang.Class seriesType)
           
static int seriesTypesIndex(ISeries s)
           
static void sort(int[] x, int startIndex, int endIndex, Comparator c)
           
static void sort(int startIndex, int endIndex, Comparator c, Swapper s)
           
static double sqr(double x)
           
static double stringToDouble(java.lang.String text, double value)
           
static void swapInteger(int a, int b)
           
static int toolTypeIndex(Tool tool)
          Returns the index in ToolTypesOf list of a given tool instance.
static double trunc(double d)
          Note: This method has been implemented here in Utils class because J2ME Math class does not include it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PISTEP

public static final double PISTEP
See Also:
Constant Field Values

BuildNumber

public static final java.lang.String BuildNumber
See Also:
Constant Field Values

VersionMode

public static final java.lang.String VersionMode
See Also:
Constant Field Values

TOOLTYPESCOUNT

public static final int TOOLTYPESCOUNT
Number of chart Tool types.

See Also:
Constant Field Values

toolTypesOf

public static final java.lang.Class[] toolTypesOf
List of chart Tool classes.


FUNCTIONTYPESCOUNT

public static final int FUNCTIONTYPESCOUNT
Number of chart Function types.

See Also:
Constant Field Values

functionTypesOf

public static final java.lang.Class[] functionTypesOf
List of chart Function types.


functionGalleryPage

public static final int[] functionGalleryPage

SERIESTYPESCOUNT

public static final int SERIESTYPESCOUNT
See Also:
Constant Field Values

seriesGalleryCount

public static final int[] seriesGalleryCount

seriesGalleryPage

public static final int[] seriesGalleryPage

seriesTypesOf

public static final java.lang.Class[] seriesTypesOf
Constructor Detail

Utils

public Utils()
Method Detail

formatFloat

public static java.lang.String formatFloat(double value)

getDateTimeStep

public static double getDateTimeStep(int value)
Evaluates and returns a steema.teechart.DateTimeStep value as an Axis double scale that may be used to set the steema.teechart.Axis.Increment.

Parameters:
value - DateTimeStep
Returns:
double

stringToDouble

public static double stringToDouble(java.lang.String text,
                                    double value)

swapInteger

public static void swapInteger(int a,
                               int b)

sort

public static void sort(int startIndex,
                        int endIndex,
                        Comparator c,
                        Swapper s)

sort

public static void sort(int[] x,
                        int startIndex,
                        int endIndex,
                        Comparator c)

toolTypeIndex

public static int toolTypeIndex(Tool tool)
Returns the index in ToolTypesOf list of a given tool instance.

Parameters:
tool - Tool to search its type in list
Returns:
int

seriesTypesIndex

public static int seriesTypesIndex(ISeries s)

seriesTypesIndex

public static int seriesTypesIndex(java.lang.Class seriesType)

MulDiv

public static int MulDiv(int a,
                         int b,
                         int c)

arrayToString

public static java.lang.String arrayToString(java.lang.String[] a)

arrayToString

public static java.lang.String arrayToString(java.lang.String[] a,
                                             char separator)

drawCheckBox

public static void drawCheckBox(int x,
                                int y,
                                IGraphics3D g,
                                boolean drawChecked,
                                boolean CheckBox,
                                Color backColor)

getEmptyColor

public static Color getEmptyColor()

colorIsEmpty

public static boolean colorIsEmpty(Color color)

darkenColor

public static Color darkenColor(Color AColor,
                                int Percentage)

round

public static int round(double value)
Returns the integer nearest to "value" parameter

Parameters:
value - double
Returns:
int

calcDistance

public static double calcDistance(Point p,
                                  int x0,
                                  int y0,
                                  int x1,
                                  int y1)

sqr

public static final double sqr(double x)

log

public static double log(double value)
Note: This function has been added to Utils because J2ME Math class does not include it. Returns Math.log of value parameter.

Parameters:
value - double
Returns:
double

log

public static double log(double x,
                         double numBase)

pointAtDistance

public static Point pointAtDistance(Point aFrom,
                                    Point aTo,
                                    int aDist)

isNullOrEmpty

public static boolean isNullOrEmpty(java.lang.String str)

emptyRectangle

public static Rectangle emptyRectangle()

isEmptyRectangle

public static boolean isEmptyRectangle(Rectangle rect)

fromLTRB

public static Rectangle fromLTRB(int l,
                                 int t,
                                 int r,
                                 int b)

pointInLineTolerance

public static boolean pointInLineTolerance(Point p,
                                           int x0,
                                           int y0,
                                           int x1,
                                           int y1,
                                           int tolerance)

intersectWithRect

public static boolean intersectWithRect(Rectangle r1,
                                        Rectangle r2)

compareDoubles

public static int compareDoubles(double d1,
                                 double d2)
Note: This code has been copied from Java JDK Double.compare method, because J2ME Double class does not include it. Compares Double d1 with d2. Returns 0 if both are equal. Returns -1 if d1 is lower than d2, and 1 if d1 is bigger than d2.

Parameters:
d1 - double
d2 - double
Returns:
int

atan2

public static double atan2(double y,
                           double x)
Note: This method has been implemented here in Utils class because J2ME Math class does not include it. Returns Math.atan2.

Parameters:
y - double
x - double
Returns:
double

pow

public static double pow(double a,
                         double b)
Note: This method has been implemented here in Utils class because J2ME Math class does not include it. Returns Math.pow.

Parameters:
a - double
b - double
Returns:
double

offsetPoint

public static PointDouble offsetPoint(PointDouble value,
                                      double x,
                                      double y)

rad2Deg

public static double rad2Deg(double radian)

exp

public static double exp(double a)
Note: This method has been implemented here in Utils class because J2ME Math class does not include it. Returns Math.exp.

Parameters:
a - double
Returns:
double

trunc

public static double trunc(double d)
Note: This method has been implemented here in Utils class because J2ME Math class does not include it. Truncate a number to the next nearest integer towards 0

Parameters:
d - double
Returns:
double

rectToPolygon

public static Point[] rectToPolygon(Rectangle r)

rectToPolygonDouble

public static PointDouble[] rectToPolygonDouble(Rectangle r)

seriesClass

public static java.lang.Class seriesClass(java.lang.String style)

rationaliseValues

public static double[] rationaliseValues(double x,
                                         double y,
                                         double z)

replaceAll

public static java.lang.String replaceAll(java.lang.String source,
                                          java.lang.String pattern,
                                          java.lang.String replacement)