Package de.justi.yagw2api.wrapper

Examples of de.justi.yagw2api.wrapper.IWVWMatch


  @Override
  public boolean equals(Object obj) {
    if ((obj == null) || !(obj instanceof IWVWMatch)) {
      return false;
    } else {
      final IWVWMatch match = (IWVWMatch) obj;
      return Objects.equal(this.id, match.getId());
    }
  }
View Full Code Here


      checkState(this.blueWorld != null, "Missing blue " + IWorld.class.getSimpleName() + " in " + this);
      checkState(this.blueWorld.isPresent(), "Missing blue " + IWorld.class.getSimpleName() + " in " + this);
      checkState(this.start.isPresent(), "Missing start in " + this);
      checkState(this.end.isPresent(), "Missing start in " + this);

      final IWVWMatch match = new WVWMatch(this.id.get(), this.redWorld.get(), this.greenWorld.get(), this.blueWorld.get(), this.centerMap.get(), this.redMap.get(), this.greenMap.get(),
          this.blueMap.get(), this.start.get(), this.end.get());
      if (this.fromMatchDTO.isPresent()) {
        checkState(this.fromMatchDTO.get().getDetails().isPresent());
        this.setupOwner(match, match.getCenterMap(), this.fromMatchDTO.get(), this.fromMatchDTO.get().getDetails().get().getCenterMap());
        this.setupOwner(match, match.getBlueMap(), this.fromMatchDTO.get(), this.fromMatchDTO.get().getDetails().get().getBlueMap());
        this.setupOwner(match, match.getRedMap(), this.fromMatchDTO.get(), this.fromMatchDTO.get().getDetails().get().getRedMap());
        this.setupOwner(match, match.getGreenMap(), this.fromMatchDTO.get(), this.fromMatchDTO.get().getDetails().get().getGreenMap());
      }
      match.getScores().update(this.redScore.or(0), this.greenScore.or(0), this.blueScore.or(0));

      match.getRedMap().connectWithMatch(match);
      match.getGreenMap().connectWithMatch(match);
      match.getBlueMap().connectWithMatch(match);
      match.getCenterMap().connectWithMatch(match);

      return match;
    }
View Full Code Here

  protected void perform(IWVWMatchDTO content) {
    final long startTimestamp = System.currentTimeMillis();
    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace("Going to perform " + this.getClass().getSimpleName() + " using content=" + content);
    }
    final IWVWMatch match = WVW_MODEL_FACTORY.newMatchBuilder().fromMatchDTO(content, YAGW2APIArenanet.INSTANCE.getCurrentLocale()).build();
    final long completedMatchModelBuildTimestamp = System.currentTimeMillis();
    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace("Done with build of " + IWVWMatch.class.getSimpleName() + " for content=" + content + " after " + (completedMatchModelBuildTimestamp - startTimestamp) + "ms");
    }
    match.getChannel().register(this);
    this.matchesBuffer.put(match.getId(), match);
    this.matchReferencesBuffer.add(match);
    checkState(!this.worldReferencesBuffer.contains(match.getBlueWorld()));
    checkState(!this.worldReferencesBuffer.contains(match.getRedWorld()));
    checkState(!this.worldReferencesBuffer.contains(match.getGreenWorld()));
    this.worldReferencesBuffer.add(match.getBlueWorld());
    this.worldReferencesBuffer.add(match.getRedWorld());
    this.worldReferencesBuffer.add(match.getGreenWorld());
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("Initialized match " + match.getId() + " after " + (System.currentTimeMillis() - startTimestamp) + "ms");
    }
    this.eventBus.post(WVW_MODEL_EVENT_FACTORY.newInitializedMatchEvent(match));
  }
View Full Code Here

  @Subscribe
  public void onWVWMatchEvent(IWVWMatchEvent event) {
    checkNotNull(event);
    LOGGER.debug(this + " will now inform it's registered listeners about " + event);
    final IWVWMatch match = event.getMatch();

    for (IWVWMatchListener listener : this.allMatchesListeners) {
      this.notifyWVWMatchListener(listener, event);
    }
    if (this.singleMatchListeners.containsKey(match)) {
View Full Code Here

    checkArgument(event.getMap().getMatch().isPresent());
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug(this + " will now inform it's registered listeners about " + event);
    }
    final IWVWMap map = event.getMap();
    final IWVWMatch match = map.getMatch().get();

    final Collection<IWVWMapListener> notifiedListeners = new ArrayList<IWVWMapListener>();

    for (IWVWMapListener listener : this.allMapsOfAllMatchesListeners) {
      this.notifyWVWMapListener(listener, event);
View Full Code Here

      return Optional.absent();
    } else {
      checkState(row >= 0, "row=" + row + " has to be greater or equal to 0");
      final int matchIndex = this.getMatchIndexForRow(row);
      checkState(matchIndex >= 0, "matchIndex=" + matchIndex + " has to be greater or equal to 0");
      final IWVWMatch match = this.matches.get(matchIndex);
      return Optional.fromNullable(match);
    }
  }
View Full Code Here

            final Optional<IWVWMatch> matchOptional = MainWindow.this.matchesTableModel.getMatch(index);
            if (matchOptional.isPresent()) {
              LOGGER.debug("Incoming selection event [" + index + "] -> match=" + matchOptional.get().getId());
              if (!selectedMatch.equals(matchOptional)) {
                selectedMatch = matchOptional;
                final IWVWMatch match = matchOptional.get();
                LOGGER.info("NEW selected match=" + match.getId());
                if (wrapper.isPresent()) {
                  MainWindow.this.allMapsModel.wireUp(MainWindow.this.wrapper.get(), match.getCenterMap(), match.getGreenMap(), match.getBlueMap(), match.getRedMap());
                  MainWindow.this.matchDetailsTableModel.wireUp(MainWindow.this.wrapper.get(), match, match.getCenterMap(), match.getGreenMap(), match.getBlueMap(),
                      match.getRedMap());
                  MainWindow.this.eternalMapModel.wireUp(MainWindow.this.wrapper.get(), match.getCenterMap());
                  MainWindow.this.greenMapModel.wireUp(MainWindow.this.wrapper.get(), match.getGreenMap());
                  MainWindow.this.blueMapModel.wireUp(MainWindow.this.wrapper.get(), match.getBlueMap());
                  MainWindow.this.redMapModel.wireUp(MainWindow.this.wrapper.get(), match.getRedMap());

                  MainWindow.this.wrapper.get().unregisterWVWMapListener(MainWindow.this);
                  MainWindow.this.wrapper.get().registerWVWMapListener(match.getCenterMap(), MainWindow.this);
                  MainWindow.this.wrapper.get().registerWVWMapListener(match.getGreenMap(), MainWindow.this);
                  MainWindow.this.wrapper.get().registerWVWMapListener(match.getBlueMap(), MainWindow.this);
                  MainWindow.this.wrapper.get().registerWVWMapListener(match.getRedMap(), MainWindow.this);
                }

                if (match.getGreenWorld().getName().isPresent()) {
                  MainWindow.this.greenMapToolWindow.setTitle(match.getGreenWorld().getName().get() + " Borderlands");
                } else {
                  MainWindow.this.greenMapToolWindow.setTitle("Green Borderlands");
                }
                if (match.getBlueWorld().getName().isPresent()) {
                  MainWindow.this.blueMapToolWindow.setTitle(match.getBlueWorld().getName().get() + " Borderlands");
                } else {
                  MainWindow.this.blueMapToolWindow.setTitle("Blue Borderlands");
                }
                if (match.getRedWorld().getName().isPresent()) {
                  MainWindow.this.redMapToolWindow.setTitle(match.getRedWorld().getName().get() + " Borderlands");
                } else {
                  MainWindow.this.redMapToolWindow.setTitle("Red Borderlands");
                }
                YAGW2APIAnchorman.INSTANCE.getAnchorman().setWVWMatchFilter(match);
                LOGGER.debug("Wired everything up for new selected match=" + match.getId());
              } else {
                LOGGER.debug("Already selected match=" + matchOptional.get().getId());
              }
            }
          }
View Full Code Here

    LOGGER.trace("Going to synchronize matchId=" + matchId);
    final Optional<IWVWMatchDTO> matchDTOOptional = WVW_SERVICE.retrieveMatch(matchId);
    if (matchDTOOptional.isPresent() && matchDTOOptional.get().getDetails().isPresent()) {
      final IWVWMatchDTO matchDTO = matchDTOOptional.get();
      final IWVWMatchDetailsDTO matchDetailsDTO = matchDTO.getDetails().get();
      final IWVWMatch matchModel = this.matchesMappedById.get(matchId);

      // 0. synchronize worlds
      this.synchronizeWorldNames(matchModel, matchDTO);

      // 1. synchronize maps
      this.synchronizeMap(matchModel, matchModel.getCenterMap(), matchDetailsDTO.getCenterMap());
      this.synchronizeMap(matchModel, matchModel.getRedMap(), matchDetailsDTO.getRedMap());
      this.synchronizeMap(matchModel, matchModel.getBlueMap(), matchDetailsDTO.getBlueMap());
      this.synchronizeMap(matchModel, matchModel.getGreenMap(), matchDetailsDTO.getGreenMap());
      // 2. synchronize match scores
      matchModel.getScores().update(matchDetailsDTO.getRedScore(), matchDetailsDTO.getGreenScore(), matchDetailsDTO.getBlueScore());
    } else {
      LOGGER.error("Failed to retrieve " + IWVWMatchDTO.class.getSimpleName() + " for matchId=" + matchId);
    }
    final long endTimestamp = System.currentTimeMillis();
    final long duration = endTimestamp - startTimestamp;
View Full Code Here

TOP

Related Classes of de.justi.yagw2api.wrapper.IWVWMatch

Copyright © 2018 www.massapicom. 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.