Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package x39.Settings;
- import java.util.ArrayList;
- import java.util.List;
- public class SOFTUO_SettingsNodeCollection {
- private int _validIndex;
- private int _actualIndex;
- private List<SettingsNode> _list;
- protected SOFTUO_SettingsNodeCollection(){
- _validIndex = -1;
- _actualIndex = -1;
- _list = new ArrayList<SettingsNode>();
- }
- public void up(int i){
- _actualIndex -= i;
- if(_actualIndex < 0 || i < 0)
- _actualIndex = 0;
- }
- public void up(){up(1);}
- public void down(SettingsNode node){
- if(_validIndex > -1)
- _list.get(_actualIndex).addChild(node);
- _actualIndex++;
- _validIndex = _actualIndex;
- if(_list.size() < _validIndex + 1)
- _list.add(node);
- else
- _list.set(_actualIndex, node);
- }
- public boolean down(){
- if(_actualIndex == _validIndex)
- return false;
- _actualIndex--;
- return true;
- }
- public SettingsNode getNode(){
- if(_validIndex <= -1)
- return null;
- return _list.get(_actualIndex);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement