<commit_before>/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */


package org.biojava.bio.symbol;

import java.util.List;
import java.io.Serializable;
import java.io.ObjectStreamException;
import java.io.InvalidObjectException;

import org.biojava.bio.Annotation;

/**
 * A basic implementation of AtomicSymbol.
 *
 * @for.user
 * If you wish to construct new Symbols, you should normally do so via utility methods
 * on <code>AlphabetManager</code>.
 *
 * @for.developer
 * This may be a useful base class for custom implementations.
 *
 * @author <NAME>
 */
public class SimpleAtomicSymbol
        extends AbstractSimpleBasisSymbol
        implements AtomicSymbol, Serializable
{
  protected SimpleAtomicSymbol(
    Annotation annotation, List syms
  ) throws IllegalSymbolException {
    super(annotation, syms);
  }

  protected Alphabet createMatches() {
    return new SingletonAlphabet(this);
  }

  private Object writeReplace()
  {
    return new SBSH(this);
  }

  private static class SBSH
          implements Serializable
  {
    private List syms;
    private Annotation ann;

    public SBSH(SimpleAtomicSymbol sym)
    {
      syms = sym.getSymbols();
      ann = sym.getAnnotation();
      System.out.println("made SBSH for " + sym.hashCode() + " " + sym);
    }

    public Object readResolve()
            throws ObjectStreamException
    {
      try {
        Symbol sym = AlphabetManager.createSymbol(ann, syms, null);
        System.out.println("read SBSH for " + sym.hashCode() + " " + sym);
        return sym;
      } catch (IllegalSymbolException ex) {
        throw new InvalidObjectException("Couldn't resolve symbol:" + syms);
      }
    }
  }
}<commit_msg>Removed some debugging noise.<commit_after>/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */


package org.biojava.bio.symbol;

import java.util.List;
import java.io.Serializable;
import java.io.ObjectStreamException;
import java.io.InvalidObjectException;

import org.biojava.bio.Annotation;

/**
 * A basic implementation of AtomicSymbol.
 *
 * @for.user
 * If you wish to construct new Symbols, you should normally do so via utility methods
 * on <code>AlphabetManager</code>.
 *
 * @for.developer
 * This may be a useful base class for custom implementations.
 *
 * @author <NAME>
 */
public class SimpleAtomicSymbol
        extends AbstractSimpleBasisSymbol
        implements AtomicSymbol, Serializable
{
  protected SimpleAtomicSymbol(
    Annotation annotation, List syms
  ) throws IllegalSymbolException {
    super(annotation, syms);
  }

  protected Alphabet createMatches() {
    return new SingletonAlphabet(this);
  }

  private Object writeReplace()
  {
    return new SBSH(this);
  }

  private static class SBSH
          implements Serializable
  {
    private List syms;
    private Annotation ann;

    public SBSH(SimpleAtomicSymbol sym)
    {
      syms = sym.getSymbols();
      ann = sym.getAnnotation();
    }

    public Object readResolve()
            throws ObjectStreamException
    {
      try {
        Symbol sym = AlphabetManager.createSymbol(ann, syms, null);
        return sym;
      } catch (IllegalSymbolException ex) {
        throw new InvalidObjectException("Couldn't resolve symbol:" + syms);
      }
    }
  }
}
{'fraction_non_alphanumeric': 0.08590511285122064, 'fraction_numerical': 0.0, 'mean_word_length': 2.923215898825655, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '129757', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1217, 'n_words': 411}