<commit_before>package Debrief.Wrappers.DynamicTrackShapes;

import java.awt.Color;
import java.awt.Point;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

import MWC.GUI.CanvasType;
import MWC.GUI.ExtendedCanvasType;
import MWC.GUI.ShapeCanvasType;
import MWC.GenericData.HiResDate;
import MWC.GenericData.WorldDistance;
import MWC.GenericData.WorldLocation;
import MWC.GenericData.WorldVector;

public class DynamicTrackCoverageWrapper extends DynamicTrackShapeWrapper
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * build a new sensorarc contact wrapper
	 * 
	 */

	public DynamicTrackCoverageWrapper(final String theTrack,
			final HiResDate startDTG, final HiResDate endDTG,
			List<DynamicShape> values, final Color theColor, final int theStyle,
			final String coverageName)
	{
		super(theTrack, startDTG, endDTG, values, theColor, theStyle, coverageName);
	}

	public DynamicTrackCoverageWrapper()
	{
		super();
	}

	@Override
	public String getConstraints()
	{
		StringBuilder builder = new StringBuilder();
		for (DynamicShape valueD : _values)
		{
			DynamicCoverageShape value = (DynamicCoverageShape) valueD;
			builder.append(value.minAngleDegs);
			builder.append(" ");
			builder.append(value.maxAngleDegs);
			builder.append(" ");
			builder.append(value.minYds);
			builder.append(" ");
			builder.append(value.maxYds);
			builder.append(" ");
		}
		return builder.toString().trim();
	}

	public void setConstraints(String arcs)
	{
		if (arcs == null)
		{
			throw new RuntimeException("Error parsing arcs");
		}
		arcs = arcs.trim();

		StringTokenizer tokens = new StringTokenizer(arcs, " ");
		ArrayList<String> elements = new ArrayList<String>();
		while(tokens.hasMoreTokens())
		{
		  String token = tokens.nextToken();
	    elements.add(token);
		}
		
		if (elements.size() % 4 != 0)
		{
			throw new IllegalArgumentException("Wrong number of elements in arcs property");
		}
		List<DynamicShape> values = new ArrayList<DynamicShape>();
		int index = 0;
		while (index < elements.size())
		{
			int minAngleDegs = getValue(elements, index++);
			int maxAngleDegs = getValue(elements, index++);
			int minYds = getValue(elements, index++);
			int maxYds = getValue(elements, index++);
			DynamicCoverageShape value = new DynamicCoverageShape(minAngleDegs,
					maxAngleDegs, minYds, maxYds);
			values.add(value);
		}
		this._values = values;
	}

	/**
	 * utility class used to store a single sensor coverage arc
	 * 
	 * @author ian
	 * 
	 */
	public static class DynamicCoverageShape implements DynamicShape
	{

		final public int minYds, maxYds, minAngleDegs, maxAngleDegs;

		public DynamicCoverageShape(int MinAngleDegs, int MaxAngleDegs, int minYds,
				int maxYds)
		{
			this.minAngleDegs = MinAngleDegs;
			this.maxAngleDegs = MaxAngleDegs;
			this.minYds = minYds;
			this.maxYds = maxYds;
		}<commit_msg>Fixed not serializable exception in dynamic shape<commit_after>package Debrief.Wrappers.DynamicTrackShapes;

import java.awt.Color;
import java.awt.Point;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

import MWC.GUI.CanvasType;
import MWC.GUI.ExtendedCanvasType;
import MWC.GUI.ShapeCanvasType;
import MWC.GenericData.HiResDate;
import MWC.GenericData.WorldDistance;
import MWC.GenericData.WorldLocation;
import MWC.GenericData.WorldVector;

public class DynamicTrackCoverageWrapper extends DynamicTrackShapeWrapper
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * build a new sensorarc contact wrapper
	 * 
	 */

	public DynamicTrackCoverageWrapper(final String theTrack,
			final HiResDate startDTG, final HiResDate endDTG,
			List<DynamicShape> values, final Color theColor, final int theStyle,
			final String coverageName)
	{
		super(theTrack, startDTG, endDTG, values, theColor, theStyle, coverageName);
	}

	public DynamicTrackCoverageWrapper()
	{
		super();
	}

	@Override
	public String getConstraints()
	{
		StringBuilder builder = new StringBuilder();
		for (DynamicShape valueD : _values)
		{
			DynamicCoverageShape value = (DynamicCoverageShape) valueD;
			builder.append(value.minAngleDegs);
			builder.append(" ");
			builder.append(value.maxAngleDegs);
			builder.append(" ");
			builder.append(value.minYds);
			builder.append(" ");
			builder.append(value.maxYds);
			builder.append(" ");
		}
		return builder.toString().trim();
	}

	public void setConstraints(String arcs)
	{
		if (arcs == null)
		{
			throw new RuntimeException("Error parsing arcs");
		}
		arcs = arcs.trim();

		StringTokenizer tokens = new StringTokenizer(arcs, " ");
		ArrayList<String> elements = new ArrayList<String>();
		while(tokens.hasMoreTokens())
		{
		  String token = tokens.nextToken();
	    elements.add(token);
		}
		
		if (elements.size() % 4 != 0)
		{
			throw new IllegalArgumentException("Wrong number of elements in arcs property");
		}
		List<DynamicShape> values = new ArrayList<DynamicShape>();
		int index = 0;
		while (index < elements.size())
		{
			int minAngleDegs = getValue(elements, index++);
			int maxAngleDegs = getValue(elements, index++);
			int minYds = getValue(elements, index++);
			int maxYds = getValue(elements, index++);
			DynamicCoverageShape value = new DynamicCoverageShape(minAngleDegs,
					maxAngleDegs, minYds, maxYds);
			values.add(value);
		}
		this._values = values;
	}

	/**
	 * utility class used to store a single sensor coverage arc
	 * 
	 * @author ian
	 * 
	 */
	public static class DynamicCoverageShape implements DynamicShape,Serializable
	{

		/**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    final public int minYds, maxYds, minAngleDegs, maxAngleDegs;

		public DynamicCoverageShape(int MinAngleDegs, int MaxAngleDegs, int minYds,
				int maxYds)
		{
			this.minAngleDegs = MinAngleDegs;
			this.maxAngleDegs = MaxAngleDegs;
			this.minYds = minYds;
			this.maxYds = maxYds;
		}
{'fraction_non_alphanumeric': 0.1085221832109799, 'fraction_numerical': 0.002074688796680498, 'mean_word_length': 4.279696714406065, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '7665389', 'n_tokens_mistral': 2286, 'n_tokens_neox': 1976, 'n_words': 470}