byucc.edif
Class EdifBusNameOps

java.lang.Object
  extended bybyucc.edif.EdifBusNameOps
All Implemented Interfaces:
java.io.Serializable

public class EdifBusNameOps
extends java.lang.Object
implements java.io.Serializable

Contains methods for parsing bus-related information from String Objects.

Version:
$Id: EdifBusNameOps.java,v 1.8 2004/12/01 17:32:37 wirthlin Exp $
Author:
Tyler Anderson
See Also:
Serialized Form

Constructor Summary
EdifBusNameOps()
           
 
Method Summary
static java.lang.String getBaseName(java.lang.String name)
          Returns the base name of this port if it is part of a bus (but isn't).
static int getBitPosition(java.lang.String name)
          Returns the position this port is within a bus if it is part of a bus (but isn't).
private static int getLeftRange(java.lang.String oldName)
          If this port is a bus then this method returns the position on the left side of the colon (:).
static int getLSB(EdifNameable name)
          Returns the lower range value of the bus, if not a bus then -1 is returned.
static int getMSB(EdifNameable name)
          Returns the higher range value of the bus, if not a bus -1 is returned.
private static int getRightRange(java.lang.String oldName)
          If this port is a bus then this method returns the position on the right side of the colon (:).
static boolean isBus(EdifNameable name)
          Returns true if the EdifNameable passed-in corresponds to that of a bus.
static boolean isBus(java.lang.String name)
          Returns true if the String passed-in corresponds to that of a bus.
static boolean isPartOfBus(java.lang.String name)
          Returns true if this port is part of a bus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EdifBusNameOps

public EdifBusNameOps()
Method Detail

getBaseName

public static java.lang.String getBaseName(java.lang.String name)
Returns the base name of this port if it is part of a bus (but isn't). Will return the name if this is already a bus.

Parameters:
name - The String to bus-parse
Returns:
A String representing this EdifPort Object's base name, meaning all numbers and underscores are removed from the end of the name

getBitPosition

public static int getBitPosition(java.lang.String name)
Returns the position this port is within a bus if it is part of a bus (but isn't). Returns -1 if this port is already a bus.

This method will return the original bit position of an EdifPort or EdifNet.

For example, (rename diff_0 "diff(0)") will return 0, a return value of -1 means no bit position has been designated or it's a bus.

Parameters:
name - The String to bus-parse
Returns:
An int representing the bit position of this EdifPort Object if it isn't a bus, but could be part of one

getLSB

public static int getLSB(EdifNameable name)
Returns the lower range value of the bus, if not a bus then -1 is returned.

This method will return the LSB of an bus version EdifPort.

For example, (rename test_data_out "test_data_out(63:60)") 4) will return 63, a return value of -1 means no LSB has been designated.

Parameters:
name - The EdifNameable Object that contains name information to bus-parse
Returns:
An int representing the lower range of this EdifPort bus Object, if its a bus

getMSB

public static int getMSB(EdifNameable name)
Returns the higher range value of the bus, if not a bus -1 is returned.

This method will return the MSB of an bus version EdifPort, or -1 if it isn't a bus.

For example, (rename test_data_out "test_data_out(63:60)") 4) will return 60, a return value of -1 means no MSB has been designated.

Parameters:
name - The EdifNameable Object that contains name information to bus-parse
Returns:
An int representing the higher range of this EdifPort bus Object, if its a bus

getRightRange

private static int getRightRange(java.lang.String oldName)
If this port is a bus then this method returns the position on the right side of the colon (:). If this isn't a bus then -1 is returned.

Parameters:
oldName - The String to bus-parse
Returns:
An int representing the range on the right side of the colon (:) of the bus's old name
See Also:
EdifPort.getMSB(), EdifPort.getLSB()

getLeftRange

private static int getLeftRange(java.lang.String oldName)
If this port is a bus then this method returns the position on the left side of the colon (:). If this isn't a bus then -1 is returned.

Parameters:
oldName - The String to bus-parse
Returns:
An int representing the range on the left side of the colon (:) of the bus's old name
See Also:
EdifPort.getMSB(), EdifPort.getLSB()

isBus

public static boolean isBus(java.lang.String name)
Returns true if the String passed-in corresponds to that of a bus.

Parameters:
name - The String to bus-parse
Returns:
True if name corresponds to a Bus-name

isBus

public static boolean isBus(EdifNameable name)
Returns true if the EdifNameable passed-in corresponds to that of a bus.

Parameters:
name - The EdifNameable Object that contains name information to bus-parse
Returns:
True if the passed-in EdifNameable corresponds to a Bus-name

isPartOfBus

public static boolean isPartOfBus(java.lang.String name)
Returns true if this port is part of a bus. Returns false if this port is already a bus, or if the bus position is not found.

Parameters:
name - The String to bus-parse
Returns:
True if this EdifPort Object isn't part of a bus, but could be