/**
  * Method for save a site's reputation result into external file
  *
  * @param listHistoryReputation
  */
 public static void saveHistoryReputation(
     List<Pair<String, historySitesReputation>> listHistoryReputation) {
   // Write again into external file
   StringBuffer rawContent = new StringBuffer();
   for (int i = 0; i < listHistoryReputation.size(); i++) {
     Pair<String, historySitesReputation> thisHistoryReputation = listHistoryReputation.get(i);
     String sitesName = thisHistoryReputation.getValue0();
     historySitesReputation historyReputation = thisHistoryReputation.getValue1();
     String sitesLabel = historyReputation.getLabelNormality();
     String sitesResponseTime = String.valueOf(historyReputation.getResponseTime());
     String sitesDateMeasure = String.valueOf(historyReputation.getMeasureDate());
     Triplet<Double, Double, Double> sitesComposition =
         historyReputation.getCompositionDangerousity();
     Double malwareComposition = sitesComposition.getValue0();
     Double phishingComposition = sitesComposition.getValue1();
     Double spammingComposition = sitesComposition.getValue2();
     String methodType = historyReputation.getMethodType();
     String reputationType = historyReputation.getReputationType();
     rawContent.append(
         sitesName
             + "*"
             + sitesLabel
             + "*"
             + sitesResponseTime
             + "*"
             + sitesDateMeasure
             + "*"
             + malwareComposition
             + "*"
             + phishingComposition
             + "*"
             + spammingComposition
             + "*"
             + methodType
             + "*"
             + reputationType
             + "\n");
   }
   EksternalFile.saveRawContentToEksternalFile(rawContent.toString(), pathHistoryReputation);
 }
 /**
  * Method for load history reputation from external file
  *
  * @return
  */
 public static List<Pair<String, historySitesReputation>> loadHistoryReputation() {
   List<Pair<String, historySitesReputation>> listHistoryReputation =
       new ArrayList<Pair<String, historySitesReputation>>();
   String rawContent = EksternalFile.getRawFileContent(pathHistoryReputation);
   if (!rawContent.isEmpty()) {
     StringTokenizer stringPerLine = new StringTokenizer(rawContent, "\n");
     while (stringPerLine.hasMoreTokens()) {
       String line = stringPerLine.nextToken();
       StringTokenizer elementEachLine = new StringTokenizer(line, "*");
       int counter = 1;
       String domainName = "";
       historySitesReputation thisHistoryReputation = new historySitesReputation();
       Double malwareComposition = 0.0, phishingComposition = 0.0, spammingComposition = 0.0;
       while (elementEachLine.hasMoreTokens()) {
         String element = elementEachLine.nextToken();
         switch (counter) {
           case 1:
             domainName = element;
             break;
           case 2:
             thisHistoryReputation.setLabelNormality(element);
             break;
           case 3:
             thisHistoryReputation.setResponseTime(Long.parseLong(element));
             break;
           case 4:
             SimpleDateFormat formatter =
                 new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
             try {
               Date measureDate = formatter.parse(element);
               thisHistoryReputation.setMeasureDate(measureDate);
             } catch (ParseException e) {
               e.printStackTrace();
             }
             break;
           case 5:
             malwareComposition = Double.parseDouble(element);
             break;
           case 6:
             phishingComposition = Double.parseDouble(element);
             break;
           case 7:
             spammingComposition = Double.parseDouble(element);
             break;
           case 8:
             thisHistoryReputation.setMethodType(element);
             break;
           case 9:
             thisHistoryReputation.setReputationType(element);
             break;
         }
         counter++;
       }
       Triplet<Double, Double, Double> composition =
           new Triplet<Double, Double, Double>(
               malwareComposition, phishingComposition, spammingComposition);
       thisHistoryReputation.setCompositionDangerousity(composition);
       Pair<String, historySitesReputation> tupleHistoryReputation =
           new Pair<String, historySitesReputation>(domainName, thisHistoryReputation);
       listHistoryReputation.add(tupleHistoryReputation);
     }
   }
   return listHistoryReputation;
 }