Package com.addthis.bundle.value

Examples of com.addthis.bundle.value.ValueObject


            @Override
            public boolean hasNext() {
                while (peek == null && iter.hasNext()) {
                    BundleField next = iter.next();
                    ValueObject value = getRawValue(next);
                    if (value == skip) {
                        continue;
                    }
                    peek = next;
                    break;
View Full Code Here


        };
    }

    @Override
    public ValueObject getValue(BundleField field) throws BundleException {
        ValueObject value = getRawValue(field);
        if (value == skip) {
            value = null;
        }
        return value;
    }
View Full Code Here

            Integer index = field.getIndex();
            if (index != null) {
                while (bundle.size() <= index) {
                    bundle.add(skip);
                }
                ValueObject prev = bundle.set(index, value);
                if (prev == skip) {
                    count++;
                }
            }
        }
View Full Code Here

            for (int i = 0; i < field.length; i++) {
                fieldRight[i] = formatRight.getField(field[i]);
            }
        }
        for (int i = 0; i < field.length; i++) {
            final ValueObject vLeft = left.getValue(fieldLeft[i]);
            final ValueObject vRight = right.getValue(fieldRight[i]);
            boolean asc = ascending == null || ascending[i];
            if (vLeft == vRight) {
                continue;
            }
            if (vLeft == null) {
                return asc ? 1 : -1;
            }
            if (vRight == null) {
                return asc ? -1 : 1;
            }
            final ValueObject.TYPE tLeft = vLeft.getObjectType();
            final ValueObject.TYPE tRight = vRight.getObjectType();
            if (tLeft != tRight || tLeft == ValueObject.TYPE.STRING) {
                final int val = vLeft.toString().compareTo(vRight.toString());
                if (val != 0) {
                    return asc ? val : -val;
                } else {
                    continue;
                }
            }
            int val = defaultValue;
            switch (tLeft) {
                case FLOAT:
                    final double vl = vLeft.asDouble().getDouble();
                    final double vr = vRight.asDouble().getDouble();
                    if (vl != vr) {
                        val = vl > vr ? 1 : -1;
                    }
                    break;
                case INT:
                    final long il = vLeft.asLong().getLong();
                    final long ir = vRight.asLong().getLong();
                    if (il != ir) {
                        val = il > ir ? 1 : -1;
                    }
                    break;
            }
View Full Code Here

            for (int i = 0; i < field.length; i++) {
                fieldRight[i] = formatRight.getField(field[i]);
            }
        }
        for (int i = 0; i < field.length; i++) {
            final ValueObject vLeft = left.getValue(fieldLeft[i]);
            final ValueObject vRight = right.getValue(fieldRight[i]);
            boolean asc = ascending == null || ascending[i];
            if (vLeft == vRight) {
                continue;
            }
            if (vLeft == null) {
                return asc ? 1 : -1;
            }
            if (vRight == null) {
                return asc ? -1 : 1;
            }
            final ValueObject.TYPE tLeft = vLeft.getObjectType();
            final ValueObject.TYPE tRight = vRight.getObjectType();
            if (tLeft != tRight || tLeft == ValueObject.TYPE.STRING) {
                final int val = vLeft.toString().compareTo(vRight.toString());
                if (val != 0) {
                    return asc ? val : -val;
                } else {
                    continue;
                }
            }
            int val = defaultValue;
            switch (tLeft) {
                case FLOAT:
                    final double vl = vLeft.asDouble().getDouble();
                    final double vr = vRight.asDouble().getDouble();
                    if (vl != vr) {
                        val = vl > vr ? 1 : -1;
                    }
                    break;
                case INT:
                    final long il = vLeft.asLong().getLong();
                    final long ir = vRight.asLong().getLong();
                    if (il != ir) {
                        val = il > ir ? 1 : -1;
                    }
                    break;
            }
View Full Code Here

        builder.append("{");
        Iterator<BundleField> iterator = bundle.iterator();
        while (iterator.hasNext()) {
            BundleField field = iterator.next();
            String fieldName = field.getName();
            ValueObject value = bundle.getValue(field);
            String formatValue = printValueObject(value);
            builder.append("\"");
            builder.append(fieldName);
            builder.append("\" = ");
            builder.append(formatValue);
View Full Code Here

            @Override
            public boolean hasNext() {
                while (peek == null && iter.hasNext()) {
                    BundleField next = iter.next();
                    ValueObject value = getRawValue(next);
                    if (value == SKIP) {
                        continue;
                    }
                    peek = next;
                    break;
View Full Code Here

        };
    }

    @Override
    public ValueObject getValue(BundleField field) throws BundleException {
        ValueObject value = getRawValue(field);
        if (value == SKIP) {
            return null;
        }
        return value;
    }
View Full Code Here

            Integer index = field.getIndex();
            if (index != null) {
                while (bundle.size() <= index) {
                    bundle.add(SKIP);
                }
                ValueObject prev = bundle.set(index, value);
                if (prev == SKIP) {
                    count++;
                }
            }
        }
View Full Code Here

                Bytes.writeString(field.getName(), out);
            } else {
                out.write(TYPE.BUNDLE_FIELD_INDEX.val);
                Bytes.writeLength(fieldIndex, out);
            }
            ValueObject val = row.getValue(field);
            encodeValue(val, out, classMap);
        }
        out.write(TYPE.BUNDLE_END.val);
    }
View Full Code Here

TOP

Related Classes of com.addthis.bundle.value.ValueObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.