コード例 #1
0
 // PUBLIC FUNCTIONS
 public void put(int col, int row, double value) {
   if ((row < window.minJforI(col)) || (row > window.maxJforI(col))) {
     throw new InternalError(
         "CostMatrix is filled in a cell (col="
             + col
             + ", row="
             + row
             + ") that is not in the "
             + "search window");
   } else cellValues[colOffsets[col] + row - window.minJforI(col)] = value;
 }
コード例 #2
0
  // CONSTRUCTOR
  MemoryResidentMatrix(SearchWindow searchWindow) {
    window = searchWindow;
    cellValues = new double[window.size()];
    colOffsets = new int[window.maxI() + 1];

    // Fill in the offset matrix
    int currentOffset = 0;
    for (int i = window.minI(); i <= window.maxI(); i++) {
      colOffsets[i] = currentOffset;
      currentOffset += window.maxJforI(i) - window.minJforI(i) + 1;
    }
  } // end Constructor
コード例 #3
0
 public double get(int col, int row) {
   if ((row < window.minJforI(col)) || (row > window.maxJforI(col))) return OUT_OF_WINDOW_VALUE;
   else return cellValues[colOffsets[col] + row - window.minJforI(col)];
 }