You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by mb...@apache.org on 2019/11/08 14:30:00 UTC

[incubator-daffodil] 05/06: Fix incorrect comment about queue depth. Whitespace standardization.

This is an automated email from the ASF dual-hosted git repository.

mbeckerle pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git

commit 83e59c1f392d443f20efebf10bd367500e71069a
Author: Michael Beckerle <mb...@tresys.com>
AuthorDate: Tue Nov 5 19:14:20 2019 -0500

    Fix incorrect comment about queue depth. Whitespace standardization.
---
 .../apache/daffodil/infoset/InfosetInputter.scala   | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetInputter.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetInputter.scala
index 8d14022..04749ea 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetInputter.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/InfosetInputter.scala
@@ -148,7 +148,7 @@ abstract class InfosetInputter
 
   override def inspectPure: Boolean = {
     accessor = inspectAccessor
-    
+
     val res = priorOpKind match {
       case Advance => {
         priorOpKind = InspectPure
@@ -159,10 +159,10 @@ abstract class InfosetInputter
         } else {
           next() //advance the input stream so nextElementErd is pointing to the correct place
           val eventKind = getEventType() match {
-            case StartElement  => StartKind
-            case EndElement    => EndKind
+            case StartElement => StartKind
+            case EndElement => EndKind
             case StartDocument => StartKind
-            case EndDocument   => EndKind
+            case EndDocument => EndKind
           }
           accessor.kind = eventKind
           if (eventKind == StartKind) {
@@ -190,14 +190,17 @@ abstract class InfosetInputter
    * in multiple infoset events. For each pull, the first event coming back is not
    * queued. Only additional extra events are queued.
    *
-   * Note that there should never be more than 3 events in the queue. This
+   * Note that there should never be more than 2 events in the queue. This
    * occurs when ending an array following by a new array of simple elements.
    * In this case, we get events 1) End Old DIArray 2) Start New DIArray 3)
-   * Start DISimple 4) End DISimple. The first event is stored in the cursor,
+   * Start new element. The first event is stored in the cursor,
    * the remaining events are queued. We also always empty the queue before
-   * enqueuing anything again. So implement this queue as an array of size 3,
+   * enqueuing anything again. So implement this queue as an array of size 2,
    * and when all items have been dequeued, reset the indices to start the next
    * enqueues at the beginning of the array.
+   *
+   * To avoid tuple allocation and overhead, this is done as a pair of arrays, not
+   * an array of pairs.
    */
   final private val MaxPendingQueueSize = 2
   private val pendingNodes = new Array[DINode](MaxPendingQueueSize)
@@ -259,8 +262,8 @@ abstract class InfosetInputter
     }
   }
 
-  private def reallyFill(advanceInput:Boolean): Boolean = {
-    if(advanceInput){
+  private def reallyFill(advanceInput: Boolean): Boolean = {
+    if (advanceInput) {
       next()
     }