Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-552

MultidimensionalCounter.getCounts(int) returns wrong array of indices

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2
    • 3.0
    • None
    • None
    • Java 1.6

    Description

      MultidimensionalCounter counter = new MultidimensionalCounter(2, 4);
      for (Integer i : counter) {
      int[] x = counter.getCounts;
      System.out.println(i + " " + Arrays.toString);
      }

      Output is:
      0 [0, 0]
      1 [0, 1]
      2 [0, 2]
      3 [0, 2] <=== should be [0, 3]
      4 [1, 0]
      5 [1, 1]
      6 [1, 2]
      7 [1, 2] <=== should be [1, 3]

      Attachments

        1. MultidimensionalCounter.patch
          2 kB
          James Bence

        Activity

          People

            Unassigned Unassigned
            jbence@pobox.com James Bence
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: