Code Search for Developers
 
 
  

AtomicTerm.java from Texai at Krugle


Show AtomicTerm.java syntax highlighted

/*
 * AtomicTerm.java
 *
 * Created on March 23, 2007, 3:19 PM
 *
 * Description: AtomicTerm is a persistent atomic term in the Texai logical representation language.
 *
 * 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.Entity;
import java.util.Date;
import org.texai.kb.Constants;
import org.texai.kb.ejb.session.shared.KBPartitionFacadeLocal;

/**
 *
 * @author reed
 */
@Entity
public class AtomicTerm extends AbstractReifiedTerm {
  
  /** Creates a new instance of AtomicTerm. */
  public AtomicTerm() {
    super();
  }

  /** Creates a new instance of AtomicTerm. 
   *
   * @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 creator the creator
   * @param creationPurpose the creation purpose
   * @param creationDate the creation date
   */
  public AtomicTerm(
          final int termId,
          final String termName,
          final String prettyName,
          final AbstractReifiedTerm creator,
          final AbstractReifiedTerm creationPurpose,
          final Date creationDate) {
    this(
            termId,
            termName,
            prettyName,
            creator.getTermType(),
            creator.getTermId(),
            creationPurpose.getTermType(),
            creationPurpose.getTermId(),
            creationDate);
  }

  /** Creates a new instance of AtomicTerm. 
   *
   * @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 creationDate the creation date
   * @param kbPartition the KB partition
   */
  public AtomicTerm(
          final int termId,
          final String termName,
          final String prettyName,
          final Date creationDate) {
    this(
            termId,
            termName,
            prettyName,
            (byte) 0,
            0,
            (byte) 0,
            0,
            creationDate);
  }

  /** Creates a new instance of AtomicTerm. 
   *
   * @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
   */
  public AtomicTerm(
          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,
            termName,
            prettyName,
            creatorTermType,
            creatorTermId,
            creationPurposeTermType,
            creationPurposeTermId,
            creationDate);
  }

  /** Gets the term type.
   *
   * @return the term type
   */
  public byte getTermType() {
    return Constants.ATOMIC;
  }

  /**
   * Returns a hash code value for the object. 
   * @return a hash code value for this object
   */
  @Override
  public int hashCode() {
    return getTermId();
  }

  /**
   * Determines whether another object is equal to this object.
   *
   * @param object the reference object with which to compare
   * @return <code>true</code> if this object is the same as the argument;
   * <code>false</code> otherwise.
   */
  @Override
  public boolean equals(final Object object) {
    if (!(object instanceof AtomicTerm)) {
      return false;
    }
    final AtomicTerm that = (AtomicTerm) object;
    return this.getTermId() == that.getTermId();
  }

  /** Returns a string representation of this object.
   *
   * @param kbPartitionFacade the KB partition facade
   * @return a string representation of this object
   */
  public String toString(final KBPartitionFacadeLocal kbPartitionFacade) {
    return getTermName();
  }

  /** Returns a CycL representation of this object.
   *
   * @param kbPartitionFacade the KB partition facade
   * @return a CycL representation of this object
   */
  public String toCycLString(final KBPartitionFacadeLocal kbPartitionFacade) {
    return "#$" + toString(kbPartitionFacade);
  }

}




See more files for this project here

Texai

Texai is an chatbot that intelligently seeks to acquire knowledge and friendly behaviors.

Project homepage: http://sourceforge.net/projects/texai
Programming language(s): Java,Shell Script,XML
License: other

  AbstractBookkeepingTerm.java
  AbstractGAF.java
  AbstractReifiedTerm.java
  AbstractTerm.java
  AtomicTerm.java
  BinaryGAF.java
  Formula.java
  LocalTermIdReference.java
  NonAtomicTerm.java
  PByteArray.java
  PDate.java
  PDouble.java
  PLong.java
  PString.java
  PVariable.java
  QuaternaryGAF.java
  QuintaryGAF.java
  RemoteTermIdReference.java
  Rule.java
  StubReifiedTerm.java
  StubTerm.java
  Symbol.java
  TermIdSequence.java
  TernaryGAF.java
  UnaryGAF.java