Code Search for Developers
 
 
  

QuaternaryGAFInfo.java from Texai at Krugle


Show QuaternaryGAFInfo.java syntax highlighted

/*
 * QuaternaryGAFInfo.java
 *
 * Created on October 24, 2006, 1:58 PM
 *
 * Description: Contains the specialized fields for QuaternaryGAF.
 *
 * Copyright (C) 2006 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.ejb.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Transient;
import org.texai.kb.Constants;

/**
 * Entity class QuaternaryGAFInfo
 *
 * @author reed
 */
@Entity
public class QuaternaryGAFInfo extends AbstractGAFInfo implements Serializable {

  /**
   * Determines if a de-serialized file is compatible with this class.
   *
   * Maintainers must change this value if and only if the new version
   * of this class is not compatible with old versions. See Sun docs
   * for <a href=http://java.sun.com/products/jdk/1.1/docs/guide
   * /serialization/spec/version.doc.html> details. </a>
   *
   * Not necessary to include in first version of the class, but
   * included here as a reminder of its importance.
   */
  @Transient
  private static final long serialVersionUID = 1L;

  /** the quaternary ground atomic formula */
  @OneToOne
  private QuaternaryGAF quaternaryGAF;    // NOPMD

  /** the predicate
   * @serial
   */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST)
  private AtomicTerm predicate;           // NOPMD

  /** the first argument
   * @serial
   */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST)
  private AbstractTerm arg1;              // NOPMD

  /** the second argument
   * @serial
   */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST)
  private AbstractTerm arg2;              // NOPMD

  /** the third argument
   * @serial
   */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST)
  private AbstractTerm arg3;              // NOPMD

  /** the fourth argument
   * @serial
   */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST)
  private AbstractTerm arg4;              // NOPMD

  /** Creates a new instance of QuaternaryGAFInfo */
  public QuaternaryGAFInfo() {
    super();
  }

  /**
   * Creates a new instance of QuaternaryGAFInfo.
   * 
   * @param quaternaryGAF the quatternary ground atomic formula
   * @param predicate the predicate
   * @param args the arguments
   * @param context the context
   * @param strength the assertion strength
   * @param generatedPhrase the generated phrase for this ground atomic formula
   * @param creator the creator
   * @param creationPurpose the creation purpose
   * @param creationTimePoint the creation time point
   */
  public QuaternaryGAFInfo(
          final QuaternaryGAF quaternaryGAF,
          final AtomicTerm predicate,
          final List<AbstractTerm> args,
          final AbstractReifiedTerm context,
          final Double strength,
          final String generatedPhrase,
          final AbstractReifiedTerm creator,
          final AbstractReifiedTerm creationPurpose,
          final TimePoint creationTimePoint) {
    super(
            context, 
            strength, 
            generatedPhrase, 
            creator, 
            creationPurpose, 
            creationTimePoint);
    //Preconditions
    assert quaternaryGAF != null : "quaternaryGAF must not be null";
    assert predicate != null : "predicate must not be null";
    assert args != null : "args must not be null";
    assert args.size() == Constants.QUATERNARY_ARGS_SIZE : "quaternary GAF must have four arguments " + args.toString();

    this.quaternaryGAF = quaternaryGAF;
    this.predicate = predicate;
    arg1 = args.get(Constants.ARG1_INDEX);
    arg2 = args.get(Constants.ARG2_INDEX);
    arg3 = args.get(Constants.ARG3_INDEX);
    arg4 = args.get(Constants.ARG4_INDEX);
  }

  /** Gets the predicate.
   *
   * @return the predicate
   */
  public AtomicTerm getPredicate() {
    return predicate;
  }

  /** Gets the first argument
   *
   * @return the first argument
   */
  public AbstractTerm getArg1() {
    return arg1;
  }

  /** Gets the second argument
   *
   * @return the second argument
   */
  public AbstractTerm getArg2() {
    return arg2;
  }

  /** Gets the third argument
   *
   * @return the third argument
   */
  public AbstractTerm getArg3() {
    return arg3;
  }

  /** Gets the fourth argument
   *
   * @return the fourth argument
   */
  public AbstractTerm getArg4() {
    return arg4;
  }

  /** Returns the arguments.
   *
   * @return the arguments
   */
  public List<AbstractTerm> getArgs() {
    final List<AbstractTerm> args = new ArrayList<AbstractTerm>(Constants.QUATERNARY_ARGS_SIZE);
    args.add(arg1);
    args.add(arg2);
    args.add(arg3);
    args.add(arg4);
    return args;
  }

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

  /**
   * 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 QuaternaryGAFInfo)) {
      return false;
    }
    final QuaternaryGAFInfo that = (QuaternaryGAFInfo) object;
    return this.getPredicate().equals(that.getPredicate())
    && this.getContext().equals(that.getContext())
    && this.getArgs().equals(that.getArgs());
  }

  /** gets the quaternary ground atomic formula
   *
   * @return the quaternary ground atomic formula
   */
  public QuaternaryGAF getQuaternaryGAF() {
    return quaternaryGAF;
  }

}




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

  AbstractGAF.java
  AbstractGAFInfo.java
  AbstractReifiedTerm.java
  AbstractTerm.java
  AtomicTerm.java
  AtomicTermInfo.java
  BinaryGAF.java
  BinaryGAFInfo.java
  Formula.java
  FormulaArgument.java
  FormulaInfo.java
  NonAtomicTerm.java
  NonAtomicTermInfo.java
  PBlob.java
  PBlobInfo.java
  PCharacter.java
  PCharacterInfo.java
  PClob.java
  PClobInfo.java
  PDate.java
  PDateInfo.java
  PDouble.java
  PDoubleInfo.java
  PLong.java
  PLongInfo.java
  PString.java
  PStringInfo.java
  PVariable.java
  PVariableInfo.java
  QuaternaryGAF.java
  QuaternaryGAFInfo.java
  QuintaryGAF.java
  QuintaryGAFInfo.java
  Rule.java
  RuleInfo.java
  Symbol.java
  SymbolInfo.java
  TernaryGAF.java
  TernaryGAFInfo.java
  TimePoint.java
  TimePointInfo.java
  UnaryGAF.java
  UnaryGAFInfo.java
  package.html