<commit_before>/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.protocol.pcep.spi;

import java.util.Arrays;
import java.util.List;

import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.Errors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
import org.opendaylight.yangtools.yang.binding.DataContainer;

public class UnknownObject implements Object {

	private final Errors error;

	private final PCEPErrors e;

	public UnknownObject(final PCEPErrors error) {
		final PCEPErrorMapping mapping = PCEPErrorMapping.getInstance();
		this.e = error;
		this.error = new ErrorsBuilder().setErrorObject(
				new ErrorObjectBuilder().setType(mapping.getFromErrorsEnum(error).type).setValue(mapping.getFromErrorsEnum(error).value).build()).build();
	}

	public List<Errors> getErrors() {
		return Arrays.asList(this.error);
	}

	public PCEPErrors getError() {
		return this.e;
	}

	@Override
	public Class<? extends DataContainer> getImplementedInterface() {
		return Object.class;
	}

	@Override
	public Boolean isIgnore() {
		return false;
	}

	@Override
	public Boolean isProcessingRule() {
		return false;
	}
}<commit_msg>Add invalid object parameter for use with semantic checks<commit_after>/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.protocol.pcep.spi;

import java.util.Arrays;
import java.util.List;

import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.Errors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
import org.opendaylight.yangtools.yang.binding.DataContainer;

import com.google.common.base.Preconditions;

/**
 * Placeholder object. This object should be injected by in positions where an
 * object is either completely unknown or has failed semantic validation.
 */
public final class UnknownObject implements Object {
	private final Object invalidObject;
	private final Errors error;
	private final PCEPErrors e;

	public UnknownObject(final PCEPErrors error) {
		this(error, null);
	}

	public UnknownObject(final PCEPErrors error, final Object invalidObject) {
		this.e = Preconditions.checkNotNull(error);

		final PCEPErrorMapping mapping = PCEPErrorMapping.getInstance();
		this.error = new ErrorsBuilder().setErrorObject(
				new ErrorObjectBuilder().setType(mapping.getFromErrorsEnum(error).type).setValue(mapping.getFromErrorsEnum(error).value).build()).build();
		this.invalidObject = invalidObject;
	}

	public List<Errors> getErrors() {
		return Arrays.asList(this.error);
	}

	public PCEPErrors getError() {
		return this.e;
	}

	public Object getInvalidObject() {
		return this.invalidObject;
	}

	@Override
	public Class<? extends DataContainer> getImplementedInterface() {
		return Object.class;
	}

	@Override
	public Boolean isIgnore() {
		return false;
	}

	@Override
	public Boolean isProcessingRule() {
		return false;
	}
}
{'fraction_non_alphanumeric': 0.10734325445230544, 'fraction_numerical': 0.017565259819468163, 'mean_word_length': 5.011730205278592, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, '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': '5834217', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1298, 'n_words': 279}