Is there a more elegant way of doing this? (Cannot be more descriptive.)
<p>I have three non-static classes representing musical composition. These are Score, Part and Note class.</p>

<p>Score contains instance variable <code>ArrayList&lt;Part&gt;</code> representing multiple instrument parts of a score, and Part contains instance variable <code>ArrayList&lt;Note&gt;</code> representing a note sequence.</p>

<pre><code>public class Score {

   private ArrayList&lt;Part&gt; parts;
   private int resolution;

   public Score(int resolution) {
      parts = new ArrayList&lt;Part&gt;();
      this.resolution = resolution;
   }

   public void addPart(Part part) {
      parts.add(part);
   }

   public ArrayList&lt;Part&gt; getParts() {
      return parts;
   }

   public int getResolution() {
      return resolution;
   }
}

public class Part {

   private ArrayList&lt;Note&gt; notes;

   public Part() {
      notes = new ArrayList&lt;Note&gt;();
   }

   public void addNote(Note note) {
      notes.add(note);
   }

   public ArrayList&lt;Note&gt; getNotes() {
      return notes;
   }
}

public class Note() {
   private long startStamp;
   private long endStamp;
   private int resolution;

   public Note(long startStamp, long endStamp, int resolution) {
      this.startStamp = startStamp;
      this.endStamp = endStamp;
      this resolution = resolution;
   }

   public double getDuration() {
      int duration = (double) (getEndStamp() - getStartStamp()) / resolution;
      return duration;
   }
}
</code></pre>

<p>Duration of each note is calculated using a score resolution. Resolution of a particular Score instance is passed through Note construtor each time note is instantiated. Note is then added to <code>ArrayList&lt;Note&gt; notes</code> of a corresponding Part instance, and part is added to <code>ArrayList&lt;Part&gt; parts</code> of a Score instance. </p>

<p>My solution of using <code>int resolution</code> as a Note constructor parameter doesn't seem elegant, since there are many notes belonging to the same score, i.e. resolution is attribute of a score rather than attribute of a note. </p>

<p>Is there a way to get resolution by referencing  a corresponding Score object from inside Note class, instead of passing resolution through constructor of a Note class, or perhaps some other solution?</p>
