Class NSM

java.lang.Object
eu.bandm.music.entities.NSM

public class NSM extends Object
Notation for Stratified Meters according to Härpfer. This implementation follows the definition by Bernd Härpfer, "The Metric Malleability and Ambiguity of Cyclic Rhythms---A Quantitative Heuristic Approach", Hofheim 2023, online resource. An extension which extends the definitions to two, namely Generic notation for stratified meters (GNSM) and measure notation for stratified meters (MNSM) . is found in Lepper/Härpfer/Trancón "Härpfer’s Extended Indispensability Algorithm In Z" online resource.

Each instance can possibly have a list of indispensability values, but this is not possible for all cases. (Currently the first weight may not appear more than four times.)

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) boolean
    Flag whether the indispesability has been tried to compute.
    (package private) @Opt List<Integer>
    List of indispensability values, in one-to-one correspondance to the list of weights.
    protected final boolean
    Whether this is a MNSM and not a GNSM.
    protected final int
    Length of the meter = number of weight positions.
    protected final List<Integer>
    Weights as given with the construction.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NSM(Integer... data)
    Constructor which takes an array of integer.
    NSM(List<Integer> data)
    Constructor which takes a non-empty list of integer values.
  • Method Summary

    Modifier and Type
    Method
    Description
    Checks whether the input data is a valid sequence of indispensability values.
    (package private) void
    Compute the indispensability values for all positions of the meter.
    (package private) int
    cPred(int i)
    Caculate the cyclic predecessor of the given (zero-based) index.
    Return an unmodifiable copy of the computed list of indispensability values.
    Return an unmodifiable copy of the list of weights.
    boolean
    Return whether this is a MNSM and not a GNSM.
    occurenceList(int weight)
    Returns a list of all position indexes where the given weight occurs.
    static @Opt List<Integer>
    Utility method which parses decimal digits only.
    int
    Return the length of the meter = the number of weight positions.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • weights

      protected final List<Integer> weights
      Weights as given with the construction.
    • size

      protected final int size
      Length of the meter = number of weight positions.
    • isMeasureAware

      protected final boolean isMeasureAware
      Whether this is a MNSM and not a GNSM.
    • indispComputed

      boolean indispComputed
      Flag whether the indispesability has been tried to compute.
    • indispensabilities

      @Opt @Opt List<Integer> indispensabilities
      List of indispensability values, in one-to-one correspondance to the list of weights.
  • Constructor Details

  • Method Details

    • size

      public int size()
      Return the length of the meter = the number of weight positions.
    • isMeasureAware

      public boolean isMeasureAware()
      Return whether this is a MNSM and not a GNSM. In an MNSM the first value appears only once.
    • getWeights

      public List<Integer> getWeights()
      Return an unmodifiable copy of the list of weights.
    • checkData

      @Opt public static @Opt PreMessage checkData(List<Integer> data)
      Checks whether the input data is a valid sequence of indispensability values. Each value in the list must be a non-negative integer. All values from zero to the highest contained value must be contained. The first position must contain the highest value.
      Returns:
      null if data is valid, otherwise an error messae
    • parse

      @Opt public static @Opt List<Integer> parse(String s)
      Utility method which parses decimal digits only.
    • occurenceList

      public List<Integer> occurenceList(int weight)
      Returns a list of all position indexes where the given weight occurs. Result may be empty. The positions are zero-based.
    • cPred

      int cPred(int i)
      Caculate the cyclic predecessor of the given (zero-based) index.
    • computeIndispensabilities

      void computeIndispensabilities()
      Compute the indispensability values for all positions of the meter. This is not always possible. (Currently the first weight may not appear more than four times.)

      Attention: in contrast to the IMAGES in the paper, lists here and in the Z formulas are zero-based.

    • getIndispensabilities

      @Opt public @Opt List<Integer> getIndispensabilities()
      Return an unmodifiable copy of the computed list of indispensability values.
      Returns:
      null if no such list can be computed, see computeIndispensabilities().