📄 counter.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: Counter.java
package org.apache.struts2.util;
import java.io.Serializable;
import java.util.Iterator;
public class Counter
implements Iterator, Serializable
{
private static final long serialVersionUID = 0x26d0d1a71f117813L;
boolean wrap;
long first;
long current;
long interval;
long last;
public Counter()
{
wrap = false;
first = 1L;
current = first;
interval = 1L;
last = -1L;
}
public void setAdd(long addition)
{
current += addition;
}
public void setCurrent(long current)
{
this.current = current;
}
public long getCurrent()
{
return current;
}
public void setFirst(long first)
{
this.first = first;
current = first;
}
public long getFirst()
{
return first;
}
public void setInterval(long interval)
{
this.interval = interval;
}
public long getInterval()
{
return interval;
}
public void setLast(long last)
{
this.last = last;
}
public long getLast()
{
return last;
}
public long getNext()
{
long next = current;
current += interval;
if (wrap && current > last)
current -= (1L + last) - first;
return next;
}
public long getPrevious()
{
current -= interval;
if (wrap && current < first)
current += (last - first) + 1L;
return current;
}
public void setWrap(boolean wrap)
{
this.wrap = wrap;
}
public boolean isWrap()
{
return wrap;
}
public boolean hasNext()
{
return last != -1L && !wrap ? current <= last : true;
}
public Object next()
{
return new Long(getNext());
}
public void remove()
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -