001package org.cpsolver.ifs.util; 002 003/** 004 * Counter. 005 * 006 * @version IFS 1.3 (Iterative Forward Search)<br> 007 * Copyright (C) 2006 - 2014 Tomáš Müller<br> 008 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br> 009 * <a href="http://muller.unitime.org">http://muller.unitime.org</a><br> 010 * <br> 011 * This library is free software; you can redistribute it and/or modify 012 * it under the terms of the GNU Lesser General Public License as 013 * published by the Free Software Foundation; either version 3 of the 014 * License, or (at your option) any later version. <br> 015 * <br> 016 * This library is distributed in the hope that it will be useful, but 017 * WITHOUT ANY WARRANTY; without even the implied warranty of 018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 019 * Lesser General Public License for more details. <br> 020 * <br> 021 * You should have received a copy of the GNU Lesser General Public 022 * License along with this library; if not see 023 * <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>. 024 */ 025public class Counter { 026 private long iValue = 0; 027 028 /** Set counter 029 * @param value counter value 030 **/ 031 public void set(long value) { 032 iValue = value; 033 } 034 035 /** Returns current value 036 * @return counter value 037 **/ 038 public long get() { 039 return iValue; 040 } 041 042 /** Increment counter 043 * @param value counter increment 044 **/ 045 public void inc(long value) { 046 iValue += value; 047 } 048 049 /** Decrement counter 050 * @param value counter decrement 051 **/ 052 public void dec(long value) { 053 iValue -= value; 054 } 055}