Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2000:
[Freeciv-Dev] Help with mine civlog java program
Home

[Freeciv-Dev] Help with mine civlog java program

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Freeciv-Dev" <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Help with mine civlog java program
From: "Wong TM (Huang Deming)" <lookmeow@xxxxxxxxxxxx>
Date: Wed, 26 Jul 2000 14:23:45 +0800

I a newbie to java. Please help me which collection (link list, map...etc)
to use to
implement int[NUM_OF_RULER][POP...SPACE][YEAR] dynamically. Below is the src
of the freeciv scorelog reader.
I be grateful if someone can implement it for me.

/*
 * dataLoader.java
 *
 * Created on July 26, 2000, 1:08 PM
 */

/**
 *
 * @author  furyhawk
 * @version 0.01
 */

import java.io.*;
import java.io.File;
import java.util.*;

import javax.swing.*;

public class CivLogData extends Object {

  public static final int POP         = 0;
  public static final int BNP         = 1;
  public static final int MFG         = 2;
  public static final int CITIES      = 3;
  public static final int TECHS       = 4;
  public static final int MUNITS      = 5;
  public static final int SETTLERS    = 6;
  public static final int WONDERS     = 7;
  public static final int TECHOUT     = 8;
  public static final int LANDAREA    = 9;
  public static final int SETTLEDAREA = 10;
  public static final int POLLUTION   = 11;
  public static final int LITERACY    = 12;
  public static final int SPACESHIP   = 13;

  // int[NUM_OF_RULER][POP...SPACE][YEAR] ??
  public List civscore = new ArrayList(); //??

  /** JFrame for Message Dialog */
  static JFrame frame;

  /** Civlog Filename not used yet */
  String logValue;

  /** Creates new CivLogData */
  public CivLogData() {
  }

  /** why does it had to be static to be called from
frmCivlog.jmiOpenActionPerformed? */
  public static void dataLoader(File theFile, String filePath) {
    try {
      BufferedReader in = new BufferedReader(new FileReader(theFile));
      String str;
      if ((str = in.readLine()) != null) {
        if(str.regionMatches(true, 0, "#FREECIV SCORELOG", 0, 17) == true){
          JOptionPane.showMessageDialog(
          frame, "It is a Civlog File: " + filePath
          );
        }
        else{
          JOptionPane.showMessageDialog(
          frame, "Not a Civlog File: " + filePath
          );
        }
      }

      /** reading in freeciv score into a data structure */
      //??????????

      in.close();

    } catch (IOException e) {
      /** FIXME: Add more debugging features */
    }
  }

}
       __
.----.|__|.---.-..-----.
|  __||  ||  _  ||  _  |
|____||__||___._||_____|





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Help with mine civlog java program, Wong TM (Huang Deming) <=