本文整理汇总了Java中com.heaven7.java.base.util.SparseArray.get方法的典型用法代码示例。如果您正苦于以下问题:Java SparseArray.get方法的具体用法?Java SparseArray.get怎么用?Java SparseArray.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.heaven7.java.base.util.SparseArray
的用法示例。
在下文中一共展示了SparseArray.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetStates
import com.heaven7.java.base.util.SparseArray; //导入方法依赖的package包/类
@Override
public final List<S> getTargetStates(int states, List<S> outStates) {
if (outStates == null) {
outStates = new ArrayList<S>();
}
final SparseArray<S> map = this.mStateMap;
int maxKey;
S s;
for (; states > 0;) {
maxKey = max2K(states);
s = map.get(maxKey);
if (s != null) {
outStates.add(s);
}
states -= maxKey;
}
return outStates;
}
示例2: exit0
import com.heaven7.java.base.util.SparseArray; //导入方法依赖的package包/类
private void exit0(int singleState, boolean byMutex) {
final SparseArray<S> stateMap = getStateMap();
S state = stateMap.get(singleState);
// no cache ? remove from cache
if (!isStateCacheEnabled()) {
stateMap.remove(singleState);
mCachedState &= ~singleState;
} else {
mCachedState |= singleState;
}
final P p = getMerger().merge(state.getStateParameter(), getStateParameter());
state.setStateParameter(p);
state.exit(byMutex ? AbstractState.FLAG_MUTEX : 0);
dispatchStateCallback(ACTION_EXIT, singleState, state, null);
state.onDetach();
}
示例3: dispose
import com.heaven7.java.base.util.SparseArray; //导入方法依赖的package包/类
public void dispose() {
final SparseArray<S> map = getStateMap();
getFlagsInternal(mCurrentStates, sTempFlags);
for(int state : sTempFlags){
final S s = map.get(state);
//TODO should destroy foreground state.?
s.exit(0);
s.onDetach();
s.dispose();
map.remove(state);
// System.out.println("dispose : " + s.toString());
}
sTempFlags.clear();
this.mCurrentStates = 0;
this.mCachedState = 0;
this.mParam = null;
}
示例4: getTargetStates
import com.heaven7.java.base.util.SparseArray; //导入方法依赖的package包/类
private List<S> getTargetStates(int targetStates, List<S> outStates) {
if (targetStates == 0) {
return null;
}
if(outStates == null){
outStates = new ArrayList<S>();
}
final SparseArray<S> stateMap = getStateMap();
getFlagsInternal(targetStates, sTempFlags);
for(int state : sTempFlags){
S s = stateMap.get(state);
if(s != null){
s.setId(state);
outStates.add(s);
}else{
System.err.println("[WARN] StateGroup >>> called [ getTargetStates()] : state not exit. state =" + state);
}
}
sTempFlags.clear();
return outStates;
}
示例5: enter0
import com.heaven7.java.base.util.SparseArray; //导入方法依赖的package包/类
private void enter0(int singleState, S state) {
if (state == null) {
throw new IllegalStateException("create state failed. Are you forget to create State " + "for state_flag = "
+ singleState + " by StateFactory? ");
}
// cache state
mCachedState &= ~singleState;
getStateMap().put(singleState, state);
final P p = getMerger().merge(state.getStateParameter(), getStateParameter());
state.setStateParameter(p);
state.onAttach(getController());
state.setId(singleState);
state.enter(0);
//dispatch callback
dispatchStateCallback(ACTION_ENTER, singleState, state, null);
state.clearOnceFlags();
// handle mutex states
int[] mutexStates = getController().getMutexState(singleState);
if (mutexStates != null) {
final SparseArray<S> stateMap = getStateMap();
int oppositeState = 0;
for (int s : mutexStates) {
// state is not the main state.
if (s != singleState && stateMap.get(s) != null) {
oppositeState |= s;
exit0(s, true);
}
}
this.mCurrentStates &= ~oppositeState;
// System.out.println("mutex state occurs. Main state : " +
// singleState + " , Mutex states : "+
// Arrays.toString(mutexStates));
// System.out.println("mutex state occurs. after adjust current
// state : " + mCurrentStates);
}
}