Examples of BlockInstance


Examples of lineage2.gameserver.model.instances.BlockInstance

          spawn.setLocy(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
          spawn.setLocz(_zCoord);
          spawn.setAmount(1);
          spawn.setHeading(1);
          spawn.setRespawnDelay(1);
          BlockInstance blockInstance = (BlockInstance) spawn.doSpawn(true);
          blockInstance.setRed((random % 2) == 0);
          _spawns.add(spawn);
          random++;
        }
      }
      catch (Exception e)
View Full Code Here

Examples of lineage2.gameserver.model.instances.BlockInstance

   * @param caster Creature
   */
  @Override
  protected void onEvtSeeSpell(Skill skill, Creature caster)
  {
    final BlockInstance actor = (BlockInstance) getActor();
    if (caster == null)
    {
      return;
    }
    if (!caster.isPlayer())
    {
      return;
    }
    final Player player = caster.getPlayer();
    final int arena = player.getBlockCheckerArena();
    if ((arena == -1) || (arena > 3))
    {
      return;
    }
    if (player.getTarget().equals(actor))
    {
      if ((skill.getId() == 5852) || (skill.getId() == 5853))
      {
        final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena);
        if ((holder.getPlayerTeam(player) == 0) && !actor.isRed())
        {
          actor.changeColor();
          increaseTeamPointsAndSend(player, holder.getEvent());
        }
        else if ((holder.getPlayerTeam(player) == 1) && actor.isRed())
        {
          actor.changeColor();
          increaseTeamPointsAndSend(player, holder.getEvent());
        }
        else
        {
          return;
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

    /**
     * TODO: Eventually, use startDate and startTime to distinguish between
     * different instances
     */
    BlockInstance instance = instances.get(0);
    BlockConfigurationEntry blockConfiguration = instance.getBlock();
    List<BlockTripEntry> blockTrips = blockConfiguration.getTrips();

    Map<String, List<TripUpdate>> tripUpdatesByTripId = MappingLibrary.mapToValueList(
        tripUpdates, "trip.tripId");

    int currentTime = (int) ((t - instance.getServiceDate()) / 1000);
    BestScheduleDeviation best = new BestScheduleDeviation();

    for (BlockTripEntry blockTrip : blockTrips) {
      TripEntry trip = blockTrip.getTrip();
      AgencyAndId tripId = trip.getId();
      List<TripUpdate> updatesForTrip = tripUpdatesByTripId.get(tripId.getId());
      if (updatesForTrip != null) {
        for (TripUpdate tripUpdate : updatesForTrip) {

          if (tripUpdate.hasExtension(GtfsRealtimeOneBusAway.obaTripUpdate)) {
            OneBusAwayTripUpdate obaTripUpdate = tripUpdate.getExtension(GtfsRealtimeOneBusAway.obaTripUpdate);
            if (obaTripUpdate.hasDelay()) {
              /**
               * TODO: Improved logic around picking the "best" schedule deviation
               */
              int delay = obaTripUpdate.getDelay();
              best.delta = 0;
              best.isInPast = false;
              best.scheduleDeviation = delay;
            }
           
            if (obaTripUpdate.hasTimestamp()) {
              best.timestamp = obaTripUpdate.getTimestamp() * 1000;
            }
          }

          for (StopTimeUpdate stopTimeUpdate : tripUpdate.getStopTimeUpdateList()) {
            BlockStopTimeEntry blockStopTime = getBlockStopTimeForStopTimeUpdate(
                tripUpdate, stopTimeUpdate, blockTrip.getStopTimes(),
                instance.getServiceDate());
            if (blockStopTime == null)
              continue;
            StopTimeEntry stopTime = blockStopTime.getStopTime();
            int currentArrivalTime = computeArrivalTime(stopTime,
                stopTimeUpdate, instance.getServiceDate());
            if (currentArrivalTime >= 0) {
              updateBestScheduleDeviation(currentTime,
                  stopTime.getArrivalTime(), currentArrivalTime, best);
            }
            int currentDepartureTime = computeDepartureTime(stopTime,
                stopTimeUpdate, instance.getServiceDate());
            if (currentDepartureTime >= 0) {
              updateBestScheduleDeviation(currentTime,
                  stopTime.getDepartureTime(), currentDepartureTime, best);
            }
          }
        }
      }
    }

    record.setServiceDate(instance.getServiceDate());
    record.setScheduleDeviation(best.scheduleDeviation);
    if (best.timestamp != 0) {
      record.setTimeOfRecord(best.timestamp);
    }
  }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

      stopTimeEvent.setDelay((int) activeBlock.getScheduleDeviation());
      stopTimeUpdate.setDeparture(stopTimeEvent);

      AgencyAndId routeId = activeTrip.getRouteCollection().getId();
      AgencyAndId tripId = activeTrip.getId();
      BlockInstance blockInstance = activeBlock.getBlockInstance();
      String startDate = String.format("%1$ty%1$tm%1$td", new Date(
          blockInstance.getServiceDate()));

      TripDescriptor.Builder tripDescriptor = TripDescriptor.newBuilder();
      tripDescriptor.setRouteId(AgencyAndId.convertToString(routeId));
      tripDescriptor.setScheduleRelationship(ScheduleRelationship.SCHEDULED);
      tripDescriptor.setStartDate(startDate);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

    BlockEntryImpl block = block("blockA");
    TripEntryImpl trip = trip("tripA", "serviceId");
    stopTime(0, null, trip, time(9, 00), 0);
    BlockConfigurationEntry blockConfig = linkBlockTrips(block, trip);
    BlockInstance blockInstance = new BlockInstance(blockConfig, serviceDate);

    VehicleLocationRecordCacheImpl cache = new VehicleLocationRecordCacheImpl();
    cache.setBlockLocationRecordCacheWindowSize(20);

    List<VehicleLocationCacheElements> records = cache.getRecordsForBlockInstance(blockInstance);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

    BlockEntryImpl blockA = block("blockA");
    TripEntryImpl tripA = trip("tripA", "serviceId");
    stopTime(0, null, tripA, time(9, 00), 0);
    BlockConfigurationEntry blockConfigA = linkBlockTrips(blockA, tripA);
    BlockInstance instanceA = new BlockInstance(blockConfigA, serviceDate);

    BlockEntryImpl blockB = block("blockB");
    TripEntryImpl tripB = trip("tripB", "serviceId");
    stopTime(0, null, tripB, time(9, 00), 0);
    BlockConfigurationEntry blockConfigB = linkBlockTrips(blockB, tripB);
    BlockInstance instanceB = new BlockInstance(blockConfigB, serviceDate);

    VehicleLocationRecordCacheImpl cache = new VehicleLocationRecordCacheImpl();
    cache.setBlockLocationRecordCacheWindowSize(20);

    cache.addRecord(instanceA,
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

      BlockEntryImpl block = block(Integer.toString(i));
      TripEntryImpl trip = trip(Integer.toString(i), "serviceId");
      stopTime(0, null, trip, time(9, 00), 0);
      BlockConfigurationEntry blockConfig = linkBlockTrips(block, trip);
      BlockInstance blockInstance = new BlockInstance(blockConfig, serviceDate);

      for (int j = 0; j < 5; j++) {

        AgencyAndId vehicleId = new AgencyAndId("1", Integer.toString(vid++));
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

   ****/

  @Override
  public void handleVehicleLocationRecord(VehicleLocationRecord record) {

    BlockInstance instance = getVehicleLocationRecordAsBlockInstance(record);

    if (instance != null) {

      ScheduledBlockLocation scheduledBlockLocation = getScheduledBlockLocationForVehicleLocationRecord(
          record, instance);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

        vehicleId, targetTime);

    // TODO : We might take a bit more care in picking the collection if
    // multiple collections are returned
    for (VehicleLocationCacheElements cacheRecord : cacheRecords) {
      BlockInstance blockInstance = cacheRecord.getBlockInstance();
      BlockLocation location = getBlockLocation(blockInstance, cacheRecord,
          null, targetTime.getTargetTime());
      if (location != null)
        return location;
    }
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.blocks.BlockInstance

      throw new IllegalArgumentException("you must specify a serviceDate");

    if (record.getTimeOfRecord() == 0)
      throw new IllegalArgumentException("you must specify a record time");

    BlockInstance blockInstance = getBestBlockForRecord(blockId,
        record.getServiceDate(), record.getTimeOfRecord());

    return blockInstance;
  }
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.