/** ************************************************************************** */ private void insertIndirectionAndPrediction(boolean isPrediction, int position) { int[] newIndirection = new int[indirection.length + 1]; boolean[] newPrediction = new boolean[newIndirection.length]; for (int i = 0; i < position; i++) { newIndirection[i] = indirection[i]; newPrediction[i] = prediction[i]; } if (isPrediction) { if (newTableHackVariable) newIndirection[position] = 0; else newIndirection[position] = predictionColumnsTable.getNumColumns(); } else newIndirection[position] = original.getNumColumns(); newPrediction[position] = isPrediction; for (int i = position + 1; i < newIndirection.length; i++) { newIndirection[i] = indirection[i - 1]; newPrediction[i] = prediction[i - 1]; } indirection = newIndirection; prediction = newPrediction; // also might need to modify predictionSet if (isPrediction) { int[] newPredictionSet = new int[predictionSet.length + 1]; for (int i = 0; i < predictionSet.length; i++) newPredictionSet[i] = predictionSet[i]; newPredictionSet[predictionSet.length] = getNumColumns(); predictionSet = newPredictionSet; } for (int i = 0; i < predictionSet.length; i++) if (predictionSet[i] > position) predictionSet[i]++; // Arrays.sort(predictionSet); }
/** * Set a char prediciton in the specified prediction column. The index into the prediction set is * used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setCharPrediction(char prediction, int row, int predictionColIdx) { predictionColumnsTable.setChar(prediction, row, predictionColIdx); }
/** * Set a byte prediciton in the specified prediction column. The index into the prediction set is * used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setBytePrediction(byte prediction, int row, int predictionColIdx) { predictionColumnsTable.setByte(prediction, row, predictionColIdx); }
/** * Set an Object prediciton in the specified prediction column. The index into the prediction set * is used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setObjectPrediction(Object prediction, int row, int predictionColIdx) { predictionColumnsTable.setObject(prediction, row, predictionColIdx); }
/** * Set a String prediciton in the specified prediction column. The index into the prediction set * is used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setStringPrediction(String prediction, int row, int predictionColIdx) { predictionColumnsTable.setString(prediction, row, predictionColIdx); }
/** * Set a boolean prediciton in the specified prediction column. The index into the prediction set * is used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setBooleanPrediction(boolean prediction, int row, int predictionColIdx) { // setBoolean(prediction, row, predictionSet[predictionColIdx]); predictionColumnsTable.setBoolean(prediction, row, predictionColIdx); }
/** * Set a short prediciton in the specified prediction column. The index into the prediction set is * used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setShortPrediction(short prediction, int row, int predictionColIdx) { // setShort(prediction, row, predictionSet[predictionColIdx]); predictionColumnsTable.setShort(prediction, row, predictionColIdx); }
/** * Set a long prediciton in the specified prediction column. The index into the prediction set is * used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setLongPrediction(long prediction, int row, int predictionColIdx) { // setLong(prediction, row, predictionSet[predictionColIdx]); predictionColumnsTable.setLong(prediction, row, predictionColIdx); }
/** * Set a double prediciton in the specified prediction column. The index into the prediction set * is used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setDoublePrediction(double prediction, int row, int predictionColIdx) { // setDouble(prediction, row, predictionSet[predictionColIdx]); predictionColumnsTable.setDouble(prediction, row, predictionColIdx); }
/** * Set a float prediciton in the specified prediction column. The index into the prediction set is * used, not the actual column index. * * @param prediction the value of the prediciton * @param row the row of the table * @param predictionColIdx the index into the prediction set */ public void setFloatPrediction(float prediction, int row, int predictionColIdx) { // setFloat(prediction, row, predictionSet[predictionColIdx]); predictionColumnsTable.setFloat(prediction, row, predictionColIdx); }
public int getColumnType(int position) { if (prediction[position]) return predictionColumnsTable.getColumnType(indirection[position]); else return original.getColumnType(position); }
public boolean isColumnNumeric(int position) { if (prediction[position]) return predictionColumnsTable.isColumnNumeric(indirection[position]); else return original.isColumnNumeric(position); }
public void setColumnIsScalar(boolean value, int position) { if (prediction[position]) predictionColumnsTable.setColumnIsScalar(value, indirection[position]); else original.setColumnIsScalar(value, position); }
public int getNumColumns() { if (newTableHackVariable) return original.getNumColumns(); return (original.getNumColumns() + predictionColumnsTable.getNumColumns()); }