1 package org.gnomekr.potron.statistics; 2 3 import java.io.Serializable; 4 import java.util.Date; 5 6 /*** 7 * TranslationStatus.java 8 * @author Xavier Cho 9 * @version $Revision 1.1 $ $Date: 2005/07/16 11:02:22 $ 10 */ 11 public class TranslationStatus implements Serializable { 12 13 private static final long serialVersionUID = -7318405209354101200L; 14 15 private long entries; 16 private long translatedEntries; 17 private long checkedOutEntries; 18 private long fuzzyEntries; 19 private long workingTimeInMillis; 20 21 /*** 22 * @param entries 23 * @param checkedOutEntries 24 * @param translatedEntries 25 * @param fuzzyEntries 26 * @param workingTimeInMillis 27 */ 28 public TranslationStatus( 29 long entries, 30 long checkedOutEntries, 31 long translatedEntries, 32 long fuzzyEntries, 33 long workingTimeInMillis) { 34 this.entries = entries; 35 this.checkedOutEntries = checkedOutEntries; 36 this.translatedEntries = translatedEntries; 37 this.fuzzyEntries = fuzzyEntries; 38 this.workingTimeInMillis = workingTimeInMillis; 39 } 40 41 /*** 42 * @return Returns the checkedOutEntries. 43 */ 44 public long getCheckedOutEntries() { 45 return checkedOutEntries; 46 } 47 48 /*** 49 * @return Returns the entries. 50 */ 51 public long getEntries() { 52 return entries; 53 } 54 55 /*** 56 * @return Returns the translatedEntries. 57 */ 58 public long getTranslatedEntries() { 59 return translatedEntries; 60 } 61 62 /*** 63 * @return Returns the fuzzyEntries. 64 */ 65 public long getFuzzyEntries() { 66 return fuzzyEntries; 67 } 68 69 /*** 70 * @return Returns the workingTimeInMillis. 71 */ 72 public long getWorkingTimeInMillis() { 73 return workingTimeInMillis; 74 } 75 76 /*** 77 * @return Returns the workingTime. 78 */ 79 public Date getWorkingTime() { 80 return new Date(workingTimeInMillis); 81 } 82 83 public float getTranslatedRate() { 84 return (entries != 0) ? (float) ((double) translatedEntries / (double) entries) 85 : 0; 86 } 87 88 public float getFuzzyRate() { 89 return (entries != 0) ? (float) ((double) fuzzyEntries / (double) entries) 90 : 0; 91 } 92 93 public float getCheckOutRate() { 94 return (entries != 0) ? (float) ((double) checkedOutEntries / (double) entries) 95 : 0; 96 } 97 }