public class ReadPredictiveModel
extends java.lang.Object
The file must be a text file where each line records the precinct identifier and a value representing the relevance, both separated by a comma character. Each line starting with the number sign character (#) will be considered as a comment and it will be ignored. Regarding the values, the precinct identifier must be a positive long value, and the relevance must be a float value between 0 and 1. Both values must be separated by a comma, whitespace, or a tab.
Modifier and Type | Field and Description |
---|---|
private java.io.BufferedReader |
fileReader
A stream to the file to be read.
|
private java.util.HashMap<java.lang.Long,java.lang.Float> |
predictiveModel
Records the values to be applied in a predictive model for each precinct.
|
Constructor and Description |
---|
ReadPredictiveModel(java.io.File file) |
ReadPredictiveModel(java.lang.String fileName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.HashMap<java.lang.Long,java.lang.Float> |
getPredictiveModel()
Returns the
predictiveModel attribue. |
void |
list(java.io.PrintStream out)
Prints this Predictive Model fields out to the specified output
stream.
|
java.util.HashMap<java.lang.Long,java.lang.Float> |
run()
Performs the reading of the file where the predictive model is saved.
|
java.lang.String |
toString() |
private java.util.HashMap<java.lang.Long,java.lang.Float> predictiveModel
key
of the map is a unique precinct identifier, while
the value
is a float in the range [0,1] with the relevance
associated with the precinct.private java.io.BufferedReader fileReader
public ReadPredictiveModel(java.lang.String fileName) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public ReadPredictiveModel(java.io.File file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public java.util.HashMap<java.lang.Long,java.lang.Float> run() throws java.io.IOException
predictiveModel
attribute.java.io.IOException
public java.util.HashMap<java.lang.Long,java.lang.Float> getPredictiveModel()
predictiveModel
attribue.predictiveModel
attribue.public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)