<commit_before>package com.planetmayo.debrief.satc.model.contributions;

import com.planetmayo.debrief.satc.model.VehicleType;
import com.planetmayo.debrief.satc.model.states.BaseRange.IncompatibleStateException;
import com.planetmayo.debrief.satc.model.states.ProblemSpace;

public class VehiclePerformanceReferenceContribution extends BaseContribution
{
	private static final long serialVersionUID = 1L;
	
	public static final String VEHICLE_TYPE = "vType";


	private VehicleType vType;

	@Override
	public void actUpon(ProblemSpace space) throws IncompatibleStateException
	{
		// does the space already have this state?
		if (space.getVehicleType() != vType)
		{
			// nope, store it then
			space.setVehicleType(vType);
		}
	}

	public void setVehicleType(VehicleType vType)
	{
		// take a copy of the type - so we can broadcast it
		VehicleType oldType = this.vType;
		
		// update the value
		this.vType = vType;

		// spread the good news
		firePropertyChange(VEHICLE_TYPE, oldType, vType);
	}

	@Override
	public ContributionDataType getDataType()
	{
		return ContributionDataType.FORECAST;
	}

	@Override
	public String getHardConstraints()
	{
		return "n/a";
	}

	public String getEstimate()
	{
		return "n/a";
	}
}<commit_msg>initial implementation of Vehicle Performance<commit_after>package com.planetmayo.debrief.satc.model.contributions;

import java.util.Iterator;

import com.planetmayo.debrief.satc.model.VehicleType;
import com.planetmayo.debrief.satc.model.states.BaseRange.IncompatibleStateException;
import com.planetmayo.debrief.satc.model.states.BoundedState;
import com.planetmayo.debrief.satc.model.states.ProblemSpace;
import com.planetmayo.debrief.satc.model.states.SpeedRange;

public class VehiclePerformanceReferenceContribution extends BaseContribution
{
	private static final long serialVersionUID = 1L;

	public static final String VEHICLE_TYPE = "vType";

	private VehicleType vType;

	@Override
	public void actUpon(ProblemSpace space) throws IncompatibleStateException
	{
		// does the space already have this state?
		if (space.getVehicleType() != vType)
		{
			// nope, store it then
			space.setVehicleType(vType);
		}

		// also, apply the speed constraint to the states, if we have one
		if (vType != null)
		{
			SpeedRange speed = new SpeedRange(vType.getMinSpeed(),
					vType.getMaxSpeed());
			Iterator<BoundedState> states = space.states().iterator();
			while (states.hasNext())
			{
				BoundedState boundedState = (BoundedState) states.next();
				boundedState.constrainTo(speed);
			}

		}
	}

	public void setVehicleType(VehicleType vType)
	{
		// take a copy of the type - so we can broadcast it
		VehicleType oldType = this.vType;

		// update the value
		this.vType = vType;

		// spread the good news
		firePropertyChange(VEHICLE_TYPE, oldType, vType);
	}

	@Override
	public ContributionDataType getDataType()
	{
		return ContributionDataType.FORECAST;
	}

	@Override
	public String getHardConstraints()
	{
		return "n/a";
	}

	public String getEstimate()
	{
		return "n/a";
	}
}
{'fraction_non_alphanumeric': 0.09345179335307667, 'fraction_numerical': 0.0006581112207963146, 'mean_word_length': 4.352112676056338, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4159998', 'n_tokens_mistral': 1083, 'n_tokens_neox': 992, 'n_words': 234}