📄 dataset.java
字号:
/*DataSet class is meant to store the results of a pollCopyright (C) 2005-2006 Igor Partola, Michael J. Krikonis, Clark UniversityThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/package SharedClasses;public class DataSet { private int VoteCountA = 0; private int VoteCountB = 0; private int VoteCountC = 0; private int VoteCountD = 0; private int VoteCountE = 0; private int VoteCountF = 0; private int VoterCount = 0; private int GreatestVote = 0; private int DataSetIndex = 0; public DataSet() { } public DataSet(int index) { DataSetIndex = index; } public void setVoteCounts(int a, int b, int c, int d, int e, int f) { VoteCountA = a; VoteCountB = b; VoteCountC = c; VoteCountD = d; VoteCountE = e; VoteCountF = f; VoterCount = a + b + c + d + e + f; GreatestVote = Math.max(Math.max(Math.max(VoteCountA, VoteCountB), Math.max(VoteCountC, VoteCountD)), Math.max(VoteCountE, VoteCountF)); } public int getVoteCountA() { return VoteCountA; } public int getVoteCountB() { return VoteCountB; } public int getVoteCountC() { return VoteCountC; } public int getVoteCountD() { return VoteCountD; } public int getVoteCountE() { return VoteCountE; } public int getVoteCountF() { return VoteCountF; } public int getVoterCount() { return VoterCount; } public int getGreatesVote() { return GreatestVote; } public void addVoteA() { VoteCountA++; VoterCount++; GreatestVote = Math.max(Math.max(Math.max(VoteCountA, VoteCountB), Math.max(VoteCountC, VoteCountD)), Math.max(VoteCountE, VoteCountF)); } public void addVoteB() { VoteCountB++; VoterCount++; GreatestVote = Math.max(Math.max(Math.max(VoteCountA, VoteCountB), Math.max(VoteCountC, VoteCountD)), Math.max(VoteCountE, VoteCountF)); } public void addVoteC() { VoteCountC++; VoterCount++; GreatestVote = Math.max(Math.max(Math.max(VoteCountA, VoteCountB), Math.max(VoteCountC, VoteCountD)), Math.max(VoteCountE, VoteCountF)); } public void addVoteD() { VoteCountD++; VoterCount++; GreatestVote = Math.max(Math.max(Math.max(VoteCountA, VoteCountB), Math.max(VoteCountC, VoteCountD)), Math.max(VoteCountE, VoteCountF)); } public void addVoteE() { VoteCountE++; VoterCount++; GreatestVote = Math.max(Math.max(Math.max(VoteCountA, VoteCountB), Math.max(VoteCountC, VoteCountD)), Math.max(VoteCountE, VoteCountF)); } public void addVoteF() { VoteCountF++; VoterCount++; GreatestVote = Math.max(Math.max(Math.max(VoteCountA, VoteCountB), Math.max(VoteCountC, VoteCountD)), Math.max(VoteCountE, VoteCountF)); } public String toString() { return new String("Result " + Integer.toString(DataSetIndex)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -