From 37b29c8d337a080e9f53b1a304bfa3008d9bf5ad Mon Sep 17 00:00:00 2001 From: amontano Date: Sun, 3 Nov 2002 08:56:11 +0000 Subject: [PATCH] Added comments to all class headers. Comments to individual methods will be added as needed. --- source/org/thdl/tib/scanner/AboutDialog.java | 5 +++++ source/org/thdl/tib/scanner/AcipToWylie.java | 16 ++++++++++++++++ .../thdl/tib/scanner/CachedSyllableListTree.java | 8 ++++---- .../thdl/tib/scanner/ConsoleScannerFilter.java | 5 +++-- source/org/thdl/tib/scanner/Definitions.java | 6 ++++-- .../scanner/DictionaryListSelectionListener.java | 2 +- .../org/thdl/tib/scanner/DuffScannerPanel.java | 4 +++- .../thdl/tib/scanner/FileSyllableListTree.java | 4 ++-- source/org/thdl/tib/scanner/Link.java | 8 ++++++++ source/org/thdl/tib/scanner/LinkedList.java | 6 ++++++ source/org/thdl/tib/scanner/ListIterator.java | 8 ++++++++ .../thdl/tib/scanner/LocalTibetanScanner.java | 7 +++++++ source/org/thdl/tib/scanner/Manipulate.java | 14 ++++++++------ .../thdl/tib/scanner/MemorySyllableListTree.java | 14 ++++++++++++++ .../thdl/tib/scanner/OnLineScannerFilter.java | 8 ++++++++ source/org/thdl/tib/scanner/PunctuationMark.java | 8 ++++++++ .../thdl/tib/scanner/RemoteScannerFilter.java | 7 +++++++ .../thdl/tib/scanner/RemoteTibetanScanner.java | 7 +++++++ .../org/thdl/tib/scanner/SimpleScannerPanel.java | 10 ++++++++++ .../org/thdl/tib/scanner/SyllableListTree.java | 6 ++++++ source/org/thdl/tib/scanner/TibetanScanner.java | 4 ++++ source/org/thdl/tib/scanner/Token.java | 6 ++++++ .../thdl/tib/scanner/WindowScannerFilter.java | 8 ++++++++ source/org/thdl/tib/scanner/Word.java | 4 ++++ 24 files changed, 157 insertions(+), 18 deletions(-) diff --git a/source/org/thdl/tib/scanner/AboutDialog.java b/source/org/thdl/tib/scanner/AboutDialog.java index d125601..c86aa38 100644 --- a/source/org/thdl/tib/scanner/AboutDialog.java +++ b/source/org/thdl/tib/scanner/AboutDialog.java @@ -21,6 +21,11 @@ package org.thdl.tib.scanner; import java.awt.*; import java.awt.event.*; +/** Window that displays copyright stuff. + + @author Andrés Montano Pellegrini + @see WindowScannerFilter +*/ class AboutDialog extends Dialog implements ActionListener, WindowListener { public AboutDialog(Frame parent) diff --git a/source/org/thdl/tib/scanner/AcipToWylie.java b/source/org/thdl/tib/scanner/AcipToWylie.java index e4e8c38..f7f1485 100644 --- a/source/org/thdl/tib/scanner/AcipToWylie.java +++ b/source/org/thdl/tib/scanner/AcipToWylie.java @@ -21,6 +21,14 @@ package org.thdl.tib.scanner; import java.net.*; import java.io.*; +/** Provides interfase to convert from tibetan text transliterated in + the Acip scheme to THDL's extended wylie scheme. + + @author Andrés Montano Pellegrini + @see WindowScannerFilter + @see Manipulate +*/ + public class AcipToWylie { private BufferedReader in; @@ -32,6 +40,14 @@ public class AcipToWylie this.out = out; } + /** Simply constructs object and invokes #run(). + @param args If no arguments are sent, it takes the ACIP text + from the standard input and sends the wylie text to the standard + output. If one argument is sent, it interprets it as the + file name for the input. If two arguments are sent, it + interprets the first one as the file name for the input and + the second one as the file name for the output. + */ public static void main (String[] args) throws Exception { PrintWriter out; diff --git a/source/org/thdl/tib/scanner/CachedSyllableListTree.java b/source/org/thdl/tib/scanner/CachedSyllableListTree.java index 3b06fea..406b100 100644 --- a/source/org/thdl/tib/scanner/CachedSyllableListTree.java +++ b/source/org/thdl/tib/scanner/CachedSyllableListTree.java @@ -19,13 +19,13 @@ package org.thdl.tib.scanner; import java.io.*; -/** Provides recommended implementation of the SyllableListTree +/** Provides recommended implementation of the {@link SyllableListTree} (currently most efficient memory-speed combination) loading - into memory only the "trunk" of the tree, and - searching the rest of the tree directly in the file. + from file into memory only the "trunk" of the tree, + and resorting to the disk when searching the rest of the tree.

The words must be stored in a binary file tree structure format. - This can be done using the BinaryFileGenerator.

+ This can be done using the {@link BinaryFileGenerator}.

@author Andrés Montano Pellegrini @see TibetanScanner diff --git a/source/org/thdl/tib/scanner/ConsoleScannerFilter.java b/source/org/thdl/tib/scanner/ConsoleScannerFilter.java index 2b767b4..a16a209 100644 --- a/source/org/thdl/tib/scanner/ConsoleScannerFilter.java +++ b/source/org/thdl/tib/scanner/ConsoleScannerFilter.java @@ -21,8 +21,9 @@ import java.io.*; import java.net.*; import java.util.*; -/** Inputs a Tibetan text and displays the words with - their definitions through the console over a shell. +/** Inputs a Tibetan text and displays the words with their + definitions through the console over a shell. Use when no + graphical interfase is supported or for batch processes. @author Andrés Montano Pellegrini */ diff --git a/source/org/thdl/tib/scanner/Definitions.java b/source/org/thdl/tib/scanner/Definitions.java index bb1f968..dcf2c9f 100644 --- a/source/org/thdl/tib/scanner/Definitions.java +++ b/source/org/thdl/tib/scanner/Definitions.java @@ -16,12 +16,14 @@ Pellegrini. All Rights Reserved. Contributor(s): ______________________________________. */ +package org.thdl.tib.scanner; + /** Stores the multiple definitions (corresponding to various dictionaries) for a single Tibetan word. - + + @see Word @author Andrés Montano Pellegrini */ -package org.thdl.tib.scanner; public class Definitions { diff --git a/source/org/thdl/tib/scanner/DictionaryListSelectionListener.java b/source/org/thdl/tib/scanner/DictionaryListSelectionListener.java index 7e9ab8a..db43920 100644 --- a/source/org/thdl/tib/scanner/DictionaryListSelectionListener.java +++ b/source/org/thdl/tib/scanner/DictionaryListSelectionListener.java @@ -23,7 +23,7 @@ import java.awt.*; import javax.swing.table.*; /** Used by the DictionaryTable to display the full definition - of Tibetan word displaed in a table when its row is clicked. + of Tibetan word displayed in a table when its row is clicked. @author Andrés Montano Pellegrini @see DictionaryTable diff --git a/source/org/thdl/tib/scanner/DuffScannerPanel.java b/source/org/thdl/tib/scanner/DuffScannerPanel.java index 7121f41..1490619 100644 --- a/source/org/thdl/tib/scanner/DuffScannerPanel.java +++ b/source/org/thdl/tib/scanner/DuffScannerPanel.java @@ -26,10 +26,12 @@ import org.thdl.tib.input.DuffPane; /** Graphical interfase to be used by applications and applets to input a Tibetan text (in Roman or Tibetan script) and - displays the words (in Roman or Tibetan script) with their + display the words (in Roman or Tibetan script) with their definitions (in Roman script). Uses the THDL inputting system. @author Andrés Montano Pellegrini + @see WindowScannerFilter + @see AppletScannerFilter */ public class DuffScannerPanel extends ScannerPanel { diff --git a/source/org/thdl/tib/scanner/FileSyllableListTree.java b/source/org/thdl/tib/scanner/FileSyllableListTree.java index 6279b59..5b72071 100644 --- a/source/org/thdl/tib/scanner/FileSyllableListTree.java +++ b/source/org/thdl/tib/scanner/FileSyllableListTree.java @@ -21,10 +21,10 @@ import java.io.*; /** Searches the words directly in a file; not the preferred implementation. The search is too slow! - The preferred implementation is the CachedSyllableListTree. + The preferred implementation is the {@link CachedSyllableListTree}.

The words must be stored in a binary file tree structure format. - This can be done using the BinaryFileGenerator.

+ This can be done using the {@link BinaryFileGenerator}.

@author Andrés Montano Pellegrini @see TibetanScanner diff --git a/source/org/thdl/tib/scanner/Link.java b/source/org/thdl/tib/scanner/Link.java index d34266c..4944570 100644 --- a/source/org/thdl/tib/scanner/Link.java +++ b/source/org/thdl/tib/scanner/Link.java @@ -19,6 +19,14 @@ Contributor(s): ______________________________________. package org.thdl.tib.scanner; import java.io.*; +/** Used by {@link LinkedList} to provide the implementation of a + simple dynamic link list. + + @author Andrés Montano Pellegrini + @see LinkedList + @see ListIterator +*/ + class Link { private Object obj; diff --git a/source/org/thdl/tib/scanner/LinkedList.java b/source/org/thdl/tib/scanner/LinkedList.java index 21bb388..5b01ec5 100644 --- a/source/org/thdl/tib/scanner/LinkedList.java +++ b/source/org/thdl/tib/scanner/LinkedList.java @@ -19,6 +19,12 @@ Contributor(s): ______________________________________. package org.thdl.tib.scanner; import java.util.*; +/** Implementation of a simple dynamic link list. Be careful with word order! + + @author Andrés Montano Pellegrini + @see Link + @see ListIterator +*/ public class LinkedList { protected Link cabeza; diff --git a/source/org/thdl/tib/scanner/ListIterator.java b/source/org/thdl/tib/scanner/ListIterator.java index 0b27b84..0c5c405 100644 --- a/source/org/thdl/tib/scanner/ListIterator.java +++ b/source/org/thdl/tib/scanner/ListIterator.java @@ -19,6 +19,14 @@ Contributor(s): ______________________________________. package org.thdl.tib.scanner; import java.util.*; +/** Used by {@link LinkedList} to provide the implementation of a + simple dynamic link list. + + @author Andrés Montano Pellegrini + @see LinkedList + @see Link +*/ + public class ListIterator { Link current; diff --git a/source/org/thdl/tib/scanner/LocalTibetanScanner.java b/source/org/thdl/tib/scanner/LocalTibetanScanner.java index 6816ba2..54449a1 100644 --- a/source/org/thdl/tib/scanner/LocalTibetanScanner.java +++ b/source/org/thdl/tib/scanner/LocalTibetanScanner.java @@ -20,6 +20,13 @@ package org.thdl.tib.scanner; import java.util.*; import java.io.*; +/** Loads dictionary stored in tree format and searches for words recursively. + How the the dictionary is loaded depends on which implementation of + {@link SyllableListTree} is invoked. + + @author Andrés Montano Pellegrini + @see SyllableListTree +*/ class LocalTibetanScanner implements TibetanScanner { public static String archivo; diff --git a/source/org/thdl/tib/scanner/Manipulate.java b/source/org/thdl/tib/scanner/Manipulate.java index 40601cb..f4aad9a 100644 --- a/source/org/thdl/tib/scanner/Manipulate.java +++ b/source/org/thdl/tib/scanner/Manipulate.java @@ -20,9 +20,7 @@ package org.thdl.tib.scanner; import java.io.*; -/** Takes the output of ConsoleScannerFilter - (in RY format), converts the Wylie to Acip - and displays the result in csv format. +/** Miscelaneous methods for the manipulation of Tibetan text. @author Andrés Montano Pellegrini */ @@ -220,9 +218,13 @@ public class Manipulate return linea; } - /** - * Sintaxis: java Manipulate [arch-palabras] < dict-orig > dict-dest - * + /** Not really important. + + Sintaxis: java Manipulate [word-file] < source-dic-entries > dest-dic-entries + + Takes the output of ConsoleScannerFilter + (in RY format), converts the Wylie to Acip + and displays the result in csv format. * arch-palabras es usado solo cuando deseamos las palabras cambiadas * a otro archivo. */ diff --git a/source/org/thdl/tib/scanner/MemorySyllableListTree.java b/source/org/thdl/tib/scanner/MemorySyllableListTree.java index dc1a312..9330c5f 100644 --- a/source/org/thdl/tib/scanner/MemorySyllableListTree.java +++ b/source/org/thdl/tib/scanner/MemorySyllableListTree.java @@ -20,6 +20,20 @@ package org.thdl.tib.scanner; import java.util.*; import java.io.*; +/** Loads the whole dictionary into memory; not the preferred + implementation. Provides the fastest search, but takes up to + much resources. The preferred implementation is the + {@link CachedSyllableListTree}. + +

The words must be stored in a binary file tree structure format. + This can be done using the {@link BinaryFileGenerator}.

+ + @author Andrés Montano Pellegrini + @see TibetanScanner + @see CachedSyllableListTree + @see BinaryFileGenerator +*/ + public class MemorySyllableListTree extends LinkedList implements SyllableListTree { protected String sil, def; diff --git a/source/org/thdl/tib/scanner/OnLineScannerFilter.java b/source/org/thdl/tib/scanner/OnLineScannerFilter.java index 3c97366..0cf372b 100644 --- a/source/org/thdl/tib/scanner/OnLineScannerFilter.java +++ b/source/org/thdl/tib/scanner/OnLineScannerFilter.java @@ -25,6 +25,14 @@ import javax.servlet.*; import javax.servlet.http.*; import org.thdl.tib.text.TibetanHTML; +/** Interfase to provide access to an on-line dictionary through a form in html; + Inputs Tibetan text (Roman script only) and displays the + words (Roman or Tibetan script) with their definitions. + Runs on the server and is called upon through an HTTP request directly + by the browser. Requires no additional software installed on the client. + + @author Andrés Montano Pellegrini +*/ public class OnLineScannerFilter extends HttpServlet { ResourceBundle rb; diff --git a/source/org/thdl/tib/scanner/PunctuationMark.java b/source/org/thdl/tib/scanner/PunctuationMark.java index 9aa8d08..d0fc5c5 100644 --- a/source/org/thdl/tib/scanner/PunctuationMark.java +++ b/source/org/thdl/tib/scanner/PunctuationMark.java @@ -18,6 +18,14 @@ Contributor(s): ______________________________________. package org.thdl.tib.scanner; +/** Right now, it only used by {@link LocalTibetanScanner} to + separate "paragraphs"; eventually it will be one + of many tokens representing grammatical parts of the sentences that will be + interpreted by the parser. + + @author Andrés Montano Pellegrini + @see LocalTibetanScanner +*/ class PunctuationMark extends Token { public PunctuationMark(char ch) diff --git a/source/org/thdl/tib/scanner/RemoteScannerFilter.java b/source/org/thdl/tib/scanner/RemoteScannerFilter.java index 0b642cc..5bb5813 100644 --- a/source/org/thdl/tib/scanner/RemoteScannerFilter.java +++ b/source/org/thdl/tib/scanner/RemoteScannerFilter.java @@ -24,6 +24,13 @@ import java.util.*; import javax.servlet.*; import javax.servlet.http.*; +/** Running on the server, receives the tibetan text from applet/applications running on + the client and sends them the words with their definitions through the Internet. + Requests are made through {@link RemoteTibetanScanner}. + + @author Andrés Montano Pellegrini + @see RemoteTibetanScanner +*/ public class RemoteScannerFilter extends GenericServlet { private TibetanScanner scanner; diff --git a/source/org/thdl/tib/scanner/RemoteTibetanScanner.java b/source/org/thdl/tib/scanner/RemoteTibetanScanner.java index 832fc01..4d3f8bf 100644 --- a/source/org/thdl/tib/scanner/RemoteTibetanScanner.java +++ b/source/org/thdl/tib/scanner/RemoteTibetanScanner.java @@ -20,6 +20,13 @@ package org.thdl.tib.scanner; import java.net.*; import java.io.*; +/** Used by applets and applications to access remote on-line dictionaries. + Sends Tibetan text, and receives the words with their definitions. The + {@link RemoteScannerFilter} receives the requests on the server. + + @author Andrés Montano Pellegrini + @see RemoteScannerFilter +*/ public class RemoteTibetanScanner implements TibetanScanner { private String url; diff --git a/source/org/thdl/tib/scanner/SimpleScannerPanel.java b/source/org/thdl/tib/scanner/SimpleScannerPanel.java index a5dd772..97ac944 100644 --- a/source/org/thdl/tib/scanner/SimpleScannerPanel.java +++ b/source/org/thdl/tib/scanner/SimpleScannerPanel.java @@ -20,6 +20,16 @@ package org.thdl.tib.scanner; import java.awt.*; import java.awt.event.*; +/** A non-Swing graphical interfase to be used by applications + running on platforms that don't support Swing, + to input a Tibetan text (in Roman script only) and + display the words (in Roman script only) with their + definitions (in Roman script). + + @author Andrés Montano Pellegrini + @see WindowScannerFilter +*/ + public class SimpleScannerPanel extends ScannerPanel { private TextArea txtInput, txtOutput; diff --git a/source/org/thdl/tib/scanner/SyllableListTree.java b/source/org/thdl/tib/scanner/SyllableListTree.java index 7fe7cef..15101c6 100644 --- a/source/org/thdl/tib/scanner/SyllableListTree.java +++ b/source/org/thdl/tib/scanner/SyllableListTree.java @@ -27,6 +27,12 @@ Contributor(s): ______________________________________. package org.thdl.tib.scanner; +/** The generic interface for accesing dictionaries. An instance of + a SyllableListTree represents a node containing a syllable, a definition + (if it is the last syllable of a word) and links to its "children". + + @author Andrés Montano Pellegrini +*/ public interface SyllableListTree { public String getDef(); diff --git a/source/org/thdl/tib/scanner/TibetanScanner.java b/source/org/thdl/tib/scanner/TibetanScanner.java index c879513..7296f02 100644 --- a/source/org/thdl/tib/scanner/TibetanScanner.java +++ b/source/org/thdl/tib/scanner/TibetanScanner.java @@ -19,6 +19,10 @@ Contributor(s): ______________________________________. package org.thdl.tib.scanner; import java.util.*; +/** Defines the core methods required to provide access to a dictionary; local or remote. + + @author Andrés Montano Pellegrini +*/ public interface TibetanScanner { public static final String copyrightUnicode="Copyright " + '\u00A9' + " 2000-2002 by Andr" + '\u00E9' + "s Montano Pellegrini, all rights reserved."; diff --git a/source/org/thdl/tib/scanner/Token.java b/source/org/thdl/tib/scanner/Token.java index 5f9ef0c..c2a5676 100644 --- a/source/org/thdl/tib/scanner/Token.java +++ b/source/org/thdl/tib/scanner/Token.java @@ -17,6 +17,12 @@ Contributor(s): ______________________________________. */ package org.thdl.tib.scanner; + +/** Represents a basic grammatical unit; seems unnecessary but when the parser + is developed it will make sense. + + @author Andrés Montano Pellegrini +*/ public class Token { protected String token; diff --git a/source/org/thdl/tib/scanner/WindowScannerFilter.java b/source/org/thdl/tib/scanner/WindowScannerFilter.java index 0205fe5..bf711f7 100644 --- a/source/org/thdl/tib/scanner/WindowScannerFilter.java +++ b/source/org/thdl/tib/scanner/WindowScannerFilter.java @@ -28,6 +28,14 @@ import java.awt.datatransfer.*; import javax.swing.text.JTextComponent; import org.thdl.tib.input.DuffPane; +/** Provides a graphical interfase to input Tibetan text (Roman or + Tibetan script) and displays the words (Roman or Tibetan script) + with their definitions. Works without Tibetan script in + platforms that don't support Swing. Can access dictionaries stored + locally or remotely. + + @author Andrés Montano Pellegrini +*/ public class WindowScannerFilter implements WindowListener, FocusListener, ActionListener, ItemListener { private ScannerPanel sp; diff --git a/source/org/thdl/tib/scanner/Word.java b/source/org/thdl/tib/scanner/Word.java index 861ebcc..3c72cb0 100644 --- a/source/org/thdl/tib/scanner/Word.java +++ b/source/org/thdl/tib/scanner/Word.java @@ -22,6 +22,10 @@ package org.thdl.tib.scanner; import org.thdl.tib.text.TibetanHTML; +/** Tibetan word with its corresponding definitions. + + @author Andrés Montano Pellegrini +*/ public class Word extends Token { /** Used to rebuild the text the user entered. */