org.opentripplanner.routing.util.IncrementingIdGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.routing.util;
/**
* Generates unique identifiers by incrementing an internal counter.
*
* @author avi
*/
public class IncrementingIdGenerator implements UniqueIdGenerator {
private int next;
public IncrementingIdGenerator() {
this(0);
}
/**
* Construct with a starting counter.
*
* First call to next() will return start.
*
* @param start
*/
public IncrementingIdGenerator(int start) {
next = start;
}
/**
* Generates the next identifier.
*
* @return
*/
public int getId(T elem) {
return next++;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy