示例#1
0
  @Override
  public float getValue(Agent a) {
    Object state = getParamObject(a);
    if (state == null) return 0;

    Object v = propertyAccessor.get(state);
    if (propertyAccessor.getType().equals(float.class)) return (float) v;
    if (propertyAccessor.getType().equals(int.class)) return (int) v;
    else throw new IllegalArgumentException("Field is not one of the acceptible types");
  }
示例#2
0
  protected Object getParamObject(Agent a) {
    AgentState state = ((ComplexAgent) a).getState(type);
    if (state == null) return null;

    return stateParamAccessor.get(state);
  }