Examples of Location


Examples of org.optaplanner.examples.tsp.domain.location.Location

    public SolverAndPersistenceFrame getWorkflowFrame() {
        return solverAndPersistenceFrame;
    }

    public void insertLocationAndVisit(double longitude, double latitude) {
        final Location newLocation;
        switch (getTravelingSalesmanTour().getDistanceType()) {
            case AIR_DISTANCE:
                newLocation = new AirLocation();
                break;
            case ROAD_DISTANCE:
                logger.warn("Adding locations for a road distance dataset is not supported.");
                return;
            default:
                throw new IllegalStateException("The distanceType (" + getTravelingSalesmanTour().getDistanceType()
                        + ") is not implemented.");
        }
        newLocation.setId(nextLocationId);
        nextLocationId++;
        newLocation.setLongitude(longitude);
        newLocation.setLatitude(latitude);
        logger.info("Scheduling insertion of newLocation ({}).", newLocation);
        doProblemFactChange(new ProblemFactChange() {
            public void doChange(ScoreDirector scoreDirector) {
                TravelingSalesmanTour solution = (TravelingSalesmanTour) scoreDirector.getWorkingSolution();
                scoreDirector.beforeProblemFactAdded(newLocation);
                solution.getLocationList().add(newLocation);
                scoreDirector.afterProblemFactAdded(newLocation);
                Visit newVisit = new Visit();
                newVisit.setId(newLocation.getId());
                newVisit.setLocation(newLocation);
                scoreDirector.beforeEntityAdded(newVisit);
                solution.getVisitList().add(newVisit);
                scoreDirector.afterEntityAdded(newVisit);
            }
View Full Code Here

Examples of org.optaplanner.examples.vehiclerouting.domain.location.Location

        assertEquals(sumOfArcs(d, z, y, b), d.getDistance(b));
        assertEquals(sumOfArcs(d, z, x, c), d.getDistance(c));
    }

    protected int sumOfArcs(Location fromLocation, Location... stopLocations) {
        Location previousLocation = fromLocation;
        int distance = 0;
        for (Location stopLocation : stopLocations) {
            distance += (int) (previousLocation.getAirDistanceDouble(stopLocation) * 1000.0 + 0.5);
            previousLocation = stopLocation;
        }
        return distance;
    }
View Full Code Here

Examples of org.python.pydev.editor.model.Location

                link = new FileLink(files[0], null, -1, -1, num);
            else {
                // files outside of the workspace
                File realFile = new File(fileName);
                if (!onlyCreateLinksForExistingFiles || realFile.exists()) {
                    ItemPointer p = new ItemPointer(realFile, new Location(num - 1, 0), null);
                    link = new ConsoleLink(p);
                }
            }
            if (link != null) {
                linkContainer.addLink(link, lineOffset + fileStart, lineLength - fileStart);
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_a.data.shipping.location.Location

        final static int MAX_TRIES = 10;

        public List<Itinerary> fetchRoutesForSpecification( RouteSpecification routeSpecification )
            throws FoundNoRoutesException
        {
            final Location origin = routeSpecification.origin().get();
            final Location destination = routeSpecification.destination().get();

            List<TransitPath> transitPaths;
            List<Itinerary> itineraries = new ArrayList<Itinerary>();

            // Try a MAX_TRIES times to avoid empty results too often
            int tries = 0;
            do
            {
                try
                {
                    transitPaths = graphTraversalService.findShortestPath( origin.getCode(), destination.getCode() );
                }
                catch( RemoteException e )
                {
                    logger.error( e.getMessage(), e );
                    return Collections.emptyList();
                }

                // The returned result is then translated back into our domain model.
                for( TransitPath transitPath : transitPaths )
                {
                    final Itinerary itinerary = toItinerary( transitPath );

                    // Use the specification to safe-guard against invalid itineraries
                    // We can use the side-effects free method of the RouteSpecification data object
                    if( routeSpecification.isSatisfiedBy( itinerary ) )
                    {
                        itineraries.add( itinerary );
                    }
                }
            }
            while( tries++ < MAX_TRIES && itineraries.size() == 0 );

            if( itineraries.size() == 0 )
            {
                throw new FoundNoRoutesException( destination.name().get(),
                                                  new LocalDate( routeSpecification.arrivalDeadline().get() ) );
            }

            return itineraries;
        }
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.data.structure.location.Location

        public List<Itinerary> fetchRoutesForSpecification( RouteSpecification routeSpecification )
            throws FoundNoRoutesException
        {
            final Date departureDate = routeSpecification.earliestDeparture().get();
            final Location origin = routeSpecification.origin().get();
            final Location destination = routeSpecification.destination().get();

            List<TransitPath> transitPaths;
            List<Itinerary> itineraries = new ArrayList<Itinerary>();

            try
            {
                transitPaths = graphTraversalService.findShortestPath( departureDate, origin.getCode(), destination.getCode() );
            }
            catch( RemoteException e )
            {
                logger.error( e.getMessage(), e );
                return Collections.emptyList();
            }

            // The returned result is then translated back into our domain model.
            for( TransitPath transitPath : transitPaths )
            {
                final Itinerary itinerary = toItinerary( transitPath );

                // Use the specification to safe-guard against invalid itineraries
                // We can use the side-effects free method of the RouteSpecification data object
                if( routeSpecification.isSatisfiedBy( itinerary ) )
                {
                    itineraries.add( itinerary );
                }
            }

            if( itineraries.size() == 0 )
            {
                throw new FoundNoRoutesException( destination.name().get(),
                                                  new LocalDate( routeSpecification.arrivalDeadline().get() ) );
            }

            return itineraries;
        }
View Full Code Here

Examples of org.rometools.feed.module.yahooweather.types.Location

    public Module parse(Element element) {
        YWeatherModuleImpl module = new YWeatherModuleImpl();
        Element location = element.getChild("location", WeatherModuleParser.NS);

        if(location != null) {
            Location l = new Location(location.getAttributeValue("city"),
                    location.getAttributeValue("region"),
                    location.getAttributeValue("country"));
            module.setLocation(l);
        }
View Full Code Here

Examples of org.saiku.query.QueryDetails.Location

      }
    }
  }

  private static void convertDetails(@NotNull Query query, @NotNull ThinDetails details) {
    Location loc = Location.valueOf(details.getLocation().toString());
    query.getDetails().setLocation(loc);
    Axis ax = getLocation(details.getAxis());
    query.getDetails().setAxis(ax);

    if (details.getMeasures().size() > 0) {
View Full Code Here

Examples of org.sonatype.mavenbook.weather.model.Location

    weatherDAO.save( weather );
    System.out.print(new WeatherFormatter().formatWeather(weather));
  }

  public void getHistory() throws Exception {
    Location location = locationDAO.findByZip(zip);
    List<Weather> weathers = weatherDAO.recentForLocation(location);
    System.out.print(new WeatherFormatter().formatHistory(location, weathers));
  }
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.content.Location

  protected File downloadFromSite(final String repositoryId, final String path)
      throws IOException
  {
    final File downloaded = new File(testIndex().getDirectory("downloads"), path);
    client().getSubsystem(Content.class).download(new Location(repositoryId, path), downloaded);
    return downloaded;
  }
View Full Code Here

Examples of org.spoutcraft.api.util.Location

  public AnimatableLocation(double x, double y, double z, double yaw, double pitch) {
    super(x, y, z, yaw, pitch);
  }

  public Animatable getValueAt(double p, Animatable startValue, Animatable endValue) {
    Location p1 = (Location) startValue;
    Location p2 = (Location) endValue;
    double x = p1.getX(), y = p1.getY(), z = p1.getZ();
    double yaw = p1.getYaw(), pitch = p1.getPitch();
    x += (p1.getX() - p2.getX()) * p;
    y += (p1.getY() - p2.getY()) * p;
    z += (p1.getZ() - p2.getZ()) * p;
    yaw += (p1.getYaw() - p2.getYaw()) * p;
    pitch += (p1.getPitch() - p2.getPitch()) * p;

    return new AnimatableLocation(x, y, z, yaw, pitch);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.