diff options
author | Martin Gruner <mg.pub@gmx.net> | 2005-06-01 20:02:04 +0000 |
---|---|---|
committer | Martin Gruner <mg.pub@gmx.net> | 2005-06-01 20:02:04 +0000 |
commit | a81f9438f49c04b3ae2317eac0a7030b69f3ac1c (patch) | |
tree | 6baee296bab6f681e36464dc5f7916d1ba47bfed /modules/hebrew-wlc | |
parent | 84677a0fef8ef467202dde5ceceab18ab6714d3c (diff) | |
download | sword-tools-a81f9438f49c04b3ae2317eac0a7030b69f3ac1c.tar.gz |
update^
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@38 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'modules/hebrew-wlc')
31 files changed, 3300 insertions, 3300 deletions
diff --git a/modules/hebrew-wlc/WLC2OSIS/Utilities/FileChooser.java b/modules/hebrew-wlc/WLC2OSIS/Utilities/FileChooser.java index 2e1b5e7..ed8d1a7 100644 --- a/modules/hebrew-wlc/WLC2OSIS/Utilities/FileChooser.java +++ b/modules/hebrew-wlc/WLC2OSIS/Utilities/FileChooser.java @@ -1,165 +1,165 @@ -package Utilities;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.io.File ;
-//==============================================================================
-/**
-*
-* <b>Positionable version of JFileChooser.</b><p>
-*
-* (The JFileChooser position isn't set or read by setLocation(...)
-* or getLocation.)<p>
-*
-*
-*<pre>
-*Dear Mr. Kimball,
-*
-*This is a known bug:
-*
-* http://developer.java.sun.com/developer/bugParade/bugs/4390885.html
-*
-*We are working on a solution for a later release. In the meantime, the
-*only workaround I can think of is to subclass JFileChooser and override
-*the method showDialog(), adding a call to setLocation().
-*
-*See example code below.
-*
-*Regards,
-*
-*Leif Samuelsson
-*
-*Sun Microsystems, Inc.
-*Java Swing Team
-*</pre>
-*/
-//==============================================================================
-
-public class FileChooser extends JFileChooser {
- private JDialog dialog;
-
- private int returnValue = ERROR_OPTION;
- private Point Location = new Point(250, 250) ;
- private Dimension Size = new Dimension( 600, 250) ;
-
-//------------------------------------------------------------------------------
-/**
-*
-* Constructor is the same as the no-argument version of JFileChooser.<p>
-*
-* Use setCurrentDirectory to set the initial directory.
-*
-*/
- public FileChooser(){
- super() ;
- }
-//------------------------------------------------------------------------------\/**
-
-/** Replaces showDialog of JFileChooser */
-
- public int showDialog(Component parent, String approveButtonText) {
- if (approveButtonText != null) {
- setApproveButtonText(approveButtonText);
- setDialogType(CUSTOM_DIALOG);
- }
-
- Frame frame = parent instanceof Frame ? (Frame) parent
- : (Frame)SwingUtilities.getAncestorOfClass(Frame.class, parent);
- String title = getUI().getDialogTitle(this);
-
- dialog = new JDialog(frame, title, true);
- dialog.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- returnValue = CANCEL_OPTION;
- }
- });
- dialog.getContentPane().add(this, BorderLayout.CENTER);
- dialog.pack();
- dialog.setLocation(Location) ;
- dialog.setSize(Size) ;
-
- rescanCurrentDirectory();
- returnValue = ERROR_OPTION;
-
- dialog.show();
- Location = dialog.getLocation() ;
- Size = dialog.getSize() ;
- return returnValue;
- }
-//------------------------------------------------------------------------------\/**
-
-/** Replaces approveSelection of JFileChooser */
- public void approveSelection() {
- returnValue = APPROVE_OPTION;
- if (dialog != null) {
- dialog.setVisible(false);
- }
- super.approveSelection();
- }
-//------------------------------------------------------------------------------\/**
-
-/** Replaces cancelSelection of JFileChooser */
- public void cancelSelection() {
- returnValue = CANCEL_OPTION;
- if (dialog != null) {
- dialog.setVisible(false);
- }
- super.cancelSelection();
- }
-//------------------------------------------------------------------------------\/**
-
-/** Sets the location of the FileChooser */
-
-public void setLocation(Point P) {
- this.Location = P ;
- }
-//------------------------------------------------------------------------------\/**
-
-/** Sets the size of the FileChooser */
-
-public void setSize(Dimension D) {
- this.Size = D ;
- }
-//------------------------------------------------------------------------------\/**
-
-/** Returns the location of the FileChooser */
-
-public Point getLocation() {
- return Location ;
- }
-//------------------------------------------------------------------------------\/**
-
-/** Returns the size of the FileChooser */
-
-public Dimension getSize() {
- return Size ;
- }
-//------------------------------------------------------------------------------\/**
-
-/** Test program provided by Leif Samuelsson */
-
- public static void main(String[] s) throws Exception {
- JFrame frame = new JFrame("FileChooser test");
- frame.setVisible(true);
- JFileChooser chooser = new FileChooser();
- chooser.setLocation(new Point(200,200)) ;
- int returnVal = chooser.showOpenDialog(frame);
- System.out.println("Position: " + chooser.getLocation()) ;
- switch (returnVal) {
- case APPROVE_OPTION:
- System.out.println("You chose to open this file: " + chooser.getSelectedFile().getName());
- break;
-
- case CANCEL_OPTION:
- System.out.println("Cancelled");
- break;
-
- case ERROR_OPTION:
- System.out.println("An error occurred");
- break;
- }
- System.exit(0);
- }
-}
-//==============================================================================
+package Utilities; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.io.File ; +//============================================================================== +/** +* +* <b>Positionable version of JFileChooser.</b><p> +* +* (The JFileChooser position isn't set or read by setLocation(...) +* or getLocation.)<p> +* +* +*<pre> +*Dear Mr. Kimball, +* +*This is a known bug: +* +* http://developer.java.sun.com/developer/bugParade/bugs/4390885.html +* +*We are working on a solution for a later release. In the meantime, the +*only workaround I can think of is to subclass JFileChooser and override +*the method showDialog(), adding a call to setLocation(). +* +*See example code below. +* +*Regards, +* +*Leif Samuelsson +* +*Sun Microsystems, Inc. +*Java Swing Team +*</pre> +*/ +//============================================================================== + +public class FileChooser extends JFileChooser { + private JDialog dialog; + + private int returnValue = ERROR_OPTION; + private Point Location = new Point(250, 250) ; + private Dimension Size = new Dimension( 600, 250) ; + +//------------------------------------------------------------------------------ +/** +* +* Constructor is the same as the no-argument version of JFileChooser.<p> +* +* Use setCurrentDirectory to set the initial directory. +* +*/ + public FileChooser(){ + super() ; + } +//------------------------------------------------------------------------------\/** + +/** Replaces showDialog of JFileChooser */ + + public int showDialog(Component parent, String approveButtonText) { + if (approveButtonText != null) { + setApproveButtonText(approveButtonText); + setDialogType(CUSTOM_DIALOG); + } + + Frame frame = parent instanceof Frame ? (Frame) parent + : (Frame)SwingUtilities.getAncestorOfClass(Frame.class, parent); + String title = getUI().getDialogTitle(this); + + dialog = new JDialog(frame, title, true); + dialog.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + returnValue = CANCEL_OPTION; + } + }); + dialog.getContentPane().add(this, BorderLayout.CENTER); + dialog.pack(); + dialog.setLocation(Location) ; + dialog.setSize(Size) ; + + rescanCurrentDirectory(); + returnValue = ERROR_OPTION; + + dialog.show(); + Location = dialog.getLocation() ; + Size = dialog.getSize() ; + return returnValue; + } +//------------------------------------------------------------------------------\/** + +/** Replaces approveSelection of JFileChooser */ + public void approveSelection() { + returnValue = APPROVE_OPTION; + if (dialog != null) { + dialog.setVisible(false); + } + super.approveSelection(); + } +//------------------------------------------------------------------------------\/** + +/** Replaces cancelSelection of JFileChooser */ + public void cancelSelection() { + returnValue = CANCEL_OPTION; + if (dialog != null) { + dialog.setVisible(false); + } + super.cancelSelection(); + } +//------------------------------------------------------------------------------\/** + +/** Sets the location of the FileChooser */ + +public void setLocation(Point P) { + this.Location = P ; + } +//------------------------------------------------------------------------------\/** + +/** Sets the size of the FileChooser */ + +public void setSize(Dimension D) { + this.Size = D ; + } +//------------------------------------------------------------------------------\/** + +/** Returns the location of the FileChooser */ + +public Point getLocation() { + return Location ; + } +//------------------------------------------------------------------------------\/** + +/** Returns the size of the FileChooser */ + +public Dimension getSize() { + return Size ; + } +//------------------------------------------------------------------------------\/** + +/** Test program provided by Leif Samuelsson */ + + public static void main(String[] s) throws Exception { + JFrame frame = new JFrame("FileChooser test"); + frame.setVisible(true); + JFileChooser chooser = new FileChooser(); + chooser.setLocation(new Point(200,200)) ; + int returnVal = chooser.showOpenDialog(frame); + System.out.println("Position: " + chooser.getLocation()) ; + switch (returnVal) { + case APPROVE_OPTION: + System.out.println("You chose to open this file: " + chooser.getSelectedFile().getName()); + break; + + case CANCEL_OPTION: + System.out.println("Cancelled"); + break; + + case ERROR_OPTION: + System.out.println("An error occurred"); + break; + } + System.exit(0); + } +} +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/Utilities/Fmt.java b/modules/hebrew-wlc/WLC2OSIS/Utilities/Fmt.java index 193ab42..de6ae93 100644 --- a/modules/hebrew-wlc/WLC2OSIS/Utilities/Fmt.java +++ b/modules/hebrew-wlc/WLC2OSIS/Utilities/Fmt.java @@ -1,355 +1,355 @@ -package Utilities ;
-
-import java.text.* ;
-import java.text.Format.* ;
-import java.io.* ;
-import java.awt.*;
-//==============================================================================
-/**
-*
-* <b>Formating tools.</b><p>
-*
-* <pre>
-* F = new Fmt() ;
-* System.out.println(F.i(2,10)) ; // 10 digit integer field.
-* System.out.println(F.f(3.1415,10, 2)) ; // 10 digit F10.2 field.
-* System.out.println(F.fill("-", 10)) ; // 10 digits of "-".
-* System.out.println(F.prepad(F.fill("-",10), 12) ;
-* // 2 digits of blank before fill.
-* </pre>
-*
-*/
-//==============================================================================
-
-public class Fmt{
-
-NumberFormat NF = NumberFormat.getInstance() ; // Provides commas in integers
-
-//-----------------------------------------------------------------------------
-/**
-* Simple constructor: Fmt F = new Fmt() ;
-*
-*/
-public Fmt(){
-}
-//-----------------------------------------------------------------------------
-/**
-*
-* Yields a string of specified FieldWidth and DecimalDigits containing
-* the given double.<p>
-*
-* @param f double to be converted.
-* @param FieldWidth Maximum number of characters to be produced. If more
-* characters are produced, the field is filled with *.
-* @param DecimalDigits int number of points after the decimal point.
-* @return String String of exactly FieldWidth characters.
-*
-*/
-public String f( double f, int FieldWidth, int DecimalDigits) {
- if(DecimalDigits>FieldWidth-2){
- String s = fill("!", FieldWidth) ;
- return s ;
- }
- String FormatString = "0." ;
- for (int k = 0; k < DecimalDigits; k++){
- FormatString = FormatString + "0" ;
- }
- while (FormatString.length() < FieldWidth){
- FormatString = "#" + FormatString ;
- }
-
- DecimalFormat DF = new DecimalFormat(FormatString) ;
- String s = DF.format(f) ;
- if (s.length()< FieldWidth){
- s = prepad(s, FieldWidth) ;
- }
- else if(s.length()>FieldWidth){
- s = fill("*", FieldWidth) ;
- }
- return s ;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Yields a string of specified FieldWidth containing the given integer.<p>
-*
-* @param i integer to be converted.
-* @param FieldWidth Maximum number of characters to be produced. If more
-* characters are produced, the field is filled with *.
-* @return String String of exactly FieldWidth characters.
-*
-*/
-public String i( int i, int FieldWidth) {
- String s = NF.format(i) ;
- if (s.length()< FieldWidth){
- s = prepad(s, FieldWidth) ;
- }
- else if(s.length()>FieldWidth){
- s = "";
- for(int k = 0; k<FieldWidth; k++){
- s = s + "*" ;
- }
- }
- return s ;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Yields a string containing the given integer.<p>
-*
-* @param i integer to be converted.
-* @return String String representing i.
-*
-*/
-public String i( int i) {
- return NF.format(i) ;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Yields a string of Width specified characters.<p>
-*
-* @param c String (usually a single character) to be repeated.
-* @param Width int number of times to repeat S.
-* @return String of Width characters.
-*
-*/
-public String fill( String c, int Width){
- String s = "" ;
- for(int i = 0; i < Width; i++){
- s = s + c ;
- }
- return s;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Prints a string of Width specified characters to a specified PrintStream.<p>
-*
-* @param P PrintStream such as System.out.
-* @param c String (usually a single character) to be repeated.
-* @param Width int number of times to repeat S.
-*
-*/
-public void bar(PrintStream P, String c, int Width){
- String s = "" ;
- for(int i = 0; i < Width; i++){
- s = s + c ;
- }
- P.println(s) ;
- return ;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Prints a string of Width specified characters to System.out.<p>
-*
-* @param c String (usually a single character) to be repeated.
-* @param Width int number of times to repeat S.
-* @return String String of Width characters.
-*
-*/
-public void bar(String c, int Width){
- bar(System.out, c, Width) ;
- return ;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Removes blanks anywhere in String.<p>
-*
-* @param c String to be deblanked.
-* @return String String without any blanks.
-*
-*/
-public String deblank(String c){
- String s = "" ;
- for (int i = 0; i < c.length(); i++){
- if(c.charAt(i) != ' '){
- s = s + c.charAt(i) ;
- }
- }
- return s ;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Pads the front of a String, giving a String of a specified length.<p>
-*
-* @param s String to be prepaded.
-* @param n Desired length of output string.
-* @return String Prepadded String.
-*
-*/
-public String prepad(String s, int n){
- int len = s.length() ;
- if (len == n){ // String is already long enough.
- return s ;
- }
- else if(len > n){
- return fill("!", n) ;
- }
-// Prepad
- String OutString = "" ;
- int Pads = n - len ;
- for (int i = 0; i < Pads; i++){
- OutString = OutString + " " ;
- }
-// Original String
- OutString = OutString + s ;
- return OutString ;
- }
-//-----------------------------------------------------------------------------
-/**
-*
-* Pads the end of a String, giving a String of a specified length.<p>
-*
-* @param s String to be postpaded.
-* @param n Desired length of output string.
-* @return String Prepadded String.
-*
-*/
-public String postpad(String s, int n){
- int len = s.length() ;
- if (len == n){ // String is already long enough.
- return s ;
- }
- else if(len > n){
- return fill("!", n) ;
- }
-// Original String
-// Postpad
- String OutString = "" ;
- for (int i = 0; i < len; i++){
- OutString = OutString + s.charAt(i) ;
- }
-// Postpad
- while (OutString.length() <= n){
- OutString = OutString + " " ;
- }
- return OutString ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Gives a convenient maximum size for a text area
-* specified in rows, columns.<p>
-*
-* @param font Font of text.
-* @param rows int giving number of rows of text.
-* @param columns int giving number of columns of text.
-* @return D Dimension of best size.
-*/
-public Dimension areaSize( Font font, int rows, int columns ){
- double XFactor = 0.70 ;
-// double YFactor = 1.42;
- double YFactor = 1.65;
-
- Integer X = new Integer( font.getSize() ) ;
- double x = XFactor*X.doubleValue()*columns ;
- Integer Y = new Integer( font.getSize() ) ;
- double y = YFactor*Y.doubleValue()*rows ;
- Dimension D = new Dimension( (new Double(x)).intValue(),
- (new Double(y)).intValue() ) ;
- return D ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Gives a convenient maximum size for a text area
-* specified as a dimension.<p>
-*
-* @param font Font of text.
-* @param d Dimnsion object giving number of rows and columns of text.
-* @return D Dimension of best size.
-*/
-public Dimension areaSize( Font font, Dimension d){
- double XFactor = 0.70 ;
- double YFactor = 1.42;
-
- Integer X = new Integer( font.getSize() ) ;
- double x = XFactor*X.doubleValue()*d.getWidth() ;
- Integer Y = new Integer( font.getSize() ) ;
- double y = YFactor*Y.doubleValue()*d.getHeight() ;
- Dimension D = new Dimension( (new Double(x)).intValue(),
- (new Double(y)).intValue() ) ;
- return D ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Removes the extension, including the ".", from a file name String.<p>
-*
-* If the Name doesn't contain a ".", the original Name is returned.
-*
-* @param Name String containing file name.
-* @return String with extension and "." removed.
-*/
-public static String removeExtension( String Name){
-
- boolean HasDot = false ;
- for (int k = 0; k < Name.length() ; k++){
- if(Name.charAt(k) == '.'){
- HasDot = true ;
- }
- }
- if(!HasDot) return Name ;
-
- String NewName = "" ;
- for (int k = Name.length()-1; k >= 0; k--){
- if( Name.charAt(k) == '.'){
- for (int j = 0; j < k ; j ++) {
- NewName = NewName + Name.charAt(j) ;
- }
- break ;
- }
- }
- if (NewName == "."){
- NewName = "" ;
- }
- return NewName ;
- }
-//-----------------------------------------------------------------------------
-/**
-* gets the extension, including the ".", from a file name String.<p>
-*
-* If the Name doesn't contain a ".", the original Name is returned.
-* From Sun JFileChooser tutorial
-*
-* @param s String containing file name with extension.
-* @return String giving the extension.
-*/
-public static String getExtension( String s){
-
- String ext = "";
- int i = s.lastIndexOf('.');
-
- if (i > 0 && i < s.length() - 1) {
- ext = s.substring(i+1).toLowerCase();
- }
- return ext;
- }
-//-----------------------------------------------------------------------------
-/**
-* Prints the name of the calling location
-* plus the current Thread to System.out.<p>
-*
-* @param Location String giving location of call.
-*/
-public void printThread( String Location){
- Thread t = Thread.currentThread() ;
- System.out.println("At " + Location + ", the current Thread is "
- + t.getName() );
- return;
- }
-//-----------------------------------------------------------------------------
-/**
-* Test program.<p>
-*/
-public static void main( String[] args) {
- Fmt F = new Fmt() ;
- String Name = "XYX.txt.spa" ;
- System.out.println(Name) ;
- System.out.println(F.removeExtension(Name)) ;
- System.out.println(F.removeExtension(F.removeExtension(Name))) ;
- }
- } // End of class
-//==============================================================================
-//==============================================================================
+package Utilities ; + +import java.text.* ; +import java.text.Format.* ; +import java.io.* ; +import java.awt.*; +//============================================================================== +/** +* +* <b>Formating tools.</b><p> +* +* <pre> +* F = new Fmt() ; +* System.out.println(F.i(2,10)) ; // 10 digit integer field. +* System.out.println(F.f(3.1415,10, 2)) ; // 10 digit F10.2 field. +* System.out.println(F.fill("-", 10)) ; // 10 digits of "-". +* System.out.println(F.prepad(F.fill("-",10), 12) ; +* // 2 digits of blank before fill. +* </pre> +* +*/ +//============================================================================== + +public class Fmt{ + +NumberFormat NF = NumberFormat.getInstance() ; // Provides commas in integers + +//----------------------------------------------------------------------------- +/** +* Simple constructor: Fmt F = new Fmt() ; +* +*/ +public Fmt(){ +} +//----------------------------------------------------------------------------- +/** +* +* Yields a string of specified FieldWidth and DecimalDigits containing +* the given double.<p> +* +* @param f double to be converted. +* @param FieldWidth Maximum number of characters to be produced. If more +* characters are produced, the field is filled with *. +* @param DecimalDigits int number of points after the decimal point. +* @return String String of exactly FieldWidth characters. +* +*/ +public String f( double f, int FieldWidth, int DecimalDigits) { + if(DecimalDigits>FieldWidth-2){ + String s = fill("!", FieldWidth) ; + return s ; + } + String FormatString = "0." ; + for (int k = 0; k < DecimalDigits; k++){ + FormatString = FormatString + "0" ; + } + while (FormatString.length() < FieldWidth){ + FormatString = "#" + FormatString ; + } + + DecimalFormat DF = new DecimalFormat(FormatString) ; + String s = DF.format(f) ; + if (s.length()< FieldWidth){ + s = prepad(s, FieldWidth) ; + } + else if(s.length()>FieldWidth){ + s = fill("*", FieldWidth) ; + } + return s ; + } +//----------------------------------------------------------------------------- +/** +* +* Yields a string of specified FieldWidth containing the given integer.<p> +* +* @param i integer to be converted. +* @param FieldWidth Maximum number of characters to be produced. If more +* characters are produced, the field is filled with *. +* @return String String of exactly FieldWidth characters. +* +*/ +public String i( int i, int FieldWidth) { + String s = NF.format(i) ; + if (s.length()< FieldWidth){ + s = prepad(s, FieldWidth) ; + } + else if(s.length()>FieldWidth){ + s = ""; + for(int k = 0; k<FieldWidth; k++){ + s = s + "*" ; + } + } + return s ; + } +//----------------------------------------------------------------------------- +/** +* +* Yields a string containing the given integer.<p> +* +* @param i integer to be converted. +* @return String String representing i. +* +*/ +public String i( int i) { + return NF.format(i) ; + } +//----------------------------------------------------------------------------- +/** +* +* Yields a string of Width specified characters.<p> +* +* @param c String (usually a single character) to be repeated. +* @param Width int number of times to repeat S. +* @return String of Width characters. +* +*/ +public String fill( String c, int Width){ + String s = "" ; + for(int i = 0; i < Width; i++){ + s = s + c ; + } + return s; + } +//----------------------------------------------------------------------------- +/** +* +* Prints a string of Width specified characters to a specified PrintStream.<p> +* +* @param P PrintStream such as System.out. +* @param c String (usually a single character) to be repeated. +* @param Width int number of times to repeat S. +* +*/ +public void bar(PrintStream P, String c, int Width){ + String s = "" ; + for(int i = 0; i < Width; i++){ + s = s + c ; + } + P.println(s) ; + return ; + } +//----------------------------------------------------------------------------- +/** +* +* Prints a string of Width specified characters to System.out.<p> +* +* @param c String (usually a single character) to be repeated. +* @param Width int number of times to repeat S. +* @return String String of Width characters. +* +*/ +public void bar(String c, int Width){ + bar(System.out, c, Width) ; + return ; + } +//----------------------------------------------------------------------------- +/** +* +* Removes blanks anywhere in String.<p> +* +* @param c String to be deblanked. +* @return String String without any blanks. +* +*/ +public String deblank(String c){ + String s = "" ; + for (int i = 0; i < c.length(); i++){ + if(c.charAt(i) != ' '){ + s = s + c.charAt(i) ; + } + } + return s ; + } +//----------------------------------------------------------------------------- +/** +* +* Pads the front of a String, giving a String of a specified length.<p> +* +* @param s String to be prepaded. +* @param n Desired length of output string. +* @return String Prepadded String. +* +*/ +public String prepad(String s, int n){ + int len = s.length() ; + if (len == n){ // String is already long enough. + return s ; + } + else if(len > n){ + return fill("!", n) ; + } +// Prepad + String OutString = "" ; + int Pads = n - len ; + for (int i = 0; i < Pads; i++){ + OutString = OutString + " " ; + } +// Original String + OutString = OutString + s ; + return OutString ; + } +//----------------------------------------------------------------------------- +/** +* +* Pads the end of a String, giving a String of a specified length.<p> +* +* @param s String to be postpaded. +* @param n Desired length of output string. +* @return String Prepadded String. +* +*/ +public String postpad(String s, int n){ + int len = s.length() ; + if (len == n){ // String is already long enough. + return s ; + } + else if(len > n){ + return fill("!", n) ; + } +// Original String +// Postpad + String OutString = "" ; + for (int i = 0; i < len; i++){ + OutString = OutString + s.charAt(i) ; + } +// Postpad + while (OutString.length() <= n){ + OutString = OutString + " " ; + } + return OutString ; + } +//----------------------------------------------------------------------------- +/** +* Gives a convenient maximum size for a text area +* specified in rows, columns.<p> +* +* @param font Font of text. +* @param rows int giving number of rows of text. +* @param columns int giving number of columns of text. +* @return D Dimension of best size. +*/ +public Dimension areaSize( Font font, int rows, int columns ){ + double XFactor = 0.70 ; +// double YFactor = 1.42; + double YFactor = 1.65; + + Integer X = new Integer( font.getSize() ) ; + double x = XFactor*X.doubleValue()*columns ; + Integer Y = new Integer( font.getSize() ) ; + double y = YFactor*Y.doubleValue()*rows ; + Dimension D = new Dimension( (new Double(x)).intValue(), + (new Double(y)).intValue() ) ; + return D ; + } +//----------------------------------------------------------------------------- +/** +* Gives a convenient maximum size for a text area +* specified as a dimension.<p> +* +* @param font Font of text. +* @param d Dimnsion object giving number of rows and columns of text. +* @return D Dimension of best size. +*/ +public Dimension areaSize( Font font, Dimension d){ + double XFactor = 0.70 ; + double YFactor = 1.42; + + Integer X = new Integer( font.getSize() ) ; + double x = XFactor*X.doubleValue()*d.getWidth() ; + Integer Y = new Integer( font.getSize() ) ; + double y = YFactor*Y.doubleValue()*d.getHeight() ; + Dimension D = new Dimension( (new Double(x)).intValue(), + (new Double(y)).intValue() ) ; + return D ; + } +//----------------------------------------------------------------------------- +/** +* Removes the extension, including the ".", from a file name String.<p> +* +* If the Name doesn't contain a ".", the original Name is returned. +* +* @param Name String containing file name. +* @return String with extension and "." removed. +*/ +public static String removeExtension( String Name){ + + boolean HasDot = false ; + for (int k = 0; k < Name.length() ; k++){ + if(Name.charAt(k) == '.'){ + HasDot = true ; + } + } + if(!HasDot) return Name ; + + String NewName = "" ; + for (int k = Name.length()-1; k >= 0; k--){ + if( Name.charAt(k) == '.'){ + for (int j = 0; j < k ; j ++) { + NewName = NewName + Name.charAt(j) ; + } + break ; + } + } + if (NewName == "."){ + NewName = "" ; + } + return NewName ; + } +//----------------------------------------------------------------------------- +/** +* gets the extension, including the ".", from a file name String.<p> +* +* If the Name doesn't contain a ".", the original Name is returned. +* From Sun JFileChooser tutorial +* +* @param s String containing file name with extension. +* @return String giving the extension. +*/ +public static String getExtension( String s){ + + String ext = ""; + int i = s.lastIndexOf('.'); + + if (i > 0 && i < s.length() - 1) { + ext = s.substring(i+1).toLowerCase(); + } + return ext; + } +//----------------------------------------------------------------------------- +/** +* Prints the name of the calling location +* plus the current Thread to System.out.<p> +* +* @param Location String giving location of call. +*/ +public void printThread( String Location){ + Thread t = Thread.currentThread() ; + System.out.println("At " + Location + ", the current Thread is " + + t.getName() ); + return; + } +//----------------------------------------------------------------------------- +/** +* Test program.<p> +*/ +public static void main( String[] args) { + Fmt F = new Fmt() ; + String Name = "XYX.txt.spa" ; + System.out.println(Name) ; + System.out.println(F.removeExtension(Name)) ; + System.out.println(F.removeExtension(F.removeExtension(Name))) ; + } + } // End of class +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/Utilities/GetParentFrame.java b/modules/hebrew-wlc/WLC2OSIS/Utilities/GetParentFrame.java index 9fcd472..80e0f2a 100644 --- a/modules/hebrew-wlc/WLC2OSIS/Utilities/GetParentFrame.java +++ b/modules/hebrew-wlc/WLC2OSIS/Utilities/GetParentFrame.java @@ -1,34 +1,34 @@ -package Utilities ;
-
-import java.awt.*;
-import javax.swing.*;
-//==============================================================================
-/**
- * <b>Gets ultimate parent Frame of a component.</b><p>
- *
- * From page 274 of Pure JFC Swing.<p>
- *
- */
-//==============================================================================
-
-public class GetParentFrame{
-
-//-------------------------------------------------------------------------------
-/**
- * Gets the ultimate parent Frame of a Component.<p>
- *
- * @param comp a Component whose parent is sought.
- * @return a Frame Ultimate parent Frame of component.
- */
-static public Frame GetParentFrame(Component comp){
- if (comp instanceof Frame) return (JFrame)comp ;
- for (Component c = comp; c!= null; c = c.getParent() ){
- if (c instanceof Frame){
- return (Frame)c ;
- }
- }
- return null ;
- }
-// end of class
-}
-//==============================================================================
+package Utilities ; + +import java.awt.*; +import javax.swing.*; +//============================================================================== +/** + * <b>Gets ultimate parent Frame of a component.</b><p> + * + * From page 274 of Pure JFC Swing.<p> + * + */ +//============================================================================== + +public class GetParentFrame{ + +//------------------------------------------------------------------------------- +/** + * Gets the ultimate parent Frame of a Component.<p> + * + * @param comp a Component whose parent is sought. + * @return a Frame Ultimate parent Frame of component. + */ +static public Frame GetParentFrame(Component comp){ + if (comp instanceof Frame) return (JFrame)comp ; + for (Component c = comp; c!= null; c = c.getParent() ){ + if (c instanceof Frame){ + return (Frame)c ; + } + } + return null ; + } +// end of class +} +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/Utilities/SuperContainer.java b/modules/hebrew-wlc/WLC2OSIS/Utilities/SuperContainer.java index 7c249c5..b03c3b9 100644 --- a/modules/hebrew-wlc/WLC2OSIS/Utilities/SuperContainer.java +++ b/modules/hebrew-wlc/WLC2OSIS/Utilities/SuperContainer.java @@ -1,176 +1,176 @@ -package Utilities ;
-
-import java.awt.*;
-import java.applet.* ;
-import java.awt.event.*;
-import javax.swing.*;
-//==============================================================================
-/**
-*
-* <b>Container object with JApplet, JFrame, and JDialog properties.<p></b>
-*
-*/
-//==============================================================================
-public class SuperContainer{
-
-Container InputContainer ;
-JRootPane RP ;
-Frame SuperFrame ; // Frame of overall screen.
-
-boolean IsJApplet = false ;
-boolean IsJFrame = false ;
-boolean IsJDialog = false ;
-boolean IsWindow = false ;
-
-/**
-* Container object with JApplet, JFrame, and JDialog properties.
-*
-* @param InputContainer Container, either a JApplet, JFrame, or JDialog.
-*/
-public SuperContainer(Container InputContainer){
- this.InputContainer = InputContainer ;
- if(InputContainer instanceof JApplet){
- IsJApplet = true ;
- RP = ((JApplet) InputContainer).getRootPane() ;
- }
- else if(InputContainer instanceof JFrame){
- IsJFrame = true ;
- RP = ((JFrame) InputContainer).getRootPane() ;
- }
- else if(InputContainer instanceof JDialog){
- RP = ((JDialog) InputContainer).getRootPane() ;
- IsJDialog = true ;
- }
- else{
- System.out.println("SuperContainer: Bad input type!") ;
- }
- IsWindow = IsJFrame | IsJDialog ;
- SuperFrame = GetParentFrame.GetParentFrame(RP.getContentPane()) ;
- }
-//------------------------------------------------------------------------------
-public Container getContentPane(){
- return RP.getContentPane() ;
- }
-//------------------------------------------------------------------------------
-public boolean isApplet(){
- return IsJApplet ;
- }
-//------------------------------------------------------------------------------
-public boolean isWindow(){
- return IsWindow ;
- }
-//------------------------------------------------------------------------------
-public void setResizable(boolean Resizable) {
- if(IsJDialog){
- ((Dialog)InputContainer).setResizable(Resizable) ;
- }
- else{
- SuperFrame.setResizable(Resizable) ;
- }
- }
-//------------------------------------------------------------------------------
-public void setTitle(String Title) {
- if(IsJFrame){
- ((JFrame) InputContainer).setTitle(Title);
- }
- else if(IsJDialog){
- ((JDialog) InputContainer).setTitle(Title);
- }
- return ;
- }
-//------------------------------------------------------------------------------
-public void addWindowListener(WindowListener WL) {
- if (IsWindow){
- ((Window)InputContainer).addWindowListener(WL) ;
- }
- return ;
- }
-//------------------------------------------------------------------------------
-public void setLocation( Point P ) {
- if (IsWindow){
- ((Window)InputContainer).setLocation(P) ;
- }
- return ;
- }
-//------------------------------------------------------------------------------
-public void setSize( Dimension D ) {
- if (IsWindow){
- ((Window)InputContainer).setSize(D) ;
- }
- return ;
- }
-//------------------------------------------------------------------------------
-public void setVisible(boolean Visible) {
- ((Component)InputContainer).setVisible(Visible) ;
- return ;
- }
-//------------------------------------------------------------------------------
-public void dispose() {
- if (IsWindow){
- ((Window)InputContainer).dispose() ;
- }
- else{
- // Restart ?
- }
- return ;
- }
-//------------------------------------------------------------------------------
-public Point getLocation() {
- if (IsWindow){
- return ((Window)InputContainer).getLocation() ;
- }
- else{
- return null ;
- }
- }
-//------------------------------------------------------------------------------
-public void pack() {
- if (IsWindow){
- ((Window)InputContainer).pack() ;
- }
- return ;
- }
-//------------------------------------------------------------------------------
-public Dimension getSize() {
- if (IsWindow){
- return ((Window)InputContainer).getSize() ;
- }
- else{
- return null ;
- }
- }
-//------------------------------------------------------------------------------
-public void setIconImage(Image I) {
- if (IsWindow){
- SuperFrame.setIconImage(I) ;
- }
- }
-//------------------------------------------------------------------------------
-public Frame superFrame() {
- return SuperFrame ;
- }
-//------------------------------------------------------------------------------
-public void showStatus(String Status) {
- if (!IsWindow){
- ((Applet)InputContainer).getAppletContext().showStatus(Status) ;
- }
- }
-//------------------------------------------------------------------------------
-public Component getGlassPane() {
- return RP.getGlassPane() ;
- }
-//------------------------------------------------------------------------------
-public void setGlassPane(Component GP) {
- RP.setGlassPane(GP) ;
- }
-//------------------------------------------------------------------------------
-public JRootPane getRootPane() {
- return RP.getRootPane() ;
- }
-//------------------------------------------------------------------------------
-public void addMouseListener(MouseListener ML) {
- RP.addMouseListener(ML);
- }
-//------------------------------------------------------------------------------
-}
-//==============================================================================
+package Utilities ; + +import java.awt.*; +import java.applet.* ; +import java.awt.event.*; +import javax.swing.*; +//============================================================================== +/** +* +* <b>Container object with JApplet, JFrame, and JDialog properties.<p></b> +* +*/ +//============================================================================== +public class SuperContainer{ + +Container InputContainer ; +JRootPane RP ; +Frame SuperFrame ; // Frame of overall screen. + +boolean IsJApplet = false ; +boolean IsJFrame = false ; +boolean IsJDialog = false ; +boolean IsWindow = false ; + +/** +* Container object with JApplet, JFrame, and JDialog properties. +* +* @param InputContainer Container, either a JApplet, JFrame, or JDialog. +*/ +public SuperContainer(Container InputContainer){ + this.InputContainer = InputContainer ; + if(InputContainer instanceof JApplet){ + IsJApplet = true ; + RP = ((JApplet) InputContainer).getRootPane() ; + } + else if(InputContainer instanceof JFrame){ + IsJFrame = true ; + RP = ((JFrame) InputContainer).getRootPane() ; + } + else if(InputContainer instanceof JDialog){ + RP = ((JDialog) InputContainer).getRootPane() ; + IsJDialog = true ; + } + else{ + System.out.println("SuperContainer: Bad input type!") ; + } + IsWindow = IsJFrame | IsJDialog ; + SuperFrame = GetParentFrame.GetParentFrame(RP.getContentPane()) ; + } +//------------------------------------------------------------------------------ +public Container getContentPane(){ + return RP.getContentPane() ; + } +//------------------------------------------------------------------------------ +public boolean isApplet(){ + return IsJApplet ; + } +//------------------------------------------------------------------------------ +public boolean isWindow(){ + return IsWindow ; + } +//------------------------------------------------------------------------------ +public void setResizable(boolean Resizable) { + if(IsJDialog){ + ((Dialog)InputContainer).setResizable(Resizable) ; + } + else{ + SuperFrame.setResizable(Resizable) ; + } + } +//------------------------------------------------------------------------------ +public void setTitle(String Title) { + if(IsJFrame){ + ((JFrame) InputContainer).setTitle(Title); + } + else if(IsJDialog){ + ((JDialog) InputContainer).setTitle(Title); + } + return ; + } +//------------------------------------------------------------------------------ +public void addWindowListener(WindowListener WL) { + if (IsWindow){ + ((Window)InputContainer).addWindowListener(WL) ; + } + return ; + } +//------------------------------------------------------------------------------ +public void setLocation( Point P ) { + if (IsWindow){ + ((Window)InputContainer).setLocation(P) ; + } + return ; + } +//------------------------------------------------------------------------------ +public void setSize( Dimension D ) { + if (IsWindow){ + ((Window)InputContainer).setSize(D) ; + } + return ; + } +//------------------------------------------------------------------------------ +public void setVisible(boolean Visible) { + ((Component)InputContainer).setVisible(Visible) ; + return ; + } +//------------------------------------------------------------------------------ +public void dispose() { + if (IsWindow){ + ((Window)InputContainer).dispose() ; + } + else{ + // Restart ? + } + return ; + } +//------------------------------------------------------------------------------ +public Point getLocation() { + if (IsWindow){ + return ((Window)InputContainer).getLocation() ; + } + else{ + return null ; + } + } +//------------------------------------------------------------------------------ +public void pack() { + if (IsWindow){ + ((Window)InputContainer).pack() ; + } + return ; + } +//------------------------------------------------------------------------------ +public Dimension getSize() { + if (IsWindow){ + return ((Window)InputContainer).getSize() ; + } + else{ + return null ; + } + } +//------------------------------------------------------------------------------ +public void setIconImage(Image I) { + if (IsWindow){ + SuperFrame.setIconImage(I) ; + } + } +//------------------------------------------------------------------------------ +public Frame superFrame() { + return SuperFrame ; + } +//------------------------------------------------------------------------------ +public void showStatus(String Status) { + if (!IsWindow){ + ((Applet)InputContainer).getAppletContext().showStatus(Status) ; + } + } +//------------------------------------------------------------------------------ +public Component getGlassPane() { + return RP.getGlassPane() ; + } +//------------------------------------------------------------------------------ +public void setGlassPane(Component GP) { + RP.setGlassPane(GP) ; + } +//------------------------------------------------------------------------------ +public JRootPane getRootPane() { + return RP.getRootPane() ; + } +//------------------------------------------------------------------------------ +public void addMouseListener(MouseListener ML) { + RP.addMouseListener(ML); + } +//------------------------------------------------------------------------------ +} +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/Utilities/package.html b/modules/hebrew-wlc/WLC2OSIS/Utilities/package.html index ad40db7..b4d6242 100644 --- a/modules/hebrew-wlc/WLC2OSIS/Utilities/package.html +++ b/modules/hebrew-wlc/WLC2OSIS/Utilities/package.html @@ -1,9 +1,9 @@ -<HTML>
-<BODY>
-<b>General java utilities.</B>
-(/Utilities/package.html)
-<p>
-
-</BODY>
-</HTML>
-
+<HTML> +<BODY> +<b>General java utilities.</B> +(/Utilities/package.html) +<p> + +</BODY> +</HTML> + diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/FileChoices.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/FileChoices.java index 09b5437..f84a505 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/FileChoices.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/FileChoices.java @@ -1,71 +1,71 @@ -package WLC2OSIS.GUI ;
-
-import WLC2OSIS.* ;
-import Utilities.* ;
-
-import java.awt.* ;
-import java.util.* ;
-import java.io.* ;
-import java.awt.event.* ;
-import javax.swing.*;
-import javax.swing.event.* ;
-import javax.swing.border.*;
-//==============================================================================
-/**
- * <b>Gets the input and output files.</b><p>
- */
-//==============================================================================
-
-public class FileChoices {
-
-WLC2OSIS A ;
-
-public FileChoices(WLC2OSIS A){
- this.A = A ;
- }
-public String getInputFilename(String DefaultInputFilename){
- FileChooser inchooser = new FileChooser() ;
- inchooser.setSelectedFile(new File(DefaultInputFilename) ) ;
- inchooser.setDialogTitle("Give the input file") ;
- inchooser.setApproveButtonText("Set") ;
- inchooser.setSize( new Dimension( 500, 400 ) ) ;
- inchooser.setLocation(new Point(200, 200) );
- inchooser.revalidate() ;
- int returnValue = inchooser.showOpenDialog(A.OverallContainer) ;
- if(returnValue==JFileChooser.APPROVE_OPTION){
- String InputFilename = inchooser.getSelectedFile().getPath() ;
- return InputFilename ;
- }
- else{
- System.out.println("WLC2OSIS:FileChoices: Didn't choose the input file.") ;
- System.exit(0) ;
- return null ;}
- }
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-public String getOutputDirectory(String DefaultOutputDirectory){
- FileChooser outchooser = new FileChooser() ;
- outchooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) ;
- File InitialDirectory = new File(DefaultOutputDirectory ) ;
- outchooser.setSelectedFile(InitialDirectory) ;
- outchooser.setDialogTitle("Set the output directory") ;
- outchooser.setApproveButtonText("Set") ;
- outchooser.setSize( new Dimension( 500, 400 ) ) ;
- outchooser.setLocation(new Point(200, 200) );
- outchooser.revalidate() ;
- int returnValue = outchooser.showOpenDialog(A.OverallContainer) ;
- if(returnValue==JFileChooser.APPROVE_OPTION){
- String OutputDirectory = outchooser.getSelectedFile().getPath() ;
- return OutputDirectory ;
- }
- else{
- System.out.println("WLC2OSIS: Didn't choose the output directory.") ;
- System.exit(0) ;
- return null ;
- }
- }
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.GUI ; + +import WLC2OSIS.* ; +import Utilities.* ; + +import java.awt.* ; +import java.util.* ; +import java.io.* ; +import java.awt.event.* ; +import javax.swing.*; +import javax.swing.event.* ; +import javax.swing.border.*; +//============================================================================== +/** + * <b>Gets the input and output files.</b><p> + */ +//============================================================================== + +public class FileChoices { + +WLC2OSIS A ; + +public FileChoices(WLC2OSIS A){ + this.A = A ; + } +public String getInputFilename(String DefaultInputFilename){ + FileChooser inchooser = new FileChooser() ; + inchooser.setSelectedFile(new File(DefaultInputFilename) ) ; + inchooser.setDialogTitle("Give the input file") ; + inchooser.setApproveButtonText("Set") ; + inchooser.setSize( new Dimension( 500, 400 ) ) ; + inchooser.setLocation(new Point(200, 200) ); + inchooser.revalidate() ; + int returnValue = inchooser.showOpenDialog(A.OverallContainer) ; + if(returnValue==JFileChooser.APPROVE_OPTION){ + String InputFilename = inchooser.getSelectedFile().getPath() ; + return InputFilename ; + } + else{ + System.out.println("WLC2OSIS:FileChoices: Didn't choose the input file.") ; + System.exit(0) ; + return null ;} + } +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +public String getOutputDirectory(String DefaultOutputDirectory){ + FileChooser outchooser = new FileChooser() ; + outchooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) ; + File InitialDirectory = new File(DefaultOutputDirectory ) ; + outchooser.setSelectedFile(InitialDirectory) ; + outchooser.setDialogTitle("Set the output directory") ; + outchooser.setApproveButtonText("Set") ; + outchooser.setSize( new Dimension( 500, 400 ) ) ; + outchooser.setLocation(new Point(200, 200) ); + outchooser.revalidate() ; + int returnValue = outchooser.showOpenDialog(A.OverallContainer) ; + if(returnValue==JFileChooser.APPROVE_OPTION){ + String OutputDirectory = outchooser.getSelectedFile().getPath() ; + return OutputDirectory ; + } + else{ + System.out.println("WLC2OSIS: Didn't choose the output directory.") ; + System.exit(0) ; + return null ; + } + } +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/Messages.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/Messages.java index bbdaba1..93a7340 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/Messages.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/Messages.java @@ -1,42 +1,42 @@ -package WLC2OSIS.GUI ;
-
-import WLC2OSIS.* ;
-import Utilities.* ;
-
-import java.awt.* ;
-import java.util.* ;
-import java.io.* ;
-import java.awt.event.* ;
-import javax.swing.*;
-import javax.swing.event.* ;
-import javax.swing.border.*;
-//==============================================================================
-/**
- * <b>Outputs messages to operator.</b><p>
- */
-//==============================================================================
-
-public class Messages {
-
-WLC2OSIS A ;
-
-public Messages(WLC2OSIS A){
- this.A = A ;
- }
-public void initialMessage(){
- String IntroMessage = "WLC2OSIS: Conversion of WHI text files to OSIS.\n\n"
- + "Important messages will be written to command window.\n"
- + "Please be ready to write them down.\n\n" ;
- JOptionPane.showMessageDialog(A.OverallContainer, IntroMessage) ;
- }
-public void doneMessage(){
- String DoneMessage = "The output file appears to have been written\n"
- + "normally. Please examine the Java Console for possible errors.\n"
- + "If any errors have occured please make a careful note of them.\n\n";
- JOptionPane.showMessageDialog(A.OverallContainer, DoneMessage) ;
- }
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.GUI ; + +import WLC2OSIS.* ; +import Utilities.* ; + +import java.awt.* ; +import java.util.* ; +import java.io.* ; +import java.awt.event.* ; +import javax.swing.*; +import javax.swing.event.* ; +import javax.swing.border.*; +//============================================================================== +/** + * <b>Outputs messages to operator.</b><p> + */ +//============================================================================== + +public class Messages { + +WLC2OSIS A ; + +public Messages(WLC2OSIS A){ + this.A = A ; + } +public void initialMessage(){ + String IntroMessage = "WLC2OSIS: Conversion of WHI text files to OSIS.\n\n" + + "Important messages will be written to command window.\n" + + "Please be ready to write them down.\n\n" ; + JOptionPane.showMessageDialog(A.OverallContainer, IntroMessage) ; + } +public void doneMessage(){ + String DoneMessage = "The output file appears to have been written\n" + + "normally. Please examine the Java Console for possible errors.\n" + + "If any errors have occured please make a careful note of them.\n\n"; + JOptionPane.showMessageDialog(A.OverallContainer, DoneMessage) ; + } +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/package.html b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/package.html index 563fa18..317474e 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/package.html +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/GUI/package.html @@ -1,9 +1,9 @@ -<HTML>
-<BODY>
-<b>Graphical user interface (GUI)</b>.
-<p/>
-<p align="right"> (<b><tt>BHS2XML/GUI/package.html</tt></b>)
-</p>
-Crude graphical interfaces.
-</BODY>
-</HTML>
+<HTML> +<BODY> +<b>Graphical user interface (GUI)</b>. +<p/> +<p align="right"> (<b><tt>BHS2XML/GUI/package.html</tt></b>) +</p> +Crude graphical interfaces. +</BODY> +</HTML> diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Books.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Books.java index ea079c7..1786351 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Books.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Books.java @@ -1,73 +1,73 @@ -package WLC2OSIS.Parse ;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Translate.* ;
-//import WLC2OSIS.Utilities.* ;
-//==============================================================================
-/**
- * <b>Processes books.</b>
- *
- * Special to WLC.
- */
-//==============================================================================
-public class Books{
-
-WLC2OSIS A ;
-Parser P ;
-public BookName[] BookNames ;
-BookName BookObject ;
-//-----------------------------------------------------------------------------
-
-public Books(WLC2OSIS A, Parser P ) {
- this.A = A ;
- this.P = P ;
- BookNames = BookName.setBookNames() ;
- }
-//------------------------------------------------------------------------------
-
-// Starts a book. Enter with WLC BookCode
-
-public void start(String BookCode){
-
- BookObject = BookName.getBookName(BookNames, BookCode) ;
- P.Book = BookObject.name ;
- P.BookAbbrev = BookObject.abbrev ;
- P.TanachBookCount = P.TanachBookCount + 1 ;
- P.BookVerseCount = 0;
- P.BookChapterCount = 0 ;
-
-//-----------------------------------------------------------------------------
-
-// Begin writing the book into the existing file
-
-
- P.ChapterNumber = 0 ;
- P.VerseNumber = 0 ;
- P.WordNumber = 0 ;
-// A.w.openTag("tanach", 0) ;
- A.w.openTag("div type=\"book\" osisID=\"" + BookObject.abbrev + "\"", 1) ;
-
-/* A.w.writeAttributedString("title", 2, "type=\"section\" subType=\"x-Section\" subtype=\"x-preverse\"",
- BookObject.hebrewname);
- A.w.writeAttributedString("title", 2, "type=\"main\" ", BookObject.hebrewname);*/
-
-
- }
-//------------------------------------------------------------------------------
-
-// Ends a book.
-
-public void end(){
- if (P.Book != null){
-
- P.BookChapterCount = P.ChapterNumber ;
- P.TanachChapterCount = P.TanachChapterCount + P.ChapterNumber ;
-
- A.w.closeTag("div", 1) ;
- System.out.println( BookObject.name + " has been written." ) ;
- }
- }
-//----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Parse ; + +import WLC2OSIS.* ; +import WLC2OSIS.Translate.* ; +//import WLC2OSIS.Utilities.* ; +//============================================================================== +/** + * <b>Processes books.</b> + * + * Special to WLC. + */ +//============================================================================== +public class Books{ + +WLC2OSIS A ; +Parser P ; +public BookName[] BookNames ; +BookName BookObject ; +//----------------------------------------------------------------------------- + +public Books(WLC2OSIS A, Parser P ) { + this.A = A ; + this.P = P ; + BookNames = BookName.setBookNames() ; + } +//------------------------------------------------------------------------------ + +// Starts a book. Enter with WLC BookCode + +public void start(String BookCode){ + + BookObject = BookName.getBookName(BookNames, BookCode) ; + P.Book = BookObject.name ; + P.BookAbbrev = BookObject.abbrev ; + P.TanachBookCount = P.TanachBookCount + 1 ; + P.BookVerseCount = 0; + P.BookChapterCount = 0 ; + +//----------------------------------------------------------------------------- + +// Begin writing the book into the existing file + + + P.ChapterNumber = 0 ; + P.VerseNumber = 0 ; + P.WordNumber = 0 ; +// A.w.openTag("tanach", 0) ; + A.w.openTag("div type=\"book\" osisID=\"" + BookObject.abbrev + "\"", 1) ; + +/* A.w.writeAttributedString("title", 2, "type=\"section\" subType=\"x-Section\" subtype=\"x-preverse\"", + BookObject.hebrewname); + A.w.writeAttributedString("title", 2, "type=\"main\" ", BookObject.hebrewname);*/ + + + } +//------------------------------------------------------------------------------ + +// Ends a book. + +public void end(){ + if (P.Book != null){ + + P.BookChapterCount = P.ChapterNumber ; + P.TanachChapterCount = P.TanachChapterCount + P.ChapterNumber ; + + A.w.closeTag("div", 1) ; + System.out.println( BookObject.name + " has been written." ) ; + } + } +//---------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Chapters.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Chapters.java index bd473ef..8d4bf1c 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Chapters.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Chapters.java @@ -1,48 +1,48 @@ -package WLC2OSIS.Parse ;
-
-import WLC2OSIS.* ;
-//==============================================================================
-/**
- * <b>Processes chapters.</b>
- */
-//==============================================================================
-public class Chapters{
-
-WLC2OSIS A ;
-Parser P ;
-//-----------------------------------------------------------------------------
-
-public Chapters(WLC2OSIS A, Parser P ) {
- this.A = A ;
- this.P = P ;
- }
-//------------------------------------------------------------------------------
-
-// Starts a book.
-
-public void start(){
- P.ChapterVerseCount = 0 ;
- P.ChapterNumber = P.ChapterNumber + 1 ;
- P.VerseNumber = 0 ;
- P.WordNumber = 0 ;
- String num = new Integer(P.ChapterNumber).toString();
- A.w.openTag("chapter osisID=\"" + P.BookAbbrev + "." + num + "\"", 2) ;
- }
-//------------------------------------------------------------------------------
-
-// Ends a book.
-
-public void end(){
- if (P.ChapterNumber != 0){
- P.ChapterVerseCount = P.VerseNumber ;
- P.BookVerseCount = P.BookVerseCount + P.VerseNumber ;
- P.TanachVerseCount = P.TanachVerseCount + P.VerseNumber ;
-
- A.w.closeTag("chapter", 2) ;
-
- }
- }
-//----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Parse ; + +import WLC2OSIS.* ; +//============================================================================== +/** + * <b>Processes chapters.</b> + */ +//============================================================================== +public class Chapters{ + +WLC2OSIS A ; +Parser P ; +//----------------------------------------------------------------------------- + +public Chapters(WLC2OSIS A, Parser P ) { + this.A = A ; + this.P = P ; + } +//------------------------------------------------------------------------------ + +// Starts a book. + +public void start(){ + P.ChapterVerseCount = 0 ; + P.ChapterNumber = P.ChapterNumber + 1 ; + P.VerseNumber = 0 ; + P.WordNumber = 0 ; + String num = new Integer(P.ChapterNumber).toString(); + A.w.openTag("chapter osisID=\"" + P.BookAbbrev + "." + num + "\"", 2) ; + } +//------------------------------------------------------------------------------ + +// Ends a book. + +public void end(){ + if (P.ChapterNumber != 0){ + P.ChapterVerseCount = P.VerseNumber ; + P.BookVerseCount = P.BookVerseCount + P.VerseNumber ; + P.TanachVerseCount = P.TanachVerseCount + P.VerseNumber ; + + A.w.closeTag("chapter", 2) ; + + } + } +//---------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Markers.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Markers.java index 7d93386..ddf0279 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Markers.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Markers.java @@ -1,71 +1,71 @@ -package WLC2OSIS.Parse ;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Translate.H ;
-
-import java.io.* ;
-//==============================================================================
-/**
- * <b>Processes markers.</b>
- *
- * Before any marker is written, the TrailingMaqaf flag must be
- * tested. If a trailing maqaf word precedes the mark, it must be
- * written before the marker.
- */
-//==============================================================================
-public class Markers{
-
-WLC2OSIS A ;
-Parser P ;
-
-//-----------------------------------------------------------------------------
-
-public Markers(WLC2OSIS A, Parser P ) {
- this.A = A ;
- this.P = P ;
- }
-//------------------------------------------------------------------------------
-
-// Samek
-public void samek(){ //parasah setumah, closed paragraph == small space in line
- testMaqafWord() ;
-// A.w.writeMarker("samekh", 4) ;
- A.w.appendText(" " + H.samekh + " ") ;
- P.MarkerWritten = true ;
- }
-//------------------------------------------------------------------------------
-
-// Pe
-public void pe(){ // parasah petuhah, open paragraph == new line
- testMaqafWord() ;
-// A.w.writeMarker("pe", 4) ;
- A.w.appendText(" " + H.pe + " " + "<p/>") ;
- P.MarkerWritten = true ;
- }
-//------------------------------------------------------------------------------
-
-// Line
-public void line(){
- System.out.println("Markers: End-of-line encountered!") ;
- }
-//----------------------------------------------------------------------------
-/**
- * Tests for a preceding trailing maqaf word and writes it.
- *
- * Before any marker is written, the TrailingMaqaf flag must be
- * tested. If a trailing maqaf word precedes the mark, it must be
- * written before the marker.
- *
- * Apparemtly ONLY EOLs cause this test to be activated.
- */
-void testMaqafWord(){
- if (P.w.TrailingMaqaf){
-// System.out.print("Markers: Marker follows trailing maqaf at ") ;
-// P.printPosition() ;
- P.w.writeWord(P.w.MaqafWord, P.w.MaqafWordType) ;
- P.w.TrailingMaqaf = false ;
- }
- }
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Parse ; + +import WLC2OSIS.* ; +import WLC2OSIS.Translate.H ; + +import java.io.* ; +//============================================================================== +/** + * <b>Processes markers.</b> + * + * Before any marker is written, the TrailingMaqaf flag must be + * tested. If a trailing maqaf word precedes the mark, it must be + * written before the marker. + */ +//============================================================================== +public class Markers{ + +WLC2OSIS A ; +Parser P ; + +//----------------------------------------------------------------------------- + +public Markers(WLC2OSIS A, Parser P ) { + this.A = A ; + this.P = P ; + } +//------------------------------------------------------------------------------ + +// Samek +public void samek(){ //parasah setumah, closed paragraph == small space in line + testMaqafWord() ; +// A.w.writeMarker("samekh", 4) ; + A.w.appendText(" " + H.samekh + " ") ; + P.MarkerWritten = true ; + } +//------------------------------------------------------------------------------ + +// Pe +public void pe(){ // parasah petuhah, open paragraph == new line + testMaqafWord() ; +// A.w.writeMarker("pe", 4) ; + A.w.appendText(" " + H.pe + " " + "<p/>") ; + P.MarkerWritten = true ; + } +//------------------------------------------------------------------------------ + +// Line +public void line(){ + System.out.println("Markers: End-of-line encountered!") ; + } +//---------------------------------------------------------------------------- +/** + * Tests for a preceding trailing maqaf word and writes it. + * + * Before any marker is written, the TrailingMaqaf flag must be + * tested. If a trailing maqaf word precedes the mark, it must be + * written before the marker. + * + * Apparemtly ONLY EOLs cause this test to be activated. + */ +void testMaqafWord(){ + if (P.w.TrailingMaqaf){ +// System.out.print("Markers: Marker follows trailing maqaf at ") ; +// P.printPosition() ; + P.w.writeWord(P.w.MaqafWord, P.w.MaqafWordType) ; + P.w.TrailingMaqaf = false ; + } + } +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Parser.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Parser.java index 50ca9a1..c8b4897 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Parser.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Parser.java @@ -1,216 +1,216 @@ -package WLC2OSIS.Parse ;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Translate.* ;
-import WLC2OSIS.Utilities.* ;
-//==============================================================================
-/**
- * <b>Parser dispatches tokens to Books, Chapters, Markers, Tanach,
- * Verses, and Words start/end methods, special to WLC. </b>
- *
- * Extensively modified for WLC.
- */
-//==============================================================================
-public class Parser{
-
-WLC2OSIS A ;
-Tokenizer t ;
-
-// Working classes
-
-public Books b ;
-Chapters c ;
-Verses v ;
-public Words w ;
-Translate T ;
-Markers m ;
-public WKQ wkq ;
-
-// Current state
-
-public boolean MarkerWritten ; // Indicates a marker has been written
- // between two words.
-
-// String BookName ;
-
-String Book ;
-String BookAbbrev ;
-int Chapter ;
-int Verse ;
-
-String LastBookCode = "" ;
-int LastChapter = -1 ;
-int LastVerse = -1 ;
-
-
-// Assorted counts
-public int ChapterVerseCount ;
-public int BookVerseCount ;
-public int BookChapterCount ;
-
-public int TanachVerseCount ;
-public int TanachChapterCount ;
-public int TanachBookCount ;
-
-int ChapterNumber ;
-int VerseNumber ;
-int WordNumber ;
-
-//-----------------------------------------------------------------------------
-public Parser(WLC2OSIS A) {
- this.A = A ;
-
- T = new Translate(A, this) ;
-
-// Set up the tokenizer
- t = new Tokenizer(A) ;
-
-// Set up the Tanach, Books, Chapters, Verses, Words, and Markers classes.
- b = new Books(A, this) ;
- c = new Chapters(A, this) ;
- v = new Verses(A, this) ;
- w = new Words(A, this) ;
- m = new Markers(A, this) ;
- wkq = new WKQ(this) ;
- new MC() ;
- Note.setNotes();
- }
-//------------------------------------------------------------------------------
-
-// Gets the next token as a String.
-
-// EOF is indicated by a return of EOF.
-
-public void parse(){
- String s ;
- boolean PreviousEOL = true ;
- System.out.println("\n") ;
-
- A.w = new XMLWriter(A.OutputDirectory, "WLC_OSIS") ;
-
- // Write the header
- Header.writeHeader(A, A.w) ;
-
- for (int k = 0; k < A.InputChars.length ; k++){
-
- s = t.nextToken() ;
-
- if(s.compareTo(t.EOF) == 0){
- break ;
- }
-
-//-----------------------------------------------------------------------------
-
-// Process a line identifier
-
- if (PreviousEOL){
- int ColonIndex = s.indexOf(':') ;
- if(ColonIndex <=0 ){
- System.out.println("Parser: Incorrect line identifier: " + s + " !") ;
- break ;
- }
- PreviousEOL= false ;
-
-// Parse the identifier
- String BookCode = s.substring(0,2) ;
- int Chapter = Integer.parseInt( s.substring(2, ColonIndex) ) ;
- int Verse = Integer.parseInt( s.substring(ColonIndex+1) ) ;
-
-// Change in Book, start a book.
- if(BookCode.compareTo(LastBookCode) != 0){
- v.end() ;
- c.end() ;
- b.end() ;
- b.start(BookCode) ;
- c.start() ;
- v.start() ;
- LastBookCode = BookCode ;
- LastChapter = 1 ;
- LastVerse = 1 ;
- }
-
-// Change in Chapter, start a Chapter.
- if(Chapter != LastChapter){
- v.end() ;
- c.end() ;
- c.start() ;
- v.start() ;
- LastChapter = Chapter ;
- LastVerse = 1 ;
- }
-
-// Change in Verse, start a Verse.
- if(Verse != LastVerse){
- v.end() ;
- v.start() ;
- LastVerse = Verse ;
- }
- }
-//-----------------------------------------------------------------------------
-
-// Process a word.
-
- else{
- if(s.compareTo(t.EOL) == 0){
- PreviousEOL = true ;
- }
- else{
- if (s.length() > 1){
- w.process(s) ;
- }
- else{
-// Look for 1 letter words.
- if( s.compareTo("P")==0){
- m.pe();
- }
- else if( s.compareTo("S")==0){
- m.samek() ;
- }
- else if( s.compareTo("?")==0){
- m.line() ;
- }
- else{ // It's a word
- w.process(s) ;
- }
- }
- }
- }
-
- }
- v.end() ;
- c.end() ;
- b.end() ;
-
- // Write the footer
- Header.writeFooter(A, A.w) ;
-
-
- A.w.close();
- return ;
- }
-//----------------------------------------------------------------------------
-
-// Counts the number of occurences of a character in a String.
-
-public int countChar(String W, char c){
- int Count = 0 ;
- for(int k=0; k < W.length(); k++){
- if(W.charAt(k)==c){
- Count++ ;
- }
- }
- return Count ;
- }
-//----------------------------------------------------------------------------
-
-// Prints a verse identification.
-
-public void printPosition(){
- System.out.print(" at " + Book + " " + A.F.i(ChapterNumber,3) + ":"
- + A.F.i(VerseNumber,2)
- + "." + A.F.i(WordNumber,2) + "\n") ;
- }
-//------------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Parse ; + +import WLC2OSIS.* ; +import WLC2OSIS.Translate.* ; +import WLC2OSIS.Utilities.* ; +//============================================================================== +/** + * <b>Parser dispatches tokens to Books, Chapters, Markers, Tanach, + * Verses, and Words start/end methods, special to WLC. </b> + * + * Extensively modified for WLC. + */ +//============================================================================== +public class Parser{ + +WLC2OSIS A ; +Tokenizer t ; + +// Working classes + +public Books b ; +Chapters c ; +Verses v ; +public Words w ; +Translate T ; +Markers m ; +public WKQ wkq ; + +// Current state + +public boolean MarkerWritten ; // Indicates a marker has been written + // between two words. + +// String BookName ; + +String Book ; +String BookAbbrev ; +int Chapter ; +int Verse ; + +String LastBookCode = "" ; +int LastChapter = -1 ; +int LastVerse = -1 ; + + +// Assorted counts +public int ChapterVerseCount ; +public int BookVerseCount ; +public int BookChapterCount ; + +public int TanachVerseCount ; +public int TanachChapterCount ; +public int TanachBookCount ; + +int ChapterNumber ; +int VerseNumber ; +int WordNumber ; + +//----------------------------------------------------------------------------- +public Parser(WLC2OSIS A) { + this.A = A ; + + T = new Translate(A, this) ; + +// Set up the tokenizer + t = new Tokenizer(A) ; + +// Set up the Tanach, Books, Chapters, Verses, Words, and Markers classes. + b = new Books(A, this) ; + c = new Chapters(A, this) ; + v = new Verses(A, this) ; + w = new Words(A, this) ; + m = new Markers(A, this) ; + wkq = new WKQ(this) ; + new MC() ; + Note.setNotes(); + } +//------------------------------------------------------------------------------ + +// Gets the next token as a String. + +// EOF is indicated by a return of EOF. + +public void parse(){ + String s ; + boolean PreviousEOL = true ; + System.out.println("\n") ; + + A.w = new XMLWriter(A.OutputDirectory, "WLC_OSIS") ; + + // Write the header + Header.writeHeader(A, A.w) ; + + for (int k = 0; k < A.InputChars.length ; k++){ + + s = t.nextToken() ; + + if(s.compareTo(t.EOF) == 0){ + break ; + } + +//----------------------------------------------------------------------------- + +// Process a line identifier + + if (PreviousEOL){ + int ColonIndex = s.indexOf(':') ; + if(ColonIndex <=0 ){ + System.out.println("Parser: Incorrect line identifier: " + s + " !") ; + break ; + } + PreviousEOL= false ; + +// Parse the identifier + String BookCode = s.substring(0,2) ; + int Chapter = Integer.parseInt( s.substring(2, ColonIndex) ) ; + int Verse = Integer.parseInt( s.substring(ColonIndex+1) ) ; + +// Change in Book, start a book. + if(BookCode.compareTo(LastBookCode) != 0){ + v.end() ; + c.end() ; + b.end() ; + b.start(BookCode) ; + c.start() ; + v.start() ; + LastBookCode = BookCode ; + LastChapter = 1 ; + LastVerse = 1 ; + } + +// Change in Chapter, start a Chapter. + if(Chapter != LastChapter){ + v.end() ; + c.end() ; + c.start() ; + v.start() ; + LastChapter = Chapter ; + LastVerse = 1 ; + } + +// Change in Verse, start a Verse. + if(Verse != LastVerse){ + v.end() ; + v.start() ; + LastVerse = Verse ; + } + } +//----------------------------------------------------------------------------- + +// Process a word. + + else{ + if(s.compareTo(t.EOL) == 0){ + PreviousEOL = true ; + } + else{ + if (s.length() > 1){ + w.process(s) ; + } + else{ +// Look for 1 letter words. + if( s.compareTo("P")==0){ + m.pe(); + } + else if( s.compareTo("S")==0){ + m.samek() ; + } + else if( s.compareTo("?")==0){ + m.line() ; + } + else{ // It's a word + w.process(s) ; + } + } + } + } + + } + v.end() ; + c.end() ; + b.end() ; + + // Write the footer + Header.writeFooter(A, A.w) ; + + + A.w.close(); + return ; + } +//---------------------------------------------------------------------------- + +// Counts the number of occurences of a character in a String. + +public int countChar(String W, char c){ + int Count = 0 ; + for(int k=0; k < W.length(); k++){ + if(W.charAt(k)==c){ + Count++ ; + } + } + return Count ; + } +//---------------------------------------------------------------------------- + +// Prints a verse identification. + +public void printPosition(){ + System.out.print(" at " + Book + " " + A.F.i(ChapterNumber,3) + ":" + + A.F.i(VerseNumber,2) + + "." + A.F.i(WordNumber,2) + "\n") ; + } +//------------------------------------------------------------------------------ +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Tokenizer.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Tokenizer.java index f896239..a0aff2b 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Tokenizer.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Tokenizer.java @@ -1,87 +1,87 @@ -package WLC2OSIS.Parse ;
-
-import WLC2OSIS.* ;
-
-import java.io.* ;
-import javax.swing.* ;
-import java.awt.* ;
-//==============================================================================
-/**
- * <b>Tokenizer based on standard Java tokenizer, special to WLC.</b>
- *
- * Special to WLC.
- */
-//==============================================================================
-public class Tokenizer{
-
-public final String EOF = "***EOF***" ;
-public final String EOL = "***EOL***" ;
-WLC2OSIS A ;
-CharArrayReader car ;
-StreamTokenizer st ;
-
-//-----------------------------------------------------------------------------
-
-public Tokenizer(WLC2OSIS A ) {
- this.A = A ;
-
-// Set up the tokenizer
-
- car = new CharArrayReader(A.InputChars) ;
- st = new StreamTokenizer( car) ;
- st.resetSyntax() ;
- st.wordChars(33, 126 ) ; // All printables are word characters
- st.ordinaryChar(63) ; // ? is a special symbol, the EOL marker.
- st.eolIsSignificant(true) ;
- }
-//------------------------------------------------------------------------------
-
-// Gets the next token as a String.
-
-// EOF is indicated by a return of EOF.
-// EOL is indicated by a return of EOL.
-
-public String nextToken(){
- int TokenType = 0 ;
- boolean Found = false ; // Found a word token or EOF ;
- String Value = "" ; // The returned String.
- do{
- try{
- TokenType = st.nextToken() ;
- }
- catch (IOException e) {
- System.out.println("Tokenizer: IOException in tokenization: " + e) ;
- }
-
- if (TokenType==StreamTokenizer.TT_WORD){
- Value = st.sval ;
- Found = true ;
- }
- else if(TokenType==StreamTokenizer.TT_EOF){
- Value = EOF ;
- Found = true ;
- }
- else if(TokenType==StreamTokenizer.TT_EOL){
- Value = EOL ;
- Found = true ;
- }
- if (TokenType==63){ // EOL marker
- Value = "?" ;
- Found = true ;
- }
-
- }while(!Found) ;
-
- return Value ;
- }
-//------------------------------------------------------------------------------
-
-// Does a pushBack on the StreamTokenizer, st.
-
-public void pushBack(){
- st.pushBack() ;
- }
-//-----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Parse ; + +import WLC2OSIS.* ; + +import java.io.* ; +import javax.swing.* ; +import java.awt.* ; +//============================================================================== +/** + * <b>Tokenizer based on standard Java tokenizer, special to WLC.</b> + * + * Special to WLC. + */ +//============================================================================== +public class Tokenizer{ + +public final String EOF = "***EOF***" ; +public final String EOL = "***EOL***" ; +WLC2OSIS A ; +CharArrayReader car ; +StreamTokenizer st ; + +//----------------------------------------------------------------------------- + +public Tokenizer(WLC2OSIS A ) { + this.A = A ; + +// Set up the tokenizer + + car = new CharArrayReader(A.InputChars) ; + st = new StreamTokenizer( car) ; + st.resetSyntax() ; + st.wordChars(33, 126 ) ; // All printables are word characters + st.ordinaryChar(63) ; // ? is a special symbol, the EOL marker. + st.eolIsSignificant(true) ; + } +//------------------------------------------------------------------------------ + +// Gets the next token as a String. + +// EOF is indicated by a return of EOF. +// EOL is indicated by a return of EOL. + +public String nextToken(){ + int TokenType = 0 ; + boolean Found = false ; // Found a word token or EOF ; + String Value = "" ; // The returned String. + do{ + try{ + TokenType = st.nextToken() ; + } + catch (IOException e) { + System.out.println("Tokenizer: IOException in tokenization: " + e) ; + } + + if (TokenType==StreamTokenizer.TT_WORD){ + Value = st.sval ; + Found = true ; + } + else if(TokenType==StreamTokenizer.TT_EOF){ + Value = EOF ; + Found = true ; + } + else if(TokenType==StreamTokenizer.TT_EOL){ + Value = EOL ; + Found = true ; + } + if (TokenType==63){ // EOL marker + Value = "?" ; + Found = true ; + } + + }while(!Found) ; + + return Value ; + } +//------------------------------------------------------------------------------ + +// Does a pushBack on the StreamTokenizer, st. + +public void pushBack(){ + st.pushBack() ; + } +//----------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Verses.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Verses.java index 6199067..0f64d16 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Verses.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Verses.java @@ -1,43 +1,43 @@ -package WLC2OSIS.Parse ;
-
-import WLC2OSIS.* ;
-//==============================================================================
-/**
- * <b>Processes verses.</b>
- */
-//==============================================================================
-public class Verses{
-
-WLC2OSIS A ;
-Parser P ;
-//-----------------------------------------------------------------------------
-
-public Verses(WLC2OSIS A, Parser P ) {
- this.A = A ;
- this.P = P ;
- }
-//------------------------------------------------------------------------------
-
-// Starts a book.
-
-public void start(){
- P.VerseNumber = P.VerseNumber + 1 ;
- P.WordNumber = 0 ;
-
- String chapternum = new Integer(P.ChapterNumber).toString();
- String versenum = new Integer(P.VerseNumber).toString();
- A.w.openTag("verse osisID=\""+P.BookAbbrev+"."+chapternum+"."+versenum+"\"", 3) ;
- }
-//------------------------------------------------------------------------------
-
-// Ends a book.
-
-public void end(){
- if( P.VerseNumber != 0){
- A.w.closeTag("verse", 3) ;
- }
- }
-//----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Parse ; + +import WLC2OSIS.* ; +//============================================================================== +/** + * <b>Processes verses.</b> + */ +//============================================================================== +public class Verses{ + +WLC2OSIS A ; +Parser P ; +//----------------------------------------------------------------------------- + +public Verses(WLC2OSIS A, Parser P ) { + this.A = A ; + this.P = P ; + } +//------------------------------------------------------------------------------ + +// Starts a book. + +public void start(){ + P.VerseNumber = P.VerseNumber + 1 ; + P.WordNumber = 0 ; + + String chapternum = new Integer(P.ChapterNumber).toString(); + String versenum = new Integer(P.VerseNumber).toString(); + A.w.openTag("verse osisID=\""+P.BookAbbrev+"."+chapternum+"."+versenum+"\"", 3) ; + } +//------------------------------------------------------------------------------ + +// Ends a book. + +public void end(){ + if( P.VerseNumber != 0){ + A.w.closeTag("verse", 3) ; + } + } +//---------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Words.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Words.java index 26c7deb..d76689e 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Words.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/Words.java @@ -1,134 +1,134 @@ -package WLC2OSIS.Parse ;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Translate.H ;
-import WLC2OSIS.Utilities.* ;
-//==============================================================================
-/**
- * <b>Processes words, sending them to the Translate class
- * after their word, qere, ketiv properties have been determined.</b>
- */
-//==============================================================================
-public class Words{
-
-WLC2OSIS A ;
-Parser P ;
-
-boolean TrailingMaqaf ;
-String MaqafWord ;
-String MaqafWordType ;
-
-//-----------------------------------------------------------------------------
-
-public Words(WLC2OSIS A, Parser P ) {
- this.A = A ;
- this.P = P ;
- }
-//------------------------------------------------------------------------------
-
-// Processes a word,
-
-public void process(String W){
-
-//----------------------------------------------------------------------------------
-
-// Process WKQ
- P.wkq.process(W) ;
-
-//----------------------------------------------------------------------------------
-
-
-// System.out.println(P.Book + " " + A.F.i(P.ChapterNumber,2) + ":"
-// + A.F.i(P.VerseNumber,2)
-// + "." + A.F.i(P.WordNumber,2) + " " + W) ;
- }
-//----------------------------------------------------------------------------------
-
-// Translates and writes a word (simple, ketib, qere) with exception markers.
-
-// All returns leave P.MarkerWritten = false ;
-
-public void write(String W, String Type) {
-
-
- String Word = P.T.translate(W) ;
-
-// Check for any KQ markers which should NOT be here!
-
- int asteriskcount = P.countChar(W, '*') ;
-
- if (asteriskcount > 0){
- System.out.print("Words.write: Unexpected KQ character * ") ;
- P.printPosition() ;
- System.out.println("Word: " + W) ;
- }
-
-// Look for a case in which there's been trailing maqaf
-// without an intervening marker.
-
- if(TrailingMaqaf & !P.MarkerWritten ){
- if(MaqafWordType.charAt(0)== Type.charAt(0) ){
- Word = MaqafWord+Word ; // Combine them.
- }
- else{
-// System.out.print("Words: Mismatched types for combining "
-// + MaqafWordType + ", " + Type + " at " ) ;
-// P.printPosition() ;
- writeWord(MaqafWord, MaqafWordType) ;
- TrailingMaqaf = false ;
- }
- }
-
-// Check for a trailing maqaf.
-// Don't write the word here.
-
- TrailingMaqaf = false ;
- if( Word.charAt(Word.length()-1) == H.maqaf){
- TrailingMaqaf = true ;
- MaqafWord = Word ;
- MaqafWordType = Type ;
- P.MarkerWritten = false ;
- return ;
- }
-
- writeWord(Word, Type) ;
- }
-//----------------------------------------------------------------------------------
-
-public void writeWord(String Word, String Type) {
-
-// Check for any exception markers ]x
-
- String Out = "" ;
- for (int k=0 ; k < Word.length() ; k++){
- char c = Word.charAt(k) ;
- if(c == ']'){
- k++ ;
- char ExceptionValue = Word.charAt(k) ;
- Out = Out + "<x>" + ExceptionValue +"</x>" ;
- System.out.println("Exception occured");
- }
- else{
- Out = Out + c ;
- }
- }
-
- if (Type.charAt(0) == 'w') {
- A.w.appendText(Out + " ") ;
- }
- else if (Type.charAt(0) == 'k') {
- A.w.appendText("["+ Out + " " + H.kaf + "] ") ;
- }
- else if (Type.charAt(0) == 'q') {
- A.w.appendText("(" + Out + " " + H.qof+ ") ") ;
- }
- else {
- System.out.println("Warning: unknown word type!");
- P.printPosition();
- }
- P.MarkerWritten = false ;
- }
-}
-
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Parse ; + +import WLC2OSIS.* ; +import WLC2OSIS.Translate.H ; +import WLC2OSIS.Utilities.* ; +//============================================================================== +/** + * <b>Processes words, sending them to the Translate class + * after their word, qere, ketiv properties have been determined.</b> + */ +//============================================================================== +public class Words{ + +WLC2OSIS A ; +Parser P ; + +boolean TrailingMaqaf ; +String MaqafWord ; +String MaqafWordType ; + +//----------------------------------------------------------------------------- + +public Words(WLC2OSIS A, Parser P ) { + this.A = A ; + this.P = P ; + } +//------------------------------------------------------------------------------ + +// Processes a word, + +public void process(String W){ + +//---------------------------------------------------------------------------------- + +// Process WKQ + P.wkq.process(W) ; + +//---------------------------------------------------------------------------------- + + +// System.out.println(P.Book + " " + A.F.i(P.ChapterNumber,2) + ":" +// + A.F.i(P.VerseNumber,2) +// + "." + A.F.i(P.WordNumber,2) + " " + W) ; + } +//---------------------------------------------------------------------------------- + +// Translates and writes a word (simple, ketib, qere) with exception markers. + +// All returns leave P.MarkerWritten = false ; + +public void write(String W, String Type) { + + + String Word = P.T.translate(W) ; + +// Check for any KQ markers which should NOT be here! + + int asteriskcount = P.countChar(W, '*') ; + + if (asteriskcount > 0){ + System.out.print("Words.write: Unexpected KQ character * ") ; + P.printPosition() ; + System.out.println("Word: " + W) ; + } + +// Look for a case in which there's been trailing maqaf +// without an intervening marker. + + if(TrailingMaqaf & !P.MarkerWritten ){ + if(MaqafWordType.charAt(0)== Type.charAt(0) ){ + Word = MaqafWord+Word ; // Combine them. + } + else{ +// System.out.print("Words: Mismatched types for combining " +// + MaqafWordType + ", " + Type + " at " ) ; +// P.printPosition() ; + writeWord(MaqafWord, MaqafWordType) ; + TrailingMaqaf = false ; + } + } + +// Check for a trailing maqaf. +// Don't write the word here. + + TrailingMaqaf = false ; + if( Word.charAt(Word.length()-1) == H.maqaf){ + TrailingMaqaf = true ; + MaqafWord = Word ; + MaqafWordType = Type ; + P.MarkerWritten = false ; + return ; + } + + writeWord(Word, Type) ; + } +//---------------------------------------------------------------------------------- + +public void writeWord(String Word, String Type) { + +// Check for any exception markers ]x + + String Out = "" ; + for (int k=0 ; k < Word.length() ; k++){ + char c = Word.charAt(k) ; + if(c == ']'){ + k++ ; + char ExceptionValue = Word.charAt(k) ; + Out = Out + "<x>" + ExceptionValue +"</x>" ; + System.out.println("Exception occured"); + } + else{ + Out = Out + c ; + } + } + + if (Type.charAt(0) == 'w') { + A.w.appendText("<seg>" + Out + "</seg> ") ; + } + else if (Type.charAt(0) == 'k') { + A.w.appendText("[<seg>" + Out + "</seg> " + H.kaf + "] ") ; + } + else if (Type.charAt(0) == 'q') { + A.w.appendText("(<seg>" + Out + "</seg> " + H.qof+ ") ") ; + } + else { + System.out.println("Warning: unknown word type!"); + P.printPosition(); + } + P.MarkerWritten = false ; + } +} + +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/package.html b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/package.html index 175262f..0c37015 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/package.html +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Parse/package.html @@ -1,9 +1,9 @@ -<HTML>
-<BODY>
-<b>Parsing classes</b>.
-<p/>
-<p align="right"> (<b><tt>BHS2XML/Parse/package.html</tt></b>)
-</p>
-Only the Parse and Tokenizer classes are specific to the WLC.
-</BODY>
-</HTML>
+<HTML> +<BODY> +<b>Parsing classes</b>. +<p/> +<p align="right"> (<b><tt>BHS2XML/Parse/package.html</tt></b>) +</p> +Only the Parse and Tokenizer classes are specific to the WLC. +</BODY> +</HTML> diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/BookName.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/BookName.java index c326011..a42f948 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/BookName.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/BookName.java @@ -1,146 +1,146 @@ -package WLC2OSIS.Translate ;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Translate.* ;
-import Utilities.* ;
-
-import java.io.*;
-//==============================================================================
-/**
- * <b>Object containing alternative book names, abbreviations,
- * and numbers.</b><p>
- *
- * Special to WLC.
- */
-//==============================================================================
-public class BookName{
-
-public int wlcnumber = 0 ; // Book number in WLC text.
-public String wlcname = "" ; // Book name in WLC text.
-
-public int number = 0 ; // Book number.
-public String name = "" ; // Book name in OSIS.
-public String abbrev = "" ; // Book abreviation in OSIS.
-public String hebrewname = "" ;
-
-//-----------------------------------------------------------------------------
-
-// Full definition
-
-public BookName( int wlcnumber, String wlcname,
- int number, String name, String abbrev,
- String hebrewname) {
- this.wlcnumber = wlcnumber ;
- this.wlcname = wlcname ;
- this.number = number ;
- this.name = name ;
- this.abbrev = abbrev ;
- this.hebrewname = hebrewname ;
- }
-//-----------------------------------------------------------------------------
-
-// Provides an array of BookNames
-
-public static BookName[] setBookNames() {
- BookName[] BookNames = new BookName[40] ;
-
- BookNames[ 1] = new BookName(1, "gn",
- 1, "Genesis", "Gen", H.Gen ) ;
- BookNames[ 2] = new BookName(2, "ex",
- 2, "Exodus", "Exod", H.Exod) ;
- BookNames[ 3] = new BookName(3, "lv",
- 3, "Leviticus", "Lev", H.Lev) ;
- BookNames[ 4] = new BookName(4, "nu",
- 4, "Numbers", "Num", H.Num) ;
- BookNames[ 5] = new BookName(5, "dt",
- 5, "Deuteronomy", "Deut", H.Deut) ;
-
- BookNames[ 6] = new BookName(6, "js",
- 6, "Joshua", "Josh", H.Josh) ;
- BookNames[ 7] = new BookName(7, "ju",
- 7, "Judges", "Judg", H.Judg) ;
- BookNames[ 8] = new BookName(8, "1s",
- 8, "1 Samuel", "1Sam", H.Sam1) ;
- BookNames[ 9] = new BookName(9, "2s",
- 9, "2 Samuel", "2Sam", H.Sam2) ;
- BookNames[10] = new BookName(10, "1k",
- 10, "1 Kings", "1Kgs", H.Kgs1) ;
- BookNames[11] = new BookName(11, "2k",
- 11, "2 Kings", "2Kgs", H.Kgs2) ;
- BookNames[12] = new BookName(12, "is",
- 12, "Isaiah", "Isa", H.Isa) ;
- BookNames[13] = new BookName(13, "je",
- 13, "Jeremiah", "Jer", H.Jer) ;
- BookNames[14] = new BookName(14, "ek",
- 14, "Ezekiel", "Ezek", H.Ezek) ;
-
- BookNames[15] = new BookName(15, "ho",
- 15, "Hosea", "Hos", H.Hos) ;
- BookNames[16] = new BookName(16, "jl",
- 16, "Joel", "Joel", H.Joel) ;
- BookNames[17] = new BookName(17, "am",
- 17, "Amos", "Amos", H.Amos) ;
- BookNames[18] = new BookName(18, "ob",
- 18, "Obadiah", "Obad", H.Obad) ;
- BookNames[19] = new BookName(19, "jn",
- 19, "Jonah", "Jonah", H.Jonah) ;
- BookNames[20] = new BookName(20, "mi",
- 20, "Micah", "Mic", H.Micah) ;
- BookNames[21] = new BookName(21, "na",
- 21, "Nahum", "Nah", H.Nahum) ;
- BookNames[22] = new BookName(22, "hb",
- 22, "Habakkuk", "Hab", H.Hab) ;
- BookNames[23] = new BookName(23, "zp",
- 23, "Zephaniah", "Zeph", H.Zeph) ;
- BookNames[24] = new BookName(24, "hg",
- 24, "Haggai", "Hag", H.Hag) ;
- BookNames[25] = new BookName(25, "zc",
- 25, "Zechariah", "Zech", H.Zech) ;
- BookNames[26] = new BookName(26, "ma",
- 26, "Malachi", "Mal", H.Mal) ;
-
- BookNames[27] = new BookName(27, "ps",
- 27, "Psalms", "Ps", H.Ps) ;
- BookNames[28] = new BookName(28, "jb",
- 29, "Job", "Job", H.Job) ;
- BookNames[29] = new BookName(29, "pr",
- 28, "Proverbs", "Prov", H.Prov) ;
- BookNames[30] = new BookName(30, "ru",
- 31, "Ruth", "Ruth", H.Ruth) ;
- BookNames[31] = new BookName(31, "ca",
- 30, "The Song of Songs", "Song", H.Song) ;
- BookNames[32] = new BookName(32, "ec",
- 33, "Ecclesiastes", "Eccl", H.Eccl) ;
- BookNames[33] = new BookName(33, "lm",
- 32, "Lamentations", "Lam", H.Lam) ;
- BookNames[34] = new BookName(34, "es",
- 34, "Esther", "Esth", H.Esth) ;
- BookNames[35] = new BookName(35, "da",
- 35, "Daniel", "Dan", H.Dan) ;
- BookNames[36] = new BookName(36, "er",
- 36, "Ezra", "Ezra", H.Ezra) ;
- BookNames[37] = new BookName(37, "ne",
- 37, "Nehemiah", "Neh", H.Neh) ;
- BookNames[38] = new BookName(38, "1c",
- 38, "1 Chronicles", "1Chr", H.Chr1) ;
- BookNames[39] = new BookName(39, "2c",
- 39, "2 Chronicles", "2Chr", H.Chr2) ;
- return BookNames ;
- }
-//-----------------------------------------------------------------------------
-
-// Returns a BookName object given a 2 letter book code.
-
-public static BookName getBookName(BookName[] BookNames, String BookCode) {
- for (int k =1; k < BookNames.length; k++) {
- if( BookCode.compareTo(BookNames[k].wlcname)==0){
- return BookNames[k] ;
- }
- }
- System.out.println("BookName: No book found for code " + BookCode + " !") ;
- return null ;
- }
-//-----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Translate ; + +import WLC2OSIS.* ; +import WLC2OSIS.Translate.* ; +import Utilities.* ; + +import java.io.*; +//============================================================================== +/** + * <b>Object containing alternative book names, abbreviations, + * and numbers.</b><p> + * + * Special to WLC. + */ +//============================================================================== +public class BookName{ + +public int wlcnumber = 0 ; // Book number in WLC text. +public String wlcname = "" ; // Book name in WLC text. + +public int number = 0 ; // Book number. +public String name = "" ; // Book name in OSIS. +public String abbrev = "" ; // Book abreviation in OSIS. +public String hebrewname = "" ; + +//----------------------------------------------------------------------------- + +// Full definition + +public BookName( int wlcnumber, String wlcname, + int number, String name, String abbrev, + String hebrewname) { + this.wlcnumber = wlcnumber ; + this.wlcname = wlcname ; + this.number = number ; + this.name = name ; + this.abbrev = abbrev ; + this.hebrewname = hebrewname ; + } +//----------------------------------------------------------------------------- + +// Provides an array of BookNames + +public static BookName[] setBookNames() { + BookName[] BookNames = new BookName[40] ; + + BookNames[ 1] = new BookName(1, "gn", + 1, "Genesis", "Gen", H.Gen ) ; + BookNames[ 2] = new BookName(2, "ex", + 2, "Exodus", "Exod", H.Exod) ; + BookNames[ 3] = new BookName(3, "lv", + 3, "Leviticus", "Lev", H.Lev) ; + BookNames[ 4] = new BookName(4, "nu", + 4, "Numbers", "Num", H.Num) ; + BookNames[ 5] = new BookName(5, "dt", + 5, "Deuteronomy", "Deut", H.Deut) ; + + BookNames[ 6] = new BookName(6, "js", + 6, "Joshua", "Josh", H.Josh) ; + BookNames[ 7] = new BookName(7, "ju", + 7, "Judges", "Judg", H.Judg) ; + BookNames[ 8] = new BookName(8, "1s", + 8, "1 Samuel", "1Sam", H.Sam1) ; + BookNames[ 9] = new BookName(9, "2s", + 9, "2 Samuel", "2Sam", H.Sam2) ; + BookNames[10] = new BookName(10, "1k", + 10, "1 Kings", "1Kgs", H.Kgs1) ; + BookNames[11] = new BookName(11, "2k", + 11, "2 Kings", "2Kgs", H.Kgs2) ; + BookNames[12] = new BookName(12, "is", + 12, "Isaiah", "Isa", H.Isa) ; + BookNames[13] = new BookName(13, "je", + 13, "Jeremiah", "Jer", H.Jer) ; + BookNames[14] = new BookName(14, "ek", + 14, "Ezekiel", "Ezek", H.Ezek) ; + + BookNames[15] = new BookName(15, "ho", + 15, "Hosea", "Hos", H.Hos) ; + BookNames[16] = new BookName(16, "jl", + 16, "Joel", "Joel", H.Joel) ; + BookNames[17] = new BookName(17, "am", + 17, "Amos", "Amos", H.Amos) ; + BookNames[18] = new BookName(18, "ob", + 18, "Obadiah", "Obad", H.Obad) ; + BookNames[19] = new BookName(19, "jn", + 19, "Jonah", "Jonah", H.Jonah) ; + BookNames[20] = new BookName(20, "mi", + 20, "Micah", "Mic", H.Micah) ; + BookNames[21] = new BookName(21, "na", + 21, "Nahum", "Nah", H.Nahum) ; + BookNames[22] = new BookName(22, "hb", + 22, "Habakkuk", "Hab", H.Hab) ; + BookNames[23] = new BookName(23, "zp", + 23, "Zephaniah", "Zeph", H.Zeph) ; + BookNames[24] = new BookName(24, "hg", + 24, "Haggai", "Hag", H.Hag) ; + BookNames[25] = new BookName(25, "zc", + 25, "Zechariah", "Zech", H.Zech) ; + BookNames[26] = new BookName(26, "ma", + 26, "Malachi", "Mal", H.Mal) ; + + BookNames[27] = new BookName(27, "ps", + 27, "Psalms", "Ps", H.Ps) ; + BookNames[28] = new BookName(28, "jb", + 29, "Job", "Job", H.Job) ; + BookNames[29] = new BookName(29, "pr", + 28, "Proverbs", "Prov", H.Prov) ; + BookNames[30] = new BookName(30, "ru", + 31, "Ruth", "Ruth", H.Ruth) ; + BookNames[31] = new BookName(31, "ca", + 30, "The Song of Songs", "Song", H.Song) ; + BookNames[32] = new BookName(32, "ec", + 33, "Ecclesiastes", "Eccl", H.Eccl) ; + BookNames[33] = new BookName(33, "lm", + 32, "Lamentations", "Lam", H.Lam) ; + BookNames[34] = new BookName(34, "es", + 34, "Esther", "Esth", H.Esth) ; + BookNames[35] = new BookName(35, "da", + 35, "Daniel", "Dan", H.Dan) ; + BookNames[36] = new BookName(36, "er", + 36, "Ezra", "Ezra", H.Ezra) ; + BookNames[37] = new BookName(37, "ne", + 37, "Nehemiah", "Neh", H.Neh) ; + BookNames[38] = new BookName(38, "1c", + 38, "1 Chronicles", "1Chr", H.Chr1) ; + BookNames[39] = new BookName(39, "2c", + 39, "2 Chronicles", "2Chr", H.Chr2) ; + return BookNames ; + } +//----------------------------------------------------------------------------- + +// Returns a BookName object given a 2 letter book code. + +public static BookName getBookName(BookName[] BookNames, String BookCode) { + for (int k =1; k < BookNames.length; k++) { + if( BookCode.compareTo(BookNames[k].wlcname)==0){ + return BookNames[k] ; + } + } + System.out.println("BookName: No book found for code " + BookCode + " !") ; + return null ; + } +//----------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/H.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/H.java index c8bc4fc..9825c27 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/H.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/H.java @@ -1,196 +1,196 @@ -package WLC2OSIS.Translate ;
-
-//==============================================================================
-/**
- * <b>Unicode Hebrew characters</b><p>
- *
- * From Unicode Hebrew, Version 4.0.
- */
-//==============================================================================
-public class H{
-
-// Letters = Consonants
-
-public static final char alef = '\u05d0' ;
-public static final char bet = '\u05d1' ;
-public static final char gimel = '\u05d2' ;
-public static final char dalet = '\u05d3' ;
-public static final char he = '\u05d4' ;
-public static final char vav = '\u05d5' ;
-public static final char zayin = '\u05d6' ;
-public static final char het = '\u05d7' ;
-public static final char tet = '\u05d8' ;
-public static final char yod = '\u05d9' ;
-public static final char finalkaf = '\u05dA' ;
-public static final char kaf = '\u05dB' ;
-public static final char lamed = '\u05dC' ;
-public static final char finalmem = '\u05dD' ;
-public static final char mem = '\u05dE' ;
-public static final char finalnun = '\u05dF' ;
-public static final char nun = '\u05e0' ;
-public static final char samekh = '\u05e1' ;
-public static final char ayin = '\u05e2' ;
-public static final char finalpe = '\u05e3' ;
-public static final char pe = '\u05e4' ;
-public static final char finaltsadi = '\u05e5' ;
-public static final char tsadi = '\u05e6' ;
-public static final char qof = '\u05e7' ;
-public static final char resh = '\u05e8' ;
-public static final char shin = '\u05e9' ;
-public static final char tav = '\u05eA' ;
-
-// Points and punctuation
-
-public static final char sheva = '\u05b0' ;
-public static final char hatafsegol = '\u05b1' ;
-public static final char hatafpatah = '\u05b2' ;
-public static final char hatafqamats = '\u05b3' ;
-public static final char hiriq = '\u05b4' ;
-public static final char tsere = '\u05b5' ;
-public static final char segol = '\u05b6' ;
-public static final char patah = '\u05b7' ;
-public static final char qamats = '\u05b8' ;
-public static final char holam = '\u05b9' ;
-public static final char reserved = '\u05ba' ;
-public static final char qubuts = '\u05bb' ;
-public static final char dagesh = '\u05bc' ;
-public static final char meteg = '\u05bd' ;
-public static final char maqaf = '\u05be' ;
-public static final char rafe = '\u05bf' ;
-public static final char paseq = '\u05c0' ;
-public static final char shindot = '\u05c1' ;
-public static final char sindot = '\u05c2' ;
-public static final char sofpasuq = '\u05c3' ;
-public static final char upperdot = '\u05c4' ;
-
-public static final char masoranumberdot = '\u0307' ;
-
-// Accents
-
-public static final char etnachta = '\u0591' ;
-public static final char accentsegol = '\u0592' ;
-public static final char shalshelet = '\u0593' ;
-public static final char zaqefqatan = '\u0594' ;
-public static final char zaqefgadol = '\u0595' ;
-public static final char tipeha = '\u0596' ;
-public static final char revia = '\u0597' ;
-public static final char zarqa = '\u0598' ;
-public static final char pashta = '\u0599' ;
-public static final char yetiv = '\u059a' ;
-public static final char tevir = '\u059b' ;
-public static final char geresh = '\u059c' ;
-public static final char gereshmuqdam= '\u059d' ;
-public static final char gershayim = '\u059e' ;
-public static final char qarneypara = '\u059f' ;
-public static final char telishagedola='\u05a0' ;
-public static final char pazer = '\u05a1' ;
-public static final char reserved2 = '\u05a2' ;
-public static final char munah = '\u05a3' ;
-public static final char mahapakh = '\u05a4' ;
-public static final char merkha = '\u05a5' ;
-public static final char merkhakefula= '\u05a6' ;
-public static final char darga = '\u05a7' ;
-public static final char qadma = '\u05a8' ;
-public static final char telishaqetana='\u05a9' ;
-public static final char yerahbenyomo= '\u05aa' ;
-public static final char ole = '\u05ab' ;
-public static final char iluy = '\u05ac' ;
-public static final char dehi = '\u05ad' ;
-public static final char zinor = '\u05ae' ;
-public static final char masoracircle= '\u05af' ;
-
-// Yiddish ligatures for completeness
-public static final char doublevav = '\u05f0' ;
-public static final char vavyod = '\u05f1' ;
-public static final char doubleyod = '\u05f2' ;
-
-
-// Additional punctuation
-public static final char punctgeresh = '\u05f3' ;
-public static final char punctgershayim = '\u05f4' ;
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-// Letters = Consonants as Strings have initial capital letter in name.
-
-public static final String Alef = "\u05d0" ;
-public static final String Bet = "\u05d1" ;
-public static final String Gimel = "\u05d2" ;
-public static final String Dalet = "\u05d3" ;
-public static final String He = "\u05d4" ;
-public static final String Vav = "\u05d5" ;
-public static final String Zayin = "\u05d6" ;
-public static final String Het = "\u05d7" ;
-public static final String Tet = "\u05d8" ;
-public static final String Yod = "\u05d9" ;
-public static final String Finalkaf = "\u05dA" ;
-public static final String Kaf = "\u05dB" ;
-public static final String Lamed = "\u05dC" ;
-public static final String Finalmem = "\u05dD" ;
-public static final String Mem = "\u05dE" ;
-public static final String Finalnun = "\u05dF" ;
-public static final String Nun = "\u05e0" ;
-public static final String Invertednun = "\uf300" ;
-public static final String Samekh = "\u05e1" ;
-public static final String Ayin = "\u05e2" ;
-public static final String Finalpe = "\u05e3" ;
-public static final String Pe = "\u05e4" ;
-public static final String Finaltsadi = "\u05e5" ;
-public static final String Tsadi = "\u05e6" ;
-public static final String Qof = "\u05e7" ;
-public static final String Resh = "\u05e8" ;
-public static final String Shin = "\u05e9" ;
-public static final String Tav = "\u05eA" ;
-//-----------------------------------------------------------------------------
-
-// Book names in Hebrew
-
-public static final String Tnk = Tav+Nun+Character.toString(punctgershayim)+Finalkaf ;
-
-public static final String Gen = Bet+Resh+Alef+Shin+Yod+Tav ;
-public static final String Exod = Shin+Mem+Vav+Tav ;
-public static final String Lev = Vav+Yod+Qof+Resh+Alef ;
-public static final String Num = Bet+Mem+Dalet+Bet+Dalet ;
-public static final String Deut = Dalet+Bet+Resh+Yod+Finalmem ;
-
-public static final String Josh = Yod+He+Vav+Shin+Ayin ;
-public static final String Judg = Shin+Vav+Pe+Tet+Yod+Finalmem ;
-public static final String Sam1 = Shin+Mem+Vav+Alef+Lamed+" "+Alef ;
-public static final String Sam2 = Shin+Mem+Vav+Alef+Lamed+" "+Bet ;
-public static final String Kgs1 = Mem+Lamed+Kaf+Yod+Finalmem+" "+Alef ;
-public static final String Kgs2 = Mem+Lamed+Kaf+Yod+Finalmem+" "+Bet ;
-public static final String Isa = Yod+Shin+Ayin+He ;
-public static final String Jer = Yod+Resh+Mem+Yod+He ;
-public static final String Ezek = Yod+Het+Zayin+Qof+Alef+Lamed ;
-
-public static final String Hos = He+Vav+Shin+Ayin ;
-public static final String Joel = Yod+Vav+Alef+Lamed ;
-public static final String Amos = Ayin+Mem+Vav+Samekh ;
-public static final String Obad = Ayin+Bet+Dalet+Yod+He ;
-public static final String Jonah = Yod+Vav+Nun+He ;
-public static final String Micah = Mem+Yod+Kaf+He ;
-public static final String Nahum = Nun+Het+Vav+Finalmem ;
-public static final String Hab = Het+Bet+Qof+Vav+Qof ;
-public static final String Zeph = Tsadi+Pe+Nun+Yod+He ;
-public static final String Hag = Het+Gimel+Yod ;
-public static final String Zech = Zayin+Kaf+Resh+Yod+He ;
-public static final String Mal = Mem+Lamed+Alef+Kaf+Yod ;
-
-public static final String Ps = Tav+He+Yod+Lamed+Yod+Finalmem ;
-public static final String Job = Alef+Yod+Vav+Bet ;
-public static final String Prov = Mem+Shin+Lamed+Yod ;
-public static final String Ruth = Resh+Vav+Tav ;
-public static final String Song = Shin+Yod+Resh+" "+He+Shin+Yod+Resh+Yod+Finalmem ;
-public static final String Eccl = Qof+He+Lamed+Tav ;
-public static final String Lam = Alef+Yod+Kaf+He ;
-public static final String Esth = Alef+Samekh+Tav+Resh ;
-public static final String Dan = Dalet+Nun+Yod+Alef+Lamed ;
-public static final String Ezra = Ayin+Zayin+Resh+Alef ;
-public static final String Neh= Nun+Het+Mem+Yod+He ;
-public static final String Chr1 = Dalet+Bet+Resh+Yod+" "+He+Yod+Mem+Yod+Finalmem+" "+Alef ;
-public static final String Chr2 = Dalet+Bet+Resh+Yod+" "+He+Yod+Mem+Yod+Finalmem+" "+Bet ;
-//-----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Translate ; + +//============================================================================== +/** + * <b>Unicode Hebrew characters</b><p> + * + * From Unicode Hebrew, Version 4.0. + */ +//============================================================================== +public class H{ + +// Letters = Consonants + +public static final char alef = '\u05d0' ; +public static final char bet = '\u05d1' ; +public static final char gimel = '\u05d2' ; +public static final char dalet = '\u05d3' ; +public static final char he = '\u05d4' ; +public static final char vav = '\u05d5' ; +public static final char zayin = '\u05d6' ; +public static final char het = '\u05d7' ; +public static final char tet = '\u05d8' ; +public static final char yod = '\u05d9' ; +public static final char finalkaf = '\u05dA' ; +public static final char kaf = '\u05dB' ; +public static final char lamed = '\u05dC' ; +public static final char finalmem = '\u05dD' ; +public static final char mem = '\u05dE' ; +public static final char finalnun = '\u05dF' ; +public static final char nun = '\u05e0' ; +public static final char samekh = '\u05e1' ; +public static final char ayin = '\u05e2' ; +public static final char finalpe = '\u05e3' ; +public static final char pe = '\u05e4' ; +public static final char finaltsadi = '\u05e5' ; +public static final char tsadi = '\u05e6' ; +public static final char qof = '\u05e7' ; +public static final char resh = '\u05e8' ; +public static final char shin = '\u05e9' ; +public static final char tav = '\u05eA' ; + +// Points and punctuation + +public static final char sheva = '\u05b0' ; +public static final char hatafsegol = '\u05b1' ; +public static final char hatafpatah = '\u05b2' ; +public static final char hatafqamats = '\u05b3' ; +public static final char hiriq = '\u05b4' ; +public static final char tsere = '\u05b5' ; +public static final char segol = '\u05b6' ; +public static final char patah = '\u05b7' ; +public static final char qamats = '\u05b8' ; +public static final char holam = '\u05b9' ; +public static final char reserved = '\u05ba' ; +public static final char qubuts = '\u05bb' ; +public static final char dagesh = '\u05bc' ; +public static final char meteg = '\u05bd' ; +public static final char maqaf = '\u05be' ; +public static final char rafe = '\u05bf' ; +public static final char paseq = '\u05c0' ; +public static final char shindot = '\u05c1' ; +public static final char sindot = '\u05c2' ; +public static final char sofpasuq = '\u05c3' ; +public static final char upperdot = '\u05c4' ; + +public static final char masoranumberdot = '\u0307' ; + +// Accents + +public static final char etnachta = '\u0591' ; +public static final char accentsegol = '\u0592' ; +public static final char shalshelet = '\u0593' ; +public static final char zaqefqatan = '\u0594' ; +public static final char zaqefgadol = '\u0595' ; +public static final char tipeha = '\u0596' ; +public static final char revia = '\u0597' ; +public static final char zarqa = '\u0598' ; +public static final char pashta = '\u0599' ; +public static final char yetiv = '\u059a' ; +public static final char tevir = '\u059b' ; +public static final char geresh = '\u059c' ; +public static final char gereshmuqdam= '\u059d' ; +public static final char gershayim = '\u059e' ; +public static final char qarneypara = '\u059f' ; +public static final char telishagedola='\u05a0' ; +public static final char pazer = '\u05a1' ; +public static final char reserved2 = '\u05a2' ; +public static final char munah = '\u05a3' ; +public static final char mahapakh = '\u05a4' ; +public static final char merkha = '\u05a5' ; +public static final char merkhakefula= '\u05a6' ; +public static final char darga = '\u05a7' ; +public static final char qadma = '\u05a8' ; +public static final char telishaqetana='\u05a9' ; +public static final char yerahbenyomo= '\u05aa' ; +public static final char ole = '\u05ab' ; +public static final char iluy = '\u05ac' ; +public static final char dehi = '\u05ad' ; +public static final char zinor = '\u05ae' ; +public static final char masoracircle= '\u05af' ; + +// Yiddish ligatures for completeness +public static final char doublevav = '\u05f0' ; +public static final char vavyod = '\u05f1' ; +public static final char doubleyod = '\u05f2' ; + + +// Additional punctuation +public static final char punctgeresh = '\u05f3' ; +public static final char punctgershayim = '\u05f4' ; + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +// Letters = Consonants as Strings have initial capital letter in name. + +public static final String Alef = "\u05d0" ; +public static final String Bet = "\u05d1" ; +public static final String Gimel = "\u05d2" ; +public static final String Dalet = "\u05d3" ; +public static final String He = "\u05d4" ; +public static final String Vav = "\u05d5" ; +public static final String Zayin = "\u05d6" ; +public static final String Het = "\u05d7" ; +public static final String Tet = "\u05d8" ; +public static final String Yod = "\u05d9" ; +public static final String Finalkaf = "\u05dA" ; +public static final String Kaf = "\u05dB" ; +public static final String Lamed = "\u05dC" ; +public static final String Finalmem = "\u05dD" ; +public static final String Mem = "\u05dE" ; +public static final String Finalnun = "\u05dF" ; +public static final String Nun = "\u05e0" ; +public static final String Invertednun = "\uf300" ; +public static final String Samekh = "\u05e1" ; +public static final String Ayin = "\u05e2" ; +public static final String Finalpe = "\u05e3" ; +public static final String Pe = "\u05e4" ; +public static final String Finaltsadi = "\u05e5" ; +public static final String Tsadi = "\u05e6" ; +public static final String Qof = "\u05e7" ; +public static final String Resh = "\u05e8" ; +public static final String Shin = "\u05e9" ; +public static final String Tav = "\u05eA" ; +//----------------------------------------------------------------------------- + +// Book names in Hebrew + +public static final String Tnk = Tav+Nun+Character.toString(punctgershayim)+Finalkaf ; + +public static final String Gen = Bet+Resh+Alef+Shin+Yod+Tav ; +public static final String Exod = Shin+Mem+Vav+Tav ; +public static final String Lev = Vav+Yod+Qof+Resh+Alef ; +public static final String Num = Bet+Mem+Dalet+Bet+Dalet ; +public static final String Deut = Dalet+Bet+Resh+Yod+Finalmem ; + +public static final String Josh = Yod+He+Vav+Shin+Ayin ; +public static final String Judg = Shin+Vav+Pe+Tet+Yod+Finalmem ; +public static final String Sam1 = Shin+Mem+Vav+Alef+Lamed+" "+Alef ; +public static final String Sam2 = Shin+Mem+Vav+Alef+Lamed+" "+Bet ; +public static final String Kgs1 = Mem+Lamed+Kaf+Yod+Finalmem+" "+Alef ; +public static final String Kgs2 = Mem+Lamed+Kaf+Yod+Finalmem+" "+Bet ; +public static final String Isa = Yod+Shin+Ayin+He ; +public static final String Jer = Yod+Resh+Mem+Yod+He ; +public static final String Ezek = Yod+Het+Zayin+Qof+Alef+Lamed ; + +public static final String Hos = He+Vav+Shin+Ayin ; +public static final String Joel = Yod+Vav+Alef+Lamed ; +public static final String Amos = Ayin+Mem+Vav+Samekh ; +public static final String Obad = Ayin+Bet+Dalet+Yod+He ; +public static final String Jonah = Yod+Vav+Nun+He ; +public static final String Micah = Mem+Yod+Kaf+He ; +public static final String Nahum = Nun+Het+Vav+Finalmem ; +public static final String Hab = Het+Bet+Qof+Vav+Qof ; +public static final String Zeph = Tsadi+Pe+Nun+Yod+He ; +public static final String Hag = Het+Gimel+Yod ; +public static final String Zech = Zayin+Kaf+Resh+Yod+He ; +public static final String Mal = Mem+Lamed+Alef+Kaf+Yod ; + +public static final String Ps = Tav+He+Yod+Lamed+Yod+Finalmem ; +public static final String Job = Alef+Yod+Vav+Bet ; +public static final String Prov = Mem+Shin+Lamed+Yod ; +public static final String Ruth = Resh+Vav+Tav ; +public static final String Song = Shin+Yod+Resh+" "+He+Shin+Yod+Resh+Yod+Finalmem ; +public static final String Eccl = Qof+He+Lamed+Tav ; +public static final String Lam = Alef+Yod+Kaf+He ; +public static final String Esth = Alef+Samekh+Tav+Resh ; +public static final String Dan = Dalet+Nun+Yod+Alef+Lamed ; +public static final String Ezra = Ayin+Zayin+Resh+Alef ; +public static final String Neh= Nun+Het+Mem+Yod+He ; +public static final String Chr1 = Dalet+Bet+Resh+Yod+" "+He+Yod+Mem+Yod+Finalmem+" "+Alef ; +public static final String Chr2 = Dalet+Bet+Resh+Yod+" "+He+Yod+Mem+Yod+Finalmem+" "+Bet ; +//----------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Header.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Header.java index 2cbe0fc..d05a6c7 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Header.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Header.java @@ -1,69 +1,69 @@ -package WLC2OSIS.Translate ;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Translate.* ;
-import WLC2OSIS.Utilities.* ;
-
-// import java.util.Date ;
-// import java.text.SimpleDateFormat ;
-//==============================================================================
-/**
- * <b>Header information for Tanach.</b><p>
- */
-//==============================================================================
-public class Header{
-
-// static SimpleDateFormat DateFormat = new SimpleDateFormat("dd MMM yyyy") ;
-// static String DateTime ;
-
-public Header(){
- }
-//-----------------------------------------------------------------------------
-
-// Writes the Notes to the XML file.
-
-public static void writeHeader(WLC2OSIS A, XMLWriter w) {
-// Date DT = new Date() ;
-// DateTime = DateFormat.format(DT) ;
- A.w.openTag("osisText osisIDWork=\"WLC\" osisRefWork=\"bible\" xml:lang=\"he\"", 0) ;
- A.w.openTag("header", 0) ;
-
- A.w.openTag("work osisWork=\"WLC\"", 1) ;
-
- A.w.writeString("title", 2, "Westminster Leningrad Codex");
- A.w.writeAttributedString("contributor", 2, "role=\"encoder\"", "Martin Gruner");
- A.w.writeAttributedString("type", 2, "type=\"OSIS\"", "Bible");
- A.w.writeAttributedString("identifier", 2, "type=\"OSIS\"", "Bible.he.WLC.2004");
- A.w.writeAttributedString("rights", 2, "type=\"x-copyright\"",
- "The WLC is maintained by the Westminster Hebrew Institute, Philadelphia, PA (http://whi.wts.edu/WHI)");
- A.w.writeString("scope", 2, "Hebrew Bible, Old Testament");
- A.w.writeString("refSystem", 2, "MT");
-
- A.w.closeTag("work", 1);
-
- A.w.closeTag("header", 0);
-
-// A.w.writeString("hebrewname", 1, H.Tnk) ;
-// A.w.writeString("title", 1, A.Title) ;
-// A.w.writeString("shortdescription", 1, A.ShortDescription) ;
-// for (int i =0; i < A.Description.length; i++){
-// A.w.writeString("description", 1, A.Description[i]) ;
-// }
-// //A.w.writeString("date", 1, A.Date) ;
-// A.w.writeString("transcriptiondate", 1, DateTime) ;
-// A.w.writeString("copyright", 1, "\u00A9 C. V. Kimball 2004") ;
-// A.w.writeString("filename", 1, A.InputFilename) ;
-//
-// A.w.closeTag("header", 0) ;
- }
-
-//==============================================================================
-
-public static void writeFooter(WLC2OSIS A, XMLWriter w) {
-
- A.w.closeTag("osisText", 0);
-
- }
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-}//==============================================================================
+package WLC2OSIS.Translate ; + +import WLC2OSIS.* ; +import WLC2OSIS.Translate.* ; +import WLC2OSIS.Utilities.* ; + +// import java.util.Date ; +// import java.text.SimpleDateFormat ; +//============================================================================== +/** + * <b>Header information for Tanach.</b><p> + */ +//============================================================================== +public class Header{ + +// static SimpleDateFormat DateFormat = new SimpleDateFormat("dd MMM yyyy") ; +// static String DateTime ; + +public Header(){ + } +//----------------------------------------------------------------------------- + +// Writes the Notes to the XML file. + +public static void writeHeader(WLC2OSIS A, XMLWriter w) { +// Date DT = new Date() ; +// DateTime = DateFormat.format(DT) ; + A.w.openTag("osisText osisIDWork=\"WLC\" osisRefWork=\"bible\" xml:lang=\"he\"", 0) ; + A.w.openTag("header", 0) ; + + A.w.openTag("work osisWork=\"WLC\"", 1) ; + + A.w.writeString("title", 2, "Westminster Leningrad Codex"); + A.w.writeAttributedString("contributor", 2, "role=\"encoder\"", "Martin Gruner"); + A.w.writeAttributedString("type", 2, "type=\"OSIS\"", "Bible"); + A.w.writeAttributedString("identifier", 2, "type=\"OSIS\"", "Bible.he.WLC.2004"); + A.w.writeAttributedString("rights", 2, "type=\"x-copyright\"", + "The WLC is maintained by the Westminster Hebrew Institute, Philadelphia, PA (http://whi.wts.edu/WHI)"); + A.w.writeString("scope", 2, "Hebrew Bible, Old Testament"); + A.w.writeString("refSystem", 2, "MT"); + + A.w.closeTag("work", 1); + + A.w.closeTag("header", 0); + +// A.w.writeString("hebrewname", 1, H.Tnk) ; +// A.w.writeString("title", 1, A.Title) ; +// A.w.writeString("shortdescription", 1, A.ShortDescription) ; +// for (int i =0; i < A.Description.length; i++){ +// A.w.writeString("description", 1, A.Description[i]) ; +// } +// //A.w.writeString("date", 1, A.Date) ; +// A.w.writeString("transcriptiondate", 1, DateTime) ; +// A.w.writeString("copyright", 1, "\u00A9 C. V. Kimball 2004") ; +// A.w.writeString("filename", 1, A.InputFilename) ; +// +// A.w.closeTag("header", 0) ; + } + +//============================================================================== + +public static void writeFooter(WLC2OSIS A, XMLWriter w) { + + A.w.closeTag("osisText", 0); + + } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +}//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MC.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MC.java index f72f400..aa9fc4d 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MC.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MC.java @@ -1,242 +1,242 @@ -package WLC2OSIS.Translate ;
-
-import WLC2OSIS.Utilities.* ;
-import Utilities.* ;
-
-import java.io.*;
-//==============================================================================
-/**
- * <b>MC ASCII decoding constants</b>.<p/>
- */
-//==============================================================================
-public class MC{
-
-/** Array of MCOs indexed by the lowest 7 bits of the character value. */
-static MCO[] Characters = new MCO[128] ;
-/** Array of MCOs indexed by integers from 0 to 99 */
-static MCO[] Numbers = new MCO[100] ;
-//-----------------------------------------------------------------------------
-
-// static initializer
-
-static {
-
-//-----------------------------------------------------------------------------
-
-// Set Unknown to all types.
-
- for (int k=0; k < 128; k++){
- Characters[k] = new MCO("Unknown", MCO.Unknown, "Unspecified", "Unspecified", 0 ) ;
- }
- for (int k=0; k < 100; k++){
- Numbers[k] = new MCO("Unknown", MCO.Unknown, "Unspecified", "Unspecified", 0 ) ;
- }
-//-----------------------------------------------------------------------------
-
-// Set the Characters table
-
- for (int k=0; k < 128; k++){
-
-// Set the Consonants.
-
- if(k == (int) ')') Characters[k] =
- new MCO("alef", MCO.Consonant, H.alef, H.alef, 0 ) ;
- if(k == (int) 'B') Characters[k] =
- new MCO("bet", MCO.Consonant, H.bet, H.bet, 0 ) ;
- if(k == (int) 'G') Characters[k] =
- new MCO("gimel", MCO.Consonant, H.gimel, H.gimel, 0 ) ;
- if(k == (int) 'D') Characters[k] =
- new MCO("dalet", MCO.Consonant, H.dalet, H.dalet, 0 ) ;
- if(k == (int) 'H') Characters[k] =
- new MCO("he", MCO.Consonant, H.he, H.he, 0 ) ;
- if(k == (int) 'W') Characters[k] =
- new MCO("vav", MCO.Consonant, H.vav, H.vav, 0 ) ;
- if(k == (int) 'Z') Characters[k] =
- new MCO("zayin", MCO.Consonant, H.zayin, H.zayin, 0 ) ;
- if(k == (int) 'X') Characters[k] =
- new MCO("het", MCO.Consonant, H.het, H.het, 0 ) ;
- if(k == (int) '+') Characters[k] =
- new MCO("tet", MCO.Consonant, H.tet, H.tet, 0 ) ;
- if(k == (int) 'Y') Characters[k] =
- new MCO("yod", MCO.Consonant, H.yod, H.yod, 0 ) ;
- if(k == (int) 'K') Characters[k] =
- new MCO("kaf", MCO.Consonant, H.kaf, H.finalkaf, 0 ) ;
- if(k == (int) 'L') Characters[k] =
- new MCO("lamed", MCO.Consonant, H.lamed, H.lamed, 0 ) ;
- if(k == (int) 'M') Characters[k] =
- new MCO("mem", MCO.Consonant, H.mem, H.finalmem, 0 ) ;
- if(k == (int) 'N') Characters[k] =
- new MCO("nun", MCO.Consonant, H.nun, H.finalnun, 0 );
- if(k == (int) 'S') Characters[k] =
- new MCO("samekh", MCO.Consonant, H.samekh, H.samekh, 0 ) ;
- if(k == (int) 'P') Characters[k] =
- new MCO("pe", MCO.Consonant, H.pe, H.finalpe, 0 ) ;
- if(k == (int) '(') Characters[k] =
- new MCO("ayin", MCO.Consonant, H.ayin, H.ayin, 0 ) ;
- if(k == (int) 'C') Characters[k] =
- new MCO("tsadi", MCO.Consonant, H.tsadi, H.finaltsadi, 0 ) ;
- if(k == (int) 'Q') Characters[k] =
- new MCO("qof", MCO.Consonant, H.qof, H.qof, 0 ) ;
- if(k == (int) 'R') Characters[k] =
- new MCO("resh", MCO.Consonant, H.resh, H.resh, 0 ) ;
- if(k == (int) '$'){
- MCO m = new MCO("shindot", MCO.Mark, H.shindot, H.shindot, 1 ) ;
- Characters[k] =
- new MCO("shin", MCO.ConsonantMark, H.shin, H.shin, 0, m) ;
- }
- if(k == (int) '&') {
- MCO m = new MCO("sindot", MCO.Mark, H.sindot, H.sindot, 2 ) ;
- Characters[k] =
- new MCO("shin", MCO.ConsonantMark, H.shin, H.shin, 0, m) ;
- }
- if(k == (int) '#') Characters[k] =
- new MCO("shin", MCO.Consonant, H.shin, H.shin, 0 ) ;
- if(k == (int) 'T') Characters[k] =
- new MCO("tav", MCO.Consonant, H.tav, H.tav, 0 ) ;
-
-
-// Set the dagesh.
-
- if(k == (int) '.') Characters[k] =
- new MCO("dagesh", MCO.Mark, H.dagesh, H.dagesh, 3 ) ;
-
-// Set the rafe.
-
- if(k == (int) ',') Characters[k] =
- new MCO("rafe", MCO.Mark, H.rafe, H.rafe, 4 ) ;
-
-// Set the maqaf.
-
- if(k == (int) '-') Characters[k] =
- new MCO("maqef", MCO.Punctuation, H.maqaf, H.maqaf, 16 ) ;
-
-// Set the morphological division indicator.
-
- if(k == (int) '/') Characters[k] =
- new MCO("morphological divider", MCO.MorphologicalDivision, ' ', ' ', 15 ) ;
-
-// Set the vowels
-
-// : is the hataf indicator
- if(k == (int) ':') Characters[k] =
- new MCO("sheva", MCO.Sheva, H.sheva, H.sheva, 7 ) ;
- if(k == (int) 'O') Characters[k] =
- new MCO("holam", MCO.Mark, H.holam, H.holam, 5 ) ;
- if(k == (int) 'I') Characters[k] =
- new MCO("hiriq", MCO.Mark, H.hiriq, H.hiriq, 7 ) ;
- if(k == (int) 'U') Characters[k] =
- new MCO("qubuts", MCO.Mark, H.qubuts, H.qubuts, 7 ) ;
- if(k == (int) '"') Characters[k] =
- new MCO("tsere", MCO.Mark, H.tsere, H.tsere, 7 ) ;
- if(k == (int) 'A') Characters[k] =
- new MCO("patah", MCO.Vowel, H.patah, H.hatafpatah, 7 ) ;
- if(k == (int) 'F') Characters[k] =
- new MCO("qamatz", MCO.Vowel, H.qamats, H.hatafqamats, 7 ) ;
- if(k == (int) 'E') Characters[k] =
- new MCO("segol", MCO.Vowel, H.segol, H.hatafsegol, 7 ) ;
-
-// Set the accents as digits in the Characters table.
-
- if(k == (int) '0') Characters[k] =
- new MCO("0", MCO.Number, '0', '0', 0 ) ;
- if(k == (int) '1') Characters[k] =
- new MCO("1", MCO.Number, '1', '1', 0 ) ;
- if(k == (int) '2') Characters[k] =
- new MCO("0", MCO.Number, '2', '2', 0 ) ;
- if(k == (int) '3') Characters[k] =
- new MCO("3", MCO.Number, '3', '3', 0 ) ;
- if(k == (int) '4') Characters[k] =
- new MCO("4", MCO.Number, '4', '4', 0 ) ;
- if(k == (int) '5') Characters[k] =
- new MCO("5", MCO.Number, '5', '5', 0 ) ;
- if(k == (int) '6') Characters[k] =
- new MCO("6", MCO.Number, '6', '6', 0 ) ;
- if(k == (int) '7') Characters[k] =
- new MCO("7", MCO.Number, '7', '7', 0 ) ;
- if(k == (int) '8') Characters[k] =
- new MCO("8", MCO.Number, '8', '8', 0 ) ;
- if(k == (int) '9') Characters[k] =
- new MCO("9", MCO.Number, '9', '9', 0 ) ;
-
-// Note
-
- if(k == (int) ']') Characters[k] =
- new MCO("Note", MCO.Note, ' ', ' ', 14 ) ;
-
- }
-
-//-----------------------------------------------------------------------------
-
-// Set the accents (From Grove's supplement.)
-// The same Unicode character may apply to several MCW accent codes.
-
- Numbers[0] = new MCO("sof pasuq", MCO.Punctuation, H.sofpasuq, H.sofpasuq, 16 ) ;
- Numbers[1] = new MCO("accentsegol", MCO.Mark, H.accentsegol, H.accentsegol, 11 ) ;
- Numbers[2] = new MCO("zinor", MCO.Mark, H.zinor, H.zinor, 13 ) ;
- Numbers[3] = new MCO("pashta", MCO.Mark, H.pashta, H.pashta, 13 ) ;
- Numbers[4] = new MCO("telishaqetana", MCO.Mark, H.telishaqetana, H.telishaqetana, 13 ) ;
- Numbers[5] = new MCO("blank+paseq", MCO.Punctuation, " " + H.paseq, " " + H.paseq, 16 ) ;
-
- Numbers[10] = new MCO("yetiv", MCO.PrepositiveMark, H.yetiv, H.yetiv, 10 ) ;
- Numbers[13] = new MCO("dehi", MCO.PrepositiveMark, H.dehi, H.dehi, 10 ) ;
-
- Numbers[11] = new MCO("gereshmuqdam", MCO.PrepositiveMark, H.gereshmuqdam, H.gereshmuqdam, 11 ) ;
- Numbers[14] = new MCO("telishagedola", MCO.PrepositiveMark, H.telishagedola, H.telishagedola, 11 ) ;
-
- Numbers[24] = new MCO("telishaqetana", MCO.Mark, H.telishaqetana, H.telishaqetana, 13 ) ;
- Numbers[33] = new MCO("pashta", MCO.Mark, H.pashta, H.pashta, 13 ) ;
- Numbers[44] = new MCO("telishagedola", MCO.Mark, H.telishagedola, H.telishagedola, 11 ) ;
- Numbers[52] = new MCO("lowpunctum", MCO.Mark,'\u0323', '\u0323' , 9 ) ;
- Numbers[53] = new MCO("highpunctum", MCO.Mark, '\u05c4', '\u05c4', 12 ) ;
- Numbers[60] = new MCO("ole", MCO.Mark, H.ole, H.ole, 11 ) ;
- Numbers[61] = new MCO("geresh", MCO.Mark, H.geresh, H.geresh, 11 ) ;
- Numbers[62] = new MCO("gershayim", MCO.Mark, H.gershayim, H.gershayim, 11 ) ;
- Numbers[63] = new MCO("qadma", MCO.Mark, H.qadma, H.qadma, 11 ) ;
- Numbers[64] = new MCO("iluy", MCO.Mark, H.iluy, H.iluy,11 ) ;
- Numbers[65] = new MCO("shalshelet", MCO.Mark, H.shalshelet, H.shalshelet, 11 ) ;
- Numbers[80] = new MCO("zaqefqatan", MCO.Mark, H.zaqefqatan, H.zaqefqatan, 11 ) ;
- Numbers[81] = new MCO("revia", MCO.Mark, H.revia, H.revia, 11 ) ;
- Numbers[82] = new MCO("zarqa", MCO.Mark, H.zarqa, H.zarqa, 11 ) ;
- Numbers[83] = new MCO("pazer", MCO.Mark, H.pazer, H.pazer, 11 ) ;
- Numbers[84] = new MCO("qarneypara", MCO.Mark, H.qarneypara, H.qarneypara, 11 ) ;
- Numbers[85] = new MCO("zaqefgadol", MCO.Mark, H.zaqefgadol, H.zaqefgadol, 11 ) ;
- String ZWJMeteg = Character.toString('\u200D')+ Character.toString(H.meteg) ;
- Numbers[35] = new MCO("centermeteg", MCO.Mark, ZWJMeteg, ZWJMeteg, 8 ) ;
- Numbers[70] = new MCO("mahapakh", MCO.Mark, H.mahapakh, H.mahapakh, 7 ) ;
- Numbers[71] = new MCO("merka", MCO.Mark, H.merkha, H.merkha, 7 ) ;
- Numbers[72] = new MCO("merkhakefula", MCO.Mark, H.merkhakefula, H.merkhakefula, 7 ) ;
- Numbers[73] = new MCO("tipeha", MCO.Mark, H.tipeha, H.tipeha, 7 ) ;
- Numbers[74] = new MCO("munah", MCO.Mark, H.munah, H.munah, 7 ) ;
- Numbers[75] = new MCO("leftmeteg", MCO.Mark, H.meteg, H.meteg, 8 ) ;
- Numbers[91] = new MCO("tevir", MCO.Mark, H.tevir, H.tevir, 7 ) ;
- Numbers[92] = new MCO("etnachta", MCO.Mark, H.etnachta, H.etnachta, 7 ) ;
- Numbers[93] = new MCO("yerahbenyomo", MCO.Mark, H.yerahbenyomo, H.yerahbenyomo, 7 ) ;
- Numbers[94] = new MCO("darga", MCO.Mark, H.darga, H.darga, 7 ) ;
- Numbers[95] = new MCO("rightmeteg", MCO.Mark, H.meteg, H.meteg, 6 ) ;
-//-----------------------------------------------------------------------------
-
-// Place the Characters results into the UnicodeChars array.
-
- UnicodeChar.setUnicodeChars(Characters, Numbers) ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Returns an MCO from a character.
-*
-*/
-public static MCO getMCO(char c){
- int k = (int) c ;
- return Characters[k] ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Returns an MCO from an integer.
-*
-*/
-public static MCO getMCO(int k){
- return Numbers[k] ;
- }
-//-----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Translate ; + +import WLC2OSIS.Utilities.* ; +import Utilities.* ; + +import java.io.*; +//============================================================================== +/** + * <b>MC ASCII decoding constants</b>.<p/> + */ +//============================================================================== +public class MC{ + +/** Array of MCOs indexed by the lowest 7 bits of the character value. */ +static MCO[] Characters = new MCO[128] ; +/** Array of MCOs indexed by integers from 0 to 99 */ +static MCO[] Numbers = new MCO[100] ; +//----------------------------------------------------------------------------- + +// static initializer + +static { + +//----------------------------------------------------------------------------- + +// Set Unknown to all types. + + for (int k=0; k < 128; k++){ + Characters[k] = new MCO("Unknown", MCO.Unknown, "Unspecified", "Unspecified", 0 ) ; + } + for (int k=0; k < 100; k++){ + Numbers[k] = new MCO("Unknown", MCO.Unknown, "Unspecified", "Unspecified", 0 ) ; + } +//----------------------------------------------------------------------------- + +// Set the Characters table + + for (int k=0; k < 128; k++){ + +// Set the Consonants. + + if(k == (int) ')') Characters[k] = + new MCO("alef", MCO.Consonant, H.alef, H.alef, 0 ) ; + if(k == (int) 'B') Characters[k] = + new MCO("bet", MCO.Consonant, H.bet, H.bet, 0 ) ; + if(k == (int) 'G') Characters[k] = + new MCO("gimel", MCO.Consonant, H.gimel, H.gimel, 0 ) ; + if(k == (int) 'D') Characters[k] = + new MCO("dalet", MCO.Consonant, H.dalet, H.dalet, 0 ) ; + if(k == (int) 'H') Characters[k] = + new MCO("he", MCO.Consonant, H.he, H.he, 0 ) ; + if(k == (int) 'W') Characters[k] = + new MCO("vav", MCO.Consonant, H.vav, H.vav, 0 ) ; + if(k == (int) 'Z') Characters[k] = + new MCO("zayin", MCO.Consonant, H.zayin, H.zayin, 0 ) ; + if(k == (int) 'X') Characters[k] = + new MCO("het", MCO.Consonant, H.het, H.het, 0 ) ; + if(k == (int) '+') Characters[k] = + new MCO("tet", MCO.Consonant, H.tet, H.tet, 0 ) ; + if(k == (int) 'Y') Characters[k] = + new MCO("yod", MCO.Consonant, H.yod, H.yod, 0 ) ; + if(k == (int) 'K') Characters[k] = + new MCO("kaf", MCO.Consonant, H.kaf, H.finalkaf, 0 ) ; + if(k == (int) 'L') Characters[k] = + new MCO("lamed", MCO.Consonant, H.lamed, H.lamed, 0 ) ; + if(k == (int) 'M') Characters[k] = + new MCO("mem", MCO.Consonant, H.mem, H.finalmem, 0 ) ; + if(k == (int) 'N') Characters[k] = + new MCO("nun", MCO.Consonant, H.nun, H.finalnun, 0 ); + if(k == (int) 'S') Characters[k] = + new MCO("samekh", MCO.Consonant, H.samekh, H.samekh, 0 ) ; + if(k == (int) 'P') Characters[k] = + new MCO("pe", MCO.Consonant, H.pe, H.finalpe, 0 ) ; + if(k == (int) '(') Characters[k] = + new MCO("ayin", MCO.Consonant, H.ayin, H.ayin, 0 ) ; + if(k == (int) 'C') Characters[k] = + new MCO("tsadi", MCO.Consonant, H.tsadi, H.finaltsadi, 0 ) ; + if(k == (int) 'Q') Characters[k] = + new MCO("qof", MCO.Consonant, H.qof, H.qof, 0 ) ; + if(k == (int) 'R') Characters[k] = + new MCO("resh", MCO.Consonant, H.resh, H.resh, 0 ) ; + if(k == (int) '$'){ + MCO m = new MCO("shindot", MCO.Mark, H.shindot, H.shindot, 1 ) ; + Characters[k] = + new MCO("shin", MCO.ConsonantMark, H.shin, H.shin, 0, m) ; + } + if(k == (int) '&') { + MCO m = new MCO("sindot", MCO.Mark, H.sindot, H.sindot, 2 ) ; + Characters[k] = + new MCO("shin", MCO.ConsonantMark, H.shin, H.shin, 0, m) ; + } + if(k == (int) '#') Characters[k] = + new MCO("shin", MCO.Consonant, H.shin, H.shin, 0 ) ; + if(k == (int) 'T') Characters[k] = + new MCO("tav", MCO.Consonant, H.tav, H.tav, 0 ) ; + + +// Set the dagesh. + + if(k == (int) '.') Characters[k] = + new MCO("dagesh", MCO.Mark, H.dagesh, H.dagesh, 3 ) ; + +// Set the rafe. + + if(k == (int) ',') Characters[k] = + new MCO("rafe", MCO.Mark, H.rafe, H.rafe, 4 ) ; + +// Set the maqaf. + + if(k == (int) '-') Characters[k] = + new MCO("maqef", MCO.Punctuation, H.maqaf, H.maqaf, 16 ) ; + +// Set the morphological division indicator. + + if(k == (int) '/') Characters[k] = + new MCO("morphological divider", MCO.MorphologicalDivision, ' ', ' ', 15 ) ; + +// Set the vowels + +// : is the hataf indicator + if(k == (int) ':') Characters[k] = + new MCO("sheva", MCO.Sheva, H.sheva, H.sheva, 7 ) ; + if(k == (int) 'O') Characters[k] = + new MCO("holam", MCO.Mark, H.holam, H.holam, 5 ) ; + if(k == (int) 'I') Characters[k] = + new MCO("hiriq", MCO.Mark, H.hiriq, H.hiriq, 7 ) ; + if(k == (int) 'U') Characters[k] = + new MCO("qubuts", MCO.Mark, H.qubuts, H.qubuts, 7 ) ; + if(k == (int) '"') Characters[k] = + new MCO("tsere", MCO.Mark, H.tsere, H.tsere, 7 ) ; + if(k == (int) 'A') Characters[k] = + new MCO("patah", MCO.Vowel, H.patah, H.hatafpatah, 7 ) ; + if(k == (int) 'F') Characters[k] = + new MCO("qamatz", MCO.Vowel, H.qamats, H.hatafqamats, 7 ) ; + if(k == (int) 'E') Characters[k] = + new MCO("segol", MCO.Vowel, H.segol, H.hatafsegol, 7 ) ; + +// Set the accents as digits in the Characters table. + + if(k == (int) '0') Characters[k] = + new MCO("0", MCO.Number, '0', '0', 0 ) ; + if(k == (int) '1') Characters[k] = + new MCO("1", MCO.Number, '1', '1', 0 ) ; + if(k == (int) '2') Characters[k] = + new MCO("0", MCO.Number, '2', '2', 0 ) ; + if(k == (int) '3') Characters[k] = + new MCO("3", MCO.Number, '3', '3', 0 ) ; + if(k == (int) '4') Characters[k] = + new MCO("4", MCO.Number, '4', '4', 0 ) ; + if(k == (int) '5') Characters[k] = + new MCO("5", MCO.Number, '5', '5', 0 ) ; + if(k == (int) '6') Characters[k] = + new MCO("6", MCO.Number, '6', '6', 0 ) ; + if(k == (int) '7') Characters[k] = + new MCO("7", MCO.Number, '7', '7', 0 ) ; + if(k == (int) '8') Characters[k] = + new MCO("8", MCO.Number, '8', '8', 0 ) ; + if(k == (int) '9') Characters[k] = + new MCO("9", MCO.Number, '9', '9', 0 ) ; + +// Note + + if(k == (int) ']') Characters[k] = + new MCO("Note", MCO.Note, ' ', ' ', 14 ) ; + + } + +//----------------------------------------------------------------------------- + +// Set the accents (From Grove's supplement.) +// The same Unicode character may apply to several MCW accent codes. + + Numbers[0] = new MCO("sof pasuq", MCO.Punctuation, H.sofpasuq, H.sofpasuq, 16 ) ; + Numbers[1] = new MCO("accentsegol", MCO.Mark, H.accentsegol, H.accentsegol, 11 ) ; + Numbers[2] = new MCO("zinor", MCO.Mark, H.zinor, H.zinor, 13 ) ; + Numbers[3] = new MCO("pashta", MCO.Mark, H.pashta, H.pashta, 13 ) ; + Numbers[4] = new MCO("telishaqetana", MCO.Mark, H.telishaqetana, H.telishaqetana, 13 ) ; + Numbers[5] = new MCO("blank+paseq", MCO.Punctuation, " " + H.paseq, " " + H.paseq, 16 ) ; + + Numbers[10] = new MCO("yetiv", MCO.PrepositiveMark, H.yetiv, H.yetiv, 10 ) ; + Numbers[13] = new MCO("dehi", MCO.PrepositiveMark, H.dehi, H.dehi, 10 ) ; + + Numbers[11] = new MCO("gereshmuqdam", MCO.PrepositiveMark, H.gereshmuqdam, H.gereshmuqdam, 11 ) ; + Numbers[14] = new MCO("telishagedola", MCO.PrepositiveMark, H.telishagedola, H.telishagedola, 11 ) ; + + Numbers[24] = new MCO("telishaqetana", MCO.Mark, H.telishaqetana, H.telishaqetana, 13 ) ; + Numbers[33] = new MCO("pashta", MCO.Mark, H.pashta, H.pashta, 13 ) ; + Numbers[44] = new MCO("telishagedola", MCO.Mark, H.telishagedola, H.telishagedola, 11 ) ; + Numbers[52] = new MCO("lowpunctum", MCO.Mark,'\u0323', '\u0323' , 9 ) ; + Numbers[53] = new MCO("highpunctum", MCO.Mark, '\u05c4', '\u05c4', 12 ) ; + Numbers[60] = new MCO("ole", MCO.Mark, H.ole, H.ole, 11 ) ; + Numbers[61] = new MCO("geresh", MCO.Mark, H.geresh, H.geresh, 11 ) ; + Numbers[62] = new MCO("gershayim", MCO.Mark, H.gershayim, H.gershayim, 11 ) ; + Numbers[63] = new MCO("qadma", MCO.Mark, H.qadma, H.qadma, 11 ) ; + Numbers[64] = new MCO("iluy", MCO.Mark, H.iluy, H.iluy,11 ) ; + Numbers[65] = new MCO("shalshelet", MCO.Mark, H.shalshelet, H.shalshelet, 11 ) ; + Numbers[80] = new MCO("zaqefqatan", MCO.Mark, H.zaqefqatan, H.zaqefqatan, 11 ) ; + Numbers[81] = new MCO("revia", MCO.Mark, H.revia, H.revia, 11 ) ; + Numbers[82] = new MCO("zarqa", MCO.Mark, H.zarqa, H.zarqa, 11 ) ; + Numbers[83] = new MCO("pazer", MCO.Mark, H.pazer, H.pazer, 11 ) ; + Numbers[84] = new MCO("qarneypara", MCO.Mark, H.qarneypara, H.qarneypara, 11 ) ; + Numbers[85] = new MCO("zaqefgadol", MCO.Mark, H.zaqefgadol, H.zaqefgadol, 11 ) ; + String ZWJMeteg = Character.toString('\u200D')+ Character.toString(H.meteg) ; + Numbers[35] = new MCO("centermeteg", MCO.Mark, ZWJMeteg, ZWJMeteg, 8 ) ; + Numbers[70] = new MCO("mahapakh", MCO.Mark, H.mahapakh, H.mahapakh, 7 ) ; + Numbers[71] = new MCO("merka", MCO.Mark, H.merkha, H.merkha, 7 ) ; + Numbers[72] = new MCO("merkhakefula", MCO.Mark, H.merkhakefula, H.merkhakefula, 7 ) ; + Numbers[73] = new MCO("tipeha", MCO.Mark, H.tipeha, H.tipeha, 7 ) ; + Numbers[74] = new MCO("munah", MCO.Mark, H.munah, H.munah, 7 ) ; + Numbers[75] = new MCO("leftmeteg", MCO.Mark, H.meteg, H.meteg, 8 ) ; + Numbers[91] = new MCO("tevir", MCO.Mark, H.tevir, H.tevir, 7 ) ; + Numbers[92] = new MCO("etnachta", MCO.Mark, H.etnachta, H.etnachta, 7 ) ; + Numbers[93] = new MCO("yerahbenyomo", MCO.Mark, H.yerahbenyomo, H.yerahbenyomo, 7 ) ; + Numbers[94] = new MCO("darga", MCO.Mark, H.darga, H.darga, 7 ) ; + Numbers[95] = new MCO("rightmeteg", MCO.Mark, H.meteg, H.meteg, 6 ) ; +//----------------------------------------------------------------------------- + +// Place the Characters results into the UnicodeChars array. + + UnicodeChar.setUnicodeChars(Characters, Numbers) ; + } +//----------------------------------------------------------------------------- +/** +* Returns an MCO from a character. +* +*/ +public static MCO getMCO(char c){ + int k = (int) c ; + return Characters[k] ; + } +//----------------------------------------------------------------------------- +/** +* Returns an MCO from an integer. +* +*/ +public static MCO getMCO(int k){ + return Numbers[k] ; + } +//----------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MCO.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MCO.java index 79643b0..98a1221 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MCO.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/MCO.java @@ -1,108 +1,108 @@ -package WLC2OSIS.Translate ;
-
-//==============================================================================
-/**
- * <b>Object representing characters with Name, Type, Group, and Unicode Hebrew
- * initial and final values.</b><p>
- */
-//==============================================================================
-public class MCO implements Cloneable{
-
-
-// Definition of MCO
-
-/** Name of this object */
-public String Name = "" ;
-/** Type of character, an integer. */
-public int Type = 0 ;
-/** Type of the object, changes during processing. */
-public String Value = "" ;
-/** The a final value Unicode character corresponding to the MC character
- * at this position in the CharValue[] CharValues. */
-public String FinalValue = "" ;
-/** Order group */
-public int Group = 0 ;
-/** Included MCO used for ConsonantMark Type only.*/
-public MCO Object = null ;
-
-// Definition of Types
-
-/** No known MC character correponds to this index. */
-public static final int Unknown = 0 ;
-/** MC character correponding to this index is a Consonant. */
-public static final int Consonant = 1 ;
-/** MC character correponding to this index is a Vowel. */
-public static final int Vowel = 2 ;
-/** MC character correponding to this index is a Mark */
-public static final int Mark = 3 ;
-/** MC character correponding to this index is a MorphologicalDivision */
-public static final int MorphologicalDivision = 4 ;
-/** MC character correponding to this index is a Punctuation */
-public static final int Punctuation = 5 ;
-
-// The following types > 5 require expansion or re-ordering
-
-/** MC character correponding to this index is a PrepositiveMark */
-public static final int PrepositiveMark = 6 ;
-/** MC character correponding to this index is a ConsonantMark */
-public static final int ConsonantMark = 7;
-/** MC character correponding to this index is a Number */
-public static final int Number = 8;
-/** MC character correponding to this index is a Sheva */
-public static final int Sheva = 9 ;
-/** MC character correponding to this index is a Note */
-public static final int Note = 10 ;
-
-//-----------------------------------------------------------------------------
-/**
- * Generate from full specification.
- */
-public MCO( String Name, int Type, String Value, String FinalValue, int Group ) {
- this.Name = Name ;
- this.Type = Type ;
- this.Value = Value ;
- this.FinalValue = FinalValue ;
- this.Group = Group ;
- this.Object = Object ;
- }
-//-----------------------------------------------------------------------------
-/**
- * Generate from Value, FinalValue as char with Object.
- */
-public MCO( String Name, int Type, char Value, char FinalValue, int Group,
- MCO Object ) {
- this.Name = Name ;
- this.Type = Type ;
- this.Value = Character.toString(Value) ;
- this.FinalValue = Character.toString(FinalValue) ;
- this.Group = Group ;
- this.Object = Object ;
- }
-//-----------------------------------------------------------------------------
-/**
- * Generate from Value, FinalValue as char without Object.
- */
-public MCO( String Name, int Type, char Value, char FinalValue, int Group ) {
- this.Name = Name ;
- this.Type = Type ;
- this.Value = Character.toString(Value) ;
- this.FinalValue = Character.toString(FinalValue) ;
- this.Group = Group ;
- this.Object = null ;
- }
-//-----------------------------------------------------------------------------
-
-public void print(){
- System.out.print(Name + " + ") ;
- }
-//-----------------------------------------------------------------------------
-
-public Object clone(){
- MCO M = new MCO( Name, Type, Value, FinalValue, Group ) ;
- M.Object = Object ;
- return M ;
- }
-//-----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Translate ; + +//============================================================================== +/** + * <b>Object representing characters with Name, Type, Group, and Unicode Hebrew + * initial and final values.</b><p> + */ +//============================================================================== +public class MCO implements Cloneable{ + + +// Definition of MCO + +/** Name of this object */ +public String Name = "" ; +/** Type of character, an integer. */ +public int Type = 0 ; +/** Type of the object, changes during processing. */ +public String Value = "" ; +/** The a final value Unicode character corresponding to the MC character + * at this position in the CharValue[] CharValues. */ +public String FinalValue = "" ; +/** Order group */ +public int Group = 0 ; +/** Included MCO used for ConsonantMark Type only.*/ +public MCO Object = null ; + +// Definition of Types + +/** No known MC character correponds to this index. */ +public static final int Unknown = 0 ; +/** MC character correponding to this index is a Consonant. */ +public static final int Consonant = 1 ; +/** MC character correponding to this index is a Vowel. */ +public static final int Vowel = 2 ; +/** MC character correponding to this index is a Mark */ +public static final int Mark = 3 ; +/** MC character correponding to this index is a MorphologicalDivision */ +public static final int MorphologicalDivision = 4 ; +/** MC character correponding to this index is a Punctuation */ +public static final int Punctuation = 5 ; + +// The following types > 5 require expansion or re-ordering + +/** MC character correponding to this index is a PrepositiveMark */ +public static final int PrepositiveMark = 6 ; +/** MC character correponding to this index is a ConsonantMark */ +public static final int ConsonantMark = 7; +/** MC character correponding to this index is a Number */ +public static final int Number = 8; +/** MC character correponding to this index is a Sheva */ +public static final int Sheva = 9 ; +/** MC character correponding to this index is a Note */ +public static final int Note = 10 ; + +//----------------------------------------------------------------------------- +/** + * Generate from full specification. + */ +public MCO( String Name, int Type, String Value, String FinalValue, int Group ) { + this.Name = Name ; + this.Type = Type ; + this.Value = Value ; + this.FinalValue = FinalValue ; + this.Group = Group ; + this.Object = Object ; + } +//----------------------------------------------------------------------------- +/** + * Generate from Value, FinalValue as char with Object. + */ +public MCO( String Name, int Type, char Value, char FinalValue, int Group, + MCO Object ) { + this.Name = Name ; + this.Type = Type ; + this.Value = Character.toString(Value) ; + this.FinalValue = Character.toString(FinalValue) ; + this.Group = Group ; + this.Object = Object ; + } +//----------------------------------------------------------------------------- +/** + * Generate from Value, FinalValue as char without Object. + */ +public MCO( String Name, int Type, char Value, char FinalValue, int Group ) { + this.Name = Name ; + this.Type = Type ; + this.Value = Character.toString(Value) ; + this.FinalValue = Character.toString(FinalValue) ; + this.Group = Group ; + this.Object = null ; + } +//----------------------------------------------------------------------------- + +public void print(){ + System.out.print(Name + " + ") ; + } +//----------------------------------------------------------------------------- + +public Object clone(){ + MCO M = new MCO( Name, Type, Value, FinalValue, Group ) ; + M.Object = Object ; + return M ; + } +//----------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Note.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Note.java index 9e8adca..a67f07d 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Note.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Note.java @@ -22,7 +22,7 @@ public static void setNotes(){ + "there might be a question of the validity of the form " + "and we keep the same form as BHS.") ; Notes.put("2", "We have puted a sop pasuq where L and BHC omit it. " - + "(The puted sof pasuq often is missing from the text.)" ) ; + + "(The added sof pasuq often is missing from the text.)" ) ; Notes.put("3", "We read or understand L differently than BHS (1983 Edition). " + "Often this notation indicates a typographical error in BHS.") ; Notes.put("4", "Puncta Extraordaria -- " @@ -35,13 +35,13 @@ public static void setNotes(){ Notes.put("8", "Inverted nun in the text.") ; Notes.put("9", "BHS has abandoned L and we concur. " + "All of these occurrences are ketib/qere problems.") ; - Notes.put("a", "Adaptations to a Qere which L and BHS, by their design, " + Notes.put("a", "Adaptations to a qere which L and BHS, by their design, " + "do not indicate.") ; Notes.put("m", "Miscellaneous notes to the text and occasions " + "where more than one bracket category applies.") ; Notes.put("q", "We have abandoned or puted a ketib/qere relative to BHS. " + "In doing this we agree with L against BHS.") ; - Notes.put("y", "Yathir readings in L which we have designated as Qeres " - + "when both Dothan and BHS list a Qere.") ; + Notes.put("y", "Yathir readings in L which we have designated as qeres " + + "when both Dothan and BHS list a qere.") ; } }
\ No newline at end of file diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Translate.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Translate.java index b63383f..8086033 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Translate.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/Translate.java @@ -245,7 +245,7 @@ public String translate(String W){ Type = M.Type ; // Only Notes require special treatment if (Type == MCO.Note){ - S = S + "<note type=\"textual\">"+ Note.Notes.get( M.Value)+ "</note>"; + S = S + "<note type=\"textual\" xml:lang=\"en\">"+ Note.Notes.get( M.Value)+ "</note>"; } // MG DISABLE MORPH DIVISION!!!!!!!!!!!!!!!! diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/UnicodeChar.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/UnicodeChar.java index 950b239..2a70266 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/UnicodeChar.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/UnicodeChar.java @@ -1,391 +1,391 @@ -package WLC2OSIS.Translate ;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Utilities.* ;
-//==============================================================================
-/**
- * <b>Object describing Unicode Hebrew characters and their relation
- * to the MC characters.</b><p>
- *
- * The static array UnicodeChars describes Hebrew Unicode characters
- * and gives their relationship to the MCW letter code.
- */
-//==============================================================================
-public class UnicodeChar{
-/** Starting index for block of Hebrew Unicode characters.*/
-public static final int UnicodeStart = 0x00000590 ;
-/** Ending index for block of Hebrew Unicode characters.*/
-public static final int UnicodeEnd = 0x00000600 ;
-/** Size of block of Hebrew Unicode characters.*/
-public static final int N = (UnicodeEnd - UnicodeStart) ;
-
-// Object contents
-
-/** Unicode name WITHOUT the word HEBREW or its type.
- * Capital followed by lower case.
- */
-public String Name = "" ; // Unicode name WITHOUT the word HEBREW or
- // its type. Capital followed by lower case.
-/** Unicode type: Accent, Point, Punctuation, Letter, or Ligature. */
-public String Type = " " ;
- /** Unicode character value. */
-public char Value= ' ' ; // Unicode character value.
-/** List of equivalent characters represented by this Unicode character.*/
-public String Equivalents = "" ; // List of equivalents
-/** Notes provided by the Unicode group.*/
- public String Notes = "" ; // Additional notes.
-/** MCW characters corresponding to this Unicode character.*/
-public String MCCode = "" ;
-/** Combining group value. */
-public String Group = "" ;
-
-/** Array of all Hebrew Unicode characters, 0...N. */
-public static UnicodeChar[] UnicodeChars = new UnicodeChar[N] ;
-/** Number of special Unicode characters */
-public static final int Special = 6;
-/** Array of special, non-Hebrew characters */
-public static UnicodeChar[] SpecialChars = new UnicodeChar[Special] ;
-
-//-----------------------------------------------------------------------------
-/**
- * Creates a UnicodeChar object from the given arguments.
- */
-UnicodeChar( char Value, String Name, String Type, String Equivalents, String Notes){
- this.Value = Value ;
- this.Name = Name ;
- this.Type = Type ;
- this.Equivalents = Equivalents ;
- this.Notes = Notes ;
- }
-//-----------------------------------------------------------------------------
-/**
- * Sets the array of UnicodeChar[], UnicodeChars, from the
- * Characters array.
- *
- * @param Characters MCO[] array of MCO object whose
- * index is the value of the corresponding MCW character.
- */
-public static void setUnicodeChars( MCO[] Characters, MCO[] Numbers ) {
-
- for (char k =0; k < N; k++){
- UnicodeChars[k] = new UnicodeChar( '?', "Undefined", "Unspecified", " " , " ") ;
- }
- for (char k =0; k < Special; k++){
- SpecialChars[k] = new UnicodeChar( '?', "Undefined", "Unspecified", " " , " ") ;
- }
-
-// Verify the H assignment and enter into table
-
- enterChar(0x0591, H.etnachta, "Etnachta", "Accent") ;
- enterChar(0x0592, H.accentsegol, "Segol", "Accent" ) ;
- enterChar(0x0593, H.shalshelet,"Shalshelet", "Accent" ) ;
- enterChar(0x0594, H.zaqefqatan, "Zaqef Qatan", "Accent" ) ;
- enterChar(0x0595, H.zaqefgadol, "Zaqef Gadol", "Accent" ) ;
- enterChar(0x0596, H.tipeha, "Tipeha", "Accent", "Tarha", " " ) ;
- enterChar(0x0597, H.revia, "Revia", "Accent" ) ;
- enterChar(0x0598, H.zarqa, "Zarqa", "Accent",
- "Tsinorit, Zinorit, Tsinor, Zinor",
- "This character is to be used when Zarqa or Tsinor are placed above, and also for Tsinorit."
- ) ;
- enterChar(0x0599, H.pashta, "Pashta", "Accent" ) ;
- enterChar(0x059a, H.yetiv, "Yetiv", "Accent" ) ;
- enterChar(0x059b, H.tevir, "Tevir", "Accent" ) ;
- enterChar(0x059c, H.geresh, "Geresh", "Accent" ) ;
- enterChar(0x059d, H.gereshmuqdam, "Geresh Muqdam", "Accent" ) ;
- enterChar(0x059e, H.gershayim, "Gereshayim", "Accent" ) ;
- enterChar(0x059f, H.qarneypara, "Qarney Para", "Accent" ) ;
- enterChar(0x05a0, H.telishagedola, "Telisha Gedola", "Accent") ;
- enterChar(0x05a1, H.pazer, "Pazer", "Accent" ) ;
- enterChar(0x05a3, H.munah, "Munah", "Accent" ) ;
- enterChar(0x05a4, H.mahapakh, "Mahapakh", "Accent" ) ;
- enterChar(0x05a5, H.merkha, "Merkha", "Accent",
- "Yored", " ") ;
- enterChar(0x05a6, H.merkhakefula, "Merkha Kefula", "Accent") ;
- enterChar(0x05a7, H.darga, "Darga", "Accent") ;
- enterChar(0x05a8, H.qadma, "Qadma", "Accent" ) ;
- enterChar(0x05a9, H.telishaqetana, "Telisha Qetana", "Accent" ) ;
- enterChar(0x05aa, H.yerahbenyomo, "Yerah Ben Yomo", "Accent",
- "Galgal", " " ) ;
- enterChar(0x05ab, H.ole, "Ole", "Accent" ) ;
- enterChar(0x05ac, H.iluy, "Iluy", "Accent" ) ;
- enterChar(0x05ad, H.dehi, "Dehi", "Accent" ) ;
- enterChar(0x05ae, H.zinor, "Zinor", "Accent",
- "Tsinor, Zarqa",
- "This character is to be used when Zarqa or Tsinor are placed above left." ) ;
- enterChar(0x05af, H.masoracircle, "Masora Circle", "Mark" ) ;
- enterMCCodeAndGroup(0x05af, "Not used", "12") ;
- enterChar(0x05b0, H.sheva, "Sheva", "Point") ;
- enterChar(0x05b1, H.hatafsegol, "Hataf Segol", "Point" ) ;
- enterChar(0x05b2, H.hatafpatah, "Hataf Patah", "Point" ) ;
- enterChar(0x05b3, H.hatafqamats, "Hataf Qamats", "Point" ) ;
- enterChar(0x05b4, H.hiriq, "Hiriq", "Point" ) ;
- enterChar(0x05b5, H.tsere, "Tsere", "Point" ) ;
- enterChar(0x05b6, H.segol, "Segol", "Point" ) ;
- enterChar(0x05b7, H.patah, "Patah", "Point",
- " ",
- "Furtive patah is not a distinct character.") ;
- enterChar(0x05b8, H.qamats, "Qamats", "Point" ) ;
- enterChar(0x05b9, H.holam, "Holam", "Point") ;
- enterChar(0x05bb, H.qubuts, "Qubuts", "Point" ) ;
- enterChar(0x05bc, H.dagesh, "Dagesh", "Point",
- "Mapiq, Shuriq", "Falls within base letter." ) ;
- enterChar(0x05bd, H.meteg, "Meteg", "Point",
- "Siluq",
- "Maybe used as a Hebrew accent sof pasuq."
- + "Left (75), center (35), and right (95) metegs are separately grouped"
- + " to produce correct positioning."
- + " The center meteg is preceded by a ZWJ, u200D, for positioning." ) ;
- enterChar(0x05be, H.maqaf, "Maqaf", "Point") ;
- enterChar(0x05bf, H.rafe, "Rafe", "Point" ) ;
- enterChar(0x05c0, H.paseq, "Paseq", "Punctuation",
- "Legarmeh",
- "May be treated as spacing punctuation, not as a point. "
- + "Each Paseq is preceded by a Space, \\u0020, for positioning." ) ;
- enterChar(0x05c1, H.shindot, "Shin Dot", "Point") ;
- enterChar(0x05c2, H.sindot, "Sin Dot", "Point" ) ;
- enterChar(0x05c3, H.sofpasuq, "Sof Pasuq", "Point",
- " ", "May be used as a Hebrew punctuation colon.") ;
- enterChar(0x05c4, H.upperdot, "Upper Dot", "Mark" ) ;
-
- enterChar(0x05d0, H.alef, "Alef", "Letter" , "Aleph", " ") ;
- enterChar(0x05d1, H.bet, "Bet", "Letter" ) ;
- enterChar(0x05d2, H.gimel, "Gimel", "Letter" ) ;
- enterChar(0x05d3, H.dalet, "Dalet", "Letter" ) ;
- enterChar(0x05d4, H.he, "He", "Letter" ) ;
- enterChar(0x05d5, H.vav, "Vav", "Letter" ) ;
- enterChar(0x05d6, H.zayin, "Zayin", "Letter" ) ;
- enterChar(0x05d7, H.het, "Het", "Letter" ) ;
- enterChar(0x05d8, H.tet, "Tet", "Letter" ) ;
- enterChar(0x05d9, H.yod, "Yod", "Letter" ) ;
- enterChar(0x05da, H.finalkaf, "Final Kaf", "Letter" ) ;
- enterChar(0x05db, H.kaf, "Kaf", "Letter" ) ;
- enterChar(0x05dc, H.lamed, "Lamed", "Letter" ) ;
- enterChar(0x05dd, H.finalmem, "Final Mem", "Letter" ) ;
- enterChar(0x05de, H.mem, "Mem", "Letter" ) ;
- enterChar(0x05df, H.finalnun, "Final Nun", "Letter" ) ;
- enterChar(0x05e0, H.nun, "Nun", "Letter" ) ;
- enterChar(0x05e1, H.samekh, "Samekh", "Letter" ) ;
- enterChar(0x05e2, H.ayin, "Ayin", "Letter" ) ;
- enterChar(0x05e3, H.finalpe, "Final Pe", "Letter" ) ;
- enterChar(0x05e4, H.pe, "Pe", "Letter" ) ;
- enterChar(0x05e5, H.finaltsadi, "Final Tsadi", "Letter") ;
- enterChar(0x05e6, H.tsadi, "Tsadi", "Letter") ;
- enterChar(0x05e7, H.qof, "Qof", "Letter" ) ;
- enterChar(0x05e8, H.resh, "Resh", "Letter" ) ;
- enterChar(0x05e9, H.shin, "Shin", "Letter" ) ;
- enterChar(0x05ea, H.tav, "Tav", "Letter" ) ;
-
-// enterChar(0x05f0, H.doublevav, "Yiddish Double Vav", "Ligature" ) ;
-// enterChar(0x05f1, H.vavyod, "Yiddish Vav Yod", "Ligature" ) ;
-// enterChar(0x05f2, H.doubleyod, "Yiddish Double Yod", "Ligature" ) ;
-
-// enterChar(0x05f3, H.punctgeresh, "Geresh", "Punctuation",
-// " ", "Punctuation, not an accent.") ;
-// enterChar(0x05f4, H.punctgershayim, "Gershayim", "Punctuation",
-// " ", "Punctuation, not an accent.") ;
-
-//-----------------------------------------------------------------------------
-
-// Set the MCO[] Characters into the UnicodeChar array.
-
- for(int k=0; k < 128; k++){
- MCO m = Characters[k];
- if(m.Type!=MCO.Unknown){
- char test = (m.Value).charAt(0) ;
-// Try to find the Value in the UnicodeChars array,
- boolean FoundValue = false;
- int j ;
- for (j = 0; j < N; j++){
- if(test == UnicodeChars[j].Value ){
- FoundValue = true ;
- break ;
- }
- }
- if(FoundValue){
- if((char)k=='&'){
- }
- else{
- UnicodeChars[j].MCCode = new Character((char)k).toString() ;
- UnicodeChars[j].Group = new Integer(m.Group).toString() ;
- }
- }
-// Try to find it as a final character
- test = (m.FinalValue).charAt(0) ;
- FoundValue = false ;
- for (j = 0; j < N; j++){
- if(test == UnicodeChars[j].Value ){
- FoundValue = true ;
- break ;
- }
- }
- if(FoundValue){
- if((char)k=='&'){
- }
- else{
- UnicodeChars[j].MCCode = new Character((char)k).toString() ;
- UnicodeChars[j].Group = new Integer(m.Group).toString() ;
- }
- }
- }
- }
-//-----------------------------------------------------------------------------
-
-// Set the MCO[] Numbers into the UnicodeChar array.
-
- for(int k=0; k < 100; k++){
- MCO m = Numbers[k];
- if(m.Type!=MCO.Unknown){
- char test = (m.Value).charAt(0) ;
-// Try to find the Value in the UnicodeChars array,
- boolean FoundValue = false;
- int j ;
- for (j = 0; j < N; j++){
- if(test == UnicodeChars[j].Value ){
- FoundValue = true ;
- break ;
- }
- }
- if(FoundValue){
- if (UnicodeChars[j].MCCode.compareTo("") == 0){
- UnicodeChars[j].MCCode = new Integer(k).toString() ;
- }
- else{
- UnicodeChars[j].MCCode = UnicodeChars[j].MCCode
- + ", " + new Integer(k).toString() ;
- }
- UnicodeChars[j].Group = new Integer(m.Group).toString() ;
- }
- }
- }
-// Special characters
-
- enterMCCodeAndGroup(0x05bd, "35, 75, 95", "8, 8, 6") ;
- enterMCCodeAndGroup(0x05c0, "5", "16") ;
- enterMCCodeAndGroup(0x05c1, "Not used", "1") ;
- enterMCCodeAndGroup(0x05c2, "Not used", "2") ;
- UnicodeChars[33].MCCode = ":E" ;
- UnicodeChars[33].Group = "7" ;
- UnicodeChars[34].MCCode = ":A" ;
- UnicodeChars[34].Group = "7" ;
- UnicodeChars[35].MCCode = ":F" ;
- UnicodeChars[35].Group = "7" ;
- UnicodeChars[89].MCCode = "&, $" ;
- UnicodeChars[89].Group = "0" ;
-
-//----------------------------------------------------------------------------
-
-// Special, non-Hebrew characters
-
- SpecialChars[0] = new UnicodeChar( '\u0020', "Space",
- "Space" , " ", "Paseq is a Space + Paseq.") ;
- SpecialChars[0].Group = " " ;
- SpecialChars[0].MCCode = "Not used";
-
- SpecialChars[1] = new UnicodeChar( '/', "Slash",
- "Morphological divider." , " ", "Morphological divider." ) ;
- SpecialChars[1].Group = " " ;
- SpecialChars[1].MCCode = "/";
-
- SpecialChars[2] = new UnicodeChar( '\u0307', "Masora or Number dot",
- "PrepositiveMark" , " ", "Upper punctum. MC code 53, is translated "
- + "as an Upper Dot, \\u05c4, not as this character. "
- + "This mark is not currently positioned properly by Internet Explorer.") ;
- SpecialChars[2].Group = "12" ;
- SpecialChars[2].MCCode = "(53)";
-
- SpecialChars[3] = new UnicodeChar( '\u0323', "Combining dot below",
- "PrepositiveMark" , " ", "Lower punctum. "
- + "This mark is not currently positioned properly by Internet Explorer.") ;
- SpecialChars[3].Group = "12" ;
- SpecialChars[3].MCCode = "52";
-
- SpecialChars[4] = new UnicodeChar( '\u200D', "Zero width joiner (ZWJ)",
- "General punct." , " ", "Center meteg is a ZWJ + meteg.") ;
- SpecialChars[4].Group = " " ;
- SpecialChars[4].MCCode = "Not used";
-
- SpecialChars[5] = new UnicodeChar( '\uf300', "Inverted nun",
- "General punct." , " ", "Not part of the current Unicode standard. "
- + "Displays acceptably in either SBL Hebrew or Ezra SIL fonts.") ;
- SpecialChars[5].Group = " " ;
- SpecialChars[5].MCCode = "Not used";
-
-
-//-----------------------------------------------------------------------------
- return ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Enters a Unicode character into the array UnicodeChars.
-*/
-static void enterChar(int value, char c, String Name, String Type,
- String Equivalents, String Notes) {
- if ( c != (char) value ){
- System.out.println("UnicodeChars: Error in character table!") ;
- System.out.println("Character: " + c + " Value: " + value ) ;
- }
- UnicodeChars[value-UnicodeStart]
- = new UnicodeChar( (char)value, Name, Type, Equivalents, Notes) ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Enters a Unicode character into the array UnicodeChars.
-*/
-static void enterChar(int value, char c, String Name, String Type) {
- if ( c != (char) value ){
- System.out.println("UnicodeChars: Error in character table!") ;
- System.out.println("Character: " + c + " Value: " + value ) ;
- }
- UnicodeChars[value-UnicodeStart]
- = new UnicodeChar( (char)value, Name, Type, "", "") ;
- }
-//-----------------------------------------------------------------------------
-/**
-* Enters the MCCode and Group number for a UnicodeChar.
-*/
-static void enterMCCodeAndGroup(int k, String MCCode, String Group ){
- UnicodeChars[k-UnicodeStart].MCCode = MCCode ;
- UnicodeChars[k-UnicodeStart].Group = Group ;
- }
-//-----------------------------------------------------------------------------
-
-// Writes the Unicode characters as an XML file.
-
-// ** This belongs in UnicodeChars ***
-
-public static void writeUnicodeChars(XMLWriter w) {
- w.openTag("coding", 0) ;
- for (int k=0; k < N ; k++){
- int i = (int) UnicodeChars[k].Value ;
- String h = Integer.toHexString(i) ;
- w.openTag("char", 1) ;
- w.writeString("value", 2, new Character(UnicodeChars[k].Value).toString() ) ;
- w.writeString("hexvalue", 2, h ) ;
- w.writeString("name", 2, UnicodeChars[k].Name) ;
- w.writeString("mccode", 2, UnicodeChars[k].MCCode) ;
- w.writeString("type", 2, UnicodeChars[k].Type) ;
- w.writeString("equivalents", 2, UnicodeChars[k].Equivalents) ;
- w.writeString("notes", 2, UnicodeChars[k].Notes) ;
- w.writeString("group", 2, UnicodeChars[k].Group) ;
- w.closeTag("char", 1) ;
- }
- for (int k=0; k < Special ; k++){
- int i = (int) SpecialChars[k].Value ;
- String h = Integer.toHexString(i) ;
- w.openTag("specialchar", 1) ;
- w.writeString("value", 2, new Character(SpecialChars[k].Value).toString() ) ;
- w.writeString("hexvalue", 2, h ) ;
- w.writeString("name", 2, SpecialChars[k].Name) ;
- w.writeString("mccode", 2, SpecialChars[k].MCCode) ;
- w.writeString("type", 2, SpecialChars[k].Type) ;
- w.writeString("equivalents", 2, SpecialChars[k].Equivalents) ;
- w.writeString("notes", 2, SpecialChars[k].Notes) ;
- w.writeString("group", 2, SpecialChars[k].Group) ;
- w.closeTag("specialchar", 1) ;
- }
- w.closeTag("coding", 0) ;
- }
-//-----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Translate ; + +import WLC2OSIS.* ; +import WLC2OSIS.Utilities.* ; +//============================================================================== +/** + * <b>Object describing Unicode Hebrew characters and their relation + * to the MC characters.</b><p> + * + * The static array UnicodeChars describes Hebrew Unicode characters + * and gives their relationship to the MCW letter code. + */ +//============================================================================== +public class UnicodeChar{ +/** Starting index for block of Hebrew Unicode characters.*/ +public static final int UnicodeStart = 0x00000590 ; +/** Ending index for block of Hebrew Unicode characters.*/ +public static final int UnicodeEnd = 0x00000600 ; +/** Size of block of Hebrew Unicode characters.*/ +public static final int N = (UnicodeEnd - UnicodeStart) ; + +// Object contents + +/** Unicode name WITHOUT the word HEBREW or its type. + * Capital followed by lower case. + */ +public String Name = "" ; // Unicode name WITHOUT the word HEBREW or + // its type. Capital followed by lower case. +/** Unicode type: Accent, Point, Punctuation, Letter, or Ligature. */ +public String Type = " " ; + /** Unicode character value. */ +public char Value= ' ' ; // Unicode character value. +/** List of equivalent characters represented by this Unicode character.*/ +public String Equivalents = "" ; // List of equivalents +/** Notes provided by the Unicode group.*/ + public String Notes = "" ; // Additional notes. +/** MCW characters corresponding to this Unicode character.*/ +public String MCCode = "" ; +/** Combining group value. */ +public String Group = "" ; + +/** Array of all Hebrew Unicode characters, 0...N. */ +public static UnicodeChar[] UnicodeChars = new UnicodeChar[N] ; +/** Number of special Unicode characters */ +public static final int Special = 6; +/** Array of special, non-Hebrew characters */ +public static UnicodeChar[] SpecialChars = new UnicodeChar[Special] ; + +//----------------------------------------------------------------------------- +/** + * Creates a UnicodeChar object from the given arguments. + */ +UnicodeChar( char Value, String Name, String Type, String Equivalents, String Notes){ + this.Value = Value ; + this.Name = Name ; + this.Type = Type ; + this.Equivalents = Equivalents ; + this.Notes = Notes ; + } +//----------------------------------------------------------------------------- +/** + * Sets the array of UnicodeChar[], UnicodeChars, from the + * Characters array. + * + * @param Characters MCO[] array of MCO object whose + * index is the value of the corresponding MCW character. + */ +public static void setUnicodeChars( MCO[] Characters, MCO[] Numbers ) { + + for (char k =0; k < N; k++){ + UnicodeChars[k] = new UnicodeChar( '?', "Undefined", "Unspecified", " " , " ") ; + } + for (char k =0; k < Special; k++){ + SpecialChars[k] = new UnicodeChar( '?', "Undefined", "Unspecified", " " , " ") ; + } + +// Verify the H assignment and enter into table + + enterChar(0x0591, H.etnachta, "Etnachta", "Accent") ; + enterChar(0x0592, H.accentsegol, "Segol", "Accent" ) ; + enterChar(0x0593, H.shalshelet,"Shalshelet", "Accent" ) ; + enterChar(0x0594, H.zaqefqatan, "Zaqef Qatan", "Accent" ) ; + enterChar(0x0595, H.zaqefgadol, "Zaqef Gadol", "Accent" ) ; + enterChar(0x0596, H.tipeha, "Tipeha", "Accent", "Tarha", " " ) ; + enterChar(0x0597, H.revia, "Revia", "Accent" ) ; + enterChar(0x0598, H.zarqa, "Zarqa", "Accent", + "Tsinorit, Zinorit, Tsinor, Zinor", + "This character is to be used when Zarqa or Tsinor are placed above, and also for Tsinorit." + ) ; + enterChar(0x0599, H.pashta, "Pashta", "Accent" ) ; + enterChar(0x059a, H.yetiv, "Yetiv", "Accent" ) ; + enterChar(0x059b, H.tevir, "Tevir", "Accent" ) ; + enterChar(0x059c, H.geresh, "Geresh", "Accent" ) ; + enterChar(0x059d, H.gereshmuqdam, "Geresh Muqdam", "Accent" ) ; + enterChar(0x059e, H.gershayim, "Gereshayim", "Accent" ) ; + enterChar(0x059f, H.qarneypara, "Qarney Para", "Accent" ) ; + enterChar(0x05a0, H.telishagedola, "Telisha Gedola", "Accent") ; + enterChar(0x05a1, H.pazer, "Pazer", "Accent" ) ; + enterChar(0x05a3, H.munah, "Munah", "Accent" ) ; + enterChar(0x05a4, H.mahapakh, "Mahapakh", "Accent" ) ; + enterChar(0x05a5, H.merkha, "Merkha", "Accent", + "Yored", " ") ; + enterChar(0x05a6, H.merkhakefula, "Merkha Kefula", "Accent") ; + enterChar(0x05a7, H.darga, "Darga", "Accent") ; + enterChar(0x05a8, H.qadma, "Qadma", "Accent" ) ; + enterChar(0x05a9, H.telishaqetana, "Telisha Qetana", "Accent" ) ; + enterChar(0x05aa, H.yerahbenyomo, "Yerah Ben Yomo", "Accent", + "Galgal", " " ) ; + enterChar(0x05ab, H.ole, "Ole", "Accent" ) ; + enterChar(0x05ac, H.iluy, "Iluy", "Accent" ) ; + enterChar(0x05ad, H.dehi, "Dehi", "Accent" ) ; + enterChar(0x05ae, H.zinor, "Zinor", "Accent", + "Tsinor, Zarqa", + "This character is to be used when Zarqa or Tsinor are placed above left." ) ; + enterChar(0x05af, H.masoracircle, "Masora Circle", "Mark" ) ; + enterMCCodeAndGroup(0x05af, "Not used", "12") ; + enterChar(0x05b0, H.sheva, "Sheva", "Point") ; + enterChar(0x05b1, H.hatafsegol, "Hataf Segol", "Point" ) ; + enterChar(0x05b2, H.hatafpatah, "Hataf Patah", "Point" ) ; + enterChar(0x05b3, H.hatafqamats, "Hataf Qamats", "Point" ) ; + enterChar(0x05b4, H.hiriq, "Hiriq", "Point" ) ; + enterChar(0x05b5, H.tsere, "Tsere", "Point" ) ; + enterChar(0x05b6, H.segol, "Segol", "Point" ) ; + enterChar(0x05b7, H.patah, "Patah", "Point", + " ", + "Furtive patah is not a distinct character.") ; + enterChar(0x05b8, H.qamats, "Qamats", "Point" ) ; + enterChar(0x05b9, H.holam, "Holam", "Point") ; + enterChar(0x05bb, H.qubuts, "Qubuts", "Point" ) ; + enterChar(0x05bc, H.dagesh, "Dagesh", "Point", + "Mapiq, Shuriq", "Falls within base letter." ) ; + enterChar(0x05bd, H.meteg, "Meteg", "Point", + "Siluq", + "Maybe used as a Hebrew accent sof pasuq." + + "Left (75), center (35), and right (95) metegs are separately grouped" + + " to produce correct positioning." + + " The center meteg is preceded by a ZWJ, u200D, for positioning." ) ; + enterChar(0x05be, H.maqaf, "Maqaf", "Point") ; + enterChar(0x05bf, H.rafe, "Rafe", "Point" ) ; + enterChar(0x05c0, H.paseq, "Paseq", "Punctuation", + "Legarmeh", + "May be treated as spacing punctuation, not as a point. " + + "Each Paseq is preceded by a Space, \\u0020, for positioning." ) ; + enterChar(0x05c1, H.shindot, "Shin Dot", "Point") ; + enterChar(0x05c2, H.sindot, "Sin Dot", "Point" ) ; + enterChar(0x05c3, H.sofpasuq, "Sof Pasuq", "Point", + " ", "May be used as a Hebrew punctuation colon.") ; + enterChar(0x05c4, H.upperdot, "Upper Dot", "Mark" ) ; + + enterChar(0x05d0, H.alef, "Alef", "Letter" , "Aleph", " ") ; + enterChar(0x05d1, H.bet, "Bet", "Letter" ) ; + enterChar(0x05d2, H.gimel, "Gimel", "Letter" ) ; + enterChar(0x05d3, H.dalet, "Dalet", "Letter" ) ; + enterChar(0x05d4, H.he, "He", "Letter" ) ; + enterChar(0x05d5, H.vav, "Vav", "Letter" ) ; + enterChar(0x05d6, H.zayin, "Zayin", "Letter" ) ; + enterChar(0x05d7, H.het, "Het", "Letter" ) ; + enterChar(0x05d8, H.tet, "Tet", "Letter" ) ; + enterChar(0x05d9, H.yod, "Yod", "Letter" ) ; + enterChar(0x05da, H.finalkaf, "Final Kaf", "Letter" ) ; + enterChar(0x05db, H.kaf, "Kaf", "Letter" ) ; + enterChar(0x05dc, H.lamed, "Lamed", "Letter" ) ; + enterChar(0x05dd, H.finalmem, "Final Mem", "Letter" ) ; + enterChar(0x05de, H.mem, "Mem", "Letter" ) ; + enterChar(0x05df, H.finalnun, "Final Nun", "Letter" ) ; + enterChar(0x05e0, H.nun, "Nun", "Letter" ) ; + enterChar(0x05e1, H.samekh, "Samekh", "Letter" ) ; + enterChar(0x05e2, H.ayin, "Ayin", "Letter" ) ; + enterChar(0x05e3, H.finalpe, "Final Pe", "Letter" ) ; + enterChar(0x05e4, H.pe, "Pe", "Letter" ) ; + enterChar(0x05e5, H.finaltsadi, "Final Tsadi", "Letter") ; + enterChar(0x05e6, H.tsadi, "Tsadi", "Letter") ; + enterChar(0x05e7, H.qof, "Qof", "Letter" ) ; + enterChar(0x05e8, H.resh, "Resh", "Letter" ) ; + enterChar(0x05e9, H.shin, "Shin", "Letter" ) ; + enterChar(0x05ea, H.tav, "Tav", "Letter" ) ; + +// enterChar(0x05f0, H.doublevav, "Yiddish Double Vav", "Ligature" ) ; +// enterChar(0x05f1, H.vavyod, "Yiddish Vav Yod", "Ligature" ) ; +// enterChar(0x05f2, H.doubleyod, "Yiddish Double Yod", "Ligature" ) ; + +// enterChar(0x05f3, H.punctgeresh, "Geresh", "Punctuation", +// " ", "Punctuation, not an accent.") ; +// enterChar(0x05f4, H.punctgershayim, "Gershayim", "Punctuation", +// " ", "Punctuation, not an accent.") ; + +//----------------------------------------------------------------------------- + +// Set the MCO[] Characters into the UnicodeChar array. + + for(int k=0; k < 128; k++){ + MCO m = Characters[k]; + if(m.Type!=MCO.Unknown){ + char test = (m.Value).charAt(0) ; +// Try to find the Value in the UnicodeChars array, + boolean FoundValue = false; + int j ; + for (j = 0; j < N; j++){ + if(test == UnicodeChars[j].Value ){ + FoundValue = true ; + break ; + } + } + if(FoundValue){ + if((char)k=='&'){ + } + else{ + UnicodeChars[j].MCCode = new Character((char)k).toString() ; + UnicodeChars[j].Group = new Integer(m.Group).toString() ; + } + } +// Try to find it as a final character + test = (m.FinalValue).charAt(0) ; + FoundValue = false ; + for (j = 0; j < N; j++){ + if(test == UnicodeChars[j].Value ){ + FoundValue = true ; + break ; + } + } + if(FoundValue){ + if((char)k=='&'){ + } + else{ + UnicodeChars[j].MCCode = new Character((char)k).toString() ; + UnicodeChars[j].Group = new Integer(m.Group).toString() ; + } + } + } + } +//----------------------------------------------------------------------------- + +// Set the MCO[] Numbers into the UnicodeChar array. + + for(int k=0; k < 100; k++){ + MCO m = Numbers[k]; + if(m.Type!=MCO.Unknown){ + char test = (m.Value).charAt(0) ; +// Try to find the Value in the UnicodeChars array, + boolean FoundValue = false; + int j ; + for (j = 0; j < N; j++){ + if(test == UnicodeChars[j].Value ){ + FoundValue = true ; + break ; + } + } + if(FoundValue){ + if (UnicodeChars[j].MCCode.compareTo("") == 0){ + UnicodeChars[j].MCCode = new Integer(k).toString() ; + } + else{ + UnicodeChars[j].MCCode = UnicodeChars[j].MCCode + + ", " + new Integer(k).toString() ; + } + UnicodeChars[j].Group = new Integer(m.Group).toString() ; + } + } + } +// Special characters + + enterMCCodeAndGroup(0x05bd, "35, 75, 95", "8, 8, 6") ; + enterMCCodeAndGroup(0x05c0, "5", "16") ; + enterMCCodeAndGroup(0x05c1, "Not used", "1") ; + enterMCCodeAndGroup(0x05c2, "Not used", "2") ; + UnicodeChars[33].MCCode = ":E" ; + UnicodeChars[33].Group = "7" ; + UnicodeChars[34].MCCode = ":A" ; + UnicodeChars[34].Group = "7" ; + UnicodeChars[35].MCCode = ":F" ; + UnicodeChars[35].Group = "7" ; + UnicodeChars[89].MCCode = "&, $" ; + UnicodeChars[89].Group = "0" ; + +//---------------------------------------------------------------------------- + +// Special, non-Hebrew characters + + SpecialChars[0] = new UnicodeChar( '\u0020', "Space", + "Space" , " ", "Paseq is a Space + Paseq.") ; + SpecialChars[0].Group = " " ; + SpecialChars[0].MCCode = "Not used"; + + SpecialChars[1] = new UnicodeChar( '/', "Slash", + "Morphological divider." , " ", "Morphological divider." ) ; + SpecialChars[1].Group = " " ; + SpecialChars[1].MCCode = "/"; + + SpecialChars[2] = new UnicodeChar( '\u0307', "Masora or Number dot", + "PrepositiveMark" , " ", "Upper punctum. MC code 53, is translated " + + "as an Upper Dot, \\u05c4, not as this character. " + + "This mark is not currently positioned properly by Internet Explorer.") ; + SpecialChars[2].Group = "12" ; + SpecialChars[2].MCCode = "(53)"; + + SpecialChars[3] = new UnicodeChar( '\u0323', "Combining dot below", + "PrepositiveMark" , " ", "Lower punctum. " + + "This mark is not currently positioned properly by Internet Explorer.") ; + SpecialChars[3].Group = "12" ; + SpecialChars[3].MCCode = "52"; + + SpecialChars[4] = new UnicodeChar( '\u200D', "Zero width joiner (ZWJ)", + "General punct." , " ", "Center meteg is a ZWJ + meteg.") ; + SpecialChars[4].Group = " " ; + SpecialChars[4].MCCode = "Not used"; + + SpecialChars[5] = new UnicodeChar( '\uf300', "Inverted nun", + "General punct." , " ", "Not part of the current Unicode standard. " + + "Displays acceptably in either SBL Hebrew or Ezra SIL fonts.") ; + SpecialChars[5].Group = " " ; + SpecialChars[5].MCCode = "Not used"; + + +//----------------------------------------------------------------------------- + return ; + } +//----------------------------------------------------------------------------- +/** +* Enters a Unicode character into the array UnicodeChars. +*/ +static void enterChar(int value, char c, String Name, String Type, + String Equivalents, String Notes) { + if ( c != (char) value ){ + System.out.println("UnicodeChars: Error in character table!") ; + System.out.println("Character: " + c + " Value: " + value ) ; + } + UnicodeChars[value-UnicodeStart] + = new UnicodeChar( (char)value, Name, Type, Equivalents, Notes) ; + } +//----------------------------------------------------------------------------- +/** +* Enters a Unicode character into the array UnicodeChars. +*/ +static void enterChar(int value, char c, String Name, String Type) { + if ( c != (char) value ){ + System.out.println("UnicodeChars: Error in character table!") ; + System.out.println("Character: " + c + " Value: " + value ) ; + } + UnicodeChars[value-UnicodeStart] + = new UnicodeChar( (char)value, Name, Type, "", "") ; + } +//----------------------------------------------------------------------------- +/** +* Enters the MCCode and Group number for a UnicodeChar. +*/ +static void enterMCCodeAndGroup(int k, String MCCode, String Group ){ + UnicodeChars[k-UnicodeStart].MCCode = MCCode ; + UnicodeChars[k-UnicodeStart].Group = Group ; + } +//----------------------------------------------------------------------------- + +// Writes the Unicode characters as an XML file. + +// ** This belongs in UnicodeChars *** + +public static void writeUnicodeChars(XMLWriter w) { + w.openTag("coding", 0) ; + for (int k=0; k < N ; k++){ + int i = (int) UnicodeChars[k].Value ; + String h = Integer.toHexString(i) ; + w.openTag("char", 1) ; + w.writeString("value", 2, new Character(UnicodeChars[k].Value).toString() ) ; + w.writeString("hexvalue", 2, h ) ; + w.writeString("name", 2, UnicodeChars[k].Name) ; + w.writeString("mccode", 2, UnicodeChars[k].MCCode) ; + w.writeString("type", 2, UnicodeChars[k].Type) ; + w.writeString("equivalents", 2, UnicodeChars[k].Equivalents) ; + w.writeString("notes", 2, UnicodeChars[k].Notes) ; + w.writeString("group", 2, UnicodeChars[k].Group) ; + w.closeTag("char", 1) ; + } + for (int k=0; k < Special ; k++){ + int i = (int) SpecialChars[k].Value ; + String h = Integer.toHexString(i) ; + w.openTag("specialchar", 1) ; + w.writeString("value", 2, new Character(SpecialChars[k].Value).toString() ) ; + w.writeString("hexvalue", 2, h ) ; + w.writeString("name", 2, SpecialChars[k].Name) ; + w.writeString("mccode", 2, SpecialChars[k].MCCode) ; + w.writeString("type", 2, SpecialChars[k].Type) ; + w.writeString("equivalents", 2, SpecialChars[k].Equivalents) ; + w.writeString("notes", 2, SpecialChars[k].Notes) ; + w.writeString("group", 2, SpecialChars[k].Group) ; + w.closeTag("specialchar", 1) ; + } + w.closeTag("coding", 0) ; + } +//----------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/WKQ.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/WKQ.java index da45a34..e6d63c8 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/WKQ.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/WKQ.java @@ -1,102 +1,102 @@ -package WLC2OSIS.Translate;
-
-import WLC2OSIS.* ;
-import WLC2OSIS.Parse.* ;
-import WLC2OSIS.Utilities.* ;
-//==============================================================================
-/**
- * <b>Processes usual and Ketib/Qere words.</b><p>
- *
- * Modified for WLC **qq and *kk null qere and null ketib entries.
- */
-//==============================================================================
-public class WKQ{
-
-Parser P ;
-
-String Ketib;
-int KCount ;
-boolean KStarted ;
-
-String Qere ;
-int QCount ;
-boolean QStarted ;
-//-----------------------------------------------------------------------------
-
-public WKQ( Parser P ) {
- this.P = P ;
- }
-//------------------------------------------------------------------------------
-/**
- * Processes MCW words, writing them using the Word.write(Word, Type) method.
- *
- * @param W String containing MCW word of any type.
- */
-public void process(String W) {
-
- int asteriskcount = P.countChar(W, '*') ;
- int FirstAsterisk = W.indexOf('*') ;
- int LastAsterisk = W.lastIndexOf("*") ;
-//----------------------------------------------------------------------------------
-
-// Process a non-KQ
-
- if (asteriskcount == 0){
- P.w.write(W, "w") ;
- }
-//----------------------------------------------------------------------------------
-
-// Look for a KQ that starts with a non-KQ string in the word
-// usually abc*xyz. Write abc as a nonKQ word, the process *wxyz.
-
-
- if (FirstAsterisk > 0 && P.countChar(W,'*') >= 1 ){
- String NonKQ = W.substring(0, FirstAsterisk) ;
- P.w.write(NonKQ, "w") ;
- W = W.substring(FirstAsterisk, W.length() ) ;
- process(W) ; // Could be either K or Q
- }
-//-----------------------------------------------------------------------------
-
-// One word has two K,Q sections. *xyz**abc, **xyz*abc, *xyz*abc, **xyz**abc
-// Process the two parts separately.
-
- else if(P.countChar(W,'*') >= 2 & LastAsterisk > 1 ){
- int Split = W.indexOf('*', 2) ;
- String Part1 = W.substring(0, Split) ;
- String Part2 = W.substring(Split, W.length()) ;
- process(Part1) ;
- process(Part2) ;
- }
-//-----------------------------------------------------------------------------
-
-// W has ONLY a leading asterisk or two leading asterisks
-
- else{
- if(W.charAt(0) == '*'){
- if(W.charAt(1) != '*'){
-
-// Ketib
-
-// Do nothing if a null K
- if (W.compareTo("*kk") != 0){
- P.w.write(W.substring(1, W.length() ), "k") ;
- }
- }
- else{
-
-// Qere
-
-// Check for a null Q
- if (W.compareTo("**qq") != 0){
- P.w.write(W.substring(2, W.length() ), "q") ;
- }
- }
- }
- }
- return ;
- }
-//------------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Translate; + +import WLC2OSIS.* ; +import WLC2OSIS.Parse.* ; +import WLC2OSIS.Utilities.* ; +//============================================================================== +/** + * <b>Processes usual and Ketib/Qere words.</b><p> + * + * Modified for WLC **qq and *kk null qere and null ketib entries. + */ +//============================================================================== +public class WKQ{ + +Parser P ; + +String Ketib; +int KCount ; +boolean KStarted ; + +String Qere ; +int QCount ; +boolean QStarted ; +//----------------------------------------------------------------------------- + +public WKQ( Parser P ) { + this.P = P ; + } +//------------------------------------------------------------------------------ +/** + * Processes MCW words, writing them using the Word.write(Word, Type) method. + * + * @param W String containing MCW word of any type. + */ +public void process(String W) { + + int asteriskcount = P.countChar(W, '*') ; + int FirstAsterisk = W.indexOf('*') ; + int LastAsterisk = W.lastIndexOf("*") ; +//---------------------------------------------------------------------------------- + +// Process a non-KQ + + if (asteriskcount == 0){ + P.w.write(W, "w") ; + } +//---------------------------------------------------------------------------------- + +// Look for a KQ that starts with a non-KQ string in the word +// usually abc*xyz. Write abc as a nonKQ word, the process *wxyz. + + + if (FirstAsterisk > 0 && P.countChar(W,'*') >= 1 ){ + String NonKQ = W.substring(0, FirstAsterisk) ; + P.w.write(NonKQ, "w") ; + W = W.substring(FirstAsterisk, W.length() ) ; + process(W) ; // Could be either K or Q + } +//----------------------------------------------------------------------------- + +// One word has two K,Q sections. *xyz**abc, **xyz*abc, *xyz*abc, **xyz**abc +// Process the two parts separately. + + else if(P.countChar(W,'*') >= 2 & LastAsterisk > 1 ){ + int Split = W.indexOf('*', 2) ; + String Part1 = W.substring(0, Split) ; + String Part2 = W.substring(Split, W.length()) ; + process(Part1) ; + process(Part2) ; + } +//----------------------------------------------------------------------------- + +// W has ONLY a leading asterisk or two leading asterisks + + else{ + if(W.charAt(0) == '*'){ + if(W.charAt(1) != '*'){ + +// Ketib + +// Do nothing if a null K + if (W.compareTo("*kk") != 0){ + P.w.write(W.substring(1, W.length() ), "k") ; + } + } + else{ + +// Qere + +// Check for a null Q + if (W.compareTo("**qq") != 0){ + P.w.write(W.substring(2, W.length() ), "q") ; + } + } + } + } + return ; + } +//------------------------------------------------------------------------------ +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/package.html b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/package.html index ae7d180..af2d2a8 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/package.html +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Translate/package.html @@ -1,8 +1,8 @@ -<HTML>
-<BODY>
-<b>Classes to translate from the ASCII MC format to Unicode<b>.
-<p/>
-<p align="right"> (BHS2XML/Translate/package.html)
-<p/>
-Only the BookName and Note classes are specific to the WLC.</BODY>
-</HTML>
+<HTML> +<BODY> +<b>Classes to translate from the ASCII MC format to Unicode<b>. +<p/> +<p align="right"> (BHS2XML/Translate/package.html) +<p/> +Only the BookName and Note classes are specific to the WLC.</BODY> +</HTML> diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/FileRead.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/FileRead.java index 85c5df3..340db8f 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/FileRead.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/FileRead.java @@ -1,106 +1,106 @@ -package WLC2OSIS.Utilities ;
-
-import WLC2OSIS.* ;
-import Utilities.FileChooser ;
-//import Utilities.Message ;
-
-import java.io.* ;
-import javax.swing.* ;
-import java.awt.* ;
-//==============================================================================
-/**
- * <b>Reads the input file.</b>
- */
-//==============================================================================
-public class FileRead{
-
-
-WLC2OSIS A ;
-int InputLength ;
-public byte[] InputBuffer ;
-File F ;
-FileInputStream FIS ;
-boolean Error ;
-//-----------------------------------------------------------------------------
-
-public FileRead(WLC2OSIS A ) {
- this.A = A ;
- InputBuffer = new byte[A.InputBufferSize] ;
- Error = false ;
- }
-//------------------------------------------------------------------------------
-
-// Reads the specified file, forming the char[] InputChars and StringBuffer Input.
-
-public void read(String Filename){
- Error = true ;
-
-// Open the file
-
- F = new File(Filename) ;
-
- try{
- FIS = new FileInputStream(F);
- if (FIS.available() > InputBuffer.length){
- System.out.println(
- "The input file length, " + FIS.available()
- + " bytes,\nis too long for the internal buffer of "
- + InputBuffer.length + " bytes.") ;
- return ;
- }
- }
- catch(IOException e){
- System.out.println(
- "FileRead.read: Error in opening FileInputStream.\n\n"
- + F.getPath() + "\n\n"
- + e.toString() + "\nNo further action taken.") ;
- return ;
- }
-//------------------------------------------------------------------------------
-
-// Read the file
-
- try{
- InputLength = FIS.read(InputBuffer) ;
- }
- catch(IOException e){
- System.out.println(
- "FileRead.read: Error on read of input file.\n\n"
- + F.getPath() + "\n\n"
- + e.toString() + "\nNo further action taken.") ;
- return;
- }
-
-// Close the file.
-
- try{
- FIS.close() ;
- }
- catch(IOException e){
- System.out.println(
- "FileRead.read: Error on close of input file.\n\n"
- + F.getPath() + "\n\n"
- + e.toString() + "\nNo further action taken.") ;
- }
-
-// Convert bytes to char[] array.
-
- A.InputChars = new char[InputLength] ;
- for (int k = 0; k < InputLength; k++){
- short shrt = (short) InputBuffer[k] ;
- A.InputChars[k] = (char) shrt ;
- }
-
- Error = false ;
- }
-//------------------------------------------------------------------------------
-
-// Gets the error condition.
-
-public boolean getError(){
- return Error ;
- }
-//-----------------------------------------------------------------------------
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Utilities ; + +import WLC2OSIS.* ; +import Utilities.FileChooser ; +//import Utilities.Message ; + +import java.io.* ; +import javax.swing.* ; +import java.awt.* ; +//============================================================================== +/** + * <b>Reads the input file.</b> + */ +//============================================================================== +public class FileRead{ + + +WLC2OSIS A ; +int InputLength ; +public byte[] InputBuffer ; +File F ; +FileInputStream FIS ; +boolean Error ; +//----------------------------------------------------------------------------- + +public FileRead(WLC2OSIS A ) { + this.A = A ; + InputBuffer = new byte[A.InputBufferSize] ; + Error = false ; + } +//------------------------------------------------------------------------------ + +// Reads the specified file, forming the char[] InputChars and StringBuffer Input. + +public void read(String Filename){ + Error = true ; + +// Open the file + + F = new File(Filename) ; + + try{ + FIS = new FileInputStream(F); + if (FIS.available() > InputBuffer.length){ + System.out.println( + "The input file length, " + FIS.available() + + " bytes,\nis too long for the internal buffer of " + + InputBuffer.length + " bytes.") ; + return ; + } + } + catch(IOException e){ + System.out.println( + "FileRead.read: Error in opening FileInputStream.\n\n" + + F.getPath() + "\n\n" + + e.toString() + "\nNo further action taken.") ; + return ; + } +//------------------------------------------------------------------------------ + +// Read the file + + try{ + InputLength = FIS.read(InputBuffer) ; + } + catch(IOException e){ + System.out.println( + "FileRead.read: Error on read of input file.\n\n" + + F.getPath() + "\n\n" + + e.toString() + "\nNo further action taken.") ; + return; + } + +// Close the file. + + try{ + FIS.close() ; + } + catch(IOException e){ + System.out.println( + "FileRead.read: Error on close of input file.\n\n" + + F.getPath() + "\n\n" + + e.toString() + "\nNo further action taken.") ; + } + +// Convert bytes to char[] array. + + A.InputChars = new char[InputLength] ; + for (int k = 0; k < InputLength; k++){ + short shrt = (short) InputBuffer[k] ; + A.InputChars[k] = (char) shrt ; + } + + Error = false ; + } +//------------------------------------------------------------------------------ + +// Gets the error condition. + +public boolean getError(){ + return Error ; + } +//----------------------------------------------------------------------------- +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/XMLWriter.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/XMLWriter.java index ed640ec..ffeb0c2 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/XMLWriter.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/XMLWriter.java @@ -1,172 +1,172 @@ -package WLC2OSIS.Utilities ;
-
-import Utilities.* ;
-
-import java.lang.System ;
-import java.io.* ;
-//==============================================================================
-/**
- * <b>Writes the output XML files.</b>
- */
-//==============================================================================
-public class XMLWriter{
-
-String Directory ;
-String Filename ;
-String IndentString = " " ;
-FileOutputStream FOS ;
-OutputStreamWriter OSW ;
-char[] CharBuffer ;
-Fmt F = new Fmt() ;
-// String XMLTag ;
-//-----------------------------------------------------------------------------
-/**
- * Writes an XML file.
- *
- * @param Directory String giving directory WITHOUT final \.
- * @param Filename String giving file name WITHOUT extension.
- *
-*/
-public XMLWriter(String Directory, String Filename){
-
- this.Directory = Directory ;
- this.Filename = Filename ;
-// this.XMLTag = XMLTag ;
-
- try{
- FOS = new FileOutputStream(Directory + File.separator + Filename + ".xml") ;
- OSW = new OutputStreamWriter(FOS, "UTF8") ;
- }
- catch(IOException e){
- System.out.println("XMLWriter: Error in opening output file.\n" + e) ;
- }
- writeString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- writeString("<osis xmlns=\"http://www.bibletechnologies.net/2003/OSIS/namespace\" "+
- "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "+
- "xsi:schemaLocation=\"http://www.bibletechnologies.net/2003/OSIS/namespaceosisCore.2.0.xsd\">\n");
- }
-//-----------------------------------------------------------------------------
-public void writeString(String Tag, int Level, String S){
- String s = "\n" ;
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- s = s + "<" + Tag + ">" ;
- s = s + S ;
- s = s + "</" + Tag + ">" ;
- writeString(s) ;
- }
-
-//-----------------------------------------------------------------------------
-public void writeAttributedString(String Tag, int Level, String AttributeString, String S){
- String s = "\n" ;
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- s = s + "<" + Tag + " " + AttributeString + ">" ;
- s = s + S ;
- s = s + "</" + Tag + ">" ;
- writeString(s) ;
- }
-
-// MG: Hack
-//-----------------------------------------------------------------------------
-public void appendText(String text){
- writeString(text) ;
- }
-
-
-//-----------------------------------------------------------------------------
-public void writeBoolean(String Tag, int Level, boolean B){
- String s = "\n" ;
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- s = s + "<" + Tag + ">" ;
- s = s + B ;
- s = s + "</" + Tag + ">" ;
- writeString(s) ;
- }
-//-----------------------------------------------------------------------------
-public void writeInt(String Tag, int Level, int I){
- String s = "\n" ;
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- s = s + "<" + Tag + ">" ;
- s = s + I ;
- s = s + "</" + Tag + ">" ;
- writeString(s) ;
- }
-//-----------------------------------------------------------------------------
-public void openTag(String Tag, int Level){
- String s = "\n" ;
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- s = s + "<" + Tag + ">" ;
- writeString(s) ;
- }
-//-----------------------------------------------------------------------------
-public void openAttributedTag(String Tag, int Level, String Attribute, String Value){
- String s = "\n" ;
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- s = s + "<" + Tag + " " + Attribute + "=\"" + Value + "\">" ;
- writeString(s) ;
- }
-//-----------------------------------------------------------------------------
-public void closeTag(String Tag, int Level){
- String s = "\n" ;
- if (Level > 0) {
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- }
- s = s + "</" + Tag + ">" ;
- writeString(s) ;
- }
-//-----------------------------------------------------------------------------
-public void writeMarker(String Tag, int Level){
- String s = "\n" ;
- if (Level > 0) {
- for (int k = 0; k < Level; k++){
- s = s + IndentString ;
- }
- }
- s = s + "<" + Tag + "/>" ;
- writeString(s) ;
- }
-//-----------------------------------------------------------------------------
-public void writeException( char Exception){
- String s ;
- s = "<x>" + Exception + "</x>" ;
- writeString(s) ;
- }
-//-----------------------------------------------------------------------------
-public void close(){
-// writeString("\n</" + XMLTag + ">") ;
- closeTag("osis", 0);
- try{
- OSW.close() ;
- }
- catch(IOException e){
- System.out.println("XMLWriter: Error in closing output file.\n" + e) ;
- }
- }
-//-----------------------------------------------------------------------------
-void writeString(String S){
- CharBuffer = S.toCharArray() ;
- try{
- OSW.write(CharBuffer, 0, CharBuffer.length) ;
- }
- catch(IOException e){
- System.out.println("XMLWriter: Error in output file.\n" + e) ;
- }
- }
-//-----------------------------------------------------------------------------
-// end of class
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS.Utilities ; + +import Utilities.* ; + +import java.lang.System ; +import java.io.* ; +//============================================================================== +/** + * <b>Writes the output XML files.</b> + */ +//============================================================================== +public class XMLWriter{ + +String Directory ; +String Filename ; +String IndentString = " " ; +FileOutputStream FOS ; +OutputStreamWriter OSW ; +char[] CharBuffer ; +Fmt F = new Fmt() ; +// String XMLTag ; +//----------------------------------------------------------------------------- +/** + * Writes an XML file. + * + * @param Directory String giving directory WITHOUT final \. + * @param Filename String giving file name WITHOUT extension. + * +*/ +public XMLWriter(String Directory, String Filename){ + + this.Directory = Directory ; + this.Filename = Filename ; +// this.XMLTag = XMLTag ; + + try{ + FOS = new FileOutputStream(Directory + File.separator + Filename + ".xml") ; + OSW = new OutputStreamWriter(FOS, "UTF8") ; + } + catch(IOException e){ + System.out.println("XMLWriter: Error in opening output file.\n" + e) ; + } + writeString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); + writeString("<osis xmlns=\"http://www.bibletechnologies.net/2003/OSIS/namespace\" "+ + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "+ + "xsi:schemaLocation=\"http://www.bibletechnologies.net/2003/OSIS/namespaceosisCore.2.0.xsd\">\n"); + } +//----------------------------------------------------------------------------- +public void writeString(String Tag, int Level, String S){ + String s = "\n" ; + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + s = s + "<" + Tag + ">" ; + s = s + S ; + s = s + "</" + Tag + ">" ; + writeString(s) ; + } + +//----------------------------------------------------------------------------- +public void writeAttributedString(String Tag, int Level, String AttributeString, String S){ + String s = "\n" ; + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + s = s + "<" + Tag + " " + AttributeString + ">" ; + s = s + S ; + s = s + "</" + Tag + ">" ; + writeString(s) ; + } + +// MG: Hack +//----------------------------------------------------------------------------- +public void appendText(String text){ + writeString(text) ; + } + + +//----------------------------------------------------------------------------- +public void writeBoolean(String Tag, int Level, boolean B){ + String s = "\n" ; + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + s = s + "<" + Tag + ">" ; + s = s + B ; + s = s + "</" + Tag + ">" ; + writeString(s) ; + } +//----------------------------------------------------------------------------- +public void writeInt(String Tag, int Level, int I){ + String s = "\n" ; + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + s = s + "<" + Tag + ">" ; + s = s + I ; + s = s + "</" + Tag + ">" ; + writeString(s) ; + } +//----------------------------------------------------------------------------- +public void openTag(String Tag, int Level){ + String s = "\n" ; + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + s = s + "<" + Tag + ">" ; + writeString(s) ; + } +//----------------------------------------------------------------------------- +public void openAttributedTag(String Tag, int Level, String Attribute, String Value){ + String s = "\n" ; + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + s = s + "<" + Tag + " " + Attribute + "=\"" + Value + "\">" ; + writeString(s) ; + } +//----------------------------------------------------------------------------- +public void closeTag(String Tag, int Level){ + String s = "\n" ; + if (Level > 0) { + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + } + s = s + "</" + Tag + ">" ; + writeString(s) ; + } +//----------------------------------------------------------------------------- +public void writeMarker(String Tag, int Level){ + String s = "\n" ; + if (Level > 0) { + for (int k = 0; k < Level; k++){ + s = s + IndentString ; + } + } + s = s + "<" + Tag + "/>" ; + writeString(s) ; + } +//----------------------------------------------------------------------------- +public void writeException( char Exception){ + String s ; + s = "<x>" + Exception + "</x>" ; + writeString(s) ; + } +//----------------------------------------------------------------------------- +public void close(){ +// writeString("\n</" + XMLTag + ">") ; + closeTag("osis", 0); + try{ + OSW.close() ; + } + catch(IOException e){ + System.out.println("XMLWriter: Error in closing output file.\n" + e) ; + } + } +//----------------------------------------------------------------------------- +void writeString(String S){ + CharBuffer = S.toCharArray() ; + try{ + OSW.write(CharBuffer, 0, CharBuffer.length) ; + } + catch(IOException e){ + System.out.println("XMLWriter: Error in output file.\n" + e) ; + } + } +//----------------------------------------------------------------------------- +// end of class +} +//============================================================================== +//============================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/package.html b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/package.html index ec59776..048e65b 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/package.html +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/Utilities/package.html @@ -1,8 +1,8 @@ -<HTML>
-<BODY>
-<b>Utilities for text reading and XML writing, not specialized to WLC</b>.<p/>
-<p align="right"> (<b><tt>BHS2XML/Utilities/package.html</tt></b>)
-<p/>
-Includes a Test class to write XML for MC ASCII test cases.
-</BODY>
-</HTML>
+<HTML> +<BODY> +<b>Utilities for text reading and XML writing, not specialized to WLC</b>.<p/> +<p align="right"> (<b><tt>BHS2XML/Utilities/package.html</tt></b>) +<p/> +Includes a Test class to write XML for MC ASCII test cases. +</BODY> +</HTML> diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSIS.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSIS.java index a8c6c21..ff13f68 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSIS.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSIS.java @@ -1,151 +1,151 @@ -package WLC2OSIS ;
-
-import WLC2OSIS.GUI.* ;
-import WLC2OSIS.Parse.* ;
-import WLC2OSIS.Translate.* ;
-import WLC2OSIS.Utilities.* ;
-import Utilities.* ;
-
-import java.awt.*;
-import java.io.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.util.*;
-//=================================================================================================
-/**
-*
-* <b>Core of WLC2OSIS, set Strings here before running program.<p></b>
-*
-*/
-//=================================================================================================
-
-public class WLC2OSIS /*implements Stoppable*/ {
-
-// Definitions of input and output to be set by user.
-
-// public String ProgramDate = "30 May 2004" ;
-public String DefaultInputFilename = "/home/Martin/dev/swordtools/modules/hebrew-wlc/" ;
-public String InputFilename;
-public String DefaultOutputDirectory = "/home/Martin/KDesktop/" ;
-public String OutputDirectory ;
-// Define the title and descriptions.
-public String Title = "The Westminster Leningrad Codex (WLC)" ;
-
-public String ShortDescription = "from the electronic version of the Leningrad Codex "
- + "maintained by the Westminster Hebrew Institute." ;
-
-public String[] Description = {
- "This text began as an electronic transcription by Whitaker and Parunak of the 1983 "
- + "printed edition of Biblia Hebraica Stuttgartensia (BHS). The "
- + "transcription is called the Michigan-Claremont electronic text and was archived "
- + "at the Oxford Text Archive (OTA) in 1987. "
- + "Since that time, the text has been modified to "
- + "conform to the photo-facsimile of the Leningrad Codex, Firkovich "
- + "B19A, residing at the Russian National Library, St. "
- + "Petersberg; hence the change of name."
- + "This version contains all 6 of the "
- + "textual elements of the OTA document: consonants, vowels, cantillation "
- + "marks, \"paragraph\" (pe, samekh) markers, ketib-qere variants, and morphological divisions. ",
-
- "The BHS so-called \"paragraph\" markers (pe and samekh) do "
- + "not actually occur in the Leningrad Codex. The editors of BHS use them "
- + "to indicate open space deliberately left blank by the scribe. Pe "
- + "(\"open\" paragraph) represents a space between verses, where the new "
- + "verse begins on a new column line. This represents a major section of "
- + "the text. Samekh (\"closed\" paragraph) represents a space of less than "
- + "a line between verses. This is understood to be a subdivision of the "
- + "corresponding \"open\" section. Since these markers represent an actual "
- + "physical feature of the text, they have been retained. " ,
-
- "The transcription was based on the \"Supplement to the code manual for "
- + "the Michigan Old Testament\" by Alan Groves and includes the "
- + "transcription notes defined there. A listing of these notes can be "
- + "obtained by clicking on the \"Notes\" link of the index page. "
- + "Transcription notes appear as superscripts and can be viewed by clicking "
- + "on them.",
-
- "The book names in English and Hebrew of the Jewish Publication Society "
- + "(JPS) Tanach have been added."} ;
-
-//public char MorphologicalDivisionMarker = '/' ;
-//-----------------------------------------------------------------------------
-
-public final int InputBufferSize = 4000000 ; // Length of input in bytes.
-public SuperContainer SC ;
-Container InputContainer ;
-public Frame SuperFrame ;
-public Container OverallContainer ; // Actually, the content pane.
-public JRootPane RP ;
-public char[] InputChars ; // Input char[] array set by FileRead.
-public Parser p ;
-public XMLWriter w ;
-public Fmt F = new Fmt() ;
-// public boolean StandAlone = true ; // If used by another app,
-Messages M;
-
-public WLC2OSIS( Container InputContainer ){
- this.InputContainer = InputContainer ;
- this.SC = new SuperContainer(InputContainer) ;
- OverallContainer = this.SC.getContentPane() ;
-// SuperFrame = SC.superFrame() ;
-// StandAlone = true ;
-//-----------------------------------------------------------------------------
-
-// Crude GUI
-
- M = new Messages(this) ;
- FileChoices fc = new FileChoices(this) ;
-
- M.initialMessage() ;
- InputFilename = fc.getInputFilename(DefaultInputFilename) ;
-// GetDate gd = new GetDate(this) ;
- OutputDirectory = fc.getOutputDirectory(DefaultOutputDirectory) ;
-//-----------------------------------------------------------------------------
-
-// Identifying printouts
-
- F.bar("=", 80) ;
- System.out.println("\nWLC2OSIS: " + Title + " " + ShortDescription ) ;
- System.out.println("\nInput file: " + InputFilename ) ;
-// System.out.println( "Input file date: " + Date ) ;
- System.out.println("\nOutput directory: " + OutputDirectory ) ;
-
- FileRead FR = new FileRead(this) ;
- FR.read(InputFilename) ;
-//-----------------------------------------------------------------------------
-
-// *** DISABLED *** Test of CCAT format -> XML translation.
-
-//L5253W.L\"815253)5253]4
-//YI&:RF)\"80L
-// if(false){
-// String TestString = "HA/$.FMA73YIM" ;
-// Test.test(this, TestString) ;
-// }
-//-----------------------------------------------------------------------------
-
-// Read, parse, and write the book files.
- p = new Parser(this) ;
- p.parse() ;
-//-----------------------------------------------------------------------------
- M.doneMessage() ;
-//-----------------------------------------------------------------------------
-
- done() ;
- }
-//-----------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-/**
- * Universal exit.
- */
-public void done(){
- System.out.println("\nWLC2OSIS: Normal end.") ;
- F.bar("=", 80) ;
- System.exit(0) ;
- }
-//-----------------------------------------------------------------------------
-// End of class
-}
-//========================================================================================
-//========================================================================================
+package WLC2OSIS ; + +import WLC2OSIS.GUI.* ; +import WLC2OSIS.Parse.* ; +import WLC2OSIS.Translate.* ; +import WLC2OSIS.Utilities.* ; +import Utilities.* ; + +import java.awt.*; +import java.io.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; +//================================================================================================= +/** +* +* <b>Core of WLC2OSIS, set Strings here before running program.<p></b> +* +*/ +//================================================================================================= + +public class WLC2OSIS /*implements Stoppable*/ { + +// Definitions of input and output to be set by user. + +// public String ProgramDate = "30 May 2004" ; +public String DefaultInputFilename = "/home/Martin/dev/swordtools/modules/hebrew-wlc/" ; +public String InputFilename; +public String DefaultOutputDirectory = "/home/Martin/KDesktop/" ; +public String OutputDirectory ; +// Define the title and descriptions. +public String Title = "The Westminster Leningrad Codex (WLC)" ; + +public String ShortDescription = "from the electronic version of the Leningrad Codex " + + "maintained by the Westminster Hebrew Institute." ; + +public String[] Description = { + "This text began as an electronic transcription by Whitaker and Parunak of the 1983 " + + "printed edition of Biblia Hebraica Stuttgartensia (BHS). The " + + "transcription is called the Michigan-Claremont electronic text and was archived " + + "at the Oxford Text Archive (OTA) in 1987. " + + "Since that time, the text has been modified to " + + "conform to the photo-facsimile of the Leningrad Codex, Firkovich " + + "B19A, residing at the Russian National Library, St. " + + "Petersberg; hence the change of name." + + "This version contains all 6 of the " + + "textual elements of the OTA document: consonants, vowels, cantillation " + + "marks, \"paragraph\" (pe, samekh) markers, ketib-qere variants, and morphological divisions. ", + + "The BHS so-called \"paragraph\" markers (pe and samekh) do " + + "not actually occur in the Leningrad Codex. The editors of BHS use them " + + "to indicate open space deliberately left blank by the scribe. Pe " + + "(\"open\" paragraph) represents a space between verses, where the new " + + "verse begins on a new column line. This represents a major section of " + + "the text. Samekh (\"closed\" paragraph) represents a space of less than " + + "a line between verses. This is understood to be a subdivision of the " + + "corresponding \"open\" section. Since these markers represent an actual " + + "physical feature of the text, they have been retained. " , + + "The transcription was based on the \"Supplement to the code manual for " + + "the Michigan Old Testament\" by Alan Groves and includes the " + + "transcription notes defined there. A listing of these notes can be " + + "obtained by clicking on the \"Notes\" link of the index page. " + + "Transcription notes appear as superscripts and can be viewed by clicking " + + "on them.", + + "The book names in English and Hebrew of the Jewish Publication Society " + + "(JPS) Tanach have been added."} ; + +//public char MorphologicalDivisionMarker = '/' ; +//----------------------------------------------------------------------------- + +public final int InputBufferSize = 4000000 ; // Length of input in bytes. +public SuperContainer SC ; +Container InputContainer ; +public Frame SuperFrame ; +public Container OverallContainer ; // Actually, the content pane. +public JRootPane RP ; +public char[] InputChars ; // Input char[] array set by FileRead. +public Parser p ; +public XMLWriter w ; +public Fmt F = new Fmt() ; +// public boolean StandAlone = true ; // If used by another app, +Messages M; + +public WLC2OSIS( Container InputContainer ){ + this.InputContainer = InputContainer ; + this.SC = new SuperContainer(InputContainer) ; + OverallContainer = this.SC.getContentPane() ; +// SuperFrame = SC.superFrame() ; +// StandAlone = true ; +//----------------------------------------------------------------------------- + +// Crude GUI + + M = new Messages(this) ; + FileChoices fc = new FileChoices(this) ; + + M.initialMessage() ; + InputFilename = fc.getInputFilename(DefaultInputFilename) ; +// GetDate gd = new GetDate(this) ; + OutputDirectory = fc.getOutputDirectory(DefaultOutputDirectory) ; +//----------------------------------------------------------------------------- + +// Identifying printouts + + F.bar("=", 80) ; + System.out.println("\nWLC2OSIS: " + Title + " " + ShortDescription ) ; + System.out.println("\nInput file: " + InputFilename ) ; +// System.out.println( "Input file date: " + Date ) ; + System.out.println("\nOutput directory: " + OutputDirectory ) ; + + FileRead FR = new FileRead(this) ; + FR.read(InputFilename) ; +//----------------------------------------------------------------------------- + +// *** DISABLED *** Test of CCAT format -> XML translation. + +//L5253W.L\"815253)5253]4 +//YI&:RF)\"80L +// if(false){ +// String TestString = "HA/$.FMA73YIM" ; +// Test.test(this, TestString) ; +// } +//----------------------------------------------------------------------------- + +// Read, parse, and write the book files. + p = new Parser(this) ; + p.parse() ; +//----------------------------------------------------------------------------- + M.doneMessage() ; +//----------------------------------------------------------------------------- + + done() ; + } +//----------------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +/** + * Universal exit. + */ +public void done(){ + System.out.println("\nWLC2OSIS: Normal end.") ; + F.bar("=", 80) ; + System.exit(0) ; + } +//----------------------------------------------------------------------------- +// End of class +} +//======================================================================================== +//======================================================================================== diff --git a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSISMain.java b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSISMain.java index 903dbf3..4e4b4f7 100644 --- a/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSISMain.java +++ b/modules/hebrew-wlc/WLC2OSIS/WLC2OSIS/WLC2OSISMain.java @@ -1,54 +1,54 @@ -package WLC2OSIS ;
-
-import Utilities.* ;
-
-import java.awt.*;
-import javax.swing.*;
-//==============================================================================
-/**
- * <b>WLC2OSISMain main method and applet launcher,
- * actual working program is in the WLC2OSIS class.</b><p>
- *
- * This is a general purpose launching class. It can launch
- *
- * 1. Applets
- * 2. Applications
- * 3. Dialogs launched from other programs
- *
- */
-//==============================================================================
-public class WLC2OSISMain{
-
-static WLC2OSIS A ;
-
-//==============================================================================
-
-/**
- * Static main() method for use as an application or dialog.
- *
- * @param args String[] un-used.
- */
-public static void main( String[] args) {
-
- boolean Dialog = false ; // Either a dialog or application window.
-
- Frame SuperFrame = GetParentFrame.GetParentFrame(new JFrame()) ;
-
- if (Dialog){
-
-// As a MODAL JDialog
- JDialog WLC2OSISDialog = new JDialog(SuperFrame, true) ;
- A = new WLC2OSIS( WLC2OSISDialog ) ;
- System.exit(0) ;
- }
- else{
-
-// Ss a JFrame
- JFrame ThisFrame = new JFrame() ;
- A = new WLC2OSIS(ThisFrame) ;
- }
- }
-// end of class
-}
-//==============================================================================
-//==============================================================================
+package WLC2OSIS ; + +import Utilities.* ; + +import java.awt.*; +import javax.swing.*; +//============================================================================== +/** + * <b>WLC2OSISMain main method and applet launcher, + * actual working program is in the WLC2OSIS class.</b><p> + * + * This is a general purpose launching class. It can launch + * + * 1. Applets + * 2. Applications + * 3. Dialogs launched from other programs + * + */ +//============================================================================== +public class WLC2OSISMain{ + +static WLC2OSIS A ; + +//============================================================================== + +/** + * Static main() method for use as an application or dialog. + * + * @param args String[] un-used. + */ +public static void main( String[] args) { + + boolean Dialog = false ; // Either a dialog or application window. + + Frame SuperFrame = GetParentFrame.GetParentFrame(new JFrame()) ; + + if (Dialog){ + +// As a MODAL JDialog + JDialog WLC2OSISDialog = new JDialog(SuperFrame, true) ; + A = new WLC2OSIS( WLC2OSISDialog ) ; + System.exit(0) ; + } + else{ + +// Ss a JFrame + JFrame ThisFrame = new JFrame() ; + A = new WLC2OSIS(ThisFrame) ; + } + } +// end of class +} +//============================================================================== +//============================================================================== |