idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
5,500 | public Collection < MobileApplication > list ( String name ) { List < MobileApplication > ret = new ArrayList < MobileApplication > ( ) ; Collection < MobileApplication > applications = list ( ) ; for ( MobileApplication application : applications ) { if ( name == null || application . getName ( ) . equals ( name ) ) ret . add ( application ) ; } return ret ; } | Returns the set of Mobile applications for the given name . |
5,501 | public Optional < MobileApplication > show ( long applicationId ) { return HTTP . GET ( String . format ( "/v2/mobile_applications/%d.json" , applicationId ) , MOBILE_APPLICATION ) ; } | Returns the Mobile application for the given application id . |
5,502 | public Collection < Metric > metricNames ( long applicationId , String name ) { QueryParameterList queryParams = new QueryParameterList ( ) ; if ( name != null && name . length ( ) > 0 ) queryParams . add ( "name" , name ) ; return HTTP . GET ( String . format ( "/v2/mobile_applications/%d/metrics.json" , applicationId ) , null , queryParams , METRICS ) . get ( ) ; } | Returns the set of metrics for the given application . |
5,503 | public Optional < MetricData > metricData ( long applicationId , List < String > queryParams ) { return HTTP . GET ( String . format ( "/v2/mobile_applications/%d/metrics/data.json" , applicationId ) , null , queryParams , METRIC_DATA ) ; } | Returns the set of metric data for the given application . |
5,504 | public static String encode ( String str ) { String encodedValue = str ; try { encodedValue = URLEncoder . encode ( encodedValue , "UTF-8" ) ; encodedValue = encodedValue . replace ( "+" , "%20" ) ; } catch ( UnsupportedEncodingException e ) { logger . severe ( "Failed to encode value: " + str ) ; } return encodedValue ; } | Encode special character in query string to the URL encoded representation . |
5,505 | @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concatDelayError ( Iterable < ? extends Publisher < ? extends T > > sources ) { ObjectHelper . requireNonNull ( sources , "sources is null" ) ; return fromIterable ( sources ) . concatMapDelayError ( ( Function ) Functions . identity ( ) ) ; } | Concatenates the Iterable sequence of Publishers into a single sequence by subscribing to each Publisher one after the other one at a time and delays any errors till the all inner Publishers terminate . |
5,506 | @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > retry ( long times , Predicate < ? super Throwable > predicate ) { if ( times < 0 ) { throw new IllegalArgumentException ( "times >= 0 required but it was " + times ) ; } ObjectHelper . requireNonNull ( predicate , "predicate is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableRetryPredicate < T > ( this , times , predicate ) ) ; } | Retries at most times or until the predicate returns false whichever happens first . |
5,507 | public Collection < PartnerSubscription > list ( long partnerId , long accountId ) { return HTTP . GET ( String . format ( "/v2/partners/%d/accounts/%d/subscriptions" , partnerId , accountId ) , PARTNER_SUBSCRIPTIONS ) . get ( ) ; } | Returns the set of subscriptions . |
5,508 | public Optional < PartnerSubscription > show ( long partnerId , long accountId , long subscriptionId ) { return HTTP . GET ( String . format ( "/v2/partners/%d/accounts/%d/subscriptions/%d" , partnerId , accountId , subscriptionId ) , PARTNER_SUBSCRIPTION ) ; } | Returns the subscription with the given id . |
5,509 | public Optional < PartnerSubscription > create ( long partnerId , long accountId , List < ProductSubscription > subscriptions ) { return HTTP . POST ( String . format ( "/v2/partners/%d/accounts/%d/subscriptions" , partnerId , accountId ) , subscriptions , PARTNER_SUBSCRIPTION ) ; } | Raplaces the subscriptions on the account with the given subscriptions . |
5,510 | public Client getClient ( ) { ClientConfig config = new ClientConfig ( ) ; config . register ( GsonMessageBodyHandler . class ) ; Client client = ClientBuilder . newClient ( config ) ; client . property ( HttpUrlConnectorProvider . SET_METHOD_WORKAROUND , true ) ; client . register ( new LicenseKeyFilter ( this . licenseKey ) ) ; if ( logger . isLoggable ( Level . FINE ) ) client . register ( new LoggingFeature ( logger , Level . FINE , LoggingFeature . Verbosity . PAYLOAD_TEXT , 8192 ) ) ; return client ; } | Returns the HTTP client . |
5,511 | public byte getDegree ( int degree ) throws IllegalArgumentException { if ( degree < 1 || degree > 7 ) throw new IllegalArgumentException ( "Degree must be between 1 and 7 (included)" ) ; if ( degree == 1 ) return getNote ( ) ; else { byte [ ] notes = new byte [ ] { Note . C , Note . D , Note . E , Note . F , Note . G , Note . A , Note . B } ; int index = 0 ; for ( int i = 0 ; i < notes . length ; i ++ ) { if ( notes [ i ] == m_keyNote ) { index = i ; break ; } } return notes [ ( index + degree - 1 ) % notes . length ] ; } } | Returns the note of the degree of the mode . |
5,512 | public void setAccidental ( byte noteHeigth , Accidental accidental ) throws IllegalArgumentException { int index = 0 ; noteHeigth = ( byte ) ( noteHeigth % 12 ) ; if ( noteHeigth == Note . C ) index = 0 ; else if ( noteHeigth == Note . D ) index = 1 ; else if ( noteHeigth == Note . E ) index = 2 ; else if ( noteHeigth == Note . F ) index = 3 ; else if ( noteHeigth == Note . G ) index = 4 ; else if ( noteHeigth == Note . A ) index = 5 ; else if ( noteHeigth == Note . B ) index = 6 ; else throw new IllegalArgumentException ( "Invalid note heigth : " + noteHeigth ) ; if ( accidental . isNotDefined ( ) ) accidentals [ index ] = Accidental . NATURAL ; else accidentals [ index ] = accidental ; } | Sets the accidental for the specified note . |
5,513 | public Accidental getAccidentalFor ( byte noteHeigth ) { int index = 0 ; if ( noteHeigth == Note . C ) index = 0 ; else if ( noteHeigth == Note . D ) index = 1 ; else if ( noteHeigth == Note . E ) index = 2 ; else if ( noteHeigth == Note . F ) index = 3 ; else if ( noteHeigth == Note . G ) index = 4 ; else if ( noteHeigth == Note . A ) index = 5 ; else if ( noteHeigth == Note . B ) index = 6 ; else throw new IllegalArgumentException ( "Invalid note heigth : " + noteHeigth ) ; return accidentals [ index ] ; } | Returns accidental for the specified note heigth for this key . |
5,514 | public void setLabel ( String labelValue ) throws IllegalArgumentException { if ( ( labelValue == null ) || ( labelValue . length ( ) == 0 ) ) throw new IllegalArgumentException ( "Part's label can't be null or empty!" ) ; m_label = labelValue ; m_music . setPartLabel ( m_label ) ; } | Sets the label which first char identifies this part . |
5,515 | public Collection < Plugin > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/plugins.json" , null , queryParams , PLUGINS ) . get ( ) ; } | Returns the set of plugins with the given query parameters . |
5,516 | public Collection < Plugin > list ( String name , boolean detailed ) { List < Plugin > ret = new ArrayList < Plugin > ( ) ; Collection < Plugin > plugins = list ( detailed ) ; for ( Plugin plugin : plugins ) { if ( name == null || plugin . getName ( ) . equals ( name ) ) ret . add ( plugin ) ; } return ret ; } | Returns the set of plugins for the given name . |
5,517 | public Optional < Plugin > show ( long pluginId , boolean detailed ) { QueryParameterList queryParams = new QueryParameterList ( ) ; queryParams . add ( "detailed" , Boolean . toString ( detailed ) ) ; return HTTP . GET ( String . format ( "/v2/plugins/%d.json" , pluginId ) , null , queryParams , PLUGIN ) ; } | Returns the plugin for the given plugin id . |
5,518 | public void DELETE ( String partialUrl , Map < String , Object > headers , List < String > queryParams ) { URI uri = buildUri ( partialUrl ) ; executeDeleteRequest ( uri , headers , queryParams ) ; } | Execute a DELETE call against the partial URL . |
5,519 | protected void executePutRequest ( URI uri , Object obj ) { executePutRequest ( uri , obj , null , null ) ; } | Execute a PUT request . |
5,520 | protected < T > Optional < T > executePostRequest ( URI uri , Object obj , GenericType < T > returnType ) { return executePostRequest ( uri , obj , null , returnType ) ; } | Execute a POST request with a return object . |
5,521 | protected void executePatchRequest ( URI uri , Object obj ) { executePatchRequest ( uri , obj , null , null ) ; } | Execute a PATCH request . |
5,522 | protected < T > Optional < T > executePatchRequest ( URI uri , Object obj , Map < String , Object > headers , List < String > queryParams , GenericType < T > returnType ) { WebTarget target = this . client . target ( uri ) ; target = applyQueryParams ( target , queryParams ) ; Invocation . Builder invocation = target . request ( MediaType . APPLICATION_JSON ) ; applyHeaders ( invocation , headers ) ; if ( obj == null ) obj = Entity . text ( "" ) ; Response response = invocation . method ( "PATCH" , Entity . entity ( obj , MediaType . APPLICATION_JSON ) ) ; handleResponseError ( "PATCH" , uri , response ) ; logResponse ( uri , response ) ; return extractEntityFromResponse ( response , returnType ) ; } | Execute a PATCH request with a return object . |
5,523 | protected void executeDeleteRequest ( URI uri , Map < String , Object > headers , List < String > queryParams ) { WebTarget target = this . client . target ( uri ) ; target = applyQueryParams ( target , queryParams ) ; Invocation . Builder invocation = target . request ( MediaType . APPLICATION_JSON ) ; applyHeaders ( invocation , headers ) ; Response response = invocation . delete ( ) ; handleResponseError ( "DELETE" , uri , response ) ; logResponse ( uri , response ) ; } | Execute a DELETE request . |
5,524 | private < T > Optional < T > extractEntityFromResponse ( Response response , GenericType < T > returnType ) { if ( response . hasEntity ( ) && ( response . getStatus ( ) == 200 || response . getStatus ( ) == 201 ) ) return Optional . of ( response . readEntity ( returnType ) ) ; return Optional . absent ( ) ; } | Extract the entity from the HTTP response . |
5,525 | private void applyHeaders ( Invocation . Builder builder , Map < String , Object > headers ) { if ( headers != null ) { for ( Map . Entry < String , Object > e : headers . entrySet ( ) ) { builder . header ( e . getKey ( ) , e . getValue ( ) ) ; } } } | Add the given set of headers to the web target . |
5,526 | private WebTarget applyQueryParams ( WebTarget target , List < String > queryParams ) { if ( queryParams != null ) { for ( int i = 0 ; i < queryParams . size ( ) ; i += 2 ) { target = target . queryParam ( queryParams . get ( i ) , queryParams . get ( i + 1 ) ) ; } } return target ; } | Add the given set of query parameters to the web target . |
5,527 | private void logResponse ( URI uri , Response response ) { if ( logger . isLoggable ( Level . FINE ) ) logger . fine ( uri . toString ( ) + " => " + response . getStatus ( ) ) ; if ( response . getStatus ( ) > 300 ) logger . warning ( response . toString ( ) ) ; } | Log a HTTP error response . |
5,528 | Rule FileField ( ) { return FirstOf ( FieldArea ( ) , FieldBook ( ) , FieldComposer ( ) , FieldDiscography ( ) , FieldFile ( ) , FieldGroup ( ) , FieldHistory ( ) , FieldNotes ( ) , FieldOrigin ( ) , FieldRhythm ( ) , FieldSource ( ) , FieldUserdefPrint ( ) , FieldUserdefPlay ( ) , FieldTranscription ( ) , UnusedField ( ) ) . label ( FileField ) ; } | Default values for the whole file - all fields except number title and voice |
5,529 | Rule FieldLength ( ) { return Sequence ( String ( "L:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , NoteLengthStrict ( ) , HeaderEol ( ) ) . label ( FieldLength ) ; } | Default note length |
5,530 | Rule FieldParts ( ) { return Sequence ( String ( "P:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , PartsPlayOrder ( ) , HeaderEol ( ) ) . label ( FieldParts ) ; } | In header defines in which order parts should be played |
5,531 | Rule FieldWords ( ) { return Sequence ( String ( "W:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , TexText ( ) , HeaderEol ( ) ) . label ( FieldWords ) ; } | Unformatted words printed after the tune |
5,532 | Rule FieldMacro ( ) { return Sequence ( String ( "m:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , OneOrMore ( FirstOf ( WSP ( ) , VCHAR ( ) ) ) . label ( "Macro" ) . suppressSubnodes ( ) , HeaderEol ( ) ) . label ( FieldMacro ) ; } | BarFly - style macros - do be defined better |
5,533 | Rule UnusedField ( ) { return Sequence ( AnyOf ( "EJYabcdefghijklnopqrstvxyz" ) . label ( "UnusedFieldLetter" ) . suppressSubnodes ( ) , String ( ":" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , TexText ( ) , HeaderEol ( ) ) . label ( UnusedField ) ; } | ignore - but for backward and forward compatibility |
5,534 | Rule Minor ( ) { return Sequence ( IgnoreCase ( "m" ) , Optional ( Sequence ( IgnoreCase ( "in" ) , Optional ( Sequence ( IgnoreCase ( "o" ) , Optional ( IgnoreCase ( "r" ) ) ) ) ) ) ) . label ( Minor ) . suppressSubnodes ( ) ; } | m min mino minor - all modes are case insensitive |
5,535 | Rule Lydian ( ) { return Sequence ( IgnoreCase ( "lyd" ) , Optional ( Sequence ( IgnoreCase ( "i" ) , Optional ( Sequence ( IgnoreCase ( "a" ) , Optional ( IgnoreCase ( "n" ) ) ) ) ) ) ) . label ( Lydian ) . suppressSubnodes ( ) ; } | major with sharp 4th |
5,536 | Rule Mixolydian ( ) { return Sequence ( IgnoreCase ( "mix" ) , Optional ( Sequence ( IgnoreCase ( "o" ) , Optional ( Sequence ( IgnoreCase ( "l" ) , Optional ( Sequence ( IgnoreCase ( "y" ) , Optional ( Sequence ( IgnoreCase ( "d" ) , Optional ( Sequence ( IgnoreCase ( "i" ) , Optional ( Sequence ( IgnoreCase ( "a" ) , Optional ( IgnoreCase ( "n" ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . label ( Mixolydian ) . suppressSubnodes ( ) ; } | major with flat 7th |
5,537 | Rule Dorian ( ) { return Sequence ( IgnoreCase ( "dor" ) , Optional ( Sequence ( IgnoreCase ( "i" ) , Optional ( Sequence ( IgnoreCase ( "a" ) , Optional ( IgnoreCase ( "n" ) ) ) ) ) ) ) . label ( Dorian ) . suppressSubnodes ( ) ; } | minor with sharp 6th |
5,538 | Rule Phrygian ( ) { return Sequence ( IgnoreCase ( "phr" ) , Optional ( Sequence ( IgnoreCase ( "y" ) , Optional ( Sequence ( IgnoreCase ( "g" ) , Optional ( Sequence ( IgnoreCase ( "i" ) , Optional ( Sequence ( IgnoreCase ( "a" ) , Optional ( IgnoreCase ( "n" ) ) ) ) ) ) ) ) ) ) ) . label ( Phrygian ) . suppressSubnodes ( ) ; } | minor with flat 2nd |
5,539 | Rule Locrian ( ) { return Sequence ( IgnoreCase ( "loc" ) , Optional ( Sequence ( IgnoreCase ( "r" ) , Optional ( Sequence ( IgnoreCase ( "i" ) , Optional ( Sequence ( IgnoreCase ( "a" ) , Optional ( IgnoreCase ( "n" ) ) ) ) ) ) ) ) ) . label ( Locrian ) . suppressSubnodes ( ) ; } | minor with flat 2nd and 5th |
5,540 | Rule ClefName ( ) { return Sequence ( FirstOfS ( IgnoreCase ( "treble" ) , IgnoreCase ( "alto" ) , IgnoreCase ( "tenor" ) , IgnoreCase ( "baritone" ) , IgnoreCase ( "bass" ) , IgnoreCase ( "mezzo" ) , IgnoreCase ( "soprano" ) , IgnoreCase ( "perc" ) , IgnoreCase ( "none" ) ) , OptionalS ( Octave ( ) ) ) . label ( ClefName ) . suppressSubnodes ( ) ; } | Maybe also Doh1 - 4 Fa1 - 4 |
5,541 | Rule HeaderEol ( ) { return Sequence ( ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , FirstOfS ( Comment ( ) , suppr ( Eol ( ) ) , suppr ( EOI ) ) ) . label ( HeaderEol ) ; } | there may be comments at the end of header lines |
5,542 | Rule GraceNotes ( ) { return Sequence ( String ( "{" ) , OptionalS ( Acciaccatura ( ) ) , ZeroOrMoreS ( GraceNoteStem ( ) ) , String ( "}" ) ) . label ( GraceNotes ) ; } | grace notes can have length |
5,543 | Rule TextExpression ( ) { return Sequence ( OptionalS ( AnyOf ( "^<>_@" ) . label ( Position ) ) , OneOrMore ( NonQuoteOneTextLine ( ) ) . label ( Text ) . suppressSubnodes ( ) ) . label ( TextExpression ) ; } | above left right below anywhere |
5,544 | Rule LatinExtendedAndOtherAlphabet ( ) { return FirstOf ( CharRange ( '\u0080' , '\u074F' ) , CharRange ( '\u0780' , '\u07BF' ) , CharRange ( '\u0900' , '\u137F' ) , CharRange ( '\u13A0' , '\u18AF' ) , CharRange ( '\u1900' , '\u197F' ) , CharRange ( '\u19E0' , '\u19FF' ) , CharRange ( '\u1D00' , '\u1D7F' ) , CharRange ( '\u1E00' , '\u2BFF' ) , CharRange ( '\u2E80' , '\u2FDF' ) , CharRange ( '\u2FF0' , '\u31BF' ) , CharRange ( '\u31F0' , '\uA4CF' ) , CharRange ( '\uAC00' , '\uD7AF' ) , CharRange ( '\uF900' , '\uFE0F' ) , CharRange ( '\uFE20' , '\uFFEF' ) ) . suppressNode ( ) ; } | chars between 0080 and FFEF with exclusions . It contains various alphabets such as latin extended hebrew arabic chinese tamil ... and symbols |
5,545 | public static boolean isTempoMessage ( MetaMessage message ) { return ( message . getType ( ) == MidiMessageType . MARKER && message . getData ( ) [ 0 ] == MidiMessageType . TEMPO_CHANGE ) ; } | Checks the first byte of the data part of the message to check if it is a tempo message or not . |
5,546 | public static boolean isNotationMarker ( MetaMessage message ) { return ( message . getType ( ) == MidiMessageType . MARKER && message . getData ( ) [ 0 ] == MidiMessageType . NOTATION_MARKER ) ; } | Checks the first byte of the data part of the message to check if it is a notation marker message or not . |
5,547 | protected void setTablature ( Tablature tablature ) { if ( tablature != null ) m_tablature = new JTablature ( tablature , getBase ( ) , getMetrics ( ) ) ; else m_tablature = null ; } | attaches a tablature to this staff line |
5,548 | public Collection < Application > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/applications.json" , null , queryParams , APPLICATIONS ) . get ( ) ; } | Returns the set of applications with the given query parameters . |
5,549 | public Collection < Application > list ( String name ) { List < Application > ret = new ArrayList < Application > ( ) ; Collection < Application > applications = list ( ) ; for ( Application application : applications ) { if ( name == null || application . getName ( ) . equals ( name ) ) ret . add ( application ) ; } return ret ; } | Returns the set of applications for the given name . |
5,550 | public Optional < Application > show ( long applicationId ) { return HTTP . GET ( String . format ( "/v2/applications/%d.json" , applicationId ) , APPLICATION ) ; } | Returns the application for the given application id . |
5,551 | public Optional < Application > update ( Application application ) { return HTTP . PUT ( String . format ( "/v2/applications/%d.json" , application . getId ( ) ) , application , APPLICATION ) ; } | Updates the given application . |
5,552 | public List getChildsInAllGenerations ( String label ) { if ( label == null || label . equals ( "" ) ) return new ArrayList ( 0 ) ; List ret = new ArrayList ( ) ; Iterator it = childs . iterator ( ) ; while ( it . hasNext ( ) ) { AbcNode abcn = ( AbcNode ) it . next ( ) ; if ( abcn . getLabel ( ) . equals ( label ) ) { ret . add ( abcn ) ; } else { ret . addAll ( abcn . getChildsInAllGenerations ( label ) ) ; } } return ret ; } | Look for child grandchild grand - grand - child having the requested label . When such one is found doesn t continue search into his own childs . |
5,553 | public List getErrors ( ) { if ( hasChilds ( ) ) { List ret = new ArrayList ( 0 ) ; Iterator it = getChilds ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { ret . addAll ( ( ( AbcNode ) it . next ( ) ) . getErrors ( ) ) ; } return ret ; } else { return errors != null ? errors : new ArrayList ( 0 ) ; } } | Returns a List of errors in all childs grand - childs ... |
5,554 | protected int getIntValue ( ) { if ( label . equals ( AbcTokens . DIGIT ) || label . equals ( AbcTokens . DIGITS ) ) { try { return Integer . parseInt ( value ) ; } catch ( NumberFormatException nfe ) { return - 1 ; } } else return - 1 ; } | Returns the value parsed into integer if label is DIGIT or DIGITS else - 1 . |
5,555 | protected short getShortValue ( ) { if ( label . equals ( AbcTokens . DIGIT ) || label . equals ( AbcTokens . DIGITS ) ) { try { return Short . parseShort ( value ) ; } catch ( NumberFormatException nfe ) { return - 1 ; } } else return - 1 ; } | Returns the value parsed into short if label is DIGIT or DIGITS else - 1 . |
5,556 | public Optional < SyntheticsAlertCondition > create ( long policyId , SyntheticsAlertCondition condition ) { return HTTP . POST ( String . format ( "/v2/alerts_synthetics_conditions/policies/%d.json" , policyId ) , condition , SYNTHETICS_ALERT_CONDITION ) ; } | Creates the given Synthetics alert condition . |
5,557 | public Optional < SyntheticsAlertCondition > update ( SyntheticsAlertCondition condition ) { return HTTP . PUT ( String . format ( "/v2/alerts_synthetics_conditions/%d.json" , condition . getId ( ) ) , condition , SYNTHETICS_ALERT_CONDITION ) ; } | Updates the given Synthetics alert condition . |
5,558 | public void add ( List < T > resources ) { for ( T resource : resources ) { if ( resource . getId ( ) != null ) ids . put ( resource . getId ( ) , resource ) ; if ( resource instanceof NamedResource ) addName ( ( NamedResource ) resource ) ; } } | Adds a list of resources . |
5,559 | public List < T > list ( String str ) { Map < String , T > map = new LinkedHashMap < String , T > ( ) ; if ( str == null || str . length ( ) == 0 ) str = "%" ; String [ ] tokens = str . split ( "," ) ; for ( String token : tokens ) { token = token . trim ( ) ; if ( token . length ( ) > 0 ) { Pattern pattern = Pattern . compile ( token . replace ( "?" , ".?" ) . replace ( "%" , ".*?" ) ) ; for ( NamedResource resource : names . values ( ) ) { if ( pattern . matcher ( resource . getName ( ) ) . matches ( ) ) map . put ( resource . getName ( ) , ( T ) resource ) ; } } } List < T > ret = new ArrayList < T > ( ) ; ret . addAll ( map . values ( ) ) ; return ret ; } | Returns the resources that match the given comma - separated list of names . |
5,560 | public List < T > list ( List < Long > ids ) { List < T > ret = new ArrayList < T > ( ) ; if ( ids != null ) { for ( Long id : ids ) { T resource = get ( id ) ; if ( resource != null ) ret . add ( resource ) ; } } return ret ; } | Returns the resources that match the given ids . |
5,561 | protected JChord createNormalizedChord ( MultiNote mNote , ScoreMetrics mtrx , Point2D base ) { return new JChord ( mNote , getClef ( ) , mtrx , base ) ; } | Invoked when a multi note is decomposed into multi notes with same strict duration . |
5,562 | public void setStaffLine ( JStaffLine staffLine ) { if ( m_normalizedChords != null ) { for ( JChord m_normalizedChord : m_normalizedChords ) { m_normalizedChord . setStaffLine ( staffLine ) ; } } else { for ( JNote m_sNoteInstance : m_sNoteInstances ) { m_sNoteInstance . setStaffLine ( staffLine ) ; } } super . setStaffLine ( staffLine ) ; } | Sets the staff line this chord belongs to . |
5,563 | public void setBase ( Point2D base ) { m_stemYEndForChord = - 1 ; if ( m_normalizedChords != null ) { for ( JChord m_normalizedChord : m_normalizedChords ) { m_normalizedChord . setBase ( base ) ; } } else { for ( JNote m_sNoteInstance : m_sNoteInstances ) { m_sNoteInstance . setBase ( base ) ; } } if ( m_jGracenotes != null ) { m_jGracenotes . setBase ( base ) ; } super . setBase ( base ) ; } | Sets the base of this chord . |
5,564 | public Part getPart ( String partLabel ) { if ( m_parts != null ) { for ( Object m_part : m_parts ) { Part p = ( Part ) m_part ; if ( p . getLabel ( ) . charAt ( 0 ) == partLabel . charAt ( 0 ) ) { if ( partLabel . length ( ) > 1 ) { p . setLabel ( partLabel ) ; } return p ; } } return null ; } else return null ; } | Returns the part of the tune identified by the given label . |
5,565 | public Part createPart ( String partLabel ) { Part part ; if ( ( part = getPart ( partLabel ) ) != null ) return part ; part = new Part ( this , partLabel ) ; if ( m_parts == null ) m_parts = new ArrayList ( ) ; m_parts . add ( part ) ; return part ; } | Creates a new part in this tune if doesn t exist and returns it . |
5,566 | public Music getMusic ( ) { if ( m_multiPartsDef == null ) { if ( m_parts == null ) return ( m_defaultPart . getMusic ( ) ) ; else return getMusicForGraphicalRendition ( ) ; } else { Music globalScore = newMusic ( ) ; globalScore . append ( m_defaultPart . getMusic ( ) ) ; Part [ ] parts = m_multiPartsDef . toPartsArray ( ) ; for ( Part part : parts ) { globalScore . append ( part . getMusic ( ) ) ; } return globalScore ; } } | Returns the music of this tune in a raw form . This is half - way between graphical rendition and audio rendition . |
5,567 | public Collection < InfraAlertCondition > list ( long policyId , int offset , int limit ) { return list ( filters ( ) . policyId ( policyId ) . offset ( offset ) . limit ( limit ) . build ( ) ) ; } | Returns the set of alert conditions for the given policy id . |
5,568 | public Optional < InfraAlertCondition > show ( long conditionId ) { return HTTP . GET ( String . format ( "/v2/alerts/conditions/%d" , conditionId ) , null , null , INFRA_ALERT_CONDITION ) ; } | Returns the infrastructure alert condition with the given id . |
5,569 | public Optional < InfraAlertCondition > update ( InfraAlertCondition condition ) { return HTTP . PUT ( String . format ( "/v2/alerts/conditions/%d" , condition . getId ( ) ) , condition , INFRA_ALERT_CONDITION ) ; } | Updates the given infrastructure alert condition . |
5,570 | public void setValues ( Map < String , Object > values ) { this . values . clear ( ) ; this . values . putAll ( values ) ; } | Sets the list of values . |
5,571 | public void addTrafficLight ( TrafficLight trafficLight ) { if ( this . trafficLights == null ) this . trafficLights = new ArrayList < TrafficLight > ( ) ; this . trafficLights . add ( trafficLight ) ; } | Adds a traffic light to the traffic lights . |
5,572 | protected void adaptToTune ( Tune tune , ScoreMetrics metrics ) { setMode ( m_mode , m_variation ) ; if ( m_mode != NONE ) { double ratio = 100 * ( 11 / metrics . getNotesSpacing ( ) ) - 100 ; int oldVariation = m_variation ; setMode ( m_mode , m_variation - ( int ) ratio ) ; m_variation = oldVariation ; Music music = tune . getMusic ( ) ; Note shortestNote = music . getShortestNoteInAllVoices ( ) ; int shortestDuration = Note . SIXTEENTH ; if ( shortestNote != null ) shortestDuration = shortestNote . getDuration ( ) ; short min = Note . SIXTEENTH ; if ( shortestDuration > min ) { TreeSet set = new TreeSet ( spacesAfter . keySet ( ) ) ; Object [ ] durations = set . toArray ( ) ; int iMin = 0 , iShortest = 0 ; for ( int i = 0 ; i < durations . length ; i ++ ) { int j = ( Integer ) durations [ i ] ; if ( j == min ) iMin = i ; if ( j == shortestDuration ) iShortest = i ; } int offset = ( iShortest > iMin ) ? iShortest - iMin : 0 ; if ( offset != 0 ) { for ( int i = durations . length - 1 ; i >= iShortest ; i -- ) { setSpaceAfter ( ( Integer ) durations [ i ] , getSpaceAfter ( ( Integer ) durations [ i - offset ] ) ) ; } } } } } | Adapt the engraving to the tune i . e . search for the shortest note in the tune . If shortest note is a quarter we can reduce the space between quarter . |
5,573 | private DurationDescription getAbsoluteDurationFor ( Fraction relativeDuration ) throws IllegalArgumentException { int absoluteDuration = - 1 ; byte dotsNumber = 0 ; if ( ! Note . isStrictDuration ( m_defaultNoteLength ) ) throw new IllegalArgumentException ( "Invalid default note duration " + m_defaultNoteLength ) ; absoluteDuration = m_defaultNoteLength * relativeDuration . getNumerator ( ) ; absoluteDuration = absoluteDuration / relativeDuration . getDenominator ( ) ; int remainingDurTmp = 0 ; if ( absoluteDuration >= 2 * Note . LONG ) { throw new IllegalArgumentException ( "Cannot calculate the dots for " + relativeDuration + " with a default duration equals to " + m_defaultNoteLength + " : absolute note length was equal to " + absoluteDuration ) ; } else { short [ ] durs = new short [ ] { Note . LONG , Note . BREVE , Note . WHOLE , Note . HALF , Note . QUARTER , Note . EIGHTH , Note . SIXTEENTH , Note . THIRTY_SECOND , Note . SIXTY_FOURTH } ; for ( int i = 0 ; i < durs . length ; i ++ ) { if ( absoluteDuration >= durs [ i ] ) { remainingDurTmp = absoluteDuration - durs [ i ] ; absoluteDuration = durs [ i ] ; break ; } } } if ( remainingDurTmp != 0 ) { int durationRepresentedByDots = 0 ; int currentDur = absoluteDuration ; while ( durationRepresentedByDots != remainingDurTmp ) { dotsNumber ++ ; currentDur = currentDur / 2 ; durationRepresentedByDots = durationRepresentedByDots + currentDur ; if ( durationRepresentedByDots > remainingDurTmp ) throw new IllegalArgumentException ( "Cannot calculate the dots for " + relativeDuration + " with a default duration equals to " + m_defaultNoteLength + " : absolute note length was equal to " + absoluteDuration ) ; } } return new DurationDescription ( ( short ) absoluteDuration , dotsNumber ) ; } | Returns the absolute note duration for the specified relative note with taking into account the default note length . |
5,574 | protected void initNewTune ( ) { m_brknRthmDotsCorrection = 0 ; m_slursDefinitionStack . clear ( ) ; m_lastParsedNote = null ; m_notesStartingTies . clear ( ) ; m_defaultNoteLength = Note . EIGHTH ; m_timeSignature = null ; m_graceNotes . clear ( ) ; m_graceNotesType = GracingType . APPOGGIATURA ; m_tune = new AbcTune ( ) ; m_music = m_tune . getMusic ( ) ; } | Inits all attributes that are related to one parsing sequence ONLY . |
5,575 | protected AbcTuneBook newAbcTuneBook ( ) { AbcTuneBook ret = new AbcTuneBook ( ) ; for ( int i = 0 ; i < m_listeners . size ( ) ; i ++ ) { Object o = m_listeners . get ( i ) ; if ( o instanceof TuneBookListenerInterface ) ret . addListener ( ( TuneBookListenerInterface ) o ) ; } return ret ; } | Instanciate a new AbcTuneBook and transfere TuneBookListeners to the newly created object |
5,576 | public Rectangle2D getBoundingBox ( ) { Rectangle2D bb = new Rectangle2D . Double ( m_base . getX ( ) , m_base . getY ( ) - 50 , getWidth ( ) , 50 ) ; return bb ; } | Returns the bounding box for this score element . |
5,577 | public JScoreElement getScoreElementAt ( Point location ) { if ( location == null ) return null ; if ( getBoundingBox ( ) . contains ( location ) ) return this ; else { if ( m_jAnnotations != null ) { for ( Object m_jAnnotation : m_jAnnotations ) { JAnnotation ja = ( JAnnotation ) m_jAnnotation ; if ( ja . getBoundingBox ( ) . contains ( location ) ) return ja ; } } if ( m_jChordName != null ) { if ( m_jChordName . getBoundingBox ( ) . contains ( location ) ) return m_jChordName ; } if ( m_jDecorations != null ) { for ( Object m_jDecoration : m_jDecorations ) { JDecoration jd = ( JDecoration ) m_jDecoration ; if ( jd . getBoundingBox ( ) . contains ( location ) ) return jd ; } } if ( m_jDynamic != null ) { if ( m_jDynamic . getBoundingBox ( ) . contains ( location ) ) return m_jDynamic ; } } return null ; } | Returns the score element whose bouding box contains the given location . |
5,578 | protected void addDecoration ( JDecoration decoration ) { if ( m_jDecorations == null ) { m_jDecorations = new Vector ( ) ; } if ( ! m_jDecorations . contains ( decoration ) ) { decoration . setStaffLine ( getStaffLine ( ) ) ; m_jDecorations . add ( decoration ) ; } } | Add decoration if it hasn t been added previously |
5,579 | protected void setColor ( Graphics2D g2 , byte scoreElement ) { if ( m_color != null ) g2 . setColor ( m_color ) ; else { Color c = getTemplate ( ) . getElementColor ( scoreElement ) ; Color d = getTemplate ( ) . getElementColor ( ScoreElements . _DEFAULT ) ; if ( ( c != null ) && ! c . equals ( d ) ) g2 . setColor ( c ) ; } } | Set the color for renderer get color value in the score template or apply the specified color for the current element . |
5,580 | protected void renderDebugBoundingBox ( Graphics2D context ) { java . awt . Color previousColor = context . getColor ( ) ; context . setColor ( java . awt . Color . RED ) ; context . draw ( getBoundingBox ( ) ) ; context . setColor ( previousColor ) ; } | For debugging purpose draw the bounding box of the element |
5,581 | protected void renderDebugBoundingBoxOuter ( Graphics2D context ) { java . awt . Color previousColor = context . getColor ( ) ; context . setColor ( java . awt . Color . RED ) ; Rectangle2D bb = getBoundingBox ( ) ; bb . setRect ( bb . getX ( ) - 1 , bb . getY ( ) - 1 , bb . getWidth ( ) + 2 , bb . getHeight ( ) + 2 ) ; context . draw ( bb ) ; context . setColor ( previousColor ) ; } | For debugging purpose draw the outer of bounding box of the element |
5,582 | public Collection < Dashboard > list ( List < String > queryParams ) { return HTTP . GET ( "/v2/dashboards.json" , null , queryParams , DASHBOARDS ) . get ( ) ; } | Returns the set of dashboards with the given query parameters . |
5,583 | public Collection < Dashboard > list ( String title ) { return list ( filters ( ) . title ( title ) . build ( ) ) ; } | Returns the set of dashboards for the given title . |
5,584 | public Optional < Dashboard > show ( long dashboardId ) { return HTTP . GET ( String . format ( "/v2/dashboards/%d.json" , dashboardId ) , DASHBOARD ) ; } | Returns the dashboard with the given id . |
5,585 | public Optional < Dashboard > update ( Dashboard dashboard ) { return HTTP . PUT ( String . format ( "/v2/dashboards/%d.json" , dashboard . getId ( ) ) , dashboard , DASHBOARD ) ; } | Updates the given dashboard . |
5,586 | public long [ ] getChannelIdArray ( ) { long [ ] ret = new long [ channelIds . size ( ) ] ; for ( int i = 0 ; i < channelIds . size ( ) ; i ++ ) ret [ i ] = channelIds . get ( i ) ; return ret ; } | Returns the array of channel ids for the policy . |
5,587 | protected void valuateNoteChars ( ) { short noteDuration = note . getStrictDuration ( ) ; if ( note . isRest ( ) ) { noteChars = new char [ ] { getMusicalFont ( ) . getRestChar ( noteDuration ) } ; } else { if ( isStemUp ( ) ) noteChars = new char [ ] { getMusicalFont ( ) . getNoteStemUpChar ( noteDuration ) } ; else noteChars = new char [ ] { getMusicalFont ( ) . getNoteStemDownChar ( noteDuration ) } ; } } | Sets the Unicode value of the note as a char array . |
5,588 | public void setStemBeginPosition ( Point2D newStemBeginPos ) { double xDelta = newStemBeginPos . getX ( ) - getStemBeginPosition ( ) . getX ( ) ; double yDelta = newStemBeginPos . getY ( ) - getStemBeginPosition ( ) . getY ( ) ; Point2D newBase = new Point2D . Double ( getBase ( ) . getX ( ) + xDelta , getBase ( ) . getY ( ) + yDelta ) ; setBase ( newBase ) ; } | Moves the note to a new position in order to set the new stem begin position to the new location . |
5,589 | public short getDefaultNoteLength ( ) { short currentNoteLength ; if ( this . floatValue ( ) < 0.75 ) currentNoteLength = Note . SIXTEENTH ; else currentNoteLength = Note . EIGHTH ; return currentNoteLength ; } | Returns the default note length for this time signature . |
5,590 | public Collection < ApplicationInstance > list ( long applicationId , List < String > queryParams ) { return HTTP . GET ( String . format ( "/v2/applications/%d/instances.json" , applicationId ) , null , queryParams , APPLICATION_INSTANCES ) . get ( ) ; } | Returns the set of application instances with the given query parameters . |
5,591 | public Optional < ApplicationInstance > show ( long applicationId , long instanceId ) { return HTTP . GET ( String . format ( "/v2/applications/%d/instances/%d.json" , applicationId , instanceId ) , APPLICATION_INSTANCE ) ; } | Returns the application instance for the given id . |
5,592 | public KeySignature getKey ( ) { for ( int i = 0 , j = size ( ) ; i < j ; i ++ ) { if ( elementAt ( i ) instanceof KeySignature ) return ( KeySignature ) elementAt ( i ) ; } return new KeySignature ( Note . C , KeySignature . MAJOR ) ; } | Returns the key signature of this tune . |
5,593 | public NoteAbstract getLastNote ( ) { if ( lastNote == null ) { for ( int i = super . size ( ) - 1 ; i >= 0 ; i -- ) { if ( super . elementAt ( i ) instanceof NoteAbstract ) { lastNote = ( NoteAbstract ) super . elementAt ( i ) ; break ; } } } return lastNote ; } | Returns the last note that has been added to this score . |
5,594 | public MidiEvent [ ] getMidiEventsFor ( Tuplet tuplet , KeySignature key , long elapsedTime ) throws InvalidMidiDataException { float totalTupletLength = tuplet . getTotalRelativeLength ( ) ; Vector tupletAsVector = tuplet . getNotesAsVector ( ) ; int notesNb = tupletAsVector . size ( ) ; MidiEvent [ ] events = new MidiEvent [ 3 * notesNb ] ; for ( int j = 0 ; j < tupletAsVector . size ( ) ; j ++ ) { Note note = null ; note = ( Note ) ( tupletAsVector . elementAt ( j ) ) ; long noteLength = getNoteLengthInTicks ( note ) ; noteLength = ( long ) ( noteLength * totalTupletLength / notesNb ) ; if ( ! note . isRest ( ) ) { ShortMessage myNoteOn = new ShortMessage ( ) ; myNoteOn . setMessage ( ShortMessage . NOTE_ON , getMidiNoteNumber ( note , key ) , 50 ) ; events [ 3 * j ] = new MidiEvent ( myNoteOn , elapsedTime ) ; events [ 3 * j + 1 ] = new MidiEvent ( new NotationMarkerMessage ( ( Note ) note ) , elapsedTime ) ; ShortMessage myNoteOff = new ShortMessage ( ) ; myNoteOff . setMessage ( ShortMessage . NOTE_OFF , getMidiNoteNumber ( note , key ) , 50 ) ; elapsedTime += noteLength ; events [ 3 * j + 2 ] = new MidiEvent ( myNoteOff , elapsedTime ) ; } } return events ; } | Returns the corresponding midi events for a tuplet . |
5,595 | public MidiEvent [ ] getMidiEventsFor ( Tempo tempo , long lastPosInTicks ) throws InvalidMidiDataException { TempoMessage mt = new TempoMessage ( tempo ) ; MidiEvent me = new MidiEvent ( mt , lastPosInTicks ) ; MidiEvent [ ] events = null ; return events ; } | Returns the corresponding midi events for a tempo change . |
5,596 | public MidiEvent [ ] getMidiEventsFor ( MultiNote notes , KeySignature key , long elapsedTime ) throws InvalidMidiDataException { Vector notesVector = notes . getNotesAsVector ( ) ; MidiEvent [ ] events = new MidiEvent [ 2 * notesVector . size ( ) + 1 ] ; for ( int j = 0 ; j < notesVector . size ( ) ; j ++ ) { Note note = ( Note ) ( notesVector . elementAt ( j ) ) ; float noteLength = getNoteLengthInTicks ( note ) ; if ( ! note . isRest ( ) ) { ShortMessage myNoteOn = new ShortMessage ( ) ; myNoteOn . setMessage ( ShortMessage . NOTE_ON , getMidiNoteNumber ( note , key ) , 50 ) ; events [ j ] = new MidiEvent ( myNoteOn , elapsedTime ) ; } } events [ notesVector . size ( ) ] = new MidiEvent ( new NotationMarkerMessage ( ( MultiNote ) notes ) , elapsedTime ) ; for ( int j = 0 ; j < notesVector . size ( ) ; j ++ ) { Note note = ( Note ) ( notesVector . elementAt ( j ) ) ; long noteLength = getNoteLengthInTicks ( note ) ; if ( ! note . isRest ( ) ) { ShortMessage myNoteOff = new ShortMessage ( ) ; myNoteOff . setMessage ( ShortMessage . NOTE_OFF , getMidiNoteNumber ( note , key ) , 50 ) ; events [ notesVector . size ( ) + j + 1 ] = new MidiEvent ( myNoteOff , elapsedTime + noteLength ) ; } } return events ; } | Returns the corresponding midi events for a multi note . |
5,597 | public void filter ( ClientRequestContext request ) throws IOException { if ( ! request . getHeaders ( ) . containsKey ( "X-Query-Key" ) ) request . getHeaders ( ) . add ( "X-Query-Key" , this . querykey ) ; } | Adds the Query key to the client request . |
5,598 | public void filter ( ClientRequestContext request ) throws IOException { if ( ! request . getHeaders ( ) . containsKey ( "X-Api-Key" ) ) request . getHeaders ( ) . add ( "X-Api-Key" , this . apikey ) ; } | Adds the API key to the client request . |
5,599 | public void setSize ( float size ) { System . err . println ( "Warning! deprecated method setSize" ) ; getTemplate ( ) . setAttributeSize ( ScoreAttribute . NOTATION_SIZE , size , SizeUnit . PT ) ; } | The size of the font used to display the music score . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.