本文整理匯總了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);
}
}