@Override public int compareTo(byte[] bytes, int start, int length) { boolean b = getBoolean(); boolean ob = getBoolean(bytes, start); return b == ob ? 0 : (b ? 1 : -1); }
public void setBoolean(boolean value) { if (bytes == null) { start = 0; length = TYPE_TRAITS.getFixedLength(); bytes = new byte[length]; } setBoolean(bytes, start, value); }
@Override public boolean operateBooleanBoolean(BooleanPointable boolp1, BooleanPointable boolp2) throws SystemException, IOException { return (boolp1.compareTo(boolp2) == -1); }
public BooleanPointable createPointable(boolean value) { BooleanPointable pointable = new BooleanPointable(); pointable.setBoolean(value); return pointable; }
@Override public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException { dOut.write(ValueTag.XS_BOOLEAN_TAG); dOut.write(boolp.getByteArray(), boolp.getStartOffset(), boolp.getLength()); }
@Override public BooleanPointable createPointable() { return new BooleanPointable(); }
@Override public int hash(byte[] bytes, int offset, int length) { boolean v = BooleanPointable.getBoolean(bytes, offset); return v ? 1 : 0; } };
@Override public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException { eval1.evaluate(tuple, p); int v1 = IntegerPointable.getInteger(p.getByteArray(), p.getStartOffset()); eval2.evaluate(tuple, p); int v2 = IntegerPointable.getInteger(p.getByteArray(), p.getStartOffset()); BooleanPointable.setBoolean(rBytes, 0, v1 > v2); result.set(rBytes, 0, 1); } };
@Override public boolean operateBooleanBoolean(BooleanPointable boolp1, BooleanPointable boolp2) throws SystemException, IOException { return (boolp1.compareTo(boolp2) == 0); }
public static boolean getBoolean(byte[] bytes, int offset) { return BooleanPointable.getBoolean(bytes, offset); } }
@Override public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException { eval1.evaluate(tuple, p); int v1 = IntegerPointable.getInteger(p.getByteArray(), p.getStartOffset()); eval2.evaluate(tuple, p); int v2 = IntegerPointable.getInteger(p.getByteArray(), p.getStartOffset()); BooleanPointable.setBoolean(rBytes, 0, v1 == v2); result.set(rBytes, 0, 1); } };
@Override public int compareTo(IPointable pointer) { return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength()); }
public boolean getBoolean() { return getBoolean(bytes, start); }
@Override public byte[] getByteArray() { if (binaryFilter.getLength() == 0) { int binarySize = 2; if (min.getLength() > 0) { binarySize += Integer.BYTES + min.getLength(); } if (max.getLength() > 0) { binarySize += Integer.BYTES + max.getLength(); } binaryFilter.setSize(binarySize); byte[] buf = binaryFilter.getByteArray(); BooleanPointable.setBoolean(buf, MIN_SET_INDICATOR_OFFSET, min.getLength() > 0); BooleanPointable.setBoolean(buf, MAX_SET_INDICATOR_OFFSET, max.getLength() > 0); int offset = 2; if (min.getLength() > 0) { IntegerPointable.setInteger(buf, offset, min.getLength()); offset += Integer.BYTES; System.arraycopy(min.getByteArray(), 0, buf, offset, min.getLength()); offset += min.getLength(); } if (max.getLength() > 0) { IntegerPointable.setInteger(buf, offset, max.getLength()); offset += Integer.BYTES; System.arraycopy(max.getByteArray(), 0, buf, offset, max.getLength()); } } return binaryFilter.getByteArray(); }
@Override public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException { dOut.write(returnTag); dOut.writeLong((long) (boolp.getBoolean() ? 1 : 0)); }
@Override public int hash() { return getBoolean() ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode(); } }
@Override public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException { dOut.write(returnTag); dOut.writeInt((int) (boolp.getBoolean() ? 1 : 0)); }
@Override public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException { dOut.write(returnTag); dOut.writeShort((short) (boolp.getBoolean() ? 1 : 0)); }
@Override public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException { double value = (boolp.getBoolean() ? 1 : 0); dOut.write(ValueTag.XS_DOUBLE_TAG); dOut.writeDouble(value); }
@Override public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException { float value = (boolp.getBoolean() ? 1 : 0); dOut.write(ValueTag.XS_FLOAT_TAG); dOut.writeFloat(value); }