Package net.sf.jaxodraw.object
Class JaxoParticleObject
java.lang.Object
net.sf.jaxodraw.object.JaxoObject
net.sf.jaxodraw.object.JaxoExtendedObject
net.sf.jaxodraw.object.JaxoParticleObject
- All Implemented Interfaces:
Shape
,PropertyChangeListener
,Serializable
,Cloneable
,EventListener
- Direct Known Subclasses:
Jaxo3PointObject
,JaxoLineObject
,JaxoLoopObject
The mother of all particle objects (arcs, lines and loops).
- Since:
- 2.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
Default dash for ghost objects.static final float
Default frequency for gluon objects.static final float
Default frequency for photon objects.static final float
Default dash for scalar objects.Fields inherited from class net.sf.jaxodraw.object.JaxoExtendedObject
SELECT_DX, SELECT_DY, SELECT_P2
Fields inherited from class net.sf.jaxodraw.object.JaxoObject
D_FORMAT, GRAY_SCALE_FORMAT, SELECT_NONE, SELECT_P1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract JaxoArrow.Coordinates
Returns the coordinates of the arrow of the current object.final boolean
arrowPositionIs
(float comp) Compares the arrowPosition of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.copy()
Returns an exact copy of the given JaxoObject.void
copyFrom
(JaxoParticleObject temp) Sets all parameters from the given object to the current one.final boolean
dashIs
(float comp) Compares the dash of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.final boolean
dlSepIs
(float comp) Compares the dlSeparation of this JaxoParticleObject to the given float, taking into account a 0.1% error margin.final int
getAmp()
Returns the amp property of this particle object.final JaxoArrow
getArrow()
Returns the arrow of this particle object.final float
Returns the arrowPosition property of this particle object.final float
getDash()
Returns the dash property of this particle object.final float
Returns the double line separation of this object.final int
Returns the wiggles property of this particle object.boolean
isCopy
(JaxoObject comp) Determines if this JaxoObject is a copy of the specified one.final boolean
Returns the double line property.final boolean
isFlip()
Returns the flip property of this particle object.final boolean
Determines whether the arrow property of this particle object is set or not.protected void
Paints an arrow on this object.final void
setAmp
(int newAmp) Sets the amp property of this particle object.final void
Sets the dash property of this particle object.final void
setArrowPosition
(float newArrowPosition) Sets the arrowPosition property of this particle object.final void
setDash
(float newDash) Sets the dash property of this particle object.final void
setDLSeparation
(float dlsep) Sets the double line separation property.final void
setDoubleLine
(boolean dline) Sets the double line property.final void
setFlip
(boolean newFlip) Sets the flip property of this particle object.final void
setPaintArrow
(boolean arr) Sets the arrow property of this particle object.void
Applies default values to this JaxoObject.void
Restore state to the values of 'o'.final void
setWiggles
(int newWiggles) Sets the wiggles property of this particle object.Methods inherited from class net.sf.jaxodraw.object.JaxoExtendedObject
canBeSelected, copyFrom, getGrabbedHandle, getHeight, getPointCount, getRadius, getRelh, getRelSize, getRelw, getSize, getStroke, getStrokeWidth, getWidth, getX, getX2, getY, getY2, latexWidth, moveBy, paintHandles, resetStroke, setLocation, setRadius, setRelativeHeight, setRelativeWidth, setRelWAndH, setStroke, setStrokeWidth, setX, setX2, setY, setY2, smallestDistanceTo, strokeIs
Methods inherited from class net.sf.jaxodraw.object.JaxoObject
addPropertyChangeListener, contains, contains, contains, contains, copyFrom, firePropertyChange, getBounds2D, getBoundsWithHandles, getColor, getGeneralPath, getLaTexLocation, getName, getPathIterator, getPathIterator, getPoints, getX, getY, intersects, intersects, isAround, isMarked, latexCommand, paint, paintVisualAid, prepareEditPanel, propertyChange, removePropertyChangeListener, rescaleObject, setAsMarked, setColor, setLocation, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setPointCount, setPoints, setTransient, setX, setXPosition, setY, setYPosition
-
Field Details
-
PHOTON_FREQ
public static final float PHOTON_FREQDefault frequency for photon objects.- See Also:
-
GLUON_FREQ
public static final float GLUON_FREQDefault frequency for gluon objects.- See Also:
-
SCALAR_DASH
public static final float SCALAR_DASHDefault dash for scalar objects.- See Also:
-
GHOST_DASH
public static final float GHOST_DASHDefault dash for ghost objects.- See Also:
-
-
Constructor Details
-
JaxoParticleObject
public JaxoParticleObject()Constructor. Adds a default arrow as a PropertyChangeListener.
-
-
Method Details
-
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 classJaxoObject
- 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
Returns the arrow of this particle object.- Returns:
- The arrow of this particle object.
-
setArrow
Sets the dash property of this particle object.- Parameters:
newArrow
- The arrow of this particle object.
-
isCopy
Determines if this JaxoObject is a copy of the specified one.- Overrides:
isCopy
in classJaxoExtendedObject
- Parameters:
comp
- The JaxoObject to compare against.- Returns:
- True if the JaxoObjects are identical.
-
copyFrom
Sets all parameters from the given object to the current one.- Parameters:
temp
- The object to copy from.
-
setState
Restore state to the values of 'o'. The object 'o' must be an object of the same "type" obtained byJaxoObject.copy()
.- Overrides:
setState
in classJaxoExtendedObject
- Parameters:
o
- 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 thepreferences
.- Overrides:
setPreferences
in classJaxoExtendedObject
-
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
Paints an arrow on this object.- Parameters:
g2
- The graphics context.
-
arrowCoordinates
Returns the coordinates of the arrow of the current object.- Returns:
- The coordinates of the arrow of the current object.
-