Пример #1
0
 /**
  * 业务功能:标记用户和目标标签列表有哪些是相同的
  *
  * @param u
  * @param label_names
  * @return
  */
 private List<String> markLabel(User u, List<String> label_names) {
   List<String> labels = new ArrayList<String>();
   for (Label l : u.getLabellist()) {
     boolean ismarked = false;
     for (String lab_name : label_names) {
       if (l.getLabel_name().equalsIgnoreCase(lab_name)
           || l.getLabel_name().contains(lab_name)
           || lab_name.contains(l.getLabel_name())) {
         ismarked = true;
       }
     }
     if (ismarked) {
       labels.add(l.getLabel_name() + "\t\t");
     } else {
       labels.add(l.getLabel_name());
     }
   }
   return labels;
 }
Пример #2
0
 // 获取某用户的标签名
 public List<String> getLabelnames() {
   List<String> labels = new ArrayList<String>();
   if (this.getLabellist() != null) {
     for (Label l : this.getLabellist()) {
       labels.add(l.getLabel_name());
     }
     return labels;
   } else {
     return null;
   }
 }