Prolog Cafe v1.2

jp.ac.kobe_u.cs.prolog.lang
Class InternalDatabase

java.lang.Object
  extended by jp.ac.kobe_u.cs.prolog.lang.InternalDatabase
All Implemented Interfaces:
java.io.Serializable

public class InternalDatabase
extends java.lang.Object
implements java.io.Serializable

Internal database for dynamic predicates.

See Also:
Serialized Form

Field Summary
protected  Term[] buffer
          An array of Term entries.
protected  int maxContents
          Maximum size of enties.
protected  java.util.LinkedList<java.lang.Integer> reusableIndices
          A list of reusable entry indices.
protected  int top
          the top index of this InternalDatabase.
 
Constructor Summary
InternalDatabase()
          Constructs a new internal dababase.
InternalDatabase(int n)
          Constructs a new internal dababase with the given size.
 
Method Summary
 boolean empty()
          Tests if this has no entry.
 Term erase(int i)
          Erases an entry with the given index from this InternalDatabase.
protected  void eraseAll()
          Discards all entries.
 Term get(int i)
          Returns an entry with the given index from this InternalDatabase.
 void init()
          Discards all entries.
 int insert(Term t)
          Inserts an entry to this InternalDatabase.
 void show()
          Shows the contents of this InternalDatabase.
 int top()
          Returns the value of top.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxContents

protected int maxContents
Maximum size of enties. Initial size is 100000.


buffer

protected Term[] buffer
An array of Term entries.


reusableIndices

protected java.util.LinkedList<java.lang.Integer> reusableIndices
A list of reusable entry indices.


top

protected int top
the top index of this InternalDatabase.

Constructor Detail

InternalDatabase

public InternalDatabase()
Constructs a new internal dababase.


InternalDatabase

public InternalDatabase(int n)
Constructs a new internal dababase with the given size.

Method Detail

init

public void init()
Discards all entries.


insert

public int insert(Term t)
Inserts an entry to this InternalDatabase.


get

public Term get(int i)
Returns an entry with the given index from this InternalDatabase.


erase

public Term erase(int i)
Erases an entry with the given index from this InternalDatabase.


eraseAll

protected void eraseAll()
Discards all entries.


empty

public boolean empty()
Tests if this has no entry.


top

public int top()
Returns the value of top.

See Also:
top

show

public void show()
Shows the contents of this InternalDatabase.


Prolog Cafe v1.2

Copyright (C) 1997-2008 M.BANBARA and N.TAMURA