test_class.declarator: log = LoggerFactory.getLogger(EbtsBuilderTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger log = LoggerFactory.getLogger(EbtsBuilderTest.class);
test_class.type: Logger
test_class.var_name: log
test_class.file: Jet/src/test/java/org/mitre/jet/ebts/EbtsBuilderTest.java
test_class.identifier: EbtsBuilderTest
test_case.body: @Test
      public void basicBuilderTest() throws Exception {
          Ebts ebts = new Ebts();
          GenericRecord type1 = new GenericRecord(1);
          type1.setField(3, new Field("0400"));
          type1.setField(8, new Field("WVMEDS001"));
  
          GenericRecord type2 = new GenericRecord(2);
          type2.setField(2, new Field("04"));
          type2.setField(19, new Field("Smith,John"));
          type2.getField(19).getOccurrences().add(new Occurrence("Smith,Johnny"));
          type2.setField(18, new Field("Smith,Jo"));
          type2.setField(41, new Field("B"));
          type2.setField(40, new Field("A"));
  
          List<String> strings = new ArrayList<String>();
          strings.add("Test1");
          strings.add("Test2");
          strings.add("Test3");
          List<Occurrence> occs = EbtsUtils.convertStringList(strings);
          occs.add(new Occurrence("HI"));
          occs.remove(new Occurrence("HI"));
  
          type2.setField(50,new Field(occs));
  
          GenericRecord type10 = new GenericRecord(10);
          type10.setField(6, new Field("600"));
          Random rand = new Random();
          byte[] imageData = new byte[10];
          rand.nextBytes(imageData);
          type10.setImageData(imageData);
          ebts.addRecord(type1);
          ebts.addRecord(type10);
          ebts.addRecord(type2);
  
  
  
          EbtsBuilder builder = new EbtsBuilder(2);
          byte[] data = builder.build(ebts);
  
          log.info("EBTS Length: {}",data.length);
  
          ByteBuffer bb = ByteBuffer.wrap(data);
          assertTrue(ByteBufferUtils.find(bb, "A".getBytes()[0]) < ByteBufferUtils.find(bb, "B".getBytes()[0]));
  
          assertEquals(200,data.length);
          new EbtsParser().parse(data);
  
      }
test_case.class_method_signature: EbtsBuilderTest.basicBuilderTest()
test_case.full_signature: @Test public void basicBuilderTest()
test_case.identifier: basicBuilderTest
test_case.invocations: setField setField setField setField add getOccurrences getField setField setField setField add add add convertStringList add remove setField setField nextBytes setImageData addRecord addRecord addRecord build info wrap assertTrue find getBytes find getBytes assertEquals parse
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void basicBuilderTest()
focal_class.declarator: minLength = 2
focal_class.modifier: private
focal_class.original_string: private int minLength = 2;
focal_class.type: int
focal_class.var_name: minLength
focal_class.declarator: binaryHeaderTypes = EbtsUtils.getBinaryHeaderTypes()
focal_class.modifier: private static final
focal_class.original_string: private static final Set<Integer> binaryHeaderTypes = EbtsUtils.getBinaryHeaderTypes();
focal_class.type: Set<Integer>
focal_class.var_name: binaryHeaderTypes
focal_class.declarator: genericTypes = EbtsUtils.getGenericRecordTypes()
focal_class.modifier: private static final
focal_class.original_string: private static final Set<Integer> genericTypes = EbtsUtils.getGenericRecordTypes();
focal_class.type: Set<Integer>
focal_class.var_name: genericTypes
focal_class.declarator: ebts
focal_class.modifier: private
focal_class.original_string: private Ebts ebts;
focal_class.type: Ebts
focal_class.var_name: ebts
focal_class.file: Jet/src/main/java/org/mitre/jet/ebts/EbtsBuilder.java
focal_class.identifier: EbtsBuilder
focal_class.class_method_signature: EbtsBuilder.EbtsBuilder()
focal_class.full_signature: public  EbtsBuilder()
focal_class.identifier: EbtsBuilder
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  EbtsBuilder()
focal_class.class_method_signature: EbtsBuilder.EbtsBuilder(final int precedingZeros)
focal_class.full_signature: public  EbtsBuilder(final int precedingZeros)
focal_class.identifier: EbtsBuilder
focal_class.modifiers: public
focal_class.parameters: (final int precedingZeros)
focal_class.signature:  EbtsBuilder(final int precedingZeros)
focal_class.class_method_signature: EbtsBuilder.fixCountField(final GenericRecord record)
focal_class.full_signature: private void fixCountField(final GenericRecord record)
focal_class.identifier: fixCountField
focal_class.modifiers: private
focal_class.parameters: (final GenericRecord record)
focal_class.return: void
focal_class.signature: void fixCountField(final GenericRecord record)
focal_class.class_method_signature: EbtsBuilder.getNextAvailableIDC()
focal_class.full_signature: private int getNextAvailableIDC()
focal_class.identifier: getNextAvailableIDC
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getNextAvailableIDC()
focal_class.class_method_signature: EbtsBuilder.genericBuilder(final GenericRecord record, final ByteArrayOutputStream baos)
focal_class.full_signature: private void genericBuilder(final GenericRecord record, final ByteArrayOutputStream baos)
focal_class.identifier: genericBuilder
focal_class.modifiers: private
focal_class.parameters: (final GenericRecord record, final ByteArrayOutputStream baos)
focal_class.return: void
focal_class.signature: void genericBuilder(final GenericRecord record, final ByteArrayOutputStream baos)
focal_class.class_method_signature: EbtsBuilder.binaryHeaderBuilder(final BinaryHeaderImageRecord record, final ByteArrayOutputStream baos)
focal_class.full_signature: private static void binaryHeaderBuilder(final BinaryHeaderImageRecord record, final ByteArrayOutputStream baos)
focal_class.identifier: binaryHeaderBuilder
focal_class.modifiers: private static
focal_class.parameters: (final BinaryHeaderImageRecord record, final ByteArrayOutputStream baos)
focal_class.return: void
focal_class.signature: void binaryHeaderBuilder(final BinaryHeaderImageRecord record, final ByteArrayOutputStream baos)
focal_class.class_method_signature: EbtsBuilder.setPrecedingZeros(final int precedingZeros)
focal_class.full_signature: public void setPrecedingZeros(final int precedingZeros)
focal_class.identifier: setPrecedingZeros
focal_class.modifiers: public
focal_class.parameters: (final int precedingZeros)
focal_class.return: void
focal_class.signature: void setPrecedingZeros(final int precedingZeros)
focal_class.class_method_signature: EbtsBuilder.build(final Ebts ebts)
focal_class.full_signature: public byte[] build(final Ebts ebts)
focal_class.identifier: build
focal_class.modifiers: public
focal_class.parameters: (final Ebts ebts)
focal_class.return: byte[]
focal_class.signature: byte[] build(final Ebts ebts)
focal_method.body: public byte[] build(final Ebts ebts) throws EbtsBuildingException {
          this.ebts = ebts;
          //Create the auto-expanding output stream
          final ByteArrayOutputStream baos = new ByteArrayOutputStream();
          //Get list of all records
          //Overwrite CNT field(1.03)
          final List<LogicalRecord> records = ebts.getAllRecords();
          for (final LogicalRecord record : records) {
  
              if (genericTypes.contains(record.getRecordType())) {
                  genericBuilder((GenericRecord)record,baos);
              } else if (binaryHeaderTypes.contains(record.getRecordType())) {
                  binaryHeaderBuilder((BinaryHeaderImageRecord)record,baos);
              }
          }
          return baos.toByteArray();
      }
focal_method.class_method_signature: EbtsBuilder.build(final Ebts ebts)
focal_method.full_signature: public byte[] build(final Ebts ebts)
focal_method.identifier: build
focal_method.invocations: getAllRecords contains getRecordType genericBuilder contains getRecordType binaryHeaderBuilder toByteArray
focal_method.modifiers: public
focal_method.parameters: (final Ebts ebts)
focal_method.return: byte[]
focal_method.signature: byte[] build(final Ebts ebts)