be.ac.ua.broker.input.pricing
Class CSVHandler

java.lang.Object
  extended by be.ac.ua.broker.input.pricing.CSVHandler
Direct Known Subclasses:
SpotCSVHandler

public class CSVHandler
extends java.lang.Object

Class that uses java CSV reader to read in the data from the CSV file downloaded from the cloudexchange.org website

Author:
Vermeersch Kurt
See Also:
http://sourceforge.net/projects/javacsv/

Field Summary
protected  java.util.List<java.util.List<java.lang.String>> fContents
          List of list in which the contents of the CSV file are stored
 
Constructor Summary
CSVHandler()
           
 
Method Summary
 java.lang.Double getHighValue(CSVFilterInterface filter, int index)
          Get the spot price value that is the tipping point bid that enables the optimal scheduling of the subtasks
 org.apache.commons.math.stat.descriptive.DescriptiveStatistics getStatistics(CSVFilterInterface filter)
          Function that generates a list of statistics object using the contents that were found in the input CSV file
 java.lang.String getValue(java.lang.String inst, java.lang.String reg, java.lang.String os)
          Get the price from the CSV file that is stated for the given instance type, geographical region and operating system.
 void parse(java.lang.String inputFile)
          Parse the given CSV file and store its contents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fContents

protected java.util.List<java.util.List<java.lang.String>> fContents
List of list in which the contents of the CSV file are stored

Constructor Detail

CSVHandler

public CSVHandler()
Method Detail

parse

public void parse(java.lang.String inputFile)
Parse the given CSV file and store its contents

Parameters:
inputFile - the input CSV file to parse and to analyze the content of

getValue

public java.lang.String getValue(java.lang.String inst,
                                 java.lang.String reg,
                                 java.lang.String os)
                          throws InstanceNotAvailableException
Get the price from the CSV file that is stated for the given instance type, geographical region and operating system.

Parameters:
inst - the instance type to get the price for
reg - the geographical region to get the price for
os - the operating system to get the price for
Returns:
the price for an instance with the provided parameter values.
Throws:
InstanceNotAvailableException

getStatistics

public org.apache.commons.math.stat.descriptive.DescriptiveStatistics getStatistics(CSVFilterInterface filter)
Function that generates a list of statistics object using the contents that were found in the input CSV file

Parameters:
filter - filter that decides whether a certain data item is still part of the filtered contents
Returns:
a list of statistics object

getHighValue

public java.lang.Double getHighValue(CSVFilterInterface filter,
                                     int index)
                              throws java.lang.Exception
Get the spot price value that is the tipping point bid that enables the optimal scheduling of the subtasks

Parameters:
filter - the date filter of the time frame in which the spot prices need to be analyzed
index - number of hours the spot price does not need to be available
Returns:
the spot price value
Throws:
java.lang.Exception