Package java.util

Examples of java.util.SortedMap


            hbox = Box.createHorizontalBox();
            hbox.add(new JLabel(resources.getStringValue("asciiOptionCharset")));
            hbox.add(Box.createHorizontalGlue());
            hbox.add(cbxCharset = new JComboBox());
            cbxCharset.addItem(resources.getStringValue("asciiOptionNoCharset"));
            SortedMap map = Charset.availableCharsets();
            for (Iterator it = map.keySet().iterator(); it.hasNext();) {
                cbxCharset.addItem(it.next());
            }
            // TODO: Use preferences to set a default charset if desired by user
            cbxCharset.setSelectedIndex(0); // None by default
            box.add(hbox);
View Full Code Here


    String sPaddedID;
    Node oBlksNode = null;
    NodeList oNodeList = null;
    int iNodeListLen = 0;
    Vector<Block> oLinkVctr = null;
    SortedMap oSortedMap = new TreeMap();

    if (DebugFile.trace) {
      if (null==oNode.getFirstChild())
        DebugFile.writeln("Node.getFirstChild() returned null");
    }

    for (oBlksNode=oNode.getFirstChild(); oBlksNode!=null; oBlksNode=oBlksNode.getNextSibling())
      if (Node.ELEMENT_NODE==oBlksNode.getNodeType())
        if (oBlksNode.getNodeName().equals("blocks")) break;

    if (DebugFile.trace)
      if (null==oBlksNode)
        DebugFile.writeln("ERROR: blocks node not found");

    if (null==oBlksNode)
      throw new DOMException(DOMException.NOT_FOUND_ERR, "<blocks> node not found");

    oNodeList = ((Element) oBlksNode).getElementsByTagName("block");
    iNodeListLen = oNodeList.getLength();

    if (DebugFile.trace)
      DebugFile.writeln(String.valueOf(iNodeListLen) + " blocks found.");

    oLinkVctr = new Vector<Block>(iNodeListLen);

    for (int i=0; i<iNodeListLen; i++) {

      if (DebugFile.trace) {
        if (null==oNodeList.item(i).getAttributes().getNamedItem("id"))
          DebugFile.writeln("ERROR: Block " + String.valueOf(i) + " does not have the required id attribute.");
        else
          if (null==oNodeList.item(i).getAttributes().getNamedItem("id").getNodeValue())
            DebugFile.writeln("ERROR: Block " + String.valueOf(i) + " id attribute is null.");
          else if (oNodeList.item(i).getAttributes().getNamedItem("id").getNodeValue().length()==0)
            DebugFile.writeln("ERROR: Block " + String.valueOf(i) + " id attribute is empty.");
      }

      sPaddedID = "-" + Gadgets.leftPad(oNodeList.item(i).getAttributes().getNamedItem("id").getNodeValue(), '0', 3);

      if (DebugFile.trace)
        DebugFile.writeln("padded id = " + sPaddedID);

      if (DebugFile.trace) {
        if (((Element)oNodeList.item(i)).getElementsByTagName("metablock").getLength()==0)
          DebugFile.writeln("ERROR: No MetaBlocks found");
        else
          if (null==((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild())
            DebugFile.writeln("ERROR: MetaBlock for Block " + String.valueOf(i) + " does not have the requiered id attribute");
          else
            if (((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue().length()==0)
              DebugFile.writeln("ERROR: MetaBlock for Block " + String.valueOf(i) + " id attribute is empty.");
            else
              DebugFile.writeln("SortedMap.put(" + ((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue() + sPaddedID + ", " + oNodeList.item(i).toString()+")");
      }

      oSortedMap.put(((Element)oNodeList.item(i)).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue() + sPaddedID, oNodeList.item(i));
    } // next (i)

    Iterator oIterator = oSortedMap.keySet().iterator();
    while (oIterator.hasNext()) {
      Node oAux = (Node) oSortedMap.get(oIterator.next());
      oLinkVctr.add(new Block(oAux));
      if (DebugFile.trace)
        DebugFile.writeln("Inserted " + ((Element)oAux).getElementsByTagName("metablock").item(0).getFirstChild().getNodeValue() + (new Integer(oAux.getAttributes().getNamedItem("id").getNodeValue())).intValue());
    } // wend
View Full Code Here

    }

    public TaskDependency[] getDependencies(Task task) {
        SearchKey fromKey = new RangeSearchFromKey(task);
        SearchKey toKey = new RangeSearchToKey(task);
        SortedMap submap = mySearchKey2dependency.subMap(fromKey, toKey);
        return (TaskDependency[]) submap.values()
                .toArray(new TaskDependency[0]);
    }
View Full Code Here

    public TaskDependency[] getDependenciesAsDependant(Task dependant) {
        SearchKey fromKey = new SearchKey(SearchKey.DEPENDANT, dependant
                .getTaskID(), -1);
        SearchKey toKey = new SearchKey(SearchKey.DEPENDEE, dependant
                .getTaskID(), -1);
        SortedMap submap = mySearchKey2dependency.subMap(fromKey, toKey);
        return (TaskDependency[]) submap.values()
                .toArray(new TaskDependency[0]);
    }
View Full Code Here

    public TaskDependency[] getDependenciesAsDependee(Task dependee) {
        SearchKey fromKey = new SearchKey(SearchKey.DEPENDEE, dependee
                .getTaskID(), -1);
        SearchKey toKey = new SearchKey(Integer.MAX_VALUE,
                dependee.getTaskID(), -1);
        SortedMap submap = mySearchKey2dependency.subMap(fromKey, toKey);
        return (TaskDependency[]) submap.values()
                .toArray(new TaskDependency[0]);
    }
View Full Code Here

            buffer.append(" ");
        }
        buffer.append("<category name=\"");
        buffer.append(escapeForXML(category.getCategoryName()));
        buffer.append("\">\n");       
        SortedMap sm = getSortedProperties(categoryPath,false);
        if (sm != null) {
            Iterator nit = sm.keySet().iterator();
            while (nit.hasNext()) {
                String name = (String) nit.next();
                String value = (String)sm.get(name);
                for ( int i = 0; i < indent+2;i++) {
                    buffer.append(" ");
                }
                buffer.append("<");
                buffer.append(escapeForXML(name));
View Full Code Here

                buffer.append(" extends=\"");
                buffer.append(escapeForXML(ec.getExtendsCategory()));
                buffer.append("\"");
            }
            buffer.append(">\n");
            SortedMap sm = getSortedProperties(ec.getCategoryName(),false);
            if (sm != null) {
                Iterator nit = sm.keySet().iterator();
                while (nit.hasNext()) {
                    String name = (String) nit.next();
                    String value = (String)sm.get(name);                
                    buffer.append("    <");
                    buffer.append(escapeForXML(name));
                    buffer.append(">");
                    // do not convert the value
                    buffer.append(escapeForXML(value));
View Full Code Here

        String[] cats = getCategoryNames(false);
        for (int i = 0; i < cats.length; i++) {
            buffer.append("  <category name=\"");
            buffer.append(escapeForXML(cats[i]));
            buffer.append("\">\n");           
            SortedMap sm = getSortedProperties(cats[i],false);
            if (sm != null) {
                Iterator nit = sm.keySet().iterator();
                while (nit.hasNext()) {
                    String name = (String) nit.next();
                    String value = (String)sm.get(name);
                    buffer.append("    <property name=\"");
                    buffer.append(escapeForXML(name));
                    buffer.append("\" value=\"");
                    // do not convert the value
                    buffer.append(escapeForXML(value));
View Full Code Here

        return buffer.toString();
    }
   
    protected SortedMap getSortedProperties(String categoryName,boolean includeParent) {
        Properties props = getProperties(categoryName,includeParent);
        SortedMap sm = new TreeMap();
        if (props != null) {
            Iterator nit = props.keySet().iterator();
            while (nit.hasNext()) {
                String name = (String) nit.next();
                String value = props.getProperty(name);
                sm.put(name,value);
            }
            return sm;
        }
        return null;
    }
View Full Code Here

        }
    String[] cats = configuration.getCategoryNames();
        for (int i = 0; i < cats.length; i++) {
            buffer.append(cats[i]);
            buffer.append(": \n");           
            SortedMap sm = getSortedProperties(cats[i],configuration);
            if (sm != null) {
                Iterator nit = sm.keySet().iterator();
                while (nit.hasNext()) {
                    String name = (String) nit.next();
                    String value = (String)sm.get(name);
                    buffer.append("\t");
                    buffer.append(name);
                    buffer.append(" : ");
                    buffer.append(value);
                    buffer.append("\n");
View Full Code Here

TOP

Related Classes of java.util.SortedMap

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.