Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ch.uzh.ifi.attempto.chartparser
Class Rule

    java.lang.Object
      ch.uzh.ifi.attempto.chartparser.Rule

    public class Rule

extends java.lang.Object

This class represents a grammar rule. A rule consists of a nonterminal category as its head, a sequence of categories as its body, and a boolean value that describes whether it is accessible or not. If a rule is not accessible then this means that no category of the body and no subcategory of those categories is accessible by any category outside of the body. This can be used to define which parts of the sentence are accessible for anaphoric references from a given position.

Author:
  Tobias Kuhn

Constructor Summary
`Rule(java.util.List<Category> categories)` Creates a new rule that is accessible.
`Rule(java.util.List<Category> categories, boolean accessible)` Creates a new rule.
`Rule(Nonterminal head, boolean accessible, Category... body)` Creates a new rule.
`Rule(Nonterminal head, Category... body)` Creates a new rule that is accessible.

Method Summary
`Rule` | `deepCopy()` Creates a deep copy of this rule.
`Rule` | `deepCopy(java.util.HashMap<java.lang.Integer,ch.uzh.ifi.attempto.chartparser.StringEntity> entities)` Creates a deep copy of this rule using the given string entities.
`Category[]` | `getBody()` Returns the body category sequence of this rule.
`Category` | `getFirst()` Returns the first category of the body.
`Nonterminal` | `getHead()` Returns the head category of this rule.
`boolean` | `hasEmptyBody()` Returns true if the body is empty (i.e.
`boolean` | `isAccessible()` Returns true if the rule is accessible.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Rule

    public Rule(Nonterminal head,
                boolean accessible,
                Category... body)

  Creates a new rule.

  Parameters:
    `head` - The head category.
    `accessible` - Defines whether the rule is accessible or not.
    `body` - The body category sequence.

### Rule

    public Rule(Nonterminal head,
                Category... body)

  Creates a new rule that is accessible.

  Parameters:
    `head` - The head category.
    `body` - The body category sequence.

### Rule

    public Rule(java.util.List<Category> categories,
                boolean accessible)

  Creates a new rule.

  Parameters:
    `categories` - The first category of this list stands for the head category (it has to be a Nonterminal object). The rest stands for the body categories.
    `accessible` - Defines whether the rule is accessible or not.

### Rule

    public Rule(java.util.List<Category> categories)

  Creates a new rule that is accessible.

  Parameters:
    `categories` - The first category of this list stands for the head category (it has to be a Nonterminal object). The rest stands for the body categories.

Method Detail

### getHead

    public Nonterminal getHead()

  Returns the head category of this rule.

  Returns:
    The head category.

### getBody

    public Category[] getBody()

  Returns the body category sequence of this rule.

  Returns:
    The body category sequence.

### hasEmptyBody

    public boolean hasEmptyBody()

  Returns true if the body is empty (i.e. it is an epsilon-rule).

  Returns:
    true if the body is empty.

### getFirst

    public Category getFirst()

  Returns the first category of the body.

  Returns:
    The first category of the body.

### isAccessible

    public boolean isAccessible()

  Returns true if the rule is accessible.

  Returns:
    true if the rule is accessible.

### deepCopy

    public Rule deepCopy()

  Creates a deep copy of this rule.

  Returns:
    A deep copy.

### deepCopy

    public Rule deepCopy(java.util.HashMap<java.lang.Integer,ch.uzh.ifi.attempto.chartparser.StringEntity> entities)

  Creates a deep copy of this rule using the given string entities. This method is usually called form another deepCopy-method.

  Parameters:
    `entities` - The string entities to be used.
  Returns:
    A deep copy.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch)