carmetal.objects
Class FunctionObject

java.lang.Object
  extended by carmetal.objects.ConstructionObject
      extended by carmetal.objects.FunctionObject
All Implemented Interfaces:
DriverObject, Evaluator, HeavyObject, PointonObject, carmetal.rene.lister.Element, carmetal.rene.util.sort.SortObject, Cloneable

public class FunctionObject
extends ConstructionObject
implements PointonObject, HeavyObject, DriverObject, Evaluator


Field Summary
static int CIRCLE
           
static int CROSS
           
static int DCROSS
           
static int DIAMOND
           
static int DOT
           
 carmetal.rene.zirkel.expression.Expression DVar
           
 boolean EditAborted
           
protected  boolean Special
           
static int SQUARE
           
protected  int Type
           
 Vector V
           
 String[] Var
           
 carmetal.rene.zirkel.expression.Expression VarMax
           
 carmetal.rene.zirkel.expression.Expression VarMin
           
 
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
FunctionObject(carmetal.construction.Construction c)
          Functions are HeavyObjects which means we always must see if it really neads to recompute.
 
Method Summary
 void addDepending(carmetal.rene.zirkel.expression.Expression E)
           
 boolean canDisplayName()
           
 boolean canInteresectWith(ConstructionObject o)
           
 void clearChanges()
           
 void compute()
          Time consuming method which is called only if it's really necessary :
 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.
 boolean equals(ConstructionObject o)
           
 double evaluateF(double x)
           
 double evaluateF(double[] x)
           
 PointObject getCenter()
           
 String getDisplayValue()
          To be overridden by the objects.
 int getDistance(PointObject P)
           
 String getEX()
           
 String getEY()
           
 double getIntegral()
           
 double getLength()
           
 int getN()
           
 double getSum()
           
 String getTag()
           
 int getType()
           
 double getValue()
          Get the value of an object or throw an exception (e.g.
 double getValue(String var)
           
 String getVar()
           
 boolean hasUnit()
           
 boolean isCartesian()
           
 boolean isDriverObject()
           
 boolean isFilled()
           
 boolean isFilledForSelect()
           
 boolean isSpecial()
           
 boolean maybeTransparent()
           
 boolean mayHaveDiscontinuityPb()
           
 boolean nearto(int x, int y, carmetal.rene.zirkel.ZirkelCanvas zc)
          Test, if this object is chosen with coordinates x,y
 boolean needsToRecompute()
          Check all objects the function depends on.
 boolean onlynearto(int x, int y, carmetal.rene.zirkel.ZirkelCanvas zc)
          Test, if this object must be chosen with coordinates x,y, assuming it is near to these coordinates.
 void paint(carmetal.rene.zirkel.graphics.MyGraphics g, carmetal.rene.zirkel.ZirkelCanvas zc)
           
 void printArgs(carmetal.rene.util.xml.XmlWriter xml)
           
 void printType(carmetal.rene.util.xml.XmlWriter xml)
           
 void project(PointObject P)
           
 void project(PointObject P, double alpha)
           
 void recursiveSearchDependencies(ConstructionObject o)
          Recursive method called by the searchDependencies method
 void repulse(PointObject P)
           
 void searchDependencies(carmetal.construction.Construction c)
          In order to see if the function must be recomputed or not, we have to register, in the DriverObjectList, all objects the function depends on.
 void setCenter(String s)
           
 void setDefaults()
           
 void setExpressions(String t, String ex, String ey)
           
 void setFilled(boolean flag)
           
 void setNeedsToRecompte(boolean n)
           
 void setRange(String min, String max, String d)
           
 void setSpecial(boolean f)
           
 void setTargetDefaults()
           
 void setType(int type)
           
 boolean somethingChanged()
           
 void updateText()
           
 void validate()
           
 
Methods inherited from class carmetal.objects.ConstructionObject
addConditional, addDepInExpressions, canFix, canKeepClose, changedBy, checkConditionals, clearCircleDep, clearConditional, clearConditionals, clearParameter, compare, contains, copyProperties, dependsOn, depset, depset, depset, discardMV, displays, drawCenteredLabel, drawLabel, drawLabel, drawPointLabel, edit, equals, equalsTo, fixed, getAlias, getCDPDisplayValue, getCDPSizeDisplay, getColor, getColorIndex, getColorIndex, getColorType, getColorType, getConditional, getConditionalColor, getConstruction, getDepArray, getDescription, getDisplaySize, getDisplayText, getE, getElementColor, getElementString, getElementString, getEquation, getEXpos, getExpression, getEYpos, getIncrement, getLines, getMax, getMin, getName, getNCount, getObtuse, getPointObject, getPrompt, getR, getSpecialColor, getStringLength, getText, getTranslation, getUnit, getVector, getX, getY, getZ, haveConditional, haveConditionals, helpDisplayNumber, helpDisplayValue, indicated, isBack, isBack, isBold, isBreak, isBreakHide, isDragable, isFixed, isFlag, isGotNCount, isHidden, isHidden, isHideBreak, isInConstruction, isInside, isJobTarget, isKeep, isKeepClose, isLarge, isMainParameter, isOwnedByControl, isParameter, isPartial, isRekFlag, isSelectable, isSlider, isSolid, isSolid, isSpecialParameter, isStrongSelected, isSuperHidden, isSuperHidden, isTarget, labelSelected, laterBind, laterTranslate, locallyLike, move, mustHide, nearto, replaceExpressions, round, round, round, roundDisplay, save, secondaryParams, selected, setAlias, setBack, setBold, setBreak, setBreakHide, setcOffset, setColor, setColor, setColorType, setConstruction, setDisplaySize, setDragable, setExpression, setFixed, setFixed, setFixed, 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, setOwnedByControl, setParameter, setPartial, setPrompt, setRekFlag, setSelectable, setSelected, setShowName, setShowValue, setSlider, setSlider, setSolid, setSpecialColor, setSpecialParameter, setStrongSelected, setSuperHidden, setTarget, setText, setText, setTracked, setTranslation, setUnit, showName, showName, showValue, showValue, snap, testConditional, text1, text2, text3, text4, textAny, textcontains, toggleHidden, tracked, translate, 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

VarMin

public carmetal.rene.zirkel.expression.Expression VarMin

VarMax

public carmetal.rene.zirkel.expression.Expression VarMax

DVar

public carmetal.rene.zirkel.expression.Expression DVar

Var

public String[] Var

Type

protected int Type

SQUARE

public static final int SQUARE
See Also:
Constant Field Values

DIAMOND

public static final int DIAMOND
See Also:
Constant Field Values

CIRCLE

public static final int CIRCLE
See Also:
Constant Field Values

DOT

public static final int DOT
See Also:
Constant Field Values

CROSS

public static final int CROSS
See Also:
Constant Field Values

DCROSS

public static final int DCROSS
See Also:
Constant Field Values

Special

protected boolean Special

V

public Vector V

EditAborted

public boolean EditAborted
Constructor Detail

FunctionObject

public FunctionObject(carmetal.construction.Construction c)
Functions are HeavyObjects which means we always must see if it really neads to recompute. Computing a function can be time consuming, but once it's computed, the paint method is fast enough.

Parameters:
c -
Method Detail

setDefaults

public void setDefaults()
Overrides:
setDefaults in class ConstructionObject

setTargetDefaults

public void setTargetDefaults()
Overrides:
setTargetDefaults in class ConstructionObject

searchDependencies

public void searchDependencies(carmetal.construction.Construction c)
In order to see if the function must be recomputed or not, we have to register, in the DriverObjectList, all objects the function depends on. There are many possibilities for an object to be in this list : if it's used in the def of the function, if it's in the min or max text box, etc...

Specified by:
searchDependencies in interface HeavyObject
Parameters:
c -

recursiveSearchDependencies

public void recursiveSearchDependencies(ConstructionObject o)
Recursive method called by the searchDependencies method

Parameters:
o -

compute

public void compute()
Time consuming method which is called only if it's really necessary :

Specified by:
compute in interface HeavyObject

setNeedsToRecompte

public void setNeedsToRecompte(boolean n)

needsToRecompute

public boolean needsToRecompute()
Check all objects the function depends on. If one of the have changed, this function return true.

Specified by:
needsToRecompute in interface HeavyObject
Returns:

setFilled

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

isFilled

public boolean isFilled()
Overrides:
isFilled 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

validate

public void validate()
Overrides:
validate in class ConstructionObject

setExpressions

public void setExpressions(String t,
                           String ex,
                           String ey)

isCartesian

public boolean isCartesian()

mayHaveDiscontinuityPb

public boolean mayHaveDiscontinuityPb()

setRange

public void setRange(String min,
                     String max,
                     String d)

getEX

public String getEX()
Overrides:
getEX in class ConstructionObject

getEY

public String getEY()
Overrides:
getEY in class ConstructionObject

paint

public void paint(carmetal.rene.zirkel.graphics.MyGraphics g,
                  carmetal.rene.zirkel.ZirkelCanvas zc)
Overrides:
paint in class ConstructionObject

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

getValue

public double getValue(String var)
                throws carmetal.construction.ConstructionException
Throws:
carmetal.construction.ConstructionException

getIntegral

public double getIntegral()
                   throws carmetal.construction.ConstructionException
Throws:
carmetal.construction.ConstructionException

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.

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

printArgs

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

setType

public void setType(int type)
Overrides:
setType in class ConstructionObject

getType

public int getType()
Overrides:
getType in class ConstructionObject

printType

public void printType(carmetal.rene.util.xml.XmlWriter xml)

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

onlynearto

public boolean onlynearto(int x,
                          int y,
                          carmetal.rene.zirkel.ZirkelCanvas zc)
Description copied from class: ConstructionObject
Test, if this object must be chosen with coordinates x,y, assuming it is near to these coordinates.

Overrides:
onlynearto in class ConstructionObject

equals

public boolean equals(ConstructionObject o)
Overrides:
equals 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 E)

hasUnit

public boolean hasUnit()
Overrides:
hasUnit in class ConstructionObject

evaluateF

public double evaluateF(double[] x)
                 throws carmetal.construction.ConstructionException
Throws:
carmetal.construction.ConstructionException

evaluateF

public double evaluateF(double x)
                 throws carmetal.construction.ConstructionException
Specified by:
evaluateF in interface Evaluator
Throws:
carmetal.construction.ConstructionException

getDistance

public int getDistance(PointObject P)
Overrides:
getDistance in class ConstructionObject

project

public void project(PointObject P)
Specified by:
project in interface PointonObject

getSum

public double getSum()

getLength

public double getLength()

isSpecial

public boolean isSpecial()
Overrides:
isSpecial in class ConstructionObject

setSpecial

public void setSpecial(boolean f)
Overrides:
setSpecial in class ConstructionObject

project

public void project(PointObject P,
                    double alpha)
Specified by:
project in interface PointonObject

maybeTransparent

public boolean maybeTransparent()
Overrides:
maybeTransparent in class ConstructionObject

canDisplayName

public boolean canDisplayName()
Overrides:
canDisplayName in class ConstructionObject

setCenter

public void setCenter(String s)

isFilledForSelect

public boolean isFilledForSelect()
Overrides:
isFilledForSelect in class ConstructionObject

getCenter

public PointObject getCenter()

getVar

public String getVar()

canInteresectWith

public boolean canInteresectWith(ConstructionObject o)
Specified by:
canInteresectWith in interface PointonObject

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

repulse

public void repulse(PointObject P)
Specified by:
repulse in interface PointonObject


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