// THIS BLOCK CONTAINS JAVA CODE.
  private long removeRefBidData(long lIndex) {
    //
    // loop through the elements in the actual container, in order to find the one
    // at lIndex. Once it is found, then loop through the reference list and remove
    // the corresponding reference for that element.
    //
    BidData refActualElement = GetBidData(lIndex);

    if (refActualElement == null) return lIndex; // oh well.

    // Loop through the reference list and remove the corresponding reference
    // for the specified element.
    //
    for (int intIndex = 0; intIndex < elementList.size(); intIndex++) {
      Object theObject = elementList.get(intIndex);

      if ((theObject == null) || !(theObject instanceof BidData)) continue;

      BidData tempRef = (BidData) (theObject);

      if ((BidData.getCPtr(tempRef) == BidData.getCPtr(refActualElement))) {
        elementList.remove(tempRef);
        break;
      }
    }

    return lIndex;
  }
  private long getCPtrAddRefBidData(BidData element) {
    // Whenever adding a reference to the list, I remove it first (if already there.)
    // That way we never store more than one reference per actual contained object.
    //
    for (int intIndex = 0; intIndex < elementList.size(); intIndex++) {
      Object theObject = elementList.get(intIndex);

      if ((theObject == null) || !(theObject instanceof BidData)) continue;

      BidData tempRef = (BidData) (theObject);

      if ((BidData.getCPtr(tempRef) == BidData.getCPtr(element))) {
        elementList.remove(
            tempRef); // It was already there, so let's remove it before adding (below.)
        break;
      }
    }
    // Now we add it...
    //
    BidData tempLocalRef = element;
    elementList.add(tempLocalRef);
    return BidData.getCPtr(element);
  } // Hope I get away with overloading this for every type. Otherwise,
  void ReadBids() throws IOException {
    /*  File Reading Stuff */
    FileReader input = new FileReader(_inputFile);
    // FileWriter output = new FileWriter(args[1]);
    /* Filter FileReader through a Buffered read to read a line at a time */
    BufferedReader bufRead = new BufferedReader(input);
    // BufferedWriter outp = new BufferedWriter(output);

    String line; // String that holds current file line

    /*Data Structures to Store Bids*/
    HashMap<Integer, BidData> Bids = new HashMap<Integer, BidData>();

    // Read first line
    line = bufRead.readLine();
    _minutes = Double.parseDouble(line);
    _stopTime = _startTime + (long) (_minutes * 60 * 1000);

    line = bufRead.readLine();
    line = bufRead.readLine();
    _regionCount = Integer.parseInt(line);

    line = bufRead.readLine();
    line = bufRead.readLine();
    _bidCount = Integer.parseInt(line);

    line = bufRead.readLine();
    line = bufRead.readLine();
    _companyCount = Integer.parseInt(line);

    line = bufRead.readLine();
    // Reading lines ending with a # (bids), and store in Bids
    Integer count = 0;
    while (line != null) {
      if (line.endsWith("#")) {
        String[] res = line.split(" ");
        BidData curbid = new BidData();
        curbid.company = Integer.parseInt(res[0]);
        curbid.value = Double.parseDouble(res[1]);
        curbid.region = new HashSet<Integer>();
        for (int k = 2; k < res.length - 1; k++) {
          curbid.region.add(Integer.parseInt(res[k]));
        }

        // store the bid
        curbid.regionCount = curbid.region.size();
        curbid.avgPerRegion = curbid.value / curbid.regionCount;
        Bids.put(count, curbid);
        count++;
      }
      line = bufRead.readLine();
    }
    bufRead.close();

    _bids = Bids;
  }
 public boolean AddBidData(BidData disownObject) {
   return otapiJNI.OfferListMarket_AddBidData(
       swigCPtr, this, BidData.getCPtr(disownObject), disownObject);
 }