net.wimpi.modbus.procimg
Class SimpleProcessImage

java.lang.Object
  extended by net.wimpi.modbus.procimg.SimpleProcessImage
All Implemented Interfaces:
ProcessImage, ProcessImageImplementation

public class SimpleProcessImage
extends Object
implements ProcessImageImplementation

Class implementing a simple process image to be able to run unit tests or handle simple cases.

Version:
@version@ (@date@)
Author:
Dieter Wimberger

Field Summary
 
Fields inherited from interface net.wimpi.modbus.procimg.ProcessImageImplementation
DIG_FALSE, DIG_INVALID, DIG_TRUE
 
Constructor Summary
SimpleProcessImage()
          Constructs a new SimpleProcessImage instance.
 
Method Summary
 void addDigitalIn(DigitalIn di)
          Adds a new DigitalIn instance.
 void addDigitalOut(DigitalOut _do)
          Adds a new DigitalOut instance.
 void addInputRegister(InputRegister reg)
          Adds a new InputRegister instance.
 void addRegister(Register reg)
          Adds a new Register instance.
 DigitalIn getDigitalIn(int ref)
          Returns the DigitalIn instance at the given reference.
 int getDigitalInCount()
          Returns the number of DigitalIn instances in this ProcessImage.
 DigitalIn[] getDigitalInRange(int ref, int count)
          Returns a range of DigitalIn instances.
 DigitalOut getDigitalOut(int ref)
          Returns the DigitalOut instance at the given reference.
 int getDigitalOutCount()
          Returns the number of DigitalOut instances in this ProcessImage.
 DigitalOut[] getDigitalOutRange(int ref, int count)
          Returns a range of DigitalOut instances.
 InputRegister getInputRegister(int ref)
          Returns the InputRegister instance at the given reference.
 int getInputRegisterCount()
          Returns the number of InputRegister instances in this ProcessImage.
 InputRegister[] getInputRegisterRange(int ref, int count)
          Returns a range of InputRegister instances.
 Register getRegister(int ref)
          Returns the Register instance at the given reference.
 int getRegisterCount()
          Returns the number of Register instances in this ProcessImage.
 Register[] getRegisterRange(int ref, int count)
          Returns a range of Register instances.
 boolean isLocked()
           
 void removeDigitalIn(DigitalIn di)
          Removes a given DigitalIn instance.
 void removeDigitalOut(DigitalOut _do)
          Removes a given DigitalOut instance.
 void removeInputRegister(InputRegister reg)
          Removes a given InputRegister instance.
 void removeRegister(Register reg)
          Removes a given Register instance.
 void setDigitalIn(int ref, DigitalIn di)
          Sets a new DigitalIn instance at the given reference.
 void setDigitalOut(int ref, DigitalOut _do)
          Sets a new DigitalOut instance at the given reference.
 void setInputRegister(int ref, InputRegister reg)
          Sets a new InputRegister instance at the given reference.
 void setLocked(boolean locked)
           
 void setRegister(int ref, Register reg)
          Sets a new Register instance at the given reference.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleProcessImage

public SimpleProcessImage()
Constructs a new SimpleProcessImage instance.

Method Detail

isLocked

public boolean isLocked()

setLocked

public void setLocked(boolean locked)

addDigitalIn

public void addDigitalIn(DigitalIn di)
Description copied from interface: ProcessImageImplementation
Adds a new DigitalIn instance.

Specified by:
addDigitalIn in interface ProcessImageImplementation
Parameters:
di - the DigitalIn instance to be added.

removeDigitalIn

public void removeDigitalIn(DigitalIn di)
Description copied from interface: ProcessImageImplementation
Removes a given DigitalIn instance.

Specified by:
removeDigitalIn in interface ProcessImageImplementation
Parameters:
di - the DigitalIn instance to be removed.

setDigitalIn

public void setDigitalIn(int ref,
                         DigitalIn di)
                  throws IllegalAddressException
Description copied from interface: ProcessImageImplementation
Sets a new DigitalIn instance at the given reference.

Specified by:
setDigitalIn in interface ProcessImageImplementation
Parameters:
ref - the reference as int.
di - the new DigitalIn instance to be set.
Throws:
IllegalAddressException - if the reference is invalid.

getDigitalIn

public DigitalIn getDigitalIn(int ref)
                       throws IllegalAddressException
Description copied from interface: ProcessImage
Returns the DigitalIn instance at the given reference.

Specified by:
getDigitalIn in interface ProcessImage
Parameters:
ref - the reference.
Returns:
the DigitalIn instance at the given address.
Throws:
IllegalAddressException - if the reference is invalid.

getDigitalInCount

public int getDigitalInCount()
Description copied from interface: ProcessImage
Returns the number of DigitalIn instances in this ProcessImage.

Specified by:
getDigitalInCount in interface ProcessImage
Returns:
the number of digital ins as int.

getDigitalInRange

public DigitalIn[] getDigitalInRange(int ref,
                                     int count)
Description copied from interface: ProcessImage
Returns a range of DigitalIn instances.

Specified by:
getDigitalInRange in interface ProcessImage
Parameters:
ref - the start offset.
count - the amount of DigitalIn from the offset.
Returns:
an array of DigitalIn instances.

addDigitalOut

public void addDigitalOut(DigitalOut _do)
Description copied from interface: ProcessImageImplementation
Adds a new DigitalOut instance.

Specified by:
addDigitalOut in interface ProcessImageImplementation
Parameters:
_do - the DigitalOut instance to be added.

removeDigitalOut

public void removeDigitalOut(DigitalOut _do)
Description copied from interface: ProcessImageImplementation
Removes a given DigitalOut instance.

Specified by:
removeDigitalOut in interface ProcessImageImplementation
Parameters:
_do - the DigitalOut instance to be removed.

setDigitalOut

public void setDigitalOut(int ref,
                          DigitalOut _do)
                   throws IllegalAddressException
Description copied from interface: ProcessImageImplementation
Sets a new DigitalOut instance at the given reference.

Specified by:
setDigitalOut in interface ProcessImageImplementation
Parameters:
ref - the reference as int.
_do - the new DigitalOut instance to be set.
Throws:
IllegalAddressException - if the reference is invalid.

getDigitalOut

public DigitalOut getDigitalOut(int ref)
                         throws IllegalAddressException
Description copied from interface: ProcessImage
Returns the DigitalOut instance at the given reference.

Specified by:
getDigitalOut in interface ProcessImage
Parameters:
ref - the reference.
Returns:
the DigitalOut instance at the given address.
Throws:
IllegalAddressException - if the reference is invalid.

getDigitalOutCount

public int getDigitalOutCount()
Description copied from interface: ProcessImage
Returns the number of DigitalOut instances in this ProcessImage.

Specified by:
getDigitalOutCount in interface ProcessImage
Returns:
the number of digital outs as int.

getDigitalOutRange

public DigitalOut[] getDigitalOutRange(int ref,
                                       int count)
Description copied from interface: ProcessImage
Returns a range of DigitalOut instances.

Specified by:
getDigitalOutRange in interface ProcessImage
Parameters:
ref - the start offset.
count - the amount of DigitalOut from the offset.
Returns:
an array of DigitalOut instances.

addInputRegister

public void addInputRegister(InputRegister reg)
Description copied from interface: ProcessImageImplementation
Adds a new InputRegister instance.

Specified by:
addInputRegister in interface ProcessImageImplementation
Parameters:
reg - the InputRegister instance to be added.

removeInputRegister

public void removeInputRegister(InputRegister reg)
Description copied from interface: ProcessImageImplementation
Removes a given InputRegister instance.

Specified by:
removeInputRegister in interface ProcessImageImplementation
Parameters:
reg - the InputRegister instance to be removed.

setInputRegister

public void setInputRegister(int ref,
                             InputRegister reg)
                      throws IllegalAddressException
Description copied from interface: ProcessImageImplementation
Sets a new InputRegister instance at the given reference.

Specified by:
setInputRegister in interface ProcessImageImplementation
Parameters:
ref - the reference as int.
reg - the new InputRegister instance to be set.
Throws:
IllegalAddressException - if the reference is invalid.

getInputRegister

public InputRegister getInputRegister(int ref)
                               throws IllegalAddressException
Description copied from interface: ProcessImage
Returns the InputRegister instance at the given reference.

Specified by:
getInputRegister in interface ProcessImage
Parameters:
ref - the reference.
Returns:
the InputRegister instance at the given address.
Throws:
IllegalAddressException - if the reference is invalid.

getInputRegisterCount

public int getInputRegisterCount()
Description copied from interface: ProcessImage
Returns the number of InputRegister instances in this ProcessImage.

Specified by:
getInputRegisterCount in interface ProcessImage
Returns:
the number of input registers as int.

getInputRegisterRange

public InputRegister[] getInputRegisterRange(int ref,
                                             int count)
Description copied from interface: ProcessImage
Returns a range of InputRegister instances.

Specified by:
getInputRegisterRange in interface ProcessImage
Parameters:
ref - the start offset.
count - the amount of InputRegister from the offset.
Returns:
an array of InputRegister instances.

addRegister

public void addRegister(Register reg)
Description copied from interface: ProcessImageImplementation
Adds a new Register instance.

Specified by:
addRegister in interface ProcessImageImplementation
Parameters:
reg - the Register instance to be added.

removeRegister

public void removeRegister(Register reg)
Description copied from interface: ProcessImageImplementation
Removes a given Register instance.

Specified by:
removeRegister in interface ProcessImageImplementation
Parameters:
reg - the Register instance to be removed.

setRegister

public void setRegister(int ref,
                        Register reg)
                 throws IllegalAddressException
Description copied from interface: ProcessImageImplementation
Sets a new Register instance at the given reference.

Specified by:
setRegister in interface ProcessImageImplementation
Parameters:
ref - the reference as int.
reg - the new Register instance to be set.
Throws:
IllegalAddressException - if the reference is invalid.

getRegister

public Register getRegister(int ref)
                     throws IllegalAddressException
Description copied from interface: ProcessImage
Returns the Register instance at the given reference.

Specified by:
getRegister in interface ProcessImage
Parameters:
ref - the reference.
Returns:
the Register instance at the given address.
Throws:
IllegalAddressException - if the reference is invalid.

getRegisterCount

public int getRegisterCount()
Description copied from interface: ProcessImage
Returns the number of Register instances in this ProcessImage.

Specified by:
getRegisterCount in interface ProcessImage
Returns:
the number of registers as int.

getRegisterRange

public Register[] getRegisterRange(int ref,
                                   int count)
Description copied from interface: ProcessImage
Returns a range of Register instances.

Specified by:
getRegisterRange in interface ProcessImage
Parameters:
ref - the start offset.
count - the amount of Register from the offset.
Returns:
an array of Register instances.


Copyright © 2010. All Rights Reserved.