001/*
002 * ============================================================================
003 * Copyright © 2002-2023 by Thomas Thrien.
004 * All Rights Reserved.
005 * ============================================================================
006 * Licensed to the public under the agreements of the GNU Lesser General Public
007 * License, version 3.0 (the "License"). You may obtain a copy of the License at
008 *
009 *      http://www.gnu.org/licenses/lgpl.html
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
014 * License for the specific language governing permissions and limitations
015 * under the License.
016 */
017
018package org.tquadrat.foundation.svg.internal;
019
020import static org.apiguardian.api.API.Status.INTERNAL;
021import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Class;
022import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Id;
023import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_PathLength;
024import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Style;
025import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_x1;
026import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_x2;
027import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_y1;
028import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_y2;
029import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Line;
030import static org.tquadrat.foundation.svg.type.SVGElementCategory.ANIMATION;
031import static org.tquadrat.foundation.svg.type.SVGElementCategory.DESCRIPTIVE;
032import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.ALLOWS_CHILDREN;
033import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_ATTRIBUTES;
034import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_CHILDREN;
035
036import java.util.ArrayList;
037import java.util.Collection;
038import java.util.HashSet;
039import java.util.List;
040
041import org.apiguardian.api.API;
042import org.tquadrat.foundation.annotation.ClassVersion;
043import org.tquadrat.foundation.svg.AllowsConditionalProcessingAttributes;
044import org.tquadrat.foundation.svg.AllowsGlobalEventAttributes;
045import org.tquadrat.foundation.svg.AllowsGraphicalEventAttributes;
046import org.tquadrat.foundation.svg.AllowsPresentationAttributes;
047import org.tquadrat.foundation.svg.AllowsStyleAttributes;
048import org.tquadrat.foundation.svg.SVGLine;
049import org.tquadrat.foundation.svg.type.SVGNumber;
050
051/**
052 *  The implementation of the
053 *  {@link SVGLine}
054 *  interface for the SVG {@code <line>} element.
055 *
056 *  @extauthor Thomas Thrien - thomas.thrien@tquadrat.org
057 *  @version $Id: SVGLineImpl.java 1074 2023-10-02 12:05:06Z tquadrat $
058 *  @since 0.0.5
059 *
060 *  @UMLGraph.link
061 */
062@ClassVersion( sourceVersion = "$Id: SVGLineImpl.java 1074 2023-10-02 12:05:06Z tquadrat $" )
063@API( status = INTERNAL, since = "0.0.5" )
064public final class SVGLineImpl extends SVGElementImpl implements SVGLine
065{
066        /*--------------*\
067    ====** Constructors **=====================================================
068        \*--------------*/
069    /**
070     *  Creates a new {@code SVGLineImpl} instance.
071     */
072    public SVGLineImpl()
073    {
074        super( SVGELEMENT_Line, ALLOWS_CHILDREN, VALIDATES_ATTRIBUTES, VALIDATES_CHILDREN );
075
076        //---* The children and attributes for the <line> element *------------
077        final Collection<String> childElements = new HashSet<>();
078        childElements.addAll( ANIMATION.getElements() );
079        childElements.addAll( DESCRIPTIVE.getElements() );
080
081        final Collection<String> attributes = new ArrayList<>();
082        attributes.addAll( List.of( SVGATTRIBUTE_Id,
083            SVGATTRIBUTE_x1, SVGATTRIBUTE_y1, SVGATTRIBUTE_x2, SVGATTRIBUTE_y2,
084            SVGATTRIBUTE_PathLength, SVGATTRIBUTE_Class, SVGATTRIBUTE_Style ) );
085        attributes.addAll( CORE_ATTRIBUTES );
086        attributes.addAll( AllowsStyleAttributes.STYLE_ATTRIBUTES );
087        attributes.addAll( AllowsConditionalProcessingAttributes.CONDITIONALPROCESSING_ATTRIBUTES );
088        attributes.addAll( AllowsGlobalEventAttributes.GLOBALEVENT_ATTRIBUTES );
089        attributes.addAll( AllowsGraphicalEventAttributes.GRAPHICALEVENT_ATTRIBUTES );
090        attributes.addAll( AllowsPresentationAttributes.PRESENTATION_ATTRIBUTES );
091
092        updateRegistries( childElements, attributes );
093    }   //  SVGLineImpl()
094
095        /*---------*\
096    ====** Methods **==========================================================
097        \*---------*/
098    /**
099     *  {@inheritDoc}
100     */
101    @Override
102    public final void setX1( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value )
103    {
104        setAttribute( SVGATTRIBUTE_x1, value );
105    }   //  setX1()
106
107    /**
108     *  {@inheritDoc}
109     */
110    @Override
111    public void setX2( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value )
112    {
113        setAttribute( SVGATTRIBUTE_x2, value );
114    }   //  setX2()
115
116    /**
117     *  {@inheritDoc}
118     */
119    @Override
120    public void setY1( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value )
121    {
122        setAttribute( SVGATTRIBUTE_y1, value );
123    }   //  setY1()
124
125    /**
126     *  {@inheritDoc}
127     */
128    @Override
129    public void setY2( @SuppressWarnings( "UseOfConcreteClass" ) final SVGNumber value )
130    {
131        setAttribute( SVGATTRIBUTE_y2, value );
132    }   //  setY2()
133}
134//  class SVGLineImpl
135
136/*
137 *  End of File
138 */