net.japanesechess.psn
Class PsnFileProcessor

java.lang.Object
  extended by net.japanesechess.psn.PsnFileProcessor

public class PsnFileProcessor
extends java.lang.Object

Handles loading, modifying, saving and processing PSN files.

Author:
T. Gene Davis

Field Summary
private  java.lang.StringBuffer comment
           
(package private)  java.awt.FileDialog fd
           
private  java.awt.FileDialog fdSave
           
private  int nestedMoves
           
private  java.lang.StringBuffer notation
           
private  boolean parsingComment
           
private  boolean parsingPly
           
private  PsnFile psn
           
private  ShogiRecord sr
           
private  ShogiPly workingPly
           
 
Constructor Summary
PsnFileProcessor()
           
 
Method Summary
private  void addAttribute(java.lang.String line)
           
 PsnFile loadPsn()
           
private  void parsePlies(java.lang.String line)
          Extracts comments and notation from each line and creates plies from it.
private  void saveOrAppend(java.awt.Frame frm, java.lang.String text)
           
 void savePsn(java.awt.Frame frm, ShogiRecord sr)
           
 void savePsn(ShogiRecord sr)
           
private  java.io.File selectFile()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

psn

private PsnFile psn

sr

private ShogiRecord sr

workingPly

private ShogiPly workingPly

parsingPly

private boolean parsingPly

parsingComment

private boolean parsingComment

notation

private java.lang.StringBuffer notation

comment

private java.lang.StringBuffer comment

nestedMoves

private int nestedMoves

fd

java.awt.FileDialog fd

fdSave

private java.awt.FileDialog fdSave
Constructor Detail

PsnFileProcessor

public PsnFileProcessor()
Method Detail

loadPsn

public PsnFile loadPsn()

parsePlies

private void parsePlies(java.lang.String line)
Extracts comments and notation from each line and creates plies from it. - numbering moves or plies with a number followed by a number and a decimal point is optional, and ignored completely during parsing - '{}' is a general purpose comment - '()' is a special use comment for showing the results of alternate move choices Nesting is allowed

Parameters:
line -

addAttribute

private void addAttribute(java.lang.String line)

selectFile

private java.io.File selectFile()

savePsn

public void savePsn(java.awt.Frame frm,
                    ShogiRecord sr)

savePsn

public void savePsn(ShogiRecord sr)

saveOrAppend

private void saveOrAppend(java.awt.Frame frm,
                          java.lang.String text)