示例#1
0
        public FormIndex decrementIndex(FormIndex index)
        {
            ArrayList indexes        = new ArrayList();
            ArrayList multiplicities = new ArrayList();
            ArrayList elements       = new ArrayList();

            if (index.isBeginningOfFormIndex())
            {
                return(index);
            }
            else if (index.isEndOfFormIndex())
            {
                if (form.Children == null || form.Children.Count == 0)
                {
                    return(FormIndex.createBeginningOfFormIndex());
                }
            }
            else
            {
                form.collapseIndex(index, indexes, multiplicities, elements);
            }

            decrementHelper(indexes, multiplicities, elements);

            if (indexes.Count == 0)
            {
                return(FormIndex.createBeginningOfFormIndex());
            }
            else
            {
                return(form.buildIndex(indexes, multiplicities, elements));
            }
        }
示例#2
0
        public virtual FormIndex decrementIndex(FormIndex index)
        {
            System.Collections.ArrayList indexes        = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            System.Collections.ArrayList multiplicities = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            System.Collections.ArrayList elements       = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));

            if (index.BeginningOfFormIndex)
            {
                return(index);
            }
            else if (index.EndOfFormIndex)
            {
                if (form.getChildren() == null || form.getChildren().size() == 0)
                {
                    return(FormIndex.createBeginningOfFormIndex());
                }
            }
            else
            {
                form.collapseIndex(index, indexes, multiplicities, elements);
            }

            decrementHelper(indexes, multiplicities, elements);

            if (indexes.Count == 0)
            {
                return(FormIndex.createBeginningOfFormIndex());
            }
            else
            {
                return(form.buildIndex(indexes, multiplicities, elements));
            }
        }
示例#3
0
 /**
  * Creates a new entry model for the form with the appropriate
  * repeat structure
  *
  * @param form
  * @param repeatStructure The structure of repeats (the repeat signals which should
  * be sent during form entry)
  * @throws IllegalArgumentException If repeatStructure is not valid
  */
 public FormEntryModel(FormDef form, int repeatStructure)
 {
     this.form = form;
     if (repeatStructure != REPEAT_STRUCTURE_LINEAR && repeatStructure != REPEAT_STRUCTURE_NON_LINEAR)
     {
         throw new ArgumentException(repeatStructure + ": does not correspond to a valid repeat structure");
     }
     //We need to see if there are any guessed repeat counts in the form, which prevents
     //us from being able to use the new repeat style
     //Unfortunately this is probably (A) slow and (B) might overflow the stack. It's not the only
     //recursive walk of the form, though, so (B) isn't really relevant
     if (repeatStructure == REPEAT_STRUCTURE_NON_LINEAR && containsRepeatGuesses(form))
     {
         repeatStructure = REPEAT_STRUCTURE_LINEAR;
     }
     this.repeatStructure  = repeatStructure;
     this.currentFormIndex = FormIndex.createBeginningOfFormIndex();
 }