kodkod.ast
Class Decls

java.lang.Object
  extended by kodkod.ast.Decls
All Implemented Interfaces:
java.lang.Iterable<Decl>, Node
Direct Known Subclasses:
Decl

public class Decls
extends java.lang.Object
implements Node, java.lang.Iterable<Decl>

A sequence of declarations.

Author:
Emina Torlak
invariant:
size > 0
children = declarations[int]
specfield:
size: int
declarations: [0..size) -> one Decl

Method Summary
<E,F,D,I> D
accept(ReturnVisitor<E,F,D,I> visitor)
          Accepts the given visitor and returns the result.
 void accept(VoidVisitor visitor)
          Accepts the given visitor.
 Decls and(Decls decls)
          Returns a sequence of this.size + decls.size declarations that has these declarations as the prefix and the given declarations as the suffix.
 java.util.List<Decl> declarations()
          Returns an unmodifiable List view of this declaration sequence
 java.util.Iterator<Decl> iterator()
          Returns an unmodifiable iterator over the declarations in this Decls object.
 int size()
          Returns the number of declarations in this Decls object.
 java.lang.String toString()
          Returns the string representation of these decls.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

declarations

public java.util.List<Decl> declarations()
Returns an unmodifiable List view of this declaration sequence

Returns:
{l: List | l.elems = this.declarations }

size

public int size()
Returns the number of declarations in this Decls object.

Returns:
this.size

iterator

public java.util.Iterator<Decl> iterator()
Returns an unmodifiable iterator over the declarations in this Decls object.

Specified by:
iterator in interface java.lang.Iterable<Decl>
Returns:
this.declarations().iterator()

and

public final Decls and(Decls decls)
Returns a sequence of this.size + decls.size declarations that has these declarations as the prefix and the given declarations as the suffix.

Returns:
{ds: Decls | ds.size = this.size + decls.size && ds.declarations = this.declarations + {i: [this.size..this.size+decls.size), d: Decl | d = decls.declarations[i-this.size] }
Throws:
java.lang.NullPointerException - - decl = null

accept

public <E,F,D,I> D accept(ReturnVisitor<E,F,D,I> visitor)
Accepts the given visitor and returns the result.

Specified by:
accept in interface Node
Returns:
the result of being visited by the given visitor
See Also:
Node.accept(kodkod.ast.visitor.ReturnVisitor)

accept

public void accept(VoidVisitor visitor)
Accepts the given visitor.

Specified by:
accept in interface Node
See Also:
Node.accept(kodkod.ast.visitor.VoidVisitor)

toString

public java.lang.String toString()
Returns the string representation of these decls.

Overrides:
toString in class java.lang.Object
Returns:
string representation of these decls