Java2HTML改造手记(3)

原创 2003年08月11日 12:25:00

Ja Java2HTML改造手记(3)

 

先重点看这个:

public static void main(String args[])

{

       ……………….

    java2html = new Java2HTML();

    o01 = new O01(args);

       ……………….

}

参数又跳转到o01上了.那么我们继续,没办法,逆向工程是需要耐心的.

// Source File Name:   O01.java

 

package com.java2html;

 

import java.io.File;

import java.io.PrintStream;

import java.util.Vector;

 

// Referenced classes of package com.java2html:

//            BadOptionException, Java2HTML, JavaDoc, O07

 

public class O01

{

 

    private String O02[];

    private boolean O03[];

 

    O01(String as[])

    {

        O02 = as;

        O03 = new boolean[as.length];

    }

 

    boolean O04(Java2HTML java2html)

        throws BadOptionException

    {

        if(O02.length == 0 || O06(new String[] {

    "help", "h", "?", "/?"

}))

        {

            System.out.println(O07.O08);

            return false;

        }

        String as[] = O010(new String[] {

            "name", "n"

        }, false, 1);

        if(as.length == 1)

        {

            java2html.setTitle(as[0]);

        }

        java2html.setFooter(O06(new String[] {

            "nofooter", "nf"

        }));

        java2html.setFooter(O06(new String[] {

            "noheader", "nh"

        }));

        java2html.setSimple(O06(new String[] {

            "simple", "s"

        }));

        int ai[] = O012(new String[] {

            "margin", "m"

        }, false, 1);

        if(ai.length == 1)

        {

            java2html.setMarginSize(ai[0]);

        }

        int ai1[] = O012(new String[] {

            "tabs", "t"

        }, false, 1);

        if(ai1.length == 1)

        {

            java2html.setTabSize(ai1[0]);

        }

        String as1[] = O010(new String[] {

            "destination", "d"

        }, false, 1);

        if(as1.length == 1)

        {

            java2html.setDestination(as1[0]);

        }

        String as2[] = O010(new String[] {

            "javasource", "js"

        }, false, -1);

        if(as2.length > 0)

        {

            java2html.setJavaDirectorySource(as2);

        }

        JavaDoc ajavadoc[] = O017(new String[] {

            "javadoc", "jd"

        });

        if(ajavadoc.length > 0)

        {

            java2html.setJavaDoc(ajavadoc);

        }

        O018();

        return true;

    }

 

    private boolean O06(String as[])

        throws BadOptionException

    {

        int i = 0;

        int j = 0;

        boolean flag = false;

        for(; i < O02.length; i++)

        {

            for(int k = 0; k < as.length; k++)

            {

                if(!O02[i].equalsIgnoreCase("-" + as[k]))

                {

                    continue;

                }

                O03[i] = true;

                if(j >= 1)

                {

                    throw new BadOptionException(as[0] + " should only be set once");

                }

                j++;

                flag = true;

                break;

            }

 

        }

 

        return flag;

    }

 

    private String[] O010(String as[], boolean flag, int i)

        throws BadOptionException

    {

        int j = 0;

        int k = 0;

        Vector vector = new Vector();

        for(; j < O02.length; j++)

        {

            for(int l = 0; l < as.length; l++)

            {

                if(!O02[j].equalsIgnoreCase("-" + as[l]))

                {

                    continue;

                }

                O03[j] = true;

                j++;

                if(k == i)

                {

                    throw new BadOptionException(as[0] + " should only be set " + i + " time(s)");

                }

                if(j >= O02.length)

                {

                    throw new BadOptionException("Value not set for " + as[0]);

                }

                O03[j] = true;

                vector.addElement(O02[j]);

                k++;

                break;

            }

 

        }

 

        if(flag && k == 0)

        {

            throw new BadOptionException(as[0] + " needs to be set");

        } else

        {

            return O026(vector);

        }

    }

 

    private int[] O012(String as[], boolean flag, int i)

        throws BadOptionException

    {

        int j = 0;

        int k = 0;

        Vector vector = new Vector();

        for(; j < O02.length; j++)

        {

            for(int l = 0; l < as.length; l++)

            {

                if(!O02[j].equalsIgnoreCase("-" + as[l]))

                {

                    continue;

                }

                O03[j] = true;

                j++;

                if(k == i)

                {

                    throw new BadOptionException(as[0] + " should only be set " + i + " time(s)");

                }

                if(j >= O02.length)

                {

                    throw new BadOptionException("Value not set for " + as[0]);

                }

                O03[j] = true;

                vector.addElement(O02[j]);

                k++;

                break;

            }

 

        }

 

        if(flag && k == 0)

        {

            throw new BadOptionException(as[0] + " needs to be set");

        }

        int ai[] = null;

        try

        {

            ai = O028(vector);

        }

        catch(Exception _ex)

        {

            throw new BadOptionException(as[0] + " must be a number");

        }

        return ai;

    }

 

    public JavaDoc[] O017(String as[])

        throws BadOptionException

    {

        int i = 0;

        int j = 0;

        Vector vector = new Vector();

        for(; i < O02.length; i++)

        {

            for(int k = 0; k < as.length; k++)

            {

                if(!O02[i].equalsIgnoreCase("-" + as[k]))

                {

                    continue;

                }

                O03[i] = true;

                if(++i >= O02.length)

                {

                    throw new BadOptionException("Value not set for " + as[0]);

                }

                O03[i] = true;

                JavaDoc javadoc = null;

                File file = new File(O02[i]);

                String s = null;

                if(i + 1 < O02.length && !O02[i + 1].startsWith("-"))

                {

                    i++;

                    if(!O02[i].startsWith("http://"))

                    {

                        throw new BadOptionException("Second Parameter of -jd/-javadoc option must start with 'http://'");

                    }

                    s = O02[i];

                    O03[i] = true;

                }

                if(s != null)

                {

                    javadoc = new JavaDoc(file, s);

                } else

                {

                    javadoc = new JavaDoc(file);

                }

                vector.addElement(javadoc);

                j++;

                break;

            }

 

        }

 

        JavaDoc ajavadoc[] = new JavaDoc[vector.size()];

        for(int l = 0; l < vector.size(); l++)

        {

            ajavadoc[l] = (JavaDoc)vector.elementAt(l);

        }

 

        return ajavadoc;

    }

 

    private String[] O026(Vector vector)

    {

        String as[] = new String[vector.size()];

        for(int i = 0; i < vector.size(); i++)

        {

            as[i] = (String)vector.elementAt(i);

        }

 

        return as;

    }

 

    private int[] O028(Vector vector)

    {

        int ai[] = new int[vector.size()];

        for(int i = 0; i < vector.size(); i++)

        {

            ai[i] = Integer.parseInt((String)vector.elementAt(i));

        }

 

        return ai;

    }

 

    public void O018()

        throws BadOptionException

    {

        for(int i = 0; i < O03.length; i++)

        {

            if(!O03[i])

            {

                throw new BadOptionException("Unkown Argument :" + O02[i]);

            }

        }

 

    }

}

 

找到这里:

O01(String as[])

{

O02 = as;

    O03 = new boolean[as.length];

}

看来这里没有作什么,那么我们回到java2html.java文件继续往下看:

public static void main(String args[])

{

…………………..

java2html = new Java2HTML();

    o01 = new O01(args);

       //这里就是了

    if(!o01.O04(java2html))

    {

           return;

    }

       ………………….

}

 

原来调用了o01.O04方法.看看:

 

boolean O04(Java2HTML java2html)

        throws BadOptionException

    {

        if(O02.length == 0 || O06(new String[] {

    "help", "h", "?", "/?"

}))

        {

            System.out.println(O07.O08);

            return false;

        }

        String as[] = O010(new String[] {

            "name", "n"

        }, false, 1);

        if(as.length == 1)

        {

            java2html.setTitle(as[0]);

        }

        java2html.setFooter(O06(new String[] {

            "nofooter", "nf"

        }));

        java2html.setFooter(O06(new String[] {

            "noheader", "nh"

        }));

        java2html.setSimple(O06(new String[] {

            "simple", "s"

        }));

        int ai[] = O012(new String[] {

            "margin", "m"

        }, false, 1);

        if(ai.length == 1)

        {

            java2html.setMarginSize(ai[0]);

        }

        int ai1[] = O012(new String[] {

            "tabs", "t"

        }, false, 1);

        if(ai1.length == 1)

        {

            java2html.setTabSize(ai1[0]);

        }

        String as1[] = O010(new String[] {

            "destination", "d"

        }, false, 1);

        if(as1.length == 1)

        {

            java2html.setDestination(as1[0]);

        }

        String as2[] = O010(new String[] {

            "javasource", "js"

        }, false, -1);

        if(as2.length > 0)

        {

            java2html.setJavaDirectorySource(as2);

        }

        JavaDoc ajavadoc[] = O017(new String[] {

            "javadoc", "jd"

        });

        if(ajavadoc.length > 0)

        {

            java2html.setJavaDoc(ajavadoc);

        }

        O018();

        return true;

    }

 

欲知后事如何,且听下回分解.

将你的老旧Android平板或手机改造成服务器

相信电脑前的各位与我一样,都对自己手中的智能手机或平板电脑爱不释手,但是作为一款科技产品更新换代的速度几乎让我们无法跟随。通常来说,每六个月的周期就会出现配置更强大的新产品,而作为消费者在购买了新设备...
  • john19891110
  • john19891110
  • 2013年10月20日 17:58
  • 2367

笔记本内置摄像头改装外置摄像头

笔记本内置摄像头的到USB摄像头的简单改装。
  • buchunjiedexin
  • buchunjiedexin
  • 2015年05月29日 00:10
  • 1977

废物利用: 动手将笔记本的显示器改成多功能显示器 可用于电视盒子以及嵌入式开发

方案比较 买了一个Cortex-A8的开源板子BeagleBone Black,其输出是HDMI,而我的显示器是VGA的。对此想到了几种方法,各有优劣: HDMI显示方案对比 方案 详细设备...
  • sy373466062
  • sy373466062
  • 2015年12月05日 17:34
  • 6283

oracle DBA 手记 2/3

  • 2011年02月23日 22:02
  • 19.07MB
  • 下载

【练习手记】【多题合集】用树状数组做线段树练习1、2、3

线段树练习 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题解 题目描述 Description 一行N个方格,开始每个格子里都有一个整数...
  • xym_CSDN
  • xym_CSDN
  • 2015年12月04日 21:29
  • 497

设以带头结点的双向循环链表表示的线性表L= (a1,a2,…,an),试写一时间复杂度O(n)的算法,将L改造为 (a1,a3,…,an,…,a4,a2)。

/* 将L中的元素,按如下规则插入新表,并返回新表。 (1,2)->(1,3,2)->(1,3,4,2)->(1,3,5,4,2)->(1,3,5,6,4,2)->... */ DuLinkList ...
  • TysonSir
  • TysonSir
  • 2017年03月27日 23:05
  • 1095

plsm2使用手记(3)-plsm2基本使用方法

来源:http://sxoo0305.blog.163.com/blog/static/10132887200911555816746/ Plsm2使用方法  注意:在看本文前,请先确认你已经...
  • shuangmu1010
  • shuangmu1010
  • 2011年08月30日 09:59
  • 458

Java小白手记2:一些名词解释

看到《Java 征途:行者的地图》 ,这是一篇有关java学习路径文章。对我等Java小白有指引作用。里面提到了一些基本的名词术语,有些我知道,有些不知道,再补上一些自己曾觉得模糊的,记录如下: 此...
  • leftfist
  • leftfist
  • 2016年03月10日 19:58
  • 1960

设双链表表示的线性表L=(a1,a2,a3.....an)将L改造为L=(a1,a3,....an...a4,a2)

//头文件 #ifndef DOUBLELIST_H #define DOUBLELIST_H #include using namespace std; template cla...
  • qq_28633157
  • qq_28633157
  • 2015年10月09日 15:31
  • 1023

网页开发手记 HTML

  • 2013年09月08日 22:11
  • 28.25MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Java2HTML改造手记(3)
举报原因:
原因补充:

(最多只允许输入30个字)