com.solab.iso8583.impl
Class SimpleTraceGenerator

java.lang.Object
  extended by com.solab.iso8583.impl.SimpleTraceGenerator
All Implemented Interfaces:
TraceNumberGenerator

public class SimpleTraceGenerator
extends Object
implements TraceNumberGenerator

Simple implementation of a TraceNumberGenerator with an internal number that is increased in memory but is not stored anywhere.

Author:
Enrique Zamudio

Constructor Summary
SimpleTraceGenerator(int initialValue)
          Creates a new instance that will use the specified initial value.
 
Method Summary
 int getLastTrace()
          Returns the last number that was generated.
 int nextTrace()
          Returns the next number in the sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTraceGenerator

public SimpleTraceGenerator(int initialValue)
Creates a new instance that will use the specified initial value. This means the first nextTrace() call will return this number.

Parameters:
initialValue - a number between 1 and 999999.
Throws:
IllegalArgumentException - if the number is less than 1 or greater than 999999.
Method Detail

getLastTrace

public int getLastTrace()
Description copied from interface: TraceNumberGenerator
Returns the last number that was generated.

Specified by:
getLastTrace in interface TraceNumberGenerator

nextTrace

public int nextTrace()
Returns the next number in the sequence. This method is synchronized, because the counter is incremented in memory only.

Specified by:
nextTrace in interface TraceNumberGenerator