WordPair.java :  » App » kabowie » net » vocollab » kabowie » core » Android Open Source

Android Open Source » App » kabowie 
kabowie » net » vocollab » kabowie » core » WordPair.java

package net.vocollab.kabowie.core;

import java.io.Serializable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * Persistent entity that makes up a word pair by containing two corresponding words in two languages. Also captures the
 * number of times a user has processed this word pair correctly.
 * 
 * @author armin
 * 
 */
@DatabaseTable(tableName = "Wordpairs")
public class WordPair implements Serializable {
    
    private static final long serialVersionUID = 3553044838262122516L;
    
    @DatabaseField(generatedId = true)
    private int id;
    
    @DatabaseField(canBeNull = false)
    private String de;
    
    @DatabaseField(canBeNull = false)
    private String ru;
    
    @DatabaseField(canBeNull = false, defaultValue = "0")
    private int numberSolved = 0;
    
    @DatabaseField(canBeNull = false, defaultValue = "false")
    private boolean deleted = false;
    
    public WordPair() {

    }
    
    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {

        return this.de + "\n=\n" + this.ru;
    }
    
    /**
     * @return the de
     */
    public final String getDe() {

        return this.de;
    }
    
    /**
     * @return the ru
     */
    public final String getRu() {

        return this.ru;
    }
    
    /**
     * @param de
     *            the de to set
     */
    public final void setDe(String de) {

        this.de = de;
    }
    
    /**
     * @param ru
     *            the ru to set
     */
    public final void setRu(String ru) {

        this.ru = ru;
    }
    
    public int getId() {

        return id;
    }
    
    /**
     * @return the numberSolved
     */
    public final int getNumberSolved() {

        return this.numberSolved;
    }
    
    /**
     * @return true if this word pair is marked as deleted, false otherwise
     */
    public final boolean isDeleted() {

        return this.deleted;
    }
    
    /**
     * @param deleted
     *            if this word pair is to be marked as deleted
     */
    public final void setDeleted(boolean deleted) {

        this.deleted = deleted;
    }
    
    /**
     * @param numberSolved
     *            the numberSolved to set
     */
    public final void setNumberSolved(int numberSolved) {

        this.numberSolved = numberSolved;
    }
    
    /**
     * @return
     */
    public String toHtmlStringDeToRu() {

        return this.de + "<br/>=<br/>" + this.ru;
    }
    
    public String toHtmlStringRuToDe() {

        return this.ru + "<br/>=<br/>" + this.de;
    }
    
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.