ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

escjava.translate
Class Frame.ModifiesIterator

java.lang.Object
  extended byescjava.translate.Frame.ModifiesIterator
Enclosing class:
Frame

static class Frame.ModifiesIterator
extends java.lang.Object

This class enables iterating over the set of store-ref locations in a ModifiesGroupPragma. It also has the ability to include in the iteration the contents of datagroups that are part of the set of store-ref locations.

Author:
David Cok

Field Summary
private  java.util.List done
          The datagroups that have already been expanded
private  boolean expandDatagroups
          If true, then datagroups are expanded and their contents made part of the iteration.
private  boolean expandWild
          If true, then field wild card store refs (obj.* and Type.*) are expanded and their contents made part of the iteration.
private  int i
          An array index into mp
private  int limit
          The maximum number of times to unroll a maps reference.
private  CondExprModifierPragmaVec mp
          The set of store-ref locations over which to iterate.
private  java.util.List others
          Fields that have yet to be iterated over.
private  TypeDecl td
          The TypeDecl whose view of any datagroups is to be used.
 
Constructor Summary
Frame.ModifiesIterator(TypeDecl td, CondExprModifierPragmaVec mp, boolean expandDatagroups)
          Creates an iterator over the store-ref locations in the CondExprModifierPragmaVec.
Frame.ModifiesIterator(TypeDecl td, CondExprModifierPragmaVec mp, boolean expandDatagroups, boolean expandWild)
          Creates an iterator over the store-ref locations in the CondExprModifierPragmaVec.
 
Method Summary
private  void add(ObjectDesignator od, FieldDecl d)
          Adds the contents of the datagroup d (of object od, which may not be null) to the 'others' list.
private  void addFields(ObjectDesignator od)
          Adds all the fields of the od (whether it is a type or an object) into the 'others' list as FieldAccess items.
private  int count(FieldDecl d)
          Returns the number of times the argument is in the 'done' list
 boolean hasNext()
          Returns true if there is more to the iteration
 java.lang.Object next()
          Returns the next element of the iteration; only valid if hasNext returns true, otherwise throws an exception
 void reset()
          Resets the iteration back to the beginning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

td

private final TypeDecl td
The TypeDecl whose view of any datagroups is to be used.


mp

private final CondExprModifierPragmaVec mp
The set of store-ref locations over which to iterate.


others

private final java.util.List others
Fields that have yet to be iterated over. This is a list of FieldAccess objects.


done

private final java.util.List done
The datagroups that have already been expanded


expandDatagroups

private final boolean expandDatagroups
If true, then datagroups are expanded and their contents made part of the iteration.


expandWild

private final boolean expandWild
If true, then field wild card store refs (obj.* and Type.*) are expanded and their contents made part of the iteration.


i

private int i
An array index into mp


limit

private int limit
The maximum number of times to unroll a maps reference.

Constructor Detail

Frame.ModifiesIterator

public Frame.ModifiesIterator(TypeDecl td,
                              CondExprModifierPragmaVec mp,
                              boolean expandDatagroups)
Creates an iterator over the store-ref locations in the CondExprModifierPragmaVec. The expandWild parameter is set false.

Parameters:
mp - The set of store-ref locations over which to iterate
expandDatagroups - if true, then datagroups are expanded and their contents (recursively) become steps in the iteration

Frame.ModifiesIterator

public Frame.ModifiesIterator(TypeDecl td,
                              CondExprModifierPragmaVec mp,
                              boolean expandDatagroups,
                              boolean expandWild)
Creates an iterator over the store-ref locations in the CondExprModifierPragmaVec.

Parameters:
mp - The set of store-ref locations over which to iterate
expandDatagroups - if true, then datagroups are expanded and their contents (recursively) become steps in the iteration
expandWild - if true, then store-ref expressions of the form obj.* are expanded into their individual fields
Method Detail

reset

public void reset()
Resets the iteration back to the beginning


hasNext

public boolean hasNext()
Returns true if there is more to the iteration

Returns:
true if there is more to the iteration

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Returns the next element of the iteration; only valid if hasNext returns true, otherwise throws an exception

Returns:
the next element of the iteration
Throws:
java.util.NoSuchElementException - if there are no more elements in the iteration

addFields

private void addFields(ObjectDesignator od)
Adds all the fields of the od (whether it is a type or an object) into the 'others' list as FieldAccess items.

Parameters:
od -

add

private void add(ObjectDesignator od,
                 FieldDecl d)
Adds the contents of the datagroup d (of object od, which may not be null) to the 'others' list.

Parameters:
od - Object reference
d - Declaration of the datagroup

count

private int count(FieldDecl d)
Returns the number of times the argument is in the 'done' list

Parameters:
d - Object to be checked
Returns:
The number of times the argument is in the 'done' list

ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage