<commit_before>/*
 * Copyright 2011 ZXing authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.zxing.oned;

/**
 * This class renders CodaBar as {@code boolean[]}.
 *
 * @author <EMAIL> (<NAME>)
 */
public final class CodaBarWriter extends OneDimensionalCodeWriter {

  private static final char[] START_END_CHARS = {'A', 'B', 'C', 'D'};
  private static final char[] ALT_START_END_CHARS = {'T', 'N', '*', 'E'};
  private static final char[] CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED = {'/', ':', '+', '.'};
  private static final char DEFAULT_GUARD = START_END_CHARS[0];
<commit_msg>check format param in CodaBarWriter::encode (#1173)<commit_after>/*
 * Copyright 2011 ZXing authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.zxing.oned;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;

import java.util.Map;

/**
 * This class renders CodaBar as {@code boolean[]}.
 *
 * @author <EMAIL> (<NAME>)
 */
public final class CodaBarWriter extends OneDimensionalCodeWriter {

  private static final char[] START_END_CHARS = {'A', 'B', 'C', 'D'};
  private static final char[] ALT_START_END_CHARS = {'T', 'N', '*', 'E'};
  private static final char[] CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED = {'/', ':', '+', '.'};
  private static final char DEFAULT_GUARD = START_END_CHARS[0];

  @Override
  public BitMatrix encode(String contents,
                          BarcodeFormat format,
                          int width,
                          int height,
                          Map<EncodeHintType,?> hints) throws WriterException {
    if (format != BarcodeFormat.CODABAR) {
      throw new IllegalArgumentException("Can only encode CODABAR, but got " + format);
    }

    return super.encode(contents, format, width, height, hints);
  }

{'fraction_non_alphanumeric': 0.10876954452753229, 'fraction_numerical': 0.007477906186267845, 'mean_word_length': 3.6492890995260665, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1369854', 'n_tokens_mistral': 881, 'n_tokens_neox': 843, 'n_words': 306}