Example usage for java.util Vector lastElement

List of usage examples for java.util Vector lastElement

Introduction

In this page you can find the example usage for java.util Vector lastElement.

Prototype

public synchronized E lastElement() 

Source Link

Document

Returns the last component of the vector.

Usage

From source file:MainClass.java

public static void main(String args[]) {
    Vector<String> v = new Vector<String>();
    v.add("A");//from w w w. j  a  va 2  s  .  co m
    v.add("B");
    String firstElement = (String) v.firstElement();
    String lastElement = (String) v.lastElement();

    System.out.println(firstElement);
    System.out.println(lastElement);
}

From source file:Main.java

public static void main(String[] args) {

    Vector vec = new Vector(4);

    vec.add(4);/*from  ww  w . j ava 2  s . c om*/
    vec.add(3);
    vec.add(2);
    vec.add(1);

    // let us print the last element of the vector
    System.out.println("Last element: " + vec.lastElement());
}

From source file:MainClass.java

public static void main(String args[]) {

    // initial size is 3, increment is 2
    Vector<Integer> v = new Vector<Integer>(3, 2);

    System.out.println("Initial size: " + v.size());
    System.out.println("Initial capacity: " + v.capacity());

    v.addElement(1);/*ww  w  .j a v a2 s .  c  o  m*/
    v.addElement(2);

    System.out.println("First element: " + v.firstElement());
    System.out.println("Last element: " + v.lastElement());

    if (v.contains(3))
        System.out.println("Vector contains 3.");
}

From source file:Cresendo.java

public static void main(String[] args) {
    String cfgFileReceiver = null; // Path to config file for eif receiver agent
    String cfgFileEngine = null; // Path to config file for xml event engine
    Options opts = null; // Command line options
    HelpFormatter hf = null; // Command line help formatter

    // Setup the message record which will contain text written to the log file
    ///*ww w.jav  a2 s . c  om*/
    // The message logger object is created when the "-l" is processed
    // as this object need to be associated with a log file
    //
    LogRecord msg = new LogRecord(LogRecord.TYPE_INFO, "Cresendo", "main", "", "", "", "", "");

    // Get the directory separator (defaults to "/")
    //
    dirSep = System.getProperty("file.separator", "/");

    // Initialise the structure containing the event handler objects
    //
    Vector<IEventHandler> eventHandler = new Vector<IEventHandler>(10, 10);

    // Process the command line arguments
    //
    try {
        opts = new Options();
        hf = new HelpFormatter();

        opts.addOption("h", "help", false, "Command line arguments help");
        opts.addOption("i", "instance name", true, "Name of cresendo instance");
        opts.addOption("l", "log dir", true, "Path to log file directory");
        opts.addOption("c", "config dir", true, "Path to configuarion file directory");

        opts.getOption("l").setRequired(true);
        opts.getOption("c").setRequired(true);

        BasicParser parser = new BasicParser();
        CommandLine cl = parser.parse(opts, args);

        // Print out some help and exit
        //
        if (cl.hasOption('h')) {
            hf.printHelp("Options", opts);
            System.exit(0);
        }

        // Set the instance name
        //
        if (cl.hasOption('i')) {
            instanceName = cl.getOptionValue('i'); // Set to something other than "default"
        }

        // Setup the message and trace logging objects for the EventEngine
        //
        if (cl.hasOption('l')) {
            // Setup the the paths to the message, trace and status log files
            //
            logDir = cl.getOptionValue("l");

            logPath = logDir + dirSep + instanceName + "-engine.log";
            tracePath = logDir + dirSep + instanceName + "-engine.trace";
            statusPath = logDir + dirSep + instanceName + "-engine.status";
        } else {
            // NOTE:  This should be picked up by the MissingOptionException catch below
            //        but I couldn't get this to work so I added the following code:
            //
            hf.printHelp("Option 'l' is a required option", opts);
            System.exit(1);
        }

        // Read the receiver and engine config files in the config directory
        //
        if (cl.hasOption('c')) {
            // Setup and check path to eif config file for TECAgent receiver object
            //
            configDir = cl.getOptionValue("c");
            cfgFileReceiver = configDir + dirSep + instanceName + ".conf";
            checkConfigFile(cfgFileReceiver);

            // Setup and check path to xml config file for the EventEngine
            //
            cfgFileEngine = cl.getOptionValue("c") + dirSep + instanceName + ".xml";
            checkConfigFile(cfgFileEngine);

        } else {
            // NOTE:  This should be picked up by the MissingOptionException catch below
            //        but I couldn't get this to work so I added the following code:
            //
            hf.printHelp("Option 'c' is a required option", opts);
            System.exit(1);
        }
    } catch (UnrecognizedOptionException e) {
        hf.printHelp(e.toString(), opts);
        System.exit(1);
    } catch (MissingOptionException e) {
        hf.printHelp(e.toString(), opts);
        System.exit(1);
    } catch (MissingArgumentException e) {
        hf.printHelp(e.toString(), opts);
        System.exit(1);
    } catch (ParseException e) {
        e.printStackTrace();
        System.exit(1);
    } catch (Exception e) {
        System.err.println(e.toString());
        System.exit(1);
    }

    // Main program
    //
    try {
        // =====================================================================
        // Setup the message, trace and status logger objects
        //
        try {
            msgHandler = new FileHandler("cresendo", "message handler", logPath);
            msgHandler.openDevice();

            msgLogger = new MessageLogger("cresendo", "message log");
            msgLogger.addHandler(msgHandler);

            trcHandler = new FileHandler("cresendo", "trace handler", tracePath);
            trcHandler.openDevice();

            trcLogger = new TraceLogger("cresendo", "trace log");
            trcLogger.addHandler(trcHandler);

            statLogger = new StatusLogger(statusPath);
        } catch (Exception e) {
            System.err.println(e.toString());
            System.exit(1);
        }

        // Add the shutdown hook
        //
        Runtime.getRuntime().addShutdownHook(new ShutdownThread(msgLogger, instanceName));

        // ---------------------------------------------------------------------
        // =====================================================================
        // Load and parse the xml event engine configuration file
        //
        //
        msg.setText("Loading xml engine from: '" + cfgFileEngine + "'");

        try {
            XMLConfiguration xmlProcessor = new XMLConfiguration();
            xmlProcessor.setFileName(cfgFileEngine);

            // Validate the xml against a document type declaration
            //
            xmlProcessor.setValidating(true);

            // Don't interpolate the tag contents by splitting them on a delimiter
            // (ie by default a comma)
            //
            xmlProcessor.setDelimiterParsingDisabled(true);

            // This will throw a ConfigurationException if the xml document does not
            // conform to its dtd.  By doing this we hopefully catch any errors left
            // behind after the xml configuration file has been edited.
            //
            xmlProcessor.load();

            // Setup the trace flag
            //
            ConfigurationNode engine = xmlProcessor.getRootNode();
            List rootAttribute = engine.getAttributes();

            for (Iterator it = rootAttribute.iterator(); it.hasNext();) {
                ConfigurationNode attr = (ConfigurationNode) it.next();

                String attrName = attr.getName();
                String attrValue = (String) attr.getValue();

                if (attrValue == null || attrValue == "") {
                    System.err.println("\n  Error: The value of the attribute '" + attrName + "'"
                            + "\n         in the xml file '" + cfgFileEngine + "'" + "\n         is not set");
                    System.exit(1);
                }

                if (attrName.matches("trace")) {
                    if (attrValue.matches("true") || attrValue.matches("on")) {
                        trcLogger.setLogging(true);
                    }
                }

                if (attrName.matches("status")) {
                    if (attrValue.matches("true") || attrValue.matches("on")) {
                        statLogger.setLogging(true);
                    } else {
                        statLogger.setLogging(false);
                    }
                }

                if (attrName.matches("interval")) {
                    if (!attrValue.matches("[0-9]+")) {
                        System.err.println("\n  Error: The value of the interval attribute in: '"
                                + cfgFileEngine + "'" + "\n         should only contain digits from 0 to 9."
                                + "\n         It currently contains: '" + attrValue + "'");
                        System.exit(1);
                    }

                    statLogger.setInterval(Integer.parseInt(attrValue));
                }
            }

            // Now build and instantiate the list of classes that will process events
            // received by the TECAgent receiver in a chain like manner.
            //
            List classes = xmlProcessor.configurationsAt("class");

            for (Iterator it = classes.iterator(); it.hasNext();) {
                HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next();

                // sub contains now all data contained in a single <class></class> tag set
                //
                String className = sub.getString("name");

                // Log message
                //
                msg.setText(msg.getText() + "\n  Instantiated event handler class: '" + className + "'");

                // The angle brackets describing the class of object held by the
                // Vector are implemented by Java 1.5 and have 2 effects.
                //
                // 1. The list accepts only elements of that class and nothing else
                // (Of course thanks to Auto-Wrap you can also add double-values)
                //
                // 2. the get(), firstElement() ... Methods don't return a Object, but
                //    they deliver an element of the class.
                //
                Vector<Class> optTypes = new Vector<Class>(10, 10);
                Vector<Object> optValues = new Vector<Object>(10, 10);

                for (int i = 0; i <= sub.getMaxIndex("option"); i++) {
                    Object optValue = null;
                    String optVarName = sub.getString("option(" + i + ")[@varname]");
                    String optJavaType = sub.getString("option(" + i + ")[@javatype]");

                    // Use the specified java type in order to make the method call
                    // to the heirarchical sub object [painful :-((]
                    //
                    if (optJavaType.matches("byte")) {
                        optTypes.addElement(byte.class);
                        optValue = sub.getByte("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = 0; // Set to something nullish
                        }
                    } else if (optJavaType.matches("short")) {
                        optTypes.addElement(byte.class);
                        optValue = sub.getShort("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = 0; // Set to something nullish
                        }
                    } else if (optJavaType.matches("int")) {
                        optTypes.addElement(int.class);
                        optValue = sub.getInt("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = 0; // Set to something nullish
                        }
                    } else if (optJavaType.matches("long")) {
                        optTypes.addElement(long.class);
                        optValue = sub.getLong("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = 0; // Set to something nullish
                        }
                    } else if (optJavaType.matches("float")) {
                        optTypes.addElement(float.class);
                        optValue = sub.getFloat("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = 0.0; // Set to something nullish
                        }
                    } else if (optJavaType.matches("double")) {
                        optTypes.addElement(double.class);
                        optValue = sub.getDouble("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = 0.0; // Set to something nullish
                        }
                    } else if (optJavaType.matches("boolean")) {
                        optTypes.addElement(boolean.class);
                        optValue = sub.getBoolean("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = false; // Set to something nullish
                        }
                    } else if (optJavaType.matches("String")) {
                        optTypes.addElement(String.class);
                        optValue = sub.getString("option(" + i + ")");

                        if (optValue == null) // Catch nulls
                        {
                            optValue = ""; // Set it to something nullish
                        }
                    } else {
                        System.err.println(
                                "Error: Unsupported java type found in xml config: '" + optJavaType + "'");
                        System.exit(1);
                    }

                    // Add option value element
                    //
                    //              System.out.println("Option value is: '" + optValue.toString() + "'\n");
                    //
                    optValues.addElement(optValue);

                    // Append to message text
                    //
                    String msgTemp = msg.getText();
                    msgTemp += "\n      option name: '" + optVarName + "'";
                    msgTemp += "\n      option type: '" + optJavaType + "'";
                    msgTemp += "\n     option value: '" + optValues.lastElement().toString() + "'";
                    msg.setText(msgTemp);
                }

                try {
                    // Instantiate the class with the java reflection api
                    //
                    Class klass = Class.forName(className);

                    // Setup an array of paramater types in order to retrieve the matching constructor
                    //
                    Class[] types = optTypes.toArray(new Class[optTypes.size()]);

                    // Get the constructor for the class which matches the parameter types
                    //
                    Constructor konstruct = klass.getConstructor(types);

                    // Create an instance of the event handler
                    //
                    IEventHandler eventProcessor = (IEventHandler) konstruct.newInstance(optValues.toArray());

                    // Add the instance to the list of event handlers
                    //
                    eventHandler.addElement(eventProcessor);

                } catch (InvocationTargetException e) {
                    System.err.println("Error: " + e.toString());
                    System.exit(1);
                } catch (ClassNotFoundException e) {
                    System.err.println("Error: class name not found: '" + className + "' \n" + e.toString());
                    System.exit(1);
                } catch (Exception e) {
                    System.err.println(
                            "Error: failed to instantiate class: '" + className + "' \n" + e.toString());
                    System.exit(1);
                }
            }
        } catch (ConfigurationException cex) // Something went wrong loading the xml file
        {
            System.err.println("\n" + "Error loading XML file: " + cfgFileEngine + "\n" + cex.toString());
            System.exit(1);
        } catch (Exception e) {
            System.err.println(e.toString());
            System.exit(1);
        }

        // ---------------------------------------------------------------------
        // =====================================================================
        // Setup the TECAgent receiver 
        // 
        Reader cfgIn = null;

        try {
            cfgIn = new FileReader(cfgFileReceiver);
        } catch (Exception e) {
            System.err.println(e.toString());
            System.exit(1);
        }

        // Start the TECAgent receiver and register the event engine handler
        //
        TECAgent receiver = new TECAgent(cfgIn, TECAgent.RECEIVER_MODE, false);

        EventEngine ee = new EventEngine(eventHandler, msgLogger, trcLogger);

        receiver.registerListener(ee);

        // Construct message and send it to the message log
        //
        String text = "\n  Cresendo instance '" + instanceName + "' listening for events on port '"
                + receiver.getConfigVal("ServerPort") + "'";

        msg.setText(msg.getText() + text);
        msgLogger.log(msg); // Send message to log

        // ---------------------------------------------------------------------
        // =====================================================================
        // Initiate status logging
        //
        if (statLogger.isLogging()) {
            int seconds = statLogger.getInterval();

            while (true) {
                try {
                    statLogger.log();
                } catch (Exception ex) {
                    System.err.println("\n  An error occurred while writing to '" + statusPath + "'" + "\n  '"
                            + ex.toString() + "'");
                }

                Thread.sleep(seconds * 1000); // Convert sleep time to milliseconds
            }
        }

        // ---------------------------------------------------------------------
    } catch (Exception e) {
        System.err.println(e.toString());
        System.exit(1);
    }
}

From source file:edu.umn.cs.spatialHadoop.util.Parallel.java

public static <T> List<T> forEach(int start, int end, RunnableRange<T> r, int parallelism)
        throws InterruptedException {
    Vector<T> results = new Vector<T>();
    if (end <= start)
        return results;
    final Vector<Throwable> exceptions = new Vector<Throwable>();
    Thread.UncaughtExceptionHandler h = new Thread.UncaughtExceptionHandler() {
        public void uncaughtException(Thread th, Throwable ex) {
            exceptions.add(ex);//from   w w w . ja  v  a  2 s  .  c  o  m
        }
    };

    // Put an upper bound on parallelism to avoid empty ranges
    if (parallelism > (end - start))
        parallelism = end - start;
    if (parallelism == 1) {
        // Avoid creating threads
        results.add(r.run(start, end));
    } else {
        LOG.info("Creating " + parallelism + " threads");
        final int[] partitions = new int[parallelism + 1];
        for (int i_thread = 0; i_thread <= parallelism; i_thread++)
            partitions[i_thread] = i_thread * (end - start) / parallelism + start;
        final Vector<RunnableRangeThread<T>> threads = new Vector<RunnableRangeThread<T>>();
        for (int i_thread = 0; i_thread < parallelism; i_thread++) {
            RunnableRangeThread<T> thread = new RunnableRangeThread<T>(r, partitions[i_thread],
                    partitions[i_thread + 1]);
            thread.setUncaughtExceptionHandler(h);
            threads.add(thread);
            threads.lastElement().start();
        }
        for (int i_thread = 0; i_thread < parallelism; i_thread++) {
            threads.get(i_thread).join();
            results.add(threads.get(i_thread).getResult());
        }
        if (!exceptions.isEmpty())
            throw new RuntimeException(exceptions.size() + " unhandled exceptions", exceptions.firstElement());
    }
    return results;
}

From source file:takatuka.classreader.dataObjs.attribute.ExceptionTableEntry.java

void restorePCInformation(BHInstruction inst) throws Exception {
    if (inst instanceof InstructionsCombined) {
        InstructionsCombined instComb = (InstructionsCombined) inst;
        Vector<BHInstruction> instr = instComb.getSimpleInstructions();
        updatePCInformation(instr.firstElement().getInstructionId(), inst.getOffSet());
        updatePCInformation(instr.lastElement().getInstructionId(), inst.getOffSet());
    } else {/*ww w .ja  va2 s.c  om*/
        updatePCInformation(inst.getInstructionId(), inst.getOffSet());
    }
}

From source file:org.xwiki.extension.repository.xwiki.internal.resources.AbstractExtensionRESTResource.java

protected BaseObject getExtensionVersionObject(XWikiDocument extensionDocument, String version) {
    if (version == null) {
        Vector<BaseObject> objects = extensionDocument
                .getObjects(XWikiRepositoryModel.EXTENSIONVERSION_CLASSNAME);

        if (objects.isEmpty()) {
            return null;
        } else {/*  w  ww .jav a 2 s .  c  om*/
            return objects.lastElement();
        }
    }

    return extensionDocument.getObject(XWikiRepositoryModel.EXTENSIONVERSION_CLASSNAME, "version", version,
            false);
}

From source file:edu.umn.cs.spatialHadoop.nasa.StockQuadTree.java

/**
 * Perform a selection query that retrieves all points in the given range.
 * The range is specified in the two-dimensional array positions.
 * @param in/*from w w  w  . j  a v a 2 s  .  co m*/
 * @param query_mbr
 * @param output
 * @return number of matched records
 * @throws IOException
 */
public static int selectionQuery(FSDataInputStream in, Rectangle query_mbr, ResultCollector<PointValue> output)
        throws IOException {
    long treeStartPosition = in.getPos();
    int numOfResults = 0;
    int resolution = in.readInt();
    short fillValue = in.readShort();
    int cardinality = in.readInt();
    long[] timestamps = new long[cardinality];
    for (int i = 0; i < cardinality; i++)
        timestamps[i] = in.readLong();
    Vector<Integer> selectedStarts = new Vector<Integer>();
    Vector<Integer> selectedEnds = new Vector<Integer>();
    StockQuadTree stockQuadTree = getOrCreateStockQuadTree(resolution);
    // Nodes to be searched. Contains node positions in the array of nodes
    Stack<Integer> nodes_2b_searched = new Stack<Integer>();
    nodes_2b_searched.add(0); // Root node (ID=1)
    Rectangle node_mbr = new Rectangle();
    while (!nodes_2b_searched.isEmpty()) {
        int node_pos = nodes_2b_searched.pop();
        stockQuadTree.getNodeMBR(node_pos, node_mbr);
        if (query_mbr.contains(node_mbr)) {
            // Add this node to the selection list and stop this branch
            if (!selectedEnds.isEmpty()
                    && selectedEnds.lastElement() == stockQuadTree.nodesStartPosition[node_pos]) {
                // Merge with an adjacent range
                selectedEnds.set(selectedEnds.size() - 1, stockQuadTree.nodesEndPosition[node_pos]);
            } else {
                // add a new range
                selectedStarts.add(stockQuadTree.nodesStartPosition[node_pos]);
                selectedEnds.add(stockQuadTree.nodesEndPosition[node_pos]);
            }
            numOfResults += stockQuadTree.nodesEndPosition[node_pos]
                    - stockQuadTree.nodesStartPosition[node_pos];
        } else if (query_mbr.intersects(node_mbr)) {
            int first_child_id = stockQuadTree.nodesID[node_pos] * 4 + 0;
            int first_child_pos = Arrays.binarySearch(stockQuadTree.nodesID, first_child_id);
            if (first_child_pos < 0) {
                // No children. Hit a leaf node
                // Scan and add matching points only
                java.awt.Point record_coords = new Point();
                for (int record_pos = stockQuadTree.nodesStartPosition[node_pos]; record_pos < stockQuadTree.nodesEndPosition[node_pos]; record_pos++) {
                    stockQuadTree.getRecordCoords(record_pos, record_coords);
                    if (query_mbr.contains(record_coords)) {
                        // matched a record.
                        if (!selectedEnds.isEmpty() && selectedEnds.lastElement() == record_pos) {
                            // Merge with an adjacent range
                            selectedEnds.set(selectedEnds.size() - 1, record_pos + 1);
                        } else {
                            // Add a new range of unit width
                            selectedStarts.add(record_pos);
                            selectedEnds.add(record_pos + 1);
                        }
                        numOfResults++;
                    }
                }
            } else {
                // Non-leaf node. Add all children to the list of nodes to search
                // Add in reverse order to the stack so that results come in sorted order
                nodes_2b_searched.add(first_child_pos + 3);
                nodes_2b_searched.add(first_child_pos + 2);
                nodes_2b_searched.add(first_child_pos + 1);
                nodes_2b_searched.add(first_child_pos + 0);
            }
        }
    }
    if (output != null) {
        PointValue returnValue = new PointValue();
        long dataStartPosition = treeStartPosition + getValuesStartOffset(cardinality);
        // Return all values in the selected ranges
        for (int iRange = 0; iRange < selectedStarts.size(); iRange++) {
            int treeStart = selectedStarts.get(iRange);
            int treeEnd = selectedEnds.get(iRange);
            long startPosition = dataStartPosition + selectedStarts.get(iRange) * cardinality * 2;
            in.seek(startPosition);
            for (int treePos = treeStart; treePos < treeEnd; treePos++) {
                // Retrieve the coords for the point at treePos
                stockQuadTree.getRecordCoords(treePos, returnValue);
                // Read all entries at current position
                for (int iValue = 0; iValue < cardinality; iValue++) {
                    short value = in.readShort();
                    if (value != fillValue) {
                        returnValue.value = value;
                        returnValue.timestamp = timestamps[iValue];
                        output.collect(returnValue);
                    }
                }
            }
        }
    }
    return numOfResults;
}

From source file:de.blinkt.openvpn.core.ConfigParser.java

private Vector<String> getOption(String option, int minarg, int maxarg) throws ConfigParseError {
    Vector<Vector<String>> alloptions = getAllOption(option, minarg, maxarg);
    if (alloptions == null)
        return null;
    else//from ww  w  . ja  v  a2  s. com
        return alloptions.lastElement();
}

From source file:org.soaplab.services.metadata.MetadataAccessorXML.java

/*********************************************************************
 * endElement()//  w  w  w . j  av a 2s  .  c o  m
 ********************************************************************/
public void endElement(String namespaceURI, String name, String qName) {

    if (tt.is(INPUT_PATH)) {

        // 'possible_values' are always dealt with only here  because
        // we had to wait for all of them first
        currInputPropertyDef.possibleValues = new String[allowed.size()];
        allowed.copyInto(currInputPropertyDef.possibleValues);
        allowed = null;

        inputs.addElement(currInputPropertyDef);
        currInputPropertyDef = null;

    } else if (tt.is(OUTPUT_PATH)) {
        outputs.addElement(currOutputPropertyDef);
        currOutputPropertyDef = null;

    } else if (tt.is(EXT_PATH)) {
        analysis.add(optionStack.pop());

    } else if (tt.is(EVENT_PATH)) {
        event.actions = new ActionDef[actions.size()];
        actions.copyInto(event.actions);
        actions.removeAllElements();

        event.conds = new CondDef[conditions.size()];
        conditions.copyInto(event.conds);
        conditions.removeAllElements();

    } else if (tt.is(ACTION_PATH)) {
        currAction.add(optionStack.pop());
        actions.addElement(currAction);
        currAction = null;

    } else if (tt.is(PARAMETER_PATH)) {
        Vector<ParamDef> base = paramStack.pop(); // should be always with 1 element
        ParamDef baseParam = base.elementAt(0);
        params.addElement(mergeDef(baseParam, currParam));
        currParam = null;

    } else if (tt.is(STANDARD_PATH) || tt.is(RANGE_PATH)) {
        ((StdParamDef) currParam).repeat = currRepeat;
        currRepeat = null;
        ((StdParamDef) currParam).lists = new ListDef[lists.size()];
        lists.copyInto(((StdParamDef) currParam).lists);
        lists = null;

    } else if (tt.is(DATA_PATH)) {
        ((IOParamDef) currParam).repeat = currRepeat;
        currRepeat = null;
        ((StdParamDef) currParam).lists = new ListDef[lists.size()];
        lists.copyInto(((StdParamDef) currParam).lists);
        lists = null;

        // ResultDef is deprecated - therefore:
        // - copy results options to the current IOPramDef
        for (Enumeration<ResultDef> en = results.elements(); en.hasMoreElements();) {
            ResultDef rd = en.nextElement();
            currParam.options.addProperties(rd.options);
            if (rd.specialType == ResultDef.URL)
                currParam.options.put(IOParamDef.SPECIAL_TYPE, "url");
        }
        results.removeAllElements();

    } else if (tt.is(RESULT_PATH)) {
        currResult.add(optionStack.pop());
        results.addElement(currResult);
        currResult = null;

    } else if (tt.is(CHOICE_PATH) || tt.is(CHOICE_LIST_PATH)) {
        Vector<ParamDef> bools = paramStack.pop();
        ((ChoiceParamDef) currParam).bools = new ParamDef[bools.size()];
        bools.copyInto(((ChoiceParamDef) currParam).bools);

    } else if (tt.is(BASE_PARAM_PATH) || tt.is(SUB_CHOICE_PATH) || tt.is(SUB_CHOICE_LIST_PATH)) {
        Vector<ParamDef> v = paramStack.peek();
        ParamDef p = v.lastElement();

        p.conds = new CondDef[conditions.size()];
        conditions.copyInto(p.conds);
        conditions.removeAllElements();

        p.add(optionStack.pop());

    } else if (name.equals("condition")) {
        if (currCondition != null) {
            currCondition.options.addProperties(optionStack.pop());
            conditions.addElement(currCondition);
            currCondition = null;
        }

    } else if (name.equals("repeatable")) {
        if (currRepeat != null) {
            currRepeat.options.addProperties(optionStack.pop());
        }

    } else if (name.equals("list")) {
        if (currList != null) {
            currList.items = new ListItemDef[listItems.size()];
            listItems.copyInto(currList.items);
            lists.addElement(currList);
            currList = null;
            listItems = null;
        }

    } else if (name.equals("default")) {
        StringBuffer buf = pcdataStack.pop();

        // we can be inside AppLab extensions...
        if (!paramStack.empty()) {
            Vector<ParamDef> v = paramStack.peek();
            if (v.size() > 0) {
                ParamDef p = v.lastElement();
                p.dflt = new String(buf);
            }

            // ...or we are in the BSA standard part
        } else if (currInputPropertyDef != null) {
            currInputPropertyDef.defaultValue = new String(buf);
        }

    } else if (name.equals("description")) {
        StringBuffer buf = pcdataStack.pop();
        analysis.options.put(SoaplabConstants.ANALYSIS_DESCRIPTION, new String(buf));

    } else if (name.equals("allowed")) {
        StringBuffer buf = pcdataStack.pop();
        if (allowed != null)
            allowed.addElement(new String(buf));

    } else if (name.equals("prompt")) {
        StringBuffer buf = pcdataStack.pop();
        if (!paramStack.empty()) {
            Vector<ParamDef> v = paramStack.peek();
            if (v.size() > 0) {
                ParamDef p = v.lastElement();
                p.options.put(SoaplabConstants.DATA_PROMPT, new String(buf));
            }
        }

    } else if (name.equals("help")) {
        StringBuffer buf = pcdataStack.pop();
        if (!paramStack.empty()) {
            Vector<ParamDef> v = paramStack.peek();
            if (v.size() > 0) {
                ParamDef p = v.lastElement();
                p.options.put(SoaplabConstants.DATA_HELP, new String(buf));
            }
        }
    }

    tt.pop();
}