Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/polls/Poll.java

60 lines
1.1 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.polls;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
public class Poll
{
2018-12-22 11:39:00 +01:00
public final int id;
public final String title;
public final String thanksMessage;
public final String badgeReward;
2018-07-06 15:30:00 +02:00
public int lastQuestionId;
private ArrayList<PollQuestion> questions;
public Poll(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.title = set.getString("title");
this.thanksMessage = set.getString("thanks_message");
this.badgeReward = set.getString("reward_badge");
2018-09-28 21:25:00 +02:00
this.questions = new ArrayList<>();
2018-07-06 15:30:00 +02:00
}
public ArrayList<PollQuestion> getQuestions()
{
return this.questions;
}
public PollQuestion getQuestion(int id)
{
for (PollQuestion q : this.questions)
{
2018-12-22 11:39:00 +01:00
if (q.id == id)
2018-07-06 15:30:00 +02:00
{
return q;
}
}
return null;
}
public void addQuestion(PollQuestion question)
{
this.questions.add(question);
Collections.sort(this.questions);
}
}