代码拉取完成,页面将自动刷新
//xlang Source, Name:ActionRecorder.xcsm
//Date: Wed Nov 15:17:35 2018
class ActionRecorder{
static class Action{
public Action(String s, int pos){
source = s;
position = pos;
}
public String source;
public int position;
};
Action lastAction ;
int pointer = 0;
Vector<Action> actions = new Vector<Action>();
public void addAction(String source, int pos){
if (lastAction != nilptr && lastAction.source.equals(source) && lastAction.position == pos){
return ;
}
tripAction();
if (actions.size() >= 1000){
actions.remove(0);
}
lastAction = new Action(source, pos);
pointer = actions.size();
actions.add(lastAction);
}
public void tripAction(){
while (actions.size() > (pointer + 1)){
actions.remove( actions.size() - 1);
}
}
public void undo(){
if ((pointer > 0) && (pointer < actions.size())){
pointer--;
lastAction = actions.get(pointer);
XSourceEditor.localtion(lastAction.source, lastAction.position);
}
}
public void redo(){
if ((pointer >=0) && (pointer + 1 < actions.size())){
pointer++;
lastAction = actions.get(pointer);
XSourceEditor.localtion(lastAction.source, lastAction.position);
}
}
public void clear(){
actions.clear();
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。