/** * Determines the most appropriate matrix to use. * * <p>Calculates the maximum length of the shortest weighted path if both sequences are totally * different, which corresponds to the sum of all the events. * * @param s1 The first sequence. * @param s2 The second sequence. * @return The most appropriate matrix. */ private static Matrix setupMatrix(EventSequence s1, EventSequence s2) { int max = 0; for (int i = 0; i < s1.size(); i++) max += s1.getEvent(i).getWeight(); for (int i = 0; i < s2.size(); i++) max += s2.getEvent(i).getWeight(); if (max > Short.MAX_VALUE) return new MatrixInt(); else return new MatrixShort(); }