Class JaxoParticleObject

  • All Implemented Interfaces:
    java.awt.Shape, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
    Direct Known Subclasses:
    Jaxo3PointObject, JaxoLineObject, JaxoLoopObject

    public abstract class JaxoParticleObject
    extends JaxoExtendedObject
    The mother of all particle objects (arcs, lines and loops).
    Since:
    2.0
    See Also:
    Serialized Form
    • Field Detail

      • PHOTON_FREQ

        public static final float PHOTON_FREQ
        Default frequency for photon objects.
        See Also:
        Constant Field Values
      • GLUON_FREQ

        public static final float GLUON_FREQ
        Default frequency for gluon objects.
        See Also:
        Constant Field Values
      • SCALAR_DASH

        public static final float SCALAR_DASH
        Default dash for scalar objects.
        See Also:
        Constant Field Values
      • GHOST_DASH

        public static final float GHOST_DASH
        Default dash for ghost objects.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JaxoParticleObject

        public JaxoParticleObject()
        Constructor. Adds a default arrow as a PropertyChangeListener.
    • Method Detail

      • copy

        public JaxoObject copy()
        Returns an exact copy of the given JaxoObject. This implementation uses Object.clone(), so the only thing to do in subclasses is to recursively clone mutable object properties.
        Overrides:
        copy in class JaxoObject
        Returns:
        The copy of the given JaxoObject.
      • getWiggles

        public final int getWiggles()
        Returns the wiggles property of this particle object.
        Returns:
        The wiggles property of this particle object.
      • setWiggles

        public final void setWiggles​(int newWiggles)
        Sets the wiggles property of this particle object.
        Parameters:
        newWiggles - The wiggles property of this particle object.
      • getDash

        public final float getDash()
        Returns the dash property of this particle object.
        Returns:
        The dash property of this particle object.
      • setDash

        public final void setDash​(float newDash)
        Sets the dash property of this particle object.
        Parameters:
        newDash - The dash property of this particle object.
      • getAmp

        public final int getAmp()
        Returns the amp property of this particle object.
        Returns:
        The amp property of this particle object.
      • setAmp

        public final void setAmp​(int newAmp)
        Sets the amp property of this particle object.
        Parameters:
        newAmp - The amp property of this particle object.
      • isPaintArrow

        public final boolean isPaintArrow()
        Determines whether the arrow property of this particle object is set or not.
        Returns:
        The arrow property of this particle object.
      • setPaintArrow

        public final void setPaintArrow​(boolean arr)
        Sets the arrow property of this particle object.
        Parameters:
        arr - The arrow property of this particle object.
      • isFlip

        public final boolean isFlip()
        Returns the flip property of this particle object.
        Returns:
        The flip property of this particle object.
      • setFlip

        public final void setFlip​(boolean newFlip)
        Sets the flip property of this particle object.
        Parameters:
        newFlip - The flip property of this particle object.
      • getArrowPosition

        public final float getArrowPosition()
        Returns the arrowPosition property of this particle object.
        Returns:
        The arrowPosition property of this particle object.
      • setArrowPosition

        public final void setArrowPosition​(float newArrowPosition)
        Sets the arrowPosition property of this particle object. Throws IllegalArgumentException if the parameter is not between 0 and 1.
        Parameters:
        newArrowPosition - The new arrowPosition property measured as a float number between 0 and 1.
      • setDoubleLine

        public final void setDoubleLine​(boolean dline)
        Sets the double line property.
        Parameters:
        dline - The double line boolean variable.
      • isDoubleLine

        public final boolean isDoubleLine()
        Returns the double line property.
        Returns:
        The double line boolean variable of this object.
      • setDLSeparation

        public final void setDLSeparation​(float dlsep)
        Sets the double line separation property.
        Parameters:
        dlsep - The double line separation to be set.
      • getDLSeparation

        public final float getDLSeparation()
        Returns the double line separation of this object.
        Returns:
        The double line separation.
      • getArrow

        public final JaxoArrow getArrow()
        Returns the arrow of this particle object.
        Returns:
        The arrow of this particle object.
      • setArrow

        public final void setArrow​(JaxoArrow newArrow)
        Sets the dash property of this particle object.
        Parameters:
        newArrow - The arrow of this particle object.
      • isCopy

        public boolean isCopy​(JaxoObject comp)
        Determines if this JaxoObject is a copy of the specified one.
        Overrides:
        isCopy in class JaxoExtendedObject
        Parameters:
        comp - The JaxoObject to compare against.
        Returns:
        True if the JaxoObjects are identical.
      • copyFrom

        public void copyFrom​(JaxoParticleObject temp)
        Sets all parameters from the given object to the current one.
        Parameters:
        temp - The object to copy from.
      • setPreferences

        public void setPreferences()
        Applies default values to this JaxoObject. All fields except location points are initialized with values taken from the preferences.
        Overrides:
        setPreferences in class JaxoExtendedObject
      • dashIs

        public final boolean dashIs​(float comp)
        Compares the dash of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.
        Parameters:
        comp - The float to compare to.
        Returns:
        True, if the dash matches within 0.1%.
      • dlSepIs

        public final boolean dlSepIs​(float comp)
        Compares the dlSeparation of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.
        Parameters:
        comp - The float to compare to.
        Returns:
        True, if the dlSeparation matches within 0.1%.
      • arrowPositionIs

        public final boolean arrowPositionIs​(float comp)
        Compares the arrowPosition of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.
        Parameters:
        comp - The float to compare to.
        Returns:
        True, if the arrowPosition matches within 0.1%.
      • paintArrow

        protected void paintArrow​(JaxoGraphics2D g2)
        Paints an arrow on this object.
        Parameters:
        g2 - The graphics context.
      • arrowCoordinates

        public abstract JaxoArrow.Coordinates arrowCoordinates()
        Returns the coordinates of the arrow of the current object.
        Returns:
        The coordinates of the arrow of the current object.