idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
5,600
public void writeScoreTo ( OutputStream os ) throws IOException { if ( m_jTune != null ) { setTune ( m_jTune . getTune ( ) ) ; } BufferedImage bufferedImage = new BufferedImage ( ( int ) m_dimension . getWidth ( ) , ( int ) m_dimension . getHeight ( ) , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D bufferedImageGfx = bufferedImage . createGraphics ( ) ; bufferedImageGfx . setColor ( getBackground ( ) ) ; bufferedImageGfx . fillRect ( 0 , 0 , bufferedImage . getWidth ( ) , bufferedImage . getHeight ( ) ) ; drawIn ( bufferedImageGfx ) ; ImageIO . write ( bufferedImage , "png" , os ) ; }
Writes the currently set tune score to a PNG output stream .
5,601
public void writeScoreTo ( File file ) throws IOException { FileOutputStream fos = new FileOutputStream ( file ) ; try { writeScoreTo ( fos ) ; } finally { fos . close ( ) ; } }
Writes the currently set tune score to a PNG file .
5,602
public void setTune ( Tune tune ) { m_jTune = new JTune ( tune , new Point ( 0 , 0 ) , getTemplate ( ) ) ; m_jTune . setColor ( getForeground ( ) ) ; m_selectedItems = null ; m_dimension . setSize ( m_jTune . getWidth ( ) , m_jTune . getHeight ( ) ) ; setPreferredSize ( m_dimension ) ; setSize ( m_dimension ) ; m_isBufferedImageOutdated = true ; repaint ( ) ; }
Sets the tune to be renderered .
5,603
public JScoreElement getScoreElementAt ( Point location ) { if ( m_jTune != null ) return m_jTune . getScoreElementAt ( location ) ; else return null ; }
Returns the graphical score element fount at the given location .
5,604
public JScoreElement getRenditionElementFor ( MusicElement elmnt ) { if ( m_jTune != null ) return m_jTune . getRenditionObjectFor ( elmnt ) ; else return null ; }
Returns the graphical element that corresponds to a tune element .
5,605
public Collection < PluginComponent > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/components.json" , null , queryParams , PLUGIN_COMPONENTS ) . get ( ) ; }
Returns the set of plugin components with the given query parameters .
5,606
public Optional < PluginComponent > show ( long componentId ) { return HTTP . GET ( String . format ( "/v2/components/%d.json" , componentId ) , PLUGIN_COMPONENT ) ; }
Returns the plugin component for the given id .
5,607
public Optional < QueryData > list ( long accountId , String query ) { QueryParameterList queryParams = new QueryParameterList ( ) ; queryParams . add ( "nrql" , encode ( query ) ) ; return HTTP . GET ( String . format ( "/v1/accounts/%d/query" , accountId ) , null , queryParams , QUERY_DATA ) ; }
Returns the set of data for a query .
5,608
public static String getKey ( String category , String name ) { if ( category != null && name != null ) return category + ":" + name ; return null ; }
Sets the key of the label from the name and category .
5,609
public Collection < AlertIncident > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/alerts_incidents.json" , null , queryParams , ALERT_INCIDENTS ) . get ( ) ; }
Returns the set of alert incidents with the given query parameters .
5,610
public Optional < ExternalServiceAlertCondition > create ( long policyId , ExternalServiceAlertCondition condition ) { return HTTP . POST ( String . format ( "/v2/alerts_external_service_conditions/policies/%d.json" , policyId ) , condition , EXTERNAL_SERVICE_ALERT_CONDITION ) ; }
Creates the given external service alert condition .
5,611
public Optional < ExternalServiceAlertCondition > update ( ExternalServiceAlertCondition condition ) { return HTTP . PUT ( String . format ( "/v2/alerts_external_service_conditions/%d.json" , condition . getId ( ) ) , condition , EXTERNAL_SERVICE_ALERT_CONDITION ) ; }
Updates the given external service alert condition .
5,612
public boolean hasDecoration ( byte decorationType ) { if ( hasDecorations ( ) ) { for ( Decoration m_decoration : m_decorations ) { if ( m_decoration . isType ( decorationType ) ) return true ; } } return false ; }
Test if the element has the specified type of decoration
5,613
public void setChannelIds ( List < Long > channelIds ) { setChannels ( AlertPolicyChannel . builder ( ) . channelIds ( channelIds ) . build ( ) ) ; }
Sets the channels for the policy .
5,614
public static Music correctPartsKeys ( Music music ) { for ( Object o : music . getVoices ( ) ) { Voice voice = ( Voice ) o ; if ( voice . hasObject ( KeySignature . class ) && voice . hasObject ( PartLabel . class ) ) { Hashtable partsKey = new Hashtable ( ) ; KeySignature tuneKey = null ; int size = voice . size ( ) ; int i = 0 ; while ( i < size ) { MusicElement me = ( MusicElement ) voice . elementAt ( i ) ; if ( me instanceof KeySignature ) { tuneKey = ( KeySignature ) me ; } else if ( me instanceof PartLabel ) { PartLabel pl = ( PartLabel ) me ; if ( ( tuneKey != null ) && ( partsKey . get ( pl . getLabel ( ) + "" ) == null ) ) { partsKey . put ( pl . getLabel ( ) + "" , tuneKey ) ; } else { tuneKey = ( KeySignature ) partsKey . get ( pl . getLabel ( ) + "" ) ; if ( i < ( size - 1 ) ) { if ( ! ( voice . elementAt ( i + 1 ) instanceof KeySignature ) ) { voice . insertElementAt ( tuneKey , i + 1 ) ; i ++ ; size ++ ; } } } } i ++ ; } } } return music ; }
Be sure each part has it s proper key signature .
5,615
public Optional < PluginsAlertCondition > create ( long policyId , PluginsAlertCondition condition ) { return HTTP . POST ( String . format ( "/v2/alerts_plugins_conditions/policies/%d.json" , policyId ) , condition , PLUGINS_ALERT_CONDITION ) ; }
Creates the given Plugins alert condition .
5,616
public Optional < PluginsAlertCondition > update ( PluginsAlertCondition condition ) { return HTTP . PUT ( String . format ( "/v2/alerts_plugins_conditions/%d.json" , condition . getId ( ) ) , condition , PLUGINS_ALERT_CONDITION ) ; }
Updates the given Plugins alert condition .
5,617
public Collection < Deployment > list ( long applicationId , List < String > queryParams ) { return HTTP . GET ( String . format ( "/v2/applications/%d/deployments.json" , applicationId ) , null , queryParams , DEPLOYMENTS ) . get ( ) ; }
Returns the set of deployments .
5,618
public Optional < Deployment > create ( long applicationId , Deployment deployment ) { return HTTP . POST ( String . format ( "/v2/applications/%d/deployments.json" , applicationId ) , deployment , DEPLOYMENT ) ; }
Creates the given deployment .
5,619
public DeploymentService delete ( long applicationId , long deploymentId ) { HTTP . DELETE ( String . format ( "/v2/applications/%d/deployments/%d.json" , applicationId , deploymentId ) ) ; return this ; }
Deletes the deployment with the given id .
5,620
public void addSource ( String source ) { if ( this . sources == null ) this . sources = new ArrayList < String > ( ) ; this . sources . add ( source ) ; }
Adds the given source to the list of sources for the widget .
5,621
public void addFilter ( String name , String value ) { if ( this . filters == null ) this . filters = new HashMap < String , String > ( ) ; this . filters . put ( name , value ) ; }
Adds the given filter to the list of filters for the widget .
5,622
public static Note getLongestNote ( Note [ ] notes ) { float length = 0 ; float currentNoteLength = 0 ; Note maxNote = null ; for ( int i = 0 ; i < notes . length && maxNote == null ; i ++ ) { currentNoteLength = notes [ i ] . getDuration ( ) ; if ( currentNoteLength > length ) maxNote = notes [ i ] ; } return maxNote ; }
Returns the note with the biggest duration from the given array of notes .
5,623
public static Note [ ] getNotesShorterThan ( Note [ ] notes , int aStrictDuration ) { Vector shorterNotes = new Vector ( ) ; Note [ ] notesArray = null ; for ( Note note : notes ) { if ( note . getStrictDuration ( ) < aStrictDuration ) shorterNotes . addElement ( note ) ; } if ( shorterNotes . size ( ) > 0 ) { notesArray = new Note [ shorterNotes . size ( ) ] ; shorterNotes . toArray ( notesArray ) ; } return notesArray ; }
Returns all notes strictly shorter than the given strict duration .
5,624
public static Note getLowestNote ( Note [ ] notes ) { Note lowestNote = notes [ 0 ] ; for ( int i = 1 ; i < notes . length ; i ++ ) if ( notes [ i ] . isLowerThan ( lowestNote ) ) lowestNote = notes [ i ] ; return lowestNote ; }
Returns the lowest note from the given array of notes .
5,625
public static Note getHighestNote ( Note [ ] notes ) { Note highestNote = notes [ 0 ] ; for ( int i = 1 ; i < notes . length ; i ++ ) if ( notes [ i ] . isHigherThan ( highestNote ) ) highestNote = notes [ i ] ; return highestNote ; }
Returns the highest note from the given array of notes .
5,626
public Note getHighestNote ( ) { Note highestNote = ( Note ) m_notes . elementAt ( 0 ) ; for ( int i = 1 ; i < m_notes . size ( ) ; i ++ ) if ( ( ( Note ) ( m_notes . elementAt ( i ) ) ) . isHigherThan ( highestNote ) ) highestNote = ( Note ) m_notes . elementAt ( i ) ; return highestNote ; }
Returns the highest note among the notes composing this multi note .
5,627
public Note [ ] getNotesBeginningTie ( ) { Vector notesBT = new Vector ( m_notes . size ( ) ) ; for ( int i = 0 ; i < m_notes . size ( ) ; i ++ ) if ( ( ( Note ) m_notes . elementAt ( i ) ) . isBeginningTie ( ) ) notesBT . addElement ( m_notes . elementAt ( i ) ) ; if ( notesBT . size ( ) > 0 ) { Note [ ] notesBTasArray = new Note [ notesBT . size ( ) ] ; notesBT . toArray ( notesBTasArray ) ; return notesBTasArray ; } else return null ; }
Returns the notes from this multinote that begin a tie .
5,628
public short [ ] getStrictDurations ( ) { Vector durations = new Vector ( ) ; short currentDuration = 0 ; for ( int i = 0 ; i < m_notes . size ( ) ; i ++ ) { currentDuration = ( ( Note ) ( m_notes . elementAt ( i ) ) ) . getStrictDuration ( ) ; if ( durations . indexOf ( new Short ( currentDuration ) ) == - 1 ) durations . addElement ( currentDuration ) ; } if ( durations . size ( ) == 0 ) return null ; else { Vector sortedDurations = new Vector ( ) ; for ( int i = 0 ; i < durations . size ( ) ; i ++ ) { int j = 0 ; while ( j < sortedDurations . size ( ) && ( Short ) sortedDurations . elementAt ( j ) < ( ( Short ) durations . elementAt ( i ) ) ) j ++ ; sortedDurations . insertElementAt ( durations . elementAt ( i ) , j ) ; } short [ ] durationsAsArray = new short [ sortedDurations . size ( ) ] ; for ( int i = 0 ; i < sortedDurations . size ( ) ; i ++ ) durationsAsArray [ i ] = ( Short ) sortedDurations . elementAt ( i ) ; return durationsAsArray ; } }
Returns the strict durations composing this multi notes .
5,629
public MultiNote [ ] normalize ( ) { Hashtable splitter = new Hashtable ( ) ; for ( int i = 0 ; i < m_notes . size ( ) ; i ++ ) { Note note = ( Note ) m_notes . elementAt ( i ) ; Short key = note . getStrictDuration ( ) ; if ( splitter . containsKey ( key ) ) ( ( Vector ) splitter . get ( key ) ) . addElement ( note ) ; else { Vector v = new Vector ( ) ; v . addElement ( note ) ; splitter . put ( key , v ) ; } } short [ ] strictDurations = getStrictDurations ( ) ; MultiNote [ ] normalizedChords = new MultiNote [ strictDurations . length ] ; for ( int i = 0 ; i < strictDurations . length ; i ++ ) { normalizedChords [ i ] = new MultiNote ( ( Vector ) splitter . get ( new Short ( strictDurations [ i ] ) ) ) ; } return normalizedChords ; }
Normalizes this multi note by decomposing it into multinotes with same strict duration .
5,630
public Note [ ] toArray ( ) { if ( m_notes . size ( ) > 0 ) { Note [ ] notes = new Note [ m_notes . size ( ) ] ; return ( Note [ ] ) m_notes . toArray ( notes ) ; } else return null ; }
Returns notes composing this multinote as an array of notes sorted from the lowest note to the highest one .
5,631
public Optional < NrqlAlertCondition > create ( long policyId , NrqlAlertCondition condition ) { return HTTP . POST ( String . format ( "/v2/alerts_nrql_conditions/policies/%d.json" , policyId ) , condition , NRQL_ALERT_CONDITION ) ; }
Creates the given NRQL alert condition .
5,632
public Optional < NrqlAlertCondition > update ( NrqlAlertCondition condition ) { return HTTP . PUT ( String . format ( "/v2/alerts_nrql_conditions/%d.json" , condition . getId ( ) ) , condition , NRQL_ALERT_CONDITION ) ; }
Updates the given NRQL alert condition .
5,633
public Part [ ] toPartsArray ( ) { Vector parts = getPartsAsRepeatedOnceVector ( ) ; Part [ ] partsArray = new Part [ parts . size ( ) ] ; for ( int i = 0 ; i < parts . size ( ) ; i ++ ) partsArray [ i ] = ( Part ) parts . elementAt ( i ) ; return partsArray ; }
Returns this multipart as an array of singles parts . The playing of the multi part would sound the same as the playing of the array of parts .
5,634
public Collection < User > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/users.json" , null , queryParams , USERS ) . get ( ) ; }
Returns the set of users with the given query parameters .
5,635
public Optional < User > show ( long userId ) { return HTTP . GET ( String . format ( "/v2/users/%d.json" , userId ) , USER ) ; }
Returns the user for the given user id .
5,636
public Optional < User > resetPassword ( long userId ) { return HTTP . POST ( String . format ( "/v2/users/%d/reset_password.json" , userId ) , null , USER ) ; }
Resets the password for the given user .
5,637
public Note getStringNote ( int stringNumber ) { if ( stringNumber > 0 && stringNumber <= m_strings . length ) { return m_strings [ stringNumber - 1 ] ; } else return null ; }
Returns the Note for the request string
5,638
public void computeFingerings ( Collection musicElements ) { if ( computedFingerings != null ) computedFingerings . clear ( ) ; Collection notes = new ArrayList ( musicElements . size ( ) ) ; Iterator it = musicElements . iterator ( ) ; while ( it . hasNext ( ) ) { MusicElement element = ( MusicElement ) it . next ( ) ; if ( element instanceof NoteAbstract ) { NoteAbstract [ ] graces = ( ( NoteAbstract ) element ) . getGracingNotes ( ) ; if ( graces != null ) { Collections . addAll ( notes , graces ) ; } notes . add ( element ) ; } } computedFingerings = new HashMap ( notes . size ( ) ) ; it = notes . iterator ( ) ; NoteAbstract lastNote = null ; while ( it . hasNext ( ) ) { NoteAbstract currentNote = ( NoteAbstract ) it . next ( ) ; if ( currentNote instanceof MultiNote ) { for ( Object o : ( ( ( MultiNote ) currentNote ) . getNotesAsVector ( ) ) ) { Note note = ( Note ) o ; if ( note . isRest ( ) || note . isEndingTie ( ) ) continue ; int string = 1 + ( int ) ( Math . random ( ) * ( m_strings . length - 1 ) ) ; int fret = ( int ) ( Math . random ( ) * m_numberOfFret ) ; computedFingerings . put ( note . getReference ( ) , new int [ ] { string , fret } ) ; } } else if ( currentNote instanceof Note ) { Note note = ( Note ) currentNote ; if ( ! note . isEndingTie ( ) ) { int [ ] pos = null ; if ( note . isRest ( ) ) { } else if ( ( lastNote != null ) && ( lastNote instanceof Note ) && ( note . getMidiLikeHeight ( ) == ( ( Note ) lastNote ) . getMidiLikeHeight ( ) ) && ( ( pos = getFingeringForNote ( ( Note ) lastNote ) ) != null ) ) { computedFingerings . put ( note . getReference ( ) , new int [ ] { pos [ 0 ] , pos [ 1 ] } ) ; } else { int string = 1 + ( int ) Math . round ( Math . random ( ) * ( m_strings . length - 1 ) ) ; int fret = ( int ) ( Math . random ( ) * m_numberOfFret ) ; computedFingerings . put ( note . getReference ( ) , new int [ ] { string , fret } ) ; } } } lastNote = currentNote ; } }
Here is the brain of tablature fingerings computation .
5,639
public Collection < PartnerUser > list ( long partnerId , long accountId ) { return HTTP . GET ( String . format ( "/v2/partners/%d/accounts/%d/users" , partnerId , accountId ) , PARTNER_USERS ) . get ( ) ; }
Returns the set of users .
5,640
public Optional < PartnerUser > create ( long partnerId , long accountId , PartnerUser user ) { return Optional . of ( HTTP . POST ( String . format ( "/v2/partners/%d/accounts/%d/users" , partnerId , accountId ) , user , PARTNER_USERS ) . get ( ) . iterator ( ) . next ( ) ) ; }
Creates the given user .
5,641
public Optional < PartnerUser > update ( long partnerId , long accountId , PartnerUser user ) { return Optional . of ( HTTP . PUT ( String . format ( "/v2/partners/%d/accounts/%d/users" , partnerId , accountId ) , user , PARTNER_USERS ) . get ( ) . iterator ( ) . next ( ) ) ; }
Updates the given user .
5,642
public PartnerUserService delete ( long partnerId , long accountId , long userId ) { HTTP . DELETE ( String . format ( "/v2/partners/%d/accounts/%d/users/%d" , partnerId , accountId , userId ) ) ; return this ; }
Deletes the user with the given id .
5,643
private void applyStemmingPolicy ( JScoreElementAbstract element ) { if ( element != null && element instanceof JStemmableElement ) { JStemmableElement stemmable = ( JStemmableElement ) element ; if ( stemmable . isFollowingStemmingPolicy ( ) ) { byte noteStemPolicy = ( byte ) getTemplate ( ) . getAttributeNumber ( ScoreAttribute . NOTE_STEM_POLICY ) ; if ( noteStemPolicy == STEMS_AUTO ) { stemmable . setAutoStem ( true ) ; } else { boolean isup = ( noteStemPolicy == STEMS_UP ) ; stemmable . setAutoStem ( false ) ; stemmable . setStemUp ( isup ) ; } } int count = currentStaffLine . countElement ( ) ; if ( stemmable . isStemUp ( ) && ( count >= 2 ) ) { Vector staffElements = currentStaffLine . getStaffElements ( ) ; JScoreElement N1 = ( JScoreElement ) staffElements . get ( count - 2 ) ; JScoreElement N2 = ( JScoreElement ) staffElements . get ( count - 3 ) ; if ( ( N1 instanceof JStemmableElement ) && ( N1 instanceof JNote ) && ( ( ( JStemmableElement ) N1 ) . isFollowingStemmingPolicy ( ) ) && ( N2 instanceof JStemmableElement ) && ! ( ( JStemmableElement ) N1 ) . isStemUp ( ) && ( ( JStemmableElement ) N2 ) . isStemUp ( ) ) { Note n = ( Note ) N1 . getMusicElement ( ) ; if ( n . getHeight ( ) == ( ( JNote ) N1 ) . getClef ( ) . getMiddleNote ( ) . getHeight ( ) ) { ( ( JStemmableElement ) N1 ) . setAutoStem ( false ) ; ( ( JStemmableElement ) N1 ) . setStemUp ( true ) ; } } } byte gracenoteStemPolicy = ( byte ) getTemplate ( ) . getAttributeNumber ( ScoreAttribute . GRACENOTE_STEM_POLICY ) ; if ( element instanceof JNoteElementAbstract ) { JNoteElementAbstract jnea = ( JNoteElementAbstract ) element ; if ( ( jnea . m_jGracenotes != null ) && ( jnea . m_jGracenotes instanceof JStemmableElement ) ) { JStemmableElement stemmableGN = ( JStemmableElement ) jnea . m_jGracenotes ; if ( gracenoteStemPolicy == STEMS_AUTO ) { stemmableGN . setAutoStem ( true ) ; } else { boolean isup = ( gracenoteStemPolicy == STEMS_UP ) ; stemmableGN . setAutoStem ( false ) ; stemmableGN . setStemUp ( isup ) ; } } } else if ( element instanceof JGroupOfNotes ) { JGroupOfNotes jgon = ( JGroupOfNotes ) element ; for ( int i = 0 ; i < jgon . m_jNotes . length ; i ++ ) { JNoteElementAbstract jnea = ( JNoteElementAbstract ) jgon . m_jNotes [ i ] ; if ( jnea . m_jGracenotes != null ) { JStemmableElement stemmableGN = ( JStemmableElement ) jnea . m_jGracenotes ; if ( gracenoteStemPolicy == STEMS_AUTO ) { stemmableGN . setAutoStem ( true ) ; } else { boolean isup = ( gracenoteStemPolicy == STEMS_UP ) ; stemmableGN . setAutoStem ( false ) ; stemmableGN . setStemUp ( isup ) ; } } } } } }
apply stemming policy to an element
5,644
private void justify ( ) { if ( m_staffLines . size ( ) > 1 ) { double maxWidth = ( ( JStaffLine ) m_staffLines . elementAt ( 0 ) ) . getWidth ( ) ; for ( int i = 1 ; i < m_staffLines . size ( ) ; i ++ ) { JStaffLine currentStaffLine = ( JStaffLine ) m_staffLines . elementAt ( i ) ; maxWidth = Math . max ( maxWidth , currentStaffLine . getWidth ( ) ) ; } for ( int i = 0 ; i < m_staffLines . size ( ) ; i ++ ) { JStaffLine currentStaffLine = ( JStaffLine ) m_staffLines . elementAt ( i ) ; if ( currentStaffLine . getWidth ( ) > maxWidth / 2 ) currentStaffLine . scaleToWidth ( maxWidth ) ; } } }
Triggers the re computation of all staff lines elements in order to get the alignment justified .
5,645
private JNoteElementAbstract getHighestNoteGlyphBetween ( NoteAbstract start , NoteAbstract end , boolean excludeStartAndEnd ) { Collection jnotes = getNoteGlyphesBetween ( start , end ) ; JNoteElementAbstract ret = null ; boolean first = true ; for ( Iterator it = jnotes . iterator ( ) ; it . hasNext ( ) ; ) { JNoteElementAbstract n = ( JNoteElementAbstract ) it . next ( ) ; if ( first && excludeStartAndEnd ) { first = false ; continue ; } if ( ! it . hasNext ( ) && excludeStartAndEnd ) { break ; } if ( ret == null ) ret = n ; else { if ( n . getBoundingBox ( ) . getMinY ( ) < ret . getBoundingBox ( ) . getMinY ( ) ) ret = n ; } } return ret ; }
Return the JNote that have the highest bounding box
5,646
private Collection getNoteGlyphesBetween ( NoteAbstract start , NoteAbstract end ) { Collection jnotes = new Vector ( ) ; try { Collection notes = m_music . getVoice ( start . getReference ( ) . getVoice ( ) ) . getNotesBetween ( start , end ) ; for ( Object note : notes ) { NoteAbstract n = ( NoteAbstract ) note ; jnotes . add ( getRenditionObjectFor ( n ) ) ; } } catch ( Exception e ) { } return jnotes ; }
Returns a Collection of JNote representing the note glyphes between start and end NoteAbstract .
5,647
public void setTuneBook ( AbcTuneBook book ) { m_model . setTuneBook ( book ) ; try { int [ ] numbers = { 0 } ; for ( int i = 0 ; i < numbers . length ; i ++ ) { } } catch ( Exception e ) { e . printStackTrace ( ) ; } }
Sets the tunebook to be displayed in this table .
5,648
public float multipliedBy ( Fraction fraction ) { int newNumerator = numerator * fraction . getNumerator ( ) ; int newDenominator = denominator * fraction . getDenominator ( ) ; return ( newNumerator / newDenominator ) ; }
Returns the float result of the multiplication of this fraction by the specified fraction . This fraction remains unchanged .
5,649
public Collection < Label > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/labels.json" , null , queryParams , LABELS ) . get ( ) ; }
Returns the set of labels .
5,650
public LabelService delete ( String key ) { HTTP . DELETE ( String . format ( "/v2/labels/%s.json" , encode ( key ) ) ) ; return this ; }
Deletes the label with the given key .
5,651
@ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , R > Maybe < R > zipWith ( MaybeSource < ? extends U > other , BiFunction < ? super T , ? super U , ? extends R > zipper ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return zip ( this , other , zipper ) ; }
Waits until this and the other MaybeSource signal a success value then applies the given BiFunction to those values and emits the BiFunction s resulting value to downstream .
5,652
public Optional < AlertCondition > create ( long policyId , AlertCondition condition ) { return HTTP . POST ( String . format ( "/v2/alerts_conditions/policies/%d.json" , policyId ) , condition , ALERT_CONDITION ) ; }
Creates the given alert condition .
5,653
public Optional < AlertCondition > update ( AlertCondition condition ) { return HTTP . PUT ( String . format ( "/v2/alerts_conditions/%d.json" , condition . getId ( ) ) , condition , ALERT_CONDITION ) ; }
Updates the given alert condition .
5,654
public int getSemitones ( ) { int semitones = 0 ; switch ( getLabel ( ) % OCTAVE ) { case UNISON : semitones = 0 ; break ; case SECOND : semitones = 2 ; break ; case THIRD : semitones = 4 ; break ; case FOURTH : semitones = 5 ; break ; case FIFTH : semitones = 7 ; break ; case SIXTH : semitones = 9 ; break ; case SEVENTH : semitones = 11 ; break ; } switch ( getQuality ( ) ) { case QUADRUPLE_DIMINISHED : case TRIPLE_DIMINISHED : case DOUBLE_DIMINISHED : case DIMINISHED : if ( allowPerfectQuality ( ) ) semitones += getQuality ( ) + 1 ; else semitones += getQuality ( ) ; break ; case MINOR : semitones -= 1 ; break ; case PERFECT : case MAJOR : break ; case AUGMENTED : case DOUBLE_AUGMENTED : case TRIPLE_AUGMENTED : case QUADRUPLE_AUGMENTED : semitones += getQuality ( ) - 1 ; break ; } semitones += 12 * getOctaveNumber ( ) ; return semitones ; }
Return the number of semitones between 2 notes spaced by this Interval
5,655
public Collection < AlertPolicy > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/alerts_policies.json" , null , queryParams , ALERT_POLICIES ) . get ( ) ; }
Returns the set of alert policies .
5,656
public Collection < AlertPolicy > list ( String name ) { return list ( filters ( ) . name ( name ) . build ( ) ) ; }
Returns the set of alert policies with the given name .
5,657
public Optional < AlertPolicy > update ( AlertPolicy policy ) { return HTTP . PUT ( String . format ( "/v2/alerts_policies/%d.json" , policy . getId ( ) ) , policy , ALERT_POLICY ) ; }
Updates the given alert policy .
5,658
public < T > void addMetric ( String name , MetricTimeslice < T > timeslice ) { metrics . put ( name , timeslice ) ; }
Adds a metric to the set of metrics .
5,659
public static byte [ ] convertToBarLine ( String barLine ) { byte [ ] barlineTypes = new byte [ ] { SIMPLE } ; if ( barLine . equals ( "::" ) || barLine . equals ( ":|:" ) || barLine . equals ( ":||:" ) ) { barlineTypes = new byte [ ] { CLOSE_AND_OPEN_REPEAT } ; } else if ( barLine . equals ( "|" ) ) { barlineTypes = new byte [ ] { SIMPLE } ; } else if ( barLine . equals ( "||" ) ) { barlineTypes = new byte [ ] { DOUBLE } ; } else if ( barLine . equals ( "[|" ) || barLine . equals ( "[||" ) ) { barlineTypes = new byte [ ] { BEGIN } ; } else if ( barLine . equals ( "|]" ) || barLine . equals ( "||]" ) ) { barlineTypes = new byte [ ] { END } ; } else if ( barLine . equals ( ":|" ) || barLine . equals ( ":||" ) || barLine . equals ( ":|]" ) || barLine . startsWith ( ":::" ) ) { barlineTypes = new byte [ ] { REPEAT_CLOSE } ; } else if ( barLine . equals ( "|:" ) || barLine . equals ( "||:" ) || barLine . equals ( "[|:" ) || barLine . endsWith ( ":::" ) ) { barlineTypes = new byte [ ] { REPEAT_OPEN } ; } else if ( barLine . equals ( "|::" ) || barLine . equals ( "[::" ) ) { barlineTypes = new byte [ ] { DOUBLE_REPEAT_OPEN } ; } else if ( barLine . equals ( "::|" ) || barLine . equals ( "::]" ) ) { barlineTypes = new byte [ ] { DOUBLE_REPEAT_CLOSE } ; } else if ( barLine . equals ( ".|" ) || barLine . equals ( ".|." ) || barLine . equals ( ":" ) ) { barlineTypes = new byte [ ] { DOTTED } ; } else if ( barLine . equals ( "[|]" ) || barLine . equals ( "[]" ) ) { barlineTypes = new byte [ ] { INVISIBLE } ; } else if ( barLine . equals ( "|]|" ) || barLine . equals ( "|||" ) || barLine . equals ( "|[|" ) ) { barlineTypes = new byte [ ] { TRIPLE } ; } return barlineTypes ; }
Converts the specified string to a bar line type .
5,660
public void play ( Tune tune ) throws IllegalStateException { if ( m_isStarted ) { try { m_tune = tune ; Sequence sequence = m_converter . toMidiSequence ( m_tune ) ; seq . setSequence ( sequence ) ; seq . setTempoInBPM ( m_tempo ) ; seq . start ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } else throw new IllegalStateException ( "The player hasn't been started yet !" ) ; }
Plays the given tune .
5,661
public Tune removeTune ( int referenceNumber ) { Tune ret = super . removeTune ( referenceNumber ) ; if ( ret != null ) { notifyListenersForTuneChange ( new TuneChangeEvent ( this , TuneChangeEvent . TUNE_REMOVED , ret ) ) ; } return ret ; }
Removes the tune having the requested reference number from the book
5,662
public void saveTo ( File file ) throws IOException { FileWriter writer = new FileWriter ( file ) ; try { writer . write ( getAbcString ( ) ) ; } finally { writer . close ( ) ; } }
Saves the ABC source String to file .
5,663
public Collection < Server > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/servers.json" , null , queryParams , SERVERS ) . get ( ) ; }
Returns the set of servers with the given query parameters .
5,664
public Collection < Server > list ( String name ) { List < Server > ret = new ArrayList < Server > ( ) ; Collection < Server > servers = list ( ) ; for ( Server server : servers ) { if ( name == null || server . getName ( ) . equals ( name ) ) ret . add ( server ) ; } return ret ; }
Returns the set of servers for the given name .
5,665
public Optional < Server > show ( long serverId ) { return HTTP . GET ( String . format ( "/v2/servers/%d.json" , serverId ) , SERVER ) ; }
Returns the server for the given server id .
5,666
public Optional < Server > update ( Server server ) { return HTTP . PUT ( String . format ( "/v2/servers/%d.json" , server . getId ( ) ) , server , SERVER ) ; }
Updates the given server .
5,667
public double getWidth ( ) { String [ ] lines = getTextLines ( ) ; double max = 0 ; for ( String line : lines ) { max = Math . max ( max , ( double ) getMetrics ( ) . getTextFontWidth ( m_textField , line ) ) ; } return max ; }
Returns the width of this score element .
5,668
public Collection < AlertChannel > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/alerts_channels.json" , null , queryParams , ALERT_CHANNELS ) . get ( ) ; }
Returns the set of alert channels .
5,669
public Collection < AlertChannel > list ( String name ) { List < AlertChannel > ret = new ArrayList < AlertChannel > ( ) ; Collection < AlertChannel > channels = list ( ) ; for ( AlertChannel channel : channels ) { if ( channel . getName ( ) . equals ( name ) ) ret . add ( channel ) ; } return ret ; }
Returns the set of alert channels with the given name .
5,670
public Collection < AlertChannel > list ( long policyId ) { Map < Long , AlertChannel > map = new HashMap < Long , AlertChannel > ( ) ; Collection < AlertChannel > channels = list ( ) ; for ( AlertChannel channel : channels ) { List < Long > channelPolicyIds = channel . getLinks ( ) . getPolicyIds ( ) ; for ( long channelPolicyId : channelPolicyIds ) { if ( channelPolicyId == policyId ) map . put ( channel . getId ( ) , channel ) ; } } return map . values ( ) ; }
Returns the set of alert channels for the given policy id .
5,671
public Optional < AlertChannel > create ( AlertChannel channel ) { return Optional . of ( HTTP . POST ( "/v2/alerts_channels.json" , channel , ALERT_CHANNELS ) . get ( ) . iterator ( ) . next ( ) ) ; }
Creates the given alert channel .
5,672
public String getText ( boolean unicode ) { if ( ! isChord ( ) ) return m_chordName ; else { StringBuilder ret = new StringBuilder ( ) ; if ( isOptional ( ) ) ret . append ( "(" ) ; ret . append ( note2string ( getNote ( ) , unicode ) ) ; ret . append ( getQuality ( ) ) ; if ( hasBass ( ) ) { ret . append ( "/" ) ; ret . append ( note2string ( getBass ( ) , unicode ) ) ; } if ( isOptional ( ) ) ret . append ( ")" ) ; return ret . toString ( ) ; } }
Returns the text of the chord .
5,673
public void writeAsMusicXML ( Tune tune , File file ) throws IOException { BufferedWriter writer = new BufferedWriter ( new FileWriter ( file ) ) ; Document doc = createMusicXmlDOM ( tune ) ; writeAsMusicXML ( doc , writer ) ; writer . flush ( ) ; writer . close ( ) ; }
Writes the specified tune to the specified file as MusicXML .
5,674
public void writeAsMusicXML ( Document doc , BufferedWriter writer ) throws IOException { try { TransformerFactory transfac = TransformerFactory . newInstance ( ) ; Transformer trans = transfac . newTransformer ( ) ; trans . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; trans . setOutputProperty ( OutputKeys . DOCTYPE_PUBLIC , "-//Recordare//DTD MusicXML 2.0 Partwise//EN" ) ; trans . setOutputProperty ( OutputKeys . DOCTYPE_SYSTEM , "http://www.musicxml.org/dtds/partwise.dtd" ) ; StreamResult result = new StreamResult ( writer ) ; DOMSource source = new DOMSource ( doc ) ; trans . transform ( source , result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
Writes the specified Node to the given writer .
5,675
public void addEntityId ( long entityId ) { if ( this . entityIds == null ) this . entityIds = new ArrayList < Long > ( ) ; this . entityIds . add ( entityId ) ; }
Adds the given entity id to the list of entities for the widget .
5,676
public void addMetric ( Metric metric ) { if ( this . metrics == null ) this . metrics = new ArrayList < Metric > ( ) ; this . metrics . add ( metric ) ; }
Adds the given metric to the list of metrics for the widget .
5,677
public Collection < ApplicationHost > list ( long applicationId , List < String > queryParams ) { return HTTP . GET ( String . format ( "/v2/applications/%d/hosts.json" , applicationId ) , null , queryParams , APPLICATION_HOSTS ) . get ( ) ; }
Returns the set of application hosts with the given query parameters .
5,678
public Optional < ApplicationHost > show ( long applicationId , long hostId ) { return HTTP . GET ( String . format ( "/v2/applications/%d/hosts/%d.json" , applicationId , hostId ) , APPLICATION_HOST ) ; }
Returns the application host for the given id .
5,679
public int getHighestReferenceNumber ( ) { int max = - 1 ; for ( Object o : m_tunes . keySet ( ) ) { Integer i = ( Integer ) o ; if ( i > max ) max = i ; } return max ; }
Returns the highest reference number from all the reference numbers this tunebook contains .
5,680
public int [ ] getReferenceNumbers ( ) { Iterator it = m_tunes . keySet ( ) . iterator ( ) ; int [ ] refNb = new int [ m_tunes . size ( ) ] ; int index = 0 ; while ( it . hasNext ( ) ) { refNb [ index ] = ( Integer ) it . next ( ) ; index ++ ; } return refNb ; }
Returns the reference numbers of tunes contained in this tunebook .
5,681
public Tune removeTune ( int referenceNumber ) { Tune ret = getTune ( referenceNumber ) ; if ( ret != null ) { ret . getTuneInfos ( ) . setBookInfos ( null ) ; ret . getInstructions ( ) . removeAll ( getInstructions ( ) ) ; m_tunes . remove ( new Integer ( referenceNumber ) ) ; } return ret ; }
Remove the tune having the requested reference number from the book
5,682
public Collection < KeyTransaction > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/key_transactions.json" , null , queryParams , KEY_TRANSACTIONS ) . get ( ) ; }
Returns the set of key transactions with the given query parameters .
5,683
public Collection < KeyTransaction > list ( String name ) { List < KeyTransaction > ret = new ArrayList < KeyTransaction > ( ) ; Collection < KeyTransaction > transactions = list ( ) ; for ( KeyTransaction transaction : transactions ) { if ( name == null || transaction . getName ( ) . equals ( name ) ) ret . add ( transaction ) ; } return ret ; }
Returns the set of key transactions for the given name .
5,684
public Optional < KeyTransaction > show ( long transactionId ) { return HTTP . GET ( String . format ( "/v2/key_transactions/%d.json" , transactionId ) , KEY_TRANSACTION ) ; }
Returns the key transaction for the given transaction id .
5,685
public Optional < AlertPolicyChannel > update ( long policyId , long channelId ) { QueryParameterList queryParams = new QueryParameterList ( ) ; queryParams . add ( "policy_id" , policyId ) ; queryParams . add ( "channel_ids" , channelId ) ; return HTTP . PUT ( "/v2/alerts_policy_channels.json" , null , null , queryParams , ALERT_POLICY_CHANNEL ) ; }
Adds the given alert channel to the alert policy with the given id .
5,686
public AlertPolicyChannelService delete ( long policyId , long channelId ) { QueryParameterList queryParams = new QueryParameterList ( ) ; queryParams . add ( "policy_id" , policyId ) ; queryParams . add ( "channel_id" , channelId ) ; HTTP . DELETE ( "/v2/alerts_policy_channels.json" , null , queryParams ) ; return this ; }
Deletes the given alert channel from the alert policy with the given id .
5,687
public void setMiddleNote ( Note n ) { byte strictHeight = n . getStrictHeight ( ) ; boolean set = false ; if ( strictHeight == getMiddleNote ( ) . getStrictHeight ( ) ) { set = true ; } else { Clef [ ] toCompare = null ; if ( isG ( ) ) { toCompare = new Clef [ ] { TREBLE , FRENCH_VIOLIN } ; } else if ( isF ( ) ) { toCompare = new Clef [ ] { BASS , BARITONE } ; } else if ( isC ( ) ) { toCompare = new Clef [ ] { SOPRANO , MEZZOSOPRANO , ALTO , TENOR } ; } if ( toCompare != null ) { for ( Clef aToCompare : toCompare ) { if ( strictHeight == aToCompare . getMiddleNote ( ) . getStrictHeight ( ) ) { m_lineNumber = ( byte ) aToCompare . getLineNumber ( ) ; set = true ; break ; } } } if ( isPerc ( ) ) { set = true ; } } if ( set ) { reset ( ) ; m_invisibleOctaveTransp = ( byte ) ( n . getOctaveTransposition ( ) - getMiddleNote ( ) . getOctaveTransposition ( ) ) ; m_middleNote = n ; reset ( ) ; } }
Sets the middle note ( for an internal octave transposition if Note n is compatible with predefined middle note .
5,688
public int getLineNumber ( ) { if ( ( m_lineNumber == - 1 ) && ( getName ( ) != null ) ) { if ( isG ( ) ) m_lineNumber = 2 ; else if ( isF ( ) ) m_lineNumber = 4 ; else if ( isC ( ) ) m_lineNumber = 3 ; else if ( isPerc ( ) ) m_lineNumber = 3 ; } return m_lineNumber ; }
Returns the number of the line staff where clef is printed . 2 for treble 3 for alto 4 for tenor 4 for bass ...
5,689
public void addState ( TrafficLightState state ) { if ( this . states == null ) this . states = new ArrayList < TrafficLightState > ( ) ; this . states . add ( state ) ; }
Adds a state to the traffic light .
5,690
public Collection < AlertCondition > list ( long entityId , String entityType ) { QueryParameterList queryParams = new QueryParameterList ( ) ; queryParams . add ( "entity_type" , entityType ) ; return HTTP . GET ( String . format ( "/v2/alerts_entity_conditions/%d.json" , entityId ) , null , queryParams , ALERT_CONDITIONS ) . get ( ) ; }
Returns the alert conditions for the given entity id .
5,691
public Collection < AlertCondition > list ( Entity entity ) { return list ( entity . getId ( ) , entity . getType ( ) ) ; }
Returns the alert conditions for the given entity .
5,692
protected Rectangle2D getBounds ( char [ ] glyph , int notationContext ) { String key = String . valueOf ( notationContext ) + "-" + String . valueOf ( glyph ) + "-" + getMusicalFont ( ) . getName ( ) ; try { if ( bounds . get ( key ) == null ) { FontRenderContext frc = g2 . getFontRenderContext ( ) ; bounds . put ( key , new TextLayout ( String . valueOf ( glyph ) , getNotationFontForContext ( notationContext ) , frc ) . getBounds ( ) ) ; } return ( Rectangle2D ) ( bounds . get ( key ) ) ; } catch ( RuntimeException e ) { System . err . println ( e . getMessage ( ) + " key=" + key ) ; throw e ; } }
Get the bounds of a glyph in the given notation context
5,693
public Font getNotationFontForContext ( int notationContext ) { try { Font baseNotationFont = ( ( MusicalFont ) getTemplate ( ) . getAttributeObject ( ScoreAttribute . NOTATION_FONT ) ) . getFont ( ) ; switch ( notationContext ) { case NOTATION_CONTEXT_GRACENOTE : return baseNotationFont . deriveFont ( getTemplate ( ) . getAttributeSize ( ScoreAttribute . NOTATION_GRACENOTE_SIZE ) ) ; case NOTATION_CONTEXT_TEMPO : return baseNotationFont . deriveFont ( getTemplate ( ) . getAttributeSize ( ScoreAttribute . NOTATION_TEMPO_SIZE ) ) ; case NOTATION_CONTEXT_NOTE : default : return baseNotationFont . deriveFont ( getTemplate ( ) . getAttributeSize ( ScoreAttribute . NOTATION_SIZE ) ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } }
Return the notation for from the given notation context
5,694
protected int getTextFontHeight ( byte textType ) { FontMetrics fontMetrics = g2 . getFontMetrics ( getTextFont ( textType ) ) ; return fontMetrics . getHeight ( ) ; }
Returns height of one line rendered in the textType font .
5,695
protected int getTextFontWidth ( byte textType , String text ) { if ( text == null ) return 0 ; FontMetrics fontMetrics = g2 . getFontMetrics ( getTextFont ( textType ) ) ; return fontMetrics . stringWidth ( text ) ; }
Returns width of string rendered in the textType font .
5,696
public void setSelectedItem ( PositionableInCharStream elmnt ) { CharStreamPosition pos = null ; if ( elmnt != null ) pos = elmnt . getCharStreamPosition ( ) ; if ( pos != null ) { int begin = pos . getStartIndex ( ) ; int end = pos . getEndIndex ( ) ; try { setCaretPosition ( end ) ; moveCaretPosition ( begin ) ; getCaret ( ) . setSelectionVisible ( true ) ; repaint ( ) ; } catch ( IllegalArgumentException ignored ) { } } }
Highlights the specified element in the abc tune notation .
5,697
public double render ( Graphics2D g ) { Color previousColor = g . getColor ( ) ; setColor ( g , ScoreElements . TABLATURE_LINES ) ; number . setText ( "MM" ) ; double mWidth = number . getWidth ( ) ; double numberOfStrings = m_tablature . getNumberOfString ( ) ; for ( int i = 1 ; i <= numberOfStrings ; i ++ ) { double y = getTextY ( i ) ; number . setText ( m_tablature . getStringNote ( i ) . getName ( ) ) ; number . setBase ( new Point2D . Double ( getBase ( ) . getX ( ) + mWidth / 2 , y ) ) ; number . setTextVerticalAlign ( TextVerticalAlign . BOTTOM ) ; number . setTextJustification ( TextJustification . CENTER ) ; number . render ( g ) ; y = getLineY ( i ) ; g . drawLine ( ( int ) ( getBase ( ) . getX ( ) + mWidth ) , ( int ) y , ( int ) ( getBase ( ) . getX ( ) + width ) , ( int ) y ) ; } g . setColor ( previousColor ) ; return getWidth ( ) ; }
Renders the strings lines avoiding the numbers previously rendered
5,698
public Collection < AlertViolation > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/alerts_violations.json" , null , queryParams , ALERT_VIOLATIONS ) . get ( ) ; }
Returns the set of alert violations with the given query parameters .
5,699
public Collection < AlertViolation > list ( long startDate , long endDate , boolean onlyOpen ) { return list ( filters ( ) . startDate ( startDate ) . endDate ( endDate ) . onlyOpen ( onlyOpen ) . build ( ) ) ; }
Returns the set of alert violations .