<commit_before>package de.ptb.epics.eve.editor.views.motoraxisview.addmultiplycomposite;

import org.apache.log4j.Logger;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IStatus;

import de.ptb.epics.eve.data.measuringstation.MotorAxisChannelAccess;
import de.ptb.epics.eve.data.scandescription.Axis;

/**
 * @author <NAME>
 * @since 1.7
 */
public class TargetToModelAfterConvertValidator implements IValidator {
	private static final Logger LOGGER = Logger
			.getLogger(TargetToModelAfterConvertValidator.class.getName());
	
	private Axis axis;
	
	/**
	 * @param axis the axis to validate with
	 */
	public TargetToModelAfterConvertValidator(Axis axis) {
		this.axis = axis;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public IStatus validate(Object value) {
		MotorAxisChannelAccess ca = null;
		Double mPos = null;
		if (this.axis.getMotorAxis().getChannelAccess() != null) {
			ca = this.axis.getMotorAxis().getChannelAccess();
			mPos = ca.getPosition();
		}
		if (ca == null || mPos == null) {
			LOGGER.warn("motor position could not be verified due to missing channel access");
			return ValidationStatus.ok();
		}
		Double val = null;
		switch (this.axis.getType()) {
		case DOUBLE:
			val = (Double)value;
			break;
		case INT:
			val = (double) ((Integer)value).intValue();
			break;
		default:
			break;
		}
		if (val == null) {
			LOGGER.warn("value could not be read");
			return ValidationStatus.ok();
		}
		if (LOGGER.isDebugEnabled()) {<commit_msg>disabled motor position verification for axis of type local<commit_after>package de.ptb.epics.eve.editor.views.motoraxisview.addmultiplycomposite;

import org.apache.log4j.Logger;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IStatus;

import de.ptb.epics.eve.data.TransportTypes;
import de.ptb.epics.eve.data.measuringstation.MotorAxisChannelAccess;
import de.ptb.epics.eve.data.scandescription.Axis;

/**
 * @author <NAME>
 * @since 1.7
 */
public class TargetToModelAfterConvertValidator implements IValidator {
	private static final Logger LOGGER = Logger
			.getLogger(TargetToModelAfterConvertValidator.class.getName());
	
	private Axis axis;
	
	/**
	 * @param axis the axis to validate with
	 */
	public TargetToModelAfterConvertValidator(Axis axis) {
		this.axis = axis;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public IStatus validate(Object value) {
		if (axis.getMotorAxis().getGoto().getAccess().getTransport()
				.equals(TransportTypes.LOCAL)) {
			// skip validation for local variables
			return ValidationStatus.ok();
		}
		MotorAxisChannelAccess ca = null;
		Double mPos = null;
		if (this.axis.getMotorAxis().getChannelAccess() != null) {
			ca = this.axis.getMotorAxis().getChannelAccess();
			mPos = ca.getPosition();
		}
		if (ca == null || mPos == null) {
			LOGGER.warn("motor position could not be verified due to missing channel access");
			return ValidationStatus.ok();
		}
		Double val = null;
		switch (this.axis.getType()) {
		case DOUBLE:
			val = (Double)value;
			break;
		case INT:
			val = (double) ((Integer)value).intValue();
			break;
		default:
			break;
		}
		if (val == null) {
			LOGGER.warn("value could not be read");
			return ValidationStatus.ok();
		}
		if (LOGGER.isDebugEnabled()) {
{'fraction_non_alphanumeric': 0.12624196376388078, 'fraction_numerical': 0.0017533606078316774, 'mean_word_length': 4.155120481927711, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '837338', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1086, 'n_words': 244}