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 |
---|---|
void |
addDisplayableVariables(java.awt.geom.Rectangle2D rect,
java.util.List<Poly> polys,
EditWindow0 wnd,
boolean multipleStrings,
boolean showTempNames)
Method to add all displayable Variables on this Electric object to an array of Poly objects.
|
protected void |
addPolyList(java.util.List<Poly> polys,
Variable var,
double cX,
double cY,
EditWindow0 wnd,
boolean multipleStrings)
Method to add to a list Poly objects that describes a displayable Variable on this Electric object.
|
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.
|
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,
boolean showTempNames)
Method to get all displayable Variables on this ElectricObject and its PortInsts to an array of Poly objects.
|
java.lang.String |
getFullDescription(Variable var)
Method to return a full description of Variable on this ElectricObject.
|
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.
|
java.lang.String |
getReadableName(Variable var)
Method to return a more readable name for Variable on this ElectricObject.
|
Schematics |
getSchematics()
Returns Schematics technology in this database
|
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)
Deprecated.
Use method with explicit EditingPreferences parameter.
|
Variable |
newDisplayVar(Variable.Key key,
java.lang.Object value,
EditingPreferences ep)
Method to create a displayable Variable on this ElectricObject with the specified values.
|
Variable |
newVar(java.lang.String name,
java.lang.Object value)
Deprecated.
Use method with explicit EditingPreferences parameter.
|
Variable |
newVar(java.lang.String name,
java.lang.Object value,
EditingPreferences ep)
Method to create a non-displayable Variable on this ElectricObject with the specified values.
|
Variable |
newVar(Variable.Key key,
java.lang.Object value)
Deprecated.
Use method with explicit EditingPreferences parameter.
|
Variable |
newVar(Variable.Key key,
java.lang.Object value,
EditingPreferences ep)
Method to create a non-displayable 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.
|
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,
boolean fromRight)
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<java.lang.String> already,
java.util.Map<java.lang.String,MutableInteger> nextPlainIndex,
boolean leaveIndexValues,
boolean fromRight)
Method to return a unique object name in a Cell.
|
Variable |
updateVar(Variable.Key key,
java.lang.Object value,
EditingPreferences ep)
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,
EditingPreferences ep)
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 java.lang.String getReadableName(Variable var)
var
- Variable on this ElectricObjectpublic java.lang.String getFullDescription(Variable var)
var
- Variable on this ElectricObjectpublic void addDisplayableVariables(java.awt.geom.Rectangle2D rect, java.util.List<Poly> polys, EditWindow0 wnd, boolean multipleStrings, boolean showTempNames)
rect
- a rectangle describing the bounds of the object on which the Variables will be displayed.polys
- a list of Poly objects that will be filled with the displayable Variables.wnd
- window in which the Variables will be displayed.multipleStrings
- true to break multi-line text into multiple Polys.showTempNames
- show temporary names on nodes and arcspublic Poly[] getDisplayableVariables(java.awt.geom.Rectangle2D rect, EditWindow0 wnd, boolean multipleStrings, boolean showTempNames)
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 multi-line text into multiple Polys.showTempNames
- show temporary names on nodes and arcs.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.protected void addPolyList(java.util.List<Poly> polys, Variable var, double cX, double cY, EditWindow0 wnd, boolean multipleStrings)
polys
- a list of polys to addvar
- 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 multi-line 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 newVar(java.lang.String name, java.lang.Object value, EditingPreferences ep)
name
- the name of the Variable.value
- the object to store in the Variable.ep
- EditingPreferences with default TextDescriptorspublic 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 newDisplayVar(Variable.Key key, java.lang.Object value, EditingPreferences ep)
key
- the key of the Variable.value
- the object to store in the Variable.ep
- EditingPreferences with default TextDescriptorspublic 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, EditingPreferences ep)
key
- the key of the Variable.value
- the object to store in the Variable.ep
- EditingPreferences with default TextDescriptorspublic 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, EditingPreferences ep)
key
- the key of the Variable.value
- the object to store in the Variable.ep
- EditingPreferences with default TextDescriptorspublic Variable updateVarText(Variable.Key key, java.lang.String text, EditingPreferences ep)
key
- the key of the Variable.text
- the text to store in the Variable.ep
- EditingPreferences with default TextDescriptorspublic 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 static java.lang.String uniqueObjectName(java.lang.String name, Cell cell, java.lang.Class<?> cls, boolean leaveIndexValues, boolean fromRight)
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]").fromRight
- true to increment multidimensional arrays starting at the rightmost index.public static java.lang.String uniqueObjectName(java.lang.String name, Cell cell, java.lang.Class<?> cls, java.util.Set<java.lang.String> already, java.util.Map<java.lang.String,MutableInteger> nextPlainIndex, boolean leaveIndexValues, boolean fromRight)
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.leaveIndexValues
- true to leave the index values untouched
(i.e. "m[17]" will become "m_1[17]" instead of "m[18]").fromRight
- true to increment multidimensional arrays starting at the rightmost index.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 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