xtc.parser
Class ModuleDependency

java.lang.Object
  extended by xtc.tree.Node
      extended by xtc.parser.ModuleDependency
All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>, Locatable
Direct Known Subclasses:
ModuleImport, ModuleInstantiation, ModuleModification

public abstract class ModuleDependency
extends Node

A grammar module dependency. Note that two module dependencies are equal if they describe the same module.

Version:
$Revision: 1.16 $
Author:
Robert Grimm

Field Summary
 ModuleList arguments
          The arguments to the dependent module.
 ModuleName module
          The name of the dependent module.
 ModuleName target
          The optional target module name.
 
Constructor Summary
ModuleDependency(ModuleName module, ModuleList arguments, ModuleName target)
          Create a new module dependency.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isConsistentWith(ModuleDependency dep)
          Determine whether this module dependency is consistent with the specified dependency, which has been resolved previously.
 boolean isImport()
          Determine whether this dependency is a module import.
 boolean isInstantiation()
          Determine whether this dependency is a module instantiation.
 boolean isModification()
          Determine whether this dependency is a module modification.
 ModuleDependency rename(ModuleMap renaming)
          Rename this module dependency.
 ModuleName visibleName()
          Get the visible name for this module dependency.
 
Methods inherited from class xtc.tree.Node
add, add, addAll, addAll, addAll, addAll, addAllTo, addNode, contains, get, getBoolean, getBooleanProperty, getGeneric, getList, getLocation, getName, getNode, getProperty, getString, getStringProperty, getTokenText, hasLocation, hasName, hasProperty, hasTraversal, hasVariable, indexOf, isAnnotation, isEmpty, isGeneric, isList, isToken, iterator, lastIndexOf, properties, remove, removeProperty, set, setLocation, setLocation, setProperty, size, strip, toAnnotation, toList, toString, toToken, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

module

public ModuleName module
The name of the dependent module.


arguments

public ModuleList arguments
The arguments to the dependent module.


target

public ModuleName target
The optional target module name.

Constructor Detail

ModuleDependency

public ModuleDependency(ModuleName module,
                        ModuleList arguments,
                        ModuleName target)
Create a new module dependency. If the specified arguments are null, they are replaced with an empty module list. If the specified target equals the module name, it is replaced by null.

Parameters:
module - The module name.
arguments - The arguments.
target - The target module name.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

isImport

public boolean isImport()
Determine whether this dependency is a module import.

Returns:
true if this dependency is an import.

isInstantiation

public boolean isInstantiation()
Determine whether this dependency is a module instantiation.

Returns:
true if this dependency is an instantiation.

isModification

public boolean isModification()
Determine whether this dependency is a module modification.

Returns:
true if this dependency is a modification.

visibleName

public ModuleName visibleName()
Get the visible name for this module dependency. The visible name is the qualifier available for nonterminals referencing productions in the dependent module.

Returns:
The visible name.

isConsistentWith

public boolean isConsistentWith(ModuleDependency dep)
Determine whether this module dependency is consistent with the specified dependency, which has been resolved previously.

Parameters:
dep - The previously resolved dependency.
Returns:
true if this module dependency is consistent with the specified one.

rename

public ModuleDependency rename(ModuleMap renaming)
Rename this module dependency. This method modifies this module dependency based on the specified module map. If any module name is renamed, the new module name's original property is set to the original module name.

Parameters:
renaming - The module map.
Returns:
This module dependency.


Copyright © 2012. All Rights Reserved.