public abstract class ElectricObject
extends java.lang.Object
implements java.io.Serializable
This class should be thread-safe.
Modifier | Constructor and Description |
---|---|
protected |
ElectricObject()
The protected constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
addDisplayableVariables(java.awt.geom.Rectangle2D rect,
Poly[] polys,
int start,
EditWindow0 wnd,
boolean multipleStrings)
Method to add all displayable Variables on this Electric object to an array of Poly objects.
|
abstract void |
addVar(Variable var)
Method to add a Variable on this ElectricObject.
|
protected void |
check()
Method to check invariants in this ElectricObject.
|
void |
checkChanging()
Routing to check whether changing of this cell allowed or not.
|
void |
checkExamine()
Method to make sure that this object can be examined.
|
void |
checkUndoing()
Routing to check whether undoing of this cell allowed or not.
|
Poly |
computeTextPoly(EditWindow0 wnd,
Variable.Key varKey)
Method to compute a Poly that describes text.
|
void |
copyTextDescriptorFrom(ElectricObject other,
Variable.Key varKey)
Method to copy text descriptor from another ElectricObject to this ElectricObject.
|
void |
copyVarsFrom(ElectricObject other)
Method to copy all variables from another ElectricObject to this ElectricObject.
|
abstract void |
delVar(Variable.Key key)
Method to delete a Variable from this ElectricObject.
|
Artwork |
getArtwork()
Returns Artwork technology in this database
|
CodeExpression.Code |
getCode(Variable.Key varKey)
Returns the Code on this ElectricObject selected by variable key.
|
abstract ImmutableElectricObject |
getD()
Returns persistent data of this ElectricObject with Variables.
|
abstract EDatabase |
getDatabase()
Returns database to which this ElectricObject belongs.
|
Poly[] |
getDisplayableVariables(java.awt.geom.Rectangle2D rect,
EditWindow0 wnd,
boolean multipleStrings)
Method to get all displayable Variables on this ElectricObject and its PortInsts to an array of Poly objects.
|
EditingPreferences |
getEditingPreferences()
Returns editing preferences for the database of this ElectricObject in current Thread
|
Generic |
getGeneric()
Returns Generic technology in this database
|
void |
getInfo()
Method to write a description of this ElectricObject (lists all Variables).
|
MutableTextDescriptor |
getMutableTextDescriptor(Variable.Key varKey)
Returns the TextDescriptor on this ElectricObject selected by variable key.
|
int |
getNumVariables()
Method to return the number of Variables on this ElectricObject.
|
Variable |
getParameterOrVariable(java.lang.String name)
Method to return the Parameter or Variable on this ElectricObject with a given name.
|
Variable |
getParameterOrVariable(Variable.Key key)
Method to return the Parameter or Variable on this ElectricObject with a given key.
|
java.util.Iterator<Variable> |
getParametersAndVariables()
Method to return an Iterator over all Parameters and Variables on this ElectricObject.
|
Poly[] |
getPolyList(Variable var,
double cX,
double cY,
EditWindow0 wnd,
boolean multipleStrings)
Method to create an array of Poly objects that describes a displayable Variable on this Electric object.
|
Schematics |
getSchematics()
Returns Schematics technology in this database
|
Technology |
getTech(TechId techId)
Get Technology by TechId
TechId must belong to same IdManager as TechPool
|
TechPool |
getTechPool()
Returns TechPool of this database
|
java.awt.geom.Rectangle2D |
getTextBounds(EditWindow0 wnd)
Method to return the bounds of this ElectricObject in an EditWindow.
|
TextDescriptor |
getTextDescriptor(Variable.Key varKey)
Returns the TextDescriptor on this ElectricObject selected by variable key.
|
Variable |
getVar(java.lang.String name)
Method to return the Variable on this ElectricObject with a given name.
|
Variable |
getVar(Variable.Key key)
Method to return the Variable on this ElectricObject with a given key.
|
java.util.Iterator<Variable> |
getVariables()
Method to return an Iterator over all Variables on this ElectricObject.
|
<T> T |
getVarValue(Variable.Key key,
java.lang.Class<T> type)
Method to return the value of the the Variable on this ElectricObject with a given key and type.
|
<T> T |
getVarValue(Variable.Key key,
java.lang.Class<T> type,
T defaultValue)
Method to return the value of the the Variable on this ElectricObject with a given key and type.
|
protected boolean |
isDatabaseObject()
Method which indicates that this object is in database.
|
boolean |
isDeprecatedVariable(Variable.Key key)
Method to determine whether a Variable key on this object is deprecated.
|
abstract boolean |
isLinked()
Returns true if object is linked into database
|
boolean |
isParam(Variable.Key varKey)
Method to return true if the Variable on this ElectricObject with given key is a parameter.
|
Variable |
newDisplayVar(Variable.Key key,
java.lang.Object value)
Method to create a displayable Variable on this ElectricObject with the specified values.
|
Variable |
newVar(java.lang.String name,
java.lang.Object value)
Method to create a non-displayable Variable on this ElectricObject with the specified values.
|
Variable |
newVar(Variable.Key key,
java.lang.Object value)
Method to create a non-displayable Variable on this ElectricObject with the specified values.
|
Variable |
newVar(Variable.Key key,
java.lang.Object value,
boolean display)
Method to create a Variable on this ElectricObject with the specified values.
|
Variable |
newVar(Variable.Key key,
java.lang.Object value,
TextDescriptor td)
Method to create a Variable on this ElectricObject with the specified values.
|
int |
numDisplayableVariables(boolean multipleStrings)
Method to return the number of displayable Variables on this ElectricObject.
|
Variable |
renameVar(java.lang.String name,
java.lang.String newName)
Rename a Variable.
|
Variable |
renameVar(Variable.Key key,
java.lang.String newName)
Rename a Variable.
|
void |
setOff(Variable.Key varKey,
double xd,
double yd)
Method to set the X and Y offsets of the text in the TextDescriptor selected by key of
variable or special key.
|
void |
setTextDescriptor(Variable.Key varKey,
TextDescriptor td)
Updates the TextDescriptor on this ElectricObject selected by varKey.
|
java.lang.String |
toString()
Returns a printable version of this ElectricObject.
|
static java.lang.String |
uniqueObjectName(java.lang.String name,
Cell cell,
java.lang.Class cls,
boolean leaveIndexValues)
Method to return a unique object name in a Cell.
|
static java.lang.String |
uniqueObjectName(java.lang.String name,
Cell cell,
java.lang.Class cls,
java.util.Set already,
java.util.Map<java.lang.String,GenMath.MutableInteger> nextPlainIndex,
boolean leaveIndexValues)
Method to return a unique object name in a Cell.
|
Variable |
updateVar(Variable.Key key,
java.lang.Object value)
Method to update a Variable on this ElectricObject with the specified values.
|
Variable |
updateVarCode(Variable.Key key,
CodeExpression.Code code)
Method to update a Variable on this ElectricObject with the specified code.
|
Variable |
updateVarText(Variable.Key key,
java.lang.String text)
Method to update a text Variable on this ElectricObject with the specified values.
|
Cell |
whichCell()
Method to determine the appropriate Cell associated with this ElectricObject.
|
public abstract ImmutableElectricObject getD()
public abstract boolean isLinked()
public <T> T getVarValue(Variable.Key key, java.lang.Class<T> type)
key
- the key of the Variable.type
- the required type of the Variable.java.lang.NullPointerException
- if key is nullpublic <T> T getVarValue(Variable.Key key, java.lang.Class<T> type, T defaultValue)
key
- the key of the Variable.type
- the required type of the Variable.defaultValue
- default valuejava.lang.NullPointerException
- if key or type is nullpublic Variable getVar(java.lang.String name)
name
- the name of the Variable.java.lang.NullPointerException
- if name is nullpublic Variable getVar(Variable.Key key)
key
- the key of the Variable.java.lang.NullPointerException
- if key is nullpublic Variable getParameterOrVariable(java.lang.String name)
name
- the name of the Parameter or Variable.java.lang.NullPointerException
- if key is nullpublic Variable getParameterOrVariable(Variable.Key key)
key
- the key of the Parameter or Variable.java.lang.NullPointerException
- if key is nullpublic TextDescriptor getTextDescriptor(Variable.Key varKey)
NodeInst.NODE_NAME
NodeInst.NODE_PROTO
ArcInst.ARC_NAME
Export.EXPORT_NAME
The TextDescriptor gives information for displaying the Variable.varKey
- key of variable or special key.public MutableTextDescriptor getMutableTextDescriptor(Variable.Key varKey)
NodeInst.NODE_NAME
NodeInst.NODE_PROTO
ArcInst.ARC_NAME
Export.EXPORT_NAME
The TextDescriptor gives information for displaying the Variable.varKey
- key of variable or special key.public CodeExpression.Code getCode(Variable.Key varKey)
NodeInst.NODE_NAME
NodeInst.NODE_PROTO
ArcInst.ARC_NAME
Export.EXPORT_NAME
The Code gives information for displaying the Variable.varKey
- key of variable or special key.public boolean isParam(Variable.Key varKey)
varKey
- key to testpublic int numDisplayableVariables(boolean multipleStrings)
public int addDisplayableVariables(java.awt.geom.Rectangle2D rect, Poly[] polys, int start, EditWindow0 wnd, boolean multipleStrings)
rect
- a rectangle describing the bounds of the object on which the Variables will be displayed.polys
- an array of Poly objects that will be filled with the displayable Variables.start
- the starting index in the array of Poly objects to fill with displayable Variables.wnd
- window in which the Variables will be displayed.multipleStrings
- true to break multiline text into multiple Polys.public Poly[] getDisplayableVariables(java.awt.geom.Rectangle2D rect, EditWindow0 wnd, boolean multipleStrings)
rect
- a rectangle describing the bounds of the object on which the Variables will be displayed.wnd
- window in which the Variables will be displayed.multipleStrings
- true to break multiline text into multiple Polys.public Poly computeTextPoly(EditWindow0 wnd, Variable.Key varKey)
wnd
- the EditWindow0 in which the text will be drawn.varKey
- the Variable.Key on the ElectricObject (may be null).public java.awt.geom.Rectangle2D getTextBounds(EditWindow0 wnd)
wnd
- the EditWindow0 in which the object is being displayed.public Poly[] getPolyList(Variable var, double cX, double cY, EditWindow0 wnd, boolean multipleStrings)
var
- the Variable on this ElectricObject to describe.cX
- the center X coordinate of the ElectricObject.cY
- the center Y coordinate of the ElectricObject.wnd
- window in which the Variable will be displayed.multipleStrings
- true to break multiline text into multiple Polys.public Variable newVar(java.lang.String name, java.lang.Object value)
name
- the name of the Variable.value
- the object to store in the Variable.public Variable newDisplayVar(Variable.Key key, java.lang.Object value)
key
- the key of the Variable.value
- the object to store in the Variable.public Variable newVar(Variable.Key key, java.lang.Object value)
key
- the key of the Variable.value
- the object to store in the Variable.public Variable newVar(Variable.Key key, java.lang.Object value, boolean display)
key
- the key of the Variable.value
- the object to store in the Variable.display
- true if the Variale is displayable.public Variable newVar(Variable.Key key, java.lang.Object value, TextDescriptor td)
key
- the key of the Variable.value
- the object to store in the Variable.td
- text descriptor of the Variablepublic abstract void addVar(Variable var)
var
- Variable to add.public Variable updateVar(Variable.Key key, java.lang.Object value)
key
- the key of the Variable.value
- the object to store in the Variable.public Variable updateVarText(Variable.Key key, java.lang.String text)
key
- the key of the Variable.text
- the text to store in the Variable.public Variable updateVarCode(Variable.Key key, CodeExpression.Code code)
key
- the key of the Variable.code
- the new code of the Variable.public void setTextDescriptor(Variable.Key varKey, TextDescriptor td)
varKey
- key of variable or special key.td
- new value TextDescriptorpublic void setOff(Variable.Key varKey, double xd, double yd)
varKey
- key of variable or special key.xd
- the X offset of the text in the TextDescriptor.yd
- the Y offset of the text in the TextDescriptor.setTextDescriptor(com.sun.electric.database.variable.Variable.Key,com.sun.electric.database.variable.TextDescriptor)
,
Variable.withOff(double,double)
public void copyTextDescriptorFrom(ElectricObject other, Variable.Key varKey)
other
- the other ElectricObject from which to copy Variables.varKey
- selector of textdescriptorpublic Variable renameVar(java.lang.String name, java.lang.String newName)
name
- the name of the var to renamenewName
- the new name of the variablepublic Variable renameVar(Variable.Key key, java.lang.String newName)
key
- the name key of the var to renamenewName
- the new name of the variablepublic abstract void delVar(Variable.Key key)
key
- the key of the Variable to delete.public void copyVarsFrom(ElectricObject other)
other
- the other ElectricObject from which to copy Variables.public static java.lang.String uniqueObjectName(java.lang.String name, Cell cell, java.lang.Class cls, boolean leaveIndexValues)
name
- the original name that is not unique.cell
- the Cell in which this name resides.cls
- the class of the object on which this name resides.leaveIndexValues
- true to leave the index values untouched
(i.e. "m[17]" will become "m_1[17]" instead of "m[18]").public static java.lang.String uniqueObjectName(java.lang.String name, Cell cell, java.lang.Class cls, java.util.Set already, java.util.Map<java.lang.String,GenMath.MutableInteger> nextPlainIndex, boolean leaveIndexValues)
name
- the original name that is not unique.cell
- the Cell in which this name resides.cls
- the class of the object on which this name resides.already
- a Set of names already in use (lower case).leaveIndexValues
- true to leave the index values untouches
(i.e. "m[17]" will become "m_1[17]" instead of "m[18]").public boolean isDeprecatedVariable(Variable.Key key)
key
- the key of the Variable.public java.util.Iterator<Variable> getVariables()
public int getNumVariables()
public java.util.Iterator<Variable> getParametersAndVariables()
public void checkChanging()
public void checkUndoing()
public void checkExamine()
public abstract EDatabase getDatabase()
public TechPool getTechPool()
public EditingPreferences getEditingPreferences()
public Technology getTech(TechId techId)
techId
- TechId to findjava.lang.IllegalArgumentException
- of TechId is not from this IdManagerpublic Artwork getArtwork()
public Generic getGeneric()
public Schematics getSchematics()
protected boolean isDatabaseObject()
public Cell whichCell()
public void getInfo()
public java.lang.String toString()
toString
in class java.lang.Object
protected void check()
java.lang.AssertionError
- if invariants are not valid