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,300
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PluginComponentService.java
|
PluginComponentService.list
|
public Collection<PluginComponent> list(List<String> queryParams)
{
return HTTP.GET("/v2/components.json", null, queryParams, PLUGIN_COMPONENTS).get();
}
|
java
|
public Collection<PluginComponent> list(List<String> queryParams)
{
return HTTP.GET("/v2/components.json", null, queryParams, PLUGIN_COMPONENTS).get();
}
|
[
"public",
"Collection",
"<",
"PluginComponent",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/components.json\"",
",",
"null",
",",
"queryParams",
",",
"PLUGIN_COMPONENTS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of plugin components with the given query parameters.
@param queryParams The query parameters
@return The set of plugin components
|
[
"Returns",
"the",
"set",
"of",
"plugin",
"components",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PluginComponentService.java#L50-L53
|
10,301
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PluginComponentService.java
|
PluginComponentService.show
|
public Optional<PluginComponent> show(long componentId)
{
return HTTP.GET(String.format("/v2/components/%d.json", componentId), PLUGIN_COMPONENT);
}
|
java
|
public Optional<PluginComponent> show(long componentId)
{
return HTTP.GET(String.format("/v2/components/%d.json", componentId), PLUGIN_COMPONENT);
}
|
[
"public",
"Optional",
"<",
"PluginComponent",
">",
"show",
"(",
"long",
"componentId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/components/%d.json\"",
",",
"componentId",
")",
",",
"PLUGIN_COMPONENT",
")",
";",
"}"
] |
Returns the plugin component for the given id.
@param componentId The plugin component id
@return The plugin component
|
[
"Returns",
"the",
"plugin",
"component",
"for",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PluginComponentService.java#L69-L72
|
10,302
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/QueryService.java
|
QueryService.list
|
public Optional<QueryData> list(long accountId, String query)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("nrql", encode(query));
return HTTP.GET(String.format("/v1/accounts/%d/query", accountId), null, queryParams, QUERY_DATA);
}
|
java
|
public Optional<QueryData> list(long accountId, String query)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("nrql", encode(query));
return HTTP.GET(String.format("/v1/accounts/%d/query", accountId), null, queryParams, QUERY_DATA);
}
|
[
"public",
"Optional",
"<",
"QueryData",
">",
"list",
"(",
"long",
"accountId",
",",
"String",
"query",
")",
"{",
"QueryParameterList",
"queryParams",
"=",
"new",
"QueryParameterList",
"(",
")",
";",
"queryParams",
".",
"add",
"(",
"\"nrql\"",
",",
"encode",
"(",
"query",
")",
")",
";",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v1/accounts/%d/query\"",
",",
"accountId",
")",
",",
"null",
",",
"queryParams",
",",
"QUERY_DATA",
")",
";",
"}"
] |
Returns the set of data for a query.
@param accountId The id of the account to query
@param query The NRQL query to execute
@return The query data
|
[
"Returns",
"the",
"set",
"of",
"data",
"for",
"a",
"query",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/QueryService.java#L48-L53
|
10,303
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/labels/Label.java
|
Label.getKey
|
public static String getKey(String category, String name)
{
if(category != null && name != null)
return category+":"+name;
return null;
}
|
java
|
public static String getKey(String category, String name)
{
if(category != null && name != null)
return category+":"+name;
return null;
}
|
[
"public",
"static",
"String",
"getKey",
"(",
"String",
"category",
",",
"String",
"name",
")",
"{",
"if",
"(",
"category",
"!=",
"null",
"&&",
"name",
"!=",
"null",
")",
"return",
"category",
"+",
"\":\"",
"+",
"name",
";",
"return",
"null",
";",
"}"
] |
Sets the key of the label from the name and category.
@param category The category of the label
@param name The name of the label
@return The key in the format "category:name"
|
[
"Sets",
"the",
"key",
"of",
"the",
"label",
"from",
"the",
"name",
"and",
"category",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/labels/Label.java#L123-L128
|
10,304
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertIncidentService.java
|
AlertIncidentService.list
|
public Collection<AlertIncident> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_incidents.json", null, queryParams, ALERT_INCIDENTS).get();
}
|
java
|
public Collection<AlertIncident> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_incidents.json", null, queryParams, ALERT_INCIDENTS).get();
}
|
[
"public",
"Collection",
"<",
"AlertIncident",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/alerts_incidents.json\"",
",",
"null",
",",
"queryParams",
",",
"ALERT_INCIDENTS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of alert incidents with the given query parameters.
@param queryParams The query parameters
@return The set of alert incidents
|
[
"Returns",
"the",
"set",
"of",
"alert",
"incidents",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertIncidentService.java#L47-L50
|
10,305
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ExternalServiceAlertConditionService.java
|
ExternalServiceAlertConditionService.create
|
public Optional<ExternalServiceAlertCondition> create(long policyId, ExternalServiceAlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_external_service_conditions/policies/%d.json", policyId), condition, EXTERNAL_SERVICE_ALERT_CONDITION);
}
|
java
|
public Optional<ExternalServiceAlertCondition> create(long policyId, ExternalServiceAlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_external_service_conditions/policies/%d.json", policyId), condition, EXTERNAL_SERVICE_ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"ExternalServiceAlertCondition",
">",
"create",
"(",
"long",
"policyId",
",",
"ExternalServiceAlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"POST",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_external_service_conditions/policies/%d.json\"",
",",
"policyId",
")",
",",
"condition",
",",
"EXTERNAL_SERVICE_ALERT_CONDITION",
")",
";",
"}"
] |
Creates the given external service alert condition.
@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",
"external",
"service",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ExternalServiceAlertConditionService.java#L108-L111
|
10,306
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ExternalServiceAlertConditionService.java
|
ExternalServiceAlertConditionService.update
|
public Optional<ExternalServiceAlertCondition> update(ExternalServiceAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_external_service_conditions/%d.json", condition.getId()), condition, EXTERNAL_SERVICE_ALERT_CONDITION);
}
|
java
|
public Optional<ExternalServiceAlertCondition> update(ExternalServiceAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_external_service_conditions/%d.json", condition.getId()), condition, EXTERNAL_SERVICE_ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"ExternalServiceAlertCondition",
">",
"update",
"(",
"ExternalServiceAlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_external_service_conditions/%d.json\"",
",",
"condition",
".",
"getId",
"(",
")",
")",
",",
"condition",
",",
"EXTERNAL_SERVICE_ALERT_CONDITION",
")",
";",
"}"
] |
Updates the given external service alert condition.
@param condition The alert condition to update
@return The alert condition that was updated
|
[
"Updates",
"the",
"given",
"external",
"service",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ExternalServiceAlertConditionService.java#L118-L121
|
10,307
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/DecorableElement.java
|
DecorableElement.hasDecoration
|
public boolean hasDecoration(byte decorationType) {
if (hasDecorations()) {
for (Decoration m_decoration : m_decorations) {
if (m_decoration.isType(decorationType))
return true;
}
}
return false;
}
|
java
|
public boolean hasDecoration(byte decorationType) {
if (hasDecorations()) {
for (Decoration m_decoration : m_decorations) {
if (m_decoration.isType(decorationType))
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"hasDecoration",
"(",
"byte",
"decorationType",
")",
"{",
"if",
"(",
"hasDecorations",
"(",
")",
")",
"{",
"for",
"(",
"Decoration",
"m_decoration",
":",
"m_decorations",
")",
"{",
"if",
"(",
"m_decoration",
".",
"isType",
"(",
"decorationType",
")",
")",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Test if the element has the specified type of decoration
@param decorationType
{@link Decoration#DOWNBOW}, {@link Decoration#STACCATO}...
|
[
"Test",
"if",
"the",
"element",
"has",
"the",
"specified",
"type",
"of",
"decoration"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/DecorableElement.java#L125-L133
|
10,308
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/alerts/policies/AlertPolicy.java
|
AlertPolicy.setChannelIds
|
public void setChannelIds(List<Long> channelIds)
{
setChannels(AlertPolicyChannel.builder().channelIds(channelIds).build());
}
|
java
|
public void setChannelIds(List<Long> channelIds)
{
setChannels(AlertPolicyChannel.builder().channelIds(channelIds).build());
}
|
[
"public",
"void",
"setChannelIds",
"(",
"List",
"<",
"Long",
">",
"channelIds",
")",
"{",
"setChannels",
"(",
"AlertPolicyChannel",
".",
"builder",
"(",
")",
".",
"channelIds",
"(",
"channelIds",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] |
Sets the channels for the policy.
@param channelIds The channels for the policy
|
[
"Sets",
"the",
"channels",
"for",
"the",
"policy",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/alerts/policies/AlertPolicy.java#L112-L115
|
10,309
|
Sciss/abc4j
|
abc/src/main/java/abc/audio/BeforeAudioRendition.java
|
BeforeAudioRendition.correctPartsKeys
|
public static Music correctPartsKeys(Music music) {
//we may have key/clef changes
//repeat operation for each voice. Key is for all voices
//but clef can change from one voice to another
for (Object o : music.getVoices()) {
Voice voice = (Voice) o;
if (voice.hasObject(KeySignature.class)
&& voice.hasObject(PartLabel.class)) {
Hashtable partsKey = new Hashtable();
KeySignature tuneKey = null;
int size = voice.size();
int i = 0;
while (i < size) {
MusicElement me = (MusicElement) voice.elementAt(i);
if (me instanceof KeySignature) {
tuneKey = (KeySignature) me;
} else if (me instanceof PartLabel) {
PartLabel pl = (PartLabel) me;
if ((tuneKey != null) && (partsKey.get(pl.getLabel() + "") == null)) {
//first time we see this part, store the key
partsKey.put(pl.getLabel() + "", tuneKey);
} else {//not the first time we see this part
//add the key
tuneKey = (KeySignature) partsKey.get(pl.getLabel() + "");
if (i < (size - 1)) {
if (!(voice.elementAt(i + 1) instanceof KeySignature)) {
//if next element is a key, no need to insert one
//just before, next while step it'll be defined as
//tuneKey
voice.insertElementAt(tuneKey, i + 1);
i++;
size++;
}
}
}
}
i++;
}//end for each element of voice
}//end voice has key(s) and part(s)
}//end for each voice of music
//else nothing to do
return music;
}
|
java
|
public static Music correctPartsKeys(Music music) {
//we may have key/clef changes
//repeat operation for each voice. Key is for all voices
//but clef can change from one voice to another
for (Object o : music.getVoices()) {
Voice voice = (Voice) o;
if (voice.hasObject(KeySignature.class)
&& voice.hasObject(PartLabel.class)) {
Hashtable partsKey = new Hashtable();
KeySignature tuneKey = null;
int size = voice.size();
int i = 0;
while (i < size) {
MusicElement me = (MusicElement) voice.elementAt(i);
if (me instanceof KeySignature) {
tuneKey = (KeySignature) me;
} else if (me instanceof PartLabel) {
PartLabel pl = (PartLabel) me;
if ((tuneKey != null) && (partsKey.get(pl.getLabel() + "") == null)) {
//first time we see this part, store the key
partsKey.put(pl.getLabel() + "", tuneKey);
} else {//not the first time we see this part
//add the key
tuneKey = (KeySignature) partsKey.get(pl.getLabel() + "");
if (i < (size - 1)) {
if (!(voice.elementAt(i + 1) instanceof KeySignature)) {
//if next element is a key, no need to insert one
//just before, next while step it'll be defined as
//tuneKey
voice.insertElementAt(tuneKey, i + 1);
i++;
size++;
}
}
}
}
i++;
}//end for each element of voice
}//end voice has key(s) and part(s)
}//end for each voice of music
//else nothing to do
return music;
}
|
[
"public",
"static",
"Music",
"correctPartsKeys",
"(",
"Music",
"music",
")",
"{",
"//we may have key/clef changes\r",
"//repeat operation for each voice. Key is for all voices\r",
"//but clef can change from one voice to another\r",
"for",
"(",
"Object",
"o",
":",
"music",
".",
"getVoices",
"(",
")",
")",
"{",
"Voice",
"voice",
"=",
"(",
"Voice",
")",
"o",
";",
"if",
"(",
"voice",
".",
"hasObject",
"(",
"KeySignature",
".",
"class",
")",
"&&",
"voice",
".",
"hasObject",
"(",
"PartLabel",
".",
"class",
")",
")",
"{",
"Hashtable",
"partsKey",
"=",
"new",
"Hashtable",
"(",
")",
";",
"KeySignature",
"tuneKey",
"=",
"null",
";",
"int",
"size",
"=",
"voice",
".",
"size",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"size",
")",
"{",
"MusicElement",
"me",
"=",
"(",
"MusicElement",
")",
"voice",
".",
"elementAt",
"(",
"i",
")",
";",
"if",
"(",
"me",
"instanceof",
"KeySignature",
")",
"{",
"tuneKey",
"=",
"(",
"KeySignature",
")",
"me",
";",
"}",
"else",
"if",
"(",
"me",
"instanceof",
"PartLabel",
")",
"{",
"PartLabel",
"pl",
"=",
"(",
"PartLabel",
")",
"me",
";",
"if",
"(",
"(",
"tuneKey",
"!=",
"null",
")",
"&&",
"(",
"partsKey",
".",
"get",
"(",
"pl",
".",
"getLabel",
"(",
")",
"+",
"\"\"",
")",
"==",
"null",
")",
")",
"{",
"//first time we see this part, store the key\r",
"partsKey",
".",
"put",
"(",
"pl",
".",
"getLabel",
"(",
")",
"+",
"\"\"",
",",
"tuneKey",
")",
";",
"}",
"else",
"{",
"//not the first time we see this part\r",
"//add the key\r",
"tuneKey",
"=",
"(",
"KeySignature",
")",
"partsKey",
".",
"get",
"(",
"pl",
".",
"getLabel",
"(",
")",
"+",
"\"\"",
")",
";",
"if",
"(",
"i",
"<",
"(",
"size",
"-",
"1",
")",
")",
"{",
"if",
"(",
"!",
"(",
"voice",
".",
"elementAt",
"(",
"i",
"+",
"1",
")",
"instanceof",
"KeySignature",
")",
")",
"{",
"//if next element is a key, no need to insert one\r",
"//just before, next while step it'll be defined as\r",
"//tuneKey\r",
"voice",
".",
"insertElementAt",
"(",
"tuneKey",
",",
"i",
"+",
"1",
")",
";",
"i",
"++",
";",
"size",
"++",
";",
"}",
"}",
"}",
"}",
"i",
"++",
";",
"}",
"//end for each element of voice\r",
"}",
"//end voice has key(s) and part(s)\r",
"}",
"//end for each voice of music\r",
"//else nothing to do\r",
"return",
"music",
";",
"}"
] |
Be sure each part has it's proper key signature.
Imagine... you have
<code>K:Bb
P:A
...
P:B
...
P:C
K:G
...</code>
in a <tt>ABCA</tt> structure, the last part A will have
the G key of part C.
This method corrects this, the key was Bb before the
first part A, so before the second part A we add a Bb
key.
|
[
"Be",
"sure",
"each",
"part",
"has",
"it",
"s",
"proper",
"key",
"signature",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/audio/BeforeAudioRendition.java#L63-L105
|
10,310
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PluginsAlertConditionService.java
|
PluginsAlertConditionService.create
|
public Optional<PluginsAlertCondition> create(long policyId, PluginsAlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_plugins_conditions/policies/%d.json", policyId), condition, PLUGINS_ALERT_CONDITION);
}
|
java
|
public Optional<PluginsAlertCondition> create(long policyId, PluginsAlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_plugins_conditions/policies/%d.json", policyId), condition, PLUGINS_ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"PluginsAlertCondition",
">",
"create",
"(",
"long",
"policyId",
",",
"PluginsAlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"POST",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_plugins_conditions/policies/%d.json\"",
",",
"policyId",
")",
",",
"condition",
",",
"PLUGINS_ALERT_CONDITION",
")",
";",
"}"
] |
Creates the given Plugins alert condition.
@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",
"Plugins",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PluginsAlertConditionService.java#L108-L111
|
10,311
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PluginsAlertConditionService.java
|
PluginsAlertConditionService.update
|
public Optional<PluginsAlertCondition> update(PluginsAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_plugins_conditions/%d.json", condition.getId()), condition, PLUGINS_ALERT_CONDITION);
}
|
java
|
public Optional<PluginsAlertCondition> update(PluginsAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_plugins_conditions/%d.json", condition.getId()), condition, PLUGINS_ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"PluginsAlertCondition",
">",
"update",
"(",
"PluginsAlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_plugins_conditions/%d.json\"",
",",
"condition",
".",
"getId",
"(",
")",
")",
",",
"condition",
",",
"PLUGINS_ALERT_CONDITION",
")",
";",
"}"
] |
Updates the given Plugins alert condition.
@param condition The alert condition to update
@return The alert condition that was updated
|
[
"Updates",
"the",
"given",
"Plugins",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PluginsAlertConditionService.java#L118-L121
|
10,312
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/DeploymentService.java
|
DeploymentService.list
|
public Collection<Deployment> list(long applicationId, List<String> queryParams)
{
return HTTP.GET(String.format("/v2/applications/%d/deployments.json", applicationId), null, queryParams, DEPLOYMENTS).get();
}
|
java
|
public Collection<Deployment> list(long applicationId, List<String> queryParams)
{
return HTTP.GET(String.format("/v2/applications/%d/deployments.json", applicationId), null, queryParams, DEPLOYMENTS).get();
}
|
[
"public",
"Collection",
"<",
"Deployment",
">",
"list",
"(",
"long",
"applicationId",
",",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/applications/%d/deployments.json\"",
",",
"applicationId",
")",
",",
"null",
",",
"queryParams",
",",
"DEPLOYMENTS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of deployments.
@param applicationId The application id for the deployments
@param queryParams The query parameters
@return The set of deployments
|
[
"Returns",
"the",
"set",
"of",
"deployments",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/DeploymentService.java#L49-L52
|
10,313
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/DeploymentService.java
|
DeploymentService.create
|
public Optional<Deployment> create(long applicationId, Deployment deployment)
{
return HTTP.POST(String.format("/v2/applications/%d/deployments.json", applicationId), deployment, DEPLOYMENT);
}
|
java
|
public Optional<Deployment> create(long applicationId, Deployment deployment)
{
return HTTP.POST(String.format("/v2/applications/%d/deployments.json", applicationId), deployment, DEPLOYMENT);
}
|
[
"public",
"Optional",
"<",
"Deployment",
">",
"create",
"(",
"long",
"applicationId",
",",
"Deployment",
"deployment",
")",
"{",
"return",
"HTTP",
".",
"POST",
"(",
"String",
".",
"format",
"(",
"\"/v2/applications/%d/deployments.json\"",
",",
"applicationId",
")",
",",
"deployment",
",",
"DEPLOYMENT",
")",
";",
"}"
] |
Creates the given deployment.
@param applicationId The application id for the deployments
@param deployment The deployment to create
@return The deployment that was created
|
[
"Creates",
"the",
"given",
"deployment",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/DeploymentService.java#L90-L93
|
10,314
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/DeploymentService.java
|
DeploymentService.delete
|
public DeploymentService delete(long applicationId, long deploymentId)
{
HTTP.DELETE(String.format("/v2/applications/%d/deployments/%d.json", applicationId, deploymentId));
return this;
}
|
java
|
public DeploymentService delete(long applicationId, long deploymentId)
{
HTTP.DELETE(String.format("/v2/applications/%d/deployments/%d.json", applicationId, deploymentId));
return this;
}
|
[
"public",
"DeploymentService",
"delete",
"(",
"long",
"applicationId",
",",
"long",
"deploymentId",
")",
"{",
"HTTP",
".",
"DELETE",
"(",
"String",
".",
"format",
"(",
"\"/v2/applications/%d/deployments/%d.json\"",
",",
"applicationId",
",",
"deploymentId",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Deletes the deployment with the given id.
@param applicationId The application id for the deployments
@param deploymentId The id of the deployment to delete
@return This object
|
[
"Deletes",
"the",
"deployment",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/DeploymentService.java#L101-L105
|
10,315
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/InventoryData.java
|
InventoryData.addSource
|
public void addSource(String source)
{
if(this.sources == null)
this.sources = new ArrayList<String>();
this.sources.add(source);
}
|
java
|
public void addSource(String source)
{
if(this.sources == null)
this.sources = new ArrayList<String>();
this.sources.add(source);
}
|
[
"public",
"void",
"addSource",
"(",
"String",
"source",
")",
"{",
"if",
"(",
"this",
".",
"sources",
"==",
"null",
")",
"this",
".",
"sources",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"this",
".",
"sources",
".",
"add",
"(",
"source",
")",
";",
"}"
] |
Adds the given source to the list of sources for the widget.
@param source The source to add to the list of sources
|
[
"Adds",
"the",
"given",
"source",
"to",
"the",
"list",
"of",
"sources",
"for",
"the",
"widget",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/InventoryData.java#L59-L64
|
10,316
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/InventoryData.java
|
InventoryData.addFilter
|
public void addFilter(String name, String value)
{
if(this.filters == null)
this.filters = new HashMap<String,String>();
this.filters.put(name, value);
}
|
java
|
public void addFilter(String name, String value)
{
if(this.filters == null)
this.filters = new HashMap<String,String>();
this.filters.put(name, value);
}
|
[
"public",
"void",
"addFilter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"filters",
"==",
"null",
")",
"this",
".",
"filters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"this",
".",
"filters",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] |
Adds the given filter to the list of filters for the widget.
@param name The name of the filter to add
@param value The value of the filter to add
|
[
"Adds",
"the",
"given",
"filter",
"to",
"the",
"list",
"of",
"filters",
"for",
"the",
"widget",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/InventoryData.java#L89-L94
|
10,317
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.getLongestNote
|
public static Note getLongestNote(Note[] notes) {
float length = 0;
float currentNoteLength = 0;
Note maxNote = null;
for (int i=0; i<notes.length && maxNote==null; i++) {
currentNoteLength = notes[i].getDuration();
if (currentNoteLength > length)
maxNote = notes[i];
}
return maxNote;
}
|
java
|
public static Note getLongestNote(Note[] notes) {
float length = 0;
float currentNoteLength = 0;
Note maxNote = null;
for (int i=0; i<notes.length && maxNote==null; i++) {
currentNoteLength = notes[i].getDuration();
if (currentNoteLength > length)
maxNote = notes[i];
}
return maxNote;
}
|
[
"public",
"static",
"Note",
"getLongestNote",
"(",
"Note",
"[",
"]",
"notes",
")",
"{",
"float",
"length",
"=",
"0",
";",
"float",
"currentNoteLength",
"=",
"0",
";",
"Note",
"maxNote",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"notes",
".",
"length",
"&&",
"maxNote",
"==",
"null",
";",
"i",
"++",
")",
"{",
"currentNoteLength",
"=",
"notes",
"[",
"i",
"]",
".",
"getDuration",
"(",
")",
";",
"if",
"(",
"currentNoteLength",
">",
"length",
")",
"maxNote",
"=",
"notes",
"[",
"i",
"]",
";",
"}",
"return",
"maxNote",
";",
"}"
] |
Returns the note with the biggest duration from the given array of notes.
@param notes An array of notes.
@return The note with the biggest duration from the given array of notes.
@see Note#getDuration()
|
[
"Returns",
"the",
"note",
"with",
"the",
"biggest",
"duration",
"from",
"the",
"given",
"array",
"of",
"notes",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L71-L81
|
10,318
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.getNotesShorterThan
|
public static Note[] getNotesShorterThan(Note[] notes, int aStrictDuration) {
Vector shorterNotes = new Vector();
Note[] notesArray =null;
for (Note note : notes) {
if (note.getStrictDuration() < aStrictDuration)
shorterNotes.addElement(note);
}
if (shorterNotes.size()>0) {
notesArray = new Note[shorterNotes.size()];
shorterNotes.toArray(notesArray);
}
return notesArray;
}
|
java
|
public static Note[] getNotesShorterThan(Note[] notes, int aStrictDuration) {
Vector shorterNotes = new Vector();
Note[] notesArray =null;
for (Note note : notes) {
if (note.getStrictDuration() < aStrictDuration)
shorterNotes.addElement(note);
}
if (shorterNotes.size()>0) {
notesArray = new Note[shorterNotes.size()];
shorterNotes.toArray(notesArray);
}
return notesArray;
}
|
[
"public",
"static",
"Note",
"[",
"]",
"getNotesShorterThan",
"(",
"Note",
"[",
"]",
"notes",
",",
"int",
"aStrictDuration",
")",
"{",
"Vector",
"shorterNotes",
"=",
"new",
"Vector",
"(",
")",
";",
"Note",
"[",
"]",
"notesArray",
"=",
"null",
";",
"for",
"(",
"Note",
"note",
":",
"notes",
")",
"{",
"if",
"(",
"note",
".",
"getStrictDuration",
"(",
")",
"<",
"aStrictDuration",
")",
"shorterNotes",
".",
"addElement",
"(",
"note",
")",
";",
"}",
"if",
"(",
"shorterNotes",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"notesArray",
"=",
"new",
"Note",
"[",
"shorterNotes",
".",
"size",
"(",
")",
"]",
";",
"shorterNotes",
".",
"toArray",
"(",
"notesArray",
")",
";",
"}",
"return",
"notesArray",
";",
"}"
] |
Returns all notes strictly shorter than the given strict duration.
@param notes An arry of notes.
@param aStrictDuration A strict duration (use constants defined class Note)
@return All notes strictly shorter than the given strict duration. <TT>null</TT>
is returned is no note if shorter than the given strict duration.
@see Note#getStrictDuration()
|
[
"Returns",
"all",
"notes",
"strictly",
"shorter",
"than",
"the",
"given",
"strict",
"duration",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L89-L101
|
10,319
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.getLowestNote
|
public static Note getLowestNote(Note[] notes) {
Note lowestNote = notes[0];
for (int i=1; i<notes.length; i++)
if (notes[i].isLowerThan(lowestNote))
lowestNote = notes[i];
return lowestNote;
}
|
java
|
public static Note getLowestNote(Note[] notes) {
Note lowestNote = notes[0];
for (int i=1; i<notes.length; i++)
if (notes[i].isLowerThan(lowestNote))
lowestNote = notes[i];
return lowestNote;
}
|
[
"public",
"static",
"Note",
"getLowestNote",
"(",
"Note",
"[",
"]",
"notes",
")",
"{",
"Note",
"lowestNote",
"=",
"notes",
"[",
"0",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"notes",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"notes",
"[",
"i",
"]",
".",
"isLowerThan",
"(",
"lowestNote",
")",
")",
"lowestNote",
"=",
"notes",
"[",
"i",
"]",
";",
"return",
"lowestNote",
";",
"}"
] |
Returns the lowest note from the given array of notes.
@param notes An array of notes.
@return The lowest note from the given array of notes.
@see Note#isLowerThan(Note)
|
[
"Returns",
"the",
"lowest",
"note",
"from",
"the",
"given",
"array",
"of",
"notes",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L107-L113
|
10,320
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.getHighestNote
|
public static Note getHighestNote(Note[] notes) {
Note highestNote = notes[0];
for (int i=1; i<notes.length; i++)
if (notes[i].isHigherThan(highestNote))
highestNote = notes[i];
return highestNote;
}
|
java
|
public static Note getHighestNote(Note[] notes) {
Note highestNote = notes[0];
for (int i=1; i<notes.length; i++)
if (notes[i].isHigherThan(highestNote))
highestNote = notes[i];
return highestNote;
}
|
[
"public",
"static",
"Note",
"getHighestNote",
"(",
"Note",
"[",
"]",
"notes",
")",
"{",
"Note",
"highestNote",
"=",
"notes",
"[",
"0",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"notes",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"notes",
"[",
"i",
"]",
".",
"isHigherThan",
"(",
"highestNote",
")",
")",
"highestNote",
"=",
"notes",
"[",
"i",
"]",
";",
"return",
"highestNote",
";",
"}"
] |
Returns the highest note from the given array of notes.
@param notes An array of notes.
@return The highes note from the given array of notes.
@see Note#isHigherThan(Note)
|
[
"Returns",
"the",
"highest",
"note",
"from",
"the",
"given",
"array",
"of",
"notes",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L119-L125
|
10,321
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.getHighestNote
|
public Note getHighestNote() {
Note highestNote = (Note)m_notes.elementAt(0);
//short highestHeight = highestNote.getHeight();
//short currentNoteLength = 0;
for (int i=1; i<m_notes.size(); i++)
if (((Note)(m_notes.elementAt(i))).isHigherThan(highestNote))
highestNote = (Note)m_notes.elementAt(i);
return highestNote;
}
|
java
|
public Note getHighestNote() {
Note highestNote = (Note)m_notes.elementAt(0);
//short highestHeight = highestNote.getHeight();
//short currentNoteLength = 0;
for (int i=1; i<m_notes.size(); i++)
if (((Note)(m_notes.elementAt(i))).isHigherThan(highestNote))
highestNote = (Note)m_notes.elementAt(i);
return highestNote;
}
|
[
"public",
"Note",
"getHighestNote",
"(",
")",
"{",
"Note",
"highestNote",
"=",
"(",
"Note",
")",
"m_notes",
".",
"elementAt",
"(",
"0",
")",
";",
"//short highestHeight = highestNote.getHeight();\r",
"//short currentNoteLength = 0;\r",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"m_notes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"if",
"(",
"(",
"(",
"Note",
")",
"(",
"m_notes",
".",
"elementAt",
"(",
"i",
")",
")",
")",
".",
"isHigherThan",
"(",
"highestNote",
")",
")",
"highestNote",
"=",
"(",
"Note",
")",
"m_notes",
".",
"elementAt",
"(",
"i",
")",
";",
"return",
"highestNote",
";",
"}"
] |
Returns the highest note among the notes composing this multi note.
@return The highest note among the notes composing this multi note.
@see #getLowestNote()
@see Note#isHigherThan(Note)
|
[
"Returns",
"the",
"highest",
"note",
"among",
"the",
"notes",
"composing",
"this",
"multi",
"note",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L147-L155
|
10,322
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.getNotesBeginningTie
|
public Note[] getNotesBeginningTie() {
Vector notesBT = new Vector(m_notes.size());
for (int i=0; i<m_notes.size(); i++)
if (((Note)m_notes.elementAt(i)).isBeginningTie())
notesBT.addElement(m_notes.elementAt(i));
if (notesBT.size()>0) {
Note[] notesBTasArray = new Note[notesBT.size()];
notesBT.toArray(notesBTasArray);
return notesBTasArray;
}
else
return null;
}
|
java
|
public Note[] getNotesBeginningTie() {
Vector notesBT = new Vector(m_notes.size());
for (int i=0; i<m_notes.size(); i++)
if (((Note)m_notes.elementAt(i)).isBeginningTie())
notesBT.addElement(m_notes.elementAt(i));
if (notesBT.size()>0) {
Note[] notesBTasArray = new Note[notesBT.size()];
notesBT.toArray(notesBTasArray);
return notesBTasArray;
}
else
return null;
}
|
[
"public",
"Note",
"[",
"]",
"getNotesBeginningTie",
"(",
")",
"{",
"Vector",
"notesBT",
"=",
"new",
"Vector",
"(",
"m_notes",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_notes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"if",
"(",
"(",
"(",
"Note",
")",
"m_notes",
".",
"elementAt",
"(",
"i",
")",
")",
".",
"isBeginningTie",
"(",
")",
")",
"notesBT",
".",
"addElement",
"(",
"m_notes",
".",
"elementAt",
"(",
"i",
")",
")",
";",
"if",
"(",
"notesBT",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"Note",
"[",
"]",
"notesBTasArray",
"=",
"new",
"Note",
"[",
"notesBT",
".",
"size",
"(",
")",
"]",
";",
"notesBT",
".",
"toArray",
"(",
"notesBTasArray",
")",
";",
"return",
"notesBTasArray",
";",
"}",
"else",
"return",
"null",
";",
"}"
] |
Returns the notes from this multinote that begin a tie.
@return Te notes from this multinote that begin a tie. <TT>null</TT> is
returned if no note begins a tie.
@see Note#isBeginningTie()
|
[
"Returns",
"the",
"notes",
"from",
"this",
"multinote",
"that",
"begin",
"a",
"tie",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L161-L173
|
10,323
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.getStrictDurations
|
public short[] getStrictDurations() {
Vector durations = new Vector();
short currentDuration = 0;
for (int i=0; i<m_notes.size(); i++) {
currentDuration = ((Note)(m_notes.elementAt(i))).getStrictDuration();
if (durations.indexOf(new Short(currentDuration))==-1)
durations.addElement(currentDuration);
}
if (durations.size()==0)
return null;
else {
//sort the durations
Vector sortedDurations = new Vector();
for (int i=0; i<durations.size(); i++) {
int j=0;
while (j<sortedDurations.size()
&& (Short) sortedDurations.elementAt(j) <
((Short) durations.elementAt(i))
)
j++;
sortedDurations.insertElementAt(durations.elementAt(i),j);
}
short[] durationsAsArray = new short[sortedDurations.size()];
for (int i=0; i<sortedDurations.size(); i++)
durationsAsArray [i] = (Short) sortedDurations.elementAt(i);
return durationsAsArray;
}
}
|
java
|
public short[] getStrictDurations() {
Vector durations = new Vector();
short currentDuration = 0;
for (int i=0; i<m_notes.size(); i++) {
currentDuration = ((Note)(m_notes.elementAt(i))).getStrictDuration();
if (durations.indexOf(new Short(currentDuration))==-1)
durations.addElement(currentDuration);
}
if (durations.size()==0)
return null;
else {
//sort the durations
Vector sortedDurations = new Vector();
for (int i=0; i<durations.size(); i++) {
int j=0;
while (j<sortedDurations.size()
&& (Short) sortedDurations.elementAt(j) <
((Short) durations.elementAt(i))
)
j++;
sortedDurations.insertElementAt(durations.elementAt(i),j);
}
short[] durationsAsArray = new short[sortedDurations.size()];
for (int i=0; i<sortedDurations.size(); i++)
durationsAsArray [i] = (Short) sortedDurations.elementAt(i);
return durationsAsArray;
}
}
|
[
"public",
"short",
"[",
"]",
"getStrictDurations",
"(",
")",
"{",
"Vector",
"durations",
"=",
"new",
"Vector",
"(",
")",
";",
"short",
"currentDuration",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_notes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"currentDuration",
"=",
"(",
"(",
"Note",
")",
"(",
"m_notes",
".",
"elementAt",
"(",
"i",
")",
")",
")",
".",
"getStrictDuration",
"(",
")",
";",
"if",
"(",
"durations",
".",
"indexOf",
"(",
"new",
"Short",
"(",
"currentDuration",
")",
")",
"==",
"-",
"1",
")",
"durations",
".",
"addElement",
"(",
"currentDuration",
")",
";",
"}",
"if",
"(",
"durations",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"else",
"{",
"//sort the durations\r",
"Vector",
"sortedDurations",
"=",
"new",
"Vector",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"durations",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"j",
"=",
"0",
";",
"while",
"(",
"j",
"<",
"sortedDurations",
".",
"size",
"(",
")",
"&&",
"(",
"Short",
")",
"sortedDurations",
".",
"elementAt",
"(",
"j",
")",
"<",
"(",
"(",
"Short",
")",
"durations",
".",
"elementAt",
"(",
"i",
")",
")",
")",
"j",
"++",
";",
"sortedDurations",
".",
"insertElementAt",
"(",
"durations",
".",
"elementAt",
"(",
"i",
")",
",",
"j",
")",
";",
"}",
"short",
"[",
"]",
"durationsAsArray",
"=",
"new",
"short",
"[",
"sortedDurations",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sortedDurations",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"durationsAsArray",
"[",
"i",
"]",
"=",
"(",
"Short",
")",
"sortedDurations",
".",
"elementAt",
"(",
"i",
")",
";",
"return",
"durationsAsArray",
";",
"}",
"}"
] |
Returns the strict durations composing this multi notes.
@return The strict durations composing this multi notes. The array is sorted
from shortest durations to longest ones.
|
[
"Returns",
"the",
"strict",
"durations",
"composing",
"this",
"multi",
"notes",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L222-L249
|
10,324
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.normalize
|
public MultiNote[] normalize() {
Hashtable splitter = new Hashtable();
for (int i=0; i<m_notes.size(); i++) {
Note note = (Note)m_notes.elementAt(i);
Short key = note.getStrictDuration();
if (splitter.containsKey(key))
((Vector)splitter.get(key)).addElement(note);
else {
Vector v = new Vector();
v.addElement(note);
splitter.put(key, v);
}
}
short[] strictDurations = getStrictDurations();
MultiNote[] normalizedChords = new MultiNote[strictDurations.length];
for (int i=0; i<strictDurations.length;i++) {
normalizedChords[i] = new MultiNote((Vector)splitter.get(new Short(strictDurations[i])));
}
return normalizedChords;
}
|
java
|
public MultiNote[] normalize() {
Hashtable splitter = new Hashtable();
for (int i=0; i<m_notes.size(); i++) {
Note note = (Note)m_notes.elementAt(i);
Short key = note.getStrictDuration();
if (splitter.containsKey(key))
((Vector)splitter.get(key)).addElement(note);
else {
Vector v = new Vector();
v.addElement(note);
splitter.put(key, v);
}
}
short[] strictDurations = getStrictDurations();
MultiNote[] normalizedChords = new MultiNote[strictDurations.length];
for (int i=0; i<strictDurations.length;i++) {
normalizedChords[i] = new MultiNote((Vector)splitter.get(new Short(strictDurations[i])));
}
return normalizedChords;
}
|
[
"public",
"MultiNote",
"[",
"]",
"normalize",
"(",
")",
"{",
"Hashtable",
"splitter",
"=",
"new",
"Hashtable",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_notes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Note",
"note",
"=",
"(",
"Note",
")",
"m_notes",
".",
"elementAt",
"(",
"i",
")",
";",
"Short",
"key",
"=",
"note",
".",
"getStrictDuration",
"(",
")",
";",
"if",
"(",
"splitter",
".",
"containsKey",
"(",
"key",
")",
")",
"(",
"(",
"Vector",
")",
"splitter",
".",
"get",
"(",
"key",
")",
")",
".",
"addElement",
"(",
"note",
")",
";",
"else",
"{",
"Vector",
"v",
"=",
"new",
"Vector",
"(",
")",
";",
"v",
".",
"addElement",
"(",
"note",
")",
";",
"splitter",
".",
"put",
"(",
"key",
",",
"v",
")",
";",
"}",
"}",
"short",
"[",
"]",
"strictDurations",
"=",
"getStrictDurations",
"(",
")",
";",
"MultiNote",
"[",
"]",
"normalizedChords",
"=",
"new",
"MultiNote",
"[",
"strictDurations",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strictDurations",
".",
"length",
";",
"i",
"++",
")",
"{",
"normalizedChords",
"[",
"i",
"]",
"=",
"new",
"MultiNote",
"(",
"(",
"Vector",
")",
"splitter",
".",
"get",
"(",
"new",
"Short",
"(",
"strictDurations",
"[",
"i",
"]",
")",
")",
")",
";",
"}",
"return",
"normalizedChords",
";",
"}"
] |
Normalizes this multi note by decomposing it into multinotes with
same strict duration.
@return An array of multinotes with unique strict duration. Such strict
durations are sorted by ascent order.
@see #hasUniqueStrictDuration()
|
[
"Normalizes",
"this",
"multi",
"note",
"by",
"decomposing",
"it",
"into",
"multinotes",
"with",
"same",
"strict",
"duration",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L256-L275
|
10,325
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiNote.java
|
MultiNote.toArray
|
public Note[] toArray() {
if (m_notes.size()>0) {
Note[] notes = new Note[m_notes.size()];
return (Note[])m_notes.toArray(notes);
}
else
return null;
}
|
java
|
public Note[] toArray() {
if (m_notes.size()>0) {
Note[] notes = new Note[m_notes.size()];
return (Note[])m_notes.toArray(notes);
}
else
return null;
}
|
[
"public",
"Note",
"[",
"]",
"toArray",
"(",
")",
"{",
"if",
"(",
"m_notes",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"Note",
"[",
"]",
"notes",
"=",
"new",
"Note",
"[",
"m_notes",
".",
"size",
"(",
")",
"]",
";",
"return",
"(",
"Note",
"[",
"]",
")",
"m_notes",
".",
"toArray",
"(",
"notes",
")",
";",
"}",
"else",
"return",
"null",
";",
"}"
] |
Returns notes composing this multinote as an array of notes, sorted
from the lowest note to the highest one.
@return Notes composing this multinote as an array of notes, sorted
from the lowest note to the highest one.
|
[
"Returns",
"notes",
"composing",
"this",
"multinote",
"as",
"an",
"array",
"of",
"notes",
"sorted",
"from",
"the",
"lowest",
"note",
"to",
"the",
"highest",
"one",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiNote.java#L313-L320
|
10,326
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/NrqlAlertConditionService.java
|
NrqlAlertConditionService.create
|
public Optional<NrqlAlertCondition> create(long policyId, NrqlAlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_nrql_conditions/policies/%d.json", policyId), condition, NRQL_ALERT_CONDITION);
}
|
java
|
public Optional<NrqlAlertCondition> create(long policyId, NrqlAlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_nrql_conditions/policies/%d.json", policyId), condition, NRQL_ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"NrqlAlertCondition",
">",
"create",
"(",
"long",
"policyId",
",",
"NrqlAlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"POST",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_nrql_conditions/policies/%d.json\"",
",",
"policyId",
")",
",",
"condition",
",",
"NRQL_ALERT_CONDITION",
")",
";",
"}"
] |
Creates the given NRQL alert condition.
@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",
"NRQL",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/NrqlAlertConditionService.java#L108-L111
|
10,327
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/NrqlAlertConditionService.java
|
NrqlAlertConditionService.update
|
public Optional<NrqlAlertCondition> update(NrqlAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_nrql_conditions/%d.json", condition.getId()), condition, NRQL_ALERT_CONDITION);
}
|
java
|
public Optional<NrqlAlertCondition> update(NrqlAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_nrql_conditions/%d.json", condition.getId()), condition, NRQL_ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"NrqlAlertCondition",
">",
"update",
"(",
"NrqlAlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_nrql_conditions/%d.json\"",
",",
"condition",
".",
"getId",
"(",
")",
")",
",",
"condition",
",",
"NRQL_ALERT_CONDITION",
")",
";",
"}"
] |
Updates the given NRQL alert condition.
@param condition The alert condition to update
@return The alert condition that was updated
|
[
"Updates",
"the",
"given",
"NRQL",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/NrqlAlertConditionService.java#L118-L121
|
10,328
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/MultiPartsDefinition.java
|
MultiPartsDefinition.toPartsArray
|
public Part[] toPartsArray()
{
Vector parts = getPartsAsRepeatedOnceVector();
Part[] partsArray = new Part[parts.size()];
for (int i=0; i<parts.size(); i++)
partsArray[i] = (Part)parts.elementAt(i);
return partsArray;
}
|
java
|
public Part[] toPartsArray()
{
Vector parts = getPartsAsRepeatedOnceVector();
Part[] partsArray = new Part[parts.size()];
for (int i=0; i<parts.size(); i++)
partsArray[i] = (Part)parts.elementAt(i);
return partsArray;
}
|
[
"public",
"Part",
"[",
"]",
"toPartsArray",
"(",
")",
"{",
"Vector",
"parts",
"=",
"getPartsAsRepeatedOnceVector",
"(",
")",
";",
"Part",
"[",
"]",
"partsArray",
"=",
"new",
"Part",
"[",
"parts",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"partsArray",
"[",
"i",
"]",
"=",
"(",
"Part",
")",
"parts",
".",
"elementAt",
"(",
"i",
")",
";",
"return",
"partsArray",
";",
"}"
] |
Returns this multipart as an array of singles parts. The playing of the
multi part would sound the same as the playing of the array of parts.
@return An array of singles parts that would sound the same as the
playing of this multipart.
|
[
"Returns",
"this",
"multipart",
"as",
"an",
"array",
"of",
"singles",
"parts",
".",
"The",
"playing",
"of",
"the",
"multi",
"part",
"would",
"sound",
"the",
"same",
"as",
"the",
"playing",
"of",
"the",
"array",
"of",
"parts",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/MultiPartsDefinition.java#L51-L58
|
10,329
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/UserService.java
|
UserService.list
|
public Collection<User> list(List<String> queryParams)
{
return HTTP.GET("/v2/users.json", null, queryParams, USERS).get();
}
|
java
|
public Collection<User> list(List<String> queryParams)
{
return HTTP.GET("/v2/users.json", null, queryParams, USERS).get();
}
|
[
"public",
"Collection",
"<",
"User",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/users.json\"",
",",
"null",
",",
"queryParams",
",",
"USERS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of users with the given query parameters.
@param queryParams The query parameters
@return The set of users
|
[
"Returns",
"the",
"set",
"of",
"users",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/UserService.java#L49-L52
|
10,330
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/UserService.java
|
UserService.show
|
public Optional<User> show(long userId)
{
return HTTP.GET(String.format("/v2/users/%d.json", userId), USER);
}
|
java
|
public Optional<User> show(long userId)
{
return HTTP.GET(String.format("/v2/users/%d.json", userId), USER);
}
|
[
"public",
"Optional",
"<",
"User",
">",
"show",
"(",
"long",
"userId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/users/%d.json\"",
",",
"userId",
")",
",",
"USER",
")",
";",
"}"
] |
Returns the user for the given user id.
@param userId The id for the user to return
@return The user
|
[
"Returns",
"the",
"user",
"for",
"the",
"given",
"user",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/UserService.java#L89-L92
|
10,331
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/UserService.java
|
UserService.resetPassword
|
public Optional<User> resetPassword(long userId)
{
return HTTP.POST(String.format("/v2/users/%d/reset_password.json", userId), null, USER);
}
|
java
|
public Optional<User> resetPassword(long userId)
{
return HTTP.POST(String.format("/v2/users/%d/reset_password.json", userId), null, USER);
}
|
[
"public",
"Optional",
"<",
"User",
">",
"resetPassword",
"(",
"long",
"userId",
")",
"{",
"return",
"HTTP",
".",
"POST",
"(",
"String",
".",
"format",
"(",
"\"/v2/users/%d/reset_password.json\"",
",",
"userId",
")",
",",
"null",
",",
"USER",
")",
";",
"}"
] |
Resets the password for the given user.
@param userId The id of the user to reset the password for
@return The user that was reset
|
[
"Resets",
"the",
"password",
"for",
"the",
"given",
"user",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/UserService.java#L99-L102
|
10,332
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Tablature.java
|
Tablature.getStringNote
|
public Note getStringNote(int stringNumber) {
if (stringNumber > 0 && stringNumber <= m_strings.length) {
return m_strings[stringNumber-1];
}
else return null;
}
|
java
|
public Note getStringNote(int stringNumber) {
if (stringNumber > 0 && stringNumber <= m_strings.length) {
return m_strings[stringNumber-1];
}
else return null;
}
|
[
"public",
"Note",
"getStringNote",
"(",
"int",
"stringNumber",
")",
"{",
"if",
"(",
"stringNumber",
">",
"0",
"&&",
"stringNumber",
"<=",
"m_strings",
".",
"length",
")",
"{",
"return",
"m_strings",
"[",
"stringNumber",
"-",
"1",
"]",
";",
"}",
"else",
"return",
"null",
";",
"}"
] |
Returns the Note for the request string
@param stringNumber Starts at 1 for lowest string line
@return a Note object, or null if string number out of
defined strings
|
[
"Returns",
"the",
"Note",
"for",
"the",
"request",
"string"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Tablature.java#L107-L112
|
10,333
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Tablature.java
|
Tablature.computeFingerings
|
public void computeFingerings(Collection musicElements) {
if (computedFingerings != null)
computedFingerings.clear();
//collect all notes
Collection notes = new ArrayList(musicElements.size());
Iterator it = musicElements.iterator();
while (it.hasNext()) {
MusicElement element = (MusicElement) it.next();
if (element instanceof NoteAbstract) {
NoteAbstract[] graces = ((NoteAbstract) element).getGracingNotes();
if (graces != null) {
Collections.addAll(notes, graces);
}
notes.add(element);
}
}
computedFingerings = new HashMap(notes.size());
//TODO iterate notes collection, compute fingering
it = notes.iterator();
NoteAbstract lastNote = null;
while (it.hasNext()) {
NoteAbstract currentNote = (NoteAbstract) it.next();
if (currentNote instanceof MultiNote) {
//we have a chord
for (Object o : (((MultiNote) currentNote).getNotesAsVector())) {
Note note = (Note) o;
if (note.isRest() || note.isEndingTie())
continue;
//just a random thing to put numbers on the tab :-)
int string = 1 + (int) (Math.random() * (m_strings.length - 1));
int fret = (int) (Math.random() * m_numberOfFret);
computedFingerings.put(note.getReference(),
new int[]{string, fret});
}
} else if (currentNote instanceof Note) {
Note note = (Note) currentNote;
if (!note.isEndingTie()) {
int[] pos = null;
if (note.isRest()) {
//reinit penalty, player may have time
//to move on the neck
}
else if ((lastNote != null)
&& (lastNote instanceof Note)
&& (note.getMidiLikeHeight()
== ((Note)lastNote).getMidiLikeHeight())
&& ((pos = getFingeringForNote((Note)lastNote)) != null)) {
//If the current note is the same than the last note
//keep the same position
computedFingerings.put(note.getReference(),
new int[] {pos[0], pos[1]});
} else {
//just a random thing to put numbers on the tab :-)
int string = 1+(int)Math.round(Math.random()*(m_strings.length-1));
int fret = (int)(Math.random()*m_numberOfFret);
computedFingerings.put(note.getReference(),
new int[]{string, fret});
}
}
}
lastNote = currentNote;
}
//use penalty parameters, use private field if needed:
//- maximal gap between index finger and little finger
// e.g. guitar: 3 frets near headstock/nut, 5 near body
// charango: 5 near headstock/nut, 7 near body
//- pick another string (small penalty)
//- move finger to another fret (greater penalty)
//- void string in a chord (increasing with number of strings
// (no penalty for 3 or 4 strings, huge penalty for 7+ strings...)
//
//if a note is impossible to render on tab, set fret number to -1
//(note lower than lowest string, more notes in MultiNote than strings...)
//capodastre position = the minimal fret value
}
|
java
|
public void computeFingerings(Collection musicElements) {
if (computedFingerings != null)
computedFingerings.clear();
//collect all notes
Collection notes = new ArrayList(musicElements.size());
Iterator it = musicElements.iterator();
while (it.hasNext()) {
MusicElement element = (MusicElement) it.next();
if (element instanceof NoteAbstract) {
NoteAbstract[] graces = ((NoteAbstract) element).getGracingNotes();
if (graces != null) {
Collections.addAll(notes, graces);
}
notes.add(element);
}
}
computedFingerings = new HashMap(notes.size());
//TODO iterate notes collection, compute fingering
it = notes.iterator();
NoteAbstract lastNote = null;
while (it.hasNext()) {
NoteAbstract currentNote = (NoteAbstract) it.next();
if (currentNote instanceof MultiNote) {
//we have a chord
for (Object o : (((MultiNote) currentNote).getNotesAsVector())) {
Note note = (Note) o;
if (note.isRest() || note.isEndingTie())
continue;
//just a random thing to put numbers on the tab :-)
int string = 1 + (int) (Math.random() * (m_strings.length - 1));
int fret = (int) (Math.random() * m_numberOfFret);
computedFingerings.put(note.getReference(),
new int[]{string, fret});
}
} else if (currentNote instanceof Note) {
Note note = (Note) currentNote;
if (!note.isEndingTie()) {
int[] pos = null;
if (note.isRest()) {
//reinit penalty, player may have time
//to move on the neck
}
else if ((lastNote != null)
&& (lastNote instanceof Note)
&& (note.getMidiLikeHeight()
== ((Note)lastNote).getMidiLikeHeight())
&& ((pos = getFingeringForNote((Note)lastNote)) != null)) {
//If the current note is the same than the last note
//keep the same position
computedFingerings.put(note.getReference(),
new int[] {pos[0], pos[1]});
} else {
//just a random thing to put numbers on the tab :-)
int string = 1+(int)Math.round(Math.random()*(m_strings.length-1));
int fret = (int)(Math.random()*m_numberOfFret);
computedFingerings.put(note.getReference(),
new int[]{string, fret});
}
}
}
lastNote = currentNote;
}
//use penalty parameters, use private field if needed:
//- maximal gap between index finger and little finger
// e.g. guitar: 3 frets near headstock/nut, 5 near body
// charango: 5 near headstock/nut, 7 near body
//- pick another string (small penalty)
//- move finger to another fret (greater penalty)
//- void string in a chord (increasing with number of strings
// (no penalty for 3 or 4 strings, huge penalty for 7+ strings...)
//
//if a note is impossible to render on tab, set fret number to -1
//(note lower than lowest string, more notes in MultiNote than strings...)
//capodastre position = the minimal fret value
}
|
[
"public",
"void",
"computeFingerings",
"(",
"Collection",
"musicElements",
")",
"{",
"if",
"(",
"computedFingerings",
"!=",
"null",
")",
"computedFingerings",
".",
"clear",
"(",
")",
";",
"//collect all notes\r",
"Collection",
"notes",
"=",
"new",
"ArrayList",
"(",
"musicElements",
".",
"size",
"(",
")",
")",
";",
"Iterator",
"it",
"=",
"musicElements",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"MusicElement",
"element",
"=",
"(",
"MusicElement",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"element",
"instanceof",
"NoteAbstract",
")",
"{",
"NoteAbstract",
"[",
"]",
"graces",
"=",
"(",
"(",
"NoteAbstract",
")",
"element",
")",
".",
"getGracingNotes",
"(",
")",
";",
"if",
"(",
"graces",
"!=",
"null",
")",
"{",
"Collections",
".",
"addAll",
"(",
"notes",
",",
"graces",
")",
";",
"}",
"notes",
".",
"add",
"(",
"element",
")",
";",
"}",
"}",
"computedFingerings",
"=",
"new",
"HashMap",
"(",
"notes",
".",
"size",
"(",
")",
")",
";",
"//TODO iterate notes collection, compute fingering\r",
"it",
"=",
"notes",
".",
"iterator",
"(",
")",
";",
"NoteAbstract",
"lastNote",
"=",
"null",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"NoteAbstract",
"currentNote",
"=",
"(",
"NoteAbstract",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"currentNote",
"instanceof",
"MultiNote",
")",
"{",
"//we have a chord\r",
"for",
"(",
"Object",
"o",
":",
"(",
"(",
"(",
"MultiNote",
")",
"currentNote",
")",
".",
"getNotesAsVector",
"(",
")",
")",
")",
"{",
"Note",
"note",
"=",
"(",
"Note",
")",
"o",
";",
"if",
"(",
"note",
".",
"isRest",
"(",
")",
"||",
"note",
".",
"isEndingTie",
"(",
")",
")",
"continue",
";",
"//just a random thing to put numbers on the tab :-)\r",
"int",
"string",
"=",
"1",
"+",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"m_strings",
".",
"length",
"-",
"1",
")",
")",
";",
"int",
"fret",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"m_numberOfFret",
")",
";",
"computedFingerings",
".",
"put",
"(",
"note",
".",
"getReference",
"(",
")",
",",
"new",
"int",
"[",
"]",
"{",
"string",
",",
"fret",
"}",
")",
";",
"}",
"}",
"else",
"if",
"(",
"currentNote",
"instanceof",
"Note",
")",
"{",
"Note",
"note",
"=",
"(",
"Note",
")",
"currentNote",
";",
"if",
"(",
"!",
"note",
".",
"isEndingTie",
"(",
")",
")",
"{",
"int",
"[",
"]",
"pos",
"=",
"null",
";",
"if",
"(",
"note",
".",
"isRest",
"(",
")",
")",
"{",
"//reinit penalty, player may have time\r",
"//to move on the neck\r",
"}",
"else",
"if",
"(",
"(",
"lastNote",
"!=",
"null",
")",
"&&",
"(",
"lastNote",
"instanceof",
"Note",
")",
"&&",
"(",
"note",
".",
"getMidiLikeHeight",
"(",
")",
"==",
"(",
"(",
"Note",
")",
"lastNote",
")",
".",
"getMidiLikeHeight",
"(",
")",
")",
"&&",
"(",
"(",
"pos",
"=",
"getFingeringForNote",
"(",
"(",
"Note",
")",
"lastNote",
")",
")",
"!=",
"null",
")",
")",
"{",
"//If the current note is the same than the last note\r",
"//keep the same position\r",
"computedFingerings",
".",
"put",
"(",
"note",
".",
"getReference",
"(",
")",
",",
"new",
"int",
"[",
"]",
"{",
"pos",
"[",
"0",
"]",
",",
"pos",
"[",
"1",
"]",
"}",
")",
";",
"}",
"else",
"{",
"//just a random thing to put numbers on the tab :-)\r",
"int",
"string",
"=",
"1",
"+",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"m_strings",
".",
"length",
"-",
"1",
")",
")",
";",
"int",
"fret",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"m_numberOfFret",
")",
";",
"computedFingerings",
".",
"put",
"(",
"note",
".",
"getReference",
"(",
")",
",",
"new",
"int",
"[",
"]",
"{",
"string",
",",
"fret",
"}",
")",
";",
"}",
"}",
"}",
"lastNote",
"=",
"currentNote",
";",
"}",
"//use penalty parameters, use private field if needed:\r",
"//- maximal gap between index finger and little finger\r",
"//\te.g. guitar: 3 frets near headstock/nut, 5 near body\r",
"//\t\t charango: 5 near headstock/nut, 7 near body\r",
"//- pick another string (small penalty)\r",
"//- move finger to another fret (greater penalty)\r",
"//- void string in a chord (increasing with number of strings\r",
"//\t(no penalty for 3 or 4 strings, huge penalty for 7+ strings...)\r",
"//\r",
"//if a note is impossible to render on tab, set fret number to -1\r",
"//(note lower than lowest string, more notes in MultiNote than strings...)\r",
"//capodastre position = the minimal fret value\r",
"}"
] |
Here is the brain of tablature fingerings computation.
@param musicElements Collection of MusicElement in which notes
will be used for computation.
|
[
"Here",
"is",
"the",
"brain",
"of",
"tablature",
"fingerings",
"computation",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Tablature.java#L133-L209
|
10,334
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java
|
PartnerUserService.list
|
public Collection<PartnerUser> list(long partnerId, long accountId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts/%d/users", partnerId, accountId), PARTNER_USERS).get();
}
|
java
|
public Collection<PartnerUser> list(long partnerId, long accountId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts/%d/users", partnerId, accountId), PARTNER_USERS).get();
}
|
[
"public",
"Collection",
"<",
"PartnerUser",
">",
"list",
"(",
"long",
"partnerId",
",",
"long",
"accountId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/partners/%d/accounts/%d/users\"",
",",
"partnerId",
",",
"accountId",
")",
",",
"PARTNER_USERS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of users.
@param partnerId The id of the partner for the users
@param accountId The id of the account for the users
@return The set of users
|
[
"Returns",
"the",
"set",
"of",
"users",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java#L47-L50
|
10,335
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java
|
PartnerUserService.create
|
public Optional<PartnerUser> create(long partnerId, long accountId, PartnerUser user)
{
return Optional.of(HTTP.POST(String.format("/v2/partners/%d/accounts/%d/users", partnerId, accountId), user, PARTNER_USERS).get().iterator().next());
}
|
java
|
public Optional<PartnerUser> create(long partnerId, long accountId, PartnerUser user)
{
return Optional.of(HTTP.POST(String.format("/v2/partners/%d/accounts/%d/users", partnerId, accountId), user, PARTNER_USERS).get().iterator().next());
}
|
[
"public",
"Optional",
"<",
"PartnerUser",
">",
"create",
"(",
"long",
"partnerId",
",",
"long",
"accountId",
",",
"PartnerUser",
"user",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"HTTP",
".",
"POST",
"(",
"String",
".",
"format",
"(",
"\"/v2/partners/%d/accounts/%d/users\"",
",",
"partnerId",
",",
"accountId",
")",
",",
"user",
",",
"PARTNER_USERS",
")",
".",
"get",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}"
] |
Creates the given user.
@param partnerId The id of the partner the user belongs to
@param accountId The id of the account for the user
@param user The user to create
@return The user that was created
|
[
"Creates",
"the",
"given",
"user",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java#L59-L62
|
10,336
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java
|
PartnerUserService.update
|
public Optional<PartnerUser> update(long partnerId, long accountId, PartnerUser user)
{
return Optional.of(HTTP.PUT(String.format("/v2/partners/%d/accounts/%d/users", partnerId, accountId), user, PARTNER_USERS).get().iterator().next());
}
|
java
|
public Optional<PartnerUser> update(long partnerId, long accountId, PartnerUser user)
{
return Optional.of(HTTP.PUT(String.format("/v2/partners/%d/accounts/%d/users", partnerId, accountId), user, PARTNER_USERS).get().iterator().next());
}
|
[
"public",
"Optional",
"<",
"PartnerUser",
">",
"update",
"(",
"long",
"partnerId",
",",
"long",
"accountId",
",",
"PartnerUser",
"user",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/partners/%d/accounts/%d/users\"",
",",
"partnerId",
",",
"accountId",
")",
",",
"user",
",",
"PARTNER_USERS",
")",
".",
"get",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}"
] |
Updates the given user.
@param partnerId The id of the partner the user belongs to
@param accountId The id of the account for the user
@param user The user to update
@return The user that was updated
|
[
"Updates",
"the",
"given",
"user",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java#L71-L74
|
10,337
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java
|
PartnerUserService.delete
|
public PartnerUserService delete(long partnerId, long accountId, long userId)
{
HTTP.DELETE(String.format("/v2/partners/%d/accounts/%d/users/%d", partnerId, accountId, userId));
return this;
}
|
java
|
public PartnerUserService delete(long partnerId, long accountId, long userId)
{
HTTP.DELETE(String.format("/v2/partners/%d/accounts/%d/users/%d", partnerId, accountId, userId));
return this;
}
|
[
"public",
"PartnerUserService",
"delete",
"(",
"long",
"partnerId",
",",
"long",
"accountId",
",",
"long",
"userId",
")",
"{",
"HTTP",
".",
"DELETE",
"(",
"String",
".",
"format",
"(",
"\"/v2/partners/%d/accounts/%d/users/%d\"",
",",
"partnerId",
",",
"accountId",
",",
"userId",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Deletes the user with the given id.
@param partnerId The id of the partner the user belongs to
@param accountId The id of the account for the user
@param userId The id of the user to delete
@return This object
|
[
"Deletes",
"the",
"user",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerUserService.java#L83-L87
|
10,338
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JTune.java
|
JTune.applyStemmingPolicy
|
private void applyStemmingPolicy(JScoreElementAbstract element) {
if (element != null && element instanceof JStemmableElement) {
JStemmableElement stemmable = (JStemmableElement) element;
if (stemmable.isFollowingStemmingPolicy()) {
byte noteStemPolicy = (byte) getTemplate().getAttributeNumber(ScoreAttribute.NOTE_STEM_POLICY);
if (noteStemPolicy == STEMS_AUTO) {
stemmable.setAutoStem(true);
} else {
boolean isup = (noteStemPolicy == STEMS_UP);
stemmable.setAutoStem(false);
stemmable.setStemUp(isup);
}
}
//if element N is up, element N-1 is middle staff,
//and N-2 is up too, then set N-1 up
//e.g.: in G clef A B A (B is up), c B c (B is down)
int count = currentStaffLine.countElement();
if (stemmable.isStemUp() && (count >= 2)) {
Vector staffElements = currentStaffLine.getStaffElements();
JScoreElement N1 = (JScoreElement) staffElements.get(count-2);
JScoreElement N2 = (JScoreElement) staffElements.get(count-3);
if ((N1 instanceof JStemmableElement)
&& (N1 instanceof JNote)
&& (((JStemmableElement)N1).isFollowingStemmingPolicy())
&& (N2 instanceof JStemmableElement)
&& !((JStemmableElement) N1).isStemUp()
&& ((JStemmableElement) N2).isStemUp()) {
Note n = (Note) N1.getMusicElement();
if (n.getHeight() == ((JNote) N1).getClef().getMiddleNote().getHeight()) {
((JStemmableElement) N1).setAutoStem(false);
((JStemmableElement) N1).setStemUp(true);
}
}
}
//grace notes
byte gracenoteStemPolicy = (byte) getTemplate().getAttributeNumber(ScoreAttribute.GRACENOTE_STEM_POLICY);
if (element instanceof JNoteElementAbstract) {
JNoteElementAbstract jnea = (JNoteElementAbstract) element;
if ((jnea.m_jGracenotes != null)
&& (jnea.m_jGracenotes instanceof JStemmableElement)) {
JStemmableElement stemmableGN = (JStemmableElement) jnea.m_jGracenotes;
if (gracenoteStemPolicy == STEMS_AUTO) {
stemmableGN.setAutoStem(true);
} else {
boolean isup = (gracenoteStemPolicy == STEMS_UP);
stemmableGN.setAutoStem(false);
stemmableGN.setStemUp(isup);
}
}
} else if (element instanceof JGroupOfNotes) {
JGroupOfNotes jgon = (JGroupOfNotes) element;
for (int i = 0; i < jgon.m_jNotes.length; i++) {
JNoteElementAbstract jnea = (JNoteElementAbstract) jgon.m_jNotes[i];
if (jnea.m_jGracenotes != null) {
JStemmableElement stemmableGN =
(JStemmableElement) jnea.m_jGracenotes;
if (gracenoteStemPolicy == STEMS_AUTO) {
stemmableGN.setAutoStem(true);
} else {
boolean isup = (gracenoteStemPolicy == STEMS_UP);
stemmableGN.setAutoStem(false);
stemmableGN.setStemUp(isup);
}
}
}
}
}
}
|
java
|
private void applyStemmingPolicy(JScoreElementAbstract element) {
if (element != null && element instanceof JStemmableElement) {
JStemmableElement stemmable = (JStemmableElement) element;
if (stemmable.isFollowingStemmingPolicy()) {
byte noteStemPolicy = (byte) getTemplate().getAttributeNumber(ScoreAttribute.NOTE_STEM_POLICY);
if (noteStemPolicy == STEMS_AUTO) {
stemmable.setAutoStem(true);
} else {
boolean isup = (noteStemPolicy == STEMS_UP);
stemmable.setAutoStem(false);
stemmable.setStemUp(isup);
}
}
//if element N is up, element N-1 is middle staff,
//and N-2 is up too, then set N-1 up
//e.g.: in G clef A B A (B is up), c B c (B is down)
int count = currentStaffLine.countElement();
if (stemmable.isStemUp() && (count >= 2)) {
Vector staffElements = currentStaffLine.getStaffElements();
JScoreElement N1 = (JScoreElement) staffElements.get(count-2);
JScoreElement N2 = (JScoreElement) staffElements.get(count-3);
if ((N1 instanceof JStemmableElement)
&& (N1 instanceof JNote)
&& (((JStemmableElement)N1).isFollowingStemmingPolicy())
&& (N2 instanceof JStemmableElement)
&& !((JStemmableElement) N1).isStemUp()
&& ((JStemmableElement) N2).isStemUp()) {
Note n = (Note) N1.getMusicElement();
if (n.getHeight() == ((JNote) N1).getClef().getMiddleNote().getHeight()) {
((JStemmableElement) N1).setAutoStem(false);
((JStemmableElement) N1).setStemUp(true);
}
}
}
//grace notes
byte gracenoteStemPolicy = (byte) getTemplate().getAttributeNumber(ScoreAttribute.GRACENOTE_STEM_POLICY);
if (element instanceof JNoteElementAbstract) {
JNoteElementAbstract jnea = (JNoteElementAbstract) element;
if ((jnea.m_jGracenotes != null)
&& (jnea.m_jGracenotes instanceof JStemmableElement)) {
JStemmableElement stemmableGN = (JStemmableElement) jnea.m_jGracenotes;
if (gracenoteStemPolicy == STEMS_AUTO) {
stemmableGN.setAutoStem(true);
} else {
boolean isup = (gracenoteStemPolicy == STEMS_UP);
stemmableGN.setAutoStem(false);
stemmableGN.setStemUp(isup);
}
}
} else if (element instanceof JGroupOfNotes) {
JGroupOfNotes jgon = (JGroupOfNotes) element;
for (int i = 0; i < jgon.m_jNotes.length; i++) {
JNoteElementAbstract jnea = (JNoteElementAbstract) jgon.m_jNotes[i];
if (jnea.m_jGracenotes != null) {
JStemmableElement stemmableGN =
(JStemmableElement) jnea.m_jGracenotes;
if (gracenoteStemPolicy == STEMS_AUTO) {
stemmableGN.setAutoStem(true);
} else {
boolean isup = (gracenoteStemPolicy == STEMS_UP);
stemmableGN.setAutoStem(false);
stemmableGN.setStemUp(isup);
}
}
}
}
}
}
|
[
"private",
"void",
"applyStemmingPolicy",
"(",
"JScoreElementAbstract",
"element",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
"&&",
"element",
"instanceof",
"JStemmableElement",
")",
"{",
"JStemmableElement",
"stemmable",
"=",
"(",
"JStemmableElement",
")",
"element",
";",
"if",
"(",
"stemmable",
".",
"isFollowingStemmingPolicy",
"(",
")",
")",
"{",
"byte",
"noteStemPolicy",
"=",
"(",
"byte",
")",
"getTemplate",
"(",
")",
".",
"getAttributeNumber",
"(",
"ScoreAttribute",
".",
"NOTE_STEM_POLICY",
")",
";",
"if",
"(",
"noteStemPolicy",
"==",
"STEMS_AUTO",
")",
"{",
"stemmable",
".",
"setAutoStem",
"(",
"true",
")",
";",
"}",
"else",
"{",
"boolean",
"isup",
"=",
"(",
"noteStemPolicy",
"==",
"STEMS_UP",
")",
";",
"stemmable",
".",
"setAutoStem",
"(",
"false",
")",
";",
"stemmable",
".",
"setStemUp",
"(",
"isup",
")",
";",
"}",
"}",
"//if element N is up, element N-1 is middle staff,\r",
"//and N-2 is up too, then set N-1 up\r",
"//e.g.: in G clef A B A (B is up), c B c (B is down)\r",
"int",
"count",
"=",
"currentStaffLine",
".",
"countElement",
"(",
")",
";",
"if",
"(",
"stemmable",
".",
"isStemUp",
"(",
")",
"&&",
"(",
"count",
">=",
"2",
")",
")",
"{",
"Vector",
"staffElements",
"=",
"currentStaffLine",
".",
"getStaffElements",
"(",
")",
";",
"JScoreElement",
"N1",
"=",
"(",
"JScoreElement",
")",
"staffElements",
".",
"get",
"(",
"count",
"-",
"2",
")",
";",
"JScoreElement",
"N2",
"=",
"(",
"JScoreElement",
")",
"staffElements",
".",
"get",
"(",
"count",
"-",
"3",
")",
";",
"if",
"(",
"(",
"N1",
"instanceof",
"JStemmableElement",
")",
"&&",
"(",
"N1",
"instanceof",
"JNote",
")",
"&&",
"(",
"(",
"(",
"JStemmableElement",
")",
"N1",
")",
".",
"isFollowingStemmingPolicy",
"(",
")",
")",
"&&",
"(",
"N2",
"instanceof",
"JStemmableElement",
")",
"&&",
"!",
"(",
"(",
"JStemmableElement",
")",
"N1",
")",
".",
"isStemUp",
"(",
")",
"&&",
"(",
"(",
"JStemmableElement",
")",
"N2",
")",
".",
"isStemUp",
"(",
")",
")",
"{",
"Note",
"n",
"=",
"(",
"Note",
")",
"N1",
".",
"getMusicElement",
"(",
")",
";",
"if",
"(",
"n",
".",
"getHeight",
"(",
")",
"==",
"(",
"(",
"JNote",
")",
"N1",
")",
".",
"getClef",
"(",
")",
".",
"getMiddleNote",
"(",
")",
".",
"getHeight",
"(",
")",
")",
"{",
"(",
"(",
"JStemmableElement",
")",
"N1",
")",
".",
"setAutoStem",
"(",
"false",
")",
";",
"(",
"(",
"JStemmableElement",
")",
"N1",
")",
".",
"setStemUp",
"(",
"true",
")",
";",
"}",
"}",
"}",
"//grace notes\r",
"byte",
"gracenoteStemPolicy",
"=",
"(",
"byte",
")",
"getTemplate",
"(",
")",
".",
"getAttributeNumber",
"(",
"ScoreAttribute",
".",
"GRACENOTE_STEM_POLICY",
")",
";",
"if",
"(",
"element",
"instanceof",
"JNoteElementAbstract",
")",
"{",
"JNoteElementAbstract",
"jnea",
"=",
"(",
"JNoteElementAbstract",
")",
"element",
";",
"if",
"(",
"(",
"jnea",
".",
"m_jGracenotes",
"!=",
"null",
")",
"&&",
"(",
"jnea",
".",
"m_jGracenotes",
"instanceof",
"JStemmableElement",
")",
")",
"{",
"JStemmableElement",
"stemmableGN",
"=",
"(",
"JStemmableElement",
")",
"jnea",
".",
"m_jGracenotes",
";",
"if",
"(",
"gracenoteStemPolicy",
"==",
"STEMS_AUTO",
")",
"{",
"stemmableGN",
".",
"setAutoStem",
"(",
"true",
")",
";",
"}",
"else",
"{",
"boolean",
"isup",
"=",
"(",
"gracenoteStemPolicy",
"==",
"STEMS_UP",
")",
";",
"stemmableGN",
".",
"setAutoStem",
"(",
"false",
")",
";",
"stemmableGN",
".",
"setStemUp",
"(",
"isup",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"element",
"instanceof",
"JGroupOfNotes",
")",
"{",
"JGroupOfNotes",
"jgon",
"=",
"(",
"JGroupOfNotes",
")",
"element",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jgon",
".",
"m_jNotes",
".",
"length",
";",
"i",
"++",
")",
"{",
"JNoteElementAbstract",
"jnea",
"=",
"(",
"JNoteElementAbstract",
")",
"jgon",
".",
"m_jNotes",
"[",
"i",
"]",
";",
"if",
"(",
"jnea",
".",
"m_jGracenotes",
"!=",
"null",
")",
"{",
"JStemmableElement",
"stemmableGN",
"=",
"(",
"JStemmableElement",
")",
"jnea",
".",
"m_jGracenotes",
";",
"if",
"(",
"gracenoteStemPolicy",
"==",
"STEMS_AUTO",
")",
"{",
"stemmableGN",
".",
"setAutoStem",
"(",
"true",
")",
";",
"}",
"else",
"{",
"boolean",
"isup",
"=",
"(",
"gracenoteStemPolicy",
"==",
"STEMS_UP",
")",
";",
"stemmableGN",
".",
"setAutoStem",
"(",
"false",
")",
";",
"stemmableGN",
".",
"setStemUp",
"(",
"isup",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}"
] |
apply stemming policy to an element
|
[
"apply",
"stemming",
"policy",
"to",
"an",
"element"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JTune.java#L850-L917
|
10,339
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JTune.java
|
JTune.justify
|
private void justify() {
if (m_staffLines.size()>1) {
double maxWidth = ((JStaffLine)m_staffLines.elementAt(0)).getWidth();
for (int i=1; i<m_staffLines.size();i++){
JStaffLine currentStaffLine = (JStaffLine)m_staffLines.elementAt(i);
maxWidth = Math.max(maxWidth, currentStaffLine.getWidth());
}
for (int i=0; i<m_staffLines.size();i++) {
JStaffLine currentStaffLine = (JStaffLine)m_staffLines.elementAt(i);
if (currentStaffLine.getWidth()>maxWidth/2)
currentStaffLine.scaleToWidth(maxWidth);
}
}
}
|
java
|
private void justify() {
if (m_staffLines.size()>1) {
double maxWidth = ((JStaffLine)m_staffLines.elementAt(0)).getWidth();
for (int i=1; i<m_staffLines.size();i++){
JStaffLine currentStaffLine = (JStaffLine)m_staffLines.elementAt(i);
maxWidth = Math.max(maxWidth, currentStaffLine.getWidth());
}
for (int i=0; i<m_staffLines.size();i++) {
JStaffLine currentStaffLine = (JStaffLine)m_staffLines.elementAt(i);
if (currentStaffLine.getWidth()>maxWidth/2)
currentStaffLine.scaleToWidth(maxWidth);
}
}
}
|
[
"private",
"void",
"justify",
"(",
")",
"{",
"if",
"(",
"m_staffLines",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"double",
"maxWidth",
"=",
"(",
"(",
"JStaffLine",
")",
"m_staffLines",
".",
"elementAt",
"(",
"0",
")",
")",
".",
"getWidth",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"m_staffLines",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"JStaffLine",
"currentStaffLine",
"=",
"(",
"JStaffLine",
")",
"m_staffLines",
".",
"elementAt",
"(",
"i",
")",
";",
"maxWidth",
"=",
"Math",
".",
"max",
"(",
"maxWidth",
",",
"currentStaffLine",
".",
"getWidth",
"(",
")",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_staffLines",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"JStaffLine",
"currentStaffLine",
"=",
"(",
"JStaffLine",
")",
"m_staffLines",
".",
"elementAt",
"(",
"i",
")",
";",
"if",
"(",
"currentStaffLine",
".",
"getWidth",
"(",
")",
">",
"maxWidth",
"/",
"2",
")",
"currentStaffLine",
".",
"scaleToWidth",
"(",
"maxWidth",
")",
";",
"}",
"}",
"}"
] |
Triggers the re computation of all staff lines elements in order to
get the alignment justified.
|
[
"Triggers",
"the",
"re",
"computation",
"of",
"all",
"staff",
"lines",
"elements",
"in",
"order",
"to",
"get",
"the",
"alignment",
"justified",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JTune.java#L978-L991
|
10,340
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JTune.java
|
JTune.getHighestNoteGlyphBetween
|
private JNoteElementAbstract getHighestNoteGlyphBetween(NoteAbstract start, NoteAbstract end, boolean excludeStartAndEnd) {
Collection jnotes = getNoteGlyphesBetween(start, end);
JNoteElementAbstract ret = null;
boolean first = true;
for (Iterator it = jnotes.iterator(); it.hasNext();) {
JNoteElementAbstract n = (JNoteElementAbstract) it.next();
if (first && excludeStartAndEnd) {
//ignore start ?
first = false;
continue;
}
if (!it.hasNext() && excludeStartAndEnd) {
//ignore end ?
break;
}
if (ret == null)
ret = n;
else {
if (n.getBoundingBox().getMinY()
< ret.getBoundingBox().getMinY())
ret = n;
}
}
return ret;
}
|
java
|
private JNoteElementAbstract getHighestNoteGlyphBetween(NoteAbstract start, NoteAbstract end, boolean excludeStartAndEnd) {
Collection jnotes = getNoteGlyphesBetween(start, end);
JNoteElementAbstract ret = null;
boolean first = true;
for (Iterator it = jnotes.iterator(); it.hasNext();) {
JNoteElementAbstract n = (JNoteElementAbstract) it.next();
if (first && excludeStartAndEnd) {
//ignore start ?
first = false;
continue;
}
if (!it.hasNext() && excludeStartAndEnd) {
//ignore end ?
break;
}
if (ret == null)
ret = n;
else {
if (n.getBoundingBox().getMinY()
< ret.getBoundingBox().getMinY())
ret = n;
}
}
return ret;
}
|
[
"private",
"JNoteElementAbstract",
"getHighestNoteGlyphBetween",
"(",
"NoteAbstract",
"start",
",",
"NoteAbstract",
"end",
",",
"boolean",
"excludeStartAndEnd",
")",
"{",
"Collection",
"jnotes",
"=",
"getNoteGlyphesBetween",
"(",
"start",
",",
"end",
")",
";",
"JNoteElementAbstract",
"ret",
"=",
"null",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Iterator",
"it",
"=",
"jnotes",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"JNoteElementAbstract",
"n",
"=",
"(",
"JNoteElementAbstract",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"first",
"&&",
"excludeStartAndEnd",
")",
"{",
"//ignore start ?\r",
"first",
"=",
"false",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"it",
".",
"hasNext",
"(",
")",
"&&",
"excludeStartAndEnd",
")",
"{",
"//ignore end ?\r",
"break",
";",
"}",
"if",
"(",
"ret",
"==",
"null",
")",
"ret",
"=",
"n",
";",
"else",
"{",
"if",
"(",
"n",
".",
"getBoundingBox",
"(",
")",
".",
"getMinY",
"(",
")",
"<",
"ret",
".",
"getBoundingBox",
"(",
")",
".",
"getMinY",
"(",
")",
")",
"ret",
"=",
"n",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Return the JNote that have the highest bounding box
@return a JNote. May return <code>null</code> if exclude is true and no notes between start and end!
|
[
"Return",
"the",
"JNote",
"that",
"have",
"the",
"highest",
"bounding",
"box"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JTune.java#L1453-L1477
|
10,341
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JTune.java
|
JTune.getNoteGlyphesBetween
|
private Collection getNoteGlyphesBetween(NoteAbstract start, NoteAbstract end) {
Collection jnotes = new Vector();
try {
Collection notes = m_music.getVoice(start.getReference().getVoice()).getNotesBetween(start, end);
for (Object note : notes) {
NoteAbstract n = (NoteAbstract) note;
jnotes.add(getRenditionObjectFor(n));
}
} catch (Exception e) {
// TODO: handle exception, shouldn't happen
}
return jnotes;
}
|
java
|
private Collection getNoteGlyphesBetween(NoteAbstract start, NoteAbstract end) {
Collection jnotes = new Vector();
try {
Collection notes = m_music.getVoice(start.getReference().getVoice()).getNotesBetween(start, end);
for (Object note : notes) {
NoteAbstract n = (NoteAbstract) note;
jnotes.add(getRenditionObjectFor(n));
}
} catch (Exception e) {
// TODO: handle exception, shouldn't happen
}
return jnotes;
}
|
[
"private",
"Collection",
"getNoteGlyphesBetween",
"(",
"NoteAbstract",
"start",
",",
"NoteAbstract",
"end",
")",
"{",
"Collection",
"jnotes",
"=",
"new",
"Vector",
"(",
")",
";",
"try",
"{",
"Collection",
"notes",
"=",
"m_music",
".",
"getVoice",
"(",
"start",
".",
"getReference",
"(",
")",
".",
"getVoice",
"(",
")",
")",
".",
"getNotesBetween",
"(",
"start",
",",
"end",
")",
";",
"for",
"(",
"Object",
"note",
":",
"notes",
")",
"{",
"NoteAbstract",
"n",
"=",
"(",
"NoteAbstract",
")",
"note",
";",
"jnotes",
".",
"add",
"(",
"getRenditionObjectFor",
"(",
"n",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// TODO: handle exception, shouldn't happen\r",
"}",
"return",
"jnotes",
";",
"}"
] |
Returns a Collection of JNote representing the note glyphes
between start and end NoteAbstract.
|
[
"Returns",
"a",
"Collection",
"of",
"JNote",
"representing",
"the",
"note",
"glyphes",
"between",
"start",
"and",
"end",
"NoteAbstract",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JTune.java#L1514-L1526
|
10,342
|
Sciss/abc4j
|
abcynth/src/main/java/abcynth/ui/TuneBookTable.java
|
TuneBookTable.setTuneBook
|
public void setTuneBook(AbcTuneBook book)
{
//System.out.println(getClass().getName() + "setTuneBook(" + book + ")");
//if (m_book!=null)
// m_book.removeListener(this);
m_model.setTuneBook(book);
try
{
int[] numbers = {0};// = m_book.getReferenceNumbers();
for (int i=0; i<numbers.length; i++)
{
//System.out.println(getClass().getName() + "retrieving " + (i+1) + "/" + numbers.length );
//m_parser.parseHeader(book.getTuneNotation(numbers[i]));
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
|
java
|
public void setTuneBook(AbcTuneBook book)
{
//System.out.println(getClass().getName() + "setTuneBook(" + book + ")");
//if (m_book!=null)
// m_book.removeListener(this);
m_model.setTuneBook(book);
try
{
int[] numbers = {0};// = m_book.getReferenceNumbers();
for (int i=0; i<numbers.length; i++)
{
//System.out.println(getClass().getName() + "retrieving " + (i+1) + "/" + numbers.length );
//m_parser.parseHeader(book.getTuneNotation(numbers[i]));
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
|
[
"public",
"void",
"setTuneBook",
"(",
"AbcTuneBook",
"book",
")",
"{",
"//System.out.println(getClass().getName() + \"setTuneBook(\" + book + \")\");",
"//if (m_book!=null)",
"// m_book.removeListener(this);",
"m_model",
".",
"setTuneBook",
"(",
"book",
")",
";",
"try",
"{",
"int",
"[",
"]",
"numbers",
"=",
"{",
"0",
"}",
";",
"// = m_book.getReferenceNumbers();",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numbers",
".",
"length",
";",
"i",
"++",
")",
"{",
"//System.out.println(getClass().getName() + \"retrieving \" + (i+1) + \"/\" + numbers.length );",
"//m_parser.parseHeader(book.getTuneNotation(numbers[i]));",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Sets the tunebook to be displayed in this table.
@param book The tunebook to be displayed in this table.
|
[
"Sets",
"the",
"tunebook",
"to",
"be",
"displayed",
"in",
"this",
"table",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abcynth/src/main/java/abcynth/ui/TuneBookTable.java#L263-L282
|
10,343
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Fraction.java
|
Fraction.multipliedBy
|
public float multipliedBy (Fraction fraction)
{
int newNumerator = numerator * fraction.getNumerator();
int newDenominator = denominator * fraction.getDenominator();
return (newNumerator/newDenominator);
}
|
java
|
public float multipliedBy (Fraction fraction)
{
int newNumerator = numerator * fraction.getNumerator();
int newDenominator = denominator * fraction.getDenominator();
return (newNumerator/newDenominator);
}
|
[
"public",
"float",
"multipliedBy",
"(",
"Fraction",
"fraction",
")",
"{",
"int",
"newNumerator",
"=",
"numerator",
"*",
"fraction",
".",
"getNumerator",
"(",
")",
";",
"int",
"newDenominator",
"=",
"denominator",
"*",
"fraction",
".",
"getDenominator",
"(",
")",
";",
"return",
"(",
"newNumerator",
"/",
"newDenominator",
")",
";",
"}"
] |
Returns the float result of the multiplication of
this fraction by the specified fraction.
This fraction remains unchanged.
@param fraction A Fraction.
@return The result of the multiplication of this fraction by the specified
one.
|
[
"Returns",
"the",
"float",
"result",
"of",
"the",
"multiplication",
"of",
"this",
"fraction",
"by",
"the",
"specified",
"fraction",
".",
"This",
"fraction",
"remains",
"unchanged",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Fraction.java#L88-L93
|
10,344
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/LabelService.java
|
LabelService.list
|
public Collection<Label> list(List<String> queryParams)
{
return HTTP.GET("/v2/labels.json", null, queryParams, LABELS).get();
}
|
java
|
public Collection<Label> list(List<String> queryParams)
{
return HTTP.GET("/v2/labels.json", null, queryParams, LABELS).get();
}
|
[
"public",
"Collection",
"<",
"Label",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/labels.json\"",
",",
"null",
",",
"queryParams",
",",
"LABELS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of labels.
@param queryParams The query parameters
@return The set of labels
|
[
"Returns",
"the",
"set",
"of",
"labels",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/LabelService.java#L49-L52
|
10,345
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/LabelService.java
|
LabelService.delete
|
public LabelService delete(String key)
{
HTTP.DELETE(String.format("/v2/labels/%s.json", encode(key)));
return this;
}
|
java
|
public LabelService delete(String key)
{
HTTP.DELETE(String.format("/v2/labels/%s.json", encode(key)));
return this;
}
|
[
"public",
"LabelService",
"delete",
"(",
"String",
"key",
")",
"{",
"HTTP",
".",
"DELETE",
"(",
"String",
".",
"format",
"(",
"\"/v2/labels/%s.json\"",
",",
"encode",
"(",
"key",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Deletes the label with the given key.
@param key The key of the label to delete
@return This object
|
[
"Deletes",
"the",
"label",
"with",
"the",
"given",
"key",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/LabelService.java#L115-L119
|
10,346
|
intendia-oss/rxjava-gwt
|
src/main/modified/io/reactivex/super/io/reactivex/Maybe.java
|
Maybe.zipWith
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final <U, R> Maybe<R> zipWith(MaybeSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) {
ObjectHelper.requireNonNull(other, "other is null");
return zip(this, other, zipper);
}
|
java
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final <U, R> Maybe<R> zipWith(MaybeSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) {
ObjectHelper.requireNonNull(other, "other is null");
return zip(this, other, zipper);
}
|
[
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"U",
",",
"R",
">",
"Maybe",
"<",
"R",
">",
"zipWith",
"(",
"MaybeSource",
"<",
"?",
"extends",
"U",
">",
"other",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"U",
",",
"?",
"extends",
"R",
">",
"zipper",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"other",
",",
"\"other is null\"",
")",
";",
"return",
"zip",
"(",
"this",
",",
"other",
",",
"zipper",
")",
";",
"}"
] |
Waits until this and the other MaybeSource signal a success value then applies the given BiFunction
to those values and emits the BiFunction's resulting value to downstream.
<img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<p>If either this or the other MaybeSource is empty or signals an error, the resulting Maybe will
terminate immediately and dispose the other source.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code zipWith} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <U>
the type of items emitted by the {@code other} MaybeSource
@param <R>
the type of items emitted by the resulting Maybe
@param other
the other MaybeSource
@param zipper
a function that combines the pairs of items from the two MaybeSources to generate the items to
be emitted by the resulting Maybe
@return the new Maybe instance
@see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a>
|
[
"Waits",
"until",
"this",
"and",
"the",
"other",
"MaybeSource",
"signal",
"a",
"success",
"value",
"then",
"applies",
"the",
"given",
"BiFunction",
"to",
"those",
"values",
"and",
"emits",
"the",
"BiFunction",
"s",
"resulting",
"value",
"to",
"downstream",
"."
] |
8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa
|
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L4568-L4573
|
10,347
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertConditionService.java
|
AlertConditionService.create
|
public Optional<AlertCondition> create(long policyId, AlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_conditions/policies/%d.json", policyId), condition, ALERT_CONDITION);
}
|
java
|
public Optional<AlertCondition> create(long policyId, AlertCondition condition)
{
return HTTP.POST(String.format("/v2/alerts_conditions/policies/%d.json", policyId), condition, ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"AlertCondition",
">",
"create",
"(",
"long",
"policyId",
",",
"AlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"POST",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_conditions/policies/%d.json\"",
",",
"policyId",
")",
",",
"condition",
",",
"ALERT_CONDITION",
")",
";",
"}"
] |
Creates the given alert condition.
@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",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertConditionService.java#L108-L111
|
10,348
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertConditionService.java
|
AlertConditionService.update
|
public Optional<AlertCondition> update(AlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_conditions/%d.json", condition.getId()), condition, ALERT_CONDITION);
}
|
java
|
public Optional<AlertCondition> update(AlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_conditions/%d.json", condition.getId()), condition, ALERT_CONDITION);
}
|
[
"public",
"Optional",
"<",
"AlertCondition",
">",
"update",
"(",
"AlertCondition",
"condition",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_conditions/%d.json\"",
",",
"condition",
".",
"getId",
"(",
")",
")",
",",
"condition",
",",
"ALERT_CONDITION",
")",
";",
"}"
] |
Updates the given alert condition.
@param condition The alert condition to update
@return The alert condition that was updated
|
[
"Updates",
"the",
"given",
"alert",
"condition",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertConditionService.java#L118-L121
|
10,349
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Interval.java
|
Interval.getSemitones
|
public int getSemitones() {
int semitones = 0;
switch (getLabel() % OCTAVE) {
case UNISON: semitones = 0; break; //unison
case SECOND: semitones = 2; break; //major 2nd
case THIRD: semitones = 4; break; //major 3rd
case FOURTH: semitones = 5; break; //perfect 4th
case FIFTH: semitones = 7; break; //perfect 5th
case SIXTH: semitones = 9; break; //major 6th
case SEVENTH: semitones = 11; break; //major 7th
}
switch (getQuality()) {
case QUADRUPLE_DIMINISHED:
case TRIPLE_DIMINISHED:
case DOUBLE_DIMINISHED:
case DIMINISHED:
if (allowPerfectQuality())
semitones += getQuality() + 1;
else
semitones += getQuality();
break;
case MINOR: semitones -= 1; break;
case PERFECT:
case MAJOR: break; //do not change pitch for major and perfect
case AUGMENTED:
case DOUBLE_AUGMENTED:
case TRIPLE_AUGMENTED:
case QUADRUPLE_AUGMENTED:
semitones += getQuality() - 1;
break;
}
semitones += 12 * getOctaveNumber();
return semitones;
}
|
java
|
public int getSemitones() {
int semitones = 0;
switch (getLabel() % OCTAVE) {
case UNISON: semitones = 0; break; //unison
case SECOND: semitones = 2; break; //major 2nd
case THIRD: semitones = 4; break; //major 3rd
case FOURTH: semitones = 5; break; //perfect 4th
case FIFTH: semitones = 7; break; //perfect 5th
case SIXTH: semitones = 9; break; //major 6th
case SEVENTH: semitones = 11; break; //major 7th
}
switch (getQuality()) {
case QUADRUPLE_DIMINISHED:
case TRIPLE_DIMINISHED:
case DOUBLE_DIMINISHED:
case DIMINISHED:
if (allowPerfectQuality())
semitones += getQuality() + 1;
else
semitones += getQuality();
break;
case MINOR: semitones -= 1; break;
case PERFECT:
case MAJOR: break; //do not change pitch for major and perfect
case AUGMENTED:
case DOUBLE_AUGMENTED:
case TRIPLE_AUGMENTED:
case QUADRUPLE_AUGMENTED:
semitones += getQuality() - 1;
break;
}
semitones += 12 * getOctaveNumber();
return semitones;
}
|
[
"public",
"int",
"getSemitones",
"(",
")",
"{",
"int",
"semitones",
"=",
"0",
";",
"switch",
"(",
"getLabel",
"(",
")",
"%",
"OCTAVE",
")",
"{",
"case",
"UNISON",
":",
"semitones",
"=",
"0",
";",
"break",
";",
"//unison\r",
"case",
"SECOND",
":",
"semitones",
"=",
"2",
";",
"break",
";",
"//major 2nd\r",
"case",
"THIRD",
":",
"semitones",
"=",
"4",
";",
"break",
";",
"//major 3rd\r",
"case",
"FOURTH",
":",
"semitones",
"=",
"5",
";",
"break",
";",
"//perfect 4th\r",
"case",
"FIFTH",
":",
"semitones",
"=",
"7",
";",
"break",
";",
"//perfect 5th\r",
"case",
"SIXTH",
":",
"semitones",
"=",
"9",
";",
"break",
";",
"//major 6th\r",
"case",
"SEVENTH",
":",
"semitones",
"=",
"11",
";",
"break",
";",
"//major 7th\r",
"}",
"switch",
"(",
"getQuality",
"(",
")",
")",
"{",
"case",
"QUADRUPLE_DIMINISHED",
":",
"case",
"TRIPLE_DIMINISHED",
":",
"case",
"DOUBLE_DIMINISHED",
":",
"case",
"DIMINISHED",
":",
"if",
"(",
"allowPerfectQuality",
"(",
")",
")",
"semitones",
"+=",
"getQuality",
"(",
")",
"+",
"1",
";",
"else",
"semitones",
"+=",
"getQuality",
"(",
")",
";",
"break",
";",
"case",
"MINOR",
":",
"semitones",
"-=",
"1",
";",
"break",
";",
"case",
"PERFECT",
":",
"case",
"MAJOR",
":",
"break",
";",
"//do not change pitch for major and perfect\r",
"case",
"AUGMENTED",
":",
"case",
"DOUBLE_AUGMENTED",
":",
"case",
"TRIPLE_AUGMENTED",
":",
"case",
"QUADRUPLE_AUGMENTED",
":",
"semitones",
"+=",
"getQuality",
"(",
")",
"-",
"1",
";",
"break",
";",
"}",
"semitones",
"+=",
"12",
"*",
"getOctaveNumber",
"(",
")",
";",
"return",
"semitones",
";",
"}"
] |
Return the number of semitones between 2 notes spaced by
this Interval
|
[
"Return",
"the",
"number",
"of",
"semitones",
"between",
"2",
"notes",
"spaced",
"by",
"this",
"Interval"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Interval.java#L310-L343
|
10,350
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyService.java
|
AlertPolicyService.list
|
public Collection<AlertPolicy> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_policies.json", null, queryParams, ALERT_POLICIES).get();
}
|
java
|
public Collection<AlertPolicy> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_policies.json", null, queryParams, ALERT_POLICIES).get();
}
|
[
"public",
"Collection",
"<",
"AlertPolicy",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/alerts_policies.json\"",
",",
"null",
",",
"queryParams",
",",
"ALERT_POLICIES",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of alert policies.
@param queryParams The query parameters
@return The set of alert policies
|
[
"Returns",
"the",
"set",
"of",
"alert",
"policies",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyService.java#L48-L51
|
10,351
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyService.java
|
AlertPolicyService.list
|
public Collection<AlertPolicy> list(String name)
{
return list(filters().name(name).build());
}
|
java
|
public Collection<AlertPolicy> list(String name)
{
return list(filters().name(name).build());
}
|
[
"public",
"Collection",
"<",
"AlertPolicy",
">",
"list",
"(",
"String",
"name",
")",
"{",
"return",
"list",
"(",
"filters",
"(",
")",
".",
"name",
"(",
"name",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] |
Returns the set of alert policies with the given name.
@param name The name of the alert policy to return
@return The set of alert policies
|
[
"Returns",
"the",
"set",
"of",
"alert",
"policies",
"with",
"the",
"given",
"name",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyService.java#L68-L71
|
10,352
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyService.java
|
AlertPolicyService.update
|
public Optional<AlertPolicy> update(AlertPolicy policy)
{
return HTTP.PUT(String.format("/v2/alerts_policies/%d.json", policy.getId()), policy, ALERT_POLICY);
}
|
java
|
public Optional<AlertPolicy> update(AlertPolicy policy)
{
return HTTP.PUT(String.format("/v2/alerts_policies/%d.json", policy.getId()), policy, ALERT_POLICY);
}
|
[
"public",
"Optional",
"<",
"AlertPolicy",
">",
"update",
"(",
"AlertPolicy",
"policy",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_policies/%d.json\"",
",",
"policy",
".",
"getId",
"(",
")",
")",
",",
"policy",
",",
"ALERT_POLICY",
")",
";",
"}"
] |
Updates the given alert policy.
@param policy The alert policy to update
@return The alert policy that was updated
|
[
"Updates",
"the",
"given",
"alert",
"policy",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyService.java#L120-L123
|
10,353
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/plugins/Component.java
|
Component.addMetric
|
public <T> void addMetric(String name, MetricTimeslice<T> timeslice)
{
metrics.put(name, timeslice);
}
|
java
|
public <T> void addMetric(String name, MetricTimeslice<T> timeslice)
{
metrics.put(name, timeslice);
}
|
[
"public",
"<",
"T",
">",
"void",
"addMetric",
"(",
"String",
"name",
",",
"MetricTimeslice",
"<",
"T",
">",
"timeslice",
")",
"{",
"metrics",
".",
"put",
"(",
"name",
",",
"timeslice",
")",
";",
"}"
] |
Adds a metric to the set of metrics.
@param <T> The type parameter used for the timeslice
@param name The name of the metric
@param timeslice The values representing the metric timeslice
|
[
"Adds",
"a",
"metric",
"to",
"the",
"set",
"of",
"metrics",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/plugins/Component.java#L154-L157
|
10,354
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/BarLine.java
|
BarLine.convertToBarLine
|
public static byte[] convertToBarLine(String barLine) {
byte[] barlineTypes = new byte[] { SIMPLE };
if (barLine.equals("::")
|| barLine.equals(":|:")
|| barLine.equals(":||:")) {
//barlineTypes = new byte[2];
//barlineTypes[0] = BarLine.REPEAT_CLOSE;
//barlineTypes[1] = BarLine.REPEAT_OPEN;
barlineTypes = new byte[] { CLOSE_AND_OPEN_REPEAT };
} else if (barLine.equals("|")) {
barlineTypes = new byte[] { SIMPLE };
} else if (barLine.equals("||")) {
barlineTypes = new byte[] { DOUBLE };
} else if (barLine.equals("[|")
|| barLine.equals("[||")) {
barlineTypes = new byte[] { BEGIN };
} else if (barLine.equals("|]")
|| barLine.equals("||]")) {
barlineTypes = new byte[] { END };
} else if (barLine.equals(":|")
|| barLine.equals(":||")
|| barLine.equals(":|]")
|| barLine.startsWith(":::")) {
barlineTypes = new byte[] { REPEAT_CLOSE };
} else if (barLine.equals("|:")
|| barLine.equals("||:")
|| barLine.equals("[|:")
|| barLine.endsWith(":::")) {
barlineTypes = new byte[] { REPEAT_OPEN };
} else if (barLine.equals("|::")
|| barLine.equals("[::")) {
barlineTypes = new byte[] { DOUBLE_REPEAT_OPEN };
} else if (barLine.equals("::|")
|| barLine.equals("::]")) {
barlineTypes = new byte[] { DOUBLE_REPEAT_CLOSE };
} else if (barLine.equals(".|")
|| barLine.equals(".|.")
|| barLine.equals(":")) {
barlineTypes = new byte[] { DOTTED };
} else if (barLine.equals("[|]")
|| barLine.equals("[]")) {
barlineTypes = new byte[] { INVISIBLE };
} else if (barLine.equals("|]|")
|| barLine.equals("|||")
|| barLine.equals("|[|")) {
barlineTypes = new byte[] { TRIPLE };
}
return barlineTypes;
}
|
java
|
public static byte[] convertToBarLine(String barLine) {
byte[] barlineTypes = new byte[] { SIMPLE };
if (barLine.equals("::")
|| barLine.equals(":|:")
|| barLine.equals(":||:")) {
//barlineTypes = new byte[2];
//barlineTypes[0] = BarLine.REPEAT_CLOSE;
//barlineTypes[1] = BarLine.REPEAT_OPEN;
barlineTypes = new byte[] { CLOSE_AND_OPEN_REPEAT };
} else if (barLine.equals("|")) {
barlineTypes = new byte[] { SIMPLE };
} else if (barLine.equals("||")) {
barlineTypes = new byte[] { DOUBLE };
} else if (barLine.equals("[|")
|| barLine.equals("[||")) {
barlineTypes = new byte[] { BEGIN };
} else if (barLine.equals("|]")
|| barLine.equals("||]")) {
barlineTypes = new byte[] { END };
} else if (barLine.equals(":|")
|| barLine.equals(":||")
|| barLine.equals(":|]")
|| barLine.startsWith(":::")) {
barlineTypes = new byte[] { REPEAT_CLOSE };
} else if (barLine.equals("|:")
|| barLine.equals("||:")
|| barLine.equals("[|:")
|| barLine.endsWith(":::")) {
barlineTypes = new byte[] { REPEAT_OPEN };
} else if (barLine.equals("|::")
|| barLine.equals("[::")) {
barlineTypes = new byte[] { DOUBLE_REPEAT_OPEN };
} else if (barLine.equals("::|")
|| barLine.equals("::]")) {
barlineTypes = new byte[] { DOUBLE_REPEAT_CLOSE };
} else if (barLine.equals(".|")
|| barLine.equals(".|.")
|| barLine.equals(":")) {
barlineTypes = new byte[] { DOTTED };
} else if (barLine.equals("[|]")
|| barLine.equals("[]")) {
barlineTypes = new byte[] { INVISIBLE };
} else if (barLine.equals("|]|")
|| barLine.equals("|||")
|| barLine.equals("|[|")) {
barlineTypes = new byte[] { TRIPLE };
}
return barlineTypes;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"convertToBarLine",
"(",
"String",
"barLine",
")",
"{",
"byte",
"[",
"]",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"SIMPLE",
"}",
";",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"::\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\":|:\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\":||:\"",
")",
")",
"{",
"//barlineTypes = new byte[2];\r",
"//barlineTypes[0] = BarLine.REPEAT_CLOSE;\r",
"//barlineTypes[1] = BarLine.REPEAT_OPEN;\r",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"CLOSE_AND_OPEN_REPEAT",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"|\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"SIMPLE",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"||\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"DOUBLE",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"[|\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"[||\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"BEGIN",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"|]\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"||]\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"END",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\":|\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\":||\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\":|]\"",
")",
"||",
"barLine",
".",
"startsWith",
"(",
"\":::\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"REPEAT_CLOSE",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"|:\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"||:\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"[|:\"",
")",
"||",
"barLine",
".",
"endsWith",
"(",
"\":::\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"REPEAT_OPEN",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"|::\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"[::\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"DOUBLE_REPEAT_OPEN",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"::|\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"::]\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"DOUBLE_REPEAT_CLOSE",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\".|\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\".|.\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\":\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"DOTTED",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"[|]\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"[]\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"INVISIBLE",
"}",
";",
"}",
"else",
"if",
"(",
"barLine",
".",
"equals",
"(",
"\"|]|\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"|||\"",
")",
"||",
"barLine",
".",
"equals",
"(",
"\"|[|\"",
")",
")",
"{",
"barlineTypes",
"=",
"new",
"byte",
"[",
"]",
"{",
"TRIPLE",
"}",
";",
"}",
"return",
"barlineTypes",
";",
"}"
] |
Converts the specified string to a bar line type.
@param barLine
The string to be converted as a bar line. Possible values are
<TT>|</TT>, <TT>||</TT>, <TT>[|</TT>, <TT>|]</TT>,
<TT>:|</TT>, <TT>|:</TT>, <TT>::</TT>...
@return The bar line type corresponding to the given string. <TT>null</TT>
is returned if no type matches the string.
|
[
"Converts",
"the",
"specified",
"string",
"to",
"a",
"bar",
"line",
"type",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/BarLine.java#L83-L131
|
10,355
|
Sciss/abc4j
|
abc/src/main/java/abc/midi/TunePlayer.java
|
TunePlayer.play
|
public void play(Tune tune) throws IllegalStateException
{
if (m_isStarted)
{
try
{
m_tune = tune;
Sequence sequence = m_converter.toMidiSequence(m_tune);
seq.setSequence(sequence);
seq.setTempoInBPM(m_tempo);
seq.start();
}
catch (Exception e)
{ e.printStackTrace(); }
}
else
throw new IllegalStateException("The player hasn't been started yet !");
}
|
java
|
public void play(Tune tune) throws IllegalStateException
{
if (m_isStarted)
{
try
{
m_tune = tune;
Sequence sequence = m_converter.toMidiSequence(m_tune);
seq.setSequence(sequence);
seq.setTempoInBPM(m_tempo);
seq.start();
}
catch (Exception e)
{ e.printStackTrace(); }
}
else
throw new IllegalStateException("The player hasn't been started yet !");
}
|
[
"public",
"void",
"play",
"(",
"Tune",
"tune",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"m_isStarted",
")",
"{",
"try",
"{",
"m_tune",
"=",
"tune",
";",
"Sequence",
"sequence",
"=",
"m_converter",
".",
"toMidiSequence",
"(",
"m_tune",
")",
";",
"seq",
".",
"setSequence",
"(",
"sequence",
")",
";",
"seq",
".",
"setTempoInBPM",
"(",
"m_tempo",
")",
";",
"seq",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"else",
"throw",
"new",
"IllegalStateException",
"(",
"\"The player hasn't been started yet !\"",
")",
";",
"}"
] |
Plays the given tune.
@param tune The tune to be played.
@exception IllegalStateException Thrown if the player hasn't been started
before.
|
[
"Plays",
"the",
"given",
"tune",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/midi/TunePlayer.java#L137-L154
|
10,356
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcTuneBook.java
|
AbcTuneBook.removeTune
|
public Tune removeTune(int referenceNumber) {
Tune ret = super.removeTune(referenceNumber);
if (ret != null) {
notifyListenersForTuneChange(new TuneChangeEvent(this,
TuneChangeEvent.TUNE_REMOVED, ret));
}
return ret;
}
|
java
|
public Tune removeTune(int referenceNumber) {
Tune ret = super.removeTune(referenceNumber);
if (ret != null) {
notifyListenersForTuneChange(new TuneChangeEvent(this,
TuneChangeEvent.TUNE_REMOVED, ret));
}
return ret;
}
|
[
"public",
"Tune",
"removeTune",
"(",
"int",
"referenceNumber",
")",
"{",
"Tune",
"ret",
"=",
"super",
".",
"removeTune",
"(",
"referenceNumber",
")",
";",
"if",
"(",
"ret",
"!=",
"null",
")",
"{",
"notifyListenersForTuneChange",
"(",
"new",
"TuneChangeEvent",
"(",
"this",
",",
"TuneChangeEvent",
".",
"TUNE_REMOVED",
",",
"ret",
")",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Removes the tune having the requested reference number from the book
@param referenceNumber
@return the removed tune, null if didn't exist.
|
[
"Removes",
"the",
"tune",
"having",
"the",
"requested",
"reference",
"number",
"from",
"the",
"book"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcTuneBook.java#L133-L140
|
10,357
|
Sciss/abc4j
|
abc/src/main/java/abc/parser/AbcTuneBook.java
|
AbcTuneBook.saveTo
|
public void saveTo(File file) throws IOException {
FileWriter writer = new FileWriter(file);
try {
writer.write(getAbcString());
} finally {
writer.close();
}
}
|
java
|
public void saveTo(File file) throws IOException {
FileWriter writer = new FileWriter(file);
try {
writer.write(getAbcString());
} finally {
writer.close();
}
}
|
[
"public",
"void",
"saveTo",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileWriter",
"writer",
"=",
"new",
"FileWriter",
"(",
"file",
")",
";",
"try",
"{",
"writer",
".",
"write",
"(",
"getAbcString",
"(",
")",
")",
";",
"}",
"finally",
"{",
"writer",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Saves the ABC source String to file.
@param file
@throws IOException
|
[
"Saves",
"the",
"ABC",
"source",
"String",
"to",
"file",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcTuneBook.java#L148-L155
|
10,358
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ServerService.java
|
ServerService.list
|
public Collection<Server> list(List<String> queryParams)
{
return HTTP.GET("/v2/servers.json", null, queryParams, SERVERS).get();
}
|
java
|
public Collection<Server> list(List<String> queryParams)
{
return HTTP.GET("/v2/servers.json", null, queryParams, SERVERS).get();
}
|
[
"public",
"Collection",
"<",
"Server",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/servers.json\"",
",",
"null",
",",
"queryParams",
",",
"SERVERS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of servers with the given query parameters.
@param queryParams The query parameters
@return The set of servers
|
[
"Returns",
"the",
"set",
"of",
"servers",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ServerService.java#L53-L56
|
10,359
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ServerService.java
|
ServerService.list
|
public Collection<Server> list(String name)
{
List<Server> ret = new ArrayList<Server>();
Collection<Server> servers = list();
for(Server server : servers)
{
if(name == null || server.getName().equals(name))
ret.add(server);
}
return ret;
}
|
java
|
public Collection<Server> list(String name)
{
List<Server> ret = new ArrayList<Server>();
Collection<Server> servers = list();
for(Server server : servers)
{
if(name == null || server.getName().equals(name))
ret.add(server);
}
return ret;
}
|
[
"public",
"Collection",
"<",
"Server",
">",
"list",
"(",
"String",
"name",
")",
"{",
"List",
"<",
"Server",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"Server",
">",
"(",
")",
";",
"Collection",
"<",
"Server",
">",
"servers",
"=",
"list",
"(",
")",
";",
"for",
"(",
"Server",
"server",
":",
"servers",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"server",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"ret",
".",
"add",
"(",
"server",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns the set of servers for the given name.
@param name The name of the servers
@return The set of servers
|
[
"Returns",
"the",
"set",
"of",
"servers",
"for",
"the",
"given",
"name",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ServerService.java#L73-L83
|
10,360
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ServerService.java
|
ServerService.show
|
public Optional<Server> show(long serverId)
{
return HTTP.GET(String.format("/v2/servers/%d.json", serverId), SERVER);
}
|
java
|
public Optional<Server> show(long serverId)
{
return HTTP.GET(String.format("/v2/servers/%d.json", serverId), SERVER);
}
|
[
"public",
"Optional",
"<",
"Server",
">",
"show",
"(",
"long",
"serverId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/servers/%d.json\"",
",",
"serverId",
")",
",",
"SERVER",
")",
";",
"}"
] |
Returns the server for the given server id.
@param serverId The id for the server to return
@return The server
|
[
"Returns",
"the",
"server",
"for",
"the",
"given",
"server",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ServerService.java#L90-L93
|
10,361
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ServerService.java
|
ServerService.update
|
public Optional<Server> update(Server server)
{
return HTTP.PUT(String.format("/v2/servers/%d.json", server.getId()), server, SERVER);
}
|
java
|
public Optional<Server> update(Server server)
{
return HTTP.PUT(String.format("/v2/servers/%d.json", server.getId()), server, SERVER);
}
|
[
"public",
"Optional",
"<",
"Server",
">",
"update",
"(",
"Server",
"server",
")",
"{",
"return",
"HTTP",
".",
"PUT",
"(",
"String",
".",
"format",
"(",
"\"/v2/servers/%d.json\"",
",",
"server",
".",
"getId",
"(",
")",
")",
",",
"server",
",",
"SERVER",
")",
";",
"}"
] |
Updates the given server.
@param server The server to update
@return The server that was updated
|
[
"Updates",
"the",
"given",
"server",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ServerService.java#L100-L103
|
10,362
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JText.java
|
JText.getWidth
|
public double getWidth() {
String[] lines = getTextLines();
double max = 0;
for (String line : lines) {
max = Math.max(max,
(double) getMetrics().getTextFontWidth(m_textField, line)
);
}
return max;
}
|
java
|
public double getWidth() {
String[] lines = getTextLines();
double max = 0;
for (String line : lines) {
max = Math.max(max,
(double) getMetrics().getTextFontWidth(m_textField, line)
);
}
return max;
}
|
[
"public",
"double",
"getWidth",
"(",
")",
"{",
"String",
"[",
"]",
"lines",
"=",
"getTextLines",
"(",
")",
";",
"double",
"max",
"=",
"0",
";",
"for",
"(",
"String",
"line",
":",
"lines",
")",
"{",
"max",
"=",
"Math",
".",
"max",
"(",
"max",
",",
"(",
"double",
")",
"getMetrics",
"(",
")",
".",
"getTextFontWidth",
"(",
"m_textField",
",",
"line",
")",
")",
";",
"}",
"return",
"max",
";",
"}"
] |
Returns the width of this score element.
@return The width of this score element.
|
[
"Returns",
"the",
"width",
"of",
"this",
"score",
"element",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JText.java#L220-L229
|
10,363
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java
|
AlertChannelService.list
|
public Collection<AlertChannel> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_channels.json", null, queryParams, ALERT_CHANNELS).get();
}
|
java
|
public Collection<AlertChannel> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_channels.json", null, queryParams, ALERT_CHANNELS).get();
}
|
[
"public",
"Collection",
"<",
"AlertChannel",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/alerts_channels.json\"",
",",
"null",
",",
"queryParams",
",",
"ALERT_CHANNELS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of alert channels.
@param queryParams The query parameters
@return The set of alert channels
|
[
"Returns",
"the",
"set",
"of",
"alert",
"channels",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java#L52-L55
|
10,364
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java
|
AlertChannelService.list
|
public Collection<AlertChannel> list(String name)
{
List<AlertChannel> ret = new ArrayList<AlertChannel>();
Collection<AlertChannel> channels = list();
for(AlertChannel channel : channels)
{
if(channel.getName().equals(name))
ret.add(channel);
}
return ret;
}
|
java
|
public Collection<AlertChannel> list(String name)
{
List<AlertChannel> ret = new ArrayList<AlertChannel>();
Collection<AlertChannel> channels = list();
for(AlertChannel channel : channels)
{
if(channel.getName().equals(name))
ret.add(channel);
}
return ret;
}
|
[
"public",
"Collection",
"<",
"AlertChannel",
">",
"list",
"(",
"String",
"name",
")",
"{",
"List",
"<",
"AlertChannel",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"AlertChannel",
">",
"(",
")",
";",
"Collection",
"<",
"AlertChannel",
">",
"channels",
"=",
"list",
"(",
")",
";",
"for",
"(",
"AlertChannel",
"channel",
":",
"channels",
")",
"{",
"if",
"(",
"channel",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"ret",
".",
"add",
"(",
"channel",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns the set of alert channels with the given name.
@param name The name of the alert channels to return
@return The set of alert channels
|
[
"Returns",
"the",
"set",
"of",
"alert",
"channels",
"with",
"the",
"given",
"name",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java#L72-L82
|
10,365
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java
|
AlertChannelService.list
|
public Collection<AlertChannel> list(long policyId)
{
Map<Long,AlertChannel> map = new HashMap<Long,AlertChannel>();
Collection<AlertChannel> channels = list();
for(AlertChannel channel : channels)
{
List<Long> channelPolicyIds = channel.getLinks().getPolicyIds();
for(long channelPolicyId : channelPolicyIds)
{
if(channelPolicyId == policyId)
map.put(channel.getId(), channel);
}
}
return map.values();
}
|
java
|
public Collection<AlertChannel> list(long policyId)
{
Map<Long,AlertChannel> map = new HashMap<Long,AlertChannel>();
Collection<AlertChannel> channels = list();
for(AlertChannel channel : channels)
{
List<Long> channelPolicyIds = channel.getLinks().getPolicyIds();
for(long channelPolicyId : channelPolicyIds)
{
if(channelPolicyId == policyId)
map.put(channel.getId(), channel);
}
}
return map.values();
}
|
[
"public",
"Collection",
"<",
"AlertChannel",
">",
"list",
"(",
"long",
"policyId",
")",
"{",
"Map",
"<",
"Long",
",",
"AlertChannel",
">",
"map",
"=",
"new",
"HashMap",
"<",
"Long",
",",
"AlertChannel",
">",
"(",
")",
";",
"Collection",
"<",
"AlertChannel",
">",
"channels",
"=",
"list",
"(",
")",
";",
"for",
"(",
"AlertChannel",
"channel",
":",
"channels",
")",
"{",
"List",
"<",
"Long",
">",
"channelPolicyIds",
"=",
"channel",
".",
"getLinks",
"(",
")",
".",
"getPolicyIds",
"(",
")",
";",
"for",
"(",
"long",
"channelPolicyId",
":",
"channelPolicyIds",
")",
"{",
"if",
"(",
"channelPolicyId",
"==",
"policyId",
")",
"map",
".",
"put",
"(",
"channel",
".",
"getId",
"(",
")",
",",
"channel",
")",
";",
"}",
"}",
"return",
"map",
".",
"values",
"(",
")",
";",
"}"
] |
Returns the set of alert channels for the given policy id.
@param policyId The id of the policy for the alert channels
@return The set of alert channels
|
[
"Returns",
"the",
"set",
"of",
"alert",
"channels",
"for",
"the",
"given",
"policy",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java#L110-L124
|
10,366
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java
|
AlertChannelService.create
|
public Optional<AlertChannel> create(AlertChannel channel)
{
return Optional.of(HTTP.POST("/v2/alerts_channels.json", channel, ALERT_CHANNELS).get().iterator().next());
}
|
java
|
public Optional<AlertChannel> create(AlertChannel channel)
{
return Optional.of(HTTP.POST("/v2/alerts_channels.json", channel, ALERT_CHANNELS).get().iterator().next());
}
|
[
"public",
"Optional",
"<",
"AlertChannel",
">",
"create",
"(",
"AlertChannel",
"channel",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"HTTP",
".",
"POST",
"(",
"\"/v2/alerts_channels.json\"",
",",
"channel",
",",
"ALERT_CHANNELS",
")",
".",
"get",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}"
] |
Creates the given alert channel.
@param channel The alert channel to create
@return The alert channel that was created
|
[
"Creates",
"the",
"given",
"alert",
"channel",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertChannelService.java#L150-L153
|
10,367
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Chord.java
|
Chord.getText
|
public String getText(boolean unicode) {
if (!isChord())
return m_chordName;
else {
StringBuilder ret = new StringBuilder();
if (isOptional())
ret.append("(");
ret.append(note2string(getNote(), unicode));
ret.append(getQuality());
if (hasBass()) {
ret.append("/");
ret.append(note2string(getBass(), unicode));
}
if (isOptional())
ret.append(")");
return ret.toString();
}
}
|
java
|
public String getText(boolean unicode) {
if (!isChord())
return m_chordName;
else {
StringBuilder ret = new StringBuilder();
if (isOptional())
ret.append("(");
ret.append(note2string(getNote(), unicode));
ret.append(getQuality());
if (hasBass()) {
ret.append("/");
ret.append(note2string(getBass(), unicode));
}
if (isOptional())
ret.append(")");
return ret.toString();
}
}
|
[
"public",
"String",
"getText",
"(",
"boolean",
"unicode",
")",
"{",
"if",
"(",
"!",
"isChord",
"(",
")",
")",
"return",
"m_chordName",
";",
"else",
"{",
"StringBuilder",
"ret",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"isOptional",
"(",
")",
")",
"ret",
".",
"append",
"(",
"\"(\"",
")",
";",
"ret",
".",
"append",
"(",
"note2string",
"(",
"getNote",
"(",
")",
",",
"unicode",
")",
")",
";",
"ret",
".",
"append",
"(",
"getQuality",
"(",
")",
")",
";",
"if",
"(",
"hasBass",
"(",
")",
")",
"{",
"ret",
".",
"append",
"(",
"\"/\"",
")",
";",
"ret",
".",
"append",
"(",
"note2string",
"(",
"getBass",
"(",
")",
",",
"unicode",
")",
")",
";",
"}",
"if",
"(",
"isOptional",
"(",
")",
")",
"ret",
".",
"append",
"(",
"\")\"",
")",
";",
"return",
"ret",
".",
"toString",
"(",
")",
";",
"}",
"}"
] |
Returns the text of the chord.
Returns the original text if it's not a real chord
@param unicode If any, accidentals are not # and b, but
\u266F (♯) = sharp and \u266D (♭) = flat
|
[
"Returns",
"the",
"text",
"of",
"the",
"chord",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Chord.java#L196-L213
|
10,368
|
Sciss/abc4j
|
abc/src/main/java/abc/xml/Abc2xml.java
|
Abc2xml.writeAsMusicXML
|
public void writeAsMusicXML(Tune tune, File file) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
Document doc = createMusicXmlDOM(tune);
// dumpDOM(doc);
writeAsMusicXML(doc, writer);
writer.flush();
writer.close();
}
|
java
|
public void writeAsMusicXML(Tune tune, File file) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
Document doc = createMusicXmlDOM(tune);
// dumpDOM(doc);
writeAsMusicXML(doc, writer);
writer.flush();
writer.close();
}
|
[
"public",
"void",
"writeAsMusicXML",
"(",
"Tune",
"tune",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"file",
")",
")",
";",
"Document",
"doc",
"=",
"createMusicXmlDOM",
"(",
"tune",
")",
";",
"// dumpDOM(doc);\r",
"writeAsMusicXML",
"(",
"doc",
",",
"writer",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"}"
] |
Writes the specified tune to the specified file as MusicXML.
@param file
A file.
@param tune
A tune.
@throws IOException
Thrown if the file cannot be created.
|
[
"Writes",
"the",
"specified",
"tune",
"to",
"the",
"specified",
"file",
"as",
"MusicXML",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/xml/Abc2xml.java#L175-L182
|
10,369
|
Sciss/abc4j
|
abc/src/main/java/abc/xml/Abc2xml.java
|
Abc2xml.writeAsMusicXML
|
public void writeAsMusicXML(Document doc, BufferedWriter writer) throws IOException {
/*
* writer.write("<"+node.getNodeName()); NamedNodeMap attr =
* node.getAttributes(); if (attr!=null) for (int i=0;
* i<attr.getLength(); i++) writer.write(" " +
* attr.item(i).getNodeName() + "=" + attr.item(i).getNodeValue());
* writer.write(">"); writer.newLine(); NodeList nlist =
* node.getChildNodes(); for (int i=0; i<nlist.getLength(); i++)
* writeAsMusicXML(writer, nlist.item(i));
* writer.write("</"+node.getNodeName()+">"); writer.newLine();
*/
try {
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
// trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "-//Recordare//DTD MusicXML 2.0 Partwise//EN");
trans.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://www.musicxml.org/dtds/partwise.dtd");
// create string from xml tree
// StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(writer);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
} catch (Exception e) {
e.printStackTrace();
}
// String xmlString = sw.toString();
// }
}
|
java
|
public void writeAsMusicXML(Document doc, BufferedWriter writer) throws IOException {
/*
* writer.write("<"+node.getNodeName()); NamedNodeMap attr =
* node.getAttributes(); if (attr!=null) for (int i=0;
* i<attr.getLength(); i++) writer.write(" " +
* attr.item(i).getNodeName() + "=" + attr.item(i).getNodeValue());
* writer.write(">"); writer.newLine(); NodeList nlist =
* node.getChildNodes(); for (int i=0; i<nlist.getLength(); i++)
* writeAsMusicXML(writer, nlist.item(i));
* writer.write("</"+node.getNodeName()+">"); writer.newLine();
*/
try {
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
// trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "-//Recordare//DTD MusicXML 2.0 Partwise//EN");
trans.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://www.musicxml.org/dtds/partwise.dtd");
// create string from xml tree
// StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(writer);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
} catch (Exception e) {
e.printStackTrace();
}
// String xmlString = sw.toString();
// }
}
|
[
"public",
"void",
"writeAsMusicXML",
"(",
"Document",
"doc",
",",
"BufferedWriter",
"writer",
")",
"throws",
"IOException",
"{",
"/*\r\n\t\t * writer.write(\"<\"+node.getNodeName()); NamedNodeMap attr =\r\n\t\t * node.getAttributes(); if (attr!=null) for (int i=0;\r\n\t\t * i<attr.getLength(); i++) writer.write(\" \" +\r\n\t\t * attr.item(i).getNodeName() + \"=\" + attr.item(i).getNodeValue());\r\n\t\t * writer.write(\">\"); writer.newLine(); NodeList nlist =\r\n\t\t * node.getChildNodes(); for (int i=0; i<nlist.getLength(); i++)\r\n\t\t * writeAsMusicXML(writer, nlist.item(i));\r\n\t\t * writer.write(\"</\"+node.getNodeName()+\">\"); writer.newLine();\r\n\t\t */",
"try",
"{",
"TransformerFactory",
"transfac",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"Transformer",
"trans",
"=",
"transfac",
".",
"newTransformer",
"(",
")",
";",
"// trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, \"yes\");\r",
"trans",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"INDENT",
",",
"\"yes\"",
")",
";",
"trans",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"DOCTYPE_PUBLIC",
",",
"\"-//Recordare//DTD MusicXML 2.0 Partwise//EN\"",
")",
";",
"trans",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"DOCTYPE_SYSTEM",
",",
"\"http://www.musicxml.org/dtds/partwise.dtd\"",
")",
";",
"// create string from xml tree\r",
"// StringWriter sw = new StringWriter();\r",
"StreamResult",
"result",
"=",
"new",
"StreamResult",
"(",
"writer",
")",
";",
"DOMSource",
"source",
"=",
"new",
"DOMSource",
"(",
"doc",
")",
";",
"trans",
".",
"transform",
"(",
"source",
",",
"result",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"// String xmlString = sw.toString();\r",
"// }\r",
"}"
] |
Writes the specified Node to the given writer.
@param node
A DOM node.
@param writer
A stream writer.
@throws IOException
Thrown if the file cannot be created.
|
[
"Writes",
"the",
"specified",
"Node",
"to",
"the",
"given",
"writer",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/xml/Abc2xml.java#L194-L224
|
10,370
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/MetricsData.java
|
MetricsData.addEntityId
|
public void addEntityId(long entityId)
{
if(this.entityIds == null)
this.entityIds = new ArrayList<Long>();
this.entityIds.add(entityId);
}
|
java
|
public void addEntityId(long entityId)
{
if(this.entityIds == null)
this.entityIds = new ArrayList<Long>();
this.entityIds.add(entityId);
}
|
[
"public",
"void",
"addEntityId",
"(",
"long",
"entityId",
")",
"{",
"if",
"(",
"this",
".",
"entityIds",
"==",
"null",
")",
"this",
".",
"entityIds",
"=",
"new",
"ArrayList",
"<",
"Long",
">",
"(",
")",
";",
"this",
".",
"entityIds",
".",
"add",
"(",
"entityId",
")",
";",
"}"
] |
Adds the given entity id to the list of entities for the widget.
@param entityId The entity id to add to the list of entities
|
[
"Adds",
"the",
"given",
"entity",
"id",
"to",
"the",
"list",
"of",
"entities",
"for",
"the",
"widget",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/MetricsData.java#L109-L114
|
10,371
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/MetricsData.java
|
MetricsData.addMetric
|
public void addMetric(Metric metric)
{
if(this.metrics == null)
this.metrics = new ArrayList<Metric>();
this.metrics.add(metric);
}
|
java
|
public void addMetric(Metric metric)
{
if(this.metrics == null)
this.metrics = new ArrayList<Metric>();
this.metrics.add(metric);
}
|
[
"public",
"void",
"addMetric",
"(",
"Metric",
"metric",
")",
"{",
"if",
"(",
"this",
".",
"metrics",
"==",
"null",
")",
"this",
".",
"metrics",
"=",
"new",
"ArrayList",
"<",
"Metric",
">",
"(",
")",
";",
"this",
".",
"metrics",
".",
"add",
"(",
"metric",
")",
";",
"}"
] |
Adds the given metric to the list of metrics for the widget.
@param metric The metric to add to the list of metrics
|
[
"Adds",
"the",
"given",
"metric",
"to",
"the",
"list",
"of",
"metrics",
"for",
"the",
"widget",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/MetricsData.java#L138-L143
|
10,372
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationHostService.java
|
ApplicationHostService.list
|
public Collection<ApplicationHost> list(long applicationId, List<String> queryParams)
{
return HTTP.GET(String.format("/v2/applications/%d/hosts.json", applicationId), null, queryParams, APPLICATION_HOSTS).get();
}
|
java
|
public Collection<ApplicationHost> list(long applicationId, List<String> queryParams)
{
return HTTP.GET(String.format("/v2/applications/%d/hosts.json", applicationId), null, queryParams, APPLICATION_HOSTS).get();
}
|
[
"public",
"Collection",
"<",
"ApplicationHost",
">",
"list",
"(",
"long",
"applicationId",
",",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/applications/%d/hosts.json\"",
",",
"applicationId",
")",
",",
"null",
",",
"queryParams",
",",
"APPLICATION_HOSTS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of application hosts with the given query parameters.
@param applicationId The application id
@param queryParams The query parameters
@return The set of application hosts
|
[
"Returns",
"the",
"set",
"of",
"application",
"hosts",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationHostService.java#L51-L54
|
10,373
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/ApplicationHostService.java
|
ApplicationHostService.show
|
public Optional<ApplicationHost> show(long applicationId, long hostId)
{
return HTTP.GET(String.format("/v2/applications/%d/hosts/%d.json", applicationId, hostId), APPLICATION_HOST);
}
|
java
|
public Optional<ApplicationHost> show(long applicationId, long hostId)
{
return HTTP.GET(String.format("/v2/applications/%d/hosts/%d.json", applicationId, hostId), APPLICATION_HOST);
}
|
[
"public",
"Optional",
"<",
"ApplicationHost",
">",
"show",
"(",
"long",
"applicationId",
",",
"long",
"hostId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/applications/%d/hosts/%d.json\"",
",",
"applicationId",
",",
"hostId",
")",
",",
"APPLICATION_HOST",
")",
";",
"}"
] |
Returns the application host for the given id.
@param applicationId The application id
@param hostId The application host id
@return The application host
|
[
"Returns",
"the",
"application",
"host",
"for",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/ApplicationHostService.java#L72-L75
|
10,374
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/TuneBook.java
|
TuneBook.getHighestReferenceNumber
|
public int getHighestReferenceNumber() {
int max = -1;
for (Object o : m_tunes.keySet()) {
Integer i = (Integer) o;
if (i > max)
max = i;
}
return max;
}
|
java
|
public int getHighestReferenceNumber() {
int max = -1;
for (Object o : m_tunes.keySet()) {
Integer i = (Integer) o;
if (i > max)
max = i;
}
return max;
}
|
[
"public",
"int",
"getHighestReferenceNumber",
"(",
")",
"{",
"int",
"max",
"=",
"-",
"1",
";",
"for",
"(",
"Object",
"o",
":",
"m_tunes",
".",
"keySet",
"(",
")",
")",
"{",
"Integer",
"i",
"=",
"(",
"Integer",
")",
"o",
";",
"if",
"(",
"i",
">",
"max",
")",
"max",
"=",
"i",
";",
"}",
"return",
"max",
";",
"}"
] |
Returns the highest reference number from all the reference numbers this
tunebook contains.
@return The highest reference number from all the reference numbers this
tunebook contains. -1 is returned if no tune is stored in this
tunebook
|
[
"Returns",
"the",
"highest",
"reference",
"number",
"from",
"all",
"the",
"reference",
"numbers",
"this",
"tunebook",
"contains",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneBook.java#L104-L112
|
10,375
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/TuneBook.java
|
TuneBook.getReferenceNumbers
|
public int[] getReferenceNumbers() {
Iterator it = m_tunes.keySet().iterator();
int[] refNb = new int[m_tunes.size()];
int index = 0;
while (it.hasNext()) {
refNb[index] = (Integer) it.next();
index++;
}
return refNb;
}
|
java
|
public int[] getReferenceNumbers() {
Iterator it = m_tunes.keySet().iterator();
int[] refNb = new int[m_tunes.size()];
int index = 0;
while (it.hasNext()) {
refNb[index] = (Integer) it.next();
index++;
}
return refNb;
}
|
[
"public",
"int",
"[",
"]",
"getReferenceNumbers",
"(",
")",
"{",
"Iterator",
"it",
"=",
"m_tunes",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"int",
"[",
"]",
"refNb",
"=",
"new",
"int",
"[",
"m_tunes",
".",
"size",
"(",
")",
"]",
";",
"int",
"index",
"=",
"0",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"refNb",
"[",
"index",
"]",
"=",
"(",
"Integer",
")",
"it",
".",
"next",
"(",
")",
";",
"index",
"++",
";",
"}",
"return",
"refNb",
";",
"}"
] |
Returns the reference numbers of tunes contained in this tunebook.
@return An array containing the reference numbers of tunes contained in
this tunebook, ordered in the way they were added in this
tunebook.
|
[
"Returns",
"the",
"reference",
"numbers",
"of",
"tunes",
"contained",
"in",
"this",
"tunebook",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneBook.java#L131-L140
|
10,376
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/TuneBook.java
|
TuneBook.removeTune
|
public Tune removeTune(int referenceNumber) {
Tune ret = getTune(referenceNumber);
if (ret != null) {
ret.getTuneInfos().setBookInfos(null);
ret.getInstructions().removeAll(getInstructions());
m_tunes.remove(new Integer(referenceNumber));
}
return ret;
}
|
java
|
public Tune removeTune(int referenceNumber) {
Tune ret = getTune(referenceNumber);
if (ret != null) {
ret.getTuneInfos().setBookInfos(null);
ret.getInstructions().removeAll(getInstructions());
m_tunes.remove(new Integer(referenceNumber));
}
return ret;
}
|
[
"public",
"Tune",
"removeTune",
"(",
"int",
"referenceNumber",
")",
"{",
"Tune",
"ret",
"=",
"getTune",
"(",
"referenceNumber",
")",
";",
"if",
"(",
"ret",
"!=",
"null",
")",
"{",
"ret",
".",
"getTuneInfos",
"(",
")",
".",
"setBookInfos",
"(",
"null",
")",
";",
"ret",
".",
"getInstructions",
"(",
")",
".",
"removeAll",
"(",
"getInstructions",
"(",
")",
")",
";",
"m_tunes",
".",
"remove",
"(",
"new",
"Integer",
"(",
"referenceNumber",
")",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Remove the tune having the requested reference number from the book
@return the removed tune, null if didn't exist.
|
[
"Remove",
"the",
"tune",
"having",
"the",
"requested",
"reference",
"number",
"from",
"the",
"book"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/TuneBook.java#L182-L190
|
10,377
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/KeyTransactionService.java
|
KeyTransactionService.list
|
public Collection<KeyTransaction> list(List<String> queryParams)
{
return HTTP.GET("/v2/key_transactions.json", null, queryParams, KEY_TRANSACTIONS).get();
}
|
java
|
public Collection<KeyTransaction> list(List<String> queryParams)
{
return HTTP.GET("/v2/key_transactions.json", null, queryParams, KEY_TRANSACTIONS).get();
}
|
[
"public",
"Collection",
"<",
"KeyTransaction",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/key_transactions.json\"",
",",
"null",
",",
"queryParams",
",",
"KEY_TRANSACTIONS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of key transactions with the given query parameters.
@param queryParams The query parameters
@return The set of key transactions
|
[
"Returns",
"the",
"set",
"of",
"key",
"transactions",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/KeyTransactionService.java#L49-L52
|
10,378
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/KeyTransactionService.java
|
KeyTransactionService.list
|
public Collection<KeyTransaction> list(String name)
{
List<KeyTransaction> ret = new ArrayList<KeyTransaction>();
Collection<KeyTransaction> transactions = list();
for(KeyTransaction transaction : transactions)
{
if(name == null || transaction.getName().equals(name))
ret.add(transaction);
}
return ret;
}
|
java
|
public Collection<KeyTransaction> list(String name)
{
List<KeyTransaction> ret = new ArrayList<KeyTransaction>();
Collection<KeyTransaction> transactions = list();
for(KeyTransaction transaction : transactions)
{
if(name == null || transaction.getName().equals(name))
ret.add(transaction);
}
return ret;
}
|
[
"public",
"Collection",
"<",
"KeyTransaction",
">",
"list",
"(",
"String",
"name",
")",
"{",
"List",
"<",
"KeyTransaction",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"KeyTransaction",
">",
"(",
")",
";",
"Collection",
"<",
"KeyTransaction",
">",
"transactions",
"=",
"list",
"(",
")",
";",
"for",
"(",
"KeyTransaction",
"transaction",
":",
"transactions",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"transaction",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"ret",
".",
"add",
"(",
"transaction",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns the set of key transactions for the given name.
@param name The name of the transactions
@return The set of transactions
|
[
"Returns",
"the",
"set",
"of",
"key",
"transactions",
"for",
"the",
"given",
"name",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/KeyTransactionService.java#L69-L79
|
10,379
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/KeyTransactionService.java
|
KeyTransactionService.show
|
public Optional<KeyTransaction> show(long transactionId)
{
return HTTP.GET(String.format("/v2/key_transactions/%d.json", transactionId), KEY_TRANSACTION);
}
|
java
|
public Optional<KeyTransaction> show(long transactionId)
{
return HTTP.GET(String.format("/v2/key_transactions/%d.json", transactionId), KEY_TRANSACTION);
}
|
[
"public",
"Optional",
"<",
"KeyTransaction",
">",
"show",
"(",
"long",
"transactionId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/key_transactions/%d.json\"",
",",
"transactionId",
")",
",",
"KEY_TRANSACTION",
")",
";",
"}"
] |
Returns the key transaction for the given transaction id.
@param transactionId The id for the key transaction to return
@return The key transaction
|
[
"Returns",
"the",
"key",
"transaction",
"for",
"the",
"given",
"transaction",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/KeyTransactionService.java#L86-L89
|
10,380
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyChannelService.java
|
AlertPolicyChannelService.update
|
public Optional<AlertPolicyChannel> update(long policyId, long channelId)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("policy_id", policyId);
queryParams.add("channel_ids", channelId);
return HTTP.PUT("/v2/alerts_policy_channels.json", null, null, queryParams, ALERT_POLICY_CHANNEL);
}
|
java
|
public Optional<AlertPolicyChannel> update(long policyId, long channelId)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("policy_id", policyId);
queryParams.add("channel_ids", channelId);
return HTTP.PUT("/v2/alerts_policy_channels.json", null, null, queryParams, ALERT_POLICY_CHANNEL);
}
|
[
"public",
"Optional",
"<",
"AlertPolicyChannel",
">",
"update",
"(",
"long",
"policyId",
",",
"long",
"channelId",
")",
"{",
"QueryParameterList",
"queryParams",
"=",
"new",
"QueryParameterList",
"(",
")",
";",
"queryParams",
".",
"add",
"(",
"\"policy_id\"",
",",
"policyId",
")",
";",
"queryParams",
".",
"add",
"(",
"\"channel_ids\"",
",",
"channelId",
")",
";",
"return",
"HTTP",
".",
"PUT",
"(",
"\"/v2/alerts_policy_channels.json\"",
",",
"null",
",",
"null",
",",
"queryParams",
",",
"ALERT_POLICY_CHANNEL",
")",
";",
"}"
] |
Adds the given alert channel to the alert policy with the given id.
@param policyId The id of the alert policy to add the channel to
@param channelId The id of the alert channel to add
@return The alert policy channel that was updated
|
[
"Adds",
"the",
"given",
"alert",
"channel",
"to",
"the",
"alert",
"policy",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyChannelService.java#L47-L53
|
10,381
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyChannelService.java
|
AlertPolicyChannelService.delete
|
public AlertPolicyChannelService delete(long policyId, long channelId)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("policy_id", policyId);
queryParams.add("channel_id", channelId);
HTTP.DELETE("/v2/alerts_policy_channels.json", null, queryParams);
return this;
}
|
java
|
public AlertPolicyChannelService delete(long policyId, long channelId)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("policy_id", policyId);
queryParams.add("channel_id", channelId);
HTTP.DELETE("/v2/alerts_policy_channels.json", null, queryParams);
return this;
}
|
[
"public",
"AlertPolicyChannelService",
"delete",
"(",
"long",
"policyId",
",",
"long",
"channelId",
")",
"{",
"QueryParameterList",
"queryParams",
"=",
"new",
"QueryParameterList",
"(",
")",
";",
"queryParams",
".",
"add",
"(",
"\"policy_id\"",
",",
"policyId",
")",
";",
"queryParams",
".",
"add",
"(",
"\"channel_id\"",
",",
"channelId",
")",
";",
"HTTP",
".",
"DELETE",
"(",
"\"/v2/alerts_policy_channels.json\"",
",",
"null",
",",
"queryParams",
")",
";",
"return",
"this",
";",
"}"
] |
Deletes the given alert channel from the alert policy with the given id.
@param policyId The id of the alert policy from which to delete the channel
@param channelId The id of the alert channel to delete
@return This object
|
[
"Deletes",
"the",
"given",
"alert",
"channel",
"from",
"the",
"alert",
"policy",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertPolicyChannelService.java#L61-L68
|
10,382
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Clef.java
|
Clef.setMiddleNote
|
public void setMiddleNote(Note n) {
//same note has middle, maybe with octave
byte strictHeight = n.getStrictHeight();
boolean set = false;
if (strictHeight == getMiddleNote().getStrictHeight()) {
set = true;
} else {
//some accepted cases
Clef[] toCompare = null;
if (isG()) {
toCompare = new Clef[] { TREBLE, FRENCH_VIOLIN };
} else if (isF()) {
toCompare = new Clef[] { BASS, BARITONE };
} else if (isC()) {
toCompare = new Clef[] { SOPRANO, MEZZOSOPRANO, ALTO, TENOR };
}
if (toCompare != null) {
for (Clef aToCompare : toCompare) {
if (strictHeight == aToCompare.getMiddleNote().getStrictHeight()) {
m_lineNumber = (byte) aToCompare.getLineNumber();
set = true;
break;
}
}
}
//Accept any note as middle
if (isPerc()) {
set = true;
}
}
if (set) {
//if linenumber has changed, recompute middle note
reset();
//compute invisible octave transposition
m_invisibleOctaveTransp =
(byte)(n.getOctaveTransposition()
- getMiddleNote().getOctaveTransposition());
m_middleNote = n;
reset();
}
}
|
java
|
public void setMiddleNote(Note n) {
//same note has middle, maybe with octave
byte strictHeight = n.getStrictHeight();
boolean set = false;
if (strictHeight == getMiddleNote().getStrictHeight()) {
set = true;
} else {
//some accepted cases
Clef[] toCompare = null;
if (isG()) {
toCompare = new Clef[] { TREBLE, FRENCH_VIOLIN };
} else if (isF()) {
toCompare = new Clef[] { BASS, BARITONE };
} else if (isC()) {
toCompare = new Clef[] { SOPRANO, MEZZOSOPRANO, ALTO, TENOR };
}
if (toCompare != null) {
for (Clef aToCompare : toCompare) {
if (strictHeight == aToCompare.getMiddleNote().getStrictHeight()) {
m_lineNumber = (byte) aToCompare.getLineNumber();
set = true;
break;
}
}
}
//Accept any note as middle
if (isPerc()) {
set = true;
}
}
if (set) {
//if linenumber has changed, recompute middle note
reset();
//compute invisible octave transposition
m_invisibleOctaveTransp =
(byte)(n.getOctaveTransposition()
- getMiddleNote().getOctaveTransposition());
m_middleNote = n;
reset();
}
}
|
[
"public",
"void",
"setMiddleNote",
"(",
"Note",
"n",
")",
"{",
"//same note has middle, maybe with octave\r",
"byte",
"strictHeight",
"=",
"n",
".",
"getStrictHeight",
"(",
")",
";",
"boolean",
"set",
"=",
"false",
";",
"if",
"(",
"strictHeight",
"==",
"getMiddleNote",
"(",
")",
".",
"getStrictHeight",
"(",
")",
")",
"{",
"set",
"=",
"true",
";",
"}",
"else",
"{",
"//some accepted cases\r",
"Clef",
"[",
"]",
"toCompare",
"=",
"null",
";",
"if",
"(",
"isG",
"(",
")",
")",
"{",
"toCompare",
"=",
"new",
"Clef",
"[",
"]",
"{",
"TREBLE",
",",
"FRENCH_VIOLIN",
"}",
";",
"}",
"else",
"if",
"(",
"isF",
"(",
")",
")",
"{",
"toCompare",
"=",
"new",
"Clef",
"[",
"]",
"{",
"BASS",
",",
"BARITONE",
"}",
";",
"}",
"else",
"if",
"(",
"isC",
"(",
")",
")",
"{",
"toCompare",
"=",
"new",
"Clef",
"[",
"]",
"{",
"SOPRANO",
",",
"MEZZOSOPRANO",
",",
"ALTO",
",",
"TENOR",
"}",
";",
"}",
"if",
"(",
"toCompare",
"!=",
"null",
")",
"{",
"for",
"(",
"Clef",
"aToCompare",
":",
"toCompare",
")",
"{",
"if",
"(",
"strictHeight",
"==",
"aToCompare",
".",
"getMiddleNote",
"(",
")",
".",
"getStrictHeight",
"(",
")",
")",
"{",
"m_lineNumber",
"=",
"(",
"byte",
")",
"aToCompare",
".",
"getLineNumber",
"(",
")",
";",
"set",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"//Accept any note as middle\r",
"if",
"(",
"isPerc",
"(",
")",
")",
"{",
"set",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"set",
")",
"{",
"//if linenumber has changed, recompute middle note\r",
"reset",
"(",
")",
";",
"//compute invisible octave transposition\r",
"m_invisibleOctaveTransp",
"=",
"(",
"byte",
")",
"(",
"n",
".",
"getOctaveTransposition",
"(",
")",
"-",
"getMiddleNote",
"(",
")",
".",
"getOctaveTransposition",
"(",
")",
")",
";",
"m_middleNote",
"=",
"n",
";",
"reset",
"(",
")",
";",
"}",
"}"
] |
Sets the middle note (for an "internal" octave
transposition, if Note n is compatible with predefined
middle note.
e.g. middle note for bass is <TT>D,</TT> accepts <TT>D</TT> or <TT>d</TT>
but will reject all other notes
|
[
"Sets",
"the",
"middle",
"note",
"(",
"for",
"an",
"internal",
"octave",
"transposition",
"if",
"Note",
"n",
"is",
"compatible",
"with",
"predefined",
"middle",
"note",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Clef.java#L466-L506
|
10,383
|
Sciss/abc4j
|
abc/src/main/java/abc/notation/Clef.java
|
Clef.getLineNumber
|
public int getLineNumber() {
if ((m_lineNumber == -1) && (getName() != null)) {
if (isG())
m_lineNumber = 2;
else if (isF())
m_lineNumber = 4;
else if (isC())
m_lineNumber = 3;
else if (isPerc())
m_lineNumber = 3;
}
return m_lineNumber;
}
|
java
|
public int getLineNumber() {
if ((m_lineNumber == -1) && (getName() != null)) {
if (isG())
m_lineNumber = 2;
else if (isF())
m_lineNumber = 4;
else if (isC())
m_lineNumber = 3;
else if (isPerc())
m_lineNumber = 3;
}
return m_lineNumber;
}
|
[
"public",
"int",
"getLineNumber",
"(",
")",
"{",
"if",
"(",
"(",
"m_lineNumber",
"==",
"-",
"1",
")",
"&&",
"(",
"getName",
"(",
")",
"!=",
"null",
")",
")",
"{",
"if",
"(",
"isG",
"(",
")",
")",
"m_lineNumber",
"=",
"2",
";",
"else",
"if",
"(",
"isF",
"(",
")",
")",
"m_lineNumber",
"=",
"4",
";",
"else",
"if",
"(",
"isC",
"(",
")",
")",
"m_lineNumber",
"=",
"3",
";",
"else",
"if",
"(",
"isPerc",
"(",
")",
")",
"m_lineNumber",
"=",
"3",
";",
"}",
"return",
"m_lineNumber",
";",
"}"
] |
Returns the number of the line staff where clef is printed.
2 for treble, 3 for alto, 4 for tenor, 4 for bass...
|
[
"Returns",
"the",
"number",
"of",
"the",
"line",
"staff",
"where",
"clef",
"is",
"printed",
".",
"2",
"for",
"treble",
"3",
"for",
"alto",
"4",
"for",
"tenor",
"4",
"for",
"bass",
"..."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Clef.java#L562-L574
|
10,384
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/TrafficLight.java
|
TrafficLight.addState
|
public void addState(TrafficLightState state)
{
if(this.states == null)
this.states = new ArrayList<TrafficLightState>();
this.states.add(state);
}
|
java
|
public void addState(TrafficLightState state)
{
if(this.states == null)
this.states = new ArrayList<TrafficLightState>();
this.states.add(state);
}
|
[
"public",
"void",
"addState",
"(",
"TrafficLightState",
"state",
")",
"{",
"if",
"(",
"this",
".",
"states",
"==",
"null",
")",
"this",
".",
"states",
"=",
"new",
"ArrayList",
"<",
"TrafficLightState",
">",
"(",
")",
";",
"this",
".",
"states",
".",
"add",
"(",
"state",
")",
";",
"}"
] |
Adds a state to the traffic light.
@param state The state to add to the traffic light
|
[
"Adds",
"a",
"state",
"to",
"the",
"traffic",
"light",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/insights/widgets/TrafficLight.java#L117-L122
|
10,385
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertEntityConditionService.java
|
AlertEntityConditionService.list
|
public Collection<AlertCondition> list(long entityId, String entityType)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("entity_type", entityType);
return HTTP.GET(String.format("/v2/alerts_entity_conditions/%d.json", entityId), null, queryParams, ALERT_CONDITIONS).get();
}
|
java
|
public Collection<AlertCondition> list(long entityId, String entityType)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("entity_type", entityType);
return HTTP.GET(String.format("/v2/alerts_entity_conditions/%d.json", entityId), null, queryParams, ALERT_CONDITIONS).get();
}
|
[
"public",
"Collection",
"<",
"AlertCondition",
">",
"list",
"(",
"long",
"entityId",
",",
"String",
"entityType",
")",
"{",
"QueryParameterList",
"queryParams",
"=",
"new",
"QueryParameterList",
"(",
")",
";",
"queryParams",
".",
"add",
"(",
"\"entity_type\"",
",",
"entityType",
")",
";",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/alerts_entity_conditions/%d.json\"",
",",
"entityId",
")",
",",
"null",
",",
"queryParams",
",",
"ALERT_CONDITIONS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the alert conditions for the given entity id.
@param entityId The id of the entity
@param entityType The type of the entity
@return The alert conditions for the entity
|
[
"Returns",
"the",
"alert",
"conditions",
"for",
"the",
"given",
"entity",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertEntityConditionService.java#L49-L54
|
10,386
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertEntityConditionService.java
|
AlertEntityConditionService.list
|
public Collection<AlertCondition> list(Entity entity)
{
return list(entity.getId(), entity.getType());
}
|
java
|
public Collection<AlertCondition> list(Entity entity)
{
return list(entity.getId(), entity.getType());
}
|
[
"public",
"Collection",
"<",
"AlertCondition",
">",
"list",
"(",
"Entity",
"entity",
")",
"{",
"return",
"list",
"(",
"entity",
".",
"getId",
"(",
")",
",",
"entity",
".",
"getType",
"(",
")",
")",
";",
"}"
] |
Returns the alert conditions for the given entity.
@param entity The entity to look up
@return The alert conditions for the entity
|
[
"Returns",
"the",
"alert",
"conditions",
"for",
"the",
"given",
"entity",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertEntityConditionService.java#L61-L64
|
10,387
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/ScoreMetrics.java
|
ScoreMetrics.getBounds
|
protected Rectangle2D getBounds(char[] glyph, int notationContext) {
String key = String.valueOf(notationContext)
+ "-" + String.valueOf(glyph)
+ "-" + getMusicalFont().getName();
try {
if (bounds.get(key) == null) {
FontRenderContext frc = g2.getFontRenderContext();
bounds.put(key, new TextLayout(
String.valueOf(glyph),//new Character(glyph[0]).toString(),
getNotationFontForContext(notationContext),
frc).getBounds());
}
return (Rectangle2D) (bounds.get(key));
} catch (RuntimeException e) {
System.err.println(e.getMessage() + " key="+key);
throw e;
}
}
|
java
|
protected Rectangle2D getBounds(char[] glyph, int notationContext) {
String key = String.valueOf(notationContext)
+ "-" + String.valueOf(glyph)
+ "-" + getMusicalFont().getName();
try {
if (bounds.get(key) == null) {
FontRenderContext frc = g2.getFontRenderContext();
bounds.put(key, new TextLayout(
String.valueOf(glyph),//new Character(glyph[0]).toString(),
getNotationFontForContext(notationContext),
frc).getBounds());
}
return (Rectangle2D) (bounds.get(key));
} catch (RuntimeException e) {
System.err.println(e.getMessage() + " key="+key);
throw e;
}
}
|
[
"protected",
"Rectangle2D",
"getBounds",
"(",
"char",
"[",
"]",
"glyph",
",",
"int",
"notationContext",
")",
"{",
"String",
"key",
"=",
"String",
".",
"valueOf",
"(",
"notationContext",
")",
"+",
"\"-\"",
"+",
"String",
".",
"valueOf",
"(",
"glyph",
")",
"+",
"\"-\"",
"+",
"getMusicalFont",
"(",
")",
".",
"getName",
"(",
")",
";",
"try",
"{",
"if",
"(",
"bounds",
".",
"get",
"(",
"key",
")",
"==",
"null",
")",
"{",
"FontRenderContext",
"frc",
"=",
"g2",
".",
"getFontRenderContext",
"(",
")",
";",
"bounds",
".",
"put",
"(",
"key",
",",
"new",
"TextLayout",
"(",
"String",
".",
"valueOf",
"(",
"glyph",
")",
",",
"//new Character(glyph[0]).toString(),\r",
"getNotationFontForContext",
"(",
"notationContext",
")",
",",
"frc",
")",
".",
"getBounds",
"(",
")",
")",
";",
"}",
"return",
"(",
"Rectangle2D",
")",
"(",
"bounds",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"e",
".",
"getMessage",
"(",
")",
"+",
"\" key=\"",
"+",
"key",
")",
";",
"throw",
"e",
";",
"}",
"}"
] |
Get the bounds of a glyph in the given notation context
@param glyph {@link abc.notation.Accidental#SHARP}, {@link abc.notation.Accidental#FLAT}...
@param notationContext {@link #NOTATION_CONTEXT_NOTE} or {@link #NOTATION_CONTEXT_GRACENOTE}
|
[
"Get",
"the",
"bounds",
"of",
"a",
"glyph",
"in",
"the",
"given",
"notation",
"context"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreMetrics.java#L99-L116
|
10,388
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/ScoreMetrics.java
|
ScoreMetrics.getNotationFontForContext
|
public Font getNotationFontForContext(int notationContext) {
try {
Font baseNotationFont = ((MusicalFont) getTemplate().getAttributeObject(
ScoreAttribute.NOTATION_FONT)).getFont();
switch (notationContext) {
case NOTATION_CONTEXT_GRACENOTE:
return baseNotationFont.deriveFont(getTemplate()
.getAttributeSize(
ScoreAttribute.NOTATION_GRACENOTE_SIZE));
case NOTATION_CONTEXT_TEMPO:
return baseNotationFont.deriveFont(getTemplate()
.getAttributeSize(ScoreAttribute.NOTATION_TEMPO_SIZE));
case NOTATION_CONTEXT_NOTE:
default:
return baseNotationFont.deriveFont(getTemplate()
.getAttributeSize(ScoreAttribute.NOTATION_SIZE));
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
|
java
|
public Font getNotationFontForContext(int notationContext) {
try {
Font baseNotationFont = ((MusicalFont) getTemplate().getAttributeObject(
ScoreAttribute.NOTATION_FONT)).getFont();
switch (notationContext) {
case NOTATION_CONTEXT_GRACENOTE:
return baseNotationFont.deriveFont(getTemplate()
.getAttributeSize(
ScoreAttribute.NOTATION_GRACENOTE_SIZE));
case NOTATION_CONTEXT_TEMPO:
return baseNotationFont.deriveFont(getTemplate()
.getAttributeSize(ScoreAttribute.NOTATION_TEMPO_SIZE));
case NOTATION_CONTEXT_NOTE:
default:
return baseNotationFont.deriveFont(getTemplate()
.getAttributeSize(ScoreAttribute.NOTATION_SIZE));
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
|
[
"public",
"Font",
"getNotationFontForContext",
"(",
"int",
"notationContext",
")",
"{",
"try",
"{",
"Font",
"baseNotationFont",
"=",
"(",
"(",
"MusicalFont",
")",
"getTemplate",
"(",
")",
".",
"getAttributeObject",
"(",
"ScoreAttribute",
".",
"NOTATION_FONT",
")",
")",
".",
"getFont",
"(",
")",
";",
"switch",
"(",
"notationContext",
")",
"{",
"case",
"NOTATION_CONTEXT_GRACENOTE",
":",
"return",
"baseNotationFont",
".",
"deriveFont",
"(",
"getTemplate",
"(",
")",
".",
"getAttributeSize",
"(",
"ScoreAttribute",
".",
"NOTATION_GRACENOTE_SIZE",
")",
")",
";",
"case",
"NOTATION_CONTEXT_TEMPO",
":",
"return",
"baseNotationFont",
".",
"deriveFont",
"(",
"getTemplate",
"(",
")",
".",
"getAttributeSize",
"(",
"ScoreAttribute",
".",
"NOTATION_TEMPO_SIZE",
")",
")",
";",
"case",
"NOTATION_CONTEXT_NOTE",
":",
"default",
":",
"return",
"baseNotationFont",
".",
"deriveFont",
"(",
"getTemplate",
"(",
")",
".",
"getAttributeSize",
"(",
"ScoreAttribute",
".",
"NOTATION_SIZE",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Return the notation for from the given notation context
@param notationContext
{@link #NOTATION_CONTEXT_NOTE},
{@link #NOTATION_CONTEXT_GRACENOTE}...
|
[
"Return",
"the",
"notation",
"for",
"from",
"the",
"given",
"notation",
"context"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreMetrics.java#L167-L189
|
10,389
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/ScoreMetrics.java
|
ScoreMetrics.getTextFontHeight
|
protected int getTextFontHeight(byte textType) {
FontMetrics fontMetrics = g2.getFontMetrics(getTextFont(textType));
return fontMetrics.getHeight();
}
|
java
|
protected int getTextFontHeight(byte textType) {
FontMetrics fontMetrics = g2.getFontMetrics(getTextFont(textType));
return fontMetrics.getHeight();
}
|
[
"protected",
"int",
"getTextFontHeight",
"(",
"byte",
"textType",
")",
"{",
"FontMetrics",
"fontMetrics",
"=",
"g2",
".",
"getFontMetrics",
"(",
"getTextFont",
"(",
"textType",
")",
")",
";",
"return",
"fontMetrics",
".",
"getHeight",
"(",
")",
";",
"}"
] |
Returns height of one line rendered in the textType font.
@param textType
one of {@link abc.ui.scoretemplates.ScoreElements} constants
@return the height of a string in this font used for this score metrics
|
[
"Returns",
"height",
"of",
"one",
"line",
"rendered",
"in",
"the",
"textType",
"font",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreMetrics.java#L318-L321
|
10,390
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/ScoreMetrics.java
|
ScoreMetrics.getTextFontWidth
|
protected int getTextFontWidth(byte textType, String text) {
if (text == null)
return 0;
FontMetrics fontMetrics = g2.getFontMetrics(getTextFont(textType));
return fontMetrics.stringWidth(text);
}
|
java
|
protected int getTextFontWidth(byte textType, String text) {
if (text == null)
return 0;
FontMetrics fontMetrics = g2.getFontMetrics(getTextFont(textType));
return fontMetrics.stringWidth(text);
}
|
[
"protected",
"int",
"getTextFontWidth",
"(",
"byte",
"textType",
",",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"return",
"0",
";",
"FontMetrics",
"fontMetrics",
"=",
"g2",
".",
"getFontMetrics",
"(",
"getTextFont",
"(",
"textType",
")",
")",
";",
"return",
"fontMetrics",
".",
"stringWidth",
"(",
"text",
")",
";",
"}"
] |
Returns width of string rendered in the textType font.
@param textType
one of {@link abc.ui.scoretemplates.ScoreElements} constants
@param text
The text we want to know its width
@return the width of a string in this font used for this score metrics
|
[
"Returns",
"width",
"of",
"string",
"rendered",
"in",
"the",
"textType",
"font",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreMetrics.java#L340-L345
|
10,391
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/TuneEditorPane.java
|
TuneEditorPane.setSelectedItem
|
public void setSelectedItem(PositionableInCharStream elmnt) {
CharStreamPosition pos = null;
if (elmnt != null)
pos = elmnt.getCharStreamPosition();
if (pos != null) {
int begin = pos.getStartIndex();
int end = pos.getEndIndex();
try {
setCaretPosition(end);
moveCaretPosition(begin);
getCaret().setSelectionVisible(true);
repaint();
}
catch (IllegalArgumentException ignored)
{}
}
}
|
java
|
public void setSelectedItem(PositionableInCharStream elmnt) {
CharStreamPosition pos = null;
if (elmnt != null)
pos = elmnt.getCharStreamPosition();
if (pos != null) {
int begin = pos.getStartIndex();
int end = pos.getEndIndex();
try {
setCaretPosition(end);
moveCaretPosition(begin);
getCaret().setSelectionVisible(true);
repaint();
}
catch (IllegalArgumentException ignored)
{}
}
}
|
[
"public",
"void",
"setSelectedItem",
"(",
"PositionableInCharStream",
"elmnt",
")",
"{",
"CharStreamPosition",
"pos",
"=",
"null",
";",
"if",
"(",
"elmnt",
"!=",
"null",
")",
"pos",
"=",
"elmnt",
".",
"getCharStreamPosition",
"(",
")",
";",
"if",
"(",
"pos",
"!=",
"null",
")",
"{",
"int",
"begin",
"=",
"pos",
".",
"getStartIndex",
"(",
")",
";",
"int",
"end",
"=",
"pos",
".",
"getEndIndex",
"(",
")",
";",
"try",
"{",
"setCaretPosition",
"(",
"end",
")",
";",
"moveCaretPosition",
"(",
"begin",
")",
";",
"getCaret",
"(",
")",
".",
"setSelectionVisible",
"(",
"true",
")",
";",
"repaint",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ignored",
")",
"{",
"}",
"}",
"}"
] |
Highlights the specified element in the abc tune notation.
@param elmnt The element to be highlighted in the abc tune notation.
|
[
"Highlights",
"the",
"specified",
"element",
"in",
"the",
"abc",
"tune",
"notation",
"."
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/TuneEditorPane.java#L180-L196
|
10,392
|
Sciss/abc4j
|
abc/src/main/java/abc/ui/swing/JTablature.java
|
JTablature.render
|
public double render(Graphics2D g) {
Color previousColor = g.getColor();
setColor(g, ScoreElements.TABLATURE_LINES);
number.setText("MM");
double mWidth = number.getWidth();
double numberOfStrings = m_tablature.getNumberOfString();
for (int i = 1; i <= numberOfStrings; i++) {
//String name
double y = getTextY(i);
number.setText(m_tablature.getStringNote(i).getName());
number.setBase(new Point2D.Double(getBase().getX()+mWidth/2, y));
number.setTextVerticalAlign(TextVerticalAlign.BOTTOM);
number.setTextJustification(TextJustification.CENTER);
number.render(g);
// line
y = getLineY(i);
g.drawLine((int)(getBase().getX()+mWidth),
(int)y,
(int)(getBase().getX()+width),
(int)y);
}
g.setColor(previousColor);
return getWidth();
}
|
java
|
public double render(Graphics2D g) {
Color previousColor = g.getColor();
setColor(g, ScoreElements.TABLATURE_LINES);
number.setText("MM");
double mWidth = number.getWidth();
double numberOfStrings = m_tablature.getNumberOfString();
for (int i = 1; i <= numberOfStrings; i++) {
//String name
double y = getTextY(i);
number.setText(m_tablature.getStringNote(i).getName());
number.setBase(new Point2D.Double(getBase().getX()+mWidth/2, y));
number.setTextVerticalAlign(TextVerticalAlign.BOTTOM);
number.setTextJustification(TextJustification.CENTER);
number.render(g);
// line
y = getLineY(i);
g.drawLine((int)(getBase().getX()+mWidth),
(int)y,
(int)(getBase().getX()+width),
(int)y);
}
g.setColor(previousColor);
return getWidth();
}
|
[
"public",
"double",
"render",
"(",
"Graphics2D",
"g",
")",
"{",
"Color",
"previousColor",
"=",
"g",
".",
"getColor",
"(",
")",
";",
"setColor",
"(",
"g",
",",
"ScoreElements",
".",
"TABLATURE_LINES",
")",
";",
"number",
".",
"setText",
"(",
"\"MM\"",
")",
";",
"double",
"mWidth",
"=",
"number",
".",
"getWidth",
"(",
")",
";",
"double",
"numberOfStrings",
"=",
"m_tablature",
".",
"getNumberOfString",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"numberOfStrings",
";",
"i",
"++",
")",
"{",
"//String name\r",
"double",
"y",
"=",
"getTextY",
"(",
"i",
")",
";",
"number",
".",
"setText",
"(",
"m_tablature",
".",
"getStringNote",
"(",
"i",
")",
".",
"getName",
"(",
")",
")",
";",
"number",
".",
"setBase",
"(",
"new",
"Point2D",
".",
"Double",
"(",
"getBase",
"(",
")",
".",
"getX",
"(",
")",
"+",
"mWidth",
"/",
"2",
",",
"y",
")",
")",
";",
"number",
".",
"setTextVerticalAlign",
"(",
"TextVerticalAlign",
".",
"BOTTOM",
")",
";",
"number",
".",
"setTextJustification",
"(",
"TextJustification",
".",
"CENTER",
")",
";",
"number",
".",
"render",
"(",
"g",
")",
";",
"// line\r",
"y",
"=",
"getLineY",
"(",
"i",
")",
";",
"g",
".",
"drawLine",
"(",
"(",
"int",
")",
"(",
"getBase",
"(",
")",
".",
"getX",
"(",
")",
"+",
"mWidth",
")",
",",
"(",
"int",
")",
"y",
",",
"(",
"int",
")",
"(",
"getBase",
"(",
")",
".",
"getX",
"(",
")",
"+",
"width",
")",
",",
"(",
"int",
")",
"y",
")",
";",
"}",
"g",
".",
"setColor",
"(",
"previousColor",
")",
";",
"return",
"getWidth",
"(",
")",
";",
"}"
] |
Renders the strings' lines, avoiding the numbers
previously rendered
|
[
"Renders",
"the",
"strings",
"lines",
"avoiding",
"the",
"numbers",
"previously",
"rendered"
] |
117b405642c84a7bfca4e3e13668838258b90ca7
|
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JTablature.java#L126-L149
|
10,393
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertViolationService.java
|
AlertViolationService.list
|
public Collection<AlertViolation> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_violations.json", null, queryParams, ALERT_VIOLATIONS).get();
}
|
java
|
public Collection<AlertViolation> list(List<String> queryParams)
{
return HTTP.GET("/v2/alerts_violations.json", null, queryParams, ALERT_VIOLATIONS).get();
}
|
[
"public",
"Collection",
"<",
"AlertViolation",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/alerts_violations.json\"",
",",
"null",
",",
"queryParams",
",",
"ALERT_VIOLATIONS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of alert violations with the given query parameters.
@param queryParams The query parameters
@return The set of alert violations
|
[
"Returns",
"the",
"set",
"of",
"alert",
"violations",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertViolationService.java#L48-L51
|
10,394
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/AlertViolationService.java
|
AlertViolationService.list
|
public Collection<AlertViolation> list(long startDate, long endDate, boolean onlyOpen)
{
return list(filters().startDate(startDate).endDate(endDate).onlyOpen(onlyOpen).build());
}
|
java
|
public Collection<AlertViolation> list(long startDate, long endDate, boolean onlyOpen)
{
return list(filters().startDate(startDate).endDate(endDate).onlyOpen(onlyOpen).build());
}
|
[
"public",
"Collection",
"<",
"AlertViolation",
">",
"list",
"(",
"long",
"startDate",
",",
"long",
"endDate",
",",
"boolean",
"onlyOpen",
")",
"{",
"return",
"list",
"(",
"filters",
"(",
")",
".",
"startDate",
"(",
"startDate",
")",
".",
"endDate",
"(",
"endDate",
")",
".",
"onlyOpen",
"(",
"onlyOpen",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] |
Returns the set of alert violations.
@param startDate Retrieves violations created after this date (in milliseconds)
@param endDate Retrieves violations created before this date (in milliseconds)
@param onlyOpen Filter by open violations
@return The set of alert violations
|
[
"Returns",
"the",
"set",
"of",
"alert",
"violations",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/AlertViolationService.java#L60-L63
|
10,395
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/BrowserApplicationService.java
|
BrowserApplicationService.list
|
public Collection<BrowserApplication> list(List<String> queryParams)
{
return HTTP.GET("/v2/browser_applications.json", null, queryParams, BROWSER_APPLICATIONS).get();
}
|
java
|
public Collection<BrowserApplication> list(List<String> queryParams)
{
return HTTP.GET("/v2/browser_applications.json", null, queryParams, BROWSER_APPLICATIONS).get();
}
|
[
"public",
"Collection",
"<",
"BrowserApplication",
">",
"list",
"(",
"List",
"<",
"String",
">",
"queryParams",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"\"/v2/browser_applications.json\"",
",",
"null",
",",
"queryParams",
",",
"BROWSER_APPLICATIONS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of Browser applications with the given query parameters.
@param queryParams The query parameters
@return The set of applications
|
[
"Returns",
"the",
"set",
"of",
"Browser",
"applications",
"with",
"the",
"given",
"query",
"parameters",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/BrowserApplicationService.java#L49-L52
|
10,396
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/BrowserApplicationService.java
|
BrowserApplicationService.list
|
public Collection<BrowserApplication> list(String name)
{
List<BrowserApplication> ret = new ArrayList<BrowserApplication>();
Collection<BrowserApplication> applications = list();
for(BrowserApplication application : applications)
{
if(name == null || application.getName().equals(name))
ret.add(application);
}
return ret;
}
|
java
|
public Collection<BrowserApplication> list(String name)
{
List<BrowserApplication> ret = new ArrayList<BrowserApplication>();
Collection<BrowserApplication> applications = list();
for(BrowserApplication application : applications)
{
if(name == null || application.getName().equals(name))
ret.add(application);
}
return ret;
}
|
[
"public",
"Collection",
"<",
"BrowserApplication",
">",
"list",
"(",
"String",
"name",
")",
"{",
"List",
"<",
"BrowserApplication",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"BrowserApplication",
">",
"(",
")",
";",
"Collection",
"<",
"BrowserApplication",
">",
"applications",
"=",
"list",
"(",
")",
";",
"for",
"(",
"BrowserApplication",
"application",
":",
"applications",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"application",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"ret",
".",
"add",
"(",
"application",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns the set of Browser applications for the given name.
@param name The name of the applications
@return The set of applications
|
[
"Returns",
"the",
"set",
"of",
"Browser",
"applications",
"for",
"the",
"given",
"name",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/BrowserApplicationService.java#L70-L80
|
10,397
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/BrowserApplicationService.java
|
BrowserApplicationService.show
|
public Optional<BrowserApplication> show(long applicationId)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("filter[ids]", new Long(applicationId));
return Optional.of(HTTP.GET("/v2/browser_applications.json", null, queryParams, BROWSER_APPLICATIONS).get().iterator().next());
}
|
java
|
public Optional<BrowserApplication> show(long applicationId)
{
QueryParameterList queryParams = new QueryParameterList();
queryParams.add("filter[ids]", new Long(applicationId));
return Optional.of(HTTP.GET("/v2/browser_applications.json", null, queryParams, BROWSER_APPLICATIONS).get().iterator().next());
}
|
[
"public",
"Optional",
"<",
"BrowserApplication",
">",
"show",
"(",
"long",
"applicationId",
")",
"{",
"QueryParameterList",
"queryParams",
"=",
"new",
"QueryParameterList",
"(",
")",
";",
"queryParams",
".",
"add",
"(",
"\"filter[ids]\"",
",",
"new",
"Long",
"(",
"applicationId",
")",
")",
";",
"return",
"Optional",
".",
"of",
"(",
"HTTP",
".",
"GET",
"(",
"\"/v2/browser_applications.json\"",
",",
"null",
",",
"queryParams",
",",
"BROWSER_APPLICATIONS",
")",
".",
"get",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}"
] |
Returns the Browser application for the given application id.
@param applicationId The id for the application to return
@return The application
|
[
"Returns",
"the",
"Browser",
"application",
"for",
"the",
"given",
"application",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/BrowserApplicationService.java#L87-L92
|
10,398
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerAccountService.java
|
PartnerAccountService.list
|
public Collection<PartnerAccount> list(long partnerId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts", partnerId), PARTNER_ACCOUNTS).get();
}
|
java
|
public Collection<PartnerAccount> list(long partnerId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts", partnerId), PARTNER_ACCOUNTS).get();
}
|
[
"public",
"Collection",
"<",
"PartnerAccount",
">",
"list",
"(",
"long",
"partnerId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/partners/%d/accounts\"",
",",
"partnerId",
")",
",",
"PARTNER_ACCOUNTS",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the set of accounts.
@param partnerId The id of the partner for the accounts
@return The set of accounts
|
[
"Returns",
"the",
"set",
"of",
"accounts",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerAccountService.java#L46-L49
|
10,399
|
opsmatters/newrelic-api
|
src/main/java/com/opsmatters/newrelic/api/services/PartnerAccountService.java
|
PartnerAccountService.show
|
public Optional<PartnerAccount> show(long partnerId, long accountId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts/%d", partnerId, accountId), PARTNER_ACCOUNT);
}
|
java
|
public Optional<PartnerAccount> show(long partnerId, long accountId)
{
return HTTP.GET(String.format("/v2/partners/%d/accounts/%d", partnerId, accountId), PARTNER_ACCOUNT);
}
|
[
"public",
"Optional",
"<",
"PartnerAccount",
">",
"show",
"(",
"long",
"partnerId",
",",
"long",
"accountId",
")",
"{",
"return",
"HTTP",
".",
"GET",
"(",
"String",
".",
"format",
"(",
"\"/v2/partners/%d/accounts/%d\"",
",",
"partnerId",
",",
"accountId",
")",
",",
"PARTNER_ACCOUNT",
")",
";",
"}"
] |
Returns the account with the given id.
@param partnerId The id of the partner the account belongs to
@param accountId The id of the account to return
@return The account
|
[
"Returns",
"the",
"account",
"with",
"the",
"given",
"id",
"."
] |
5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e
|
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/PartnerAccountService.java#L57-L60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.