id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
10,200
|
intendia-oss/rxjava-gwt
|
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
|
Flowable.concatDelayError
|
@SuppressWarnings({ "unchecked", "rawtypes" })
@CheckReturnValue
@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());
}
|
java
|
@SuppressWarnings({ "unchecked", "rawtypes" })
@CheckReturnValue
@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());
}
|
[
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"CheckReturnValue",
"@",
"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.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream. Both the outer and inner {@code Publisher}
sources are expected to honor backpressure as well. If the outer violates this, a
{@code MissingBackpressureException} is signaled. If any of the inner {@code Publisher}s violates
this, it <em>may</em> throw an {@code IllegalStateException} when an inner {@code Publisher} completes.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code concatDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <T> the common element base type
@param sources the Iterable sequence of Publishers
@return the new Publisher with the concatenating behavior
|
[
"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",
"."
] |
8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa
|
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L1565-L1572
|
10,201
|
intendia-oss/rxjava-gwt
|
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
|
Flowable.retry
|
@CheckReturnValue
@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));
}
|
java
|
@CheckReturnValue
@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));
}
|
[
"@",
"CheckReturnValue",
"@",
"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.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param times the number of times to repeat
@param predicate the predicate called with the failure Throwable and should return true to trigger a retry.
@return the new Flowable instance
|
[
"Retries",
"at",
"most",
"times",
"or",
"until",
"the",
"predicate",
"returns",
"false",
"whichever",
"happens",
"first",
"."
] |
8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa
|
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L13099-L13109
|
10,202
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerSubscriptionService.java
|
PartnerSubscriptionService.list
|
public Collection<PartnerSubscription> list(long partnerId, long accountId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts/%d/subscriptions", partnerId, accountId), PARTNER_SUBSCRIPTIONS).get();
}
|
java
|
public Collection<PartnerSubscription> list(long partnerId, long accountId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts/%d/subscriptions", partnerId, accountId), PARTNER_SUBSCRIPTIONS).get();
}
|
[
"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.
@param partnerId The id of the partner for the subscriptions
@param accountId The id of the account for the subscriptions
@return The set of subscriptions
|
[
"Returns",
"the",
"set",
"of",
"subscriptions",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerSubscriptionService.java#L49-L52
|
10,203
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerSubscriptionService.java
|
PartnerSubscriptionService.show
|
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);
}
|
java
|
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);
}
|
[
"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.
@param partnerId The id of the partner the subscription belongs to
@param accountId The id of the account for the subscription
@param subscriptionId The id of the subscription to return
@return The subscription
|
[
"Returns",
"the",
"subscription",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerSubscriptionService.java#L61-L64
|
10,204
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerSubscriptionService.java
|
PartnerSubscriptionService.create
|
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);
}
|
java
|
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);
}
|
[
"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.
@param partnerId The id of the partner the subscriptions belongs to
@param accountId The id of the account for the subscriptions
@param subscriptions The subscriptions to create
@return The subscription that was created
|
[
"Raplaces",
"the",
"subscriptions",
"on",
"the",
"account",
"with",
"the",
"given",
"subscriptions",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerSubscriptionService.java#L73-L76
|
10,205
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/httpclient/LicenseKeyHttpClientProvider.java
|
LicenseKeyHttpClientProvider.getClient
|
@Override
public Client getClient()
{
ClientConfig config = new ClientConfig();
config.register(GsonMessageBodyHandler.class);
Client client = ClientBuilder.newClient(config);
client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // To support PATCH method
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;
}
|
java
|
@Override
public Client getClient()
{
ClientConfig config = new ClientConfig();
config.register(GsonMessageBodyHandler.class);
Client client = ClientBuilder.newClient(config);
client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // To support PATCH method
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;
}
|
[
"@",
"Override",
"public",
"Client",
"getClient",
"(",
")",
"{",
"ClientConfig",
"config",
"=",
"new",
"ClientConfig",
"(",
")",
";",
"config",
".",
"register",
"(",
"GsonMessageBodyHandler",
".",
"class",
")",
";",
"Client",
"client",
"=",
"ClientBuilder",
".",
"newClient",
"(",
"config",
")",
";",
"client",
".",
"property",
"(",
"HttpUrlConnectorProvider",
".",
"SET_METHOD_WORKAROUND",
",",
"true",
")",
";",
"// To support PATCH method",
"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.
@return The HTTP client
|
[
"Returns",
"the",
"HTTP",
"client",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/httpclient/LicenseKeyHttpClientProvider.java#L63-L74
|
10,206
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/KeySignature.java
|
KeySignature.getDegree
|
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];
}
}
|
java
|
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];
}
}
|
[
"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.
@param degree
between 1 and 7, included. getDegree(1) is equivalent to
{@link #getNote()}.
@return Possible values are <TT>Note.A</TT>, <TT>Note.B</TT>, <TT>Note.C</TT>,
<TT>Note.D</TT>, <TT>Note.E</TT>, <TT>Note.F</TT> or <TT>Note.G</TT>.
@throws IllegalArgumentException
if degree is <1 or >7
|
[
"Returns",
"the",
"note",
"of",
"the",
"degree",
"of",
"the",
"mode",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/KeySignature.java#L249-L267
|
10,207
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/KeySignature.java
|
KeySignature.setAccidental
|
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;
//accept it, because in midi, the key is changed when there
//is an accidental in a bar, using this method
//else if (accidental.isDoubleFlat() || accidental.isDoubleSharp())
// throw new IllegalArgumentException("Accidental can't be DOUBLE_SHARP or DOUBLE_FLAT");
else
accidentals[index] = accidental;
}
|
java
|
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;
//accept it, because in midi, the key is changed when there
//is an accidental in a bar, using this method
//else if (accidental.isDoubleFlat() || accidental.isDoubleSharp())
// throw new IllegalArgumentException("Accidental can't be DOUBLE_SHARP or DOUBLE_FLAT");
else
accidentals[index] = accidental;
}
|
[
"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",
";",
"//accept it, because in midi, the key is changed when there\r",
"//is an accidental in a bar, using this method\r",
"//else if (accidental.isDoubleFlat() || accidental.isDoubleSharp())\r",
"// throw new IllegalArgumentException(\"Accidental can't be DOUBLE_SHARP or DOUBLE_FLAT\");\r",
"else",
"accidentals",
"[",
"index",
"]",
"=",
"accidental",
";",
"}"
] |
Sets the accidental for the specified note.
@param noteHeigth The note heigth. Possible values are,
<TT>Note.A</TT>, <TT>Note.B</TT>, <TT>Note.C</TT>, <TT>Note.D</TT>,
<TT>Note.E</TT>, <TT>Note.F</TT> or <TT>Note.G</TT>.
@param accidental The accidental to be set to the note. Possible values are :
<TT>Accidental.SHARP</TT>, <TT>Accidental.NATURAL</TT>
or <TT>Accidental.FLAT</TT>.
@exception IllegalArgumentException Thrown if an invalid note heigth or
accidental has been given.
|
[
"Sets",
"the",
"accidental",
"for",
"the",
"specified",
"note",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/KeySignature.java#L313-L335
|
10,208
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/KeySignature.java
|
KeySignature.getAccidentalFor
|
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];
}
|
java
|
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];
}
|
[
"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.
@param noteHeigth A note heigth among <TT>Note.C</TT>, <TT>Note.D</TT>,
<TT>Note.E</TT>, <TT>Note.F</TT>, <TT>Note.G</TT>, <TT>Note.A</TT>,
<TT>Note.B</TT>.
@return Accidental value for the specified note heigth. This value can be
<TT>NATURAL</TT>, <TT>FLAT</TT> or <TT>SHARP</TT>.
@exception IllegalArgumentException Thrown if the specified note heigth
is invalid.
|
[
"Returns",
"accidental",
"for",
"the",
"specified",
"note",
"heigth",
"for",
"this",
"key",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/KeySignature.java#L345-L357
|
10,209
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Part.java
|
Part.setLabel
|
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);
}
|
java
|
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);
}
|
[
"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.
@param labelValue
The label that identifies this part.
@throws IllegalArgumentException if label is 0-length
|
[
"Sets",
"the",
"label",
"which",
"first",
"char",
"identifies",
"this",
"part",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Part.java#L48-L54
|
10,210
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PluginService.java
|
PluginService.list
|
public Collection<Plugin> list(List<String> queryParams)
{
return HTTP.GET("/v2/plugins.json", null, queryParams, PLUGINS).get();
}
|
java
|
public Collection<Plugin> list(List<String> queryParams)
{
return HTTP.GET("/v2/plugins.json", null, queryParams, PLUGINS).get();
}
|
[
"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.
@param queryParams The query parameters
@return The set of plugins
|
[
"Returns",
"the",
"set",
"of",
"plugins",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PluginService.java#L49-L52
|
10,211
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PluginService.java
|
PluginService.list
|
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;
}
|
java
|
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;
}
|
[
"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.
@param name The name of the plugins
@param detailed <CODE>true</CODE> if the details of the plugin should be included
@return The set of plugins
|
[
"Returns",
"the",
"set",
"of",
"plugins",
"for",
"the",
"given",
"name",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PluginService.java#L70-L80
|
10,212
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PluginService.java
|
PluginService.show
|
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);
}
|
java
|
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);
}
|
[
"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.
@param pluginId The id for the plugin to return
@param detailed <CODE>true</CODE> if the details of the plugin should be included
@return The plugin
|
[
"Returns",
"the",
"plugin",
"for",
"the",
"given",
"plugin",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PluginService.java#L88-L93
|
10,213
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.DELETE
|
public void DELETE(String partialUrl, Map<String, Object> headers,
List<String> queryParams)
{
URI uri = buildUri(partialUrl);
executeDeleteRequest(uri, headers, queryParams);
}
|
java
|
public void DELETE(String partialUrl, Map<String, Object> headers,
List<String> queryParams)
{
URI uri = buildUri(partialUrl);
executeDeleteRequest(uri, headers, queryParams);
}
|
[
"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.
@param partialUrl The partial URL to build
@param headers A set of headers to add to the request
@param queryParams A set of query parameters to add to the request
|
[
"Execute",
"a",
"DELETE",
"call",
"against",
"the",
"partial",
"URL",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L314-L319
|
10,214
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.executePutRequest
|
protected void executePutRequest(URI uri, Object obj)
{
executePutRequest(uri, obj, null, null);
}
|
java
|
protected void executePutRequest(URI uri, Object obj)
{
executePutRequest(uri, obj, null, null);
}
|
[
"protected",
"void",
"executePutRequest",
"(",
"URI",
"uri",
",",
"Object",
"obj",
")",
"{",
"executePutRequest",
"(",
"uri",
",",
"obj",
",",
"null",
",",
"null",
")",
";",
"}"
] |
Execute a PUT request.
@param uri The URI to call
@param obj The object to use for the PUT
|
[
"Execute",
"a",
"PUT",
"request",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L360-L363
|
10,215
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.executePostRequest
|
protected <T> Optional<T> executePostRequest(URI uri, Object obj, GenericType<T> returnType)
{
return executePostRequest(uri, obj, null, returnType);
}
|
java
|
protected <T> Optional<T> executePostRequest(URI uri, Object obj, GenericType<T> returnType)
{
return executePostRequest(uri, obj, null, returnType);
}
|
[
"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.
@param <T> The type parameter used for the return object
@param uri The URI to call
@param obj The object to use for the POST
@param returnType The type to marshall the result back into
@return The return type
|
[
"Execute",
"a",
"POST",
"request",
"with",
"a",
"return",
"object",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L447-L450
|
10,216
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.executePatchRequest
|
protected void executePatchRequest(URI uri, Object obj)
{
executePatchRequest(uri, obj, null, null);
}
|
java
|
protected void executePatchRequest(URI uri, Object obj)
{
executePatchRequest(uri, obj, null, null);
}
|
[
"protected",
"void",
"executePatchRequest",
"(",
"URI",
"uri",
",",
"Object",
"obj",
")",
"{",
"executePatchRequest",
"(",
"uri",
",",
"obj",
",",
"null",
",",
"null",
")",
";",
"}"
] |
Execute a PATCH request.
@param uri The URI to call
@param obj The object to use for the PATCH
|
[
"Execute",
"a",
"PATCH",
"request",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L476-L479
|
10,217
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.executePatchRequest
|
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);
}
|
java
|
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);
}
|
[
"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.
@param <T> The type parameter used for the return object
@param uri The URI to call
@param obj The object to use for the PATCH
@param headers A set of headers to add to the request
@param queryParams A set of query parameters to add to the request
@param returnType The type to marshall the result back into
@return The return type
|
[
"Execute",
"a",
"PATCH",
"request",
"with",
"a",
"return",
"object",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L512-L525
|
10,218
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.executeDeleteRequest
|
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);
}
|
java
|
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);
}
|
[
"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.
@param uri The URI to call
@param headers A set of headers to add to the request
@param queryParams A set of query parameters to add to the request
|
[
"Execute",
"a",
"DELETE",
"request",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L542-L552
|
10,219
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.extractEntityFromResponse
|
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();
}
|
java
|
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();
}
|
[
"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.
@param <T> The type parameter used for the return object
@param response The HTTP response to extract the entity from
@param returnType The type to marshall the result back into
@return The extracted entity
|
[
"Extract",
"the",
"entity",
"from",
"the",
"HTTP",
"response",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L561-L566
|
10,220
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.applyHeaders
|
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());
}
}
}
|
java
|
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());
}
}
}
|
[
"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.
@param builder The invocation to add the headers to
@param headers The headers to add
|
[
"Add",
"the",
"given",
"set",
"of",
"headers",
"to",
"the",
"web",
"target",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L573-L582
|
10,221
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.applyQueryParams
|
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;
}
|
java
|
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;
}
|
[
"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.
@param target The web target to add the parameters to
@param queryParams The query parameters to add
@return The updated target
|
[
"Add",
"the",
"given",
"set",
"of",
"query",
"parameters",
"to",
"the",
"web",
"target",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L590-L601
|
10,222
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
|
HttpContext.logResponse
|
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());
}
|
java
|
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());
}
|
[
"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.
@param uri The URI used for the HTTP call
@param response The HTTP call response
|
[
"Log",
"a",
"HTTP",
"error",
"response",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L608-L614
|
10,223
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.FileField
|
Rule FileField() {
return FirstOf(FieldArea(), FieldBook(), FieldComposer(),
FieldDiscography(), FieldFile(), FieldGroup(),
FieldHistory(), FieldNotes(), FieldOrigin(),
FieldRhythm(), FieldSource(), FieldUserdefPrint(),
FieldUserdefPlay(), FieldTranscription(),
UnusedField()
//FieldLength(), FieldMeter(), FieldParts(),
//FieldTempo(), FieldWords(), FieldKey()
).label(FileField);
}
|
java
|
Rule FileField() {
return FirstOf(FieldArea(), FieldBook(), FieldComposer(),
FieldDiscography(), FieldFile(), FieldGroup(),
FieldHistory(), FieldNotes(), FieldOrigin(),
FieldRhythm(), FieldSource(), FieldUserdefPrint(),
FieldUserdefPlay(), FieldTranscription(),
UnusedField()
//FieldLength(), FieldMeter(), FieldParts(),
//FieldTempo(), FieldWords(), FieldKey()
).label(FileField);
}
|
[
"Rule",
"FileField",
"(",
")",
"{",
"return",
"FirstOf",
"(",
"FieldArea",
"(",
")",
",",
"FieldBook",
"(",
")",
",",
"FieldComposer",
"(",
")",
",",
"FieldDiscography",
"(",
")",
",",
"FieldFile",
"(",
")",
",",
"FieldGroup",
"(",
")",
",",
"FieldHistory",
"(",
")",
",",
"FieldNotes",
"(",
")",
",",
"FieldOrigin",
"(",
")",
",",
"FieldRhythm",
"(",
")",
",",
"FieldSource",
"(",
")",
",",
"FieldUserdefPrint",
"(",
")",
",",
"FieldUserdefPlay",
"(",
")",
",",
"FieldTranscription",
"(",
")",
",",
"UnusedField",
"(",
")",
"//FieldLength(), FieldMeter(), FieldParts(),\r",
"//FieldTempo(), FieldWords(), FieldKey()\r",
")",
".",
"label",
"(",
"FileField",
")",
";",
"}"
] |
Default values for the whole file - all fields except number, title and
voice
file-field ::= field-area / field-book / field-composer /
field-discography / field-file / field-group / field-history /
field-length / field-meter / field-notes / field-origin / field-parts /
field-tempo / field-rhythm / field-source / field-userdef-print /
field-userdef-play / field-words / field-transcription / field-key /
unused-field
|
[
"Default",
"values",
"for",
"the",
"whole",
"file",
"-",
"all",
"fields",
"except",
"number",
"title",
"and",
"voice"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L72-L82
|
10,224
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.FieldLength
|
Rule FieldLength() {
return Sequence(String("L:"),
ZeroOrMore(WSP()).suppressNode(),
NoteLengthStrict(), HeaderEol()).label(FieldLength);
}
|
java
|
Rule FieldLength() {
return Sequence(String("L:"),
ZeroOrMore(WSP()).suppressNode(),
NoteLengthStrict(), HeaderEol()).label(FieldLength);
}
|
[
"Rule",
"FieldLength",
"(",
")",
"{",
"return",
"Sequence",
"(",
"String",
"(",
"\"L:\"",
")",
",",
"ZeroOrMore",
"(",
"WSP",
"(",
")",
")",
".",
"suppressNode",
"(",
")",
",",
"NoteLengthStrict",
"(",
")",
",",
"HeaderEol",
"(",
")",
")",
".",
"label",
"(",
"FieldLength",
")",
";",
"}"
] |
Default note length
field-length ::= %x4C.3A *WSP note-length-strict header-eol<p>
<tt>L:</tt>
|
[
"Default",
"note",
"length"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L279-L283
|
10,225
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.FieldParts
|
Rule FieldParts() {
return Sequence(String("P:"),
ZeroOrMore(WSP()).suppressNode(),
PartsPlayOrder(), HeaderEol()).label(FieldParts);
}
|
java
|
Rule FieldParts() {
return Sequence(String("P:"),
ZeroOrMore(WSP()).suppressNode(),
PartsPlayOrder(), HeaderEol()).label(FieldParts);
}
|
[
"Rule",
"FieldParts",
"(",
")",
"{",
"return",
"Sequence",
"(",
"String",
"(",
"\"P:\"",
")",
",",
"ZeroOrMore",
"(",
"WSP",
"(",
")",
")",
".",
"suppressNode",
"(",
")",
",",
"PartsPlayOrder",
"(",
")",
",",
"HeaderEol",
"(",
")",
")",
".",
"label",
"(",
"FieldParts",
")",
";",
"}"
] |
In header defines in which order parts should be played
field-parts ::= %x50.3A *WSP parts-play-order header-eol<p>
<tt>P:</tt>
|
[
"In",
"header",
"defines",
"in",
"which",
"order",
"parts",
"should",
"be",
"played"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L317-L321
|
10,226
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.FieldWords
|
Rule FieldWords() {
return Sequence(String("W:"),
ZeroOrMore(WSP()).suppressNode(),
TexText(), HeaderEol()).label(FieldWords);
}
|
java
|
Rule FieldWords() {
return Sequence(String("W:"),
ZeroOrMore(WSP()).suppressNode(),
TexText(), HeaderEol()).label(FieldWords);
}
|
[
"Rule",
"FieldWords",
"(",
")",
"{",
"return",
"Sequence",
"(",
"String",
"(",
"\"W:\"",
")",
",",
"ZeroOrMore",
"(",
"WSP",
"(",
")",
")",
".",
"suppressNode",
"(",
")",
",",
"TexText",
"(",
")",
",",
"HeaderEol",
"(",
")",
")",
".",
"label",
"(",
"FieldWords",
")",
";",
"}"
] |
Unformatted words, printed after the tune
field-words ::= %x57.3A *WSP tex-text header-eol<p>
<tt>W:</tt>
|
[
"Unformatted",
"words",
"printed",
"after",
"the",
"tune"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L388-L392
|
10,227
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.FieldMacro
|
Rule FieldMacro() {
return Sequence(String("m:"),
ZeroOrMore(WSP()).suppressNode(),
OneOrMore(FirstOf(WSP(), VCHAR()))
.label("Macro").suppressSubnodes(),
HeaderEol()
).label(FieldMacro);
}
|
java
|
Rule FieldMacro() {
return Sequence(String("m:"),
ZeroOrMore(WSP()).suppressNode(),
OneOrMore(FirstOf(WSP(), VCHAR()))
.label("Macro").suppressSubnodes(),
HeaderEol()
).label(FieldMacro);
}
|
[
"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
field-macro ::= %x6D.3A *WSP 1*(WSP / VCHAR) header-eol<p>
<tt>m:</tt>
|
[
"BarFly",
"-",
"style",
"macros",
"-",
"do",
"be",
"defined",
"better"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L408-L415
|
10,228
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.UnusedField
|
Rule UnusedField() {
//TODO remove s:symbol-line
return Sequence(
AnyOf("EJYabcdefghijklnopqrstvxyz")
/*FirstOf('E', 'I', 'J', 'Y',
CharRange('a', 'l'),
CharRange('n', 't'),
'v', 'x', 'y', 'z')*/
.label("UnusedFieldLetter").suppressSubnodes(),
String(":"),
ZeroOrMore(WSP()).suppressNode(),
TexText(), HeaderEol()).label(UnusedField);
}
|
java
|
Rule UnusedField() {
//TODO remove s:symbol-line
return Sequence(
AnyOf("EJYabcdefghijklnopqrstvxyz")
/*FirstOf('E', 'I', 'J', 'Y',
CharRange('a', 'l'),
CharRange('n', 't'),
'v', 'x', 'y', 'z')*/
.label("UnusedFieldLetter").suppressSubnodes(),
String(":"),
ZeroOrMore(WSP()).suppressNode(),
TexText(), HeaderEol()).label(UnusedField);
}
|
[
"Rule",
"UnusedField",
"(",
")",
"{",
"//TODO remove s:symbol-line\r",
"return",
"Sequence",
"(",
"AnyOf",
"(",
"\"EJYabcdefghijklnopqrstvxyz\"",
")",
"/*FirstOf('E', 'I', 'J', 'Y',\r\n\t\t\t\t\t\tCharRange('a', 'l'),\r\n\t\t\t\t\t\tCharRange('n', 't'),\r\n\t\t\t\t\t\t'v', 'x', 'y', 'z')*/",
".",
"label",
"(",
"\"UnusedFieldLetter\"",
")",
".",
"suppressSubnodes",
"(",
")",
",",
"String",
"(",
"\":\"",
")",
",",
"ZeroOrMore",
"(",
"WSP",
"(",
")",
")",
".",
"suppressNode",
"(",
")",
",",
"TexText",
"(",
")",
",",
"HeaderEol",
"(",
")",
")",
".",
"label",
"(",
"UnusedField",
")",
";",
"}"
] |
ignore - but for backward and forward compatibility
unused-field ::= (%x45 / %x49 / %4A / %59 / %61-6c / %6e-%74 / %76 / %78-7A) %3A *(WSP / VCHAR) eol<p>
<tt>E: I: J: Y: a:-l: n:-t: v: x: y: z:</tt>
|
[
"ignore",
"-",
"but",
"for",
"backward",
"and",
"forward",
"compatibility"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L431-L443
|
10,229
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.Minor
|
Rule Minor() {
return Sequence(IgnoreCase("m"),
Optional(Sequence(IgnoreCase("in"),
Optional(Sequence(IgnoreCase("o"),
Optional(IgnoreCase("r"))
))
))
).label(Minor).suppressSubnodes();
}
|
java
|
Rule Minor() {
return Sequence(IgnoreCase("m"),
Optional(Sequence(IgnoreCase("in"),
Optional(Sequence(IgnoreCase("o"),
Optional(IgnoreCase("r"))
))
))
).label(Minor).suppressSubnodes();
}
|
[
"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
minor ::= "m" ["in" ["o" ["r"]]]
|
[
"m",
"min",
"mino",
"minor",
"-",
"all",
"modes",
"are",
"case",
"insensitive"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L613-L621
|
10,230
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.Lydian
|
Rule Lydian() {
return Sequence(IgnoreCase("lyd"),
Optional(Sequence(IgnoreCase("i"),
Optional(Sequence(IgnoreCase("a"),
Optional(IgnoreCase("n"))
))
))
).label(Lydian).suppressSubnodes();
}
|
java
|
Rule Lydian() {
return Sequence(IgnoreCase("lyd"),
Optional(Sequence(IgnoreCase("i"),
Optional(Sequence(IgnoreCase("a"),
Optional(IgnoreCase("n"))
))
))
).label(Lydian).suppressSubnodes();
}
|
[
"Rule",
"Lydian",
"(",
")",
"{",
"return",
"Sequence",
"(",
"IgnoreCase",
"(",
"\"lyd\"",
")",
",",
"Optional",
"(",
"Sequence",
"(",
"IgnoreCase",
"(",
"\"i\"",
")",
",",
"Optional",
"(",
"Sequence",
"(",
"IgnoreCase",
"(",
"\"a\"",
")",
",",
"Optional",
"(",
"IgnoreCase",
"(",
"\"n\"",
")",
")",
")",
")",
")",
")",
")",
".",
"label",
"(",
"Lydian",
")",
".",
"suppressSubnodes",
"(",
")",
";",
"}"
] |
major with sharp 4th
lydian ::= "lyd" ["i" ["a" ["n"]]]
|
[
"major",
"with",
"sharp",
"4th"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L637-L645
|
10,231
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.Mixolydian
|
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();
}
|
java
|
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();
}
|
[
"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
mixolydian ::= "mix" ["o" ["l" ["y" ["d" ["i" ["a" ["n"]]]]]]]
|
[
"major",
"with",
"flat",
"7th"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L665-L681
|
10,232
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.Dorian
|
Rule Dorian() {
return Sequence(IgnoreCase("dor"),
Optional(Sequence(IgnoreCase("i"),
Optional(Sequence(IgnoreCase("a"),
Optional(IgnoreCase("n"))
))
))
).label(Dorian).suppressSubnodes();
}
|
java
|
Rule Dorian() {
return Sequence(IgnoreCase("dor"),
Optional(Sequence(IgnoreCase("i"),
Optional(Sequence(IgnoreCase("a"),
Optional(IgnoreCase("n"))
))
))
).label(Dorian).suppressSubnodes();
}
|
[
"Rule",
"Dorian",
"(",
")",
"{",
"return",
"Sequence",
"(",
"IgnoreCase",
"(",
"\"dor\"",
")",
",",
"Optional",
"(",
"Sequence",
"(",
"IgnoreCase",
"(",
"\"i\"",
")",
",",
"Optional",
"(",
"Sequence",
"(",
"IgnoreCase",
"(",
"\"a\"",
")",
",",
"Optional",
"(",
"IgnoreCase",
"(",
"\"n\"",
")",
")",
")",
")",
")",
")",
")",
".",
"label",
"(",
"Dorian",
")",
".",
"suppressSubnodes",
"(",
")",
";",
"}"
] |
minor with sharp 6th
dorian ::= "dor" ["i" ["a" ["n"]]]
|
[
"minor",
"with",
"sharp",
"6th"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L687-L695
|
10,233
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.Phrygian
|
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();
}
|
java
|
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();
}
|
[
"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
phrygian ::= "phr" ["y" ["g" ["i" ["a" ["n"]]]]]
|
[
"minor",
"with",
"flat",
"2nd"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L717-L729
|
10,234
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.Locrian
|
Rule Locrian() {
return Sequence(IgnoreCase("loc"),
Optional(Sequence(IgnoreCase("r"),
Optional(Sequence(IgnoreCase("i"),
Optional(Sequence(IgnoreCase("a"),
Optional(IgnoreCase("n"))
))
))
))
).label(Locrian).suppressSubnodes();
}
|
java
|
Rule Locrian() {
return Sequence(IgnoreCase("loc"),
Optional(Sequence(IgnoreCase("r"),
Optional(Sequence(IgnoreCase("i"),
Optional(Sequence(IgnoreCase("a"),
Optional(IgnoreCase("n"))
))
))
))
).label(Locrian).suppressSubnodes();
}
|
[
"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
locrian ::= "loc" ["r" ["i" ["a" ["n"]]]]
|
[
"minor",
"with",
"flat",
"2nd",
"and",
"5th"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L735-L745
|
10,235
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.ClefName
|
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();
}
|
java
|
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();
}
|
[
"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
clef-name ::= "treble" / "alto" / "tenor" / "baritone" / "bass"
/ "mezzo" / "soprano" / "perc" / "none"
|
[
"Maybe",
"also",
"Doh1",
"-",
"4",
"Fa1",
"-",
"4"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L933-L940
|
10,236
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.HeaderEol
|
Rule HeaderEol() {
return Sequence(ZeroOrMore(WSP()).suppressNode(),
FirstOfS(Comment(), suppr(Eol()), suppr(EOI))
).label(HeaderEol);
}
|
java
|
Rule HeaderEol() {
return Sequence(ZeroOrMore(WSP()).suppressNode(),
FirstOfS(Comment(), suppr(Eol()), suppr(EOI))
).label(HeaderEol);
}
|
[
"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
header-eol ::= *WSP (comment / eol)
|
[
"there",
"may",
"be",
"comments",
"at",
"the",
"end",
"of",
"header",
"lines"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L992-L996
|
10,237
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.GraceNotes
|
Rule GraceNotes() {
return Sequence(
String("{"),
OptionalS(Acciaccatura()),
ZeroOrMoreS(GraceNoteStem()),
String("}"))
.label(GraceNotes);
}
|
java
|
Rule GraceNotes() {
return Sequence(
String("{"),
OptionalS(Acciaccatura()),
ZeroOrMoreS(GraceNoteStem()),
String("}"))
.label(GraceNotes);
}
|
[
"Rule",
"GraceNotes",
"(",
")",
"{",
"return",
"Sequence",
"(",
"String",
"(",
"\"{\"",
")",
",",
"OptionalS",
"(",
"Acciaccatura",
"(",
")",
")",
",",
"ZeroOrMoreS",
"(",
"GraceNoteStem",
"(",
")",
")",
",",
"String",
"(",
"\"}\"",
")",
")",
".",
"label",
"(",
"GraceNotes",
")",
";",
"}"
] |
grace notes can have length
grace-notes ::= "{" acciaccatura 1*( grace-note-stem ) "}"
|
[
"grace",
"notes",
"can",
"have",
"length"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L1302-L1309
|
10,238
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.TextExpression
|
Rule TextExpression() {
return Sequence(
OptionalS(AnyOf("^<>_@").label(Position)),
OneOrMore(NonQuoteOneTextLine()).label(Text).suppressSubnodes()
).label(TextExpression);
}
|
java
|
Rule TextExpression() {
return Sequence(
OptionalS(AnyOf("^<>_@").label(Position)),
OneOrMore(NonQuoteOneTextLine()).label(Text).suppressSubnodes()
).label(TextExpression);
}
|
[
"Rule",
"TextExpression",
"(",
")",
"{",
"return",
"Sequence",
"(",
"OptionalS",
"(",
"AnyOf",
"(",
"\"^<>_@\"",
")",
".",
"label",
"(",
"Position",
")",
")",
",",
"OneOrMore",
"(",
"NonQuoteOneTextLine",
"(",
")",
")",
".",
"label",
"(",
"Text",
")",
".",
"suppressSubnodes",
"(",
")",
")",
".",
"label",
"(",
"TextExpression",
")",
";",
"}"
] |
above, left, right, below, anywhere
text-expression ::= [ "^" / "<" / ">" / "_" / "@" ] 1*non-quote
|
[
"above",
"left",
"right",
"below",
"anywhere"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L1420-L1425
|
10,239
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcGrammar.java
|
AbcGrammar.LatinExtendedAndOtherAlphabet
|
Rule LatinExtendedAndOtherAlphabet() {
return FirstOf(
CharRange('\u0080', '\u074F'), //Latin to Syriac
CharRange('\u0780', '\u07BF'), //Thaana
CharRange('\u0900', '\u137F'), //Devanagari to Ethiopic
CharRange('\u13A0', '\u18AF'), //Cherokee to Mongolian
CharRange('\u1900', '\u197F'), //Limbu to Tai Le
CharRange('\u19E0', '\u19FF'), //Khmer
CharRange('\u1D00', '\u1D7F'), //Phonetic ext
CharRange('\u1E00', '\u2BFF'), //Latin ext add to misc symbol & arrows
CharRange('\u2E80', '\u2FDF'), //CJK radicals to Kangxi radical
CharRange('\u2FF0', '\u31BF'), //Ideographic desc chars to Bopomofo ext
CharRange('\u31F0', '\uA4CF'), //Katakana phonet ext to Yi radicals
CharRange('\uAC00', '\uD7AF'), //Hangul syllable
//exclude Surrogates
CharRange('\uF900', '\uFE0F'), //CJK compat to Variation selectors
CharRange('\uFE20', '\uFFEF') //combin half mark to halfwidth & fullwidth forms
).suppressNode();
}
|
java
|
Rule LatinExtendedAndOtherAlphabet() {
return FirstOf(
CharRange('\u0080', '\u074F'), //Latin to Syriac
CharRange('\u0780', '\u07BF'), //Thaana
CharRange('\u0900', '\u137F'), //Devanagari to Ethiopic
CharRange('\u13A0', '\u18AF'), //Cherokee to Mongolian
CharRange('\u1900', '\u197F'), //Limbu to Tai Le
CharRange('\u19E0', '\u19FF'), //Khmer
CharRange('\u1D00', '\u1D7F'), //Phonetic ext
CharRange('\u1E00', '\u2BFF'), //Latin ext add to misc symbol & arrows
CharRange('\u2E80', '\u2FDF'), //CJK radicals to Kangxi radical
CharRange('\u2FF0', '\u31BF'), //Ideographic desc chars to Bopomofo ext
CharRange('\u31F0', '\uA4CF'), //Katakana phonet ext to Yi radicals
CharRange('\uAC00', '\uD7AF'), //Hangul syllable
//exclude Surrogates
CharRange('\uF900', '\uFE0F'), //CJK compat to Variation selectors
CharRange('\uFE20', '\uFFEF') //combin half mark to halfwidth & fullwidth forms
).suppressNode();
}
|
[
"Rule",
"LatinExtendedAndOtherAlphabet",
"(",
")",
"{",
"return",
"FirstOf",
"(",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Latin to Syriac\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Thaana\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Devanagari to Ethiopic\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Cherokee to Mongolian\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Limbu to Tai Le\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Khmer\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Phonetic ext \r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Latin ext add to misc symbol & arrows\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//CJK radicals to Kangxi radical\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Ideographic desc chars to Bopomofo ext\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Katakana phonet ext to Yi radicals\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//Hangul syllable\r",
"//exclude Surrogates\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"//CJK compat to Variation selectors\r",
"CharRange",
"(",
"'",
"'",
",",
"'",
"'",
")",
"//combin half mark to halfwidth & fullwidth forms\r",
")",
".",
"suppressNode",
"(",
")",
";",
"}"
] |
chars between 0080 and FFEF with exclusions.
It contains various alphabets such as latin extended,
hebrew, arabic, chinese, tamil... and symbols
|
[
"chars",
"between",
"0080",
"and",
"FFEF",
"with",
"exclusions",
".",
"It",
"contains",
"various",
"alphabets",
"such",
"as",
"latin",
"extended",
"hebrew",
"arabic",
"chinese",
"tamil",
"...",
"and",
"symbols"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L2558-L2576
|
10,240
|
Sciss/abc4j
|
abc/src/main/java/abc/midi/MetaMessageWA.java
|
MetaMessageWA.isTempoMessage
|
public static boolean isTempoMessage(MetaMessage message) {
return
(message.getType()==MidiMessageType.MARKER &&
message.getData()[0]==MidiMessageType.TEMPO_CHANGE);
}
|
java
|
public static boolean isTempoMessage(MetaMessage message) {
return
(message.getType()==MidiMessageType.MARKER &&
message.getData()[0]==MidiMessageType.TEMPO_CHANGE);
}
|
[
"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.
@param message
@return <TT>true</TT> if the given message is a tempo message,
<TT>false</TT> otherwise.
|
[
"Checks",
"the",
"first",
"byte",
"of",
"the",
"data",
"part",
"of",
"the",
"message",
"to",
"check",
"if",
"it",
"is",
"a",
"tempo",
"message",
"or",
"not",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/midi/MetaMessageWA.java#L63-L67
|
10,241
|
Sciss/abc4j
|
abc/src/main/java/abc/midi/MetaMessageWA.java
|
MetaMessageWA.isNotationMarker
|
public static boolean isNotationMarker(MetaMessage message) {
return
(message.getType()==MidiMessageType.MARKER &&
message.getData()[0]==MidiMessageType.NOTATION_MARKER);
}
|
java
|
public static boolean isNotationMarker(MetaMessage message) {
return
(message.getType()==MidiMessageType.MARKER &&
message.getData()[0]==MidiMessageType.NOTATION_MARKER);
}
|
[
"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.
@param message
@return <TT>true</TT> if the given message is a marker notation message,
<TT>false</TT> otherwise.
|
[
"Checks",
"the",
"first",
"byte",
"of",
"the",
"data",
"part",
"of",
"the",
"message",
"to",
"check",
"if",
"it",
"is",
"a",
"notation",
"marker",
"message",
"or",
"not",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/midi/MetaMessageWA.java#L74-L78
|
10,242
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JStaffLine.java
|
JStaffLine.setTablature
|
protected void setTablature(Tablature tablature) {
if (tablature != null)
m_tablature = new JTablature(tablature, getBase(), getMetrics());
else
m_tablature = null;
}
|
java
|
protected void setTablature(Tablature tablature) {
if (tablature != null)
m_tablature = new JTablature(tablature, getBase(), getMetrics());
else
m_tablature = null;
}
|
[
"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
@param tablature null to remove tablature
|
[
"attaches",
"a",
"tablature",
"to",
"this",
"staff",
"line"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JStaffLine.java#L106-L111
|
10,243
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java
|
ApplicationService.list
|
public Collection<Application> list(List<String> queryParams)
{
return HTTP.GET("/v2/applications.json", null, queryParams, APPLICATIONS).get();
}
|
java
|
public Collection<Application> list(List<String> queryParams)
{
return HTTP.GET("/v2/applications.json", null, queryParams, APPLICATIONS).get();
}
|
[
"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.
@param queryParams The query parameters
@return The set of applications
|
[
"Returns",
"the",
"set",
"of",
"applications",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java#L53-L56
|
10,244
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java
|
ApplicationService.list
|
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;
}
|
java
|
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;
}
|
[
"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.
@param name The name of the applications
@return The set of applications
|
[
"Returns",
"the",
"set",
"of",
"applications",
"for",
"the",
"given",
"name",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java#L73-L83
|
10,245
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java
|
ApplicationService.show
|
public Optional<Application> show(long applicationId)
{
return HTTP.GET(String.format("/v2/applications/%d.json", applicationId), APPLICATION);
}
|
java
|
public Optional<Application> show(long applicationId)
{
return HTTP.GET(String.format("/v2/applications/%d.json", applicationId), APPLICATION);
}
|
[
"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.
@param applicationId The id for the application to return
@return The application
|
[
"Returns",
"the",
"application",
"for",
"the",
"given",
"application",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java#L90-L93
|
10,246
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java
|
ApplicationService.update
|
public Optional<Application> update(Application application)
{
return HTTP.PUT(String.format("/v2/applications/%d.json", application.getId()), application, APPLICATION);
}
|
java
|
public Optional<Application> update(Application application)
{
return HTTP.PUT(String.format("/v2/applications/%d.json", application.getId()), application, APPLICATION);
}
|
[
"public",
"Optional",
"<",
"Application",
">",
"update",
"(",
"Application",
"application",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/applications/%d.json\"",
",",
"application",
".",
"getId",
"(",
")",
")",
",",
"application",
",",
"APPLICATION",
")",
";",
"}"
] |
Updates the given application.
@param application The application to update
@return The application that was updated
|
[
"Updates",
"the",
"given",
"application",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationService.java#L100-L103
|
10,247
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcNode.java
|
AbcNode.getChildsInAllGenerations
|
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;
}
|
java
|
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;
}
|
[
"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.
@param label
|
[
"Look",
"for",
"child",
"grandchild",
"grand",
"-",
"grand",
"-",
"child",
"having",
"the",
"requested",
"label",
".",
"When",
"such",
"one",
"is",
"found",
"doesn",
"t",
"continue",
"search",
"into",
"his",
"own",
"childs",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcNode.java#L212-L226
|
10,248
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcNode.java
|
AbcNode.getErrors
|
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);
}
}
|
java
|
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);
}
}
|
[
"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...
|
[
"Returns",
"a",
"List",
"of",
"errors",
"in",
"all",
"childs",
"grand",
"-",
"childs",
"..."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcNode.java#L261-L272
|
10,249
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcNode.java
|
AbcNode.getIntValue
|
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;
}
|
java
|
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;
}
|
[
"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.
|
[
"Returns",
"the",
"value",
"parsed",
"into",
"integer",
"if",
"label",
"is",
"DIGIT",
"or",
"DIGITS",
"else",
"-",
"1",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcNode.java#L288-L299
|
10,250
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcNode.java
|
AbcNode.getShortValue
|
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;
}
|
java
|
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;
}
|
[
"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.
|
[
"Returns",
"the",
"value",
"parsed",
"into",
"short",
"if",
"label",
"is",
"DIGIT",
"or",
"DIGITS",
"else",
"-",
"1",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcNode.java#L319-L329
|
10,251
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/SyntheticsAlertConditionService.java
|
SyntheticsAlertConditionService.create
|
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);
}
|
java
|
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);
}
|
[
"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.
@param policyId The id of the policy to add the alert condition to
@param condition The alert condition to create
@return The alert condition that was created
|
[
"Creates",
"the",
"given",
"Synthetics",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/SyntheticsAlertConditionService.java#L108-L111
|
10,252
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/SyntheticsAlertConditionService.java
|
SyntheticsAlertConditionService.update
|
public Optional<SyntheticsAlertCondition> update(SyntheticsAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_synthetics_conditions/%d.json", condition.getId()), condition, SYNTHETICS_ALERT_CONDITION);
}
|
java
|
public Optional<SyntheticsAlertCondition> update(SyntheticsAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_synthetics_conditions/%d.json", condition.getId()), condition, SYNTHETICS_ALERT_CONDITION);
}
|
[
"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.
@param condition The alert condition to update
@return The alert condition that was updated
|
[
"Updates",
"the",
"given",
"Synthetics",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/SyntheticsAlertConditionService.java#L118-L121
|
10,253
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/util/ResourceList.java
|
ResourceList.add
|
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);
}
}
|
java
|
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);
}
}
|
[
"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.
@param resources The resources to add
|
[
"Adds",
"a",
"list",
"of",
"resources",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/util/ResourceList.java#L57-L66
|
10,254
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/util/ResourceList.java
|
ResourceList.list
|
public List<T> list(String str)
{
Map<String,T> map = new LinkedHashMap<String,T>();
if(str == null || str.length() == 0) // Select all resources by default
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;
}
|
java
|
public List<T> list(String str)
{
Map<String,T> map = new LinkedHashMap<String,T>();
if(str == null || str.length() == 0) // Select all resources by default
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;
}
|
[
"public",
"List",
"<",
"T",
">",
"list",
"(",
"String",
"str",
")",
"{",
"Map",
"<",
"String",
",",
"T",
">",
"map",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"T",
">",
"(",
")",
";",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"// Select all resources by default",
"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.
@param str The comma-separated list of names (including wildcards)
@return The resources that match the given list
|
[
"Returns",
"the",
"resources",
"that",
"match",
"the",
"given",
"comma",
"-",
"separated",
"list",
"of",
"names",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/util/ResourceList.java#L111-L135
|
10,255
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/util/ResourceList.java
|
ResourceList.list
|
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;
}
|
java
|
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;
}
|
[
"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.
@param ids The list of the resource ids
@return The resources that match the given ids
|
[
"Returns",
"the",
"resources",
"that",
"match",
"the",
"given",
"ids",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/util/ResourceList.java#L142-L157
|
10,256
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JChord.java
|
JChord.createNormalizedChord
|
protected JChord createNormalizedChord(MultiNote mNote, ScoreMetrics mtrx, Point2D base) {
return new JChord(mNote, getClef(), mtrx, base);
}
|
java
|
protected JChord createNormalizedChord(MultiNote mNote, ScoreMetrics mtrx, Point2D base) {
return new JChord(mNote, getClef(), mtrx, base);
}
|
[
"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.
|
[
"Invoked",
"when",
"a",
"multi",
"note",
"is",
"decomposed",
"into",
"multi",
"notes",
"with",
"same",
"strict",
"duration",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JChord.java#L150-L152
|
10,257
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JChord.java
|
JChord.setStaffLine
|
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);
}
|
java
|
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);
}
|
[
"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.
|
[
"Sets",
"the",
"staff",
"line",
"this",
"chord",
"belongs",
"to",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JChord.java#L171-L182
|
10,258
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JChord.java
|
JChord.setBase
|
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);
}
|
java
|
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);
}
|
[
"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.
|
[
"Sets",
"the",
"base",
"of",
"this",
"chord",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JChord.java#L189-L204
|
10,259
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Tune.java
|
Tune.getPart
|
public Part getPart(String partLabel)
{
if (m_parts!=null)
{
for (Object m_part : m_parts) {
Part p = (Part) m_part;
//if (p.getLabel().equals(partLabel)
// || p.getLabel().equals(""+partLabel.charAt(0))) {
if (p.getLabel().charAt(0) == partLabel.charAt(0)) {
if (partLabel.length() > 1) {
p.setLabel(partLabel);
}
return p;
}
}
return null;
}
else
return null;
}
|
java
|
public Part getPart(String partLabel)
{
if (m_parts!=null)
{
for (Object m_part : m_parts) {
Part p = (Part) m_part;
//if (p.getLabel().equals(partLabel)
// || p.getLabel().equals(""+partLabel.charAt(0))) {
if (p.getLabel().charAt(0) == partLabel.charAt(0)) {
if (partLabel.length() > 1) {
p.setLabel(partLabel);
}
return p;
}
}
return null;
}
else
return null;
}
|
[
"public",
"Part",
"getPart",
"(",
"String",
"partLabel",
")",
"{",
"if",
"(",
"m_parts",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"m_part",
":",
"m_parts",
")",
"{",
"Part",
"p",
"=",
"(",
"Part",
")",
"m_part",
";",
"//if (p.getLabel().equals(partLabel)\r",
"//\t|| p.getLabel().equals(\"\"+partLabel.charAt(0))) {\r",
"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.
@param partLabel A part label.
@return The part of the tune identified by the given label, <TT>null</TT>
if no part with the specified label exists in this tune.
|
[
"Returns",
"the",
"part",
"of",
"the",
"tune",
"identified",
"by",
"the",
"given",
"label",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Tune.java#L286-L305
|
10,260
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Tune.java
|
Tune.createPart
|
public Part createPart(String partLabel) {
Part part;
if ((part = getPart(partLabel)) != null)
return part;
// check should be requiered to see if the label is not
// empty or blank character because the blank character is
// used as flag for the default part.
part = new Part(this, partLabel);
if (m_parts==null) m_parts = new ArrayList();
m_parts.add(part);
return part;
}
|
java
|
public Part createPart(String partLabel) {
Part part;
if ((part = getPart(partLabel)) != null)
return part;
// check should be requiered to see if the label is not
// empty or blank character because the blank character is
// used as flag for the default part.
part = new Part(this, partLabel);
if (m_parts==null) m_parts = new ArrayList();
m_parts.add(part);
return part;
}
|
[
"public",
"Part",
"createPart",
"(",
"String",
"partLabel",
")",
"{",
"Part",
"part",
";",
"if",
"(",
"(",
"part",
"=",
"getPart",
"(",
"partLabel",
")",
")",
"!=",
"null",
")",
"return",
"part",
";",
"// check should be requiered to see if the label is not \r",
"// empty or blank character because the blank character is\r",
"// used as flag for the default part.\r",
"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.
@param partLabel The label defining this new tune part.
@return The new part properly labeled.
|
[
"Creates",
"a",
"new",
"part",
"in",
"this",
"tune",
"if",
"doesn",
"t",
"exist",
"and",
"returns",
"it",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Tune.java#L310-L321
|
10,261
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Tune.java
|
Tune.getMusic
|
public Music getMusic() {
if (m_multiPartsDef == null) {
if (m_parts == null) //no part at all
return (m_defaultPart.getMusic());
else //ah, they are some parts, but no part order
//return the same thing than graphical rendition
//parts in alphabetic order
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;
}
}
|
java
|
public Music getMusic() {
if (m_multiPartsDef == null) {
if (m_parts == null) //no part at all
return (m_defaultPart.getMusic());
else //ah, they are some parts, but no part order
//return the same thing than graphical rendition
//parts in alphabetic order
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;
}
}
|
[
"public",
"Music",
"getMusic",
"(",
")",
"{",
"if",
"(",
"m_multiPartsDef",
"==",
"null",
")",
"{",
"if",
"(",
"m_parts",
"==",
"null",
")",
"//no part at all\r",
"return",
"(",
"m_defaultPart",
".",
"getMusic",
"(",
")",
")",
";",
"else",
"//ah, they are some parts, but no part order\r",
"//return the same thing than graphical rendition\r",
"//parts in alphabetic order\r",
"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.
Parts order is expanded. And that's all.
e.g. the parts order is ABAB, you'll get :
<ul>
<li>the default part, if any before "A"
<li>A
<li>B
<li>A
<li>B
</ul>
If there is no part, it's simple, it returns the "default"
part.
If you want to retrieve the music related to each part separatly
see {@link #getPart(String)}.{@link Part#getMusic() getMusic()}.
This is not desired for printing and graphic output.
But this is a beginning for audio output.
In your audio converter you'll have to manage all bar
repeats, decorations rendering... or you could use
{@link #getMusicForAudioRendition()} which does this
task for you.
@see #getMusicForGraphicalRendition()
@see #getMusicForAudioRendition()
@see #getPart(String)
@return The music part of this tune. If this tune isn't composed of
several parts this method returns the "normal" music part. If
this tune is composed of several parts the returned music is
generated so that the tune looks like a "single-part" one.
|
[
"Returns",
"the",
"music",
"of",
"this",
"tune",
"in",
"a",
"raw",
"form",
".",
"This",
"is",
"half",
"-",
"way",
"between",
"graphical",
"rendition",
"and",
"audio",
"rendition",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Tune.java#L665-L683
|
10,262
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/InfraAlertConditionService.java
|
InfraAlertConditionService.list
|
public Collection<InfraAlertCondition> list(long policyId, int offset, int limit)
{
return list(filters().policyId(policyId).offset(offset).limit(limit).build());
}
|
java
|
public Collection<InfraAlertCondition> list(long policyId, int offset, int limit)
{
return list(filters().policyId(policyId).offset(offset).limit(limit).build());
}
|
[
"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.
@param policyId The id of the alert policy to return the conditions for
@param offset The item count offset
@param limit The number of results per page, maximum 50
@return The set of alert conditions
|
[
"Returns",
"the",
"set",
"of",
"alert",
"conditions",
"for",
"the",
"given",
"policy",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/InfraAlertConditionService.java#L61-L64
|
10,263
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/InfraAlertConditionService.java
|
InfraAlertConditionService.show
|
public Optional<InfraAlertCondition> show(long conditionId)
{
return HTTP.GET(String.format("/v2/alerts/conditions/%d", conditionId), null, null, INFRA_ALERT_CONDITION);
}
|
java
|
public Optional<InfraAlertCondition> show(long conditionId)
{
return HTTP.GET(String.format("/v2/alerts/conditions/%d", conditionId), null, null, INFRA_ALERT_CONDITION);
}
|
[
"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.
@param conditionId The id of the alert condition to return
@return The alert condition
|
[
"Returns",
"the",
"infrastructure",
"alert",
"condition",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/InfraAlertConditionService.java#L112-L115
|
10,264
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/InfraAlertConditionService.java
|
InfraAlertConditionService.update
|
public Optional<InfraAlertCondition> update(InfraAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts/conditions/%d", condition.getId()), condition, INFRA_ALERT_CONDITION);
}
|
java
|
public Optional<InfraAlertCondition> update(InfraAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts/conditions/%d", condition.getId()), condition, INFRA_ALERT_CONDITION);
}
|
[
"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.
@param condition The alert condition to update
@return The alert condition that was updated
|
[
"Updates",
"the",
"given",
"infrastructure",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/InfraAlertConditionService.java#L132-L135
|
10,265
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/metrics/MetricTimeslice.java
|
MetricTimeslice.setValues
|
public void setValues(Map<String,Object> values)
{
this.values.clear();
this.values.putAll(values);
}
|
java
|
public void setValues(Map<String,Object> values)
{
this.values.clear();
this.values.putAll(values);
}
|
[
"public",
"void",
"setValues",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
")",
"{",
"this",
".",
"values",
".",
"clear",
"(",
")",
";",
"this",
".",
"values",
".",
"putAll",
"(",
"values",
")",
";",
"}"
] |
Sets the list of values.
@param values The list of values
|
[
"Sets",
"the",
"list",
"of",
"values",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/metrics/MetricTimeslice.java#L83-L87
|
10,266
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/TrafficLightPresentation.java
|
TrafficLightPresentation.addTrafficLight
|
public void addTrafficLight(TrafficLight trafficLight)
{
if(this.trafficLights == null)
this.trafficLights = new ArrayList<TrafficLight>();
this.trafficLights.add(trafficLight);
}
|
java
|
public void addTrafficLight(TrafficLight trafficLight)
{
if(this.trafficLights == null)
this.trafficLights = new ArrayList<TrafficLight>();
this.trafficLights.add(trafficLight);
}
|
[
"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.
@param trafficLight The traffic light to add to the traffic lights
|
[
"Adds",
"a",
"traffic",
"light",
"to",
"the",
"traffic",
"lights",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/TrafficLightPresentation.java#L56-L61
|
10,267
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/Engraver.java
|
Engraver.adaptToTune
|
protected void adaptToTune(Tune tune, ScoreMetrics metrics) {
//reinit the values of the engraving mode
setMode(m_mode, m_variation);
if (m_mode != NONE) {
//11=notes spacing at 45px (default font size)
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();
//System.out.println("shortest note duration = "+shortest.getDuration());
short min = /*(shortestDuration >= Note.QUARTER)
? Note.SIXTEENTH
: */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++) {
//System.out.println("durations["+i+"] = "+durations[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--) {
//DEBUG
/*String s = "";
for (Iterator itSet = set.iterator(); itSet.hasNext();) {
Integer i2 = (Integer) itSet.next();
System.out.print(i2+"\t");
s += getSpaceAfter(i2.intValue())+"\t";
}
System.out.println("\n"+s);*/
setSpaceAfter((Integer) durations[i],
getSpaceAfter((Integer) durations[i - offset])
);
}
}
//System.out.println(spaceAfter.keySet().toArray());
//System.out.println(spaceAfter.entrySet().toArray());
}
}
}
|
java
|
protected void adaptToTune(Tune tune, ScoreMetrics metrics) {
//reinit the values of the engraving mode
setMode(m_mode, m_variation);
if (m_mode != NONE) {
//11=notes spacing at 45px (default font size)
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();
//System.out.println("shortest note duration = "+shortest.getDuration());
short min = /*(shortestDuration >= Note.QUARTER)
? Note.SIXTEENTH
: */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++) {
//System.out.println("durations["+i+"] = "+durations[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--) {
//DEBUG
/*String s = "";
for (Iterator itSet = set.iterator(); itSet.hasNext();) {
Integer i2 = (Integer) itSet.next();
System.out.print(i2+"\t");
s += getSpaceAfter(i2.intValue())+"\t";
}
System.out.println("\n"+s);*/
setSpaceAfter((Integer) durations[i],
getSpaceAfter((Integer) durations[i - offset])
);
}
}
//System.out.println(spaceAfter.keySet().toArray());
//System.out.println(spaceAfter.entrySet().toArray());
}
}
}
|
[
"protected",
"void",
"adaptToTune",
"(",
"Tune",
"tune",
",",
"ScoreMetrics",
"metrics",
")",
"{",
"//reinit the values of the engraving mode\r",
"setMode",
"(",
"m_mode",
",",
"m_variation",
")",
";",
"if",
"(",
"m_mode",
"!=",
"NONE",
")",
"{",
"//11=notes spacing at 45px (default font size)\r",
"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",
"(",
")",
";",
"//System.out.println(\"shortest note duration = \"+shortest.getDuration());\r",
"short",
"min",
"=",
"/*(shortestDuration >= Note.QUARTER)\r\n\t\t\t\t? Note.SIXTEENTH\r\n\t\t\t\t: */",
"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",
"++",
")",
"{",
"//System.out.println(\"durations[\"+i+\"] = \"+durations[i]);\r",
"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",
"--",
")",
"{",
"//DEBUG\r",
"/*String s = \"\";\r\n\t\t\t\t\t\tfor (Iterator itSet = set.iterator(); itSet.hasNext();) {\r\n\t\t\t\t\t\t\tInteger i2 = (Integer) itSet.next();\r\n\t\t\t\t\t\t\tSystem.out.print(i2+\"\\t\");\r\n\t\t\t\t\t\t\ts += getSpaceAfter(i2.intValue())+\"\\t\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tSystem.out.println(\"\\n\"+s);*/",
"setSpaceAfter",
"(",
"(",
"Integer",
")",
"durations",
"[",
"i",
"]",
",",
"getSpaceAfter",
"(",
"(",
"Integer",
")",
"durations",
"[",
"i",
"-",
"offset",
"]",
")",
")",
";",
"}",
"}",
"//System.out.println(spaceAfter.keySet().toArray());\r",
"//System.out.println(spaceAfter.entrySet().toArray());\r",
"}",
"}",
"}"
] |
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.
|
[
"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",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/Engraver.java#L54-L106
|
10,268
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcParserAbstract.java
|
AbcParserAbstract.getAbsoluteDurationFor
|
private DurationDescription getAbsoluteDurationFor(Fraction relativeDuration)
throws IllegalArgumentException {
// This algorithm is closely linked to the way constants are defined
// in the Note class !!!
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;
}
}
}
// from here, absDurTemp contains the *real* note duration (without the
// dots) and remainingDurTemp contains the part that should be expressed
// using dots.
if (remainingDurTmp != 0) {
// valuates the number of dots.
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);
}
|
java
|
private DurationDescription getAbsoluteDurationFor(Fraction relativeDuration)
throws IllegalArgumentException {
// This algorithm is closely linked to the way constants are defined
// in the Note class !!!
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;
}
}
}
// from here, absDurTemp contains the *real* note duration (without the
// dots) and remainingDurTemp contains the part that should be expressed
// using dots.
if (remainingDurTmp != 0) {
// valuates the number of dots.
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);
}
|
[
"private",
"DurationDescription",
"getAbsoluteDurationFor",
"(",
"Fraction",
"relativeDuration",
")",
"throws",
"IllegalArgumentException",
"{",
"// This algorithm is closely linked to the way constants are defined\r",
"// in the Note class !!!\r",
"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",
";",
"}",
"}",
"}",
"// from here, absDurTemp contains the *real* note duration (without the\r",
"// dots) and remainingDurTemp contains the part that should be expressed\r",
"// using dots.\r",
"if",
"(",
"remainingDurTmp",
"!=",
"0",
")",
"{",
"// valuates the number of dots.\r",
"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.
@return The absolute note duration for the specified relative note with
taking into account the default note length. ONLY Possible values
are {@link Note#LONG}, {@link Note#BREVE}, {@link Note#WHOLE},
{@link Note#HALF}, {@link Note#QUARTER}, {@link Note#EIGHTH},
{@link Note#SIXTEENTH}, {@link Note#THIRTY_SECOND},
{@link Note#SIXTY_FOURTH}.
Useful to convert notes such as : <IMG
src="./images/dottedcrotchet.gif"/>
@exception IllegalArgumentException
Thrown if the computing of the absolute note duration is
impossible.
|
[
"Returns",
"the",
"absolute",
"note",
"duration",
"for",
"the",
"specified",
"relative",
"note",
"with",
"taking",
"into",
"account",
"the",
"default",
"note",
"length",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcParserAbstract.java#L314-L367
|
10,269
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcParserAbstract.java
|
AbcParserAbstract.initNewTune
|
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();
}
|
java
|
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();
}
|
[
"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.
|
[
"Inits",
"all",
"attributes",
"that",
"are",
"related",
"to",
"one",
"parsing",
"sequence",
"ONLY",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcParserAbstract.java#L433-L444
|
10,270
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcParserAbstract.java
|
AbcParserAbstract.newAbcTuneBook
|
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;
}
|
java
|
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;
}
|
[
"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
|
[
"Instanciate",
"a",
"new",
"AbcTuneBook",
"and",
"transfere",
"TuneBookListeners",
"to",
"the",
"newly",
"created",
"object"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcParserAbstract.java#L450-L458
|
10,271
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java
|
JScoreElementAbstract.getBoundingBox
|
public Rectangle2D getBoundingBox() {
Rectangle2D bb = new Rectangle2D.Double(
m_base.getX(),
m_base.getY()-50,
getWidth(),
50);
return bb;
}
|
java
|
public Rectangle2D getBoundingBox() {
Rectangle2D bb = new Rectangle2D.Double(
m_base.getX(),
m_base.getY()-50,
getWidth(),
50);
return bb;
}
|
[
"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.
@return the bounding box for this score element.
|
[
"Returns",
"the",
"bounding",
"box",
"for",
"this",
"score",
"element",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java#L140-L147
|
10,272
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java
|
JScoreElementAbstract.getScoreElementAt
|
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;
}
|
java
|
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;
}
|
[
"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.
@param location A location.
@return The score element whose bouding box contains the
given location. <TT>this</TT> can be returned or one of the
sub <TT>JScoreElement</TT> contained in this one. <TT>null</TT>
is returned if no matching element has been found.
|
[
"Returns",
"the",
"score",
"element",
"whose",
"bouding",
"box",
"contains",
"the",
"given",
"location",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java#L156-L186
|
10,273
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java
|
JScoreElementAbstract.addDecoration
|
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);
}
}
|
java
|
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);
}
}
|
[
"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
|
[
"Add",
"decoration",
"if",
"it",
"hasn",
"t",
"been",
"added",
"previously"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java#L218-L226
|
10,274
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java
|
JScoreElementAbstract.setColor
|
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);
}
}
|
java
|
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);
}
}
|
[
"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.
|
[
"Set",
"the",
"color",
"for",
"renderer",
"get",
"color",
"value",
"in",
"the",
"score",
"template",
"or",
"apply",
"the",
"specified",
"color",
"for",
"the",
"current",
"element",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java#L276-L285
|
10,275
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java
|
JScoreElementAbstract.renderDebugBoundingBox
|
protected void renderDebugBoundingBox(Graphics2D context) {
/* */java.awt.Color previousColor = context.getColor();
context.setColor(java.awt.Color.RED);
context.draw(getBoundingBox());
context.setColor(previousColor);/* */
}
|
java
|
protected void renderDebugBoundingBox(Graphics2D context) {
/* */java.awt.Color previousColor = context.getColor();
context.setColor(java.awt.Color.RED);
context.draw(getBoundingBox());
context.setColor(previousColor);/* */
}
|
[
"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
|
[
"For",
"debugging",
"purpose",
"draw",
"the",
"bounding",
"box",
"of",
"the",
"element"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java#L412-L417
|
10,276
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java
|
JScoreElementAbstract.renderDebugBoundingBoxOuter
|
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);
}
|
java
|
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);
}
|
[
"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
|
[
"For",
"debugging",
"purpose",
"draw",
"the",
"outer",
"of",
"bounding",
"box",
"of",
"the",
"element"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreElementAbstract.java#L423-L430
|
10,277
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java
|
DashboardService.list
|
public Collection<Dashboard> list(List<String> queryParams)
{
return HTTP.GET("/v2/dashboards.json", null, queryParams, DASHBOARDS).get();
}
|
java
|
public Collection<Dashboard> list(List<String> queryParams)
{
return HTTP.GET("/v2/dashboards.json", null, queryParams, DASHBOARDS).get();
}
|
[
"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.
@param queryParams The query parameters
@return The set of dashboards
|
[
"Returns",
"the",
"set",
"of",
"dashboards",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java#L49-L52
|
10,278
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java
|
DashboardService.list
|
public Collection<Dashboard> list(String title)
{
return list(filters().title(title).build());
}
|
java
|
public Collection<Dashboard> list(String title)
{
return list(filters().title(title).build());
}
|
[
"public",
"Collection",
"<",
"Dashboard",
">",
"list",
"(",
"String",
"title",
")",
"{",
"return",
"list",
"(",
"filters",
"(",
")",
".",
"title",
"(",
"title",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] |
Returns the set of dashboards for the given title.
@param title The dashboard title
@return The set of dashboards
|
[
"Returns",
"the",
"set",
"of",
"dashboards",
"for",
"the",
"given",
"title",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java#L59-L62
|
10,279
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java
|
DashboardService.show
|
public Optional<Dashboard> show(long dashboardId)
{
return HTTP.GET(String.format("/v2/dashboards/%d.json", dashboardId), DASHBOARD);
}
|
java
|
public Optional<Dashboard> show(long dashboardId)
{
return HTTP.GET(String.format("/v2/dashboards/%d.json", dashboardId), DASHBOARD);
}
|
[
"public",
"Optional",
"<",
"Dashboard",
">",
"show",
"(",
"long",
"dashboardId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/dashboards/%d.json\"",
",",
"dashboardId",
")",
",",
"DASHBOARD",
")",
";",
"}"
] |
Returns the dashboard with the given id.
@param dashboardId The id of the dashboard to return
@return The dashboard
|
[
"Returns",
"the",
"dashboard",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java#L79-L82
|
10,280
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java
|
DashboardService.update
|
public Optional<Dashboard> update(Dashboard dashboard)
{
return HTTP.PUT(String.format("/v2/dashboards/%d.json", dashboard.getId()), dashboard, DASHBOARD);
}
|
java
|
public Optional<Dashboard> update(Dashboard dashboard)
{
return HTTP.PUT(String.format("/v2/dashboards/%d.json", dashboard.getId()), dashboard, DASHBOARD);
}
|
[
"public",
"Optional",
"<",
"Dashboard",
">",
"update",
"(",
"Dashboard",
"dashboard",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/dashboards/%d.json\"",
",",
"dashboard",
".",
"getId",
"(",
")",
")",
",",
"dashboard",
",",
"DASHBOARD",
")",
";",
"}"
] |
Updates the given dashboard.
@param dashboard The dashboard to update
@return The dashboard that was updated
|
[
"Updates",
"the",
"given",
"dashboard",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/DashboardService.java#L99-L102
|
10,281
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/alerts/policies/AlertPolicyChannel.java
|
AlertPolicyChannel.getChannelIdArray
|
public long[] getChannelIdArray()
{
long[] ret = new long[channelIds.size()];
for(int i = 0; i < channelIds.size(); i++)
ret[i] = channelIds.get(i);
return ret;
}
|
java
|
public long[] getChannelIdArray()
{
long[] ret = new long[channelIds.size()];
for(int i = 0; i < channelIds.size(); i++)
ret[i] = channelIds.get(i);
return ret;
}
|
[
"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.
@return The array of channel ids
|
[
"Returns",
"the",
"array",
"of",
"channel",
"ids",
"for",
"the",
"policy",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/alerts/policies/AlertPolicyChannel.java#L67-L73
|
10,282
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JNote.java
|
JNote.valuateNoteChars
|
protected void valuateNoteChars() {
short noteDuration = note.getStrictDuration();
if (note.isRest()){
noteChars = new char[] { getMusicalFont().getRestChar(noteDuration) };
//System.out.println("duration of the rest is " + noteDuration);
}
else {
if (isStemUp())
noteChars = new char[] { getMusicalFont().getNoteStemUpChar(noteDuration) };
else
noteChars = new char[] { getMusicalFont().getNoteStemDownChar(noteDuration) };
}
}
|
java
|
protected void valuateNoteChars() {
short noteDuration = note.getStrictDuration();
if (note.isRest()){
noteChars = new char[] { getMusicalFont().getRestChar(noteDuration) };
//System.out.println("duration of the rest is " + noteDuration);
}
else {
if (isStemUp())
noteChars = new char[] { getMusicalFont().getNoteStemUpChar(noteDuration) };
else
noteChars = new char[] { getMusicalFont().getNoteStemDownChar(noteDuration) };
}
}
|
[
"protected",
"void",
"valuateNoteChars",
"(",
")",
"{",
"short",
"noteDuration",
"=",
"note",
".",
"getStrictDuration",
"(",
")",
";",
"if",
"(",
"note",
".",
"isRest",
"(",
")",
")",
"{",
"noteChars",
"=",
"new",
"char",
"[",
"]",
"{",
"getMusicalFont",
"(",
")",
".",
"getRestChar",
"(",
"noteDuration",
")",
"}",
";",
"//System.out.println(\"duration of the rest is \" + noteDuration);\r",
"}",
"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.
@see #noteChars
|
[
"Sets",
"the",
"Unicode",
"value",
"of",
"the",
"note",
"as",
"a",
"char",
"array",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JNote.java#L97-L109
|
10,283
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JNote.java
|
JNote.setStemBeginPosition
|
public void setStemBeginPosition(Point2D newStemBeginPos) {
double xDelta = newStemBeginPos.getX() - getStemBeginPosition().getX();
double yDelta = newStemBeginPos.getY() - getStemBeginPosition().getY();
//System.out.println("translating " + this + " with " + xDelta + "/" + yDelta);
Point2D newBase = new Point2D.Double(getBase().getX()+xDelta, getBase().getY()+yDelta);
setBase(newBase);
}
|
java
|
public void setStemBeginPosition(Point2D newStemBeginPos) {
double xDelta = newStemBeginPos.getX() - getStemBeginPosition().getX();
double yDelta = newStemBeginPos.getY() - getStemBeginPosition().getY();
//System.out.println("translating " + this + " with " + xDelta + "/" + yDelta);
Point2D newBase = new Point2D.Double(getBase().getX()+xDelta, getBase().getY()+yDelta);
setBase(newBase);
}
|
[
"public",
"void",
"setStemBeginPosition",
"(",
"Point2D",
"newStemBeginPos",
")",
"{",
"double",
"xDelta",
"=",
"newStemBeginPos",
".",
"getX",
"(",
")",
"-",
"getStemBeginPosition",
"(",
")",
".",
"getX",
"(",
")",
";",
"double",
"yDelta",
"=",
"newStemBeginPos",
".",
"getY",
"(",
")",
"-",
"getStemBeginPosition",
"(",
")",
".",
"getY",
"(",
")",
";",
"//System.out.println(\"translating \" + this + \" with \" + xDelta + \"/\" + yDelta);\r",
"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 .
|
[
"Moves",
"the",
"note",
"to",
"a",
"new",
"position",
"in",
"order",
"to",
"set",
"the",
"new",
"stem",
"begin",
"position",
"to",
"the",
"new",
"location",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JNote.java#L152-L158
|
10,284
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/TimeSignature.java
|
TimeSignature.getDefaultNoteLength
|
public short getDefaultNoteLength() {
short currentNoteLength;
if (this.floatValue() < 0.75)
currentNoteLength = Note.SIXTEENTH;
else
currentNoteLength = Note.EIGHTH;
return currentNoteLength;
}
|
java
|
public short getDefaultNoteLength() {
short currentNoteLength;
if (this.floatValue() < 0.75)
currentNoteLength = Note.SIXTEENTH;
else
currentNoteLength = Note.EIGHTH;
return currentNoteLength;
}
|
[
"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.
@return The default note length for this time signature. The default note
length is equals to <TT>Note.SIXTEENTH</TT> when the time
signature decimal conversion value is strictly less than 0.75. If
it's higher, the default is <TT>Note.EIGHTH</TT>.
|
[
"Returns",
"the",
"default",
"note",
"length",
"for",
"this",
"time",
"signature",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TimeSignature.java#L84-L91
|
10,285
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationInstanceService.java
|
ApplicationInstanceService.list
|
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();
}
|
java
|
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();
}
|
[
"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.
@param applicationId The application id
@param queryParams The query parameters
@return The set of application instances
|
[
"Returns",
"the",
"set",
"of",
"application",
"instances",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationInstanceService.java#L51-L54
|
10,286
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationInstanceService.java
|
ApplicationInstanceService.show
|
public Optional<ApplicationInstance> show(long applicationId, long instanceId)
{
return HTTP.GET(String.format("/v2/applications/%d/instances/%d.json", applicationId, instanceId), APPLICATION_INSTANCE);
}
|
java
|
public Optional<ApplicationInstance> show(long applicationId, long instanceId)
{
return HTTP.GET(String.format("/v2/applications/%d/instances/%d.json", applicationId, instanceId), APPLICATION_INSTANCE);
}
|
[
"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.
@param applicationId The application id
@param instanceId The application instance id
@return The application instance
|
[
"Returns",
"the",
"application",
"instance",
"for",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationInstanceService.java#L72-L75
|
10,287
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Voice.java
|
Voice.getKey
|
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);
}
|
java
|
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);
}
|
[
"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.
@return The key signature of this tune.
|
[
"Returns",
"the",
"key",
"signature",
"of",
"this",
"tune",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Voice.java#L206-L212
|
10,288
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Voice.java
|
Voice.getLastNote
|
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;
}
|
java
|
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;
}
|
[
"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.
@return The last note that has been added to this score. <TT>null</TT>
if no note in this score.
|
[
"Returns",
"the",
"last",
"note",
"that",
"has",
"been",
"added",
"to",
"this",
"score",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Voice.java#L224-L234
|
10,289
|
Sciss/abc4j
|
abc/src/main/java/abc/midi/OldBasicMidiConverter.java
|
OldBasicMidiConverter.getMidiEventsFor
|
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;
// to be fixed : this can be a note or a multi note.
//if (tupletAsVector.elementAt(j) instanceof Note)
note = (Note)(tupletAsVector.elementAt(j));
//else
// note = (Note)((MultiNote)tupletAsVector.elementAt(j)).getNotesAsVector().elementAt(0);
long noteLength = getNoteLengthInTicks(note);//, defaultLength);
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);
}
/* else
if (tupletAsVector.elementAt(j) instanceof MultiNote)
{
events = getMidiEventsFor((MultiNote)tupletAsVector.elementAt(j), key, elapsedTime);
long noteLength = events[1+(events.length-1)/2].getTick()-events[0].getTick();
noteLength = (long)(noteLength * totalTupletLength / tuplet.countNotes());
for (int i=0; i<(events.length-1)/2-1; i++)
{
events[i].setTick(elapsedTime);
events[2*i+1].setTick(elapsedTime+noteLength);
}
}*/
}
return events;
}
|
java
|
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;
// to be fixed : this can be a note or a multi note.
//if (tupletAsVector.elementAt(j) instanceof Note)
note = (Note)(tupletAsVector.elementAt(j));
//else
// note = (Note)((MultiNote)tupletAsVector.elementAt(j)).getNotesAsVector().elementAt(0);
long noteLength = getNoteLengthInTicks(note);//, defaultLength);
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);
}
/* else
if (tupletAsVector.elementAt(j) instanceof MultiNote)
{
events = getMidiEventsFor((MultiNote)tupletAsVector.elementAt(j), key, elapsedTime);
long noteLength = events[1+(events.length-1)/2].getTick()-events[0].getTick();
noteLength = (long)(noteLength * totalTupletLength / tuplet.countNotes());
for (int i=0; i<(events.length-1)/2-1; i++)
{
events[i].setTick(elapsedTime);
events[2*i+1].setTick(elapsedTime+noteLength);
}
}*/
}
return events;
}
|
[
"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",
";",
"// to be fixed : this can be a note or a multi note.\r",
"//if (tupletAsVector.elementAt(j) instanceof Note)\r",
"note",
"=",
"(",
"Note",
")",
"(",
"tupletAsVector",
".",
"elementAt",
"(",
"j",
")",
")",
";",
"//else\r",
"// note = (Note)((MultiNote)tupletAsVector.elementAt(j)).getNotesAsVector().elementAt(0);\r",
"long",
"noteLength",
"=",
"getNoteLengthInTicks",
"(",
"note",
")",
";",
"//, defaultLength);\r",
"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",
")",
";",
"}",
"/* else\r\n if (tupletAsVector.elementAt(j) instanceof MultiNote)\r\n {\r\n events = getMidiEventsFor((MultiNote)tupletAsVector.elementAt(j), key, elapsedTime);\r\n long noteLength = events[1+(events.length-1)/2].getTick()-events[0].getTick();\r\n noteLength = (long)(noteLength * totalTupletLength / tuplet.countNotes());\r\n for (int i=0; i<(events.length-1)/2-1; i++)\r\n {\r\n events[i].setTick(elapsedTime);\r\n events[2*i+1].setTick(elapsedTime+noteLength);\r\n }\r\n }*/",
"}",
"return",
"events",
";",
"}"
] |
Returns the corresponding midi events for a tuplet.
|
[
"Returns",
"the",
"corresponding",
"midi",
"events",
"for",
"a",
"tuplet",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/midi/OldBasicMidiConverter.java#L55-L98
|
10,290
|
Sciss/abc4j
|
abc/src/main/java/abc/midi/OldBasicMidiConverter.java
|
OldBasicMidiConverter.getMidiEventsFor
|
public MidiEvent[] getMidiEventsFor(Tempo tempo, long lastPosInTicks) throws InvalidMidiDataException
{
TempoMessage mt = new TempoMessage(tempo);
MidiEvent me = new MidiEvent(mt,lastPosInTicks);
MidiEvent[] events = null;//{me, new MidiEvent(new TempoMessageWA(), lastPosInTicks)};
return events;
}
|
java
|
public MidiEvent[] getMidiEventsFor(Tempo tempo, long lastPosInTicks) throws InvalidMidiDataException
{
TempoMessage mt = new TempoMessage(tempo);
MidiEvent me = new MidiEvent(mt,lastPosInTicks);
MidiEvent[] events = null;//{me, new MidiEvent(new TempoMessageWA(), lastPosInTicks)};
return events;
}
|
[
"public",
"MidiEvent",
"[",
"]",
"getMidiEventsFor",
"(",
"Tempo",
"tempo",
",",
"long",
"lastPosInTicks",
")",
"throws",
"InvalidMidiDataException",
"{",
"TempoMessage",
"mt",
"=",
"new",
"TempoMessage",
"(",
"tempo",
")",
";",
"MidiEvent",
"me",
"=",
"new",
"MidiEvent",
"(",
"mt",
",",
"lastPosInTicks",
")",
";",
"MidiEvent",
"[",
"]",
"events",
"=",
"null",
";",
"//{me, new MidiEvent(new TempoMessageWA(), lastPosInTicks)};\r",
"return",
"events",
";",
"}"
] |
Returns the corresponding midi events for a tempo change.
|
[
"Returns",
"the",
"corresponding",
"midi",
"events",
"for",
"a",
"tempo",
"change",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/midi/OldBasicMidiConverter.java#L101-L107
|
10,291
|
Sciss/abc4j
|
abc/src/main/java/abc/midi/OldBasicMidiConverter.java
|
OldBasicMidiConverter.getMidiEventsFor
|
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);//, defaultLength);
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);//, defaultLength);
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;
}
|
java
|
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);//, defaultLength);
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);//, defaultLength);
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;
}
|
[
"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",
")",
";",
"//, defaultLength);\r",
"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",
")",
";",
"//, defaultLength);\r",
"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.
|
[
"Returns",
"the",
"corresponding",
"midi",
"events",
"for",
"a",
"multi",
"note",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/midi/OldBasicMidiConverter.java#L110-L140
|
10,292
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/httpclient/filters/QueryKeyFilter.java
|
QueryKeyFilter.filter
|
public void filter(ClientRequestContext request) throws IOException
{
if(!request.getHeaders().containsKey("X-Query-Key"))
request.getHeaders().add("X-Query-Key", this.querykey);
}
|
java
|
public void filter(ClientRequestContext request) throws IOException
{
if(!request.getHeaders().containsKey("X-Query-Key"))
request.getHeaders().add("X-Query-Key", this.querykey);
}
|
[
"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.
@param request The client request
|
[
"Adds",
"the",
"Query",
"key",
"to",
"the",
"client",
"request",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/httpclient/filters/QueryKeyFilter.java#L45-L49
|
10,293
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/httpclient/filters/ApiKeyFilter.java
|
ApiKeyFilter.filter
|
public void filter(ClientRequestContext request) throws IOException
{
if(!request.getHeaders().containsKey("X-Api-Key"))
request.getHeaders().add("X-Api-Key", this.apikey);
}
|
java
|
public void filter(ClientRequestContext request) throws IOException
{
if(!request.getHeaders().containsKey("X-Api-Key"))
request.getHeaders().add("X-Api-Key", this.apikey);
}
|
[
"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.
@param request The client request
|
[
"Adds",
"the",
"API",
"key",
"to",
"the",
"client",
"request",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/httpclient/filters/ApiKeyFilter.java#L45-L49
|
10,294
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreComponent.java
|
JScoreComponent.setSize
|
public void setSize(float size){
System.err.println("Warning! deprecated method setSize");
getTemplate().setAttributeSize(ScoreAttribute.NOTATION_SIZE, size, SizeUnit.PT);
}
|
java
|
public void setSize(float size){
System.err.println("Warning! deprecated method setSize");
getTemplate().setAttributeSize(ScoreAttribute.NOTATION_SIZE, size, SizeUnit.PT);
}
|
[
"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.
@param size The size of the font used to display the music score expressed in ?
@deprecated use {@link #getScoreMetrics() getScoreMetrics()}.{@link ScoreMetrics#setNotationFontSize(float) setNotationSize(float)} and then {@link #refresh()}
or better, set attribute {@link ScoreAttribute#NOTATION_SIZE} in template
|
[
"The",
"size",
"of",
"the",
"font",
"used",
"to",
"display",
"the",
"music",
"score",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L153-L156
|
10,295
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreComponent.java
|
JScoreComponent.writeScoreTo
|
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());//Color.WHITE);
bufferedImageGfx.fillRect(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight());
drawIn(bufferedImageGfx);
ImageIO.write(bufferedImage, "png", os);
}
|
java
|
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());//Color.WHITE);
bufferedImageGfx.fillRect(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight());
drawIn(bufferedImageGfx);
ImageIO.write(bufferedImage, "png", os);
}
|
[
"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",
"(",
")",
")",
";",
"//Color.WHITE);\r",
"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.
@param os The PNG output stream
@throws IOException Thrown if the given file cannot be accessed.
|
[
"Writes",
"the",
"currently",
"set",
"tune",
"score",
"to",
"a",
"PNG",
"output",
"stream",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L209-L219
|
10,296
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreComponent.java
|
JScoreComponent.writeScoreTo
|
public void writeScoreTo(File file) throws IOException {
FileOutputStream fos = new FileOutputStream(file);
try {
writeScoreTo(fos);
} finally {
fos.close();
}
}
|
java
|
public void writeScoreTo(File file) throws IOException {
FileOutputStream fos = new FileOutputStream(file);
try {
writeScoreTo(fos);
} finally {
fos.close();
}
}
|
[
"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.
@param file The PNG output file.
@throws IOException Thrown if the given file cannot be accessed.
|
[
"Writes",
"the",
"currently",
"set",
"tune",
"score",
"to",
"a",
"PNG",
"file",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L224-L231
|
10,297
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreComponent.java
|
JScoreComponent.setTune
|
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();
}
|
java
|
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();
}
|
[
"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.
@param tune The tune to be displayed.
|
[
"Sets",
"the",
"tune",
"to",
"be",
"renderered",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L251-L263
|
10,298
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreComponent.java
|
JScoreComponent.getScoreElementAt
|
public JScoreElement getScoreElementAt(Point location) {
if (m_jTune!=null)
return m_jTune.getScoreElementAt(location);
else
return null;
}
|
java
|
public JScoreElement getScoreElementAt(Point location) {
if (m_jTune!=null)
return m_jTune.getScoreElementAt(location);
else
return null;
}
|
[
"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.
@param location A point in the score.
@return The graphical score element found at the specified location.
<TT>null</TT> is returned if no item is found at the given location.
|
[
"Returns",
"the",
"graphical",
"score",
"element",
"fount",
"at",
"the",
"given",
"location",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L304-L309
|
10,299
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JScoreComponent.java
|
JScoreComponent.getRenditionElementFor
|
public JScoreElement getRenditionElementFor(MusicElement elmnt) {
if (m_jTune!=null)
//return (JScoreElement)m_jTune.getRenditionObjectsMapping().get(elmnt);
return m_jTune.getRenditionObjectFor(elmnt);
else
return null;
}
|
java
|
public JScoreElement getRenditionElementFor(MusicElement elmnt) {
if (m_jTune!=null)
//return (JScoreElement)m_jTune.getRenditionObjectsMapping().get(elmnt);
return m_jTune.getRenditionObjectFor(elmnt);
else
return null;
}
|
[
"public",
"JScoreElement",
"getRenditionElementFor",
"(",
"MusicElement",
"elmnt",
")",
"{",
"if",
"(",
"m_jTune",
"!=",
"null",
")",
"//return (JScoreElement)m_jTune.getRenditionObjectsMapping().get(elmnt);\r",
"return",
"m_jTune",
".",
"getRenditionObjectFor",
"(",
"elmnt",
")",
";",
"else",
"return",
"null",
";",
"}"
] |
Returns the graphical element that corresponds to a tune element.
@param elmnt A tune element.
@return The graphical score element that corresponds to the given
tune element. <TT>null</TT> is returned if the given tune element
does not have any graphical representation.
|
[
"Returns",
"the",
"graphical",
"element",
"that",
"corresponds",
"to",
"a",
"tune",
"element",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L376-L382
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.