Package com.asakusafw.runtime.value

Examples of com.asakusafw.runtime.value.IntOption


     * @throws Exception テストに失敗した場合
     */
    @Test
    public void copy() throws Exception {
        LookUpKey k1 = new LookUpKey();
        k1.add(new IntOption(100));

        LookUpKey k2 = k1.copy();
        k2.add(new IntOption(200));

        LookUpKey k3 = new LookUpKey();
        k3.add(new IntOption(100));
        k3.add(new IntOption(200));

        assertThat(k1.equals(k2), is(false));
        assertThat(k2.equals(k3), is(true));
        assertThat(k2.hashCode(), is(k3.hashCode()));
    }
View Full Code Here


     * @throws Exception テストに失敗した場合
     */
    @Test
    public void reset() throws Exception {
        LookUpKey k1 = new LookUpKey();
        k1.add(new IntOption(100));
        k1.reset();
        k1.add(new IntOption(200));

        LookUpKey k2 = new LookUpKey();
        k2.add(new IntOption(200));

        assertThat(k1.equals(k2), is(true));
        assertThat(k1.hashCode(), is(k2.hashCode()));
    }
View Full Code Here

        slots.put("1", createWithInt(1));
        slots.put("min", createWithInt(Integer.MIN_VALUE));
        slots.put("max", createWithInt(Integer.MAX_VALUE));
        slots.put("null", createWithInt(null));
        slots.put("0.1", createWithInt(0));
        slots.get("0.1").add(new IntOption(1));

        List<SortableSlot> copy = new ArrayList<SortableSlot>(slots.values());
        Collections.sort(copy);

        assertThat(copy.get(0), is(slots.get("null")));
View Full Code Here

    }

    private SortableSlot createWithInt(Integer value) throws IOException {
        SortableSlot slot = new SortableSlot();
        slot.begin(0);
        IntOption option;
        if (value == null) {
            option = new IntOption();
        } else {
            option = new IntOption(value);
        }
        slot.add(option);
        return slot;
    }
View Full Code Here

        int[] partitionMemberCount = new int[partitions];
        for (int i = 0; i < partitions; i++) {
            for (int j = 0; j < records; j++) {
                SortableSlot slot = new SortableSlot();
                slot.begin(i);
                slot.add(new IntOption(j));

                int partition = partitioner.getPartition(slot, null, partitions);
                partitionMemberCount[partition]++;

                // パーティションの切り替わりをカウントする
View Full Code Here

     */
    @SuppressWarnings("deprecation")
    @Test
    public void loadStore() throws Exception {
        WritableSlot slot = new WritableSlot();
        IntOption value = new IntOption(100);
        IntOption copy = new IntOption();

        slot.store(value);
        slot.loadTo(copy);
        assertThat(copy, is(value));

View Full Code Here

     */
    @SuppressWarnings("deprecation")
    @Test
    public void writable() throws Exception {
        WritableSlot slot = new WritableSlot();
        IntOption value = new IntOption(100);
        IntOption copy = new IntOption(200);

        slot.store(value);
        WritableSlot restored1 = restore(slot);
        restored1.loadTo(copy);
        assertThat(copy, is(value));
View Full Code Here

     * intの値を出力するテスト。
     * @throws Exception 例外が発生した場合
     */
    @Test
    public void emitInt() throws Exception {
        IntOption value = new IntOption();

        value.modify(0);
        emitter.emit(value);
        value.modify(10);
        emitter.emit(value);
        value.modify(-10);
        emitter.emit(value);
        emitter.endRecord();

        value.setNull();
        emitter.emit(value);
        value.modify(Integer.MAX_VALUE);
        emitter.emit(value);
        value.modify(Integer.MIN_VALUE);
        emitter.emit(value);
        emitter.endRecord();

        emitter.close();

        RecordParser parser = parser();
        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(0));
        parser.fill(value);
        assertThat(value.get(), is(10));
        parser.fill(value);
        assertThat(value.get(), is(-10));

        assertThat(parser.next(), is(true));
        parser.fill(value);
        assertThat(value.isNull(), is(true));
        parser.fill(value);
        assertThat(value.get(), is(Integer.MAX_VALUE));
        parser.fill(value);
        assertThat(value.get(), is(Integer.MIN_VALUE));

        assertThat(parser.next(), is(false));
    }
View Full Code Here

                } else {
                    ps.setLong(parameterIndex, longOption.get());
                }
                break;
            case INT:
                IntOption intOption = (IntOption) vo;
                if (intOption.isNull()) {
                    ps.setNull(parameterIndex, Types.INTEGER);
                } else {
                    ps.setInt(parameterIndex, intOption.get());
                }
                break;
            case SMALL_INT:
                ShortOption shortOption = (ShortOption) vo;
                if (shortOption.isNull()) {
View Full Code Here

                    longOption.modify(l);
                }
                modelClass.getMethod(name, LongOption.class).invoke(model, longOption);
                break;
            case INT:
                IntOption intOption = new IntOption();
                int i = rs.getInt(columnIndex);
                if (rs.wasNull()) {
                    intOption.setNull();
                } else {
                    intOption.modify(i);
                }
                modelClass.getMethod(name, IntOption.class).invoke(model, intOption);
                break;
            case SMALL_INT:
                ShortOption shortOption = new ShortOption();
View Full Code Here

TOP

Related Classes of com.asakusafw.runtime.value.IntOption

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.