PhastEncoder { public static void copyInt(int[] intDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, int value, Boolean isOptional){ if (isOptional) { if (MOST_FREQUENT_CASE == (pmapHeader & bitMask)){ bitMask = bitMask << 1; if (MOST_FREQUENT_CASE == (pmapHeader & bitMask)) { writer.writePackedInt(intDictionary[idx]); } else { writer.writePackedInt(value); } } } else { if (MOST_FREQUENT_CASE == (pmapHeader & bitMask)) { } else { writer.writePackedInt(value); } } }  static long pmapBuilderLong(long pmap, int type, int oper, long curValue, long prevValue, long initValue, boolean isNull); static long pmapBuilderInt(long pmap, int type, int oper, int curValue, int prevValue, int initValue, boolean isNull); static long pmapBuilderString(long pmap, int token,  boolean isNull); static void encodeIntPresent(ChannelWriter writer, long pmapHeader, long bitMask, int value, Boolean isOptional); static void encodeDeltaInt(int[] intDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, int value, Boolean isOptional); static void encodeDeltaLong(long[] longDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, long value, Boolean isOptional); static void encodeString(ChannelWriter writer, StringBuilder value, long pmapHeader, long bitMask, Boolean isOptional); static void incrementInt(int[] intDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, Boolean isOptional); static void copyInt(int[] intDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, int value, Boolean isOptional); static void encodeDefaultInt(int[] defaultIntDictionary, ChannelWriter writer, long pmapHeader, long bitmask, int idx, int value, Boolean isOptional); static void encodeLongPresent(ChannelWriter writer, long pmapHeader, long bitMask, long value, Boolean isOptional); static void incrementLong(long[] longDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, Boolean isOptional); static void copyLong(long[] longDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, long value, Boolean isOptional); static void encodeDefaultLong(long[] defaultLongDictionary, ChannelWriter writer, long pmapHeader, long bitmask, int idx, long value, Boolean isOptional); static void encodeShortPresent(ChannelWriter writer, long pmapHeader, long bitMask, short value, Boolean isOptional); static void incrementShort(short[] shortDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, Boolean isOptional); static void copyShort(short[] shortDictionary, ChannelWriter writer, long pmapHeader, long bitMask, int idx, short value, Boolean isOptional); static void encodeDefaultShort(short[] defaultShortDictionary, ChannelWriter writer, long pmapHeader, long bitmask, int idx, short value, Boolean isOptional); static void encodeDeltaShort(short[] shortDictionary, ChannelWriter writer, long pmapHeader, int idx, long bitMask, short value, Boolean isOptional); static final int INCOMING_VARIABLE; static final long MOST_FREQUENT_CASE; static final long LEAST_FREQUENT_CASE; }
@Test public void copyIntTest() throws IOException{ Pipe<RawDataSchema> encodedValuesToValidate = new Pipe<RawDataSchema>(new PipeConfig<RawDataSchema>(RawDataSchema.instance, 100, 4000)); encodedValuesToValidate.initBuffers(); DataOutputBlobWriter<RawDataSchema> writer = new DataOutputBlobWriter<RawDataSchema>(encodedValuesToValidate); int[] intDictionary = new int[5]; Arrays.fill(intDictionary, 0); intDictionary[2] = 5; PhastEncoder.copyInt(intDictionary, writer, 0, 0, 2, 0, false); writer.close(); }