Package TextDataTest

Source Code of TextDataTest.Main

package TextDataTest;

import DisplayProject.actions.AppletConnectionInfo;
import DisplayProject.actions.UserWindow;
import DisplayProject.plaf.Win32LookAndFeel;
import Framework.BooleanData;
import Framework.DateTimeData;
import Framework.DecimalData;
import Framework.DoubleData;
import Framework.ErrorMgr;
import Framework.ForteKeyboardFocusManager;
import Framework.FrameworkUtils;
import Framework.IntegerData;
import Framework.RuntimeProperties;
import Framework.StopWatch;
import Framework.TextData;
import Framework.TextNullable;
import java.awt.KeyboardFocusManager;
import java.io.Serializable;
import java.lang.String;
import javax.swing.UIManager;
import org.apache.log4j.Logger;

/**
* Main<p>
* <p>
* @author Generated from Forte
* @since  19-Nov-2008
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@SuppressWarnings("serial")
public class Main
        implements Serializable
{

    // ------------
    // Constructors
    // ------------
    public Main() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();

    }

    // -------
    // Methods
    // -------
    /**
     * work<p>
     * <p>
     */
    public void work() {
        TextData text = new TextData();
        TextData format = new TextData();
        TextNullable weird = new TextNullable();
        weird.setValue( "XXX" );
        weird.setValue("ABC");
        weird.setValue( (String)null);
        weird.setValue("CCC");
        weird.setValue((TextData)null);
        StopWatch sw = new StopWatch();
        sw.fire();
        for (int i = 1; i <= 10000; i++) {

            //
            //   with textdata format and 1 parameter
            format = new TextData("my name is %1");
            text.replaceParameters(format, new TextData("Fred"));
            //
            //   with textdata format and 2 parameters
            format = new TextData("my name is %1 %2");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"));
            //
            //   with textdata format and 3 parameters
            format = new TextData("my name is %1 %2, age: %3");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"), new IntegerData(35));
            //
            //   with textdata format and 4 parameters
            format = new TextData("my name is %1 %2, age: %3, weight %4");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85));
            //
            //   with textdata format and 5 parameters
            format = new TextData("my name is %1 %2, age: %3, weight %4, married %5");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE));
            //
            //   with textdata format and 6 parameters
            format = new TextData("my name is %1 %2, age: %3, weight %4, married %5, born %6");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE));
            //
            //   with textdata format and 7 parameters
            format = new TextData("my name is %1 %2, age: %3, weight %4, married %5, born %6, ratio %7");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE), new DoubleData(3.4));
            //
            //   with textdata format and 8 parameters
            format = new TextData("my name is %1 %2, age: %3, weight %4, married %5, born %6, ratio %7, income %8");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE), new DoubleData(3.4), new DecimalData(50010.35));
            //
            //   with textdata format and 9 parameters
            format = new TextData("my name is %1 %2, age: %3, weight %4, married %5, born %6, ratio %7, income %8, happy %9");
            text.replaceParameters(format, new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE), new DoubleData(3.4), new DecimalData(50010.35), new BooleanData(true, BooleanData.qq_Resolver.cVALUE));

            //
            //   with string format and 1 parameter
            text.replaceParameters("my name is %1", new TextData("Fred"));
            //
            //   with string format and 2 parameters
            text.replaceParameters("my name is %1 %2", new TextData("Fred"), new TextData("Jones"));
            //
            //   with string format and 3 parameters
            text.replaceParameters("my name is %1 %2, age: %3", new TextData("Fred"), new TextData("Jones"), new IntegerData(35));
            //
            //   with string format and 4 parameters
            text.replaceParameters("my name is %1 %2, age: %3, weight %4", new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85));
            //
            //   with string format and 5 parameters
            text.replaceParameters("my name is %1 %2, age: %3, weight %4, married %5", new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE));
            //
            //   with string format and 6 parameters
            text.replaceParameters("my name is %1 %2, age: %3, weight %4, married %5, born %6", new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE));
            //
            //   with string format and 7 parameters
            text.replaceParameters("my name is %1 %2, age: %3, weight %4, married %5, born %6, ratio %7", new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE), new DoubleData(3.4));
            //
            //   with string format and 8 parameters
            text.replaceParameters("my name is %1 %2, age: %3, weight %4, married %5, born %6, ratio %7, income %8", new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE), new DoubleData(3.4), new DecimalData(50010.35));
            //
            //   with string format and 9 parameters
            text.replaceParameters("my name is %1 %2, age: %3, weight %4, married %5, born %6, ratio %7, income %8, happy %9", new TextData("Fred"), new TextData("Jones"), new IntegerData(35), new IntegerData(85), new BooleanData(true, BooleanData.qq_Resolver.cVALUE), new DateTimeData(new TextData("01-Jan-1960"), DateTimeData.qq_Resolver.cVALUE), new DoubleData(3.4), new DecimalData(50010.35), new BooleanData(true, BooleanData.qq_Resolver.cVALUE));

        }

        int time = (int)sw.split();
        Logger.getLogger("task.part.logmgr").info( Integer.toString(time));
    }

    // -----------
    // Main method
    // -----------
    public static void main( String[] args ) {
        FrameworkUtils.setCmdLineArgs(args);
        AppletConnectionInfo client = null;
        try {
            // Install our own focus manager. MUST be done prior to setting the
            // UIManager, otherwise you'll run into issues like things have the wrong focus.
            KeyboardFocusManager.setCurrentKeyboardFocusManager(new ForteKeyboardFocusManager());

            UIManager.setLookAndFeel(new Win32LookAndFeel());

            client = UserWindow.postAPPLETStarted();
            Main main_start = new Main();
            main_start.work();
            UserWindow.postAPPLETStopped(client);
            System.exit(0);
        } catch (Throwable e) {
            ErrorMgr.showErrors(null, "Unhandled exception", e);
            UserWindow.postAPPLETStopped(client);
            System.exit(0);
        }
    }
// end class Main
// c Pass 2 Conversion Time: 452 milliseconds
TOP

Related Classes of TextDataTest.Main

TOP
Copyright © 2018 www.massapi.com. 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.