byucc.jhdl.base
Class Property

java.lang.Object
  extended bybyucc.jhdl.base.Property
Direct Known Subclasses:
PropertyBoolean, PropertyInt, PropertyString

public class Property
extends java.lang.Object

The Property class allows a user to attach an arbitrary number of name-value properties, where the value can be of any type, to a Cell or Wire. It remains public and extensible, if other uses are desired. Properties can be stored in a PropertyList, and null values are presently allowed.

Author:
Eric Blake

Constructor Summary
Property(java.lang.String name, java.lang.Class type, java.lang.Object argument)
          Creates a new property.
Property(java.lang.String name, java.lang.Object argument)
          Creates a new property.
Property(java.lang.String name, java.lang.Object argument, boolean isVisible)
          Creates a new property.
 
Method Summary
 boolean bvalue()
          If this is a boolean property, return the value as a native boolean.
 void bvalue(boolean b)
          If this is a boolean property, resets the argument.
 java.lang.String getName()
          Returns the name of this Property
 java.lang.Class getType()
          Returns the declared type of the property (which may be a superclass of the actual argument).
 java.lang.Object getValue()
          Returns the value of the Property.
 boolean isVisible()
          Returns whether this property is visible to netlisters
 void isVisible(boolean b)
          Sets whether this property is visible to netlisters
 int ivalue()
          If this is an integer property, return the value as a native int.
 void ivalue(int i)
          If this is an integer property, resets the argument.
 java.lang.Object setValue(java.lang.Object arg)
          Sets the value if it is compatible, otherwise throws an exception.
 java.lang.String svalue()
          Returns the string value of this property.
 void svalue(java.lang.String s)
          If this is a String property, resets the argument.
 java.lang.String toString()
          Returns a string representation of this Property, in the form 'name: value'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Property

public Property(java.lang.String name,
                java.lang.Object argument,
                boolean isVisible)
Creates a new property.

Parameters:
name - the name of the property
argument - the value of the property
Throws:
BuildException - if the argument is incompatible with the specified type

Property

public Property(java.lang.String name,
                java.lang.Object argument)
Creates a new property.

Parameters:
name - the name of the property
argument - the value of the property
Throws:
BuildException - if the argument is incompatible with the specified type

Property

public Property(java.lang.String name,
                java.lang.Class type,
                java.lang.Object argument)
Creates a new property.

Parameters:
name - the name of the property
type - the type of the property
argument - the value of the property
Throws:
BuildException - if the argument is incompatible with the specified type
Method Detail

getType

public java.lang.Class getType()
Returns the declared type of the property (which may be a superclass of the actual argument).

Returns:
the declared type of the property

isVisible

public boolean isVisible()
Returns whether this property is visible to netlisters

Returns:
true if visible (the default state)

isVisible

public void isVisible(boolean b)
Sets whether this property is visible to netlisters

Parameters:
b - the new state of the visibility flag

getName

public java.lang.String getName()
Returns the name of this Property

Returns:
the property name

bvalue

public void bvalue(boolean b)
If this is a boolean property, resets the argument. Otherwise, throws an exception.

Parameters:
b - the new value of the argument
Throws:
BuildException - if this property is not of type boolean

bvalue

public boolean bvalue()
If this is a boolean property, return the value as a native boolean. Otherwise, throws an exception.

Returns:
the boolean value of the property
Throws:
BuildException - if this property is not of type boolean

ivalue

public void ivalue(int i)
If this is an integer property, resets the argument. Otherwise, throws an exception.

Parameters:
i - the new value of the argument
Throws:
BuildException - if this property is not of type integer

ivalue

public int ivalue()
If this is an integer property, return the value as a native int. Otherwise, throws an exception.

Returns:
the int value of the property
Throws:
BuildException - if this property is not of type integer

svalue

public void svalue(java.lang.String s)
If this is a String property, resets the argument. Otherwise, throws an exception.

Parameters:
s - the new value of the argument
Throws:
BuildException - if this property is not of type String

svalue

public java.lang.String svalue()
Returns the string value of this property. Note that if this property is of type String, the argument itself is returned, but if it is of any other type, it is the value of argument.toString().

Returns:
the String value of the argument.

setValue

public java.lang.Object setValue(java.lang.Object arg)
Sets the value if it is compatible, otherwise throws an exception.

Parameters:
arg - the new value
Returns:
the previous value (may be null)
Throws:
BuildException - if the new value is incompatible with the declared type

getValue

public java.lang.Object getValue()
Returns the value of the Property.

Returns:
the value of the property

toString

public java.lang.String toString()
Returns a string representation of this Property, in the form 'name: value'.

Returns:
a String for this Property


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.