be.ac.ulg.montefiore.run.totem.domain.model.impl
Class DomainConvertorImpl

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.domain.model.impl.DomainConvertorImpl
All Implemented Interfaces:
DomainConvertor

public class DomainConvertorImpl
extends java.lang.Object
implements DomainConvertor

This convertor allow to convert any node,link or LSP id from int to String. These conversions are needed in each class that works on int id instead of String id. WARNING : there is no assumption that the integer id are consecutive. When removing a node, link or Lsp elements, we remove the element but we not reuse its int id for other elements. Instead, the next integer id is used i.e. a not already used integer.

Creation date: 19-Jan-2005 18:40:01

Author:
Fabian Skivee (skivee@run.montefiore.ulg.ac.be)

Field Summary
protected  java.util.HashMap<java.lang.Integer,java.lang.String> lspInt2String
           
 
Constructor Summary
DomainConvertorImpl(Domain domain)
          Create all the conversion table from a domain
 
Method Summary
 void addLinkId(java.lang.String linkId)
          Add a conversion for the linkId link
 void addLspId(java.lang.String lspId)
          Add a conversion for the lspId LSP
 void addNodeId(java.lang.String nodeId)
          Add a conversion for the nodeId node
 java.lang.String getLinkId(int id)
          Convert a int link id in a String link id
 int getLinkId(java.lang.String id)
          Convert a String link id in a int link id
 java.lang.String getLspId(int id)
          Convert a int lsp id in a String lsp id
 int getLspId(java.lang.String id)
          Convert a String LSP id in a int LSP id
 int getMaxLinkId()
          Get the max link int id
 int getMaxLspId()
          Get the max LSP int id
 int getMaxNodeId()
          Get the max node int id
 java.lang.String getNodeId(int id)
          Convert a int node id in a String node id
 int getNodeId(java.lang.String id)
          Convert a String node id in a int node id
 void removeLinkId(java.lang.String linkId)
          Remove the conversion for the link linkId
 void removeLspId(java.lang.String lspId)
          Remove the conversion for the lspId LSP
 void removeNodeId(java.lang.String nodeId)
          Remove the conversion for the node nodeId
 void renameLinkId(java.lang.String oldId, java.lang.String newId)
          Rename a Link without changing its int id
 void renameLspId(java.lang.String oldId, java.lang.String newId)
          Rename an LSP without changing its int id
 void renameNodeId(java.lang.String oldId, java.lang.String newId)
          Rename a Node without changing its int id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lspInt2String

protected java.util.HashMap<java.lang.Integer,java.lang.String> lspInt2String
Constructor Detail

DomainConvertorImpl

public DomainConvertorImpl(Domain domain)
Create all the conversion table from a domain

Parameters:
domain -
Method Detail

getMaxNodeId

public int getMaxNodeId()
Get the max node int id

Specified by:
getMaxNodeId in interface DomainConvertor
Returns:

getNodeId

public int getNodeId(java.lang.String id)
              throws NodeNotFoundException
Convert a String node id in a int node id

Specified by:
getNodeId in interface DomainConvertor
Parameters:
id -
Returns:
Throws:
NodeNotFoundException

getNodeId

public java.lang.String getNodeId(int id)
                           throws NodeNotFoundException
Convert a int node id in a String node id

Specified by:
getNodeId in interface DomainConvertor
Parameters:
id -
Returns:
Throws:
NodeNotFoundException

addNodeId

public void addNodeId(java.lang.String nodeId)
               throws NodeAlreadyExistException
Add a conversion for the nodeId node

Specified by:
addNodeId in interface DomainConvertor
Parameters:
nodeId -
Throws:
NodeAlreadyExistException

removeNodeId

public void removeNodeId(java.lang.String nodeId)
                  throws NodeNotFoundException
Remove the conversion for the node nodeId

Specified by:
removeNodeId in interface DomainConvertor
Parameters:
nodeId -
Throws:
NodeNotFoundException

getMaxLinkId

public int getMaxLinkId()
Get the max link int id

Specified by:
getMaxLinkId in interface DomainConvertor
Returns:

getLinkId

public int getLinkId(java.lang.String id)
              throws LinkNotFoundException
Convert a String link id in a int link id

Specified by:
getLinkId in interface DomainConvertor
Parameters:
id -
Returns:
Throws:
LinkNotFoundException

getLinkId

public java.lang.String getLinkId(int id)
                           throws LinkNotFoundException
Convert a int link id in a String link id

Specified by:
getLinkId in interface DomainConvertor
Parameters:
id -
Returns:
Throws:
LinkNotFoundException

addLinkId

public void addLinkId(java.lang.String linkId)
               throws LinkAlreadyExistException
Add a conversion for the linkId link

Specified by:
addLinkId in interface DomainConvertor
Parameters:
linkId -
Throws:
LinkAlreadyExistException

removeLinkId

public void removeLinkId(java.lang.String linkId)
                  throws LinkNotFoundException
Remove the conversion for the link linkId

Specified by:
removeLinkId in interface DomainConvertor
Parameters:
linkId -
Throws:
LinkNotFoundException

getMaxLspId

public int getMaxLspId()
Get the max LSP int id

Specified by:
getMaxLspId in interface DomainConvertor
Returns:

getLspId

public int getLspId(java.lang.String id)
             throws LspNotFoundException
Convert a String LSP id in a int LSP id

Specified by:
getLspId in interface DomainConvertor
Parameters:
id -
Returns:
Throws:
LspNotFoundException

getLspId

public java.lang.String getLspId(int id)
                          throws LspNotFoundException
Convert a int lsp id in a String lsp id

Specified by:
getLspId in interface DomainConvertor
Parameters:
id -
Returns:
Throws:
LspNotFoundException

addLspId

public void addLspId(java.lang.String lspId)
              throws LspAlreadyExistException
Add a conversion for the lspId LSP

Specified by:
addLspId in interface DomainConvertor
Parameters:
lspId -
Throws:
LspAlreadyExistException

removeLspId

public void removeLspId(java.lang.String lspId)
                 throws LspNotFoundException
Remove the conversion for the lspId LSP

Specified by:
removeLspId in interface DomainConvertor
Parameters:
lspId -
Throws:
LspNotFoundException

renameLspId

public void renameLspId(java.lang.String oldId,
                        java.lang.String newId)
                 throws LspNotFoundException,
                        LspAlreadyExistException
Rename an LSP without changing its int id

Specified by:
renameLspId in interface DomainConvertor
Parameters:
oldId -
newId -
Throws:
LspNotFoundException - if the oldId not in the index
LspAlreadyExistException - If the newI already in the index

renameNodeId

public void renameNodeId(java.lang.String oldId,
                         java.lang.String newId)
                  throws NodeAlreadyExistException,
                         NodeNotFoundException
Description copied from interface: DomainConvertor
Rename a Node without changing its int id

Specified by:
renameNodeId in interface DomainConvertor
Throws:
NodeAlreadyExistException - If the newId already in the index
NodeNotFoundException - if the oldId not in the index

renameLinkId

public void renameLinkId(java.lang.String oldId,
                         java.lang.String newId)
                  throws LinkAlreadyExistException,
                         LinkNotFoundException
Description copied from interface: DomainConvertor
Rename a Link without changing its int id

Specified by:
renameLinkId in interface DomainConvertor
Throws:
LinkAlreadyExistException - If the newId already in the index
LinkNotFoundException - if the oldId not in the index


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.