Package java.util

Examples of java.util.SortedSet


    }

    private BeanProperty[] getPkProperties(JavaClass javaClass) {
        JavaMethod[] methods = javaClass.getMethods();
        JavaMethod method;
        SortedSet propSet = new TreeSet(new Comparator() {
                    public int compare(Object o1, Object o2) {
                        BeanProperty p1 = (BeanProperty) o1;
                        BeanProperty p2 = (BeanProperty) o2;
                        return p1.getName().compareTo(p2.getName());
                    }
                });

        for (int i = 0; i < methods.length; i++) {
            method = methods[i];
            int metaFlags = ejbUtils.getMethodMetadata(javaClass, method);

            if (EjbUtils.hasFlag(metaFlags, EjbUtils.METADATA_METHOD_PRIMARY_KEY_FIELD)) {
                BeanProperty beanProperty = javaClass.getBeanProperty(method.getPropertyName());

                if (beanProperty != null) {
                    if (propSet.add(beanProperty)) {
                        if (log.isDebugEnabled()) {
                            log.debug(beanProperty.getName() + " was added to the Set");
                        }
                    } else {
                        if (log.isDebugEnabled()) {
                            log.debug(beanProperty.getName() +
                                " wasn't added to the Set. There must be already a property with the same name");
                        }
                    }
                } else {
                    String errorMessage = "Unexpected null property for " + method.getPropertyName() + " in " +
                        javaClass.getFullyQualifiedName();
                    log.error(errorMessage);
                    throw new Error(errorMessage);
                }
            }
        }

        return (BeanProperty[]) propSet.toArray(new BeanProperty[0]);
    }
View Full Code Here


        }

        Element rootNode = requestDoc.createElement(mSource.getName());
        requestDoc.appendChild(rootNode);

        SortedSet paramSet = new TreeSet(parameters.keySet());
        String key = null;
        Node tmpNode = null;
        String[] values = null;
        for (Iterator it = paramSet.iterator(); it.hasNext();)
        {
          key = (String) it.next();
          values = (String[]) parameters.get(key);
          if ((XBUSSystem.FILENAME_WILDCARD.equals(key))
              || (XBUSSystem.FILENAME_WILDCARD_XML.equals(key)))
View Full Code Here

      long ret = 0L;
      if (limitEntry == null)
         return ret;
     
      synchronized (this) {
         SortedSet set = this.storage.headSet(limitEntry);
         ret = set.size();
         this.storage.removeAll(set);
         if (inclusive) {
            if (this.storage.remove(limitEntry)) ret++;
         }
      }
View Full Code Here

  Iterator handleAttributesSubtree(Element E,NameSpaceSymbTable ns)
      throws CanonicalizationException {
    // System.out.println("During the traversal, I encountered " +
    // XMLUtils.getXPath(E));
    // result will contain the attrs which have to be outputted
    SortedSet result = this.result;      
      result.clear();
    NamedNodeMap attrs=null;
       
    int attrsLength = 0;
        if (E.hasAttributes()) {
            attrs = E.getAttributes();
          attrsLength = attrs.getLength();
        }
    //The prefix visibly utilized(in the attribute or in the name) in the element
    SortedSet visiblyUtilized =(SortedSet) _inclusiveNSSet.clone();
         
    for (int i = 0; i < attrsLength; i++) {
      Attr N = (Attr) attrs.item(i);
      String NName=N.getLocalName();
      String NNodeValue=N.getNodeValue();
           
      if (!XMLNS_URI.equals(N.getNamespaceURI())) {
        //Not a namespace definition.
        //The Element is output element, add his prefix(if used) to visibyUtilized
        String prefix = N.getPrefix();
        if ( (prefix != null) && (!prefix.equals(XML) && !prefix.equals(XMLNS)) ) {
            visiblyUtilized.add(prefix);
        }         
        //Add to the result.
         result.add(N);       
        continue;
      }
 
      if (ns.addMapping(NName, NNodeValue,N)) {
        //New definition check if it is relative.
                if (C14nHelper.namespaceIsRelative(NNodeValue)) {
                    Object exArgs[] = {E.getTagName(), NName,
                            N.getNodeValue()};
                    throw new CanonicalizationException(
                            "c14n.Canonicalizer.RelativeNamespace", exArgs);
                }
            }
    }   
             
    if (E.getNamespaceURI() != null) {
      String prefix = E.getPrefix();
      if ((prefix == null) || (prefix.length() == 0)) {
        visiblyUtilized.add(XMLNS);
      } else {
        visiblyUtilized.add(prefix);
      }
    } else {
      visiblyUtilized.add(XMLNS);
    }
                 
    //This can be optimezed by I don't have time
    Iterator it=visiblyUtilized.iterator();
    while (it.hasNext()) {
      String s=(String)it.next();                 
      Attr key=ns.getMapping(s);
      if (key==null) {
        continue;
View Full Code Here

   * @throws CanonicalizationException
   */
  final Iterator handleAttributes(Element E, NameSpaceSymbTable ns)
      throws CanonicalizationException {
    // result will contain the attrs which have to be outputted
    SortedSet result = this.result;      
      result.clear();
    NamedNodeMap attrs = null;
    int attrsLength = 0;
        if (E.hasAttributes()) {
            attrs = E.getAttributes();          
          attrsLength = attrs.getLength();
        }
    //The prefix visibly utilized(in the attribute or in the name) in the element
    Set visiblyUtilized =null;
    //It's the output selected.
    boolean isOutputElement = isVisible(E);     
    if (isOutputElement) {
      visiblyUtilized =  (Set) this._inclusiveNSSet.clone();
    }
   
    for (int i = 0; i < attrsLength; i++) {
      Attr N = (Attr) attrs.item(i);
      String NName=N.getLocalName();
      String NNodeValue=N.getNodeValue();
      if ( !isVisible(N) )  {
        //The node is not in the nodeset(if there is a nodeset)
        continue;
      }     
           
      if (!XMLNS_URI.equals(N.getNamespaceURI())) {
        //Not a namespace definition.
        if (isOutputElement) {
          //The Element is output element, add his prefix(if used) to visibyUtilized
          String prefix = N.getPrefix();
          if ((prefix != null) && (!prefix.equals(XML) && !prefix.equals(XMLNS)) ){
              visiblyUtilized.add(prefix);
          }         
          //Add to the result.
            result.add(N);
        }
        continue;
      }
           
     
      if (ns.addMapping(NName, NNodeValue,N)) {
                //New definiton check if it is relative
                if (C14nHelper.namespaceIsRelative(NNodeValue)) {
                    Object exArgs[] = {E.getTagName(), NName,
                            N.getNodeValue()};
                    throw new CanonicalizationException(
                            "c14n.Canonicalizer.RelativeNamespace", exArgs);
                }   
            }
    }

    if (isOutputElement) {                
           //The element is visible, handle the xmlns definition   
           Attr xmlns = E.getAttributeNodeNS(XMLNS_URI, XMLNS);
           if ((xmlns!=null) &&  (!isVisible(xmlns))) {
              //There is a definition but the xmlns is not selected by the xpath.
              //then xmlns=""
              ns.addMapping(XMLNS,"",nullNode);                              
            }

      if (E.getNamespaceURI() != null) {
        String prefix = E.getPrefix();
        if ((prefix == null) || (prefix.length() == 0)) {
          visiblyUtilized.add(XMLNS);
        } else {
          visiblyUtilized.add( prefix);
        }
      } else {
        visiblyUtilized.add(XMLNS);
      }                 
      //This can be optimezed by I don't have time
      //visiblyUtilized.addAll(this._inclusiveNSSet);
      Iterator it=visiblyUtilized.iterator();
      while (it.hasNext()) {
        String s=(String)it.next();                   
        Attr key=ns.getMapping(s);
        if (key==null) {
          continue;
        }
        result.add(key);
      }
    } else /*if (_circunvented)*/ {     
      Iterator it=this._inclusiveNSSet.iterator();
      while (it.hasNext()) {
        String s=(String)it.next();       
        Attr key=ns.getMappingWithoutRendered(s);
        if (key==null) {
          continue;
        }
        result.add(key);               
      }
    }

    return result.iterator();
  }
View Full Code Here

           throws CanonicalizationException {
       if (!E.hasAttributes() && !firstCall) {
         return null;
      }
      // result will contain the attrs which have to be outputted      
      final SortedSet result = this.result;      
      result.clear();
      NamedNodeMap attrs = E.getAttributes();
      int attrsLength = attrs.getLength();     
           
      for (int i = 0; i < attrsLength; i++) {
         Attr N = (Attr) attrs.item(i);
         String NName=N.getLocalName();
         String NValue=N.getValue();
         String NUri =N.getNamespaceURI();

         if (!XMLNS_URI.equals(NUri)) {
           //It's not a namespace attr node. Add to the result and continue.
            result.add(N);
            continue;
         }
        
         if (XML.equals(NName)
                 && XML_LANG_URI.equals(NValue)) {
           //The default mapping for xml must not be output.
           continue;
         }
        
         Node n=ns.addMappingAndRender(NName,NValue,N);              
       
          if (n!=null) {
             //Render the ns definition
             result.add(n);
             if (C14nHelper.namespaceIsRelative(N)) {
                Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() };
                throw new CanonicalizationException(
                   "c14n.Canonicalizer.RelativeNamespace", exArgs);
             }
          }       
      }
                
      if (firstCall) {
        //It is the first node of the subtree
        //Obtain all the namespaces defined in the parents, and added to the output.
        ns.getUnrenderedNodes(result);                                 
        //output the attributes in the xml namespace.
    addXmlAttributesSubtree(E, result);
        firstCall=false;
      }
     
      return result.iterator();
   }
View Full Code Here

        attrs=E.getAttributes();
       attrsLength= attrs.getLength();
    }
   
   
    SortedSet result = this.result;      
    result.clear();
   
           
    for (int i = 0; i < attrsLength; i++) {
       Attr N = (Attr) attrs.item(i);
       String NName=N.getLocalName();
       String NValue=N.getValue();
       String NUri =N.getNamespaceURI();
      
       if (!XMLNS_URI.equals(NUri)) {
           //A non namespace definition node.
           if (isRealVisible){
           //The node is visible add the attribute to the list of output attributes.
             result.add(N);
          }
           //keep working
          continue;
       }

             
       if ("xml".equals(NName)
               && XML_LANG_URI.equals(NValue)) {
          /* except omit namespace node with local name xml, which defines
           * the xml prefix, if its string value is http://www.w3.org/XML/1998/namespace.
           */
          continue;
       }
       //add the prefix binding to the ns symb table.
       //ns.addInclusiveMapping(NName,NValue,N,isRealVisible);         
      if  (isVisible(N))  {
          //The xpath select this node output it if needed.
          Node n=ns.addMappingAndRenderXNodeSet(NName,NValue,N,isRealVisible);          
          if (n!=null) {
            result.add(n);
                    if (C14nHelper.namespaceIsRelative(N)) {
                       Object exArgs[] = { E.getTagName(), NName, N.getNodeValue() };
                       throw new CanonicalizationException(
                          "c14n.Canonicalizer.RelativeNamespace", exArgs);
                    }
          }
      }
    }
    if (isRealVisible) {                
      //The element is visible, handle the xmlns definition       
        Attr xmlns = E.getAttributeNodeNS(XMLNS_URI, XMLNS);
        Node n=null;
        if (xmlns == null) {
          //No xmlns def just get the already defined.
          n=ns.getMapping(XMLNS);           
        } else if ( !isVisible(xmlns)) {
          //There is a definition but the xmlns is not selected by the xpath.
          //then xmlns=""
          n=ns.addMappingAndRenderXNodeSet(XMLNS,"",nullNode,true);                         
        }
        //output the xmlns def if needed.
        if (n!=null) {
          result.add(n);
      }
        //Float all xml:* attributes of the unselected parent elements to this one.
      addXmlAttributes(E,result);
    }
   
    return result.iterator();
   }
View Full Code Here

   public InclusiveNamespaces(Document doc, Set prefixes) {

      super(doc);

      StringBuffer sb = new StringBuffer();
      SortedSet prefixList = new TreeSet(prefixes);


      Iterator it = prefixList.iterator();

      while (it.hasNext()) {
         String prefix = (String) it.next();

         if (prefix.equals("xmlns")) {
View Full Code Here

    * @param inclusiveNamespaces
    * @return A set to string
    */
   public static SortedSet prefixStr2Set(String inclusiveNamespaces) {

      SortedSet prefixes = new TreeSet();

      if ((inclusiveNamespaces == null)
              || (inclusiveNamespaces.length() == 0)) {
         return prefixes;
      }

      StringTokenizer st = new StringTokenizer(inclusiveNamespaces, " \t\r\n");

      while (st.hasMoreTokens()) {
         String prefix = st.nextToken();

         if (prefix.equals("#default")) {
            prefixes.add("xmlns" );
         } else {
            prefixes.add( prefix);
         }
      }

      return prefixes;
   }
View Full Code Here

   * @param renderer the renderer of the chart being created
   * @param jrPlot the Jasper view of that plot
   */
  private void configureAxisSeriesColors(CategoryItemRenderer renderer, JRChartPlot jrPlot)
  {
    SortedSet seriesColors = jrPlot.getSeriesColors();

    if (seriesColors != null)
    {
      Iterator iter = seriesColors.iterator();
      while (iter.hasNext())
      {
        JRSeriesColor seriesColor = (JRSeriesColor)iter.next();
        renderer.setSeriesPaint(seriesColor.getSeriesOrder(), seriesColor.getColor());
      }
View Full Code Here

TOP

Related Classes of java.util.SortedSet

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.