<commit_before>/*
 *    Debrief - the Open Source Maritime Analysis Application
 *    http://debrief.info
 *
 *    (C) 2000-2014, PlanetMayo Ltd
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the Eclipse Public License v1.0
 *    (http://www.eclipse.org/legal/epl-v10.html)
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 */
package org.mwc.debrief.track_shift.views;

import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.util.List;

import org.jfree.chart.axis.DateAxis;
import org.jfree.ui.RectangleEdge;

public class CachedTickDateAxis extends DateAxis
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Double _lastHeight = null;

	/** pass the constructor args back to the parent
	 * 
	 * @param string
	 */
	public CachedTickDateAxis(final String string)
	{
		super(string);
	}
	
	@SuppressWarnings("rawtypes")
	private List _myTicks;

	/** utility method to clear our cached list (when we know dates have changed)
	 * 
	 */
	public void clearTicks()
	{
		_myTicks = null;
	}
	
	@SuppressWarnings("rawtypes")
	@Override
	protected List refreshTicksVertical(final Graphics2D g2, final Rectangle2D dataArea,
			final RectangleEdge edge)
	{
		// do we have a height?
		if(_lastHeight != null)
		{
			// is the new height different to our last one?
			if(Math.abs( dataArea.getHeight() - _lastHeight.doubleValue()) > 60)
			{
				// yes - ditch the ticks
				_myTicks = null;
			}
		}
		
		// do we have any ticks?
		if(_myTicks == null)
		{
			// nope, better create some
			_myTicks =  super.refreshTicksVertical(g2, dataArea, edge);
			_lastHeight = dataArea.getHeight();
		}
		
		
		return _myTicks;
	}
	
}<commit_msg>cleanup<commit_after>/*
 *    Debrief - the Open Source Maritime Analysis Application
 *    http://debrief.info
 *
 *    (C) 2000-2014, PlanetMayo Ltd
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the Eclipse Public License v1.0
 *    (http://www.eclipse.org/legal/epl-v10.html)
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 */
package org.mwc.debrief.track_shift.views;

import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.util.List;

import org.jfree.chart.axis.DateAxis;
import org.jfree.ui.RectangleEdge;

public class CachedTickDateAxis extends DateAxis
{


  /**
   * 
   */
  private static final long serialVersionUID = 1L;

  private Double _lastHeight = null;

  /**
   * pass the constructor args back to the parent
   * 
   * @param string
   */
  public CachedTickDateAxis(final String string)
  {
    super(string);
  }

  @SuppressWarnings("rawtypes")
  private List _myTicks;

  /**
   * utility method to clear our cached list (when we know dates have changed)
   * 
   */
  public void clearTicks()
  {
    _myTicks = null;
  }

  @SuppressWarnings("rawtypes")
  @Override
  protected List refreshTicksVertical(final Graphics2D g2,
      final Rectangle2D dataArea, final RectangleEdge edge)
  {
    // do we have a height?
    if (_lastHeight != null)
    {
      // is the new height different to our last one?
      if (Math.abs(dataArea.getHeight() - _lastHeight.doubleValue()) > 60)
      {
        // yes - ditch the ticks
        _myTicks = null;
      }
    }

    // do we have any ticks?
    if (_myTicks == null)
    {
      // nope, better create some
      _myTicks = super.refreshTicksVertical(g2, dataArea, edge);
      _lastHeight = dataArea.getHeight();
    }

    return _myTicks;
  }

}
{'fraction_non_alphanumeric': 0.09664848012470771, 'fraction_numerical': 0.010911925175370226, 'mean_word_length': 2.920570264765784, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2375386', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1212, 'n_words': 374}