public void onStopNestedScroll(View paramView) { z.a(paramView); int i2 = getChildCount(); int i1 = 0; if (i1 < i2) { View localView = getChildAt(i1); d locald = (d)localView.getLayoutParams(); if (!locald.h()) {} for (;;) { i1 += 1; break; Behavior localBehavior = locald.b(); if (localBehavior != null) { localBehavior.a(this, localView, paramView); } locald.g(); locald.j(); } } r = null; s = null; }
public void c(View paramView) { int i3 = g.size(); int i2 = 0; int i1 = 0; if (i2 < i3) { View localView = (View)g.get(i2); if (localView == paramView) { i1 = 1; } for (;;) { i2 += 1; break; if (i1 != 0) { d locald = (d)localView.getLayoutParams(); Behavior localBehavior = locald.b(); if ((localBehavior != null) && (locald.a(this, localView, paramView))) { localBehavior.c(this, localView, paramView); } } } } }
public boolean onStartNestedScroll(View paramView1, View paramView2, int paramInt) { int i2 = getChildCount(); int i1 = 0; boolean bool1 = false; if (i1 < i2) { View localView = getChildAt(i1); d locald = (d)localView.getLayoutParams(); Behavior localBehavior = locald.b(); if (localBehavior != null) { boolean bool2 = localBehavior.a(this, localView, paramView1, paramView2, paramInt); bool1 |= bool2; locald.a(bool2); } for (;;) { i1 += 1; break; locald.a(false); } } return bool1; }
public RpcPromise end() { if (_successlist.isEmpty() == false) { Behavior next = _successlist.remove(0); next.onNext(new RpcAsyncContext(null, this)); } return this; }
@Override public BehaviorStatus run() { tickParallel(); BehaviorStatus status = null; if (executing == null) { if ((executing = getNextBehavior()) == null) { return BehaviorStatus.FAILURE; } if (executing.shouldExecute()) { prepareForExecution(executing); } else { status = BehaviorStatus.FAILURE; } } if (status == null) { status = executing.run(); } if (status == BehaviorStatus.FAILURE) { if (retryChildren) { stopExecution(executing); executing = null; return BehaviorStatus.RUNNING; } } else if (status == BehaviorStatus.RESET_AND_REMOVE) { getBehaviors().remove(executing); stopExecution(executing); executing = null; return BehaviorStatus.SUCCESS; } return status; }
void a(boolean paramBoolean) { int i3 = ai.h(this); int i4 = g.size(); int i1 = 0; while (i1 < i4) { View localView = (View)g.get(i1); Object localObject1 = (d)localView.getLayoutParams(); int i2 = 0; while (i2 < i1) { localObject2 = (View)g.get(i2); if (h == localObject2) { b(localView, i3); } i2 += 1; } localObject1 = j; Object localObject2 = k; c(localView, (Rect)localObject1); a(localView, true, (Rect)localObject2); if (((Rect)localObject1).equals(localObject2)) { i1 += 1; } else { b(localView, (Rect)localObject2); i2 = i1 + 1; label155: Behavior localBehavior; if (i2 < i4) { localObject1 = (View)g.get(i2); localObject2 = (d)((View)localObject1).getLayoutParams(); localBehavior = ((d)localObject2).b(); if ((localBehavior != null) && (localBehavior.b(this, (View)localObject1, localView))) { if ((paramBoolean) || (!((d)localObject2).i())) { break label235; } ((d)localObject2).j(); } } for (;;) { i2 += 1; break label155; break; label235: boolean bool = localBehavior.c(this, (View)localObject1, localView); if (paramBoolean) { ((d)localObject2).b(bool); } } } } }
public boolean onTouchEvent(MotionEvent paramMotionEvent) { Object localObject = null; int i1 = t.a(paramMotionEvent); boolean bool2; if (q == null) { bool2 = a(paramMotionEvent, 1); if (!bool2) {} } for (;;) { Behavior localBehavior = ((d)q.getLayoutParams()).b(); boolean bool1; if (localBehavior != null) { bool1 = localBehavior.a(this, q, paramMotionEvent); } for (;;) { boolean bool3; if (q == null) { bool3 = bool1 | super.onTouchEvent(paramMotionEvent); paramMotionEvent = (MotionEvent)localObject; } do { if (((bool3) || (i1 != 0)) || (paramMotionEvent != null)) { paramMotionEvent.recycle(); } if ((i1 == 1) || (i1 == 3)) { e(); } return bool3; paramMotionEvent = (MotionEvent)localObject; bool3 = bool1; } while (!bool2); long l1; if (0 == 0) { l1 = SystemClock.uptimeMillis(); } for (paramMotionEvent = MotionEvent.obtain(l1, l1, 3, 0.0F, 0.0F, 0);; paramMotionEvent = null) { super.onTouchEvent(paramMotionEvent); bool3 = bool1; break; } bool1 = false; continue; bool1 = false; } bool2 = false; } }
/** Updates block stack and invokes any additional behavior. */ @Override public void exitScope(NodeTraversal t) { pop(blockStack); if (t.getScope().isGlobal()) { // Update global scope reference lists when we are done with it. compiler.updateGlobalVarReferences(referenceMap, t.getScopeRoot()); behavior.afterExitScope(t, compiler.getGlobalVarReferences()); } else { behavior.afterExitScope(t, new ReferenceMapWrapper(referenceMap)); } }
void b(View paramView) { int i2 = getChildCount(); int i1 = 0; while (i1 < i2) { View localView = getChildAt(i1); Behavior localBehavior = ((d)localView.getLayoutParams()).b(); if ((localBehavior != null) && (localBehavior.b(this, localView, paramView))) { localBehavior.d(this, localView, paramView); } i1 += 1; } }
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { paramInt2 = ai.h(this); paramInt3 = g.size(); paramInt1 = 0; while (paramInt1 < paramInt3) { View localView = (View)g.get(paramInt1); Behavior localBehavior = ((d)localView.getLayoutParams()).b(); if ((localBehavior == null) || (!localBehavior.a(this, localView, paramInt2))) { a(localView, paramInt2); } paramInt1 += 1; } }
public void onNext(RpcAsyncContext ctx, RpcPromise from) { if (from != null && from._lastPoint != null) { int index = _successlist.indexOf(from._lastPoint); _successlist.subList(0, index + 1).clear(); } if (_successlist.size() == 0) { onFinally(ctx); return; } Behavior next = null; next = _successlist.remove(0); if (next != null) { next.onNext(ctx); } }
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) { ViewParent p = this.getParent().getParent(); if (p instanceof CoordinatorLayout) { CoordinatorLayout cl = ((CoordinatorLayout) p); AppBarLayout apl = (AppBarLayout) cl.findViewById(R.id.app_bar_layout); CoordinatorLayout.LayoutParams lp = (LayoutParams) apl.getLayoutParams(); final Behavior viewBehavior = lp.getBehavior(); if (viewBehavior != null) { viewBehavior.onNestedFling(this, apl, target, velocityX, velocityY, consumed); } } return super.onNestedFling(target, velocityX, velocityY, consumed); }
public void onNestedScroll(View paramView, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { int i3 = getChildCount(); int i1 = 0; int i2 = 0; View localView; Object localObject; if (i2 < i3) { localView = getChildAt(i2); localObject = (d)localView.getLayoutParams(); if (((d)localObject).h()) {} } for (;;) { i2 += 1; break; localObject = ((d)localObject).b(); if (localObject != null) { ((Behavior)localObject).a(this, localView, paramView, paramInt1, paramInt2, paramInt3, paramInt4); i1 = 1; continue; if (i1 != 0) { a(true); } return; } } }
void b(View paramView, int paramInt) { d locald = (d)paramView.getLayoutParams(); if (g != null) { Object localObject = j; Rect localRect1 = k; Rect localRect2 = l; a(g, (Rect)localObject); a(paramView, false, localRect1); a(paramView, paramInt, (Rect)localObject, localRect2); paramInt = left - left; int i1 = top - top; if (paramInt != 0) { paramView.offsetLeftAndRight(paramInt); } if (i1 != 0) { paramView.offsetTopAndBottom(i1); } if ((paramInt != 0) || (i1 != 0)) { localObject = locald.b(); if (localObject != null) { ((Behavior)localObject).c(this, paramView, g); } } } }
private void onFinally(RpcAsyncContext ctx) { if (_finanlly != null) { _finanlly.onNext(ctx); } if (_nextPromise != null) { _nextPromise.onNext(ctx, this); } }
public void conditionFulfilled(Behavior beh) { if (!this.busy && behContainer.isBehaviorActivated(beh)) { this.busy = true; beh.consequent(counterActionFactory); this.busy = false; } else { // beh.condition(userActionFactory); } }
protected void onRestoreInstanceState(Parcelable paramParcelable) { paramParcelable = (SavedState)paramParcelable; super.onRestoreInstanceState(paramParcelable.getSuperState()); paramParcelable = a; int i2 = getChildCount(); int i1 = 0; while (i1 < i2) { View localView = getChildAt(i1); int i3 = localView.getId(); Behavior localBehavior = a(localView).b(); if ((i3 != -1) && (localBehavior != null)) { Parcelable localParcelable = (Parcelable)paramParcelable.get(i3); if (localParcelable != null) { localBehavior.a(this, localView, localParcelable); } } i1 += 1; } }
private void e() { int i1 = 0; if (q != null) { Behavior localBehavior = ((d)q.getLayoutParams()).b(); if (localBehavior != null) { long l1 = SystemClock.uptimeMillis(); MotionEvent localMotionEvent = MotionEvent.obtain(l1, l1, 3, 0.0F, 0.0F, 0); localBehavior.a(this, q, localMotionEvent); localMotionEvent.recycle(); } q = null; } int i2 = getChildCount(); while (i1 < i2) { ((d)getChildAt(i1).getLayoutParams()).f(); i1 += 1; } }
protected Parcelable onSaveInstanceState() { SavedState localSavedState = new SavedState(super.onSaveInstanceState()); SparseArray localSparseArray = new SparseArray(); int i2 = getChildCount(); int i1 = 0; while (i1 < i2) { Object localObject = getChildAt(i1); int i3 = ((View)localObject).getId(); Behavior localBehavior = ((d)((View)localObject).getLayoutParams()).b(); if ((i3 != -1) && (localBehavior != null)) { localObject = localBehavior.a(this, (View)localObject); if (localObject != null) { localSparseArray.append(i3, localObject); } } i1 += 1; } a = localSparseArray; return localSavedState; }
@Override public void setMiscText(String txt) { super.setMiscText(""); if (txt.startsWith("-")) { txt = txt.substring(1).toLowerCase().trim(); for (final Object[] A : affects) if (((CMObject) A[0]).ID().toLowerCase().equals(txt)) { unAffectAffected(A); return; } for (final Object[] A : affects) if ((A[0] instanceof Ability) && (((Environmental) A[0]).name().toLowerCase().startsWith(txt))) { unAffectAffected(A); return; } for (final Object[] A : affects) if ((A[0] instanceof Behavior) && (((Behavior) A[0]).name().toLowerCase().startsWith(txt))) { unAffectAffected(A); return; } } else if (txt.trim().length() > 0) { if (txt.startsWith("+")) txt = txt.substring(1); else for (final Object[] A : affects) unAffectAffected(A); int x = txt.indexOf(' '); if (x < 0) return; final String abilityStr = txt.substring(0, x).trim(); String numTicksStr = txt.substring(x + 1).trim(); String parms = ""; x = numTicksStr.indexOf(' '); if (x > 0) { parms = numTicksStr.substring(x + 1).trim(); numTicksStr = numTicksStr.substring(0, x); } CMObject A = CMClass.getAbility(abilityStr); if (A == null) A = CMClass.getBehavior(abilityStr); if (A == null) A = CMClass.findAbility(abilityStr); if (A == null) A = CMClass.findBehavior(abilityStr); if (A != null) { affects.addElement(new Object[] {A, new int[] {CMath.s_int(numTicksStr)}}); if (A instanceof Ability) ((Ability) A).setMiscText(parms); if ((A instanceof Behavior) && (affected instanceof PhysicalAgent)) ((Behavior) A).setParms(parms); finishInit(A); } } }
public void finishInit(CMObject A) { if (affected == null) return; if (A instanceof Ability) { ((Ability) A).makeNonUninvokable(); ((Ability) A).makeLongLasting(); ((Ability) A).setAffectedOne(affected); } if ((A instanceof Behavior) && (affected instanceof PhysicalAgent)) ((Behavior) A).startBehavior((PhysicalAgent) affected); if (affected != null) affected.recoverPhyStats(); if (affected instanceof MOB) { ((MOB) affected).recoverCharStats(); ((MOB) affected).recoverMaxState(); } initialized = true; }
public void onNestedScrollAccepted(View paramView1, View paramView2, int paramInt) { z.a(paramView1, paramView2, paramInt); r = paramView1; s = paramView2; int i2 = getChildCount(); int i1 = 0; if (i1 < i2) { View localView = getChildAt(i1); Object localObject = (d)localView.getLayoutParams(); if (!((d)localObject).h()) {} for (;;) { i1 += 1; break; localObject = ((d)localObject).b(); if (localObject != null) { ((Behavior)localObject).b(this, localView, paramView1, paramView2, paramInt); } } } }
public void run() { for (Behavior bee : io.getBehaviors()) { // Getting Pieces if (bee.getPiece() != null) { placePiece(bee.getStartPoint(), bee.getPiece()); System.out.println(bee.toString()); } else if (isWhitesTurn == b.get(bee.getStartPoint()).getColor()) { // make into methods // Taking pieces if (this.b.get(bee.getEndPoint()) != null) { if (takePiece(bee.getStartPoint(), bee.getEndPoint())) { System.out.println(bee.toString()); } else { System.err.println("Cannot take " + bee.toString()); } pawnPromotion(bee.getEndPoint()); } // castling else if (bee.getP3() != null && bee.getP4() != null) { if (castling(bee.getStartPoint(), bee.getEndPoint(), bee.getP3(), bee.getP4())) { System.out.println(bee.toString()); } else { System.err.println("Cannot move " + bee.toString()); } } // moving pieces else if (this.b.get(bee.getEndPoint()) == null) { if (movePiece(bee.getStartPoint(), bee.getEndPoint())) { System.out.println(bee.toString()); } else { System.err.println("Cannot move " + bee.toString()); } pawnPromotion(bee.getEndPoint()); } isWhitesTurn = !isWhitesTurn; if (checkForCheckMate() && isWhitesTurn) { System.out.println("Checkmate. Black wins!"); } else if (checkForCheckMate() && !isWhitesTurn) { System.out.println("Checkmate. White wins!"); } else if (checkForCheckMate() && !isKingInCheck()) { System.out.println("StaleMate."); } else if (isKingInCheck()) { System.out.println("The King is in check"); } } else { if (isWhitesTurn) { System.out.println("Its not Black's turn!"); } else if (!isWhitesTurn) { System.out.println("Its not White's turn!"); } } cd.displayBoard(); } }
public void loop(Behavior<A> a_out) { ((EventLoop<A>) event).loop(a_out.changes()); value = a_out.sample(); }
public void onNestedPreScroll(View paramView, int paramInt1, int paramInt2, int[] paramArrayOfInt) { int i2 = 0; int i1 = 0; int i3 = 0; int i6 = getChildCount(); int i4 = 0; View localView; Object localObject; int i5; if (i4 < i6) { localView = getChildAt(i4); localObject = (d)localView.getLayoutParams(); if (!((d)localObject).h()) { i5 = i3; i3 = i2; i2 = i1; i1 = i5; } } for (;;) { i5 = i4 + 1; i4 = i3; i3 = i1; i1 = i2; i2 = i4; i4 = i5; break; localObject = ((d)localObject).b(); if (localObject != null) { int[] arrayOfInt = m; m[1] = 0; arrayOfInt[0] = 0; ((Behavior)localObject).a(this, localView, paramView, paramInt1, paramInt2, m); if (paramInt1 > 0) { i3 = Math.max(i2, m[0]); label158: if (paramInt2 <= 0) { break label201; } } label201: for (i1 = Math.max(i1, m[1]);; i1 = Math.min(i1, m[1])) { i2 = i1; i1 = 1; break; i3 = Math.min(i2, m[0]); break label158; } paramArrayOfInt[0] = i2; paramArrayOfInt[1] = i1; if (i3 != 0) { a(true); } return; } i5 = i3; i3 = i2; i2 = i1; i1 = i5; } }
public String getTickStatusSummary(Tickable obj) { if (obj == null) return ""; long code = obj.getTickStatus(); if (obj instanceof Environmental) { if (CMath.bset(code, Tickable.STATUS_BEHAVIOR)) { long b = (code - Tickable.STATUS_BEHAVIOR); String codeWord = "Behavior #" + b; if ((b >= 0) && (b < ((Environmental) obj).numBehaviors())) { Behavior B = ((Environmental) obj).fetchBehavior((int) b); codeWord += " (" + B.name() + ": " + B.getTickStatus(); } else codeWord += " (#Error#)"; return codeWord; } else if (CMath.bset(code, Tickable.STATUS_SCRIPT) && (obj instanceof MOB)) { long b = (code - Tickable.STATUS_SCRIPT); String codeWord = "Script #" + b; if ((b >= 0) && (b < ((MOB) obj).numScripts())) { ScriptingEngine S = ((MOB) obj).fetchScript((int) b); codeWord += " (" + CMStrings.limit(S.getScript(), 20) + ": " + S.getTickStatus(); } return codeWord; } else if ((code & STATUS_ALLMISCTICKS) > 0) { long base = (code & STATUS_ALLMISCTICKS); int num = 0; for (int i = 1; i < 6; i++) if ((1 << (10 + i)) == base) { num = i; break; } return "Misc" + num + " Activity #" + (code - base); } else if (CMath.bset(code, Tickable.STATUS_AFFECT)) { long b = (code - Tickable.STATUS_AFFECT); String codeWord = "Effect #" + b; if ((b >= 0) && (b < ((Environmental) obj).numEffects())) { Environmental E = ((Environmental) obj).fetchEffect((int) b); codeWord += " (" + E.name() + ": " + E.getTickStatus() + ")"; } return codeWord; } } String codeWord = null; if (CMath.bset(code, Tickable.STATUS_BEHAVIOR)) codeWord = "Behavior?!"; else if (CMath.bset(code, Tickable.STATUS_SCRIPT)) codeWord = "Script?!"; else if (CMath.bset(code, Tickable.STATUS_AFFECT)) codeWord = "Effect?!"; else switch ((int) code) { case (int) Tickable.STATUS_ALIVE: codeWord = "Alive"; break; case (int) Tickable.STATUS_REBIRTH: codeWord = "Rebirth"; break; case (int) Tickable.STATUS_CLASS: codeWord = "Class"; break; case (int) Tickable.STATUS_DEAD: codeWord = "Dead"; break; case (int) Tickable.STATUS_END: codeWord = "End"; break; case (int) Tickable.STATUS_FIGHT: codeWord = "Fighting"; break; case (int) Tickable.STATUS_NOT: codeWord = "!"; break; case (int) Tickable.STATUS_OTHER: codeWord = "Other"; break; case (int) Tickable.STATUS_RACE: codeWord = "Race"; break; case (int) Tickable.STATUS_START: codeWord = "Start"; break; case (int) Tickable.STATUS_WEATHER: codeWord = "Weather"; break; default: codeWord = "?"; break; } return codeWord; }
@Override void setOwner(Agent agent) { super.setOwner(agent); for (State s : states.values()) s.log = log; }
public Behavior mutate() { GO_FORWARD temp = (GO_FORWARD) clone(); temp.dist = r.nextInt(3) + 1; return Behavior.mutate(temp); }
private void loadRichFacesComponents() { richfacesAttributes = new HashMap<Class<?>, List<Attribute>>(); try { ClassLoader cl = Attributes.class.getClassLoader(); Enumeration<URL> fileUrls = cl.getResources("META-INF/faces-config.xml"); URL configFile = null; while (fileUrls.hasMoreElements()) { URL url = fileUrls.nextElement(); if (url.getPath().matches(".*richfaces[^/]+jar.*")) { configFile = url; } } JAXBContext context = JAXBContext.newInstance(FacesConfigHolder.class); FacesConfigHolder facesConfigHolder = (FacesConfigHolder) context.createUnmarshaller().unmarshal(configFile); List<Component> components = facesConfigHolder.getComponents(); List<Behavior> behaviors = facesConfigHolder.getBehaviors(); for (Component c : components) { if (c.getAttributes() == null) { continue; } // remove hidden attributes Iterator<Attribute> i = c.getAttributes().iterator(); while (i.hasNext()) { Attribute a = i.next(); if (a.isHidden() || "id".equals(a.getName()) || "binding".equals(a.getName())) { i.remove(); } } richfacesAttributes.put(c.getComponentClass(), c.getAttributes()); logger.debug("attributes for component " + c.getComponentClass().getName() + " loaded"); } for (Behavior b : behaviors) { if (b.getAttributes() == null) { continue; } // remove hidden attributes Iterator<Attribute> i = b.getAttributes().iterator(); while (i.hasNext()) { Attribute a = i.next(); if (a.isHidden() || "id".equals(a.getName()) || "binding".equals(a.getName())) { i.remove(); } } richfacesAttributes.put(b.getBehaviorClass(), b.getAttributes()); logger.debug("attributes for behavior " + b.getBehaviorClass().getName() + " loaded"); } } catch (IOException ex) { logger.error("Input/output error.", ex); } catch (JAXBException ex) { logger.error("XML reading error.", ex); } }
private boolean a(MotionEvent paramMotionEvent, int paramInt) { boolean bool1 = false; int i1 = 0; MotionEvent localMotionEvent = null; int i3 = t.a(paramMotionEvent); List localList = h; a(localList); int i4 = localList.size(); int i2 = 0; View localView; Behavior localBehavior; if (i2 < i4) { localView = (View)localList.get(i2); d locald = (d)localView.getLayoutParams(); localBehavior = locald.b(); if (((bool1) || (i1 != 0)) && (i3 != 0)) { if (localBehavior == null) { break label330; } if (localMotionEvent == null) { long l1 = SystemClock.uptimeMillis(); localMotionEvent = MotionEvent.obtain(l1, l1, 3, 0.0F, 0.0F, 0); switch (paramInt) { } for (;;) { label140: i2 += 1; break; localBehavior.b(this, localView, localMotionEvent); continue; localBehavior.a(this, localView, localMotionEvent); } } } else { boolean bool2 = bool1; if (!bool1) { bool2 = bool1; if (localBehavior == null) {} } switch (paramInt) { default: label220: bool2 = bool1; if (bool1) { q = localView; bool2 = bool1; } bool1 = bool2; bool2 = locald.e(); boolean bool3 = locald.a(this, localView); if ((bool3) && (!bool2)) { i1 = 1; label272: if ((!bool3) || (i1 != 0)) { break label324; } } break; } } } for (;;) { localList.clear(); return bool1; bool1 = localBehavior.b(this, localView, paramMotionEvent); break label220; bool1 = localBehavior.a(this, localView, paramMotionEvent); break label220; i1 = 0; break label272; label324: break label140; break; label330: break label140; } }