test_class.declarator: DEFAULT_SEQUENCE_BITS = 12L
test_class.modifier: private static final
test_class.original_string: private static final long DEFAULT_SEQUENCE_BITS = 12L;
test_class.type: long
test_class.var_name: DEFAULT_SEQUENCE_BITS
test_class.declarator: DEFAULT_KEY_AMOUNT = 10
test_class.modifier: private static final
test_class.original_string: private static final int DEFAULT_KEY_AMOUNT = 10;
test_class.type: int
test_class.var_name: DEFAULT_KEY_AMOUNT
test_class.file: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithmTest.java
test_class.identifier: SnowflakeKeyGenerateAlgorithmTest
test_case.body: @Test
      public void assertSetWorkerIdSuccess() throws NoSuchFieldException, IllegalAccessException {
          SnowflakeKeyGenerateAlgorithm keyGenerateAlgorithm = new SnowflakeKeyGenerateAlgorithm();
          Properties props = new Properties();
          props.setProperty("worker-id", String.valueOf(1L));
          keyGenerateAlgorithm.setProps(props);
          keyGenerateAlgorithm.init();
          Field field = keyGenerateAlgorithm.getClass().getDeclaredField("props");
          field.setAccessible(true);
          assertThat(((Properties) field.get(keyGenerateAlgorithm)).getProperty("worker-id"), is("1"));
      }
test_case.class_method_signature: SnowflakeKeyGenerateAlgorithmTest.assertSetWorkerIdSuccess()
test_case.full_signature: @Test public void assertSetWorkerIdSuccess()
test_case.identifier: assertSetWorkerIdSuccess
test_case.invocations: setProperty valueOf setProps init getDeclaredField getClass setAccessible assertThat getProperty get is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertSetWorkerIdSuccess()
focal_class.declarator: EPOCH
focal_class.modifier: public static final
focal_class.original_string: public static final long EPOCH;
focal_class.type: long
focal_class.var_name: EPOCH
focal_class.declarator: WORKER_ID_KEY = "worker-id"
focal_class.modifier: private static final
focal_class.original_string: private static final String WORKER_ID_KEY = "worker-id";
focal_class.type: String
focal_class.var_name: WORKER_ID_KEY
focal_class.declarator: MAX_VIBRATION_OFFSET_KEY = "max-vibration-offset"
focal_class.modifier: private static final
focal_class.original_string: private static final String MAX_VIBRATION_OFFSET_KEY = "max-vibration-offset";
focal_class.type: String
focal_class.var_name: MAX_VIBRATION_OFFSET_KEY
focal_class.declarator: MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS_KEY = "max-tolerate-time-difference-milliseconds"
focal_class.modifier: private static final
focal_class.original_string: private static final String MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS_KEY = "max-tolerate-time-difference-milliseconds";
focal_class.type: String
focal_class.var_name: MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS_KEY
focal_class.declarator: SEQUENCE_BITS = 12L
focal_class.modifier: private static final
focal_class.original_string: private static final long SEQUENCE_BITS = 12L;
focal_class.type: long
focal_class.var_name: SEQUENCE_BITS
focal_class.declarator: WORKER_ID_BITS = 10L
focal_class.modifier: private static final
focal_class.original_string: private static final long WORKER_ID_BITS = 10L;
focal_class.type: long
focal_class.var_name: WORKER_ID_BITS
focal_class.declarator: SEQUENCE_MASK = (1 << SEQUENCE_BITS) - 1
focal_class.modifier: private static final
focal_class.original_string: private static final long SEQUENCE_MASK = (1 << SEQUENCE_BITS) - 1;
focal_class.type: long
focal_class.var_name: SEQUENCE_MASK
focal_class.declarator: WORKER_ID_LEFT_SHIFT_BITS = SEQUENCE_BITS
focal_class.modifier: private static final
focal_class.original_string: private static final long WORKER_ID_LEFT_SHIFT_BITS = SEQUENCE_BITS;
focal_class.type: long
focal_class.var_name: WORKER_ID_LEFT_SHIFT_BITS
focal_class.declarator: TIMESTAMP_LEFT_SHIFT_BITS = WORKER_ID_LEFT_SHIFT_BITS + WORKER_ID_BITS
focal_class.modifier: private static final
focal_class.original_string: private static final long TIMESTAMP_LEFT_SHIFT_BITS = WORKER_ID_LEFT_SHIFT_BITS + WORKER_ID_BITS;
focal_class.type: long
focal_class.var_name: TIMESTAMP_LEFT_SHIFT_BITS
focal_class.declarator: WORKER_ID_MAX_VALUE = 1L << WORKER_ID_BITS
focal_class.modifier: private static final
focal_class.original_string: private static final long WORKER_ID_MAX_VALUE = 1L << WORKER_ID_BITS;
focal_class.type: long
focal_class.var_name: WORKER_ID_MAX_VALUE
focal_class.declarator: WORKER_ID = 0
focal_class.modifier: private static final
focal_class.original_string: private static final long WORKER_ID = 0;
focal_class.type: long
focal_class.var_name: WORKER_ID
focal_class.declarator: DEFAULT_VIBRATION_VALUE = 1
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_VIBRATION_VALUE = 1;
focal_class.type: int
focal_class.var_name: DEFAULT_VIBRATION_VALUE
focal_class.declarator: MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS = 10
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS = 10;
focal_class.type: int
focal_class.var_name: MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS
focal_class.declarator: timeService = new TimeService()
focal_class.modifier: @Setter
      private static
focal_class.original_string: @Setter
      private static TimeService timeService = new TimeService();
focal_class.type: TimeService
focal_class.var_name: timeService
focal_class.declarator: props = new Properties()
focal_class.modifier: @Getter
      @Setter
      private
focal_class.original_string: @Getter
      @Setter
      private Properties props = new Properties();
focal_class.type: Properties
focal_class.var_name: props
focal_class.declarator: workerId
focal_class.modifier: private
focal_class.original_string: private long workerId;
focal_class.type: long
focal_class.var_name: workerId
focal_class.declarator: maxVibrationOffset
focal_class.modifier: private
focal_class.original_string: private int maxVibrationOffset;
focal_class.type: int
focal_class.var_name: maxVibrationOffset
focal_class.declarator: maxTolerateTimeDifferenceMilliseconds
focal_class.modifier: private
focal_class.original_string: private int maxTolerateTimeDifferenceMilliseconds;
focal_class.type: int
focal_class.var_name: maxTolerateTimeDifferenceMilliseconds
focal_class.declarator: sequenceOffset = -1
focal_class.modifier: private
focal_class.original_string: private int sequenceOffset = -1;
focal_class.type: int
focal_class.var_name: sequenceOffset
focal_class.declarator: sequence
focal_class.modifier: private
focal_class.original_string: private long sequence;
focal_class.type: long
focal_class.var_name: sequence
focal_class.declarator: lastMilliseconds
focal_class.modifier: private
focal_class.original_string: private long lastMilliseconds;
focal_class.type: long
focal_class.var_name: lastMilliseconds
focal_class.file: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
focal_class.identifier: SnowflakeKeyGenerateAlgorithm
focal_class.interfaces: implements KeyGenerateAlgorithm
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.init()
focal_class.full_signature: @Override public void init()
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.getWorkerId()
focal_class.full_signature: private long getWorkerId()
focal_class.identifier: getWorkerId
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getWorkerId()
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.getMaxVibrationOffset()
focal_class.full_signature: private int getMaxVibrationOffset()
focal_class.identifier: getMaxVibrationOffset
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getMaxVibrationOffset()
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.getMaxTolerateTimeDifferenceMilliseconds()
focal_class.full_signature: private int getMaxTolerateTimeDifferenceMilliseconds()
focal_class.identifier: getMaxTolerateTimeDifferenceMilliseconds
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getMaxTolerateTimeDifferenceMilliseconds()
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.generateKey()
focal_class.full_signature: @Override public synchronized Comparable<?> generateKey()
focal_class.identifier: generateKey
focal_class.modifiers: @Override public synchronized
focal_class.parameters: ()
focal_class.return: Comparable<?>
focal_class.signature: Comparable<?> generateKey()
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.waitTolerateTimeDifferenceIfNeed(final long currentMilliseconds)
focal_class.full_signature: @SneakyThrows(InterruptedException.class) private boolean waitTolerateTimeDifferenceIfNeed(final long currentMilliseconds)
focal_class.identifier: waitTolerateTimeDifferenceIfNeed
focal_class.modifiers: @SneakyThrows(InterruptedException.class) private
focal_class.parameters: (final long currentMilliseconds)
focal_class.return: boolean
focal_class.signature: boolean waitTolerateTimeDifferenceIfNeed(final long currentMilliseconds)
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.waitUntilNextTime(final long lastTime)
focal_class.full_signature: private long waitUntilNextTime(final long lastTime)
focal_class.identifier: waitUntilNextTime
focal_class.modifiers: private
focal_class.parameters: (final long lastTime)
focal_class.return: long
focal_class.signature: long waitUntilNextTime(final long lastTime)
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.vibrateSequenceOffset()
focal_class.full_signature: private void vibrateSequenceOffset()
focal_class.identifier: vibrateSequenceOffset
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void vibrateSequenceOffset()
focal_class.class_method_signature: SnowflakeKeyGenerateAlgorithm.getType()
focal_class.full_signature: @Override public String getType()
focal_class.identifier: getType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getType()
focal_method.body: @Override
      public void init() {
          workerId = getWorkerId();
          maxVibrationOffset = getMaxVibrationOffset();
          maxTolerateTimeDifferenceMilliseconds = getMaxTolerateTimeDifferenceMilliseconds();
      }
focal_method.class_method_signature: SnowflakeKeyGenerateAlgorithm.init()
focal_method.full_signature: @Override public void init()
focal_method.identifier: init
focal_method.invocations: getWorkerId getMaxVibrationOffset getMaxTolerateTimeDifferenceMilliseconds
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void init()