edu.mit.csail.sdg.alloy4compiler.ast
Class Decl

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4compiler.ast.Decl

public final class Decl
extends java.lang.Object

Immutable; this declaration binds a list of names to an expression.


Field Summary
 Pos disjoint
          If nonnull, then each name is disjoint (and this.disjoint is the location of the "disjoint" keyword)
 Pos disjoint2
          If nonnull, then each atom of this sig has disjoint value for this field (and this.disjoint2 is the location of the "disjoint" keyword)
 Expr expr
          The value that the list of names are bound to.
 Pos isPrivate
          If nonnull, then this decl is private (and this.isPrivate is the location of the "private" keyword)
 ConstList<? extends ExprHasName> names
          The list of names.
 
Constructor Summary
Decl(Pos isPrivate, Pos disjoint, Pos disjoint2, java.util.List<? extends ExprHasName> names, Expr expr)
          This constructs a declaration; the list of names must not be empty.
 
Method Summary
static ExprHasName findDuplicateName(java.util.List<Decl> list)
          If the list of declaration contains a duplicate name, return one such duplicate name, else return null.
 ExprHasName get()
          Return the first variable in this declaration.
 boolean hasName(java.lang.String name)
          Returns true if this declaration contains the given name.
 Pos span()
          Returns a Pos object representing the entire span of this expression and all its subexpressions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isPrivate

public final Pos isPrivate
If nonnull, then this decl is private (and this.isPrivate is the location of the "private" keyword)


disjoint

public final Pos disjoint
If nonnull, then each name is disjoint (and this.disjoint is the location of the "disjoint" keyword)


disjoint2

public final Pos disjoint2
If nonnull, then each atom of this sig has disjoint value for this field (and this.disjoint2 is the location of the "disjoint" keyword)


names

public final ConstList<? extends ExprHasName> names
The list of names.


expr

public final Expr expr
The value that the list of names are bound to.

Constructor Detail

Decl

public Decl(Pos isPrivate,
            Pos disjoint,
            Pos disjoint2,
            java.util.List<? extends ExprHasName> names,
            Expr expr)
This constructs a declaration; the list of names must not be empty.

Method Detail

span

public Pos span()
Returns a Pos object representing the entire span of this expression and all its subexpressions.


get

public ExprHasName get()
Return the first variable in this declaration.


findDuplicateName

public static ExprHasName findDuplicateName(java.util.List<Decl> list)
If the list of declaration contains a duplicate name, return one such duplicate name, else return null.


hasName

public boolean hasName(java.lang.String name)
Returns true if this declaration contains the given name.