Examples of Vote


Examples of net.bnubot.bot.commands.Vote

  @Override
  public void channelLeave(Connection source, BNetUser user) {
    touchUser(source, user, "leaving the channel");

    Vote vote = votes.get(source);
    if((vote != null) && vote.getSubject().equals(user))
      vote.cancel();
  }
View Full Code Here

Examples of net.lr.tutorial.karaf.vote.model.Vote

    return this.votingMap.remove(topic);
  }

  @Override
  public void addVote(String topic, int voteNum) {
    getVoting(topic).addVote(new Vote(topic, voteNum));
  }
View Full Code Here

Examples of net.lr.tutorial.karaf.vote.model.Vote

      String text = message.getText();
      String[] parts = text.split(" ");
      String topic = parts[0];
      int voteNum = Integer.parseInt(parts[1]);
      String fromUser = message.getSender().getName();
      return new Vote(topic, voteNum, fromUser, message.getCreatedAt());
    } catch (Throwable  e) {
      LOG.info("Invalid tweet " + message.getText() + ": " + e.getMessage());
      return null;
    }
  }
View Full Code Here

Examples of net.lr.tutorial.karaf.vote.model.Vote

      String text = tweet.getText();
      String[] parts = text.split(" ");
      String topic = parts[1];
      int voteNum = Integer.parseInt(parts[2]);
      String fromUser = tweet.getSource();
      return new Vote(topic, voteNum, fromUser, tweet.getCreatedAt());
    } catch (Throwable  e) {
      LOG.info("Invalid tweet " + tweet.getText() + ": " + e.getMessage());
      return null;
    }
  }
View Full Code Here

Examples of net.lr.tutorial.karaf.vote.model.Vote

public class IrcConverter {
  public Vote textToVote(String chatLine, @Header("irc.user.nick") String userNick) {
    String[] parts = chatLine.split(" ");
    String topic = parts[0];
    int voteNum = Integer.parseInt(parts[1]);
    return new Vote(topic, voteNum, userNick, new Date());
  }
View Full Code Here

Examples of net.lr.tutorial.karaf.vote.model.Vote

    EasyMock.expect(tweet.getSource()).andReturn("schneider_chris").anyTimes();
    Date now = new Date();
    EasyMock.expect(tweet.getCreatedAt()).andReturn(now).anyTimes();
    EasyMock.expect(tweet.getText()).andReturn("#camel mytopic 2").anyTimes();
    EasyMock.replay(tweet);
    Vote vote = converter.convert(tweet);
    Assert.assertEquals(tweet.getSource(), vote.getFromUser());
    Assert.assertEquals(now, vote.getVoteDateTime());
    Assert.assertEquals(2, vote.getVote());
    Assert.assertEquals("mytopic", vote.getTopic());
    EasyMock.verify(tweet);
  }
View Full Code Here

Examples of org.apache.pivot.util.Vote

        indexBoundsCheck("selectedIndex", selectedIndex, -1, tabs.getLength() - 1);

        int previousSelectedIndex = this.selectedIndex;

        if (previousSelectedIndex != selectedIndex) {
            Vote vote = tabPaneSelectionListeners.previewSelectedIndexChange(this, selectedIndex);

            if (vote == Vote.APPROVE) {
                this.selectedIndex = selectedIndex;
                tabPaneSelectionListeners.selectedIndexChanged(this, previousSelectedIndex);
            } else {
View Full Code Here

Examples of org.apache.pivot.util.Vote

        @Override
        public Sequence<Component> remove(int index, int count) {
            Sequence<Component> removed;

            Vote vote = tabPaneListeners.previewRemoveTabs(TabPane.this, index, count);
            if (vote == Vote.APPROVE) {
                // Remove the tabs from the tab list
                removed = tabs.remove(index, count);

                // Update the selection
View Full Code Here

Examples of org.apache.pivot.util.Vote

            }
        }

        @Override
        public Vote previewRemoveTabs(TabPane tabPane, int index, int count) {
            Vote vote = Vote.APPROVE;

            for (TabPaneListener listener : this) {
                vote = vote.tally(listener.previewRemoveTabs(tabPane, index, count));
            }

            return vote;
        }
View Full Code Here

Examples of org.apache.pivot.util.Vote

    private static class TabPaneSelectionListenerList extends WTKListenerList<TabPaneSelectionListener>
        implements TabPaneSelectionListener {
        @Override
        public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex) {
            Vote vote = Vote.APPROVE;

            for (TabPaneSelectionListener listener : this) {
                vote = vote.tally(listener.previewSelectedIndexChange(tabPane, selectedIndex));
            }

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