public abstract class AbstractModelReader extends Object
Modifier and Type | Field and Description |
---|---|
protected DataReader |
dataReader |
protected int |
NUM_PREDS
The number of predicates contained in the model.
|
Constructor and Description |
---|
AbstractModelReader(DataReader dataReader) |
AbstractModelReader(File f) |
Modifier and Type | Method and Description |
---|---|
abstract void |
checkModelType() |
abstract AbstractModel |
constructModel() |
AbstractModel |
getModel() |
protected int[][] |
getOutcomePatterns() |
protected String[] |
getOutcomes() |
protected Context[] |
getParameters(int[][] outcomePatterns)
Reads the parameters from a file and populates an array of context objects.
|
protected String[] |
getPredicates() |
double |
readDouble()
Implement as needed for the format the model is stored in.
|
int |
readInt()
Implement as needed for the format the model is stored in.
|
String |
readUTF()
Implement as needed for the format the model is stored in.
|
protected int NUM_PREDS
protected DataReader dataReader
public AbstractModelReader(File f) throws IOException
IOException
public AbstractModelReader(DataReader dataReader)
public int readInt() throws IOException
IOException
public double readDouble() throws IOException
IOException
public String readUTF() throws IOException
IOException
public AbstractModel getModel() throws IOException
IOException
public abstract void checkModelType() throws IOException
IOException
public abstract AbstractModel constructModel() throws IOException
IOException
protected String[] getOutcomes() throws IOException
IOException
protected int[][] getOutcomePatterns() throws IOException
IOException
protected String[] getPredicates() throws IOException
IOException
protected Context[] getParameters(int[][] outcomePatterns) throws IOException
outcomePatterns
- The outcomes patterns for the model. The first index refers to which
outcome pattern (a set of outcomes that occurs with a context) is being specified. The
second index specifies the number of contexts which use this pattern at index 0, and the
index of each outcomes which make up this pattern in indicies 1-n.IOException
- when the model file does not match the outcome patterns or can not be read.Copyright © 2017 The Apache Software Foundation. All rights reserved.