// Path: src/main/java/sleet/SleetException.java
// public class SleetException extends Exception {
// 
//   /**
//    * generated by eclipse
//    */
//   private static final long serialVersionUID = -404982431470350032L;
// 
//   public SleetException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
//   public SleetException(String message) {
//     super(message);
//   }
// 
//   public SleetException(Throwable cause) {
//     super(cause);
//   }
// 
// }
// 
// Path: src/main/java/sleet/generators/GeneratorConfigException.java
// public class GeneratorConfigException extends GeneratorException {
//   /**
//    * generated by eclipse
//    */
//   private static final long serialVersionUID = -2894157024668803650L;
// 
//   public GeneratorConfigException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
//   public GeneratorConfigException(String message) {
//     super(message);
//   }
// 
//   public GeneratorConfigException(Throwable cause) {
//     super(cause);
//   }
// 
// }
// 
// Path: src/main/java/sleet/generators/GeneratorSessionException.java
// public class GeneratorSessionException extends GeneratorException {
//   /**
//    * generated by eclipse
//    */
// 
//   private static final long serialVersionUID = -5663201042060915360L;
// 
//   public GeneratorSessionException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
//   public GeneratorSessionException(String message) {
//     super(message);
//   }
// 
//   public GeneratorSessionException(Throwable cause) {
//     super(cause);
//   }
// 
// }
// 
// Path: src/main/java/sleet/generators/IdGenerator.java
// public interface IdGenerator<T extends IdType<?, ?>> {
//   public void beginIdSession(Properties config) throws SleetException;
// 
//   public void checkSessionValidity() throws SleetException;
// 
//   public void endIdSession() throws SleetException;
// 
//   public IdType<?, ?> getId(List<IdState<?, ?>> states) throws SleetException;
// }
// 
// Path: src/main/java/sleet/id/LongId.java
// public class LongId implements LongIdType {
//   private final long value;
//   private final int numBits;
//   private final IdError error;
// 
//   public LongId(long value, IdError error, int numBits) {
//     this.value = value;
//     this.error = error;
//     this.numBits = numBits;
//   }
// 
//   @Override
//   public Long getId() {
//     return this.value;
//   }
// 
//   @Override
//   public IdError getError() {
//     return this.error;
//   }
// 
//   @Override
//   public int getNumBitsInId() {
//     return this.numBits;
//   }
// 
// }
// 
// Path: src/main/java/sleet/id/LongIdType.java
// public interface LongIdType extends IdType<Long, IdError> {
// 
// }
// 
// Path: src/main/java/sleet/id/TimeIdType.java
// public interface TimeIdType extends IdType<Long, TimeIdError> {
// 
// }
// 
// Path: src/main/java/sleet/state/IdState.java
// public class IdState<T, E extends IdError> {
//   private Class<? extends IdGenerator<? extends IdType<T, E>>> generatorClass;
//   private IdType<T, E> id;
// 
//   public IdState(Class<? extends IdGenerator<? extends IdType<T, E>>> generatorClass, IdType<T, E> id) {
//     this.generatorClass = generatorClass;
//     this.id = id;
//   }
// 
//   public Class<? extends IdGenerator<? extends IdType<T, E>>> getGeneratorClass() {
//     return generatorClass;
//   }
// 
//   public IdType<T, E> getId() {
//     return id;
//   }
// }


import java.util.List;
import java.util.Properties;
import sleet.SleetException;
import sleet.generators.GeneratorConfigException;
import sleet.generators.GeneratorSessionException;
import sleet.generators.IdGenerator;
import sleet.id.LongId;
import sleet.id.LongIdType;
import sleet.id.TimeIdType;
import sleet.state.IdState;
          throw new TimeDependencyException(this.getClass().getName() + " depends on there being a single preceeding TimeIdType id, but found at least two.");
        }
      }
    }
    if (timeIdType == null) {
      throw new TimeDependencyException(this.getClass().getName() + " depends on there being a single preceeding TimeIdType id, but found none.");
    }

    long currentTimeValue = timeIdType.getId();
    long returnValue = -1;
    if (currentTimeValue < this.lastTimeValue) {
      return new LongId(-1, new TimeIdReverseSkewError(this.getClass().getName()
          + " depends on the preceeding id generator which generated the TimeIdType to guard against the TimeIdType values decreasing over time"), this.bits);
    } else if (currentTimeValue == this.lastTimeValue) {
      if (this.sequenceValue > this.maxSequenceValue || this.sequenceValue < 0) {
        return new LongId(-1, new SequenceIdOverflowError(this.getClass().getName()
            + " overflowed the maximum sequence value when allocating a sequence id for time value \"" + currentTimeValue + "\"."), this.bits);
      } else {
        returnValue = this.sequenceValue;
        this.sequenceValue++;
      }
    } else {
      this.sequenceValue = 0;
      returnValue = this.sequenceValue;
      this.sequenceValue++;
    }
    this.lastTimeValue = currentTimeValue;
    return new LongId(returnValue, null, this.bits);
  }

// Path: src/main/java/sleet/SleetException.java
// public class SleetException extends Exception {
// 
//   /**
//    * generated by eclipse
//    */
//   private static final long serialVersionUID = -404982431470350032L;
// 
//   public SleetException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
//   public SleetException(String message) {
//     super(message);
//   }
// 
//   public SleetException(Throwable cause) {
//     super(cause);
//   }
// 
// }
// 
// Path: src/main/java/sleet/generators/GeneratorConfigException.java
// public class GeneratorConfigException extends GeneratorException {
//   /**
//    * generated by eclipse
//    */
//   private static final long serialVersionUID = -2894157024668803650L;
// 
//   public GeneratorConfigException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
//   public GeneratorConfigException(String message) {
//     super(message);
//   }
// 
//   public GeneratorConfigException(Throwable cause) {
//     super(cause);
//   }
// 
// }
// 
// Path: src/main/java/sleet/generators/GeneratorSessionException.java
// public class GeneratorSessionException extends GeneratorException {
//   /**
//    * generated by eclipse
//    */
// 
//   private static final long serialVersionUID = -5663201042060915360L;
// 
//   public GeneratorSessionException(String message, Throwable cause) {
//     super(message, cause);
//   }
// 
//   public GeneratorSessionException(String message) {
//     super(message);
//   }
// 
//   public GeneratorSessionException(Throwable cause) {
//     super(cause);
//   }
// 
// }
// 
// Path: src/main/java/sleet/generators/IdGenerator.java
// public interface IdGenerator<T extends IdType<?, ?>> {
//   public void beginIdSession(Properties config) throws SleetException;
// 
//   public void checkSessionValidity() throws SleetException;
// 
//   public void endIdSession() throws SleetException;
// 
//   public IdType<?, ?> getId(List<IdState<?, ?>> states) throws SleetException;
// }
// 
// Path: src/main/java/sleet/id/LongId.java
// public class LongId implements LongIdType {
//   private final long value;
//   private final int numBits;
//   private final IdError error;
// 
//   public LongId(long value, IdError error, int numBits) {
//     this.value = value;
//     this.error = error;
//     this.numBits = numBits;
//   }
// 
//   @Override
//   public Long getId() {
//     return this.value;
//   }
// 
//   @Override
//   public IdError getError() {
//     return this.error;
//   }
// 
//   @Override
//   public int getNumBitsInId() {
//     return this.numBits;
//   }
// 
// }
// 
// Path: src/main/java/sleet/id/LongIdType.java
// public interface LongIdType extends IdType<Long, IdError> {
// 
// }
// 
// Path: src/main/java/sleet/id/TimeIdType.java
// public interface TimeIdType extends IdType<Long, TimeIdError> {
// 
// }
// 
// Path: src/main/java/sleet/state/IdState.java
// public class IdState<T, E extends IdError> {
//   private Class<? extends IdGenerator<? extends IdType<T, E>>> generatorClass;
//   private IdType<T, E> id;
// 
//   public IdState(Class<? extends IdGenerator<? extends IdType<T, E>>> generatorClass, IdType<T, E> id) {
//     this.generatorClass = generatorClass;
//     this.id = id;
//   }
// 
//   public Class<? extends IdGenerator<? extends IdType<T, E>>> getGeneratorClass() {
//     return generatorClass;
//   }
// 
//   public IdType<T, E> getId() {
//     return id;
//   }
// }


// Path: src/main/java/sleet/generators/time/TimeDependentSequenceIdGenerator.java
import java.util.List;
import java.util.Properties;
import sleet.SleetException;
import sleet.generators.GeneratorConfigException;
import sleet.generators.GeneratorSessionException;
import sleet.generators.IdGenerator;
import sleet.id.LongId;
import sleet.id.LongIdType;
import sleet.id.TimeIdType;
import sleet.state.IdState;

          throw new TimeDependencyException(this.getClass().getName() + " depends on there being a single preceeding TimeIdType id, but found at least two.");
        }
      }
    }
    if (timeIdType == null) {
      throw new TimeDependencyException(this.getClass().getName() + " depends on there being a single preceeding TimeIdType id, but found none.");
    }

    long currentTimeValue = timeIdType.getId();
    long returnValue = -1;
    if (currentTimeValue < this.lastTimeValue) {
      return new LongId(-1, new TimeIdReverseSkewError(this.getClass().getName()
          + " depends on the preceeding id generator which generated the TimeIdType to guard against the TimeIdType values decreasing over time"), this.bits);
    } else if (currentTimeValue == this.lastTimeValue) {
      if (this.sequenceValue > this.maxSequenceValue || this.sequenceValue < 0) {
        return new LongId(-1, new SequenceIdOverflowError(this.getClass().getName()
            + " overflowed the maximum sequence value when allocating a sequence id for time value \"" + currentTimeValue + "\"."), this.bits);
      } else {
        returnValue = this.sequenceValue;
        this.sequenceValue++;
      }
    } else {
      this.sequenceValue = 0;
      returnValue = this.sequenceValue;
      this.sequenceValue++;
    }
    this.lastTimeValue = currentTimeValue;
    return new LongId(returnValue, null, this.bits);
  }

  private void validateSessionStarted() throws GeneratorSessionException {