:  » Graphic-Library » GLIPS-Graffiti-editor-1.5 » org » apache » batik » svggen » Java Open Source

Java Open Source » Graphic Library » GLIPS Graffiti editor 1.5 
GLIPS Graffiti editor 1.5 » org » apache » batik » svggen »

   Copyright 2001,2003  The Apache Software Foundation 

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   See the License for the specific language governing permissions and
   limitations under the License.

package org.apache.batik.svggen;

import java.util.HashSet;
import java.util.Set;

 * Represents an SVG attribute and provides convenience
 * methods to determine whether or not the attribute applies
 * to a given element type.
 * @author <a href="">Vincent Hardy</a>
 * @version $Id:,v 1.1 2005/11/21 09:51:19 dev Exp $
public class SVGAttribute {
     * SVG syntax for the attribute
    private String name;

     * Set of Element tags to which the attribute does or
     * does not apply.
    private Set applicabilitySet;

     * Controls the semantic of applicabilitySet. If
     * true, then the applicabilitySet contains the elments
     * to which the attribute applies. If false, the
     * Set contains the elements to which the attribute
     * does not apply.
    private boolean isSetInclusive;

     * @param applicabilitySet Set of Element tags (Strings) to which
     *        the attribute applies
     * @param isSetInclusive defines whether elements in applicabilitySet
     *        define the list of elements to which the attribute
     *        applies or to which it does not apply
    public SVGAttribute(Set applicabilitySet, boolean isSetInclusive){
        if(applicabilitySet == null)
            applicabilitySet = new HashSet();

        this.applicabilitySet = applicabilitySet;
        this.isSetInclusive = isSetInclusive;

     * @param tag the tag of the Element to which the attribute
     *        could apply.
     * @return true if the attribute applies to the given Element
    public boolean appliesTo(String tag){
        boolean tagInMap = applicabilitySet.contains(tag);
            return tagInMap;
            return !tagInMap;
}  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.