Code Search for Developers
 
 
  

TermIdSequence.java from Texai at Krugle


Show TermIdSequence.java syntax highlighted

/*
 * TermIdSequence.java
 *
 * Created on April 27, 2007, 8:49 AM
 *
 * Description: Provides the term id sequence.  When the database writing process initializes, it queries the
 * value of the highestTermId and sets isHighestTermIdPersisted to false.  When the database writing process
 * shuts down, it persists the the value of the highestTermId and sets isHighestTermIdPersisted to true.
 *
 * Copyright (C) April 27, 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 com.sleepycat.persist.model.PrimaryKey;

/**
 *
 * @author reed
 */
@Entity
public class TermIdSequence {
  
  /** the sequence entry id, which has the singleton value 1 */
  @PrimaryKey
  private int id;         
 
  /** the lowest termId in this database shard */
  private int lowestTermId;
  
  /** the highest termId in this database shard */
  private int highestTermId;
  
  /** the indicator that the term id sequence has been successfully persisted by the database writing process */
  private boolean isTermIdSequencePersisted;
  
  /** Creates a new instance of TermIdSequence. */
  public TermIdSequence() {
  }
  
  /** Gets the lowest termId in this database shard.
   *
   * @return the lowest termId in this database shard
   */
  public int getLowestTermId() {
    return highestTermId;
  }
  
  /** Sets the lowest termId in this database shard.
   *
   * @param lowestTermId the lowest termId in this database shard
   */
  public void setLowestTermId(final int lowestTermId) {
    assert lowestTermId != 0 : "highestTermId must not be zero";
    
    this.lowestTermId = lowestTermId;
  }

  /** Gets the highest termId in this database shard.
   *
   * @return the highest termId in this database shard
   */
  public int getHighestTermId() {
    return highestTermId;
  }
  
  /** Sets the highest termId in this database shard.
   *
   * @param highestTermId the highest termId in this database shard
   */
  public void setHighestTermId(final int highestTermId) {
    assert highestTermId != 0 : "highestTermId must not be zero";
    
    this.highestTermId = highestTermId;
  }

  /** Gets the indicator that the term id sequence has been successfully persisted by the database writing process.
   *
   * @return the indicator that the term id sequence has been successfully persisted by the database writing process
   */
  public boolean isTermIdSequencePersisted() {
    return isTermIdSequencePersisted;
  }
  
  /** Sets the indicator that the term id sequence has been successfully persisted by the database writing process.
   *
   * @param isTermIdSequencePersisted the indicator that the term id sequence has been successfully persisted by the database writing process
   */
  public void setIsTermIdSequencePersisted(final boolean isTermIdSequencePersisted) {
    this.isTermIdSequencePersisted = isTermIdSequencePersisted;
  }


}




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