byucc.edif.tools.merge
Class BasicEdifBusNetNamingPolicy

java.lang.Object
  extended by byucc.edif.tools.merge.BasicEdifBusNetNamingPolicy
All Implemented Interfaces:
EdifBusNetNamingPolicy

public class BasicEdifBusNetNamingPolicy
extends java.lang.Object
implements EdifBusNetNamingPolicy

Basic implementation of the EdifBusNetNamingPolicy using regular expressions. This class performs the parsing on given EdifNet names by comparing the names with predefined regular expressions. The regular expression defines the naming policy.

Author:
Michael J Wirthlin

Field Summary
(package private)  java.util.regex.Pattern _p
          Local copy of the Pattern.
static java.lang.String PARAN_BITPOS_PARAN_REGEX
          This regular expression will match against a net name that ends in "(<#>)" where <#> is a decimal number.
static java.lang.String UNDERSCORE_BITPOS_REGEX
          This regular expression will match against a net name that ends in "_<#>" where <#> is a decimal number.
static java.lang.String UNDERSCORE_BITPOS_UNDERSCORE_REGEX
          This regular expression will match against a net name that ends in "_<#>_" where <#> is a decimal number.
 
Constructor Summary
BasicEdifBusNetNamingPolicy()
          The default constructor will create a naming policy based on the @link{UNDERSCORE_BITPOS_REGEX}.
BasicEdifBusNetNamingPolicy(java.lang.String regex)
          Create a new naming policy based on the given regular expression.
 
Method Summary
 java.lang.String getBusBaseName(java.lang.String name)
          Return the basename of the single bit net without the bit number.
 int getBusPosition(java.lang.String name)
          Returns the bit position of the Net within the bus.
 java.util.regex.Matcher getMatcher(java.lang.String name)
           
 boolean isValidBusNetName(java.lang.String name)
          Returns true if the given name is valid under the given naming policy.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDERSCORE_BITPOS_REGEX

public static final java.lang.String UNDERSCORE_BITPOS_REGEX
This regular expression will match against a net name that ends in "_<#>" where <#> is a decimal number. Example: test_5

See Also:
Constant Field Values

UNDERSCORE_BITPOS_UNDERSCORE_REGEX

public static final java.lang.String UNDERSCORE_BITPOS_UNDERSCORE_REGEX
This regular expression will match against a net name that ends in "_<#>_" where <#> is a decimal number. Example: test_5_

See Also:
Constant Field Values

PARAN_BITPOS_PARAN_REGEX

public static final java.lang.String PARAN_BITPOS_PARAN_REGEX
This regular expression will match against a net name that ends in "(<#>)" where <#> is a decimal number. Note that this is not a valid EDIF name and is used for the "oldname" value. Example: test(5)

See Also:
Constant Field Values

_p

java.util.regex.Pattern _p
Local copy of the Pattern.

Constructor Detail

BasicEdifBusNetNamingPolicy

public BasicEdifBusNetNamingPolicy()
The default constructor will create a naming policy based on the @link{UNDERSCORE_BITPOS_REGEX}.


BasicEdifBusNetNamingPolicy

public BasicEdifBusNetNamingPolicy(java.lang.String regex)
Create a new naming policy based on the given regular expression. The regular expression should have two and only two "groups" (i.e. regular expression units separated by parenthesis). The first group will identify the "basename" and the second group will identify the "bit position".

Method Detail

isValidBusNetName

public boolean isValidBusNetName(java.lang.String name)
Description copied from interface: EdifBusNetNamingPolicy
Returns true if the given name is valid under the given naming policy. This method should only return true if the naming policy can return both the basename and bit position of the net.

Specified by:
isValidBusNetName in interface EdifBusNetNamingPolicy

getMatcher

public java.util.regex.Matcher getMatcher(java.lang.String name)

getBusPosition

public int getBusPosition(java.lang.String name)
Description copied from interface: EdifBusNetNamingPolicy
Returns the bit position of the Net within the bus. Will return a non-negative value if the string is valid. Otherwise, it returns -1.

Specified by:
getBusPosition in interface EdifBusNetNamingPolicy

getBusBaseName

public java.lang.String getBusBaseName(java.lang.String name)
Description copied from interface: EdifBusNetNamingPolicy
Return the basename of the single bit net without the bit number. This method will should return a null if the name does not match the bus naming policy.

Specified by:
getBusBaseName in interface EdifBusNetNamingPolicy

main

public static void main(java.lang.String[] args)