<commit_before>package org.verapdf.model.visitor.cos.pb;

import org.apache.pdfbox.cos.*;
import org.verapdf.model.impl.pb.cos.*;

import java.io.IOException;

/**
 * Implementation of {@link ICOSVisitor} which realize Visitor pattern. Implements singleton pattern.
 * Current implementation create objects of abstract model implementation for corresponding objects
 * of pdf box. Methods call from {@code <? extends COSBase>} objects using accept() method.
 *
 * @author <NAME>
 */
public final class PBCosVisitor implements ICOSVisitor {

    private final static PBCosVisitor visitor = new PBCosVisitor();

    private PBCosVisitor(){}

    public static PBCosVisitor getInstance() {
        return visitor;
    }

    /** {@inheritDoc} Create a PBCosArray for corresponding COSArray.
     * @return PBCosArray object
     * @see PBCosArray
     */
    @Override
    public Object visitFromArray(COSArray obj) throws IOException {
        return new PBCosArray(obj);
    }

    /** {@inheritDoc} Create a PBCosBool for corresponding COSBoolean.
     * @return PBCosBool object
     * @see PBCosBool
     */
    @Override
    public Object visitFromBoolean(COSBoolean obj) throws IOException {
        return new PBCosBool(obj);
    }

    /** {@inheritDoc} Create a PBCosDict for corresponding COSDictionary.
     * @return PBCosDict object
     * @see PBCosDict
     */
    @Override
    public Object visitFromDictionary(COSDictionary obj) throws IOException {
        return new PBCosDict(obj);
    }

    /** {@inheritDoc} Create a PBCosDocument for corresponding COSDocument.
     * @return PBCosDocument object
     * @see PBCosDocument
     */
    @Override
    public Object visitFromDocument(COSDocument obj) throws IOException {
        return new PBCosDocument(obj);
    }

    /** {@inheritDoc} Create a PBCosReal for corresponding COSFloat.
     * @return PBCosReal object
     * @see PBCosReal
     */
    @Override
    public Object visitFromFloat(COSFloat obj) throws IOException {
        return new PBCosReal(obj);
    }

    /** {@inheritDoc} Create a PBCosInteger for corresponding COSInteger.
     * @return PBCosInteger object
     * @see PBCosInteger
     */
    @Override
    public Object visitFromInt(COSInteger obj) throws IOException {
        return new PBCosInteger(obj);
    }

    /** {@inheritDoc} Create a PBCosName for corresponding COSName.
     * @return PBCosName object
     * @see PBCosName
     */
    @Override
    public Object visitFromName(COSName obj) throws IOException {
        return new PBCosName(obj);
    }

    /** {@inheritDoc} Create a PBCosNull for corresponding COSNull.
     * @return PBCosNull object
     * @see PBCosNull
     */
    @Override
    public Object visitFromNull(COSNull obj) throws IOException {
        return PBCosNull.NULL;
    }

    /** {@inheritDoc} Create a PBCosStream for corresponding COSStream.
     * @return PBCosStream object
     * @see PBCosStream
     */
    @Override
    public Object visitFromStream(COSStream obj) throws IOException {
        return new PBCosStream(obj);
    }

    /** {@inheritDoc} Create a PBCosString for corresponding COSString.
     * @return PBCosString object
     * @see PBCosString
     */
    @Override
    public Object visitFromString(COSString obj) throws IOException {
        return new PBCosString(obj);
    }

    /** Notification of visiting in indirect object. Create a PBCosIndirect for corresponding
     * COSObject. {@code COSObject#accept(ICOSVisitor)} not accept indirect objects - its get
     * direct content and accepting it.
     * @return {@link PBCosIndirect} object
     * @see PBCosIndirect
     * @see COSObject#accept(ICOSVisitor)
     */
    public Object visitFromObject(COSObject obj) throws IOException {
        return new PBCosIndirect(obj, true);
    }
}<commit_msg>Fixes associated with previous changes<commit_after>package org.verapdf.model.visitor.cos.pb;

import org.apache.pdfbox.cos.*;
import org.verapdf.model.impl.pb.cos.*;

import java.io.IOException;

/**
 * Implementation of {@link ICOSVisitor} which realize Visitor pattern. Implements singleton pattern.
 * Current implementation create objects of abstract model implementation for corresponding objects
 * of pdf box. Methods call from {@code <? extends COSBase>} objects using accept() method.
 *
 * @author <NAME>
 */
public final class PBCosVisitor implements ICOSVisitor {

    private final static PBCosVisitor visitor = new PBCosVisitor();

    private PBCosVisitor(){}

    public static PBCosVisitor getInstance() {
        return visitor;
    }

    /** {@inheritDoc} Create a PBCosArray for corresponding COSArray.
     * @return PBCosArray object
     * @see PBCosArray
     */
    @Override
    public Object visitFromArray(COSArray obj) throws IOException {
        return new PBCosArray(obj);
    }

    /** {@inheritDoc} Create a PBCosBool for corresponding COSBoolean.
     * @return PBCosBool object
     * @see PBCosBool
     */
    @Override
    public Object visitFromBoolean(COSBoolean obj) throws IOException {
        return new PBCosBool(obj);
    }

    /** {@inheritDoc} Create a PBCosDict for corresponding COSDictionary.
     * @return PBCosDict object
     * @see PBCosDict
     */
    @Override
    public Object visitFromDictionary(COSDictionary obj) throws IOException {
        return new PBCosDict(obj);
    }

    /** {@inheritDoc} Create a PBCosDocument for corresponding COSDocument.
     * @return PBCosDocument object
     * @see PBCosDocument
     */
    @Override
    public Object visitFromDocument(COSDocument obj) throws IOException {
        return new PBCosDocument(obj);
    }

    /** {@inheritDoc} Create a PBCosReal for corresponding COSFloat.
     * @return PBCosReal object
     * @see PBCosReal
     */
    @Override
    public Object visitFromFloat(COSFloat obj) throws IOException {
        return new PBCosReal(obj);
    }

    /** {@inheritDoc} Create a PBCosInteger for corresponding COSInteger.
     * @return PBCosInteger object
     * @see PBCosInteger
     */
    @Override
    public Object visitFromInt(COSInteger obj) throws IOException {
        return new PBCosInteger(obj);
    }

    /** {@inheritDoc} Create a PBCosName for corresponding COSName.
     * @return PBCosName object
     * @see PBCosName
     */
    @Override
    public Object visitFromName(COSName obj) throws IOException {
        return new PBCosName(obj);
    }

    /** {@inheritDoc} Create a PBCosNull for corresponding COSNull.
     * @return PBCosNull object
     * @see PBCosNull
     */
    @Override
    public Object visitFromNull(COSNull obj) throws IOException {
        return PBCosNull.NULL;
    }

    /** {@inheritDoc} Create a PBCosStream for corresponding COSStream.
     * @return PBCosStream object
     * @see PBCosStream
     */
    @Override
    public Object visitFromStream(COSStream obj) throws IOException {
        return new PBCosStream(obj);
    }

    /** {@inheritDoc} Create a PBCosString for corresponding COSString.
     * @return PBCosString object
     * @see PBCosString
     */
    @Override
    public Object visitFromString(COSString obj) throws IOException {
        return new PBCosString(obj);
    }

    /** Notification of visiting in indirect object. Create a PBCosIndirect for corresponding
     * COSObject. {@code COSObject#accept(ICOSVisitor)} not accept indirect objects - its get
     * direct content and accepting it.
     * @return {@link PBCosIndirect} object
     * @see PBCosIndirect
     * @see COSObject#accept(ICOSVisitor)
     */
    public Object visitFromObject(COSObject obj) throws IOException {
        return new PBCosIndirect(obj);
    }
}
{'fraction_non_alphanumeric': 0.08199713205579455, 'fraction_numerical': 0.0, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5329332', 'n_tokens_mistral': 2188, 'n_tokens_neox': 2116, 'n_words': 659}