carmetal.objects
Class ExpressionObject

java.lang.Object
  extended by carmetal.objects.ConstructionObject
      extended by carmetal.objects.ExpressionObject
All Implemented Interfaces:
DriverObject, MoveableObject, SimulationObject, carmetal.rene.lister.Element, carmetal.rene.util.sort.SortObject, Cloneable

public class ExpressionObject
extends ConstructionObject
implements MoveableObject, SimulationObject, DriverObject

Build a mathematical expression


Field Summary
 double C
           
protected  double CurrentValue
           
protected  boolean CurrentValueValid
           
 carmetal.rene.zirkel.expression.Expression E
           
protected  carmetal.rene.zirkel.expression.Expression EX
           
protected  carmetal.rene.zirkel.expression.Expression EY
           
protected  boolean Fixed
           
 double H
           
 double R
           
 double SC
           
 double SD
           
 double SH
           
protected  boolean Slider
           
protected  carmetal.rene.zirkel.expression.Expression SMax
           
protected  carmetal.rene.zirkel.expression.Expression SMin
           
 double SR
           
 double SW
           
 double SX
           
 double SY
           
 double W
           
protected  double X
           
protected  double Y
           
 
Fields inherited from class carmetal.objects.ConstructionObject
Back, Bold, Break, BreakHide, Cn, ColorIndex, ColorType, Conditionals, Count, DescriptionState, DisplaysText, DL, Flag, FormulaState, gotNCount, HasZ, Hidden, HideBreak, inConstruction, Indicated, INVISIBLE, IsDrawn, JobTarget, Keep, KeepClose, LabelSelected, Large, MainParameter, Name, NCount, NeedsRecompute, NORMAL, Obtuse, Parameter, RekFlag, RekValidating, Scratch, Selectable, Selected, ShowIndicatedName, ShowName, ShowValue, SizeState, Solid, SpecialColor, SpecialParameter, StrongSelected, SuperHidden, Target, Text, THICK, THIN, Tracked, Translation, TX1, TX2, TY1, TY2, Unit, Valid, Value, VRek, XcOffset, YcOffset
 
Constructor Summary
ExpressionObject(carmetal.construction.Construction c, double x, double y)
           
 
Method Summary
 void addDepending(carmetal.rene.zirkel.expression.Expression EE)
           
 void clearChanges()
           
 ConstructionObject copy(double x, double y)
          This clones the object for macro construction.
 Enumeration depending()
          Return an enumeration of objects, that this object depends on.
 void dragTo(double x, double y)
           
 boolean equals(ConstructionObject o)
           
 boolean fixed()
           
 String getDisplayValue()
          To be overridden by the objects.
 String getEquation()
           
 String getEX()
           
 carmetal.rene.zirkel.expression.Expression getExp()
           
 String getExpression()
           
 String getEY()
           
 String getMax()
           
 double getMaxValue()
           
 String getMin()
           
 double getMinValue()
           
 int getN()
           
 double getOldX()
           
 double getOldY()
           
 String getPrompt()
           
 double getSliderPosition()
          Compute the relative position, the slider must be on according to CurrentValue
 String getTag()
           
 double getValue()
          Get the value of an object or throw an exception (e.g.
 double getX()
           
 double getY()
           
 boolean isDriverObject()
           
 boolean isOwnedByControl()
           
 boolean isSlider()
           
 void move(double x, double y)
           
 boolean moveable()
           
 boolean nearto(int x, int y, carmetal.rene.zirkel.ZirkelCanvas zc)
          Test, if this object is chosen with coordinates x,y
 void paint(carmetal.rene.zirkel.graphics.MyGraphics g, carmetal.rene.zirkel.ZirkelCanvas zc)
          Paint the expression.
 void printArgs(carmetal.rene.util.xml.XmlWriter xml)
           
 void reset()
           
 void resetSimulationValue()
          Reset the old value.
 void round()
           
 void setCurrentValue(double x)
           
 void setDefaults()
           
 void setExpression(String expr, carmetal.construction.Construction c)
           
 void setFixed(boolean flag)
           
 void setFixed(String expr)
           
 void setFixed(String x, String y)
           
 void setOwnedByControl(boolean b)
           
 void setPrompt(String prompt)
           
 void setSimulationValue(double x)
          Set the simulation value, remember the old value.
 void setSlider(boolean flag)
          Set or clear the slider.
 void setSlider(String smin, String smax)
          Set the slider to min, max und step values.
 void setSliderPosition(double d)
          Set the expression according to the relative value the slider is on.
 void setTargetDefaults()
           
 void snap(carmetal.rene.zirkel.ZirkelCanvas zc)
           
 boolean somethingChanged()
           
 void startDrag(double x, double y)
           
 void translate()
          Override in children! This translates the mother items.
 void updateText()
           
 void validate()
           
 
Methods inherited from class carmetal.objects.ConstructionObject
addConditional, addDepInExpressions, canDisplayName, canFix, canKeepClose, changedBy, checkConditionals, clearCircleDep, clearConditional, clearConditionals, clearParameter, compare, contains, copyProperties, dependsOn, depset, depset, depset, discardMV, displays, drawCenteredLabel, drawLabel, drawLabel, drawPointLabel, edit, equals, equalsTo, getAlias, getCDPDisplayValue, getCDPSizeDisplay, getColor, getColorIndex, getColorIndex, getColorType, getColorType, getConditional, getConditionalColor, getConstruction, getDepArray, getDescription, getDisplaySize, getDisplayText, getDistance, getE, getElementColor, getElementString, getElementString, getEXpos, getEYpos, getIncrement, getLines, getName, getNCount, getObtuse, getPointObject, getR, getSpecialColor, getStringLength, getText, getTranslation, getType, getUnit, getVector, getZ, hasUnit, haveConditional, haveConditionals, helpDisplayNumber, helpDisplayValue, indicated, isBack, isBack, isBold, isBreak, isBreakHide, isDragable, isFilled, isFilledForSelect, isFixed, isFlag, isGotNCount, isHidden, isHidden, isHideBreak, isInConstruction, isInside, isJobTarget, isKeep, isKeepClose, isLarge, isMainParameter, isParameter, isPartial, isRekFlag, isSelectable, isSolid, isSolid, isSpecial, isSpecialParameter, isStrongSelected, isSuperHidden, isSuperHidden, isTarget, labelSelected, laterBind, laterTranslate, locallyLike, maybeTransparent, mustHide, nearto, onlynearto, replaceExpressions, round, round, roundDisplay, save, secondaryParams, selected, setAlias, setBack, setBold, setBreak, setBreakHide, setcOffset, setColor, setColor, setColorType, setConstruction, setDisplaySize, setDragable, setFilled, setFixed, setFlag, setFont, setGotNCount, setHidden, setHideBreak, setInConstruction, setIncrement, setIndicated, setIndicated, setInside, setJobTarget, setKeep, setKeepClose, setKeepClose, setLabelSelected, setLarge, setLines, setMainParameter, setName, setName, setNameCheck, setNameWithNumber, setNCount, setObtuse, setOffset, setParameter, setPartial, setRekFlag, setSelectable, setSelected, setShowName, setShowValue, setSolid, setSpecial, setSpecialColor, setSpecialParameter, setStrongSelected, setSuperHidden, setTarget, setText, setText, setTracked, setTranslation, setType, setUnit, showName, showName, showValue, showValue, testConditional, text1, text2, text3, text4, textAny, textcontains, toggleHidden, tracked, translateConditionals, translateExpressions, translateOffset, updateCircleDep, valid, visible, xcOffset, ycOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X

protected double X

Y

protected double Y

E

public carmetal.rene.zirkel.expression.Expression E

EX

protected carmetal.rene.zirkel.expression.Expression EX

EY

protected carmetal.rene.zirkel.expression.Expression EY

Fixed

protected boolean Fixed

CurrentValue

protected double CurrentValue

CurrentValueValid

protected boolean CurrentValueValid

Slider

protected boolean Slider

SMin

protected carmetal.rene.zirkel.expression.Expression SMin

SMax

protected carmetal.rene.zirkel.expression.Expression SMax

C

public double C

R

public double R

W

public double W

H

public double H

SC

public double SC

SR

public double SR

SW

public double SW

SH

public double SH

SX

public double SX

SY

public double SY

SD

public double SD
Constructor Detail

ExpressionObject

public ExpressionObject(carmetal.construction.Construction c,
                        double x,
                        double y)
Method Detail

setDefaults

public void setDefaults()
Overrides:
setDefaults in class ConstructionObject

setTargetDefaults

public void setTargetDefaults()
Overrides:
setTargetDefaults in class ConstructionObject

getTag

public String getTag()
Overrides:
getTag in class ConstructionObject

getN

public int getN()
Overrides:
getN in class ConstructionObject

updateText

public void updateText()
Overrides:
updateText in class ConstructionObject

paint

public void paint(carmetal.rene.zirkel.graphics.MyGraphics g,
                  carmetal.rene.zirkel.ZirkelCanvas zc)
Paint the expression. Use value, name (i.e. tag), or slider. Remember slider position for nearto and drags.

Overrides:
paint in class ConstructionObject

getSliderPosition

public double getSliderPosition()
Compute the relative position, the slider must be on according to CurrentValue

Returns:
0 <= position <= 1

setSliderPosition

public void setSliderPosition(double d)
Set the expression according to the relative value the slider is on. 0 <= d <= 1.

Parameters:
d -

nearto

public boolean nearto(int x,
                      int y,
                      carmetal.rene.zirkel.ZirkelCanvas zc)
Description copied from class: ConstructionObject
Test, if this object is chosen with coordinates x,y

Overrides:
nearto in class ConstructionObject

getX

public double getX()
Overrides:
getX in class ConstructionObject

getY

public double getY()
Overrides:
getY in class ConstructionObject

getExp

public carmetal.rene.zirkel.expression.Expression getExp()

move

public void move(double x,
                 double y)
Specified by:
move in interface MoveableObject
Overrides:
move in class ConstructionObject

snap

public void snap(carmetal.rene.zirkel.ZirkelCanvas zc)
Overrides:
snap in class ConstructionObject

round

public void round()
Overrides:
round in class ConstructionObject

printArgs

public void printArgs(carmetal.rene.util.xml.XmlWriter xml)
Overrides:
printArgs in class ConstructionObject

equals

public boolean equals(ConstructionObject o)
Overrides:
equals in class ConstructionObject

setExpression

public void setExpression(String expr,
                          carmetal.construction.Construction c)
                   throws carmetal.construction.ConstructionException
Overrides:
setExpression in class ConstructionObject
Throws:
carmetal.construction.ConstructionException

setFixed

public void setFixed(String expr)
Overrides:
setFixed in class ConstructionObject

getExpression

public String getExpression()
Overrides:
getExpression in class ConstructionObject

depending

public Enumeration depending()
Description copied from class: ConstructionObject
Return an enumeration of objects, that this object depends on. This should usually called from children via super.

Overrides:
depending in class ConstructionObject

addDepending

public void addDepending(carmetal.rene.zirkel.expression.Expression EE)

getValue

public double getValue()
                throws carmetal.construction.ConstructionException
Description copied from class: ConstructionObject
Get the value of an object or throw an exception (e.g. if invalid). Not all objects have a value.

Overrides:
getValue in class ConstructionObject
Throws:
carmetal.construction.ConstructionException

getPrompt

public String getPrompt()
Overrides:
getPrompt in class ConstructionObject

setPrompt

public void setPrompt(String prompt)
Overrides:
setPrompt in class ConstructionObject

translate

public void translate()
Description copied from class: ConstructionObject
Override in children! This translates the mother items.

Overrides:
translate in class ConstructionObject

validate

public void validate()
Overrides:
validate in class ConstructionObject

setFixed

public void setFixed(boolean flag)
Overrides:
setFixed in class ConstructionObject

setFixed

public void setFixed(String x,
                     String y)
Overrides:
setFixed in class ConstructionObject

copy

public ConstructionObject copy(double x,
                               double y)
Description copied from class: ConstructionObject
This clones the object for macro construction. NOTE: This must be overriden in all items to translate the mother objects.

Overrides:
copy in class ConstructionObject

moveable

public boolean moveable()
Specified by:
moveable in interface MoveableObject

reset

public void reset()

fixed

public boolean fixed()
Overrides:
fixed in class ConstructionObject

getEX

public String getEX()
Overrides:
getEX in class ConstructionObject

getEY

public String getEY()
Overrides:
getEY in class ConstructionObject

setCurrentValue

public void setCurrentValue(double x)

setSimulationValue

public void setSimulationValue(double x)
Set the simulation value, remember the old value.

Specified by:
setSimulationValue in interface SimulationObject

resetSimulationValue

public void resetSimulationValue()
Reset the old value.

Specified by:
resetSimulationValue in interface SimulationObject

setSlider

public void setSlider(String smin,
                      String smax)
Set the slider to min, max und step values.

Overrides:
setSlider in class ConstructionObject
Parameters:
smin -
smax -
sstep -

setSlider

public void setSlider(boolean flag)
Set or clear the slider.

Overrides:
setSlider in class ConstructionObject
Parameters:
flag -

startDrag

public void startDrag(double x,
                      double y)
Specified by:
startDrag in interface MoveableObject

dragTo

public void dragTo(double x,
                   double y)
Specified by:
dragTo in interface MoveableObject

getOldX

public double getOldX()
Specified by:
getOldX in interface MoveableObject

getOldY

public double getOldY()
Specified by:
getOldY in interface MoveableObject

isSlider

public boolean isSlider()
Overrides:
isSlider in class ConstructionObject

getMinValue

public double getMinValue()

getMaxValue

public double getMaxValue()

getMin

public String getMin()
Overrides:
getMin in class ConstructionObject

getMax

public String getMax()
Overrides:
getMax in class ConstructionObject

getDisplayValue

public String getDisplayValue()
Description copied from class: ConstructionObject
To be overridden by the objects.

Overrides:
getDisplayValue in class ConstructionObject
Returns:
The string to display the value (length, coordinates) of the object.

getEquation

public String getEquation()
Overrides:
getEquation in class ConstructionObject

isDriverObject

public boolean isDriverObject()
Specified by:
isDriverObject in interface DriverObject
Overrides:
isDriverObject in class ConstructionObject

somethingChanged

public boolean somethingChanged()
Specified by:
somethingChanged in interface DriverObject

clearChanges

public void clearChanges()
Specified by:
clearChanges in interface DriverObject

isOwnedByControl

public boolean isOwnedByControl()
Overrides:
isOwnedByControl in class ConstructionObject

setOwnedByControl

public void setOwnedByControl(boolean b)
Overrides:
setOwnedByControl in class ConstructionObject


© Copyright 2005 S.Chekanov. All Rights Reserved.
jHPlot package, a part of jHepWork: is a full-featured multiplatform data-analysis framework