Skip to content

Commit

Permalink
Created DataVizBeatPoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
DamonHD committed Jun 4, 2024
1 parent 07db76d commit 94aabc6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
2 changes: 1 addition & 1 deletion RELEASES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ or release/freeze points.
SIGNIFICANT CHANGES SINCE LAST RELEASE
======================================

DHD20240604: added optional dataLabels and dataRendered to MIDITune.
DHD20240604: added optional DataVizBeatPoint dataRendered to MIDITune.



Expand Down
2 changes: 1 addition & 1 deletion javasrc/org/hd/d/statsHouse/data/DataBounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* 0 for no such main stream, 1+ for stream, possibly larger than streams
* @param maxVal maximum (non-zero) value in the data; non-negative.
* @param firstDate first data row date as raw String; can be null
* @param lkastDate last data row date as raw String; can be null
* @param lastDate last data row date as raw String; can be null
*/
public record DataBounds(int streams, int mainDataStream, float maxVal, String firstDate, String lastDate)
{
Expand Down
39 changes: 39 additions & 0 deletions javasrc/org/hd/d/statsHouse/data/DataVizBeatPoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Copyright (c) 2024, Damon Hart-Davis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package org.hd.d.statsHouse.data;

import java.util.List;

/**Data Visualisation for a data point per simple (typically 4/4) beat.
*
* @param dataLabels column labels for dataRendered (not containing nulls or commas);
* may be null
* @param dataRendered the set of key data as rendered in the tune,
* with the outer List usually one item per bar beat,
* and the inner list an ordered list of the key items rendered in that beat maybe normalised;
* may be null
*/
public record DataVizBeatPoint(
List<String> dataLabels,
List<List<Float>> dataRendered
)
{
public DataVizBeatPoint
{
if(null != dataLabels) { dataLabels = List.copyOf(dataLabels); } // Defensive copy.
}
}
10 changes: 4 additions & 6 deletions javasrc/org/hd/d/statsHouse/midi/MIDITune.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;
import java.util.Objects;

import org.hd.d.statsHouse.data.DataVizBeatPoint;
import org.hd.d.statsHouse.generic.TuneSectionPlan;

/**A representation of a full MIDI 'tune' created from data.
Expand All @@ -35,15 +36,13 @@
* may be null
* @param dataLabels column labels for dataRendered (not containing nulls or commas);
* may be null
* @param dataRendered the set of key data as rendered in the tune,
* with the outer List usually one item per bar beat,
* and the inner list an ordered list of the key items rendered in that beat maybe normalised;
* @param dataRendered the set of key data as rendered in the tune;
* may be null
*/
public record MIDITune(List<MIDIDataMelodyTrack> dataMelody,
List<MIDISupportTrack> supportTracks,
TuneSectionPlan plan,
List<String> dataLabels, List<List<Float>> dataRendered)
DataVizBeatPoint dataRendered)
{
public MIDITune
{
Expand All @@ -53,15 +52,14 @@ public record MIDITune(List<MIDIDataMelodyTrack> dataMelody,
Objects.requireNonNull(supportTracks);
if(supportTracks.stream().anyMatch(t -> t == null)) { throw new IllegalArgumentException(); }
supportTracks = List.copyOf(supportTracks); // Defensive copy.
if(null != dataLabels) { dataLabels = List.copyOf(dataLabels); } // Defensive copy.
}

/**Data melody and support track and plan, no rendered data. */
public MIDITune(
final List<MIDIDataMelodyTrack> dataMelody,
final List<MIDISupportTrack> supportTracks,
final TuneSectionPlan plan)
{ this(dataMelody, supportTracks, plan, null, null); }
{ this(dataMelody, supportTracks, plan, null); }

/**Data melody and support track, no plan nor rendered data. */
public MIDITune(
Expand Down

0 comments on commit 94aabc6

Please sign in to comment.