@Override
    public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      index = position;
      ViewHolder holder = null;
      Info info = (Info) mList.get(position).get(INFO);

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.join_info_listview_item, null);
        holder = new ViewHolder();
        holder.name = (TextView) convertView.findViewById(R.id.join_info_item_text_name);
        holder.starNum = (LinearLayout) convertView.findViewById(R.id.join_info_item_linear_star);
        holder.progress = (TextView) convertView.findViewById(R.id.join_info_item_text_progress);
        holder.allAtm = (TextView) convertView.findViewById(R.id.join_info_item_text_all_amt);
        holder.atm = (TextView) convertView.findViewById(R.id.join_info_item_text_amt);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      holder.name.setText("发起人:" + info.getName());
      holder.progress.setText(info.getProgress());
      holder.allAtm.setText("¥" + info.getAllAtm());
      holder.atm.setText("¥" + info.getAtm());
      PublicMethod.createStar(
          holder.starNum,
          info.getCrown(),
          info.getCup(),
          info.getDiamond(),
          info.getStarNum(),
          JoinInfoActivity.this);
      return convertView;
    }
Example #2
0
  public ArrayList<Action> searchActionList(ActionEnum t, ArrayList<Info> kList, char searchType) {
    searchResult.clear();
    int minKey = -1;
    boolean isFirst = true;

    // 渡された Info リストのうち,その Info が入っているアクションの数が一番小さい Info を選ぶ
    for (int i = 0; i < kList.size(); i++) {
      if (actionArrayListforEachInfoHashMap.containsKey(kList.get(i))) {
        if (isFirst) {
          minKey = i;
          isFirst = false;
        } else {
          if (actionArrayListforEachInfoHashMap.get(kList.get(minKey)).size()
              > actionArrayListforEachInfoHashMap.get(kList.get(i)).size()) {
            minKey = i;
          }
        }
      }
    }
    // 一つも存在しない場合は空で返す
    if (minKey == -1) {
      if (kList.size() == 0) {
        if (t == ActionEnum.HELLO || t == ActionEnum.BYE) {
          searchResult.addAll(actionArrayListforEachTypeHashMap.get(t));
        }
      }
      return searchResult;
    }

    ArrayList<Action> firstList = actionArrayListforEachInfoHashMap.get(kList.get(minKey));
    for (int i = 0; i < firstList.size(); i++) {
      Action tempAction = firstList.get(i);
      int actionItemNum = 0;
      if (tempAction.targetItem != null) {
        actionItemNum = 1;
      }
      actionItemNum = actionItemNum + tempAction.itemArrayList.size();
      boolean allFound = true;
      for (int j = 0; j < kList.size(); j++) {
        Info tempInfo = kList.get(j);
        //				System.err.println("tempAction: " + tempAction + "/ tempInfo: " + tempInfo.getName()
        // );
        if (tempAction.type != t || !tempAction.itemHashMap.containsKey(tempInfo.getName())) {
          if (tempAction.targetItem != null) {
            if (!tempAction.targetItem.getName().equals(tempInfo.getName())) {
              allFound = false;
              break;
            }
          } else {
            allFound = false;
            break;
          }
        }
      }
      if (allFound) {
        if (searchType == ActionSet.ONLY_MATCH) {
          if (actionItemNum == kList.size()) {
            searchResult.add(tempAction);
          }
        } else if (searchType == ActionSet.NORMAL_MATCH) {
          searchResult.add(tempAction);
        }
      }
    }
    return searchResult;
  }
Example #3
0
  @Override
  public OracleStaInfoDetailModel getBaseInfo(
      String monitorId,
      int eventType,
      String title,
      Date now,
      StaTimeEnum staTimeEnum,
      TimeGranularityEnum timeGranularityEnum) {
    OracleStaInfoDetailModel staInfoDetailModel = new OracleStaInfoDetailModel();
    staInfoDetailModel.setTitle(title);
    Info info = infoRepository.findOne(monitorId);
    String monitorName = info.getName();
    staInfoDetailModel.setMonitorName(monitorName);
    // 2013-3-2 2:42
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    String end = sdf.format(now);
    Date time = StaTimeEnum.getTime(staTimeEnum, now);
    String begin = sdf.format(time);
    staInfoDetailModel.setBegin(begin);
    staInfoDetailModel.setEnd(end);
    SimpleDateFormat sdf2 = new SimpleDateFormat("E,dd日-MM月-yyyy年 HH:mm");
    switch (eventType) {
        // 连接时间
      case 1:
        {
          // 阈值信息
          //                staInfoDetailModel.setNormal();
          //                staInfoDetailModel.setWarn();
          //                staInfoDetailModel.setError();
          staInfoDetailModel.setEventName("连接时间 ms");
          // 表数据
          List<EventSta> eventStaList =
              eventStaRepository.findAllByTimeAndType(time, now, eventType + "", monitorId);
          staInfoDetailModel.setRecordItems(eventStaList);
          // 点列
          List<Point> points = new ArrayList<Point>();
          // 平均值
          double min = 0;
          double max = 0;
          double sum = 0;
          for (EventSta eventSta : eventStaList) {
            // 和
            sum += eventSta.getAvg();
            // 最小值
            if (min >= eventSta.getMin()) {
              min = eventSta.getMin();
            }
            // 最大值
            if (max <= eventSta.getMax()) {
              max = eventSta.getMax();
            }
            // 点
            Point point = new Point();
            point.setxAxis(eventSta.getEventRecordTime());
            point.setyAxis(eventSta.getAvg());
            point.setDescription(
                "连接时间"
                    + "("
                    + sdf2.format(eventSta.getEventRecordTime())
                    + " ,"
                    + eventSta.getAvg()
                    + ")");
            points.add(point);
          }
          staInfoDetailModel.setMaxAvg(max);
          staInfoDetailModel.setMinAvg(min);
          Double avg1 = sum / eventStaList.size();
          int avg2 = avg1.intValue();
          staInfoDetailModel.setAvg(Double.parseDouble(avg2 + ""));

          // 图形点
          staInfoDetailModel.setxName("时间");
          staInfoDetailModel.setyName("连接时间");

          staInfoDetailModel.setPoints(points);
          break;
        }
        // 用户数
      case 2:
        {
          staInfoDetailModel.setEventName("用户数");
          // 表数据
          List<EventSta> eventStaList =
              eventStaRepository.findAllByTimeAndType(time, now, eventType + "", monitorId);
          staInfoDetailModel.setRecordItems(eventStaList);
          // 点列
          List<Point> points = new ArrayList<Point>();
          // 平均值
          double min = 0;
          double max = 0;
          double sum = 0;
          for (EventSta eventSta : eventStaList) {
            // 和
            sum += eventSta.getAvg();
            // 最小值
            if (min >= eventSta.getMin()) {
              min = eventSta.getMin();
            }
            // 最大值
            if (max <= eventSta.getMax()) {
              max = eventSta.getMax();
            }
            // 点
            Point point = new Point();
            point.setxAxis(eventSta.getEventRecordTime());
            point.setyAxis(eventSta.getAvg());
            point.setDescription(
                "用户数"
                    + "("
                    + sdf2.format(eventSta.getEventRecordTime())
                    + " ,"
                    + eventSta.getAvg()
                    + ")");
            points.add(point);
          }
          staInfoDetailModel.setMaxAvg(max);
          staInfoDetailModel.setMinAvg(min);
          Double avg1 = sum / eventStaList.size();
          int avg2 = avg1.intValue();
          staInfoDetailModel.setAvg(Double.parseDouble(avg2 + ""));

          // 图形点
          staInfoDetailModel.setxName("时间");
          staInfoDetailModel.setyName("用户数");

          staInfoDetailModel.setPoints(points);
          break;
        }
        // SGA命中率
      case 3:
        {
          staInfoDetailModel.setEventName("缓冲区击中率");
          // 表数据
          List<EventSta> eventStaList =
              eventStaRepository.findAllByTimeAndType(time, now, eventType + "", monitorId);
          staInfoDetailModel.setRecordItems(eventStaList);
          // 点列
          List<Point> points = new ArrayList<Point>();
          // 平均值
          double min = 0;
          double max = 0;
          double sum = 0;
          for (EventSta eventSta : eventStaList) {
            // 和
            sum += eventSta.getAvg();
            // 最小值
            if (min >= eventSta.getMin()) {
              min = eventSta.getMin();
            }
            // 最大值
            if (max <= eventSta.getMax()) {
              max = eventSta.getMax();
            }
            // 点
            Point point = new Point();
            point.setxAxis(eventSta.getEventRecordTime());
            point.setyAxis(eventSta.getAvg());
            point.setDescription(
                "缓冲区击中率"
                    + "("
                    + sdf2.format(eventSta.getEventRecordTime())
                    + " ,"
                    + eventSta.getAvg()
                    + ")");
            points.add(point);
          }
          staInfoDetailModel.setMaxAvg(max);
          staInfoDetailModel.setMinAvg(min);
          staInfoDetailModel.setAvg(sum / eventStaList.size());

          // 图形点
          staInfoDetailModel.setxName("时间");
          staInfoDetailModel.setyName("缓冲区击中率");

          staInfoDetailModel.setPoints(points);
          break;
        }
    }
    return staInfoDetailModel;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      index = position;
      ViewHolder holder = null;
      Info info = (Info) mList.get(position);

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.join_info_listview_item, null);
        holder = new ViewHolder();
        holder.type = (TextView) convertView.findViewById(R.id.join_info_item_text_name);
        holder.ding = (TextView) convertView.findViewById(R.id.join_info_item_text_ding);
        holder.name = (TextView) convertView.findViewById(R.id.join_info_item_text_faqiren);
        holder.starNum = (LinearLayout) convertView.findViewById(R.id.join_info_item_linear_star);
        holder.progress = (TextView) convertView.findViewById(R.id.join_info_item_text_progress);
        holder.allAtm = (TextView) convertView.findViewById(R.id.join_info_item_text_all_amt);
        holder.layoutLeft =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_left);
        holder.layoutCenter =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_center);
        holder.layoutRight =
            (LinearLayout) convertView.findViewById(R.id.join_info_item_layout_right);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      if (info.getIsTop().equals("true")) {
        holder.ding.setBackgroundResource(R.drawable.join_top);
        holder.ding.setVisibility(view.VISIBLE);
      } else {
        holder.ding.setVisibility(view.GONE);
      }
      int with = PublicMethod.getDisplayWidth(JoinInfoActivity.this);
      if (with == 800) {
        LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(
                PublicMethod.getPxInt(110, JoinInfoActivity.this),
                PublicMethod.getPxInt(28, JoinInfoActivity.this));
        holder.type.setLayoutParams(params);
        LinearLayout.LayoutParams paramsLayout =
            new LinearLayout.LayoutParams(250, LayoutParams.WRAP_CONTENT);
        holder.layoutLeft.setLayoutParams(paramsLayout);
        holder.layoutCenter.setLayoutParams(paramsLayout);
        holder.layoutRight.setLayoutParams(paramsLayout);
      }
      holder.type.setText(info.getLottype());
      holder.name.setText("发起人:" + getusername(info.getName()));
      holder.progress.setText(info.getProgress() + "(" + info.getSafe() + ")");
      holder.allAtm.setText(info.getAllAtm() + "元");
      // holder.atm.setText("¥"+info.getAtm());
      // holder.safe.setText(info.getSafe());
      PublicMethod.createStar(
          holder.starNum,
          info.getCrown(),
          info.getGrayCrown(),
          info.getCup(),
          info.getGrayCup(),
          info.getDiamond(),
          info.getGrayDiamond(),
          info.getStarNum(),
          info.getGrayStarNum(),
          JoinInfoActivity.this,
          4);
      return convertView;
    }