exe
Class ShowFile

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by exe.ShowFile
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class ShowFile
extends java.io.PrintWriter

ShowFile is a GAIGS XML Support class design to handle all writing to a GAIGS XML Script file. Client classes can contruct a ShowFile instance, write snaps to it, and close the ShowFile.

Version:
5/28/06 (6/15/07 -- audio added)
Author:
Myles McNally (Tom Naps -- audio parameters added)

Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ShowFile(java.lang.String fileName)
          Create a ShowFile instance.
ShowFile(java.lang.String fileName, int questionCount)
          Create a ShowFile instance.
ShowFile(java.lang.String fileName, int questionCount, int opCount)
          Create a ShowFile instance.
 
Method Summary
 void close()
          Close the ShowFile.
 void writeSnap(java.lang.String title, double titleFontSize, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, double titleFontSize, java.lang.String docURI, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, double titleFontSize, java.lang.String docURI, java.lang.String pseudoURI, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, double titleFontSize, java.lang.String docURI, java.lang.String pseudoURI, question q, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, double titleFontSize, java.lang.String docURI, java.lang.String pseudoURI, java.lang.String audio_text, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, double titleFontSize, java.lang.String docURI, java.lang.String pseudoURI, java.lang.String audio_text, question q, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, java.lang.String docURI, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, java.lang.String docURI, java.lang.String pseudoURI, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, java.lang.String docURI, java.lang.String pseudoURI, question q, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, java.lang.String docURI, java.lang.String pseudoURI, java.lang.String audio_text, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 void writeSnap(java.lang.String title, java.lang.String docURI, java.lang.String pseudoURI, java.lang.String audio_text, question q, GAIGSdatastr... ds)
          Write a snapshot to the output file.
 
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, clearError, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShowFile

public ShowFile(java.lang.String fileName)
         throws java.io.IOException
Create a ShowFile instance. Open the output file, write the preliminary XML to it, and create a default question collection.

Parameters:
fileName - The file name of the ShowFile to be created.
Throws:
java.io.IOException

ShowFile

public ShowFile(java.lang.String fileName,
                int questionCount)
         throws java.io.IOException
Create a ShowFile instance. Open the output file, write the preliminary XML to it, and create a default question collection. Uses probabilistic questioning based on questionCount.

Parameters:
fileName - The file name of the ShowFile to be created.
questionCount - The number of questions to be asked.
Throws:
java.io.IOException

ShowFile

public ShowFile(java.lang.String fileName,
                int questionCount,
                int opCount)
         throws java.io.IOException
Create a ShowFile instance. Open the output file, write the preliminary XML to it, and create a default question collection. Uses probabilistic questioning based on questionCount and opCount.

Parameters:
fileName - The file name of the ShowFile to be created.
questionCount - The number of questions to be asked.
opCount - The estimated number of questions opportunities.
Throws:
java.io.IOException
Method Detail

writeSnap

public void writeSnap(java.lang.String title,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. No documentation, pseudocode, audio or questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      double titleFontSize,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. No documentation, pseudocode, audio, or questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
titleFontSize - The font size of the title.
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      java.lang.String docURI,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Only documentation is associated with this snapshot.

Parameters:
title - The title of the snapshot.
docURI - The uri of the associated documentation (Do not pass null for docURI!).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      double titleFontSize,
                      java.lang.String docURI,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Only documentation is associated with this snapshot.

Parameters:
title - The title of the snapshot.
titleFontSize - The font size of the title.
docURI - The uri of the associated documentation (Do not pass null for documentation!).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, pseudocode but no questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (Do not pass null for pseudocode!).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      java.lang.String audio_text,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, pseudocode, audio, but no questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (Do not pass null for pseudocode!).
audio_text - The string to be spoken. (If the string contains '.au' or '.wav', the assumption is made that this is a url for an audio file. Otherwise the speech-to-text module is used to speak the text.) (pass null for no audio).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      double titleFontSize,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, pseudocode but no questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
titleFontSize - The font size of the title.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (Do not pass null for pseudocode!).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      double titleFontSize,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      java.lang.String audio_text,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, pseudocode, audio, but no questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
titleFontSize - The font size of the title.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (Do not pass null for pseudocode!).
audio_text - The string to be spoken. (If the string contains '.au' or '.wav', the assumption is made that this is a url for an audio file. Otherwise the speech-to-text module is used to speak the text.) (pass null for no audio).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      question q,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, pseudocode and questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (Do not pass null for pseudocode!).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      java.lang.String audio_text,
                      question q,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, pseudocode, audio, and questions are associated with this snapshot.

Parameters:
title - The title of the snapshot.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (Do not pass null for pseudocode!).
audio_text - The string to be spoken. (If the string contains '.au' or '.wav', the assumption is made that this is a url for an audio file. Otherwise the speech-to-text module is used to speak the text.) (pass null for no audio).
ds - A varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      double titleFontSize,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      question q,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, psuedocode and a question are associated with this snapshot.

Parameters:
title - The title of the snapshot.
titleFontSize - The font size of the title.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (pass null for no pseudocode).
q - A question attached to this snapshot (Do not pass null for question!).
ds - The varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

writeSnap

public void writeSnap(java.lang.String title,
                      double titleFontSize,
                      java.lang.String docURI,
                      java.lang.String pseudoURI,
                      java.lang.String audio_text,
                      question q,
                      GAIGSdatastr... ds)
               throws java.io.IOException
Write a snapshot to the output file. Documentation, psuedocode, audio, and a question are associated with this snapshot.

Parameters:
title - The title of the snapshot.
titleFontSize - The font size of the title.
docURI - The uri of the associated documentation (pass null for no documentation).
pseudoURI - The uri of the associated pseudocode (pass null for no pseudocode).
audio_text - The string to be spoken. (If the string contains '.au' or '.wav', the assumption is made that this is a url for an audio file. Otherwise the speech-to-text module is used to speak the text.) (pass null for no audio).
q - A question attached to this snapshot (Do not pass null for question!).
ds - The varargs list of GAIGS structures in the snapshot.
Throws:
java.io.IOException

close

public void close()
Close the ShowFile. First write the QuestionCollection XML, then the terminal show tag, and then finally actually close the file.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.PrintWriter