001package net.sf.cpsolver.ifs.util; 002 003/** 004 * Counter. 005 * 006 * @version IFS 1.2 (Iterative Forward Search)<br> 007 * Copyright (C) 2006 - 2010 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 public void set(long value) { 030 iValue = value; 031 } 032 033 /** Returns current value */ 034 public long get() { 035 return iValue; 036 } 037 038 /** Increment counter */ 039 public void inc(long value) { 040 iValue += value; 041 } 042 043 /** Decrement counter */ 044 public void dec(long value) { 045 iValue -= value; 046 } 047}