AbstractReifiedTerm.java from Texai at Krugle
Show AbstractReifiedTerm.java syntax highlighted
/*
* AbstractReifiedTerm.java
*
* Created on March 30, 2007, 3:43 PM
*
* Description:
*
* Copyright (C) 2007 Stephen L. Reed.
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either
* version 2 of 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 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.texai.kb.entity;
import com.sleepycat.persist.model.Persistent;
import com.sleepycat.persist.model.Relationship;
import com.sleepycat.persist.model.SecondaryKey;
import java.util.Date;
/**
*
* @author reed
*/
@Persistent
public abstract class AbstractReifiedTerm extends AbstractBookkeepingTerm {
/** the term name, which if null indicates that the term name is generated from the term id */
@SecondaryKey(relate=Relationship.MANY_TO_ONE)
private String termName; // NOPMD
/** the pretty name */
private String prettyName; // NOPMD
/** Creates a new instance of AbstractReifiedTerm. */
public AbstractReifiedTerm() {
super();
}
/** Creates a new instance of AbstractReifiedTerm.
*
* @param termId the database term ID
* @param the term name, which if null indicates that the term name is generated from the term id
* @param prettyName the pretty name
* @param creator the creator of this atomic term
* @param creationPurpose the creation purpose of this atomic term
* @param creationDate the creation date
*/
public AbstractReifiedTerm(
final int termId,
final String termName,
final String prettyName,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final Date creationDate) {
super(
termId,
creator,
creationPurpose,
creationDate);
//Preconditions
assert termName != null : "termName must not be null";
assert !termName.isEmpty() : "termName must not be an empty string";
this.termName = termName;
this.prettyName = prettyName;
}
/** Creates a new instance of AbstractReifiedTerm.
*
* @param termId the database term ID
* @param termName the term name, which if null indicates that the term name is generated from the term id
* @param prettyName the pretty name
* @param creatorTermType the term type of creator term of this atomic term
* @param creatorTermId the term id of creator term of this atomic term
* @param creationPurposeTermType the term type of the creation purpose of this atomic term
* @param creationPurposeTermId the term id of the creation time point of this atomic term
* @param creationDate the creation date
* @param kbPartitionId the KB partition term id
*/
public AbstractReifiedTerm(
final int termId,
final String termName,
final String prettyName,
final byte creatorTermType,
final int creatorTermId,
final byte creationPurposeTermType,
final int creationPurposeTermId,
final Date creationDate) {
super(
termId,
creatorTermType,
creatorTermId,
creationPurposeTermType,
creationPurposeTermId,
creationDate);
//Preconditions
assert !termName.isEmpty() : "termName must not be an empty string";
this.termName = termName;
this.prettyName = prettyName;
}
/** Returns the term name.
*
* @return the term name
*/
public String getTermName() {
return termName == null ? "anonymous_local_id_" + getTermId() : termName;
}
/** Sets the term name.
*
* @param termName the term name
*/
public void setTermName(final String termName) {
this.termName = termName;
}
/** Returns the pretty name.
*
* @return the pretty name
*/
public String getPrettyName() {
return prettyName;
}
/** Sets the pretty name.
*
* @param prettyName the pretty name
*/
public void setPrettyName(final String prettyName) {
this.prettyName = prettyName;
}
}
See more files for this project here