/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hp.hpl.jena.sparql.core;

import com.hp.hpl.jena.graph.Node ;

/** Count changes */
public class DatasetChangesCounter implements DatasetChanges
{
    long countStart = 0 ;
    long countFinish = 0 ;
    long countAdd = 0 ;
    long countDelete = 0 ;
    long countNoAdd = 0 ;
    long countNoDelete = 0 ;
    
    
    @Override
    public void start()
    {
        countStart++ ;
    }

    @Override
    public void change(QuadAction qaction, Node g, Node s, Node p, Node o)
    {
        switch (qaction)
        {
            case ADD:       countAdd++ ; break ;
            case DELETE:    countDelete++ ; break ;
            case NO_ADD:    countNoAdd++ ; break ;
            case NO_DELETE: countNoDelete++ ; break ;
            //default : break ; 
        }
    }

    @Override
    public void finish()
    {
        countFinish++ ;
    }
}

@@ -893,16 +893,59 @@
  changes
+, or simply note if a change has been made.
  */%0Apubl
@@ -1023,16 +1023,19 @@
 ntStart 
+   
 = 0 ;%0A  
@@ -1053,22 +1053,29 @@
 tFinish 
+  
 = 0 ;%0A
+    %0A
     long
@@ -1080,24 +1080,29 @@
 ng countAdd 
+     
 = 0 ;%0A    lo
@@ -1112,24 +1112,26 @@
 countDelete 
+  
 = 0 ;%0A    lo
@@ -1144,16 +1144,19 @@
 ntNoAdd 
+   
 = 0 ;%0A  
@@ -1187,21 +1187,16 @@
  ;%0A    %0A
-    %0A
     @Ove
@@ -1224,20 +1224,16 @@
  start()
-%0A   
  %7B%0A     
@@ -1349,47 +1349,113 @@
 e o)
+ %7B
 %0A    
-%7B%0A        switch (qaction)%0A       
+    if ( qaction == null )%0A            throw new NullPointerException() ;%0A        switch (qaction)
  %7B%0A 
@@ -1691,16 +1691,23 @@
 break ; 
+       
 %0A       
@@ -1758,19 +1758,15 @@
 sh()
+ %7B
 %0A    
-%7B%0A    
     
@@ -1778,16 +1778,325 @@
 Finish++
+ ;%0A    %7D%0A    %0A    public boolean hasChanged() %7B%0A        return countAdd %3E 0 %7C%7C countDelete %3E 0 ;%0A    %7D%0A    %0A    public void reset() %7B %0A        countStart    = 0 ;%0A        countFinish   = 0 ;%0A        %0A        countAdd      = 0 ;%0A        countDelete   = 0 ;%0A        countNoAdd    = 0 ;%0A        countNoDelete = 0
  ;%0A    %7D
@@ -2096,10 +2096,12 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A
+%0A

Add operations to simply indicate whether change (probably) happened.