Package java.util

Examples of java.util.Stack


        SAXParser parser = factory.newSAXParser();

        rootNode = helmaNode;
        currentNode = null;
        convertedNodes = new HashMap();
        nodeStack = new Stack();
        parsingHopObject = true;

        parser.parse(in, this);

        return rootNode;
View Full Code Here


   */
  public HashMap getQuryData(String target,String source)
  {
    HashMap hmap = new HashMap();

    Stack stack = getTableTrack(target, source);

    Set tableSet = new TreeSet();
   
    String pop1 = "";
    String pop2 = "";   
    pop1 = (String)stack.pop();
    tableSet.add(pop1);
    String searchClause = " ";
   
    while(!stack.empty())
    {
      pop2 = (String)stack.pop();     
      tableSet.add(pop1);
      tableSet.add(pop2);     
      Vector vec = (Vector) ((HashMap)this.get(pop2)).get(pop1);

      String clause = "";
View Full Code Here

   */
  private Stack getTableTrack(String target,String source )
  {
    String currEle = source;

    Stack current = new Stack();
    Stack track = new Stack();
    Stack found = new Stack();

    found.push(source);

    if (source.equals(target))
    {
      track.push(source);
      return track ;     
    }
   

    while(!found.empty() )
    {
      String popEle = (String)found.pop();
      String lastTrack ="";

      //1 st Step
      if (!track.empty() )
      {
        lastTrack = (String)track.pop();

        if (popEle.equals(lastTrack))  continue;
        else
        {
          currEle = popEle;
          found.push(currEle);
          track.push(lastTrack);
        }
      }
      // 2 nd Step
      HashMap currChild = (HashMap)get(currEle);
      Set set = currChild.keySet();
      current.addAll(set);
     
      //3 rd Step
      if (current.empty())
      {
        continue;
      }
      else
      {
        if (current.search(target) != -1)
        {
          track.push(currEle);
          track.push(target);         
          break;
        }
        else
        {
          while ( !current.empty())
          {
            found.push(current.pop());
            track.push(currEle);
          }
        }
      }
   
View Full Code Here

        getBeanInstances(m_mainKFPerspective.getCurrentTabIndex()).size() > 0);
  }

  private void addUndoPoint() {
    try {
      Stack undo = m_mainKFPerspective.getUndoBuffer();
      File tempFile = File.createTempFile("knowledgeFlow", FILE_EXTENSION);
      tempFile.deleteOnExit();

      if(saveLayout(tempFile, m_mainKFPerspective.getCurrentTabIndex(), true)) {
        undo.push(tempFile);

        // keep no more than 20 undo points
        if (undo.size() > 20) {
          undo.remove(0);
        }
        m_undoB.setEnabled(true);
      }

    } catch (Exception ex) {
View Full Code Here

    /**
     * Locate all jsp files in the webapp. Used if no explicit
     * jsps are specified.
     */
    public void scanFiles( File base ) throws JasperException {
        Stack dirs = new Stack();
        dirs.push(base);

        // Make sure default extensions are always included
        if ((getExtensions() == null) || (getExtensions().size() < 2)) {
            addExtension("jsp");
            addExtension("jspx");
        }

        while (!dirs.isEmpty()) {
            String s = dirs.pop().toString();
            File f = new File(s);
            if (f.exists() && f.isDirectory()) {
                String[] files = f.list();
                String ext;
                for (int i = 0; (files != null) && i < files.length; i++) {
                    File f2 = new File(s, files[i]);
                    if (f2.isDirectory()) {
                        dirs.push(f2.getPath());
                    } else {
                        String path = f2.getPath();
                        String uri = path.substring(uriRoot.length());
                        ext = files[i].substring(files[i].lastIndexOf('.') +1);
                        if (getExtensions().contains(ext) ||
View Full Code Here

            throw new ExceptionConverter(e);
        }
    }

    protected void removeUnusedNode(PdfObject obj, boolean hits[]) {
        Stack state = new Stack();
        state.push(obj);
        while (!state.empty()) {
            Object current = state.pop();
            if (current == null)
                continue;
            ArrayList ar = null;
            PdfDictionary dic = null;
            PdfName[] keys = null;
            Object[] objs = null;
            int idx = 0;
            if (current instanceof PdfObject) {
                obj = (PdfObject)current;
                switch (obj.type()) {
                    case PdfObject.DICTIONARY:
                    case PdfObject.STREAM:
                        dic = (PdfDictionary)obj;
                        keys = new PdfName[dic.size()];
                        dic.getKeys().toArray(keys);
                        break;
                    case PdfObject.ARRAY:
                         ar = ((PdfArray)obj).getArrayList();
                         break;
                    case PdfObject.INDIRECT:
                        PRIndirectReference ref = (PRIndirectReference)obj;
                        int num = ref.getNumber();
                        if (!hits[num]) {
                            hits[num] = true;
                            state.push(getPdfObjectRelease(ref));
                        }
                        continue;
                    default:
                        continue;
                }
            }
            else {
                objs = (Object[])current;
                if (objs[0] instanceof ArrayList) {
                    ar = (ArrayList)objs[0];
                    idx = ((Integer)objs[1]).intValue();
                }
                else {
                    keys = (PdfName[])objs[0];
                    dic = (PdfDictionary)objs[1];
                    idx = ((Integer)objs[2]).intValue();
                }
            }
            if (ar != null) {
                for (int k = idx; k < ar.size(); ++k) {
                    PdfObject v = (PdfObject)ar.get(k);
                    if (v.isIndirect()) {
                        int num = ((PRIndirectReference)v).getNumber();
                        if (num >= xrefObj.size() || (!partial && xrefObj.get(num) == null)) {
                            ar.set(k, PdfNull.PDFNULL);
                            continue;
                        }
                    }
                    if (objs == null)
                        state.push(new Object[]{ar, new Integer(k + 1)});
                    else {
                        objs[1] = new Integer(k + 1);
                        state.push(objs);
                    }
                    state.push(v);
                    break;
                }
            }
            else {
                for (int k = idx; k < keys.length; ++k) {
                    PdfName key = keys[k];
                    PdfObject v = dic.get(key);
                    if (v.isIndirect()) {
                        int num = ((PRIndirectReference)v).getNumber();
                        if (num >= xrefObj.size() || (!partial && xrefObj.get(num) == null)) {
                            dic.put(key, PdfNull.PDFNULL);
                            continue;
                        }
                    }
                    if (objs == null)
                        state.push(new Object[]{keys, dic, new Integer(k + 1)});
                    else {
                        objs[2] = new Integer(k + 1);
                        state.push(objs);
                    }
                    state.push(v);
                    break;
                }
            }
        }
    }
View Full Code Here

protected JTextField urlField;

HelpURLStack(JEditorPane htmlField, JTextField textField) {
    contentField = htmlField;
    urlField = textField;
    back = new Stack();
    current = null;
    forward = new Stack();
}
View Full Code Here

                com.lowagie.text.List list = (com.lowagie.text.List)element;
                ArrayList items = list.getItems();
                ListItem item = null;
                float listIndentation = list.getIndentationLeft();
                int count = 0;
                Stack stack = new Stack();
                for (int k = 0; k < items.size(); ++k) {
                    Object obj = items.get(k);
                    if (obj instanceof ListItem) {
                        if (count == listIdx) {
                            item = (ListItem)obj;
                            break;
                        }
                        else ++count;
                    }
                    else if (obj instanceof com.lowagie.text.List) {
                        stack.push(new Object[]{list, new Integer(k), new Float(listIndentation)});
                        list = (com.lowagie.text.List)obj;
                        items = list.getItems();
                        listIndentation += list.getIndentationLeft();
                        k = -1;
                        continue;
                    }
                    if (k == items.size() - 1) {
                        if (!stack.isEmpty()) {
                            Object objs[] = (Object[])stack.pop();
                            list = (com.lowagie.text.List)objs[0];
                            items = list.getItems();
                            k = ((Integer)objs[1]).intValue();
                            listIndentation = ((Float)objs[2]).floatValue();
                        }
View Full Code Here

   */
    private SimpleXMLParser(SimpleXMLDocHandler doc, SimpleXMLDocHandlerComment comment, boolean html) {
      this.doc = doc;
      this.comment = comment;
      this.html = html;
      stack = new Stack();
      state = html ? TEXT : UNKNOWN;
    }
View Full Code Here

        private static ThreadLocal local = new ThreadLocal();
       

        public static boolean empty ()
        {
            Stack s = (Stack)local.get();

            if (s == null)
                return false;

            return s.empty();
        }
View Full Code Here

TOP

Related Classes of java.util.Stack

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.