Tabnine Logo
TimelineOpcode.getOpcodeIndex
Code IndexAdd Tabnine to your IDE (free)

How to use
getOpcodeIndex
method
in
com.ning.billing.meter.timeline.times.TimelineOpcode

Best Java code snippets using com.ning.billing.meter.timeline.times.TimelineOpcode.getOpcodeIndex (Showing top 10 results out of 315)

origin: com.ning.billing/killbill-meter

private void writeRepeatedDelta(final int delta, final int repeatCount, final DataOutputStream dataStream) throws IOException {
  if (repeatCount > 1) {
    if (repeatCount > MAX_BYTE_REPEAT_COUNT) {
      dataStream.writeByte(TimelineOpcode.REPEATED_DELTA_TIME_SHORT.getOpcodeIndex());
      dataStream.writeShort(repeatCount);
    } else if (repeatCount == 2) {
      dataStream.writeByte(delta);
    } else {
      dataStream.writeByte(TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex());
      dataStream.writeByte(repeatCount);
    }
  }
  dataStream.writeByte(delta);
}
origin: com.ning.billing/killbill-meter

  private void writeTime(final int lastTime, final int newTime, final DataOutputStream dataStream) throws IOException {
    if (newTime > lastTime) {
      final int delta = (newTime - lastTime);
      if (delta <= TimelineOpcode.MAX_DELTA_TIME) {
        dataStream.writeByte(delta);
      } else {
        dataStream.writeByte(TimelineOpcode.FULL_TIME.getOpcodeIndex());
        dataStream.writeInt(newTime);
      }
    } else if (newTime == lastTime) {
      dataStream.writeByte(0);
    }
  }
}
origin: com.ning.billing/killbill-meter

  return nextOpcode;
if (nextOpcode == TimelineOpcode.FULL_TIME.getOpcodeIndex()) {
  lastValue = timelineDataStream.readInt();
  byteCursor += 4;
} else if (nextOpcode == TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex()) {
  repeatCount = timelineDataStream.readUnsignedByte() - 1;
  delta = timelineDataStream.read();
  byteCursor += 2;
  lastValue += delta;
} else if (nextOpcode == TimelineOpcode.REPEATED_DELTA_TIME_SHORT.getOpcodeIndex()) {
  repeatCount = timelineDataStream.readUnsignedShort() - 1;
  delta = timelineDataStream.read();
origin: com.ning.billing/killbill-meter

int opcode;
while ((opcode = byteDataStream.read()) != -1) {
  if (opcode == TimelineOpcode.FULL_TIME.getOpcodeIndex()) {
    byteDataStream.readInt();
    count++;
  } else if (opcode <= TimelineOpcode.MAX_DELTA_TIME) {
    count++;
  } else if (opcode == TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex()) {
    count += byteDataStream.read();
  } else if (opcode == TimelineOpcode.REPEATED_DELTA_TIME_SHORT.getOpcodeIndex()) {
    count += byteDataStream.readUnsignedShort();
origin: com.ning.billing/killbill-meter

if (nextOpcode == TimelineOpcode.FULL_TIME.getOpcodeIndex()) {
  lastValue = timelineDataStream.readInt();
  byteCursor += 4;
  sampleNumber++;
} else if (nextOpcode == TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex()) {
  repeatCount = timelineDataStream.readUnsignedByte() - 1;
  delta = timelineDataStream.read();
  lastValue += delta;
  sampleNumber++;
} else if (nextOpcode == TimelineOpcode.REPEATED_DELTA_TIME_SHORT.getOpcodeIndex()) {
  repeatCount = timelineDataStream.readUnsignedShort() - 1;
  delta = timelineDataStream.read();
origin: com.ning.billing/killbill-meter

if (opcode == TimelineOpcode.FULL_TIME.getOpcodeIndex()) {
  lastTime = byteDataStream.readInt();
  dateTimeList.add(DateTimeUtils.dateTimeFromUnixSeconds(lastTime));
} else if (opcode == TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex()) {
  final int repeatCount = byteDataStream.readUnsignedByte();
  final int delta = byteDataStream.readUnsignedByte();
    dateTimeList.add(DateTimeUtils.dateTimeFromUnixSeconds(lastTime));
} else if (opcode == TimelineOpcode.REPEATED_DELTA_TIME_SHORT.getOpcodeIndex()) {
  final int repeatCount = byteDataStream.readUnsignedShort();
  final int delta = byteDataStream.readUnsignedByte();
origin: com.ning.billing/killbill-meter

  @Test(groups = "fast")
  public void testMaxDeltaTime() throws Exception {
    for (final TimelineOpcode opcode : TimelineOpcode.values()) {
      Assert.assertTrue(opcode.getOpcodeIndex() >= TimelineOpcode.MAX_DELTA_TIME);
    }
  }
}
origin: com.ning.billing/killbill-meter

boolean useNewDelta = false;
boolean nonDeltaTime = false;
if (opcode == TimelineOpcode.FULL_TIME.getOpcodeIndex()) {
  newTime = byteDataStream.readInt();
  if (newTime < lastTime) {
  useNewDelta = true;
  newCount = 1;
} else if (opcode == TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex()) {
  newCount = byteDataStream.read();
  newDelta = byteDataStream.read();
                           opcode, byteCursor, chunkCounter, new String(Hex.encodeHex(times))));
} else if (opcode == TimelineOpcode.REPEATED_DELTA_TIME_SHORT.getOpcodeIndex()) {
  newCount = byteDataStream.readUnsignedShort();
  newDelta = byteDataStream.read();
origin: com.ning.billing/killbill-meter

final byte[] compressedTimes2 = timelineCoder.compressDateTimes(unencodedTimes2);
Assert.assertEquals(compressedTimes1.length, 8);
Assert.assertEquals(compressedTimes1[0] & 0xff, TimelineOpcode.FULL_TIME.getOpcodeIndex());
Assert.assertEquals(compressedTimes1[5] & 0xff, TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex());
Assert.assertEquals(compressedTimes1[6] & 0xff, sampleCount - 1);
Assert.assertEquals(compressedTimes1[7] & 0xff, 100);
Assert.assertEquals(compressedTimes2.length, 8);
Assert.assertEquals(compressedTimes2[0] & 0xff, TimelineOpcode.FULL_TIME.getOpcodeIndex());
Assert.assertEquals(compressedTimes2[5] & 0xff, TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex());
Assert.assertEquals(compressedTimes2[6] & 0xff, sampleCount - 1);
Assert.assertEquals(compressedTimes2[7] & 0xff, 100);
final byte[] combinedTimes = timelineCoder.combineTimelines(timesList, null);
Assert.assertEquals(combinedTimes.length, 9);
Assert.assertEquals(combinedTimes[0] & 0xff, TimelineOpcode.FULL_TIME.getOpcodeIndex());
Assert.assertEquals(combinedTimes[5] & 0xff, TimelineOpcode.REPEATED_DELTA_TIME_SHORT.getOpcodeIndex());
Assert.assertEquals(combinedTimes[6] & 0xff, 1);
Assert.assertEquals(combinedTimes[7] & 0xff, sampleCount * 2 - 1 - 256);
origin: com.ning.billing/killbill-meter

final byte[] compressedTimes2 = timelineCoder.compressDateTimes(unencodedTimes2);
Assert.assertEquals(compressedTimes1.length, 8);
Assert.assertEquals(compressedTimes1[0] & 0xff, TimelineOpcode.FULL_TIME.getOpcodeIndex());
Assert.assertEquals(compressedTimes1[5] & 0xff, TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex());
Assert.assertEquals(compressedTimes1[6] & 0xff, 9);
Assert.assertEquals(compressedTimes1[7] & 0xff, 100);
Assert.assertEquals(compressedTimes2.length, 8);
Assert.assertEquals(compressedTimes2[0] & 0xff, TimelineOpcode.FULL_TIME.getOpcodeIndex());
Assert.assertEquals(compressedTimes2[5] & 0xff, TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex());
Assert.assertEquals(compressedTimes2[6] & 0xff, 9);
Assert.assertEquals(compressedTimes2[7] & 0xff, 100);
final byte[] combinedTimes = timelineCoder.combineTimelines(timesList, null);
Assert.assertEquals(combinedTimes.length, 8);
Assert.assertEquals(combinedTimes[0] & 0xff, TimelineOpcode.FULL_TIME.getOpcodeIndex());
Assert.assertEquals(combinedTimes[5] & 0xff, TimelineOpcode.REPEATED_DELTA_TIME_BYTE.getOpcodeIndex());
Assert.assertEquals(combinedTimes[6] & 0xff, 19);
Assert.assertEquals(combinedTimes[7] & 0xff, 100);
com.ning.billing.meter.timeline.timesTimelineOpcodegetOpcodeIndex

Popular methods of TimelineOpcode

  • values

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • JTable (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now