|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.electric.database.variable.Variable
public class Variable
The Variable immutable class defines a single attribute-value pair that can be attached to any ElectricObject.
This immutable class is thread-safe.
Nested Class Summary | |
---|---|
static class |
Variable.AttrKey
The Key class caches attribute Variable names. |
static class |
Variable.Key
The Key class caches Variable names. |
Field Summary | |
---|---|
static Variable[] |
NULL_ARRAY
empty array of Variables. |
Method Summary | |
---|---|
static java.lang.String |
betterVariableName(java.lang.String name)
Method to convert the standard Variable names to more readable strings. |
void |
check(boolean paramAllowed,
boolean inheritAllowed)
Checks invariant of this Variable. |
boolean |
compare(java.lang.Object obj,
java.lang.StringBuffer buffer)
This function is to compare Variable elements. |
java.lang.String |
describe(int aindex)
Return a description of this Variable without any context or helper object info |
java.lang.String |
describe(int aindex,
VarContext context,
java.lang.Object eobj)
Method to return a String describing this Variable. |
java.lang.String |
describe(VarContext context,
java.lang.Object eobj)
Method to return a description of this Variable. |
boolean |
equals(java.lang.Object o)
|
static Variable.Key |
findKey(java.lang.String name)
Method to return the Key object for a given Variable name. |
CodeExpression.Code |
getCode()
Determine what code type this variable has, if any |
CodeExpression |
getCodeExpression()
Returns CodeExpression of this Variable, it it is code variable. |
int |
getColorIndex()
Method to return the color index of the Variable's TextDescriptor. |
AbstractTextDescriptor.DispPos |
getDispPart()
Method to return the text display part of the Variable's TextDescriptor. |
int |
getFace()
Method to return the text font of the Variable's TextDescriptor. |
java.lang.String |
getFullDescription(ElectricObject eobj)
Method to return a full description of this Variable. |
Variable.Key |
getKey()
Method to return the Variable Key associated with this Variable. |
int |
getLength()
Get the number of entries stored in this Variable. |
java.lang.Object |
getObject()
Returns thread-independent value of this Variable. |
java.lang.Object |
getObject(int index)
Returns thread-independent element of array value of this Variable. |
AbstractTextDescriptor.Position |
getPos()
Method to return the text position of the Variable's TextDescriptor. |
java.lang.String |
getPureValue(int aindex)
Method to convert this Variable to a String without any evaluation of code. |
java.lang.String |
getReadableName(ElectricObject owner)
Method to return a more readable name for this Variable. |
AbstractTextDescriptor.Rotation |
getRotation()
Method to return the text rotation of the Variable's TextDescriptor. |
AbstractTextDescriptor.Size |
getSize()
Method to return the text size of the text in the Variable's TextDescriptor. |
TextDescriptor |
getTextDescriptor()
Method to return the TextDescriptor on this Variable. |
java.lang.String |
getTrueName()
Method to return the "true" name for this Variable. |
double |
getTrueSize(EditWindow0 wnd)
Method to find the true size in points for the Variable's TextDescriptor in a given EditWindow0. |
AbstractTextDescriptor.Unit |
getUnit()
Method to return the Unit of the Variable's TextDescriptor. |
double |
getXOff()
Method to return the X offset of the text in the Variable's TextDescriptor. |
double |
getYOff()
Method to return the Y offset of the text in the Variable's TextDescriptor. |
int |
hashCode()
|
boolean |
isArray()
Returns true if the value is array, |
boolean |
isAttribute()
Method to return if this is Variable is a User Attribute. |
boolean |
isBold()
Method to return true if the text in the Variable's TextDescriptor is bold. |
boolean |
isCode()
Method to tell whether this Variable is any code. |
boolean |
isDisplay()
Method to return true if this Variable is displayable. |
boolean |
isInherit()
Method to return true if the text in the Variable's TextDescriptor is inheritable. |
boolean |
isInterior()
Method to return true if the text in the Variable's TextDescriptor is interior. |
boolean |
isItalic()
Method to return true if the text in the Variable's TextDescriptor is italic. |
boolean |
isJava()
Method to return true if this Variable is Java. |
boolean |
isLinked(ElectricObject owner)
Returns true if variable is linked to a linked owner, false otherwise. |
boolean |
isUnderline()
Method to return true if the text in the Variable's TextDescriptor is underlined. |
static Variable |
newInstance(Variable.Key key,
java.lang.Object value,
TextDescriptor descriptor)
Returns new Variable. |
static Variable.Key |
newKey(java.lang.String name)
Method to find or create the Key object for a given Variable name. |
static Variable.Key |
newKey(java.lang.String name,
ElectricObject parent)
Method to find or create the Key object for a given Variable name. |
static Variable |
read(IdReader reader)
Read Variable from IdReader. |
static java.lang.Object |
readObject(IdReader reader)
Read Object from IdReader. |
java.lang.String |
toString()
Returns a printable version of this Variable. |
Variable |
withAbsSize(int s)
Returns Variable which differs from this Variable by text size. |
Variable |
withBold(boolean state)
Returns Variable which differs from this Variable by bold flag. |
Variable |
withCode(CodeExpression.Code code)
Returns Variable which differs from this Variable by code. |
static java.lang.Object |
withCode(java.lang.Object value,
CodeExpression.Code code)
Returns Object of specified Code derived from specified Object If code is not NONE, the new Object will be of type CodeExpression. |
Variable |
withColorIndex(int colorIndex)
Returns Variable which differs from this Variable by colorIndex. |
Variable |
withDisplay(boolean state)
Returns Variable which differs from this Variable by displayable flag. |
Variable |
withDispPart(AbstractTextDescriptor.DispPos dispPos)
Returns Variable which differs from this Variable by dislay part. |
Variable |
withFace(int f)
Returns Variable which differs from this Variable by text font. |
Variable |
withInherit(boolean state)
Returns Variable which differs from this Variable by inheritable flag. |
Variable |
withInterior(boolean state)
Returns Variable which differs from this Variable by interior flag. |
Variable |
withItalic(boolean state)
Returns Variable which differs from this Variable by italic flag. |
Variable |
withObject(java.lang.Object value)
Returns Variable which differs from this Variable by value. |
Variable |
withOff(double xd,
double yd)
Returns Variable which differs from this Variable by X and Y offsets of the text in the Variable's TextDescriptor. |
Variable |
withParam(boolean state)
Returns Variable which deffers from this Variable by parameter flag. |
Variable |
withPos(AbstractTextDescriptor.Position p)
Returns Variable which differs from this Variable by position. |
Variable |
withRelSize(double s)
Returns Variable which differs from this Variable by text size. |
Variable |
withRenamedIds(IdMapper idMapper)
Returns Variable which differs from this Variable by renamed Ids. |
Variable |
withRotation(AbstractTextDescriptor.Rotation r)
Returns Variable which differs from this Variable by rotation. |
Variable |
withText(java.lang.String text)
Returns Variable which differs from this Variable by text value. |
Variable |
withTextDescriptor(TextDescriptor descriptor)
Returns Variable which differs from this Variable by TextDescriptor. |
Variable |
withUnderline(boolean state)
Returns Variable which differs from this Variable by underline flag. |
Variable |
withUnit(AbstractTextDescriptor.Unit u)
Returns Variable which differs from this Variable by unit. |
void |
write(IdWriter writer)
Write this Variable to IdWriter. |
static void |
writeObject(IdWriter writer,
java.lang.Object obj)
Write Object to IdWriter. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Variable[] NULL_ARRAY
Method Detail |
---|
public static Variable.Key findKey(java.lang.String name)
public static Variable.Key newKey(java.lang.String name)
name
- given Variable name.
public static Variable.Key newKey(java.lang.String name, ElectricObject parent)
name
- given Variable name.parent
- the object on which this Variable key will reside.
public static Variable newInstance(Variable.Key key, java.lang.Object value, TextDescriptor descriptor)
key
- key of this Variable.value
- value of this Variable.descriptor
- text descriptor of this Variable.
java.lang.NullPointerException
- if key, descriptor or value is null.
java.lang.IllegalArgumentException
- if value has invalid typepublic static java.lang.Object withCode(java.lang.Object value, CodeExpression.Code code)
value
- specified Objectcode
- code of new Object.
public void check(boolean paramAllowed, boolean inheritAllowed)
paramAllowed
- true if paramerer flag is allowed on this VariableinheritAllowed
- true if inherit flag is allowed on this Variable
java.lang.AssertionError
- or NullPointerException if invariant is broken.public boolean isArray()
public int getLength()
public java.lang.Object getObject()
public void write(IdWriter writer) throws java.io.IOException
writer
- where to write.
java.io.IOException
public static void writeObject(IdWriter writer, java.lang.Object obj) throws java.io.IOException
writer
- where to write.obj
-
java.io.IOException
public static Variable read(IdReader reader) throws java.io.IOException
reader
- from to read.
java.io.IOException
public static java.lang.Object readObject(IdReader reader) throws java.io.IOException
reader
- from to read
java.io.IOException
public Variable withObject(java.lang.Object value)
value
- value of new Variable.
java.lang.NullPointerException
- if value is null.
java.lang.IllegalArgumentException
- if value has invalid typepublic Variable withText(java.lang.String text)
text
- text value of new Variable.
java.lang.NullPointerException
- if value is null.
java.lang.IllegalArgumentException
- if value has invalid typepublic Variable withCode(CodeExpression.Code code)
code
- code of new Variable.
public Variable withRenamedIds(IdMapper idMapper)
idMapper
- a mapper from old Ids to new Ids.
public java.lang.Object getObject(int index)
index
- index of array
java.lang.ArrayIndexOutOfBoundsException
- if index is scalar of value is out of bounds.public Variable.Key getKey()
public boolean isLinked(ElectricObject owner)
owner
- owner of this variable.
public java.lang.String getReadableName(ElectricObject owner)
public java.lang.String getFullDescription(ElectricObject eobj)
public static java.lang.String betterVariableName(java.lang.String name)
name
- the actual Variable name.
public java.lang.String getTrueName()
public java.lang.String describe(VarContext context, java.lang.Object eobj)
public java.lang.String describe(int aindex)
public java.lang.String describe(int aindex, VarContext context, java.lang.Object eobj)
aindex
- if negative, print the entire array.context
- the VarContext for this Variable.eobj
- the Object on which this Variable resides.
public java.lang.String getPureValue(int aindex)
aindex
- if negative, print the entire array.
public boolean compare(java.lang.Object obj, java.lang.StringBuffer buffer)
obj
- Object to compare tobuffer
- To store comparison messages in case of failure
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public TextDescriptor getTextDescriptor()
public Variable withTextDescriptor(TextDescriptor descriptor)
descriptor
- the new TextDescriptor on this Variable.
public Variable withDisplay(boolean state)
state
- true, if new Variable is displayable.
public boolean isDisplay()
public CodeExpression getCodeExpression()
public CodeExpression.Code getCode()
public boolean isJava()
public boolean isCode()
public boolean isAttribute()
public int getColorIndex()
public Variable withColorIndex(int colorIndex)
colorIndex
- color index of new Variable.
public AbstractTextDescriptor.Position getPos()
public Variable withPos(AbstractTextDescriptor.Position p)
p
- the text position of new Variable.
java.lang.NullPointerException
- if p is null.public AbstractTextDescriptor.Size getSize()
public double getTrueSize(EditWindow0 wnd)
wnd
- the EditWindow0 in which drawing will occur.
public Variable withAbsSize(int s)
s
- the point size of new Variable.
public Variable withRelSize(double s)
s
- the unit size of new Variable.
public int getFace()
public Variable withFace(int f)
f
- the text font of new Variable.
public AbstractTextDescriptor.Rotation getRotation()
public Variable withRotation(AbstractTextDescriptor.Rotation r)
r
- the text rotation of new Variable.
public AbstractTextDescriptor.DispPos getDispPart()
public Variable withDispPart(AbstractTextDescriptor.DispPos dispPos)
dispPos
- the text display part of new Variable.
java.lang.NullPointerException
- if dispPos is nullpublic boolean isItalic()
public Variable withItalic(boolean state)
state
- true if text of new Variable is italic.
public boolean isBold()
public Variable withBold(boolean state)
state
- true if text of new Variable is bold.
public boolean isUnderline()
public Variable withUnderline(boolean state)
state
- true text of new Variable is underlined.
public boolean isInterior()
public Variable withInterior(boolean state)
state
- true if text with new Variable is interior.
public boolean isInherit()
public Variable withInherit(boolean state)
state
- true if new Variable is inheritable.
public Variable withParam(boolean state)
state
- true if new Variable is parameter.
public double getXOff()
public double getYOff()
public Variable withOff(double xd, double yd)
xd
- the X offset of the text in new Variable's TextDescriptor.yd
- the Y offset of the text in new Variable's TextDescriptor.
public AbstractTextDescriptor.Unit getUnit()
public Variable withUnit(AbstractTextDescriptor.Unit u)
u
- the Unit of new Variable.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |