TrackFinder.java

  1. /*
  2.  * *********************************************************************************************************************
  3.  *
  4.  * blueMarine II: Semantic Media Centre
  5.  * http://tidalwave.it/projects/bluemarine2
  6.  *
  7.  * Copyright (C) 2015 - 2021 by Tidalwave s.a.s. (http://tidalwave.it)
  8.  *
  9.  * *********************************************************************************************************************
  10.  *
  11.  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  12.  * the License. You may obtain a copy of the License at
  13.  *
  14.  *     http://www.apache.org/licenses/LICENSE-2.0
  15.  *
  16.  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  17.  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
  18.  * specific language governing permissions and limitations under the License.
  19.  *
  20.  * *********************************************************************************************************************
  21.  *
  22.  * git clone https://bitbucket.org/tidalwave/bluemarine2-src
  23.  * git clone https://github.com/tidalwave-it/bluemarine2-src
  24.  *
  25.  * *********************************************************************************************************************
  26.  */
  27. package it.tidalwave.bluemarine2.model.finder.audio;

  28. import javax.annotation.Nonnull;
  29. import it.tidalwave.util.Id;
  30. import it.tidalwave.util.spi.ExtendedFinderSupport;
  31. import it.tidalwave.bluemarine2.model.audio.MusicArtist;
  32. import it.tidalwave.bluemarine2.model.audio.Record;
  33. import it.tidalwave.bluemarine2.model.audio.Track;
  34. import it.tidalwave.bluemarine2.model.spi.SourceAwareFinder;

  35. /***********************************************************************************************************************
  36.  *
  37.  * A {@code Finder} for {@link Track}s.
  38.  *
  39.  * @stereotype      Finder
  40.  *
  41.  * @author  Fabrizio Giudici
  42.  *
  43.  **********************************************************************************************************************/
  44. public interface TrackFinder extends SourceAwareFinder<Track, TrackFinder>,
  45.                                      ExtendedFinderSupport<Track, TrackFinder>
  46.   {
  47.     /*******************************************************************************************************************
  48.      *
  49.      * Constrains the search to tracks made by the given artist.
  50.      *
  51.      * @param       artistId    the artist id
  52.      * @return                  the {@code Finder}, in fluent fashion
  53.      *
  54.      ******************************************************************************************************************/
  55.     @Nonnull
  56.     public TrackFinder madeBy (@Nonnull Id artistId);

  57.     /*******************************************************************************************************************
  58.      *
  59.      * Constrains the search to tracks made by the given artist.
  60.      *
  61.      * @param       artist      the artist
  62.      * @return                  the {@code Finder}, in fluent fashion
  63.      *
  64.      ******************************************************************************************************************/
  65.     @Nonnull
  66.     public default TrackFinder madeBy (@Nonnull final MusicArtist artist)
  67.       {
  68.         return madeBy(artist.getId());
  69.       }

  70.     /*******************************************************************************************************************
  71.      *
  72.      * Constrains the search to tracks contained in the given record.
  73.      *
  74.      * @param       recordId    the record id
  75.      * @return                  the {@code Finder}, in fluent fashion
  76.      *
  77.      ******************************************************************************************************************/
  78.     @Nonnull
  79.     public TrackFinder inRecord (@Nonnull Id recordId);

  80.     /*******************************************************************************************************************
  81.      *
  82.      * Constrains the search to tracks contained in the given record.
  83.      *
  84.      * @param       record      the record
  85.      * @return                  the {@code Finder}, in fluent fashion
  86.      *
  87.      ******************************************************************************************************************/
  88.     @Nonnull
  89.     public default TrackFinder inRecord (@Nonnull final Record record)
  90.       {
  91.         return inRecord(record.getId());
  92.       }
  93.   }