/** * Adds, to the existing information, field(s) that are read in * the source record(s). * * @param readFields the position(s) in the source record(s) */ public void addReadFields(FieldSet readFields) { if (this.readFields == null) { this.readFields = readFields; } else { this.readFields = this.readFields.addFields(readFields); } }
/** * Adds, to the existing information, field(s) that are read in * the source record(s) from the first input. * * @param input the input of the read fields * @param readFields the position(s) in the source record(s) */ public void addReadFields(int input, FieldSet readFields) { if (input != 0 && input != 1) { throw new IndexOutOfBoundsException(); } else if (input == 0) { this.readFields1 = (this.readFields1 == null) ? readFields.clone() : this.readFields1.addFields(readFields); } else { this.readFields2 = (this.readFields2 == null) ? readFields.clone() : this.readFields2.addFields(readFields); } }
@Test public void testImmutability() { FieldSet s1 = new FieldSet(); FieldSet s2 = new FieldSet(5); FieldSet s3 = new FieldSet(Integer.valueOf(7)); FieldSet s4 = new FieldSet(5, 4, 7, 6); s1.addFields(s2).addFields(s3); s2.addFields(s4); s4.addFields(s1); s1.addField(Integer.valueOf(14)); s2.addFields(78, 13, 66, 3); assertEquals(0, s1.size()); assertEquals(1, s2.size()); assertEquals(1, s3.size()); assertEquals(4, s4.size()); }
@Test public void testFieldSetAdds() { check(new FieldSet().addField(1).addField(2), 1, 2); check(FieldSet.EMPTY_SET.addField(3).addField(2), 3, 2); check(new FieldSet(13).addFields(new FieldSet(17, 31, 42)), 17, 13, 42, 31); check(new FieldSet(14).addFields(new FieldSet(17)), 17, 14); check(new FieldSet(3).addFields(2, 8, 5, 7), 3, 2, 8, 5, 7); check(new FieldSet().addFields(new FieldSet())); check(new FieldSet().addFields(new FieldSet(3, 4)), 4, 3); check(new FieldSet(5, 1).addFields(new FieldSet()), 5, 1); }
@Test public void testAddListToSet() { check(new FieldSet().addField(1).addFields(new FieldList(14, 3, 1)), 1, 3, 14); }
/** * Adds, to the existing information, field(s) that are read in * the source record(s). * * @param readFields the position(s) in the source record(s) */ public void addReadFields(FieldSet readFields) { if (this.readFields == null) { this.readFields = readFields; } else { this.readFields = this.readFields.addFields(readFields); } }
/** * Adds, to the existing information, field(s) that are read in * the source record(s). * * @param readFields the position(s) in the source record(s) */ public void addReadFields(FieldSet readFields) { if (this.readFields == null) { this.readFields = readFields; } else { this.readFields = this.readFields.addFields(readFields); } }
/** * Adds, to the existing information, field(s) that are read in * the source record(s) from the first input. * * @param input the input of the read fields * @param readFields the position(s) in the source record(s) */ public void addReadFields(int input, FieldSet readFields) { if (input != 0 && input != 1) { throw new IndexOutOfBoundsException(); } else if (input == 0) { this.readFields1 = (this.readFields1 == null) ? readFields.clone() : this.readFields1.addFields(readFields); } else { this.readFields2 = (this.readFields2 == null) ? readFields.clone() : this.readFields2.addFields(readFields); } }
/** * Adds, to the existing information, field(s) that are read in * the source record(s) from the first input. * * @param input the input of the read fields * @param readFields the position(s) in the source record(s) */ public void addReadFields(int input, FieldSet readFields) { if (input != 0 && input != 1) { throw new IndexOutOfBoundsException(); } else if (input == 0) { this.readFields1 = (this.readFields1 == null) ? readFields.clone() : this.readFields1.addFields(readFields); } else { this.readFields2 = (this.readFields2 == null) ? readFields.clone() : this.readFields2.addFields(readFields); } }