1 package org.tigris.scarab.attribute; 2 3 48 49 import org.tigris.scarab.om.AttributeValue; 50 51 57 public class TotalVotesAttribute extends AttributeValue 58 { 59 public int getTotalVotes() 60 { 61 int votes = 0; 62 if (getNumericValue() != null) 65 { 66 votes = getNumericValue().intValue(); 67 } 68 75 return votes; 76 } 77 78 public void addVotes(int votes) 79 { 80 setNumericValue(new Integer (getTotalVotes()+votes)); 81 } 82 83 public void addVote() 84 { 85 addVotes(1); 86 } 87 88 public void removeVotes(int votes) 89 { 90 setNumericValue(new Integer (getTotalVotes()-votes)); 91 } 92 93 public void removeVote() 94 { 95 removeVotes(1); 96 } 97 98 101 public void init() 102 { 103 } 104 105 public Object loadResources() 106 { 107 return null; 108 } 109 110 public void setResources(Object obj) 111 { 112 } 113 } 114 | Popular Tags |