de.upb.hni.vmagic.type
Class PhysicalType

java.lang.Object
  extended by de.upb.hni.vmagic.VhdlElement
      extended by de.upb.hni.vmagic.type.Type
          extended by de.upb.hni.vmagic.type.PhysicalType
All Implemented Interfaces:
BlockDeclarativeItem, DeclarativeItemMarker, EntityDeclarativeItem, PackageBodyDeclarativeItem, PackageDeclarativeItem, ProcessDeclarativeItem, SubprogramDeclarativeItem, NamedEntity, SubtypeIndication

public class PhysicalType
extends Type

Physical type.


Nested Class Summary
static class PhysicalType.Unit
          A unit in a physical type.
 
Constructor Summary
PhysicalType(java.lang.String identifier, RangeProvider range, java.lang.String primaryUnit)
          Creates a physical type.
 
Method Summary
 PhysicalType.Unit createUnit(java.lang.String identifier, AbstractLiteral factor, java.lang.String baseUnit)
          Creates a unit and adds it to this physical type.
 PhysicalType.Unit createUnit(java.lang.String identifier, int factor, java.lang.String baseUnit)
          Creates a unit with a integer factor and adds it to this physical type.
 PhysicalType.Unit createUnit(java.lang.String identifier, java.lang.String baseUnit)
          Creates a unit without a factor and adds it to this physical type.
 java.lang.String getPrimaryUnit()
          Returns the identifier of the primary unit.
 RangeProvider getRange()
          Returns the range of this physical type.
 java.util.List<PhysicalType.Unit> getUnits()
          Returns the list of units.
 void setPrimaryUnit(java.lang.String primaryUnit)
          Sets the identifier of the primary unit.
 void setRange(RangeProvider range)
          Sets the range of this physical type.
 
Methods inherited from class de.upb.hni.vmagic.type.Type
getIdentifier, setIdentifier
 
Methods inherited from class de.upb.hni.vmagic.VhdlElement
getParent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhysicalType

public PhysicalType(java.lang.String identifier,
                    RangeProvider range,
                    java.lang.String primaryUnit)
Creates a physical type.

Parameters:
identifier - the identifier of this type
range - the range
primaryUnit - the primary unit identifier
Method Detail

getPrimaryUnit

public java.lang.String getPrimaryUnit()
Returns the identifier of the primary unit.

Returns:
the identifier of the primary unit

setPrimaryUnit

public void setPrimaryUnit(java.lang.String primaryUnit)
Sets the identifier of the primary unit.

Parameters:
primaryUnit - the identifier of the primary unit

getRange

public RangeProvider getRange()
Returns the range of this physical type.

Returns:
the range

setRange

public void setRange(RangeProvider range)
Sets the range of this physical type.

Parameters:
range - the range

getUnits

public java.util.List<PhysicalType.Unit> getUnits()
Returns the list of units.

Returns:
a modifiable list of units

createUnit

public PhysicalType.Unit createUnit(java.lang.String identifier,
                                    AbstractLiteral factor,
                                    java.lang.String baseUnit)
Creates a unit and adds it to this physical type.

Parameters:
identifier - the unit's identifier
factor - the factor
baseUnit - the base unit
Returns:
the created unit

createUnit

public PhysicalType.Unit createUnit(java.lang.String identifier,
                                    int factor,
                                    java.lang.String baseUnit)
Creates a unit with a integer factor and adds it to this physical type.

Parameters:
identifier - the unit's identifier
factor - the factor
baseUnit - the base unit
Returns:
the created unit

createUnit

public PhysicalType.Unit createUnit(java.lang.String identifier,
                                    java.lang.String baseUnit)
Creates a unit without a factor and adds it to this physical type. Units without a factor implicitly use 1 as a factor.

Parameters:
identifier - the unit's identifier
baseUnit - the base unit
Returns:
the created unit