Functor.java

// FILE. . . . . d:/hak/hlt/src/hlt/fot/Functor.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hak-Laptop
// STARTED ON. . Sat Jul 14 07:23:44 2018

// Last modified on Sat Aug 25 05:07:43 2018 by hak

package hlt.fot;



This is a class for a term-constructor functor (element of a Signature).

See also:  Signature
Copyright:  © by the author
Author:  Hassan Aït-Kaci
Version:  Last modified on Sun Jul 15 08:50:27 2018 by hak



public class Functor
{ /* ************************************************************************ */

  

Name of this functor.


  protected String name;

  

Returns the name of this functor.


  public String name ()
  {
    return this.name;
  }

  // /**
  //  * Sets the name of this functor to the given string and returns this functor.
  //  */
  // public Functor setName (String name)
  // {
  //   this.name = name;
  //   return this;
  // }

  /* ************************************************************************ */
  
  

Number of arguments for a term with this functor as root symbol.


  protected int arity;

  

Returns the number of arguments taken by this functor.


  public int arity ()
  {
    return this.arity;
  }

  // /**
  //  * Sets the arity of this functor to the given <tt>int</tt> and
  //  * returns this functor.
  //  */
  // public Functor setArity (int arity)
  // {
  //   this.arity = arity;
  //   return this;
  // }

  /* ************************************************************************ */
  
  

Signature of where this functor belongs.


  protected Signature signature;

  

Returns the signature where this functor belongs.


  public Signature signature ()
  {
    return signature;
  }

  

Index of this functor in its signature (starting at 0 and at most signature.size()); i.e., this.functorIndex = signature.functor(index).


  protected int index;

  

Returns the index of this functor in its signature (starting at 0 and at most signature.size()-1) and is equal to signature.functor(index()).


  public int index ()
  {
    return index;
  }

  

Returns the position of this functor in its signature (starting at 1 and at most signature.size()) that is such that this.position() = this.index()+1.


  public int position ()
  {
    return index+1;
  }

  /* ************************************************************************ */

  

Constructs a functor object name/arity at position index in signature.


  public Functor (int index, String name, int arity, Signature signature)
  {
    this.index = index;
    this.name = name;
    this.arity = arity;
    this.signature = signature;
  }

  /* ************************************************************************ */

  public boolean equal (Functor functor)
  {
    return this == functor;
  }

  /* ************************************************************************ */

  public String toString ()
  {
    return name; // +"/"+arity;
  }
}


This file was generated on Sat Aug 25 07:59:54 CEST 2018 from file Functor.java
by the hlt.language.tools.Hilite Java tool written by Hassan Aït-Kaci