Test guarding.

@return
429546
public function guarded($guard = null)
	{
		if(!$this->isAuthGuarded())
		{
			if(is_null($guard))
				$guard = $this->guard;

			$this->user = $this->users()->findOrFail(Auth::guard($guard)->user()->id);
		}

		return $this;
	}
1073652
public boolean isAtEnd() {
    final AtomicBoolean atEnd = new AtomicBoolean(true);
    foreachPartition(ps -> {
      if (!ps.isAtEnd()) {
        atEnd.set(false);
      }
    });
    return atEnd.get();
  }
456222
public Object getControlValue()
    {
        short iFieldValue = 0;
        for (int iBitNumber = 0; iBitNumber < this.getComponentCount(); iBitNumber++)
        {
            JCheckBox checkBox = (JCheckBox)this.getComponent(iBitNumber);
            boolean bState = checkBox.isSelected();
            if (!m_bCheckedIsOn)
                bState = !bState; // Do opposite operation
            if (bState)
                iFieldValue |= (1 << iBitNumber);   // Set the bit
            else
                iFieldValue &= ~(1 << iBitNumber);  // Clear the bit
        }
        return new Short(iFieldValue);
    }
62226
static sun.misc.Unsafe getUnsafe() {
        try {
            return sun.misc.Unsafe.getUnsafe();
        } catch (SecurityException se) {
            try {
                return java.security.AccessController.doPrivileged
                    (new java.security
                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {
                        public sun.misc.Unsafe run() throws Exception {
                            java.lang.reflect.Field f = sun.misc
                                .Unsafe.class.getDeclaredField("theUnsafe");
                            f.setAccessible(true);
                            return (sun.misc.Unsafe) f.get(null);
                        }});
            } catch (java.security.PrivilegedActionException e) {
                throw new RuntimeException("Could not initialize intrinsics",
                                           e.getCause());
            }
        }
    }
463548
@Pure
	public IExpressionBuilder getGuard() {
		IExpressionBuilder exprBuilder = this.expressionProvider.get();
		exprBuilder.eInit(getSarlBehaviorUnit(), new Procedures.Procedure1<XExpression>() {
				public void apply(XExpression expr) {
					getSarlBehaviorUnit().setGuard(expr);
				}
			}, getTypeResolutionContext());
		return exprBuilder;
	}
852680
public final EObject ruleGuarded() throws RecognitionException {
        EObject current = null;

        Token otherlv_0=null;
        Token otherlv_2=null;
        Token otherlv_3=null;
        Token otherlv_4=null;
        EObject lv_guard_1_0 = null;

        EObject lv_guarded_5_0 = null;


         enterRule(); 
            
        try {
            // InternalSimpleAntlr.g:888:28: ( (otherlv_0= '{' ( (lv_guard_1_0= ruleOrExpression ) ) otherlv_2= '}' otherlv_3= '?' otherlv_4= '=>' ( (lv_guarded_5_0= ruleParenthesized ) ) ) )
            // InternalSimpleAntlr.g:889:1: (otherlv_0= '{' ( (lv_guard_1_0= ruleOrExpression ) ) otherlv_2= '}' otherlv_3= '?' otherlv_4= '=>' ( (lv_guarded_5_0= ruleParenthesized ) ) )
            {
            // InternalSimpleAntlr.g:889:1: (otherlv_0= '{' ( (lv_guard_1_0= ruleOrExpression ) ) otherlv_2= '}' otherlv_3= '?' otherlv_4= '=>' ( (lv_guarded_5_0= ruleParenthesized ) ) )
            // InternalSimpleAntlr.g:889:3: otherlv_0= '{' ( (lv_guard_1_0= ruleOrExpression ) ) otherlv_2= '}' otherlv_3= '?' otherlv_4= '=>' ( (lv_guarded_5_0= ruleParenthesized ) )
            {
            otherlv_0=(Token)match(input,16,FOLLOW_20); if (state.failed) return current;
            if ( state.backtracking==0 ) {

                  	newLeafNode(otherlv_0, grammarAccess.getGuardedAccess().getLeftCurlyBracketKeyword_0());
                  
            }
            // InternalSimpleAntlr.g:893:1: ( (lv_guard_1_0= ruleOrExpression ) )
            // InternalSimpleAntlr.g:894:1: (lv_guard_1_0= ruleOrExpression )
            {
            // InternalSimpleAntlr.g:894:1: (lv_guard_1_0= ruleOrExpression )
            // InternalSimpleAntlr.g:895:3: lv_guard_1_0= ruleOrExpression
            {
            if ( state.backtracking==0 ) {
               
              	        newCompositeNode(grammarAccess.getGuardedAccess().getGuardOrExpressionParserRuleCall_1_0()); 
              	    
            }
            pushFollow(FOLLOW_21);
            lv_guard_1_0=ruleOrExpression();

            state._fsp--;
            if (state.failed) return current;
            if ( state.backtracking==0 ) {

              	        if (current==null) {
              	            current = createModelElementForParent(grammarAccess.getGuardedRule());
              	        }
                     		set(
                     			current, 
                     			"guard",
                      		lv_guard_1_0, 
                      		"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.OrExpression");
              	        afterParserOrEnumRuleCall();
              	    
            }

            }


            }

            otherlv_2=(Token)match(input,17,FOLLOW_22); if (state.failed) return current;
            if ( state.backtracking==0 ) {

                  	newLeafNode(otherlv_2, grammarAccess.getGuardedAccess().getRightCurlyBracketKeyword_2());
                  
            }
            otherlv_3=(Token)match(input,27,FOLLOW_23); if (state.failed) return current;
            if ( state.backtracking==0 ) {

                  	newLeafNode(otherlv_3, grammarAccess.getGuardedAccess().getQuestionMarkKeyword_3());
                  
            }
            otherlv_4=(Token)match(input,30,FOLLOW_24); if (state.failed) return current;
            if ( state.backtracking==0 ) {

                  	newLeafNode(otherlv_4, grammarAccess.getGuardedAccess().getEqualsSignGreaterThanSignKeyword_4());
                  
            }
            // InternalSimpleAntlr.g:923:1: ( (lv_guarded_5_0= ruleParenthesized ) )
            // InternalSimpleAntlr.g:924:1: (lv_guarded_5_0= ruleParenthesized )
            {
            // InternalSimpleAntlr.g:924:1: (lv_guarded_5_0= ruleParenthesized )
            // InternalSimpleAntlr.g:925:3: lv_guarded_5_0= ruleParenthesized
            {
            if ( state.backtracking==0 ) {
               
              	        newCompositeNode(grammarAccess.getGuardedAccess().getGuardedParenthesizedParserRuleCall_5_0()); 
              	    
            }
            pushFollow(FOLLOW_2);
            lv_guarded_5_0=ruleParenthesized();

            state._fsp--;
            if (state.failed) return current;
            if ( state.backtracking==0 ) {

              	        if (current==null) {
              	            current = createModelElementForParent(grammarAccess.getGuardedRule());
              	        }
                     		set(
                     			current, 
                     			"guarded",
                      		lv_guarded_5_0, 
                      		"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.Parenthesized");
              	        afterParserOrEnumRuleCall();
              	    
            }

            }


            }


            }


            }

            if ( state.backtracking==0 ) {
               leaveRule(); 
            }
        }
         
            catch (RecognitionException re) { 
                recover(input,re); 
                appendSkippedTokens();
            } 
        finally {
        }
        return current;
    }
1237554
@GET
    @Path("/checkIsUserInRole")
    @RolesAllowed("Tester")
    public Response checkIsUserInRole(@Context SecurityContext sec) {
        Principal user = sec.getUserPrincipal();
        Response response;
        if (!sec.isUserInRole("Echoer")) {
            response = Response.status(new Response.StatusType() {
                @Override
                public int getStatusCode() {
                    return Response.Status.FORBIDDEN.getStatusCode();
                }

                @Override
                public Response.Status.Family getFamily() {
                    return Response.Status.FORBIDDEN.getFamily();
                }

                @Override
                public String getReasonPhrase() {
                    return "SecurityContext.isUserInRole(Echoer) was false";
                }
            }).build();
        } else {
            response = Response.ok(user.getName(), MediaType.TEXT_PLAIN).build();
        }
        return response;
    }
651378
function () {
            /*  determine parameters  */
            var params = $cs.params("guard", arguments, {
                method: { pos: 0, valid: "string", req: true },
                level:  { pos: 1, valid: "number", req: true }
            });

            /*  sanity check enter/leave method name  */
            var valid = false;
            var i;
            for (i = 0; i < _cs.states.length; i++) {
                if (   _cs.states[i].enter === params.method
                    || _cs.states[i].leave === params.method) {
                    valid = true;
                    break;
                }
            }
            if (!valid)
                throw _cs.exception("guard", "no such declared enter/leave method: \""
                    + params.method + "\"");

            /*  ensure the guard slot exists  */
            if (!_cs.isdefined(this.__state_guards[params.method]))
                this.__state_guards[params.method] = 0;

            /*  activate/deactivate guard  */
            var deactivate = false;
            if (params.level > 0)
                /*  increase guard level  */
                this.__state_guards[params.method] += params.level;
            else  if (params.level < 0) {
                /*  decrease guard level  */
                if (this.__state_guards[params.method] < (-params.level))
                    throw _cs.exception("guard", "guard level decrease request too large");
                this.__state_guards[params.method] += params.level;
                if (this.__state_guards[params.method] === 0)
                    deactivate = true;
            }
            else {
                /*  reset guard level  */
                this.__state_guards[params.method] = 0;
                deactivate = true;
            }
            if (deactivate) {
                /*  finally deactivate guard  */
                delete this.__state_guards[params.method];

                /*  give all pending state transitions
                    (which now might proceed) a chance  */
                _cs.state_progression();
            }
        }
1259057
public java.util.List<TrustedAdvisorCheckDescription> getChecks() {
        if (checks == null) {
            checks = new com.amazonaws.internal.SdkInternalList<TrustedAdvisorCheckDescription>();
        }
        return checks;
    }
827239
public long misses() {
        Lock readerLock = context.ctxLock.readLock();
        readerLock.lock();
        try {
            return SSLContext.sessionMisses(context.ctx);
        } finally {
            readerLock.unlock();
        }
    }
283718
public static Random getRandom()
  {
    if (_isTest) {
      return _testRandom;
    }

    Random random = _freeRandomList.allocate();

    if (random == null) {
      random = new SecureRandom();
    }

    return random;
  }
225690
public List<SecurityRoleType<WebFragmentType<T>>> getAllSecurityRole()
   {
      List<SecurityRoleType<WebFragmentType<T>>> list = new ArrayList<SecurityRoleType<WebFragmentType<T>>>();
      List<Node> nodeList = childNode.get("security-role");
      for(Node node: nodeList)
      {
         SecurityRoleType<WebFragmentType<T>>  type = new SecurityRoleTypeImpl<WebFragmentType<T>>(this, "security-role", childNode, node);
         list.add(type);
      }
      return list;
   }
598265
private T nextUncheck() {
		if (0 != this.index || false == this.includeStart) {
			// 非第一个元素或不包含第一个元素增加步进
			this.current = this.next;
			if (null != this.current) {
				this.next = safeStep(this.next);
			}
		}
		index++;
		return this.current;
	}
1279429
public java.util.List<String> getInstancesToProtect() {
        if (instancesToProtect == null) {
            instancesToProtect = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return instancesToProtect;
    }
663899
public Deferred<ArrayList<Object>> checkNecessaryTablesExist() {
    final ArrayList<Deferred<Object>> checks =
      new ArrayList<Deferred<Object>>(2);
    checks.add(client.ensureTableExists(
        config.getString("tsd.storage.hbase.data_table")));
    checks.add(client.ensureTableExists(
        config.getString("tsd.storage.hbase.uid_table")));
    if (config.enable_tree_processing()) {
      checks.add(client.ensureTableExists(
          config.getString("tsd.storage.hbase.tree_table")));
    }
    if (config.enable_realtime_ts() || config.enable_realtime_uid() ||
        config.enable_tsuid_incrementing()) {
      checks.add(client.ensureTableExists(
          config.getString("tsd.storage.hbase.meta_table")));
    }
    return Deferred.group(checks);
  }
3669
function addGuard(guard, expr) {
      let safeExpr = null;
      if (!isWellFormed(expr)) {
        expr = '{/*Malformed Expression*/}';
      }
      needsRuntime = true;
      safeExpr = ` rt_${ unpredictableSuffix }.${ guard }(${ expr }) `;
      return safeExpr;
    }
163362
@GuardedBy("lock")
  private boolean isSatisfied(Guard guard) {
    try {
      return guard.isSatisfied();
    } catch (Throwable throwable) {
      signalAllWaiters();
      throw Throwables.propagate(throwable);
    }
  }