Package org.dmd.util.parsing

Examples of org.dmd.util.parsing.Token


        while(it.hasNext()){
            StringName  key         = it.next();
            String  firstChar   = key.getNameString().substring(0,1).toUpperCase();
            TreeMap<String,Token> charTree    = index.get(firstChar);

            charTree.put(key.getNameString().toUpperCase(), new Token(key.getNameString(),0,schema.allDefs.get(key)));
        }

        // Generate the index reference header in HTML format - this will be
        // placed at the top of each index page.
        sb.append("<P> <HR SIZE=3 NOSHADE>");
        sb.append("<TABLE>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> <A HREF=\"index-allSchemas.shtml\"> Schema Summary </A></TD><TD></TD> </tr>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> <A HREF=\"classHierarchy.shtml\"> Class Hierarchy </A></TD><TD></TD> </tr>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> <A HREF=\"instanceHierarchy.shtml\"> Instance Hierarchy </A></TD><TD></TD> </tr>\n");
        sb.append("<tr> <TD CLASS=\"pagetextUnjust\"> Definitions Index </TD> <TD>\n");

        Iterator<String> indexIT = index.keySet().iterator();
        while(indexIT.hasNext()){
            String key = indexIT.next();
            TreeMap<String,Token>     tm = index.get(key);
//            String      fn = new String(dir + File.separator + "index-" + key + ".shtml");

            if (tm.size() > 0){
                sb.append("<A HREF=\"index-" + key + ".shtml\">" + key + "</A> \n");
            }
            else{
                sb.append(key + "  ");
            }
        }
        sb.append("</TD> </tr> </TABLE> <HR SIZE=3 NOSHADE> <P>\n");
        indexRefHTML = sb.toString();

        // Generate the schema summary
        try {
            BufferedWriter out = new BufferedWriter(new FileWriter(dir + "/index-allSchemas.shtml"));

            out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n");
            out.write("        \"http://www.w3.org/TR/REC-html40\">\n");
            out.write("<HTML>\n");
            out.write("<HEAD>\n");
            out.write("<LINK href=\"/standard.css\" rel=\"stylesheet\" type=\"text/css\">\n");
            out.write("<TITLE> " + organization + " - Schema Summary </TITLE>\n");
            out.write("</HEAD>\n");
            out.write("<BODY BGCOLOR=\"FFFFFF\">\n\n");

            // The whole page is in a table
            out.write("<TABLE WIDTH=600 CELLPADDING=10> <tr>\n");

            out.write("<TD WIDTH=120 CLASS=\"sidebar2\" VALIGN=TOP>\n");
//            out.write("<!--#include virtual=\"navLinks.html\" --> <P> </TD>\n");

            out.write("<TD>\n\n");

            out.write("<P CLASS=\"pagehead\">" + organization + " Schema Summary\n");
            out.write(indexRefHTML);
            // out.write("<H2> Schema Summary </H2> <P>");

            out.write("<TABLE>\n");

            Iterator<SchemaDefinition> schemaIT= schema.getSchemas();
            while(schemaIT.hasNext()){
                SchemaDefinition sd = schemaIT.next();

                out.write("<tr> <TD VALIGN=TOP CLASS=\"pagetextUnjust\">\n");
                out.write(schemaLink(sd));
                out.write("</TD> <TD CLASS=\"pagetextUnjust\">\n");
                out.write(sd.getDescription());
                out.write("</TD> </tr>");
            }

            out.write("</TABLE>");

            out.write("</TD> </tr> </TABLE>");
            out.write("</BODY>\n");
            out.write("</HTML>\n");

            out.close();
        } catch (IOException e) {
            System.out.println("IO Error:\n" + e);
        }


        indexIT = index.keySet().iterator();
        while(it.hasNext()){
            String key = indexIT.next();
            TreeMap<String,Token>     tm = index.get(key);
            String      fn = new String(dir + File.separator + "index-" + key + ".shtml");

            if (tm.size() > 0){
                try {
                    BufferedWriter out = new BufferedWriter(new FileWriter(fn));
                    Iterator<Token> defsIt = tm.values().iterator();

                    System.out.println("Generating index - " + fn);

                    out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n");
                    out.write("        \"http://www.w3.org/TR/REC-html40\">\n");
                    out.write("<HTML>\n");
                    out.write("<HEAD>\n");
                    out.write("<LINK href=\"/standard.css\" rel=\"stylesheet\" type=\"text/css\">\n");
                    out.write("<TITLE> " + organization + " - Schema Definitions Starting With The Letter - " + key + "</TITLE>\n");
                    out.write("</HEAD>\n");
                    out.write("<BODY BGCOLOR=\"FFFFFF\">\n\n");

                    // The whole page is in a table
                    out.write("<TABLE WIDTH=600 CELLPADDING=10> <tr> \n");

                    out.write("<TD WIDTH=120 CLASS=\"sidebar2\" VALIGN=TOP>\n");
//                    out.write("<!--#include virtual=\"navLinks.html\" --> <P> </TD>\n");

                    out.write("<TD>\n\n");
                    out.write(indexRefHTML);
                    out.write("<H1> - " + key + " - </H1> <P>");

                    out.write("<TABLE>\n");

                    while(defsIt.hasNext()){
                        Token               t  = (Token)defsIt.next();
                        DmsDefinition    go = (DmsDefinition) t.getUserData();

                        out.write("<tr> <TD VALIGN=TOP>\n");

                        if (go instanceof AttributeDefinition){
                            AttributeDefinition ad = (AttributeDefinition)go;
                            if (schema.attrAbbrevs.get(t.getValue()) != null){
                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
                                out.write("the abbreviated name of the " + defLink(ad,null) + " attribute of type " + defLink(ad.getType(),null) + " from the " + schemaLink(ad.getDefinedIn()) + " schema");
                            }
//                            else if (schema.reposNames.get(tname) != null){
//                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
//                                out.write("the repository name of the " + defLink(ad,null) + " attribute of type " + defLink(ad.getType(),null) + " from the " + schemaLink(ad.getDefinedIn()) + " schema");
//                            }
                            else{
                                out.write(defLink(go,null) + "</TD> <TD>\n");
                                out.write(" an attribute of type " + defLink(ad.getType(),null) + " from the " + schemaLink(ad.getDefinedIn()) + " schema");
                            }
                        }
                        else if (go instanceof ClassDefinition){
                            ClassDefinition cd = (ClassDefinition)go;
                            if (schema.attrAbbrevs.get(t.getValue()) != null){
                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
                                out.write("the abbreviated name of the " + defLink(cd,null) + " class from the " + schemaLink(cd.getDefinedIn()) + " schema");
                            }
//                            else if (schema.reposNames.get(t.getValue()) != null){
//                                out.write(defLink(go,t.getValue()) + "</TD> <TD>\n");
//                                out.write("the repository name of the " + defLink(cd,null) + " class from the " + schemaLink(cd.getDefinedIn()) + " schema");
View Full Code Here


            StringName  key = null;

            dict = new Dictionary();
            while(it.hasNext()){
                key = (StringName)it.next();
                dict.add(new Token(key.getNameString(),id++,allDefs.get(key)));
            }
        }
        return(dict);
    }
View Full Code Here

TOP

Related Classes of org.dmd.util.parsing.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.