<commit_before>package fgis.server.services;

import fgis.server.entity.fgis.Resource;
import fgis.server.entity.fgis.ResourceTrack;
import fgis.server.entity.fgis.dao.ResourceRepository;
import fgis.server.entity.fgis.dao.ResourceTrackRepository;
import java.util.Date;
import java.util.Random;
import javax.ejb.EJB;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import org.geolatte.geom.DimensionalFlag;
import org.geolatte.geom.Point;
import org.geolatte.geom.PointSequenceBuilder;
import org.geolatte.geom.PointSequenceBuilders;
import org.geolatte.geom.crs.CrsId;

@javax.ejb.Local
@Stateless
public class DataGeneratorEJB
{
  @EJB
  private ResourceRepository _resourceService;

  @EJB
  private ResourceTrackRepository _resourceTrackRepository;


  @Schedule( second = "*/5", minute = "*", hour = "*", persistent = false )
  public void insertData()
  {
    final String resourceName = "Peter";
    Resource resource = _resourceService.findByName( resourceName );
    if ( null == resource )
    {
      resource = new Resource( "Person", resourceName );
      _resourceService.persist( resource );
    }
    final Random random = new Random();

    final PointSequenceBuilder builder =
      PointSequenceBuilders.variableSized( DimensionalFlag.d2D, CrsId.UNDEFINED );
    final double latPosition = 144.92978643046 + random.nextDouble() / 1;
    final double longPosition = -37.794939500455 + random.nextDouble() / 1;
    builder.add( latPosition , longPosition );

    System.out.println( "Generating point " + latPosition + ", " + longPosition +
                        " for resource " + resource.getName() );

    final Point point = new Point( builder.toPointSequence() );
    _resourceTrackRepository.persist( new ResourceTrack( resource, new Date(), point ) );
    resource.setLocation( point );<commit_msg>Move the position close to where it was in the past<commit_after>package fgis.server.services;

import fgis.server.entity.fgis.Resource;
import fgis.server.entity.fgis.ResourceTrack;
import fgis.server.entity.fgis.dao.ResourceRepository;
import fgis.server.entity.fgis.dao.ResourceTrackRepository;
import java.util.Date;
import java.util.List;
import java.util.Random;
import javax.ejb.EJB;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import org.geolatte.geom.DimensionalFlag;
import org.geolatte.geom.Point;
import org.geolatte.geom.PointSequenceBuilder;
import org.geolatte.geom.PointSequenceBuilders;
import org.geolatte.geom.crs.CrsId;

@javax.ejb.Local
@Stateless
public class DataGeneratorEJB
{
  @EJB
  private ResourceRepository _resourceService;

  @EJB
  private ResourceTrackRepository _resourceTrackRepository;


  @Schedule( second = "*/5", minute = "*", hour = "*", persistent = false )
  public void insertData()
  {
    final String resourceName = "Peter";
    Resource resource = _resourceService.findByName( resourceName );
    if ( null == resource )
    {
      resource = new Resource( "Person", resourceName );
      _resourceService.persist( resource );
    }
    final Random random = new Random();

    final Point lastLocation = resource.getLocation();

    final PointSequenceBuilder builder =
      PointSequenceBuilders.variableSized( DimensionalFlag.d2D, CrsId.UNDEFINED );
    final double startX = null == lastLocation ? 144.92978643046 : lastLocation.getX();
    final double startY = null == lastLocation ? -37.794939500455 : lastLocation.getY();

    final double latPosition = startX + ( random.nextDouble() / 100 ) - 0.005;
    final double longPosition = startY + ( random.nextDouble() / 100 ) - 0.005;
    builder.add( latPosition , longPosition );


    System.out.println( "Generating point " + latPosition + ", " + longPosition +
                        " for resource " + resource.getName() );

    final Point point = new Point( builder.toPointSequence() );
    _resourceTrackRepository.persist( new ResourceTrack( resource, new Date(), point ) );
    resource.setLocation( point );
{'fraction_non_alphanumeric': 0.10783572688334593, 'fraction_numerical': 0.019148400100781053, 'mean_word_length': 4.089743589743589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '370370', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1176, 'n_words': 272}