Exemplo n.º 1
0
  private void clear() {
    Utility.ClearComponents(topPane);
    Utility.ClearComponents(bottomPane);

    dateField.setText(Utility.getCurrentDate());
    numofChildrenF.setText("0");
  }
Exemplo n.º 2
0
  private boolean Validate() {

    FamilyNodes familyNodes =
        new FamilyNodes(
            dateField,
            datePicker,
            Name,
            LastName,
            MidlleName,
            SpouseName,
            agefield,
            addressF,
            yrResidency,
            numofChildrenF,
            surveyedyr,
            maritalCBox,
            barangayCb,
            genderCB,
            underEmployedCBox,
            otherIncomeCbox,
            ownershipCbox,
            below8kCbox,
            occupancyCBox,
            childrenSchlCBox);

    return Utility.Validate(familyNodes);
  }
Exemplo n.º 3
0
  @Override
  public String toXML(int depth) {
    final String tab = Utility.generateTab(depth);

    String xml =
        tab
            + "<componentView componentID=\""
            + getAssociedComponent().getId()
            + "\" color=\""
            + getColor().getRGB()
            + "\">\n";
    xml += Utility.boundsToXML(depth + 1, getBounds(), "geometry");
    xml += tab + "</componentView>\n";

    return xml;
  }
Exemplo n.º 4
0
  public static void printMatrix(List<List<Integer>> myArrays) {
    System.out.println("Matrix is: ");
    for (int i = 0; i < myArrays.size(); i++) {

      Utility.printArray(myArrays.get(i));
    }
  }
Exemplo n.º 5
0
  /**
   * Return a String representing the structure of all components in class diagram in XML format
   * (get the XSD in documents).
   *
   * @param depth the number of tabs to put before a new tag
   * @return the string representing the structure of class diagram in XML.
   */
  public String toXML(int depth) {
    final String tab = Utility.generateTab(depth);

    String xml = tab + "<diagramElements>\n";

    // write for each component its XML structure.
    for (final IDiagramComponent component : components) xml += component.toXML(depth + 1) + "\n";

    return xml + tab + "</diagramElements>";
  }
Exemplo n.º 6
0
  public static List<List<Integer>> copyArrayOfArrays(List<List<Integer>> myArrays) {
    List<List<Integer>> copyArrays = new ArrayList<>();
    List<Integer> myArray;

    for (int i = 0; i < myArrays.size(); i++) {
      myArray = Utility.copyArray(myArrays.get(i));
      copyArrays.add(myArray);
    }

    return copyArrays;
  }
Exemplo n.º 7
0
 @Override
 public String toXML(int depth) {
   final String tab = Utility.generateTab(depth);
   return tab
       + "<multiplicity>\n"
       + tab
       + "\t<min>"
       + getLowerBound()
       + "</min>\n"
       + tab
       + "\t<max>"
       + getUpperBound()
       + "</max>\n"
       + tab
       + "</multiplicity>";
 }
Exemplo n.º 8
0
  private void Save() {

    // Family Information
    String inputedDate = dateField.getText();
    LocalDate dateissued = datePicker.getValue();
    int residencyYr = Integer.parseInt(yrResidency.getText());
    int numofchildren = Integer.parseInt(numofChildrenF.getText());
    String name = Name.getText().trim();
    String lastname = LastName.getText().trim();
    String middleName = MidlleName.getText().trim();

    String spousename = SpouseName.getText().trim();
    String age = agefield.getText();
    String maritalStatus = maritalCBox.getSelectionModel().getSelectedItem().toString();
    String barangay = barangayCb.getSelectionModel().getSelectedItem().toString();
    String gender = genderCB.getSelectionModel().getSelectedItem().toString();
    String address = addressF.getText();

    // poverty factors
    String hasOtherIncome = otherIncomeCbox.getSelectionModel().getSelectedItem().toString();
    String isBelow8k = below8kCbox.getSelectionModel().getSelectedItem().toString();
    String ownership = ownershipCbox.getSelectionModel().getSelectedItem().toString();
    String occupancy = occupancyCBox.getSelectionModel().getSelectedItem().toString();
    String isunderEmployed = "";
    ChildrenSchoolCategory childrenScl = null;

    if (!childrenSchlCBox.getSelectionModel().isEmpty()) {
      childrenScl = (ChildrenSchoolCategory) childrenSchlCBox.getSelectionModel().getSelectedItem();
    }

    if (underEmployedCBox.getSelectionModel().isEmpty()) {
      isunderEmployed = "";
    } else {
      isunderEmployed = underEmployedCBox.getSelectionModel().getSelectedItem().toString();
    }

    FamilyInfo familyInfo =
        new FamilyInfo(
            inputedDate,
            dateissued,
            residencyYr,
            numofchildren,
            name,
            lastname,
            middleName,
            spousename,
            age,
            maritalStatus,
            barangay,
            gender,
            address,
            clientID);

    FamilyPoverty familyPoverty =
        new FamilyPoverty(
            hasOtherIncome,
            isBelow8k,
            ownership,
            occupancy,
            isunderEmployed,
            childrenScl,
            dateissued,
            Utility.getCurrentMonth());

    family = new Family(familyInfo, familyPoverty);

    // send data to clientWindow
    familyFormListener.handle(family);

    //  Doesn't clear data unless notification is falls
    if (!Controller.isNotified) {
      clear();
    }
  }
Exemplo n.º 9
0
  private GridPane getTopPane() {
    topPane = new GridPane();

    // Top pane
    Label DateL = new Label("Date");
    Label surveyDateL = new Label("Surveyed Date");
    Label NameL = new Label("Name");
    Label spouseNameL = new Label("Spouse Name");
    Label addressL = new Label("Address");
    Label ageL = new Label("Age");
    Label yearofResidencyL = new Label("Year of Residency");
    Label numofChildrenL = new Label("Number of Children");

    // search nodes declaration

    // topPane nodes declaration
    dateField = new TextField(Utility.getCurrentDate());

    datePicker = new DatePicker();
    Name = new TextField();
    SpouseName = new TextField();
    agefield = new TextField();
    addressF = new TextField();
    yrResidency = new TextField();
    numofChildrenF = new TextField();

    // nodes initialization
    dateField.setAlignment(Pos.CENTER);
    dateField.setDisable(true);
    numofChildrenF.setText("0");

    Name.setPromptText("First Name");
    LastName.setPromptText("Last Name");
    MidlleName.setPromptText("Middle Name");

    SpouseName.setPromptText("Spouse Full Name");
    agefield.setPromptText("35");
    addressF.setPromptText("e.g 12345 Manga st. Mabalacat");
    yrResidency.setPromptText("e.g 2012");
    numofChildrenF.setPromptText("Number of children");

    SpouseName.setDisable(true);

    maritalCBox = new ComboBox(getMaritalStatus());
    barangayCb = new ComboBox(getBarangayListModel());
    genderCB = new ComboBox(getGender());

    maritalCBox.setPrefWidth(140);
    maritalCBox.setPromptText("Marital Status");
    maritalCBox.setEditable(false);

    genderCB.setPromptText("Gender");
    genderCB.setPrefWidth(140);

    barangayCb.setPromptText("Barangay");
    barangayCb.setEditable(false);

    // --------------------- Layouting ----------------------------///

    int indexYTop = 0;

    topPane.setConstraints(topTitleL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.TOP);

    indexYTop++;
    topPane.setConstraints(DateL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(dateField, 1, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);
    topPane.setConstraints(barangayCb, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;

    topPane.setConstraints(surveyDateL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(datePicker, 1, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);
    bottomPane.setConstraints(maritalCBox, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    bottomPane.setConstraints(yearofResidencyL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(yrResidency, 1, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(genderCB, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    bottomPane.setConstraints(numofChildrenL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(numofChildrenF, 1, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(ageL, 4, indexYTop, 1, 1, HPos.RIGHT, VPos.CENTER);
    topPane.setConstraints(agefield, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    topPane.setConstraints(NameL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(Name, 1, indexYTop, 3, 1, HPos.CENTER, VPos.CENTER);
    topPane.setConstraints(LastName, 4, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);
    topPane.setConstraints(MidlleName, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    topPane.setConstraints(spouseNameL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(SpouseName, 1, indexYTop, 5, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    topPane.setConstraints(addressL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(addressF, 1, indexYTop, 5, 1, HPos.CENTER, VPos.CENTER);

    dateField.setPrefColumnCount(6);
    agefield.setPrefColumnCount(6);

    // adding nodes to the top gridpane
    topPane
        .getChildren()
        .addAll(
            topTitleL,
            DateL,
            dateField,
            surveyDateL,
            datePicker,
            barangayCb,
            yearofResidencyL,
            yrResidency,
            maritalCBox,
            numofChildrenL,
            numofChildrenF,
            genderCB,
            NameL,
            Name,
            LastName,
            MidlleName,
            ageL,
            agefield,
            spouseNameL,
            SpouseName,
            addressL,
            addressF);

    addTopComponentListeners();

    return topPane;
  }
Exemplo n.º 10
0
  public static void main(String[] args) {
    int cores = Runtime.getRuntime().availableProcessors();
    System.out.println("The number of cores is: " + cores);

    System.out.println(System.getenv("PROCESSOR_IDENTIFIER"));
    System.out.println(System.getenv("PROCESSOR_ARCHITECTURE"));
    System.out.println(System.getenv("PROCESSOR_ARCHITEW6432"));
    System.out.println(System.getenv("NUMBER_OF_PROCESSORS"));

    System.out.println("Free memory (bytes): " + Runtime.getRuntime().freeMemory());

    System.out.println("Total memory (bytes): " + Runtime.getRuntime().totalMemory());
    // App app = new App();

    List<Integer> sortArrayMerge = new ArrayList<>();

    Utility.populateArray(sortArrayMerge);
    List<Integer> sortArrayMergeParallel = Utility.copyArray(sortArrayMerge);
    List<Integer> sortArrayMergeParallelWO = Utility.copyArray(sortArrayMerge);
    List<Integer> sortArrayMergeParallelOptimized = Utility.copyArray(sortArrayMerge);
    // Utility.printArray(sortArray);
    // Utility.printArray(sortArrayCopy);

    long startParallelMergeWO = System.currentTimeMillis();
    MultithreadedSort.runParallelMerge(
        sortArrayMergeParallelWO, cores, MultithreadedSort.MERGE_SORT_WO_SENTINEL);
    long endParrallelMergeWO = System.currentTimeMillis();

    long startParallelMerge = System.currentTimeMillis();
    // MultithreadedSort.runParallelMerge(sortArrayMergeParallel, cores,
    // MultithreadedSort.MERGE_SORT);
    long endParrallelMerge = System.currentTimeMillis();

    long startParallelMergeOptimized = System.currentTimeMillis();
    // MultithreadedSort.runParallelMerge(sortArrayMergeParallelOptimized, cores,
    // MultithreadedSort.MERGE_SORT_OPTIMIZED);
    long endParallelMergeOptimized = System.currentTimeMillis();

    long startMerge = System.currentTimeMillis();
    // Sort.mergeSort(sortArrayMerge, 0, sortArrayMerge.size() - 1);
    long endMerge = System.currentTimeMillis();

    // The search without sentinels seems to perform slightly faster with
    // the ratio of times
    // approaching to 1 as the size of array grows
    System.out.println(
        "Merge time paralle optimized is: "
            + (endParallelMergeOptimized - startParallelMergeOptimized)
            + "\nMerge time is: "
            + (endMerge - startMerge)
            + "\nParralel merge time WO is: "
            + (endParrallelMergeWO - startParallelMergeWO)
            + "\nParralel merge time is: "
            + (endParrallelMerge - startParallelMerge));
    //		 Utility.printArray(sortArrayMerge);
    //		 Utility.printArray(sortArrayMergeWO);
    //		 Utility.printArray(sortArrayMergeParallelWO);
    //		 Utility.printArray(sortArrayMergeParallel);
    //
    //		//
  }
Exemplo n.º 11
0
  public static String run(
      String fileSuffix,
      boolean singleFeature,
      double alpha,
      double beta,
      double gamma,
      double semanticThreshold,
      boolean newAsParent,
      int method,
      boolean validAnswerOnly,
      int testingMode,
      int keywordNumber,
      int adjustScore,
      int adjustSimilarity,
      int view,
      int suggestRank,
      int trainingDataSize,
      boolean enrichmentUsed,
      int featuresUsed)
      throws Exception {

    // For simplification
    int features = featuresUsed;
    boolean enrichment = enrichmentUsed;
    if (method >= 100) {
      features = method / 10 % 10;
      int enrich = method % 10;
      if (enrich == 0) {
        enrichment = false;
      } else {
        enrichment = true;
      }
    }

    // Experiment
    double confidenceLevel = 0.95;
    int repeatNumber = 1;

    double[] levelOneAccuracyArray = new double[repeatNumber];
    double[] levelTwoAccuracyArray = new double[repeatNumber];
    double[] levelThreeAccuracyArray = new double[repeatNumber];
    double[] accuracyArray = new double[repeatNumber];
    double[] accuracyLeafArray = new double[repeatNumber];
    double[] accuracyNonLeafArray = new double[repeatNumber];
    double[] meanDistanceArray = new double[repeatNumber];
    double[] meanSimilarityArray = new double[repeatNumber];
    double[] meanRankingArray = new double[repeatNumber];
    double[] rankAUCArray = new double[repeatNumber];
    double[] recommendationRankingArray = new double[repeatNumber];

    // System.out.println("Start insertion, repeat = " + repeatNumber);
    System.out.println();

    for (int s = 0; s < repeatNumber; s++) {

      // Load 91 tree
      ACMTreeNode root91 = new ACMTreeNode("ccs91_experiment.txt", false);
      ACMTreeNode root98 = new ACMTreeNode("ccs98_experiment.txt", false);

      int oldSize = root91.size();

      Vector<String> newKeywords = new Vector<String>();
      Vector<String> newNumbers = new Vector<String>();
      if (testingMode == 0) {
        newKeywords = Utility.loadVector("ccs98_keyword.txt");
      } else if (testingMode == 1) {
        newKeywords = Utility.loadVector("ccs98_pn100.txt");
        newNumbers = Utility.loadVector("ccs98_pn100_answer_number.txt");
      } else if (testingMode == 2) {
        newKeywords = Utility.loadVector("doaj_100.txt");
        newNumbers = Utility.loadVector("doaj100_answer_number.txt");
      }

      // Load NGD similarities from File
      ACMTreeSimilarity ns = new ACMTreeSimilarity(false);

      ns.loadAllNGDSimilarities();

      int size = 0;
      if (testingMode == 0) {
        size = ns.getNew98Size();
      } else if (testingMode == 1) {
        size = ns.getPn98Size();
      } else if (testingMode == 2) {
        size = ns.getDoaj100Size();
      }

      // Load web page number for original keywords
      root91.loadWebPageNumber(ns.getTree91(), 0);

      // Load author number
      AuthorSimilarity as = new AuthorSimilarity(false);
      as.loadAndComputeAuthorSimilarities(true);

      // Load word similarity
      WordSimilarity ws = new WordSimilarity(false);
      ws.loadAndComputeWordSimilarities();

      // Similarity array, distance array and randomized vector
      boolean[] valid = new boolean[size];
      double[] sim = new double[size];
      double[] dis = new double[size];
      double[] rank = new double[size];
      double[] recommend = new double[size];
      // Vector<Integer> randomVector = Utility.getShuffledVector(size);

      int totalNumber = 0;
      int correctNumber = 0;

      int totalLeafNumber = 0;
      int correctLeafNumber = 0;

      int totalNonLeafNumber = 0;
      int correctNonLeafNumber = 0;

      int levelOneCorrectNumber = 0;
      int levelTwoCorrectNumber = 0;
      int levelThreeCorrectNumber = 0;

      Vector<ACMTreeNode> predictedParentNodeVector = new Vector<ACMTreeNode>();
      Vector<ACMTreeNode> targetChildNodeVector = new Vector<ACMTreeNode>();

      int iStart = 0;
      int iStop = size;
      if (keywordNumber > -1) {
        iStart = keywordNumber;
        iStop = keywordNumber + 1;
      }
      for (int i = iStart; i < iStop; i++) {

        // Use perfect or randomized index
        int index = i;
        // int index = ((Integer)randomVector.get(i)).intValue();

        // Get child name
        String childName = (String) newKeywords.get(index);
        if (keywordNumber > -1) {
          System.out.println("Target keyword = " + childName);
        }

        // We might add reordering call here

        // Get the node from 98 tree for answer
        ACMTreeNode actualParentNode = new ACMTreeNode(false);
        if (testingMode == 0) {
          actualParentNode = root98.getNodeByName(childName).getParentNode();
          ACMTreeNode actualParentNode91 =
              root91.getNodeByName(actualParentNode.getClassificationName());
          if (actualParentNode91 != null) {
            actualParentNode = actualParentNode91;
          }
        } else if (testingMode == 1 || testingMode == 2) {
          String childNumber = (String) newNumbers.get(index);
          actualParentNode = root91.getNodeByNumber(childNumber);
        }

        int actualIndex = -1;
        if (actualParentNode != null) {
          String actualParentName = actualParentNode.getClassificationName();
          // System.out.println("actualParent = " + actualParentName);
          actualIndex = root91.getActualParentIndex(actualParentName, newAsParent);
          // System.out.println("actualIndex = " + actualIndex);
        }

        // Run if the answer can be found
        valid[index] = false;

        if (!validAnswerOnly || actualIndex != -1) {

          // System.out.println(childName);
          // System.out.println(childName + "," + actualParentNode.classificationName);

          // String lv1 = (String)actualParentNode.getParentNameVector(new Vector()).get(1);
          // System.out.println(lv1);

          valid[index] = true;
          totalNumber++;

          if (actualParentNode.getClassificationNumber().getIsLeaf()) {
            totalLeafNumber++;
          } else {
            totalNonLeafNumber++;
          }

          // Load similarities for original and new keywords
          if (testingMode == 0) {
            root91.loadSimilarity(
                ns.getNew98ToTree91NGD()[index], 0, ns.getNew98ToNew98NGD()[index]);
            root91.adjustSimilarities(beta, adjustSimilarity);
            root91.loadAuthor1(as.getNew98ToTree91Level1()[index], 0);
            root91.loadAuthor2(as.getNew98ToTree91Level2()[index], 0);
            root91.loadAuthor12(as.getNew98ToTree91LevelBoth()[index], 0);
            root91.loadJaccard(ns.getNew98ToTree91Jaccard()[index], 0);
            root91.loadIntersection(ns.getNew98ToTree91()[index], 0);
            root91.loadWord(ws.getNew98ToTree91Word()[index], 0);
          } else if (testingMode == 1) {
            root91.loadSimilarity(ns.getPn98ToTree91NGD()[index], 0);
          } else if (testingMode == 2) {
            root91.loadSimilarity(ns.getDoaj100ToTree91NGD()[index], 0);
            root91.adjustSimilarities(beta, adjustSimilarity);
            root91.loadAuthor1(as.getDoaj100ToTree91Level1()[index], 0);
            root91.loadAuthor2(as.getDoaj100ToTree91Level2()[index], 0);
            root91.loadAuthor12(as.getDoaj100ToTree91LevelBoth()[index], 0);
            root91.loadJaccard(ns.getDoaj100ToTree91Jaccard()[index], 0);
            root91.loadIntersection(ns.getDoaj100ToTree91()[index], 0);
            root91.loadWord(ws.getDoaj100ToTree91Word()[index], 0);
          }

          // Find max similarity node; select first if there are multiple
          double[] scoreArray = new double[0];
          if (method == -1) { // Random
            scoreArray = root91.getScoreArrayByRandom(newAsParent);
          } else if (method == 0) { // NGD
            scoreArray = root91.getScoreArrayByNGD(newAsParent);
          } else if (method == 1) { // LibLinear
            scoreArray =
                root91.getScoreArrayByLibLinear(
                    "model_classification_" + fileSuffix + ".txt",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method);
          } else if (method == 2) { // Score linear ensemble
            scoreArray =
                root91.getScoreArrayByLinearScoreEnsemble(
                    "model_classification_" + fileSuffix + ".txt",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    gamma,
                    method);
          } else if (method == 3) { // Rank linear ensemble
            scoreArray =
                root91.getScoreArrayByLinearRankEnsemble(
                    "model_classification_" + fileSuffix + ".txt",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    gamma,
                    method);
          } else if (method == 4) { // Score multiply ensemble
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsemble(
                    "model_classification_" + fileSuffix + ".txt",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method);
          } else if (method == 5) { // Rank multiply ensemble
            scoreArray =
                root91.getScoreArrayByMultiplyRankEnsemble(
                    "model_classification_" + fileSuffix + ".txt",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method);
          } else if (method == 6
              || method == 7
              || method == 8
              || method == 12
              || method == 100
              || method == 101
              || method == 110
              || method == 120
              || method == 121
              || method == 130
              || method == 131) { // Weka classification
            scoreArray =
                root91.getScoreArrayByWekaClassification(
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 9) { // Score multiply ensemble, LL + NB
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNB(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 10) { // Score multiply ensemble, NGD + NB
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleNGDNB(
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 11) { // Rank linear ensemble, NGD + NB
            scoreArray =
                root91.getScoreArrayByLinearRankEnsembleNGDNB(
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    gamma,
                    method,
                    enrichment,
                    features);
          } else if (method == 13) { // LibSVC
            scoreArray =
                root91.getScoreArrayByLibSVC(
                    "model_classification_" + fileSuffix + ".txt",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method);
          } else if (method == 14) { // Author 1
            scoreArray = root91.getScoreArrayByAuthor1(newAsParent);
          } else if (method == 15) { // Score multiply ensemble, LL + NB + NGD
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBNGD(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 16) { // Jaccard
            scoreArray = root91.getScoreArrayByJaccard(newAsParent);
          } else if (method == 17) { // Author 2
            scoreArray = root91.getScoreArrayByAuthor2(newAsParent);
          } else if (method == 18) { // Author 12
            scoreArray = root91.getScoreArrayByAuthor12(newAsParent);
          } else if (method == 19) { // Score multiply ensemble, LL + NB + Jaccard
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBJaccard(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 20) { // Score multiply ensemble, LL + NB + NGD + Jaccard
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBNGDJaccard(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 21) { // Intersection
            scoreArray = root91.getScoreArrayByIntersection(newAsParent);
          } else if (method == 22) { // Score multiply ensemble, LL + NB + Jaccard + Intersection
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBJaccardIntersection(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method
              == 23) { // Score multiply ensemble, LL + NB + NGD + Jaccard + Intersection
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBNGDJaccardIntersection(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method
              == 24) { // Score multiply ensemble, LL + NB + Jaccard + Intersection + Author
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBJaccardIntersectionAuthor(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 25) { // Score multiply ensemble, LL + NB + NGD + Jaccard + Author
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBNGDJaccardAuthor(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 26) { // Word
            scoreArray = root91.getScoreArrayByWord(newAsParent);
          } else if (method
              == 27) { // Score multiply ensemble, LL + NB + Jaccard + Intersection + Word
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBJaccardIntersectionWord(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 28) { // Score multiply ensemble, LL + NB + NGD + Jaccard + Word
            scoreArray =
                root91.getScoreArrayByMultiplyScoreEnsembleLLNBNGDJaccardWord(
                    "model_classification_" + fileSuffix + ".txt",
                    "model_classification_" + fileSuffix + ".model",
                    index,
                    ns.getNew98()[index],
                    singleFeature,
                    semanticThreshold,
                    newAsParent,
                    method,
                    enrichment,
                    features);
          } else if (method == 29) { // OneNorm, combine six baseline methods
            scoreArray = root91.getScoreArrayByOneNorm(newAsParent);
          } else if (method == 30) { // TwoNorm, combine six baseline methods
            scoreArray = root91.getScoreArrayByTwoNorm(newAsParent);
          } else if (method == 31) { // Parent level
            scoreArray = root91.getScoreArrayByParentLevel(newAsParent);
          } else if (method == 32) { // Sibling count
            scoreArray = root91.getScoreArrayBySiblingCount(newAsParent);
          } else if (method == 33) { // Children count
            scoreArray = root91.getScoreArrayByChildrenCount(newAsParent);
          } else if (method == 34) { // Parent web page number
            scoreArray = root91.getScoreArrayByParentWebPageNumber(newAsParent);
          } else if (method == 35) { // OneNorm, topology
            scoreArray = root91.getScoreArrayByOneNormTopology(newAsParent);
          } else if (method == 36) { // OneNorm, content
            scoreArray = root91.getScoreArrayByOneNormContent(newAsParent);
          } else if (method == 37) { // OneNorm, social
            scoreArray = root91.getScoreArrayByOneNormSocial(newAsParent);
          }

          // Utility.printDoubleArray(scoreArray, scoreArray.length);

          // Set score and rank by the score array
          root91.setScoresAndRanks(scoreArray, newAsParent);

          // Adjust scores here: try different methods
          switch (adjustScore) {
            case 0:
              root91.adjustScoreByChildAverageBottomUp(beta);
              break;
            case 1:
              root91.adjustScoreByChildAverageTopDown(beta);
              break;
            case 2:
              root91.adjustScoreByChildMaximumBottomUp(beta);
              break;
            case 3:
              root91.adjustScoreByChildMaximumTopDown(beta);
              break;
            case 4:
              root91.addScoreByChildAverageBottomUp(beta);
              break;
            case 5:
              root91.addScoreByChildAverageTopDown(beta);
              break;
            case 6:
              root91.addScoreByChildMaximumBottomUp(beta);
              break;
            case 7:
              root91.addScoreByChildMaximumTopDown(beta);
              break;
            case 8:
              root91.addScoreByChildAllTopDown(beta);
              break;
            case 9:
              root91.addScoreByChildAllBottomUp(beta);
              break;
            case 10:
              root91.addScoreByChildMinimumBottomUp(beta);
              break;
            case 11:
              root91.addScoreByChildMinimumTopDown(beta);
              break;
            case 12:
              root91.addScoreByChildMinMaxTopDown(beta);
              break;
            case 13:
              root91.addScoreByChildMaxMinTopDown(beta);
              break;
            default:
              break;
          }

          root91.setScore(0);
          scoreArray = root91.getScores(newAsParent);
          // Utility.printDoubleArray(scoreArray, 5);
          root91.setScoresAndRanks(scoreArray, newAsParent);

          ACMTreeNode predictedParentNode =
              root91.findPredictedParentNode(scoreArray, newAsParent, actualIndex);
          // System.out.println("predictedParent=" + predictedParentNode.getClassificationName());
          // System.out.println();

          // Compute structural similarity, structural distance
          sim[index] =
              root91.computeStructuralSimilarity(
                  predictedParentNode, actualParentNode, childName, alpha);
          dis[index] =
              root91.computeStructuralDistance(predictedParentNode, actualParentNode, childName);

          // Compute recommendation ranking
          if (method == -1) {
            recommend[index] = root91.getRandomRecommendationRank(actualParentNode);
          } else {
            recommend[index] = root91.getRecommendationRank(actualParentNode, null);
          }

          // Create new node as leaf
          ACMTreeNode child = new ACMTreeNode(false);
          if (testingMode == 0) {
            child =
                predictedParentNode.createNewChildNodeAsLeaf(
                    childName, index, ns.getNew98()[index], false);
          } else if (testingMode == 1) {
            child =
                predictedParentNode.createNewChildNodeAsLeaf(
                    childName, index, ns.getPn98()[index], false);
          } else if (testingMode == 2) {
            child =
                predictedParentNode.createNewChildNodeAsLeaf(
                    childName, index, ns.getDoaj100()[index], false);
          }

          rank[index] = root91.getAnswerRanking();
          child.setAnswerRanking(rank[index]);
          child.setStructuralDistance(dis[index]);
          child.setStructuralSimilarity(sim[index]);
          child.setScore(predictedParentNode.getScore());

          if (newAsParent) {
            predictedParentNode.insertChildNode(child);
          }
          predictedParentNodeVector.add(predictedParentNode);
          targetChildNodeVector.add(child);

          // Compute level-based accuracy
          int commonLevel =
              root91.computeCommonLevel(predictedParentNode, actualParentNode, childName);

          if (commonLevel > 1) { // First level
            levelOneCorrectNumber++;
            child.setLevelOneCorrect(true);

            if (commonLevel > 2) { // Second level
              levelTwoCorrectNumber++;
              child.setLevelTwoCorrect(true);

              if (commonLevel > 3) { // Third level
                levelThreeCorrectNumber++;
                child.setLevelThreeCorrect(true);
              }
            }
          }

          // Compute accuracy
          // System.out.println(sim[index]);
          if (sim[index] == 1.0) {
            correctNumber++;
            child.setCorrect(true);
            // System.out.println(child.getClassificationName());

            if (actualParentNode.getClassificationNumber().getIsLeaf()) {
              correctLeafNumber++;
            } else {
              correctNonLeafNumber++;
            }
          }

          // Display names and similarity
          /*
          String predictedParentName = predictedParentNode.getClassificationName();
          System.out.println(childName + ", " + predictedParentName + ", " + actualParentName + ", " + sim[i] + ", " + dis[i]);
          root91.printSimilarities();
          */

          // Output tree for view
          if (view == 0 || view == 2) {
            root91.resetType();
            root91.computeType(predictedParentNode, actualParentNode);
            root91.outputXMLForPrefuse(
                "view/view_" + fileSuffix + "k" + (index + 1) + ".xml", childName, suggestRank);
          } else if (view == 1) {
            root91.computeCorrectNumber(predictedParentNode, actualParentNode);
          }
          System.out.print("o");
        } else {
          System.out.print(".");
        }
        if (((i + 1) % (size / 5)) == 0) {
          System.out.println();
        }
      }

      if (!newAsParent) {
        for (int i = 0; i < predictedParentNodeVector.size(); i++) {
          ACMTreeNode parent = (ACMTreeNode) predictedParentNodeVector.get(i);
          ACMTreeNode child = (ACMTreeNode) targetChildNodeVector.get(i);
          parent.insertChildNode(child);
        }
      }

      // Display in original order, for easier comparison
      /*
      for(int i=0; i<ns.getCurrentNew98Size(); i++) {
      	System.out.println(sim[i]);
      }
      System.out.println();
      */

      levelOneAccuracyArray[s] = (double) levelOneCorrectNumber / (double) totalNumber;
      levelTwoAccuracyArray[s] = (double) levelTwoCorrectNumber / (double) totalNumber;
      levelThreeAccuracyArray[s] = (double) levelThreeCorrectNumber / (double) totalNumber;
      accuracyArray[s] = (double) correctNumber / (double) totalNumber;
      accuracyLeafArray[s] = (double) correctLeafNumber / (double) totalLeafNumber;
      accuracyNonLeafArray[s] = (double) correctNonLeafNumber / (double) totalNonLeafNumber;

      meanDistanceArray[s] =
          Utility.computeAndPrintStatistics(
              "dis", Utility.getValidData(dis, valid), confidenceLevel, totalNumber);
      meanSimilarityArray[s] =
          Utility.computeAndPrintStatistics(
              "sim", Utility.getValidData(sim, valid), confidenceLevel, totalNumber);
      meanRankingArray[s] =
          Utility.computeAndPrintStatistics(
              "rank", Utility.getValidData(rank, valid), confidenceLevel, totalNumber);
      recommendationRankingArray[s] =
          Utility.computeAndPrintStatistics(
              "recommend", Utility.getValidData(recommend, valid), confidenceLevel, totalNumber);

      rankAUCArray[s] = root91.computeRankBasedAUC(targetChildNodeVector, oldSize);

      System.out.println();
      System.out.println(
          "Done, valid keyword number = "
              + totalNumber
              + ", leaf = "
              + totalLeafNumber
              + ", nonleaf = "
              + totalNonLeafNumber);
      // System.out.println(correctNumber + ", " + totalNumber);
      // System.out.println(s + ", " + accuracyArray[s] + ", " + meanDistanceArray[s] + ", " +
      // meanSimilarityArray[s]);

      // root91.printSimilarities();
      // root91.printAll();
      // root91.printTesting(0);

      root91.logAll("final/final_" + fileSuffix + ".txt", false);
      root91.logLevelOne("lv1/lv1_" + fileSuffix + ".txt", false);
      root91.logAnalysisForExcel("analysis/analysis_" + fileSuffix + ".csv", targetChildNodeVector);

      if (view == 1) {
        root91.setCorrectNumber(54);
        root91.outputXMLForPrefuse("view/view_" + fileSuffix + ".xml", null, -1);
      }
    }

    // Compute statistical measurements
    System.out.println();
    double lv1 =
        Utility.computeAndPrintStatistics(
            "Level 1 Accuracy", levelOneAccuracyArray, confidenceLevel, repeatNumber);
    double lv2 =
        Utility.computeAndPrintStatistics(
            "Level 2 Accuracy", levelTwoAccuracyArray, confidenceLevel, repeatNumber);
    double lv3 =
        Utility.computeAndPrintStatistics(
            "Level 3 Accuracy", levelThreeAccuracyArray, confidenceLevel, repeatNumber);
    double total =
        Utility.computeAndPrintStatistics(
            "Total Accuracy", accuracyArray, confidenceLevel, repeatNumber);
    double leaf =
        Utility.computeAndPrintStatistics(
            "Leaf Accuracy", accuracyLeafArray, confidenceLevel, repeatNumber);
    double nonleaf =
        Utility.computeAndPrintStatistics(
            "Non Leaf Accuracy", accuracyNonLeafArray, confidenceLevel, repeatNumber);
    double dis =
        Utility.computeAndPrintStatistics(
            "Distance", meanDistanceArray, confidenceLevel, repeatNumber);
    double sim =
        Utility.computeAndPrintStatistics(
            "Similarity", meanSimilarityArray, confidenceLevel, repeatNumber);
    double rank =
        Utility.computeAndPrintStatistics(
            "Ranking", meanRankingArray, confidenceLevel, repeatNumber);
    double rankAUC =
        Utility.computeAndPrintStatistics("RankAUC", rankAUCArray, confidenceLevel, repeatNumber);
    double recommend =
        Utility.computeAndPrintStatistics(
            "Recommendation Ranking", recommendationRankingArray, confidenceLevel, repeatNumber);

    PrintWriter pw = new PrintWriter("result/result_" + fileSuffix + ".txt");
    pw.print(trainingDataSize);
    pw.print(", " + String.format("%.4f", lv1));
    pw.print(", " + String.format("%.4f", lv2));
    pw.print(", " + String.format("%.4f", lv3));
    pw.print(", " + String.format("%.4f", total));
    pw.print(", " + String.format("%.4f", leaf));
    pw.print(", " + String.format("%.4f", nonleaf));
    pw.print(", " + String.format("%.4f", dis));
    pw.print(", " + String.format("%.4f", sim));
    pw.print(", " + String.format("%.4f", rank));
    pw.print(", " + String.format("%.4f", rankAUC));
    pw.print(", " + String.format("%.4f", recommend));
    pw.println();
    pw.close();

    String resultString = "";
    resultString += method;
    resultString += "," + features;
    resultString += "," + enrichment;
    resultString += "," + total;
    resultString += "," + sim;
    resultString += "," + rank;
    resultString += "," + rankAUC;
    resultString += "," + recommend;

    return resultString;

    // Backup //////////////////////////////////////////////////////

    // Load similarities
    /*
    ACMTreeNode root91 = new ACMTreeNode();
    root91.loadACMTreeFromFile("ccs91_experiment.txt");

    //root91.loadSimilarityFromFile("YahooNGDSim_3D Stereo Scene Analysis.txt");
    //root91.loadSimilarityFromFile("YahooNGDSim_Distributed Objects.txt");
    root91.loadSimilarityFromFile("YahooNGDSim_Quadratic Programming Methods.txt");

    root91.adjustSimilarityByChildMaximum(0.5);
    root91.printSimilarities(1);
    */

    // Show preprocessed keywords in 91 (adjusted)
    /*
    ACMTreeNode root91 = new ACMTreeNode();
    root91.loadAndAdjustACMTree("ccs91_experiment.txt");
    Vector names = root91.getPreprocessedNameVector(new Vector());
    //Vector names = root91.getPreprocessedSubjectDescriptorNames(new Vector());
    //Vector names = root91.getPreprocessedMainClassNames(new Vector());
    //Vector names = root91.getRepeatedKeywords(new Vector());
    Utility.printStringVector(names);
    */

    // Find new (leaf / subject descriptor) keywords in 98
    /*
    ACMTreeNode root98 = new ACMTreeNode();
    root98.loadAndAdjustACMTree("ccs98_experiment.txt");

    ACMTreeNode root91 = new ACMTreeNode();
    root91.loadAndAdjustACMTree("ccs91_experiment.txt");

    Vector name91 = root91.getPreprocessedNameVector(new Vector());
    Vector newKeywords = root98.findNewKeywords(name91, new Vector());
    //Vector newLeafKeywords = root98.getNewLeafKeywords(new Vector());
    //Vector newSubjectDescriptorKeywords = root98.getNewSubjectDescriptorKeywords(new Vector());
    Utility.printStringVector(newKeywords);
    //root98.printNewForExcel();
    */

    // Find deleted keywords in 98
    /*
    ACMTreeNode root98 = new ACMTreeNode();
    root98.loadAndAdjustACMTree("ccs98_experiment.txt");
    Vector deletedKeywords = root98.getDeletedKeywords(new Vector());
    Utility.printStringVector(deletedKeywords);
    */

    // Find replaced (new and deleted) keywords in 98
    /*
    ACMTreeNode root98 = new ACMTreeNode();
    root98.loadAndAdjustACMTree("ccs98_experiment.txt");

    ACMTreeNode root91 = new ACMTreeNode();
    root91.loadAndAdjustACMTree("ccs91_experiment.txt");
    Vector name91 = root91.getPreprocessedNameVector(new Vector());

    Vector newKeywords = root98.findNewKeywords(name91, new Vector());
    Vector deletedKeywords = root98.getDeletedKeywords(new Vector());

    for(int i=0; i<newKeywords.size(); i++) {
    	String newKeyword = (String)newKeywords.get(i);
    	for(int j=0; j<deletedKeywords.size(); j++) {
    		String deletedKeyword = (String)deletedKeywords.get(j);
    		if(newKeyword.equalsIgnoreCase(deletedKeyword)) {
    			System.out.println(newKeyword);
    			break;
    		}
    	}
    }
    */

    // Insertion Test
    /*
    ACMTreeNode childNode = new ACMTreeNode();
    childNode.setClassificationName("Tim Test");
    childNode.setClassificationNumber(new ACMTreeClassificationNumber());
    childNode.getClassificationNumber().setIsLeaf(true);
    ACMTreeNode firstChild = (ACMTreeNode)root98.childNode.get(0);
    ACMTreeNode secondChild = (ACMTreeNode)firstChild.childNode.get(0);
    firstChild.insertChildNodeBetween(childNode, secondChild);
    */
  }
Exemplo n.º 12
0
  @Override
  public void paintComponent(Graphics2D g2) {
    if (!isVisible()) return;

    final Color textColor = new Color(40, 40, 40);
    final Color borderColor = new Color(65, 65, 65);
    final GradientPaint backGradient =
        new GradientPaint(
            bounds.x,
            bounds.y,
            getColor(),
            bounds.x + bounds.width,
            bounds.y + bounds.height,
            getColor().darker());

    final String className = component.getName();

    final FontMetrics classNameMetrics = g2.getFontMetrics(entityName.getEffectivFont());
    final int classNameWidth = classNameMetrics.stringWidth(className);
    final int classNameHeight = classNameMetrics.getHeight();

    final Dimension classNameSize = new Dimension(classNameWidth, classNameHeight);

    stereotypeFont = stereotypeFont.deriveFont(stereotypeFontBasic.getSize() * parent.getZoom());

    g2.setFont(stereotypeFont);
    final String stereotype =
        Utility.truncate(g2, "<<" + component.getStereotype() + " >>", bounds.width - 15);

    final FontMetrics stereotypeMetrics = g2.getFontMetrics(stereotypeFont);
    final int stereotypeWidth = stereotypeMetrics.stringWidth(stereotype);
    final int stereotypeHeight = stereotypeMetrics.getHeight();

    final Dimension stereotypeSize = new Dimension(stereotypeWidth, stereotypeHeight);

    final FontMetrics metrics = g2.getFontMetrics(entityName.getEffectivFont());
    final int textBoxHeight = metrics.getHeight();

    bounds.height = computeHeight(classNameSize.height, stereotypeHeight, textBoxHeight);

    final Rectangle bounds = getBounds();

    int offset = bounds.y + VERTICAL_SPACEMENT / 2;
    final int stereotypeLocationWidth = bounds.x + (bounds.width - stereotypeSize.width) / 2;

    entityName.setBounds(new Rectangle(1, 1, bounds.width - 15, textBoxHeight + 2));
    final Rectangle entityNameBounds = entityName.getBounds();
    final int classNameLocationX = bounds.x + (bounds.width - entityNameBounds.width) / 2;

    // draw background
    g2.setPaint(backGradient);
    g2.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);

    // draw border
    g2.setStroke(new BasicStroke(BORDER_WIDTH));
    g2.setColor(borderColor);
    g2.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);

    // draw stereotype
    if (!component.getStereotype().isEmpty()) {
      offset += stereotypeSize.height;

      g2.setFont(stereotypeFont);
      g2.setColor(textColor);
      g2.drawString(stereotype, stereotypeLocationWidth, offset);
    }

    // draw class name
    offset += /* classNameSize.height + */ VERTICAL_SPACEMENT / 2;

    entityName.setBounds(
        new Rectangle(classNameLocationX, offset, bounds.width - 15, textBoxHeight + 2));
    entityName.paintComponent(g2);

    offset += entityNameBounds.height;

    // draw separator
    offset += 10;
    g2.setStroke(new BasicStroke(BORDER_WIDTH));
    g2.setColor(borderColor);
    g2.drawLine(bounds.x, offset, bounds.x + bounds.width, offset);

    // draw attributes
    if (displayAttributes && attributesView.size() > 0)
      // draw methods
      for (final TextBoxAttribute tb : attributesView) {
        tb.setBounds(new Rectangle(bounds.x + 8, offset + 2, bounds.width - 15, textBoxHeight + 2));
        tb.paintComponent(g2);

        offset += textBoxHeight;
      }

    // draw separator
    offset += 10;
    g2.setStroke(new BasicStroke(BORDER_WIDTH));
    g2.setColor(borderColor);
    g2.drawLine(bounds.x, offset, bounds.x + bounds.width, offset);

    // draw methods
    if (displayMethods && methodsView.size() > 0)
      // draw methods
      for (final TextBoxMethod tb : methodsView) {
        tb.setBounds(new Rectangle(bounds.x + 8, offset + 2, bounds.width - 15, textBoxHeight + 2));
        tb.paintComponent(g2);

        offset += textBoxHeight;
      }

    // is component selected? -> draw selected style
    if (parent.getSelectedComponents().contains(this)) drawSelectedStyle(g2);
  }
Exemplo n.º 13
0
 public static void printArrayOfArrays(List<List<Integer>> myArrays) {
   for (int i = 0; i < myArrays.size(); i++) {
     System.out.println("Array #" + (i + 1) + ":");
     Utility.printArray(myArrays.get(i));
   }
 }