Elexis API documentation
Version 2.1.6 as of December 11 2011

waelti.statistics.queries
Class QueryUtil

java.lang.Object
  extended by waelti.statistics.queries.QueryUtil

public class QueryUtil
extends java.lang.Object


Constructor Summary
QueryUtil()
           
 
Method Summary
static java.util.List<java.lang.Object[]> addAverage(java.util.List<java.lang.Object[]> list, int InColumn1, int InColumn2, int resultColumn)
          InColumn1 / InColumn2 = resultColumn.
static double convertAndRoundMoney(int num)
          Rounds a given amount of money in Rappen to the next 5 Rappen.
static void convertDoubleToInteger(java.util.List<java.lang.Object[]> list, int index)
           
static java.lang.String convertFromCalendar(java.util.Calendar cal)
          Throws an IllegalArgumentException if one the the calendar values are wrong.
static java.util.Calendar convertToCalendar(java.lang.String dateString)
          Converts a Patient's birth date to a calendar object.
static void convertToCurrency(java.util.List<java.lang.Object[]> list, int column)
          Converts a double value of Rappen to a string in CHF.
static java.util.List<java.lang.String[]> convertToString(java.util.List<java.lang.Object[]> list)
          This methods converts any List containing arrays of objects into a list containing arrays of strings.
static java.util.List<java.lang.Object[]> createCohorts(java.util.List<java.lang.Object[]> list, int intervall)
          Returns a new list with the cohorts given the size given.
static int extractYear(java.lang.String date)
          Extracts the year from a string formatted as given by Patient.getGeburtsdatum().
static java.util.List<java.lang.Object[]> initiateYears(int firstYear, int arraySize)
          This method generates a list containing as many arrays as there are years between the given firstYear integer and the actual year.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryUtil

public QueryUtil()
Method Detail

extractYear

public static int extractYear(java.lang.String date)
Extracts the year from a string formatted as given by Patient.getGeburtsdatum().
If the string is empty, '0' is returned.

Parameters:
date - a string in the format "DD.MM.YYYY"
Returns:
year of birth as an integer.
See Also:
Patient

initiateYears

public static java.util.List<java.lang.Object[]> initiateYears(int firstYear,
                                                               int arraySize)
This method generates a list containing as many arrays as there are years between the given firstYear integer and the actual year. Every array contains in the first column the year as an integer. All other array elements are filled with integer values of 0.
This is useful if you want to create some time series.

Parameters:
firstYear - the first year of this time series.
arraySize - the array size of each year, inclusive the date.
Returns:
list containing an array for each year in the time series and its value as an integer in the first column of the array.

createCohorts

public static java.util.List<java.lang.Object[]> createCohorts(java.util.List<java.lang.Object[]> list,
                                                               int intervall)
Returns a new list with the cohorts given the size given. The array of the list has to contain all numerical values. The result list will contain strings in the first element of each array.

Parameters:
intervall - the size of the cohorts.
Returns:
a new list.

convertToString

public static java.util.List<java.lang.String[]> convertToString(java.util.List<java.lang.Object[]> list)
This methods converts any List containing arrays of objects into a list containing arrays of strings. This is for convenience, since handling strings from the beginning of the computation can be complicated and clutter the code.


convertToCurrency

public static void convertToCurrency(java.util.List<java.lang.Object[]> list,
                                     int column)
Converts a double value of Rappen to a string in CHF.


convertAndRoundMoney

public static double convertAndRoundMoney(int num)
Rounds a given amount of money in Rappen to the next 5 Rappen.

Parameters:
Amount - of Rappen
Returns:
Amounf of CHF, in steps of 5 Rappen

addAverage

public static java.util.List<java.lang.Object[]> addAverage(java.util.List<java.lang.Object[]> list,
                                                            int InColumn1,
                                                            int InColumn2,
                                                            int resultColumn)
InColumn1 / InColumn2 = resultColumn. ResultColumn will be a double.


convertToCalendar

public static java.util.Calendar convertToCalendar(java.lang.String dateString)
                                            throws java.lang.NumberFormatException
Converts a Patient's birth date to a calendar object. Format of the given String has to be of 'dd.mm.yyyy'

Throws:
java.lang.NumberFormatException

convertFromCalendar

public static java.lang.String convertFromCalendar(java.util.Calendar cal)
Throws an IllegalArgumentException if one the the calendar values are wrong.


convertDoubleToInteger

public static void convertDoubleToInteger(java.util.List<java.lang.Object[]> list,
                                          int index)

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis