<commit_before>/*
 * Cacheonix systems licenses this file to You under the LGPL 2.1
 * (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.cacheonix.org/products/cacheonix/license-lgpl-2.1.htm
 *
 * 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 org.cacheonix.impl.cache.store;

/**
 * Tracks number of elements across a set of buckets.
 */
public final class SharedCounter {

   private long counter = 0L;

   private final long maxValue;


   /**
    * Creates a counter.
    *
    * @param maxValue a maximum value. The maximum value is used for reference and does not affect counting.
    */
   public SharedCounter(final long maxValue) {

      this.maxValue = maxValue;
   }


   /**
    * Increments the counter.
    *
    * @return a new counter value.
    */
   public long increment() {

      ++counter;

      return counter;
   }


   /**
    * Decrement the counter.
    *
    * @return a new counter value.
    */
   public long decrement() {

      --counter;

      return counter;
   }


   /**
    * Adds a value to the counter.
    *
    * @param value the value to add to the counter.
    * @return a new counter value.
    */
   public long add(final long value) {

      counter = counter + value;

      return counter;
   }


   /**
    * Subtracts a value from the counter.
    *
    * @param value the value to subtract from the counter.
    * @return a new counter value.
    */
   public long subtract(final long value) {

      counter = counter - value;

      return counter;
   }
<commit_msg>Code quality: simplified assignment<commit_after>/*
 * Cacheonix systems licenses this file to You under the LGPL 2.1
 * (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.cacheonix.org/products/cacheonix/license-lgpl-2.1.htm
 *
 * 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 org.cacheonix.impl.cache.store;

/**
 * Tracks number of elements across a set of buckets.
 */
public final class SharedCounter {

   private long counter = 0L;

   private final long maxValue;


   /**
    * Creates a counter.
    *
    * @param maxValue a maximum value. The maximum value is used for reference and does not affect counting.
    */
   public SharedCounter(final long maxValue) {

      this.maxValue = maxValue;
   }


   /**
    * Increments the counter.
    *
    * @return a new counter value.
    */
   public long increment() {

      ++counter;

      return counter;
   }


   /**
    * Decrement the counter.
    *
    * @return a new counter value.
    */
   public long decrement() {

      --counter;

      return counter;
   }


   /**
    * Adds a value to the counter.
    *
    * @param value the value to add to the counter.
    * @return a new counter value.
    */
   public long add(final long value) {

      counter += value;

      return counter;
   }


   /**
    * Subtracts a value from the counter.
    *
    * @param value the value to subtract from the counter.
    * @return a new counter value.
    */
   public long subtract(final long value) {

      counter -= value;

      return counter;
   }

{'fraction_non_alphanumeric': 0.0847324239244491, 'fraction_numerical': 0.0026232948583420775, 'mean_word_length': 2.3743362831858406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4436816', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1036, 'n_words': 441}