Package org.timerescue.action

Examples of org.timerescue.action.DefaultAttackAction$Constants$Parameter


                SampleOAuth2Provider.generateAccessAndRefreshToken(accessor);
                String redirect_uri = request.getParameter(OAuth2.REDIRECT_URI);
                String state = request.getParameter(OAuth2.STATE);
               
                List<Parameter> list = new ArrayList<Parameter>(5);
                list.add(new Parameter(OAuth2.ACCESS_TOKEN,accessor.accessToken));
                list.add(new Parameter(OAuth2.TOKEN_TYPE,accessor.tokenType));
                list.add(new Parameter(OAuth2.EXPIRES_IN,"3600"));
                if(accessor.scope!=null) list.add(new Parameter(OAuth2.SCOPE,accessor.scope));
                if(state != null){
                    list.add(new Parameter(OAuth2.STATE, state));
                }
               
                redirect_uri = OAuth2.addParametersAsFragment(redirect_uri,list);
                response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
                response.setHeader("Location", OAuth2.decodePercent(redirect_uri));
View Full Code Here


            // test number of parameters
            if (firstParameters.size() == secondParameters.size())
            {
                for (int i = 0; i < firstParameters.size() && sameSignature; i++)
                {
                    final Parameter firstParameter = (Parameter)firstParameters.get(i);
                    final Parameter secondParameter = (Parameter)secondParameters.get(i);

                    // test each parameter's type
                    sameSignature =
                        isEqual(
                            firstParameter.getType(),
                            secondParameter.getType());
                }
            }
            else
            {
                sameSignature = false;
View Full Code Here

        Iterator iterator = this.metaObject.getOwnedParameters().iterator();

        boolean commaNeeded = false;
        while (iterator.hasNext())
        {
            Parameter parameter = (Parameter)iterator.next();

            if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
            {
                if (commaNeeded)
                {
                    buffer.append(", ");
                }
                buffer.append(parameter.getName());
                commaNeeded = true;
            }
        }
        return buffer.toString();
    }
View Full Code Here

        Iterator iterator = this.metaObject.getOwnedParameters().iterator();

        boolean commaNeeded = false;
        while (iterator.hasNext())
        {
            Parameter parameter = (Parameter)iterator.next();

            if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
            {
                if (commaNeeded)
                {
                    buffer.append(", ");
                }
View Full Code Here

            arguments,
            new Predicate()
            {
                public boolean evaluate(final Object object)
                {
                    Parameter p = (Parameter)object;
                    return !p.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL) && !p.isException();
                }
            });
        return arguments;
    }
View Full Code Here

   * Return an appropriate attack action to be performed
   * @return
   */
  private DefaultAttackAction getAttack() {
    // TODO Check on other skills and see how to attack
    DefaultAttackAction attack =
        (DefaultAttackAction) ActionFactory.getInstance(
            DefaultAttackAction.class);
    return attack;

  }
View Full Code Here

  /**
   * Test method for {@link org.timerescue.utils.Introspection#getSerializableFromClass(java.lang.String)}.
   */
  @Test
  public void testGetSerializableFromClass() {
    DefaultAttackAction action = new DefaultAttackAction();
    String clasname = action.getClass().getName();
    Serializable ser = null;
    try {
      ser = Introspection.getSerializableFromClass(action.getClass().getName());
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      fail("Error ClassNotFound");
    } catch (InstantiationException e) {
View Full Code Here

        Constants.Property.AGGRESSIVENESS);
    //TODO pass this to behaviors
    //Getting environment information
    //I am already attacking? or am i the target?
    if (state_holder.isStateActive(DefaultAttackAction.class)){     
      DefaultAttackAction attack = (DefaultAttackAction) state_holder.getState(
          DefaultAttackAction.class);
      Agent target = attack.getTarget();
      //Counter attack if it is the target
      decision = attack(target);
      //If the target couldn't be reached remove states
      if(decision.equals(null)){
        attack.removeStates();
      }
    }else{
      //Is it aggressive?
      if (Boolean.parseBoolean(aggressiveness)){     
        decision = attack();
View Full Code Here

   * Attack : aggressive behavior towards any low life target
   * @return
   */
  private Action attack() {
    // TODO Check on other skills and see how to attack
    DefaultAttackAction attack = getAttack();
    //Looking for other agents
    Element element;
    Agent target = null, temp = null;
    int target_life, temp_life;
    for (int i = 0; i < surroundings.length; i++) {
View Full Code Here

   * @param target
   * @return the attack action
   */
  private Action attack(Agent target) {   
    if(target !=null){
      DefaultAttackAction attack = getAttack();
      //Add target
      attack.setTarget(target);
      //Set attacker
      attack.setAttacker(this);
      return attack;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.timerescue.action.DefaultAttackAction$Constants$Parameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.