org.cpsolver.ifs.util

## Class PrologFile.Term

- java.lang.Object
- - org.cpsolver.ifs.util.PrologFile.Term

- Enclosing class:
    PrologFile

      public static class PrologFile.Term
      extends Object

  Term -- it can contain a text and a content (set of terms)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Term(List<PrologFile.Term> content)` constructor
    `Term(PrologFile.Term[] content)` constructor
    `Term(String text)` constructor
    `Term(String text, List<PrologFile.Term> content)` constructor
    `Term(String text, PrologFile.Term[] content)` constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `clone()`
    `PrologFile.Term` | `element(String name)` element of content named name
    `PrologFile.Term` | `elementAt(int idx)` idx-th element of content
    `boolean` | `equals(Object o)`
    `List<PrologFile.Term>` | `getContent()` return content
    `String` | `getText()` return text
    `int` | `hashCode()`
    `int` | `indexOf(String name)` index of element of content named name
    `int` | `size()` content size
    `boolean` | `toBoolean()` return text as boolean
    `boolean[]` | `toBooleanArray()` return content as boolean array
    `double` | `toDouble()` return text as double
    `int` | `toInt()` return text as int
    `int[]` | `toIntArray()` return content as int array
    `long` | `toLong()` return text as long
    `String` | `toString()` string representation of term
    `String[]` | `toStringArray()` return content as string array

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Term

          public Term(String text)

      constructor
      Parameters:
        `text` - name of the term

    - #### Term

          public Term(List<PrologFile.Term> content)

      constructor
      Parameters:
        `content` - inner terms

    - #### Term

          public Term(String text,
                      List<PrologFile.Term> content)

      constructor
      Parameters:
        `text` - name of the term
        `content` - inner terms

    - #### Term

          public Term(String text,
                      PrologFile.Term[] content)

      constructor
      Parameters:
        `text` - name of the term
        `content` - inner terms

    - #### Term

          public Term(PrologFile.Term[] content)

      constructor
      Parameters:
        `content` - inner terms

  - ### Method Detail

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### getText

          public String getText()

      return text
      Returns:
        term name

    - #### getContent

          public List<PrologFile.Term> getContent()

      return content
      Returns:
        term content (inner terms)

    - #### size

          public int size()

      content size
      Returns:
        number of inner terms

    - #### toInt

          public int toInt()

      return text as int
      Returns:
        term name as int

    - #### toLong

          public long toLong()

      return text as long
      Returns:
        term name as long

    - #### toDouble

          public double toDouble()

      return text as double
      Returns:
        term name as double

    - #### toBoolean

          public boolean toBoolean()

      return text as boolean
      Returns:
        term name as boolean

    - #### toBooleanArray

          public boolean[] toBooleanArray()

      return content as boolean array
      Returns:
        inner terms as booleans

    - #### toStringArray

          public String[] toStringArray()

      return content as string array
      Returns:
        inner terms as strings

    - #### toIntArray

          public int[] toIntArray()

      return content as int array
      Returns:
        inner terms as ints

    - #### elementAt

          public PrologFile.Term elementAt(int idx)

      idx-th element of content
      Parameters:
        `idx` - index of the inner term
      Returns:
        inner term

    - #### element

          public PrologFile.Term element(String name)

      element of content named name
      Parameters:
        `name` - name of the inner term
      Returns:
        inner term, null if not present

    - #### indexOf

          public int indexOf(String name)

      index of element of content named name
      Parameters:
        `name` - name of the inner term
      Returns:
        index of the inner term, -1 if not present

    - #### toString

          public String toString()

      string representation of term
      Overrides:
        `toString` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### clone

          public Object clone()

      Overrides:
        `clone` in class `Object`