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
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
3,300 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/splitpanel/MaterialSplitPanel.java | MaterialSplitPanel.getAxis | public Axis getAxis() {
return options.orientation != null ? Axis.fromStyleName(options.orientation) : null;
} | java | public Axis getAxis() {
return options.orientation != null ? Axis.fromStyleName(options.orientation) : null;
} | [
"public",
"Axis",
"getAxis",
"(",
")",
"{",
"return",
"options",
".",
"orientation",
"!=",
"null",
"?",
"Axis",
".",
"fromStyleName",
"(",
"options",
".",
"orientation",
")",
":",
"null",
";",
"}"
] | Get the axis orientation of splitter component. | [
"Get",
"the",
"axis",
"orientation",
"of",
"splitter",
"component",
"."
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/splitpanel/MaterialSplitPanel.java#L284-L286 |
3,301 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/splitpanel/MaterialSplitPanel.java | MaterialSplitPanel.getDock | public Dock getDock() {
return options.dock != null ? Dock.fromStyleName(options.dock) : null;
} | java | public Dock getDock() {
return options.dock != null ? Dock.fromStyleName(options.dock) : null;
} | [
"public",
"Dock",
"getDock",
"(",
")",
"{",
"return",
"options",
".",
"dock",
"!=",
"null",
"?",
"Dock",
".",
"fromStyleName",
"(",
"options",
".",
"dock",
")",
":",
"null",
";",
"}"
] | Get the dock value. | [
"Get",
"the",
"dock",
"value",
"."
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/splitpanel/MaterialSplitPanel.java#L298-L300 |
3,302 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java | MaterialComboBox.addItem | public void addItem(String text, T value, OptGroup optGroup) {
if (!values.contains(value)) {
values.add(value);
optGroup.add(buildOption(text, value));
}
} | java | public void addItem(String text, T value, OptGroup optGroup) {
if (!values.contains(value)) {
values.add(value);
optGroup.add(buildOption(text, value));
}
} | [
"public",
"void",
"addItem",
"(",
"String",
"text",
",",
"T",
"value",
",",
"OptGroup",
"optGroup",
")",
"{",
"if",
"(",
"!",
"values",
".",
"contains",
"(",
"value",
")",
")",
"{",
"values",
".",
"add",
"(",
"value",
")",
";",
"optGroup",
".",
"add",
"(",
"buildOption",
"(",
"text",
",",
"value",
")",
")",
";",
"}",
"}"
] | Add item directly to combobox component with existing OptGroup
@param text - The text you want to labeled on the option item
@param value - The value you want to pass through in this option
@param optGroup - Add directly this option into the existing group | [
"Add",
"item",
"directly",
"to",
"combobox",
"component",
"with",
"existing",
"OptGroup"
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java#L237-L242 |
3,303 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java | MaterialComboBox.addItem | public Option addItem(String text, T value) {
if (!values.contains(value)) {
Option option = buildOption(text, value);
values.add(value);
listbox.add(option);
return option;
}
return null;
} | java | public Option addItem(String text, T value) {
if (!values.contains(value)) {
Option option = buildOption(text, value);
values.add(value);
listbox.add(option);
return option;
}
return null;
} | [
"public",
"Option",
"addItem",
"(",
"String",
"text",
",",
"T",
"value",
")",
"{",
"if",
"(",
"!",
"values",
".",
"contains",
"(",
"value",
")",
")",
"{",
"Option",
"option",
"=",
"buildOption",
"(",
"text",
",",
"value",
")",
";",
"values",
".",
"add",
"(",
"value",
")",
";",
"listbox",
".",
"add",
"(",
"option",
")",
";",
"return",
"option",
";",
"}",
"return",
"null",
";",
"}"
] | Add Value directly to combobox component
@param text - The text you want to labeled on the option item
@param value - The value you want to pass through in this option | [
"Add",
"Value",
"directly",
"to",
"combobox",
"component"
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java#L250-L258 |
3,304 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java | MaterialComboBox.buildOption | protected Option buildOption(String text, T value) {
Option option = new Option();
option.setText(text);
option.setValue(keyFactory.generateKey(value));
return option;
} | java | protected Option buildOption(String text, T value) {
Option option = new Option();
option.setText(text);
option.setValue(keyFactory.generateKey(value));
return option;
} | [
"protected",
"Option",
"buildOption",
"(",
"String",
"text",
",",
"T",
"value",
")",
"{",
"Option",
"option",
"=",
"new",
"Option",
"(",
")",
";",
"option",
".",
"setText",
"(",
"text",
")",
";",
"option",
".",
"setValue",
"(",
"keyFactory",
".",
"generateKey",
"(",
"value",
")",
")",
";",
"return",
"option",
";",
"}"
] | Build the Option Element with provided params | [
"Build",
"the",
"Option",
"Element",
"with",
"provided",
"params"
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java#L276-L281 |
3,305 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java | MaterialComboBox.getSingleValue | public T getSingleValue() {
List<T> values = getSelectedValue();
if (!values.isEmpty()) {
return values.get(0);
}
return null;
} | java | public T getSingleValue() {
List<T> values = getSelectedValue();
if (!values.isEmpty()) {
return values.get(0);
}
return null;
} | [
"public",
"T",
"getSingleValue",
"(",
")",
"{",
"List",
"<",
"T",
">",
"values",
"=",
"getSelectedValue",
"(",
")",
";",
"if",
"(",
"!",
"values",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"values",
".",
"get",
"(",
"0",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Only return a single value even if multi support is activate. | [
"Only",
"return",
"a",
"single",
"value",
"even",
"if",
"multi",
"support",
"is",
"activate",
"."
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java#L497-L503 |
3,306 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java | MaterialComboBox.setSingleValue | public void setSingleValue(T value, boolean fireEvents) {
int index = this.values.indexOf(value);
if (index < 0 && value instanceof String) {
index = getIndexByString((String) value);
}
if (index > -1) {
List<T> before = getValue();
setSelectedIndex(index);
if (fireEvents) {
ValueChangeEvent.fireIfNotEqual(this, before, Collections.singletonList(value));
}
}
} | java | public void setSingleValue(T value, boolean fireEvents) {
int index = this.values.indexOf(value);
if (index < 0 && value instanceof String) {
index = getIndexByString((String) value);
}
if (index > -1) {
List<T> before = getValue();
setSelectedIndex(index);
if (fireEvents) {
ValueChangeEvent.fireIfNotEqual(this, before, Collections.singletonList(value));
}
}
} | [
"public",
"void",
"setSingleValue",
"(",
"T",
"value",
",",
"boolean",
"fireEvents",
")",
"{",
"int",
"index",
"=",
"this",
".",
"values",
".",
"indexOf",
"(",
"value",
")",
";",
"if",
"(",
"index",
"<",
"0",
"&&",
"value",
"instanceof",
"String",
")",
"{",
"index",
"=",
"getIndexByString",
"(",
"(",
"String",
")",
"value",
")",
";",
"}",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"List",
"<",
"T",
">",
"before",
"=",
"getValue",
"(",
")",
";",
"setSelectedIndex",
"(",
"index",
")",
";",
"if",
"(",
"fireEvents",
")",
"{",
"ValueChangeEvent",
".",
"fireIfNotEqual",
"(",
"this",
",",
"before",
",",
"Collections",
".",
"singletonList",
"(",
"value",
")",
")",
";",
"}",
"}",
"}"
] | Set the selected value using a single item, generally used
in single selection mode. | [
"Set",
"the",
"selected",
"value",
"using",
"a",
"single",
"item",
"generally",
"used",
"in",
"single",
"selection",
"mode",
"."
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java#L533-L547 |
3,307 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/circularprogress/MaterialCircularProgress.java | MaterialCircularProgress.setFillColor | public void setFillColor(Color fillColor) {
this.fillColor = fillColor;
options.fill = ColorHelper.setupComputedBackgroundColor(fillColor);
} | java | public void setFillColor(Color fillColor) {
this.fillColor = fillColor;
options.fill = ColorHelper.setupComputedBackgroundColor(fillColor);
} | [
"public",
"void",
"setFillColor",
"(",
"Color",
"fillColor",
")",
"{",
"this",
".",
"fillColor",
"=",
"fillColor",
";",
"options",
".",
"fill",
"=",
"ColorHelper",
".",
"setupComputedBackgroundColor",
"(",
"fillColor",
")",
";",
"}"
] | Set the fillColor of the circular progress | [
"Set",
"the",
"fillColor",
"of",
"the",
"circular",
"progress"
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/circularprogress/MaterialCircularProgress.java#L184-L187 |
3,308 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/circularprogress/MaterialCircularProgress.java | MaterialCircularProgress.setEmptyFillColor | public void setEmptyFillColor(Color emptyFillColor) {
this.emptyFillColor = emptyFillColor;
options.emptyFill = ColorHelper.setupComputedBackgroundColor(emptyFillColor);
} | java | public void setEmptyFillColor(Color emptyFillColor) {
this.emptyFillColor = emptyFillColor;
options.emptyFill = ColorHelper.setupComputedBackgroundColor(emptyFillColor);
} | [
"public",
"void",
"setEmptyFillColor",
"(",
"Color",
"emptyFillColor",
")",
"{",
"this",
".",
"emptyFillColor",
"=",
"emptyFillColor",
";",
"options",
".",
"emptyFill",
"=",
"ColorHelper",
".",
"setupComputedBackgroundColor",
"(",
"emptyFillColor",
")",
";",
"}"
] | Set the empty fill color of the circular progress | [
"Set",
"the",
"empty",
"fill",
"color",
"of",
"the",
"circular",
"progress"
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/circularprogress/MaterialCircularProgress.java#L196-L199 |
3,309 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/autocomplete/base/MaterialSuggestionOracle.java | MaterialSuggestionOracle.add | public void add(String text, Image image) {
this.imageElem = image.getElement().toString();
add(text + image);
} | java | public void add(String text, Image image) {
this.imageElem = image.getElement().toString();
add(text + image);
} | [
"public",
"void",
"add",
"(",
"String",
"text",
",",
"Image",
"image",
")",
"{",
"this",
".",
"imageElem",
"=",
"image",
".",
"getElement",
"(",
")",
".",
"toString",
"(",
")",
";",
"add",
"(",
"text",
"+",
"image",
")",
";",
"}"
] | Autocomplete with Image item selection. | [
"Autocomplete",
"with",
"Image",
"item",
"selection",
"."
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/autocomplete/base/MaterialSuggestionOracle.java#L40-L43 |
3,310 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/incubator/client/infinitescroll/recycle/RecycleManager.java | RecycleManager.recycle | public void recycle(RecyclePosition position) {
stubCount = determineStubCount();
switch (position) {
case BOTTOM:
if (hasRecycledWidgets()) {
// Will remove the current recycled widgets
remove(getRecycledWidgets().stream()
.skip(0)
.limit((parent.getLimit() * (currentIndex + 1)) - stubCount)
.collect(Collectors.toList()));
currentIndex++;
// Will determine if the current index is greater than the load index then we need to recycle the next
// set of recycled widgets
if (currentIndex < loadIndex) {
add(getRecycledWidgets(currentIndex));
}
}
break;
case TOP:
if (currentIndex > 0) {
// Will remove the current recycled widgets
remove(getRecycledWidgets(currentIndex));
// Will add the previous recycled widgets
int skip = ((parent.getLimit() * currentIndex) - parent.getLimit()) - stubCount;
insert(getRecycledWidgets().stream()
.skip(skip < 0 ? 0 : skip)
.limit(parent.getLimit())
.collect(Collectors.toList()));
currentIndex--;
}
break;
}
} | java | public void recycle(RecyclePosition position) {
stubCount = determineStubCount();
switch (position) {
case BOTTOM:
if (hasRecycledWidgets()) {
// Will remove the current recycled widgets
remove(getRecycledWidgets().stream()
.skip(0)
.limit((parent.getLimit() * (currentIndex + 1)) - stubCount)
.collect(Collectors.toList()));
currentIndex++;
// Will determine if the current index is greater than the load index then we need to recycle the next
// set of recycled widgets
if (currentIndex < loadIndex) {
add(getRecycledWidgets(currentIndex));
}
}
break;
case TOP:
if (currentIndex > 0) {
// Will remove the current recycled widgets
remove(getRecycledWidgets(currentIndex));
// Will add the previous recycled widgets
int skip = ((parent.getLimit() * currentIndex) - parent.getLimit()) - stubCount;
insert(getRecycledWidgets().stream()
.skip(skip < 0 ? 0 : skip)
.limit(parent.getLimit())
.collect(Collectors.toList()));
currentIndex--;
}
break;
}
} | [
"public",
"void",
"recycle",
"(",
"RecyclePosition",
"position",
")",
"{",
"stubCount",
"=",
"determineStubCount",
"(",
")",
";",
"switch",
"(",
"position",
")",
"{",
"case",
"BOTTOM",
":",
"if",
"(",
"hasRecycledWidgets",
"(",
")",
")",
"{",
"// Will remove the current recycled widgets",
"remove",
"(",
"getRecycledWidgets",
"(",
")",
".",
"stream",
"(",
")",
".",
"skip",
"(",
"0",
")",
".",
"limit",
"(",
"(",
"parent",
".",
"getLimit",
"(",
")",
"*",
"(",
"currentIndex",
"+",
"1",
")",
")",
"-",
"stubCount",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
";",
"currentIndex",
"++",
";",
"// Will determine if the current index is greater than the load index then we need to recycle the next",
"// set of recycled widgets",
"if",
"(",
"currentIndex",
"<",
"loadIndex",
")",
"{",
"add",
"(",
"getRecycledWidgets",
"(",
"currentIndex",
")",
")",
";",
"}",
"}",
"break",
";",
"case",
"TOP",
":",
"if",
"(",
"currentIndex",
">",
"0",
")",
"{",
"// Will remove the current recycled widgets",
"remove",
"(",
"getRecycledWidgets",
"(",
"currentIndex",
")",
")",
";",
"// Will add the previous recycled widgets",
"int",
"skip",
"=",
"(",
"(",
"parent",
".",
"getLimit",
"(",
")",
"*",
"currentIndex",
")",
"-",
"parent",
".",
"getLimit",
"(",
")",
")",
"-",
"stubCount",
";",
"insert",
"(",
"getRecycledWidgets",
"(",
")",
".",
"stream",
"(",
")",
".",
"skip",
"(",
"skip",
"<",
"0",
"?",
"0",
":",
"skip",
")",
".",
"limit",
"(",
"parent",
".",
"getLimit",
"(",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
";",
"currentIndex",
"--",
";",
"}",
"break",
";",
"}",
"}"
] | Will recycle the provided widgets (@link widgets} with provided {@link RecyclePosition} | [
"Will",
"recycle",
"the",
"provided",
"widgets",
"("
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/incubator/client/infinitescroll/recycle/RecycleManager.java#L63-L101 |
3,311 | GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/incubator/client/infinitescroll/recycle/RecycleManager.java | RecycleManager.getRecycledWidgets | public List<Widget> getRecycledWidgets() {
List<Widget> widgets = new ArrayList<>();
for (Integer recycledIndex : recycledWidgets.keySet()) {
widgets.addAll(recycledWidgets.get(recycledIndex));
}
return widgets;
} | java | public List<Widget> getRecycledWidgets() {
List<Widget> widgets = new ArrayList<>();
for (Integer recycledIndex : recycledWidgets.keySet()) {
widgets.addAll(recycledWidgets.get(recycledIndex));
}
return widgets;
} | [
"public",
"List",
"<",
"Widget",
">",
"getRecycledWidgets",
"(",
")",
"{",
"List",
"<",
"Widget",
">",
"widgets",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Integer",
"recycledIndex",
":",
"recycledWidgets",
".",
"keySet",
"(",
")",
")",
"{",
"widgets",
".",
"addAll",
"(",
"recycledWidgets",
".",
"get",
"(",
"recycledIndex",
")",
")",
";",
"}",
"return",
"widgets",
";",
"}"
] | Get all recycled widgets | [
"Get",
"all",
"recycled",
"widgets"
] | 11aec9d92918225f70f936285d0ae94f2178c36e | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/incubator/client/infinitescroll/recycle/RecycleManager.java#L180-L186 |
3,312 | Jasig/sass-maven-plugin | src/main/java/org/jasig/maven/plugin/sass/AbstractSassMojo.java | AbstractSassMojo.executeSassScript | protected void executeSassScript(String sassScript) throws MojoExecutionException, MojoFailureException {
final Log log = this.getLog();
System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe");
log.debug("Execute SASS Ruby Script:\n" + sassScript);
final ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
final ScriptEngine jruby = scriptEngineManager.getEngineByName("jruby");
try {
CompilerCallback compilerCallback = new CompilerCallback(log);
jruby.getBindings(ScriptContext.ENGINE_SCOPE).put("compiler_callback", compilerCallback);
jruby.eval(sassScript);
if (failOnError && compilerCallback.hadError()) {
throw new MojoFailureException("SASS compilation encountered errors (see above for details).");
}
}
catch (final ScriptException e) {
throw new MojoExecutionException("Failed to execute SASS ruby script:\n" + sassScript, e);
}
} | java | protected void executeSassScript(String sassScript) throws MojoExecutionException, MojoFailureException {
final Log log = this.getLog();
System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe");
log.debug("Execute SASS Ruby Script:\n" + sassScript);
final ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
final ScriptEngine jruby = scriptEngineManager.getEngineByName("jruby");
try {
CompilerCallback compilerCallback = new CompilerCallback(log);
jruby.getBindings(ScriptContext.ENGINE_SCOPE).put("compiler_callback", compilerCallback);
jruby.eval(sassScript);
if (failOnError && compilerCallback.hadError()) {
throw new MojoFailureException("SASS compilation encountered errors (see above for details).");
}
}
catch (final ScriptException e) {
throw new MojoExecutionException("Failed to execute SASS ruby script:\n" + sassScript, e);
}
} | [
"protected",
"void",
"executeSassScript",
"(",
"String",
"sassScript",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"final",
"Log",
"log",
"=",
"this",
".",
"getLog",
"(",
")",
";",
"System",
".",
"setProperty",
"(",
"\"org.jruby.embed.localcontext.scope\"",
",",
"\"threadsafe\"",
")",
";",
"log",
".",
"debug",
"(",
"\"Execute SASS Ruby Script:\\n\"",
"+",
"sassScript",
")",
";",
"final",
"ScriptEngineManager",
"scriptEngineManager",
"=",
"new",
"ScriptEngineManager",
"(",
")",
";",
"final",
"ScriptEngine",
"jruby",
"=",
"scriptEngineManager",
".",
"getEngineByName",
"(",
"\"jruby\"",
")",
";",
"try",
"{",
"CompilerCallback",
"compilerCallback",
"=",
"new",
"CompilerCallback",
"(",
"log",
")",
";",
"jruby",
".",
"getBindings",
"(",
"ScriptContext",
".",
"ENGINE_SCOPE",
")",
".",
"put",
"(",
"\"compiler_callback\"",
",",
"compilerCallback",
")",
";",
"jruby",
".",
"eval",
"(",
"sassScript",
")",
";",
"if",
"(",
"failOnError",
"&&",
"compilerCallback",
".",
"hadError",
"(",
")",
")",
"{",
"throw",
"new",
"MojoFailureException",
"(",
"\"SASS compilation encountered errors (see above for details).\"",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"ScriptException",
"e",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Failed to execute SASS ruby script:\\n\"",
"+",
"sassScript",
",",
"e",
")",
";",
"}",
"}"
] | Execute the SASS Compilation Ruby Script | [
"Execute",
"the",
"SASS",
"Compilation",
"Ruby",
"Script"
] | d57bc14748dd25a83eb73172b646436ffc983ed9 | https://github.com/Jasig/sass-maven-plugin/blob/d57bc14748dd25a83eb73172b646436ffc983ed9/src/main/java/org/jasig/maven/plugin/sass/AbstractSassMojo.java#L180-L199 |
3,313 | Karumi/HeaderRecyclerView | library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java | HeaderRecyclerViewAdapter.onCreateViewHolder | @Override public final VH onCreateViewHolder(ViewGroup parent, int viewType) {
VH viewHolder;
if (isHeaderType(viewType)) {
viewHolder = onCreateHeaderViewHolder(parent, viewType);
} else if (isFooterType(viewType)) {
viewHolder = onCreateFooterViewHolder(parent, viewType);
} else {
viewHolder = onCreateItemViewHolder(parent, viewType);
}
return viewHolder;
} | java | @Override public final VH onCreateViewHolder(ViewGroup parent, int viewType) {
VH viewHolder;
if (isHeaderType(viewType)) {
viewHolder = onCreateHeaderViewHolder(parent, viewType);
} else if (isFooterType(viewType)) {
viewHolder = onCreateFooterViewHolder(parent, viewType);
} else {
viewHolder = onCreateItemViewHolder(parent, viewType);
}
return viewHolder;
} | [
"@",
"Override",
"public",
"final",
"VH",
"onCreateViewHolder",
"(",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"VH",
"viewHolder",
";",
"if",
"(",
"isHeaderType",
"(",
"viewType",
")",
")",
"{",
"viewHolder",
"=",
"onCreateHeaderViewHolder",
"(",
"parent",
",",
"viewType",
")",
";",
"}",
"else",
"if",
"(",
"isFooterType",
"(",
"viewType",
")",
")",
"{",
"viewHolder",
"=",
"onCreateFooterViewHolder",
"(",
"parent",
",",
"viewType",
")",
";",
"}",
"else",
"{",
"viewHolder",
"=",
"onCreateItemViewHolder",
"(",
"parent",
",",
"viewType",
")",
";",
"}",
"return",
"viewHolder",
";",
"}"
] | Invokes onCreateHeaderViewHolder, onCreateItemViewHolder or onCreateFooterViewHolder methods
based on the view type param. | [
"Invokes",
"onCreateHeaderViewHolder",
"onCreateItemViewHolder",
"or",
"onCreateFooterViewHolder",
"methods",
"based",
"on",
"the",
"view",
"type",
"param",
"."
] | c018472a1b15de661d8aec153bd5f555ef1e9a37 | https://github.com/Karumi/HeaderRecyclerView/blob/c018472a1b15de661d8aec153bd5f555ef1e9a37/library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java#L49-L59 |
3,314 | Karumi/HeaderRecyclerView | library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java | HeaderRecyclerViewAdapter.onBindViewHolder | @Override public final void onBindViewHolder(VH holder, int position) {
if (isHeaderPosition(position)) {
onBindHeaderViewHolder(holder, position);
} else if (isFooterPosition(position)) {
onBindFooterViewHolder(holder, position);
} else {
onBindItemViewHolder(holder, position);
}
} | java | @Override public final void onBindViewHolder(VH holder, int position) {
if (isHeaderPosition(position)) {
onBindHeaderViewHolder(holder, position);
} else if (isFooterPosition(position)) {
onBindFooterViewHolder(holder, position);
} else {
onBindItemViewHolder(holder, position);
}
} | [
"@",
"Override",
"public",
"final",
"void",
"onBindViewHolder",
"(",
"VH",
"holder",
",",
"int",
"position",
")",
"{",
"if",
"(",
"isHeaderPosition",
"(",
"position",
")",
")",
"{",
"onBindHeaderViewHolder",
"(",
"holder",
",",
"position",
")",
";",
"}",
"else",
"if",
"(",
"isFooterPosition",
"(",
"position",
")",
")",
"{",
"onBindFooterViewHolder",
"(",
"holder",
",",
"position",
")",
";",
"}",
"else",
"{",
"onBindItemViewHolder",
"(",
"holder",
",",
"position",
")",
";",
"}",
"}"
] | Invokes onBindHeaderViewHolder, onBindItemViewHolder or onBindFooterViewHOlder methods based
on the position param. | [
"Invokes",
"onBindHeaderViewHolder",
"onBindItemViewHolder",
"or",
"onBindFooterViewHOlder",
"methods",
"based",
"on",
"the",
"position",
"param",
"."
] | c018472a1b15de661d8aec153bd5f555ef1e9a37 | https://github.com/Karumi/HeaderRecyclerView/blob/c018472a1b15de661d8aec153bd5f555ef1e9a37/library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java#L81-L89 |
3,315 | Karumi/HeaderRecyclerView | library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java | HeaderRecyclerViewAdapter.getItemViewType | @Override public int getItemViewType(int position) {
int viewType = TYPE_ITEM;
if (isHeaderPosition(position)) {
viewType = TYPE_HEADER;
} else if (isFooterPosition(position)) {
viewType = TYPE_FOOTER;
}
return viewType;
} | java | @Override public int getItemViewType(int position) {
int viewType = TYPE_ITEM;
if (isHeaderPosition(position)) {
viewType = TYPE_HEADER;
} else if (isFooterPosition(position)) {
viewType = TYPE_FOOTER;
}
return viewType;
} | [
"@",
"Override",
"public",
"int",
"getItemViewType",
"(",
"int",
"position",
")",
"{",
"int",
"viewType",
"=",
"TYPE_ITEM",
";",
"if",
"(",
"isHeaderPosition",
"(",
"position",
")",
")",
"{",
"viewType",
"=",
"TYPE_HEADER",
";",
"}",
"else",
"if",
"(",
"isFooterPosition",
"(",
"position",
")",
")",
"{",
"viewType",
"=",
"TYPE_FOOTER",
";",
"}",
"return",
"viewType",
";",
"}"
] | Returns the type associated to an item given a position passed as arguments. If the position
is related to a header item returns the constant TYPE_HEADER or TYPE_FOOTER if the position is
related to the footer, if not, returns TYPE_ITEM.
If your application has to support different types override this method and provide your
implementation. Remember that TYPE_HEADER, TYPE_ITEM and TYPE_FOOTER are internal constants
can be used to identify an item given a position, try to use different values in your
application. | [
"Returns",
"the",
"type",
"associated",
"to",
"an",
"item",
"given",
"a",
"position",
"passed",
"as",
"arguments",
".",
"If",
"the",
"position",
"is",
"related",
"to",
"a",
"header",
"item",
"returns",
"the",
"constant",
"TYPE_HEADER",
"or",
"TYPE_FOOTER",
"if",
"the",
"position",
"is",
"related",
"to",
"the",
"footer",
"if",
"not",
"returns",
"TYPE_ITEM",
"."
] | c018472a1b15de661d8aec153bd5f555ef1e9a37 | https://github.com/Karumi/HeaderRecyclerView/blob/c018472a1b15de661d8aec153bd5f555ef1e9a37/library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java#L140-L148 |
3,316 | Karumi/HeaderRecyclerView | library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java | HeaderRecyclerViewAdapter.getItemCount | @Override public int getItemCount() {
int size = items.size();
if (hasHeader()) {
size++;
}
if (hasFooter()) {
size++;
}
return size;
} | java | @Override public int getItemCount() {
int size = items.size();
if (hasHeader()) {
size++;
}
if (hasFooter()) {
size++;
}
return size;
} | [
"@",
"Override",
"public",
"int",
"getItemCount",
"(",
")",
"{",
"int",
"size",
"=",
"items",
".",
"size",
"(",
")",
";",
"if",
"(",
"hasHeader",
"(",
")",
")",
"{",
"size",
"++",
";",
"}",
"if",
"(",
"hasFooter",
"(",
")",
")",
"{",
"size",
"++",
";",
"}",
"return",
"size",
";",
"}"
] | Returns the items list size if there is no a header configured or the size taking into account
that if a header or a footer is configured the number of items returned is going to include
this elements. | [
"Returns",
"the",
"items",
"list",
"size",
"if",
"there",
"is",
"no",
"a",
"header",
"configured",
"or",
"the",
"size",
"taking",
"into",
"account",
"that",
"if",
"a",
"header",
"or",
"a",
"footer",
"is",
"configured",
"the",
"number",
"of",
"items",
"returned",
"is",
"going",
"to",
"include",
"this",
"elements",
"."
] | c018472a1b15de661d8aec153bd5f555ef1e9a37 | https://github.com/Karumi/HeaderRecyclerView/blob/c018472a1b15de661d8aec153bd5f555ef1e9a37/library/src/main/java/com/karumi/headerrecyclerview/HeaderRecyclerViewAdapter.java#L155-L164 |
3,317 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.getPointForID | Point getPointForID(int id) {
for (int i = 0; i < pointCount; i++) {
if (id == -1 || points[i].id == id) {
return points[i];
}
}
return null;
} | java | Point getPointForID(int id) {
for (int i = 0; i < pointCount; i++) {
if (id == -1 || points[i].id == id) {
return points[i];
}
}
return null;
} | [
"Point",
"getPointForID",
"(",
"int",
"id",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pointCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"id",
"==",
"-",
"1",
"||",
"points",
"[",
"i",
"]",
".",
"id",
"==",
"id",
")",
"{",
"return",
"points",
"[",
"i",
"]",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the Point matching the given ID. if available
@param id The Point ID to match. A value of -1 matches any Point.
@return a matching Point, or null if there is no point with that ID. | [
"Gets",
"the",
"Point",
"matching",
"the",
"given",
"ID",
".",
"if",
"available"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L113-L120 |
3,318 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.assignPrimaryID | void assignPrimaryID() {
if (pointCount == 0) {
primaryID = -1;
} else if (primaryID <= 0) {
// No primary ID is assigned. Assign a new ID arbitrarily.
primaryID = points[0].id;
} else {
for (int i = 0; i < pointCount; i++) {
if (points[i].id == primaryID) {
// The old primary ID is still valid
return;
}
}
// assign a new primary ID
primaryID = points[0].id;
}
} | java | void assignPrimaryID() {
if (pointCount == 0) {
primaryID = -1;
} else if (primaryID <= 0) {
// No primary ID is assigned. Assign a new ID arbitrarily.
primaryID = points[0].id;
} else {
for (int i = 0; i < pointCount; i++) {
if (points[i].id == primaryID) {
// The old primary ID is still valid
return;
}
}
// assign a new primary ID
primaryID = points[0].id;
}
} | [
"void",
"assignPrimaryID",
"(",
")",
"{",
"if",
"(",
"pointCount",
"==",
"0",
")",
"{",
"primaryID",
"=",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"primaryID",
"<=",
"0",
")",
"{",
"// No primary ID is assigned. Assign a new ID arbitrarily.",
"primaryID",
"=",
"points",
"[",
"0",
"]",
".",
"id",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pointCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"points",
"[",
"i",
"]",
".",
"id",
"==",
"primaryID",
")",
"{",
"// The old primary ID is still valid",
"return",
";",
"}",
"}",
"// assign a new primary ID",
"primaryID",
"=",
"points",
"[",
"0",
"]",
".",
"id",
";",
"}",
"}"
] | Updates the primary point ID | [
"Updates",
"the",
"primary",
"point",
"ID"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L128-L144 |
3,319 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.addPoint | Point addPoint(Point p) {
if (points.length == pointCount) {
points = Arrays.copyOf(points, points.length * 2);
}
if (points[pointCount] == null) {
points[pointCount] = new Point();
}
if (p != null) {
p.copyTo(points[pointCount]);
}
return points[pointCount++];
} | java | Point addPoint(Point p) {
if (points.length == pointCount) {
points = Arrays.copyOf(points, points.length * 2);
}
if (points[pointCount] == null) {
points[pointCount] = new Point();
}
if (p != null) {
p.copyTo(points[pointCount]);
}
return points[pointCount++];
} | [
"Point",
"addPoint",
"(",
"Point",
"p",
")",
"{",
"if",
"(",
"points",
".",
"length",
"==",
"pointCount",
")",
"{",
"points",
"=",
"Arrays",
".",
"copyOf",
"(",
"points",
",",
"points",
".",
"length",
"*",
"2",
")",
";",
"}",
"if",
"(",
"points",
"[",
"pointCount",
"]",
"==",
"null",
")",
"{",
"points",
"[",
"pointCount",
"]",
"=",
"new",
"Point",
"(",
")",
";",
"}",
"if",
"(",
"p",
"!=",
"null",
")",
"{",
"p",
".",
"copyTo",
"(",
"points",
"[",
"pointCount",
"]",
")",
";",
"}",
"return",
"points",
"[",
"pointCount",
"++",
"]",
";",
"}"
] | Adds a Point to this state object.
@param p the Point describing the data to add, or null if no data is
available yet for this point. p is not modified,
but its contents are copied to the object describing the new
Point.
@return the Point with the data for the new touch point. The fields of
this Point may be modified directly to change the data for the new
touch point. | [
"Adds",
"a",
"Point",
"to",
"this",
"state",
"object",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L174-L185 |
3,320 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.removePointForID | void removePointForID(int id) {
for (int i = 0; i < pointCount; i++) {
if (points[i].id == id) {
if (i < pointCount - 1) {
System.arraycopy(points, i + 1, points, i, pointCount - i - 1);
points[pointCount - 1] = null;
}
pointCount --;
}
}
} | java | void removePointForID(int id) {
for (int i = 0; i < pointCount; i++) {
if (points[i].id == id) {
if (i < pointCount - 1) {
System.arraycopy(points, i + 1, points, i, pointCount - i - 1);
points[pointCount - 1] = null;
}
pointCount --;
}
}
} | [
"void",
"removePointForID",
"(",
"int",
"id",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pointCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"points",
"[",
"i",
"]",
".",
"id",
"==",
"id",
")",
"{",
"if",
"(",
"i",
"<",
"pointCount",
"-",
"1",
")",
"{",
"System",
".",
"arraycopy",
"(",
"points",
",",
"i",
"+",
"1",
",",
"points",
",",
"i",
",",
"pointCount",
"-",
"i",
"-",
"1",
")",
";",
"points",
"[",
"pointCount",
"-",
"1",
"]",
"=",
"null",
";",
"}",
"pointCount",
"--",
";",
"}",
"}",
"}"
] | Removes the point with the given ID
@param id The ID of the touch point which is to be removed. | [
"Removes",
"the",
"point",
"with",
"the",
"given",
"ID"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L191-L201 |
3,321 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.setPoint | void setPoint(int index, Point p) {
if (index >= pointCount) {
throw new IndexOutOfBoundsException();
}
p.copyTo(points[index]);
} | java | void setPoint(int index, Point p) {
if (index >= pointCount) {
throw new IndexOutOfBoundsException();
}
p.copyTo(points[index]);
} | [
"void",
"setPoint",
"(",
"int",
"index",
",",
"Point",
"p",
")",
"{",
"if",
"(",
"index",
">=",
"pointCount",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"p",
".",
"copyTo",
"(",
"points",
"[",
"index",
"]",
")",
";",
"}"
] | Replaces the touch point data at the given index with the given touch
point data
@param index the index at which to change the touch point data
@param p the data to copy to the given index. | [
"Replaces",
"the",
"touch",
"point",
"data",
"at",
"the",
"given",
"index",
"with",
"the",
"given",
"touch",
"point",
"data"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L209-L214 |
3,322 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.equalsSorted | boolean equalsSorted(TouchState ts) {
if (ts.pointCount == pointCount
&& ts.primaryID == primaryID
&& ts.window == window) {
for (int i = 0; i < pointCount; i++) {
Point p1 = ts.points[i];
Point p2 = points[i];
if (p1.x != p2.x || p1.y != p2.y || p1.id != p2.id) {
return false;
}
}
return true;
} else {
return false;
}
} | java | boolean equalsSorted(TouchState ts) {
if (ts.pointCount == pointCount
&& ts.primaryID == primaryID
&& ts.window == window) {
for (int i = 0; i < pointCount; i++) {
Point p1 = ts.points[i];
Point p2 = points[i];
if (p1.x != p2.x || p1.y != p2.y || p1.id != p2.id) {
return false;
}
}
return true;
} else {
return false;
}
} | [
"boolean",
"equalsSorted",
"(",
"TouchState",
"ts",
")",
"{",
"if",
"(",
"ts",
".",
"pointCount",
"==",
"pointCount",
"&&",
"ts",
".",
"primaryID",
"==",
"primaryID",
"&&",
"ts",
".",
"window",
"==",
"window",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pointCount",
";",
"i",
"++",
")",
"{",
"Point",
"p1",
"=",
"ts",
".",
"points",
"[",
"i",
"]",
";",
"Point",
"p2",
"=",
"points",
"[",
"i",
"]",
";",
"if",
"(",
"p1",
".",
"x",
"!=",
"p2",
".",
"x",
"||",
"p1",
".",
"y",
"!=",
"p2",
".",
"y",
"||",
"p1",
".",
"id",
"!=",
"p2",
".",
"id",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Compare two non-null states whose points are sorted by ID | [
"Compare",
"two",
"non",
"-",
"null",
"states",
"whose",
"points",
"are",
"sorted",
"by",
"ID"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L249-L264 |
3,323 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.canBeFoldedWith | boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs) {
if (ts.pointCount != pointCount) {
return false;
}
if (ignoreIDs) {
return true;
}
for (int i = 0; i < pointCount; i++) {
if (ts.points[i].id != points[i].id) {
return false;
}
}
return true;
} | java | boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs) {
if (ts.pointCount != pointCount) {
return false;
}
if (ignoreIDs) {
return true;
}
for (int i = 0; i < pointCount; i++) {
if (ts.points[i].id != points[i].id) {
return false;
}
}
return true;
} | [
"boolean",
"canBeFoldedWith",
"(",
"TouchState",
"ts",
",",
"boolean",
"ignoreIDs",
")",
"{",
"if",
"(",
"ts",
".",
"pointCount",
"!=",
"pointCount",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"ignoreIDs",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pointCount",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ts",
".",
"points",
"[",
"i",
"]",
".",
"id",
"!=",
"points",
"[",
"i",
"]",
".",
"id",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Finds out whether two non-null states are identical in everything but
their touch point coordinates
@param ts the TouchState to compare to
@param ignoreIDs if true, ignore IDs when comparing points | [
"Finds",
"out",
"whether",
"two",
"non",
"-",
"null",
"states",
"are",
"identical",
"in",
"everything",
"but",
"their",
"touch",
"point",
"coordinates"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L272-L285 |
3,324 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java | LinuxTouchTransform.getValue | int getValue(LinuxEventBuffer buffer) {
int axis = buffer.getEventCode();
int value = buffer.getEventValue();
int i;
for (i = 0; i < axes.length && axes[i] != -1; i++) {
if (axes[i] == axis) {
return transform(i, value);
}
}
if (i == axes.length) {
axes = Arrays.copyOf(axes, axes.length * 2);
Arrays.fill(axes, i + 1, axes.length - 1, -1);
translates = Arrays.copyOf(translates, translates.length * 2);
scalars = Arrays.copyOf(scalars, scalars.length * 2);
mins = Arrays.copyOf(mins, mins.length * 2);
maxs = Arrays.copyOf(maxs, maxs.length * 2);
}
initTransform(axis, i);
return transform(i, value);
} | java | int getValue(LinuxEventBuffer buffer) {
int axis = buffer.getEventCode();
int value = buffer.getEventValue();
int i;
for (i = 0; i < axes.length && axes[i] != -1; i++) {
if (axes[i] == axis) {
return transform(i, value);
}
}
if (i == axes.length) {
axes = Arrays.copyOf(axes, axes.length * 2);
Arrays.fill(axes, i + 1, axes.length - 1, -1);
translates = Arrays.copyOf(translates, translates.length * 2);
scalars = Arrays.copyOf(scalars, scalars.length * 2);
mins = Arrays.copyOf(mins, mins.length * 2);
maxs = Arrays.copyOf(maxs, maxs.length * 2);
}
initTransform(axis, i);
return transform(i, value);
} | [
"int",
"getValue",
"(",
"LinuxEventBuffer",
"buffer",
")",
"{",
"int",
"axis",
"=",
"buffer",
".",
"getEventCode",
"(",
")",
";",
"int",
"value",
"=",
"buffer",
".",
"getEventValue",
"(",
")",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"axes",
".",
"length",
"&&",
"axes",
"[",
"i",
"]",
"!=",
"-",
"1",
";",
"i",
"++",
")",
"{",
"if",
"(",
"axes",
"[",
"i",
"]",
"==",
"axis",
")",
"{",
"return",
"transform",
"(",
"i",
",",
"value",
")",
";",
"}",
"}",
"if",
"(",
"i",
"==",
"axes",
".",
"length",
")",
"{",
"axes",
"=",
"Arrays",
".",
"copyOf",
"(",
"axes",
",",
"axes",
".",
"length",
"*",
"2",
")",
";",
"Arrays",
".",
"fill",
"(",
"axes",
",",
"i",
"+",
"1",
",",
"axes",
".",
"length",
"-",
"1",
",",
"-",
"1",
")",
";",
"translates",
"=",
"Arrays",
".",
"copyOf",
"(",
"translates",
",",
"translates",
".",
"length",
"*",
"2",
")",
";",
"scalars",
"=",
"Arrays",
".",
"copyOf",
"(",
"scalars",
",",
"scalars",
".",
"length",
"*",
"2",
")",
";",
"mins",
"=",
"Arrays",
".",
"copyOf",
"(",
"mins",
",",
"mins",
".",
"length",
"*",
"2",
")",
";",
"maxs",
"=",
"Arrays",
".",
"copyOf",
"(",
"maxs",
",",
"maxs",
".",
"length",
"*",
"2",
")",
";",
"}",
"initTransform",
"(",
"axis",
",",
"i",
")",
";",
"return",
"transform",
"(",
"i",
",",
"value",
")",
";",
"}"
] | Gets the transformed pixel coordinate of the current event in the buffer
provided.
@param buffer A LinuxEventBuffer containing a raw event line
@return a transformed value in screen space | [
"Gets",
"the",
"transformed",
"pixel",
"coordinate",
"of",
"the",
"current",
"event",
"in",
"the",
"buffer",
"provided",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java#L72-L91 |
3,325 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java | LinuxTouchTransform.getAxis | int getAxis(LinuxEventBuffer buffer) {
int axis = buffer.getEventCode();
if (flipXY) {
switch (axis) {
case LinuxInput.ABS_X: return LinuxInput.ABS_Y;
case LinuxInput.ABS_Y: return LinuxInput.ABS_X;
case LinuxInput.ABS_MT_POSITION_X: return LinuxInput.ABS_MT_POSITION_Y;
case LinuxInput.ABS_MT_POSITION_Y: return LinuxInput.ABS_MT_POSITION_X;
default:
return axis;
}
} else {
return axis;
}
} | java | int getAxis(LinuxEventBuffer buffer) {
int axis = buffer.getEventCode();
if (flipXY) {
switch (axis) {
case LinuxInput.ABS_X: return LinuxInput.ABS_Y;
case LinuxInput.ABS_Y: return LinuxInput.ABS_X;
case LinuxInput.ABS_MT_POSITION_X: return LinuxInput.ABS_MT_POSITION_Y;
case LinuxInput.ABS_MT_POSITION_Y: return LinuxInput.ABS_MT_POSITION_X;
default:
return axis;
}
} else {
return axis;
}
} | [
"int",
"getAxis",
"(",
"LinuxEventBuffer",
"buffer",
")",
"{",
"int",
"axis",
"=",
"buffer",
".",
"getEventCode",
"(",
")",
";",
"if",
"(",
"flipXY",
")",
"{",
"switch",
"(",
"axis",
")",
"{",
"case",
"LinuxInput",
".",
"ABS_X",
":",
"return",
"LinuxInput",
".",
"ABS_Y",
";",
"case",
"LinuxInput",
".",
"ABS_Y",
":",
"return",
"LinuxInput",
".",
"ABS_X",
";",
"case",
"LinuxInput",
".",
"ABS_MT_POSITION_X",
":",
"return",
"LinuxInput",
".",
"ABS_MT_POSITION_Y",
";",
"case",
"LinuxInput",
".",
"ABS_MT_POSITION_Y",
":",
"return",
"LinuxInput",
".",
"ABS_MT_POSITION_X",
";",
"default",
":",
"return",
"axis",
";",
"}",
"}",
"else",
"{",
"return",
"axis",
";",
"}",
"}"
] | Gets the transformed axis number of the current event in the buffer
provided.
@param buffer A LinuxEventBuffer containing a raw event line
@return an axis number (e.g. Input.ABS_X) | [
"Gets",
"the",
"transformed",
"axis",
"number",
"of",
"the",
"current",
"event",
"in",
"the",
"buffer",
"provided",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxTouchTransform.java#L100-L114 |
3,326 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/KeyState.java | KeyState.getWindow | MonocleWindow getWindow(boolean recalculateCache) {
if (window == null || recalculateCache) {
window = (MonocleWindow)
MonocleWindowManager.getInstance().getFocusedWindow();
}
return window;
} | java | MonocleWindow getWindow(boolean recalculateCache) {
if (window == null || recalculateCache) {
window = (MonocleWindow)
MonocleWindowManager.getInstance().getFocusedWindow();
}
return window;
} | [
"MonocleWindow",
"getWindow",
"(",
"boolean",
"recalculateCache",
")",
"{",
"if",
"(",
"window",
"==",
"null",
"||",
"recalculateCache",
")",
"{",
"window",
"=",
"(",
"MonocleWindow",
")",
"MonocleWindowManager",
".",
"getInstance",
"(",
")",
".",
"getFocusedWindow",
"(",
")",
";",
"}",
"return",
"window",
";",
"}"
] | Returns the Glass window on which this event state is located . | [
"Returns",
"the",
"Glass",
"window",
"on",
"which",
"this",
"event",
"state",
"is",
"located",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/KeyState.java#L78-L84 |
3,327 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/MonocleDnDClipboard.java | MonocleDnDClipboard.pushToSystem | @Override
protected void pushToSystem(HashMap<String, Object> cacheData, int supportedActions) {
MouseInput.getInstance().notifyDragStart();
((MonocleApplication) Application.GetApplication()).enterDnDEventLoop();
actionPerformed(Clipboard.ACTION_COPY_OR_MOVE);
} | java | @Override
protected void pushToSystem(HashMap<String, Object> cacheData, int supportedActions) {
MouseInput.getInstance().notifyDragStart();
((MonocleApplication) Application.GetApplication()).enterDnDEventLoop();
actionPerformed(Clipboard.ACTION_COPY_OR_MOVE);
} | [
"@",
"Override",
"protected",
"void",
"pushToSystem",
"(",
"HashMap",
"<",
"String",
",",
"Object",
">",
"cacheData",
",",
"int",
"supportedActions",
")",
"{",
"MouseInput",
".",
"getInstance",
"(",
")",
".",
"notifyDragStart",
"(",
")",
";",
"(",
"(",
"MonocleApplication",
")",
"Application",
".",
"GetApplication",
"(",
")",
")",
".",
"enterDnDEventLoop",
"(",
")",
";",
"actionPerformed",
"(",
"Clipboard",
".",
"ACTION_COPY_OR_MOVE",
")",
";",
"}"
] | Here the magic happens.
When this method is called all input events should be grabbed and
appropriate drag notifications should be sent instead of regular input
events | [
"Here",
"the",
"magic",
"happens",
".",
"When",
"this",
"method",
"is",
"called",
"all",
"input",
"events",
"should",
"be",
"grabbed",
"and",
"appropriate",
"drag",
"notifications",
"should",
"be",
"sent",
"instead",
"of",
"regular",
"input",
"events"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/MonocleDnDClipboard.java#L51-L56 |
3,328 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchPipeline.java | TouchPipeline.add | void add(TouchPipeline pipeline) {
for (int i = 0; i < pipeline.filters.size(); i++) {
addFilter(pipeline.filters.get(i));
}
} | java | void add(TouchPipeline pipeline) {
for (int i = 0; i < pipeline.filters.size(); i++) {
addFilter(pipeline.filters.get(i));
}
} | [
"void",
"add",
"(",
"TouchPipeline",
"pipeline",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pipeline",
".",
"filters",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"addFilter",
"(",
"pipeline",
".",
"filters",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}"
] | Adds the filters in the given pipeline to this pipeline | [
"Adds",
"the",
"filters",
"in",
"the",
"given",
"pipeline",
"to",
"this",
"pipeline"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchPipeline.java#L39-L43 |
3,329 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchPipeline.java | TouchPipeline.addNamedFilters | void addNamedFilters(String filterNameList) {
String[] touchFilterNames = filterNameList.split(",");
if (touchFilterNames != null) {
for (String touchFilterName : touchFilterNames) {
String s = touchFilterName.trim();
if (s.length() > 0) {
addNamedFilter(s);
}
}
}
} | java | void addNamedFilters(String filterNameList) {
String[] touchFilterNames = filterNameList.split(",");
if (touchFilterNames != null) {
for (String touchFilterName : touchFilterNames) {
String s = touchFilterName.trim();
if (s.length() > 0) {
addNamedFilter(s);
}
}
}
} | [
"void",
"addNamedFilters",
"(",
"String",
"filterNameList",
")",
"{",
"String",
"[",
"]",
"touchFilterNames",
"=",
"filterNameList",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
"(",
"touchFilterNames",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"touchFilterName",
":",
"touchFilterNames",
")",
"{",
"String",
"s",
"=",
"touchFilterName",
".",
"trim",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"addNamedFilter",
"(",
"s",
")",
";",
"}",
"}",
"}",
"}"
] | Attempts to add the filters named in the comma-separated list provided. | [
"Attempts",
"to",
"add",
"the",
"filters",
"named",
"in",
"the",
"comma",
"-",
"separated",
"list",
"provided",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchPipeline.java#L48-L58 |
3,330 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchPipeline.java | TouchPipeline.flush | void flush() {
for (int i = 0; i < filters.size(); i++) {
TouchFilter filter = filters.get(i);
while (filter.flush(flushState)) {
if (MonocleSettings.settings.traceEventsVerbose) {
MonocleTrace.traceEvent("Flushing %s from %s", flushState, filter);
}
boolean consumed = false;
for (int j = i + 1; j < filters.size() && !consumed; j++) {
consumed = filters.get(j).filter(flushState);
}
if (!consumed) {
touch.setState(flushState);
}
}
}
} | java | void flush() {
for (int i = 0; i < filters.size(); i++) {
TouchFilter filter = filters.get(i);
while (filter.flush(flushState)) {
if (MonocleSettings.settings.traceEventsVerbose) {
MonocleTrace.traceEvent("Flushing %s from %s", flushState, filter);
}
boolean consumed = false;
for (int j = i + 1; j < filters.size() && !consumed; j++) {
consumed = filters.get(j).filter(flushState);
}
if (!consumed) {
touch.setState(flushState);
}
}
}
} | [
"void",
"flush",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"filters",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"TouchFilter",
"filter",
"=",
"filters",
".",
"get",
"(",
"i",
")",
";",
"while",
"(",
"filter",
".",
"flush",
"(",
"flushState",
")",
")",
"{",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"traceEventsVerbose",
")",
"{",
"MonocleTrace",
".",
"traceEvent",
"(",
"\"Flushing %s from %s\"",
",",
"flushState",
",",
"filter",
")",
";",
"}",
"boolean",
"consumed",
"=",
"false",
";",
"for",
"(",
"int",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<",
"filters",
".",
"size",
"(",
")",
"&&",
"!",
"consumed",
";",
"j",
"++",
")",
"{",
"consumed",
"=",
"filters",
".",
"get",
"(",
"j",
")",
".",
"filter",
"(",
"flushState",
")",
";",
"}",
"if",
"(",
"!",
"consumed",
")",
"{",
"touch",
".",
"setState",
"(",
"flushState",
")",
";",
"}",
"}",
"}",
"}"
] | Flushes any remaining data in the pipeline, possibly pushing more
state objects to TouchInput. | [
"Flushes",
"any",
"remaining",
"data",
"in",
"the",
"pipeline",
"possibly",
"pushing",
"more",
"state",
"objects",
"to",
"TouchInput",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchPipeline.java#L124-L140 |
3,331 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/NativePlatformFactory.java | NativePlatformFactory.getNativePlatform | public static synchronized NativePlatform getNativePlatform() {
if (platform == null) {
String platformFactoryProperty =
AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("monocle.platform",
"MX6,OMAP,Dispman,Android,X11,Linux,Headless"));
String[] platformFactories = platformFactoryProperty.split(",");
for (int i = 0; i < platformFactories.length; i++) {
String factoryName = platformFactories[i].trim();
String factoryClassName;
if (factoryName.contains(".")) {
factoryClassName = factoryName;
} else {
factoryClassName = "com.sun.glass.ui.monocle."
+ factoryName + "PlatformFactory";
}
if (MonocleSettings.settings.tracePlatformConfig) {
MonocleTrace.traceConfig("Trying platform %s with class %s",
factoryName, factoryClassName);
}
try {
final ClassLoader loader = NativePlatformFactory.class.getClassLoader();
final Class<?> clazz = Class.forName(factoryClassName, false, loader);
if (!NativePlatformFactory.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException("Unrecognized Monocle platform: "
+ factoryClassName);
}
NativePlatformFactory npf = (NativePlatformFactory) clazz.newInstance();
if (npf.matches() &&
npf.getMajorVersion() == majorVersion &&
npf.getMinorVersion() == minorVersion) {
platform = npf.createNativePlatform();
if (MonocleSettings.settings.tracePlatformConfig) {
MonocleTrace.traceConfig("Matched %s", factoryName);
}
return platform;
}
} catch (Exception e) {
if (MonocleSettings.settings.tracePlatformConfig) {
MonocleTrace.traceConfig("Failed to create platform %s",
factoryClassName);
}
e.printStackTrace();
}
}
throw new UnsupportedOperationException(
"Cannot load a native platform from: '"
+ platformFactoryProperty + "'");
}
return platform;
} | java | public static synchronized NativePlatform getNativePlatform() {
if (platform == null) {
String platformFactoryProperty =
AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("monocle.platform",
"MX6,OMAP,Dispman,Android,X11,Linux,Headless"));
String[] platformFactories = platformFactoryProperty.split(",");
for (int i = 0; i < platformFactories.length; i++) {
String factoryName = platformFactories[i].trim();
String factoryClassName;
if (factoryName.contains(".")) {
factoryClassName = factoryName;
} else {
factoryClassName = "com.sun.glass.ui.monocle."
+ factoryName + "PlatformFactory";
}
if (MonocleSettings.settings.tracePlatformConfig) {
MonocleTrace.traceConfig("Trying platform %s with class %s",
factoryName, factoryClassName);
}
try {
final ClassLoader loader = NativePlatformFactory.class.getClassLoader();
final Class<?> clazz = Class.forName(factoryClassName, false, loader);
if (!NativePlatformFactory.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException("Unrecognized Monocle platform: "
+ factoryClassName);
}
NativePlatformFactory npf = (NativePlatformFactory) clazz.newInstance();
if (npf.matches() &&
npf.getMajorVersion() == majorVersion &&
npf.getMinorVersion() == minorVersion) {
platform = npf.createNativePlatform();
if (MonocleSettings.settings.tracePlatformConfig) {
MonocleTrace.traceConfig("Matched %s", factoryName);
}
return platform;
}
} catch (Exception e) {
if (MonocleSettings.settings.tracePlatformConfig) {
MonocleTrace.traceConfig("Failed to create platform %s",
factoryClassName);
}
e.printStackTrace();
}
}
throw new UnsupportedOperationException(
"Cannot load a native platform from: '"
+ platformFactoryProperty + "'");
}
return platform;
} | [
"public",
"static",
"synchronized",
"NativePlatform",
"getNativePlatform",
"(",
")",
"{",
"if",
"(",
"platform",
"==",
"null",
")",
"{",
"String",
"platformFactoryProperty",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"(",
"PrivilegedAction",
"<",
"String",
">",
")",
"(",
")",
"->",
"System",
".",
"getProperty",
"(",
"\"monocle.platform\"",
",",
"\"MX6,OMAP,Dispman,Android,X11,Linux,Headless\"",
")",
")",
";",
"String",
"[",
"]",
"platformFactories",
"=",
"platformFactoryProperty",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"platformFactories",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"factoryName",
"=",
"platformFactories",
"[",
"i",
"]",
".",
"trim",
"(",
")",
";",
"String",
"factoryClassName",
";",
"if",
"(",
"factoryName",
".",
"contains",
"(",
"\".\"",
")",
")",
"{",
"factoryClassName",
"=",
"factoryName",
";",
"}",
"else",
"{",
"factoryClassName",
"=",
"\"com.sun.glass.ui.monocle.\"",
"+",
"factoryName",
"+",
"\"PlatformFactory\"",
";",
"}",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"tracePlatformConfig",
")",
"{",
"MonocleTrace",
".",
"traceConfig",
"(",
"\"Trying platform %s with class %s\"",
",",
"factoryName",
",",
"factoryClassName",
")",
";",
"}",
"try",
"{",
"final",
"ClassLoader",
"loader",
"=",
"NativePlatformFactory",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"factoryClassName",
",",
"false",
",",
"loader",
")",
";",
"if",
"(",
"!",
"NativePlatformFactory",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unrecognized Monocle platform: \"",
"+",
"factoryClassName",
")",
";",
"}",
"NativePlatformFactory",
"npf",
"=",
"(",
"NativePlatformFactory",
")",
"clazz",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"npf",
".",
"matches",
"(",
")",
"&&",
"npf",
".",
"getMajorVersion",
"(",
")",
"==",
"majorVersion",
"&&",
"npf",
".",
"getMinorVersion",
"(",
")",
"==",
"minorVersion",
")",
"{",
"platform",
"=",
"npf",
".",
"createNativePlatform",
"(",
")",
";",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"tracePlatformConfig",
")",
"{",
"MonocleTrace",
".",
"traceConfig",
"(",
"\"Matched %s\"",
",",
"factoryName",
")",
";",
"}",
"return",
"platform",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"tracePlatformConfig",
")",
"{",
"MonocleTrace",
".",
"traceConfig",
"(",
"\"Failed to create platform %s\"",
",",
"factoryClassName",
")",
";",
"}",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot load a native platform from: '\"",
"+",
"platformFactoryProperty",
"+",
"\"'\"",
")",
";",
"}",
"return",
"platform",
";",
"}"
] | Obtains a NativePlatform that matches the platform on which we are running.
The system property monocle.platform defines a series of cascading
fallbacks for what NativePlatform types to attempt to create. monocle
.platform can be overridden to select a specific platform. For
example, running with -Dmonocle.platform=Dispman,
Linux selects the NativePlatform that works with the dispmanx
libraries on the Raspberry Pi, but falls back to a generic
software-rendered Linux framebuffer implementation if we are not
running on a device with dispmanx libraries.
@return a new NativePlatform | [
"Obtains",
"a",
"NativePlatform",
"that",
"matches",
"the",
"platform",
"on",
"which",
"we",
"are",
"running",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/NativePlatformFactory.java#L82-L131 |
3,332 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/Udev.java | Udev.getInstance | static synchronized Udev getInstance() {
if (instance == null) {
try {
instance = new Udev();
} catch (IOException e) {
System.err.println("Udev: failed to open connection");
e.printStackTrace();
}
}
return instance;
} | java | static synchronized Udev getInstance() {
if (instance == null) {
try {
instance = new Udev();
} catch (IOException e) {
System.err.println("Udev: failed to open connection");
e.printStackTrace();
}
}
return instance;
} | [
"static",
"synchronized",
"Udev",
"getInstance",
"(",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"try",
"{",
"instance",
"=",
"new",
"Udev",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Udev: failed to open connection\"",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"return",
"instance",
";",
"}"
] | Gets the singleton Udev object | [
"Gets",
"the",
"singleton",
"Udev",
"object"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/Udev.java#L48-L58 |
3,333 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/Udev.java | Udev.readEvent | private Map<String, String> readEvent() throws IOException {
Map<String, String> map = new HashMap<>();
ByteBuffer b;
synchronized (this) {
b = buffer;
if (b == null) {
return map;
}
}
int length = _readEvent(fd, b);
synchronized (this) {
if (buffer == null) {
return map;
}
int propertiesOffset = _getPropertiesOffset(buffer);
int propertiesLength = _getPropertiesLength(buffer);
int propertiesEnd = propertiesOffset + propertiesLength;
if (length < propertiesEnd) {
throw new IOException("Mismatched property segment length");
}
buffer.position(propertiesOffset);
// Data read from the udev monitor is in the form of a list of
// lines separated by null bytes.
// Each line defines a key/value pair, with the
// format: <key>=<value><null terminator>
StringBuffer key = new StringBuffer();
StringBuffer value = new StringBuffer();
nextKey: while (buffer.position() < propertiesEnd) {
key.setLength(0);
value.setLength(0);
boolean readKey = false;
while (buffer.position() < length && !readKey) {
char ch = (char) buffer.get();
switch (ch) {
case '\000': // no value on this line
map.put(key.toString(), "");
continue nextKey;
case '=':
readKey = true;
break;
default:
key.append(ch);
}
}
while (buffer.position() < propertiesEnd) {
char ch = (char) buffer.get();
switch (ch) {
case '\000':
map.put(key.toString(), value.toString());
continue nextKey;
default:
value.append(ch);
}
}
}
buffer.clear();
}
return map;
} | java | private Map<String, String> readEvent() throws IOException {
Map<String, String> map = new HashMap<>();
ByteBuffer b;
synchronized (this) {
b = buffer;
if (b == null) {
return map;
}
}
int length = _readEvent(fd, b);
synchronized (this) {
if (buffer == null) {
return map;
}
int propertiesOffset = _getPropertiesOffset(buffer);
int propertiesLength = _getPropertiesLength(buffer);
int propertiesEnd = propertiesOffset + propertiesLength;
if (length < propertiesEnd) {
throw new IOException("Mismatched property segment length");
}
buffer.position(propertiesOffset);
// Data read from the udev monitor is in the form of a list of
// lines separated by null bytes.
// Each line defines a key/value pair, with the
// format: <key>=<value><null terminator>
StringBuffer key = new StringBuffer();
StringBuffer value = new StringBuffer();
nextKey: while (buffer.position() < propertiesEnd) {
key.setLength(0);
value.setLength(0);
boolean readKey = false;
while (buffer.position() < length && !readKey) {
char ch = (char) buffer.get();
switch (ch) {
case '\000': // no value on this line
map.put(key.toString(), "");
continue nextKey;
case '=':
readKey = true;
break;
default:
key.append(ch);
}
}
while (buffer.position() < propertiesEnd) {
char ch = (char) buffer.get();
switch (ch) {
case '\000':
map.put(key.toString(), value.toString());
continue nextKey;
default:
value.append(ch);
}
}
}
buffer.clear();
}
return map;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"readEvent",
"(",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"ByteBuffer",
"b",
";",
"synchronized",
"(",
"this",
")",
"{",
"b",
"=",
"buffer",
";",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"return",
"map",
";",
"}",
"}",
"int",
"length",
"=",
"_readEvent",
"(",
"fd",
",",
"b",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
"map",
";",
"}",
"int",
"propertiesOffset",
"=",
"_getPropertiesOffset",
"(",
"buffer",
")",
";",
"int",
"propertiesLength",
"=",
"_getPropertiesLength",
"(",
"buffer",
")",
";",
"int",
"propertiesEnd",
"=",
"propertiesOffset",
"+",
"propertiesLength",
";",
"if",
"(",
"length",
"<",
"propertiesEnd",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Mismatched property segment length\"",
")",
";",
"}",
"buffer",
".",
"position",
"(",
"propertiesOffset",
")",
";",
"// Data read from the udev monitor is in the form of a list of",
"// lines separated by null bytes.",
"// Each line defines a key/value pair, with the",
"// format: <key>=<value><null terminator>",
"StringBuffer",
"key",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"StringBuffer",
"value",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"nextKey",
":",
"while",
"(",
"buffer",
".",
"position",
"(",
")",
"<",
"propertiesEnd",
")",
"{",
"key",
".",
"setLength",
"(",
"0",
")",
";",
"value",
".",
"setLength",
"(",
"0",
")",
";",
"boolean",
"readKey",
"=",
"false",
";",
"while",
"(",
"buffer",
".",
"position",
"(",
")",
"<",
"length",
"&&",
"!",
"readKey",
")",
"{",
"char",
"ch",
"=",
"(",
"char",
")",
"buffer",
".",
"get",
"(",
")",
";",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"'",
":",
"// no value on this line",
"map",
".",
"put",
"(",
"key",
".",
"toString",
"(",
")",
",",
"\"\"",
")",
";",
"continue",
"nextKey",
";",
"case",
"'",
"'",
":",
"readKey",
"=",
"true",
";",
"break",
";",
"default",
":",
"key",
".",
"append",
"(",
"ch",
")",
";",
"}",
"}",
"while",
"(",
"buffer",
".",
"position",
"(",
")",
"<",
"propertiesEnd",
")",
"{",
"char",
"ch",
"=",
"(",
"char",
")",
"buffer",
".",
"get",
"(",
")",
";",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"'",
":",
"map",
".",
"put",
"(",
"key",
".",
"toString",
"(",
")",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"continue",
"nextKey",
";",
"default",
":",
"value",
".",
"append",
"(",
"ch",
")",
";",
"}",
"}",
"}",
"buffer",
".",
"clear",
"(",
")",
";",
"}",
"return",
"map",
";",
"}"
] | Reads data from the udev monitor. Blocks until data is available | [
"Reads",
"data",
"from",
"the",
"udev",
"monitor",
".",
"Blocks",
"until",
"data",
"is",
"available"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/Udev.java#L136-L194 |
3,334 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/Udev.java | Udev.close | synchronized void close() {
thread.interrupt();
_close(fd);
fd = 0l;
buffer = null;
thread = null;
} | java | synchronized void close() {
thread.interrupt();
_close(fd);
fd = 0l;
buffer = null;
thread = null;
} | [
"synchronized",
"void",
"close",
"(",
")",
"{",
"thread",
".",
"interrupt",
"(",
")",
";",
"_close",
"(",
"fd",
")",
";",
"fd",
"=",
"0l",
";",
"buffer",
"=",
"null",
";",
"thread",
"=",
"null",
";",
"}"
] | Closes the udev monitor connection | [
"Closes",
"the",
"udev",
"monitor",
"connection"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/Udev.java#L197-L203 |
3,335 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxEventBuffer.java | LinuxEventBuffer.put | synchronized boolean put(ByteBuffer event) throws
InterruptedException {
boolean isSync = event.getInt(eventStruct.getTypeIndex()) == 0
&& event.getInt(eventStruct.getValueIndex()) == 0;
while (bb.limit() - bb.position() < event.limit()) {
// Block if bb is full. This should be the
// only time this thread waits for anything
// except for more event lines.
if (MonocleSettings.settings.traceEventsVerbose) {
MonocleTrace.traceEvent(
"Event buffer %s is full, waiting for some space to become available",
bb);
// wait for half the space to be available, to avoid excessive context switching?
}
wait();
}
if (isSync) {
positionOfLastSync = bb.position();
}
bb.put(event);
if (MonocleSettings.settings.traceEventsVerbose) {
int index = bb.position() - eventStruct.getSize();
MonocleTrace.traceEvent("Read %s [index=%d]",
getEventDescription(index), index);
}
return isSync;
} | java | synchronized boolean put(ByteBuffer event) throws
InterruptedException {
boolean isSync = event.getInt(eventStruct.getTypeIndex()) == 0
&& event.getInt(eventStruct.getValueIndex()) == 0;
while (bb.limit() - bb.position() < event.limit()) {
// Block if bb is full. This should be the
// only time this thread waits for anything
// except for more event lines.
if (MonocleSettings.settings.traceEventsVerbose) {
MonocleTrace.traceEvent(
"Event buffer %s is full, waiting for some space to become available",
bb);
// wait for half the space to be available, to avoid excessive context switching?
}
wait();
}
if (isSync) {
positionOfLastSync = bb.position();
}
bb.put(event);
if (MonocleSettings.settings.traceEventsVerbose) {
int index = bb.position() - eventStruct.getSize();
MonocleTrace.traceEvent("Read %s [index=%d]",
getEventDescription(index), index);
}
return isSync;
} | [
"synchronized",
"boolean",
"put",
"(",
"ByteBuffer",
"event",
")",
"throws",
"InterruptedException",
"{",
"boolean",
"isSync",
"=",
"event",
".",
"getInt",
"(",
"eventStruct",
".",
"getTypeIndex",
"(",
")",
")",
"==",
"0",
"&&",
"event",
".",
"getInt",
"(",
"eventStruct",
".",
"getValueIndex",
"(",
")",
")",
"==",
"0",
";",
"while",
"(",
"bb",
".",
"limit",
"(",
")",
"-",
"bb",
".",
"position",
"(",
")",
"<",
"event",
".",
"limit",
"(",
")",
")",
"{",
"// Block if bb is full. This should be the",
"// only time this thread waits for anything",
"// except for more event lines.",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"traceEventsVerbose",
")",
"{",
"MonocleTrace",
".",
"traceEvent",
"(",
"\"Event buffer %s is full, waiting for some space to become available\"",
",",
"bb",
")",
";",
"// wait for half the space to be available, to avoid excessive context switching?",
"}",
"wait",
"(",
")",
";",
"}",
"if",
"(",
"isSync",
")",
"{",
"positionOfLastSync",
"=",
"bb",
".",
"position",
"(",
")",
";",
"}",
"bb",
".",
"put",
"(",
"event",
")",
";",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"traceEventsVerbose",
")",
"{",
"int",
"index",
"=",
"bb",
".",
"position",
"(",
")",
"-",
"eventStruct",
".",
"getSize",
"(",
")",
";",
"MonocleTrace",
".",
"traceEvent",
"(",
"\"Read %s [index=%d]\"",
",",
"getEventDescription",
"(",
"index",
")",
",",
"index",
")",
";",
"}",
"return",
"isSync",
";",
"}"
] | Adds a raw Linux event to the buffer. Blocks if the buffer is full.
Checks whether this is a SYN SYN_REPORT event terminator.
@param event A ByteBuffer containing the event to be added.
@return true if the event was "SYN SYN_REPORT", false otherwise
@throws InterruptedException if our thread was interrupted while waiting
for the buffer to empty. | [
"Adds",
"a",
"raw",
"Linux",
"event",
"to",
"the",
"buffer",
".",
"Blocks",
"if",
"the",
"buffer",
"is",
"full",
".",
"Checks",
"whether",
"this",
"is",
"a",
"SYN",
"SYN_REPORT",
"event",
"terminator",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxEventBuffer.java#L91-L117 |
3,336 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxEventBuffer.java | LinuxEventBuffer.nextEvent | synchronized void nextEvent() {
if (currentPosition > positionOfLastSync) {
throw new IllegalStateException("Cannot advance past the last" +
" EV_SYN EV_SYN_REPORT 0");
}
currentPosition += eventStruct.getSize();
if (MonocleSettings.settings.traceEventsVerbose && hasNextEvent()) {
MonocleTrace.traceEvent("Processing %s [index=%d]",
getEventDescription(), currentPosition);
}
} | java | synchronized void nextEvent() {
if (currentPosition > positionOfLastSync) {
throw new IllegalStateException("Cannot advance past the last" +
" EV_SYN EV_SYN_REPORT 0");
}
currentPosition += eventStruct.getSize();
if (MonocleSettings.settings.traceEventsVerbose && hasNextEvent()) {
MonocleTrace.traceEvent("Processing %s [index=%d]",
getEventDescription(), currentPosition);
}
} | [
"synchronized",
"void",
"nextEvent",
"(",
")",
"{",
"if",
"(",
"currentPosition",
">",
"positionOfLastSync",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot advance past the last\"",
"+",
"\" EV_SYN EV_SYN_REPORT 0\"",
")",
";",
"}",
"currentPosition",
"+=",
"eventStruct",
".",
"getSize",
"(",
")",
";",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"traceEventsVerbose",
"&&",
"hasNextEvent",
"(",
")",
")",
"{",
"MonocleTrace",
".",
"traceEvent",
"(",
"\"Processing %s [index=%d]\"",
",",
"getEventDescription",
"(",
")",
",",
"currentPosition",
")",
";",
"}",
"}"
] | Advances to the next event line. Call from the application thread. | [
"Advances",
"to",
"the",
"next",
"event",
"line",
".",
"Call",
"from",
"the",
"application",
"thread",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxEventBuffer.java#L191-L201 |
3,337 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxInput.java | LinuxInput.typeToString | static String typeToString(short type) {
for (Field field : LinuxInput.class.getDeclaredFields()) {
try {
if (field.getName().startsWith("EV_")
&& field.getType() == Short.TYPE
&& field.getShort(null) == type) {
return field.getName();
}
} catch (IllegalAccessException e) {
}
}
return new Formatter().format("0x%04x", type & 0xffff).out().toString();
} | java | static String typeToString(short type) {
for (Field field : LinuxInput.class.getDeclaredFields()) {
try {
if (field.getName().startsWith("EV_")
&& field.getType() == Short.TYPE
&& field.getShort(null) == type) {
return field.getName();
}
} catch (IllegalAccessException e) {
}
}
return new Formatter().format("0x%04x", type & 0xffff).out().toString();
} | [
"static",
"String",
"typeToString",
"(",
"short",
"type",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"LinuxInput",
".",
"class",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"field",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"EV_\"",
")",
"&&",
"field",
".",
"getType",
"(",
")",
"==",
"Short",
".",
"TYPE",
"&&",
"field",
".",
"getShort",
"(",
"null",
")",
"==",
"type",
")",
"{",
"return",
"field",
".",
"getName",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"}",
"}",
"return",
"new",
"Formatter",
"(",
")",
".",
"format",
"(",
"\"0x%04x\"",
",",
"type",
"&",
"0xffff",
")",
".",
"out",
"(",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Convert an event type to its equivalent string. This method is
inefficient and is for debugging use only. | [
"Convert",
"an",
"event",
"type",
"to",
"its",
"equivalent",
"string",
".",
"This",
"method",
"is",
"inefficient",
"and",
"is",
"for",
"debugging",
"use",
"only",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxInput.java#L738-L750 |
3,338 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxInput.java | LinuxInput.codeToString | static String codeToString(String type, short code) {
int i = type.indexOf("_");
if (i >= 0) {
String prefix = type.substring(i + 1);
String altPrefix = prefix.equals("KEY") ? "BTN" : prefix;
for (Field field : LinuxInput.class.getDeclaredFields()) {
String name = field.getName();
try {
if ((name.startsWith(prefix) || name.startsWith(altPrefix))
&& field.getType() == Short.TYPE
&& field.getShort(null) == code) {
return field.getName();
}
} catch (IllegalAccessException e) {
}
}
}
return new Formatter().format("0x%04x", code & 0xffff).out().toString();
} | java | static String codeToString(String type, short code) {
int i = type.indexOf("_");
if (i >= 0) {
String prefix = type.substring(i + 1);
String altPrefix = prefix.equals("KEY") ? "BTN" : prefix;
for (Field field : LinuxInput.class.getDeclaredFields()) {
String name = field.getName();
try {
if ((name.startsWith(prefix) || name.startsWith(altPrefix))
&& field.getType() == Short.TYPE
&& field.getShort(null) == code) {
return field.getName();
}
} catch (IllegalAccessException e) {
}
}
}
return new Formatter().format("0x%04x", code & 0xffff).out().toString();
} | [
"static",
"String",
"codeToString",
"(",
"String",
"type",
",",
"short",
"code",
")",
"{",
"int",
"i",
"=",
"type",
".",
"indexOf",
"(",
"\"_\"",
")",
";",
"if",
"(",
"i",
">=",
"0",
")",
"{",
"String",
"prefix",
"=",
"type",
".",
"substring",
"(",
"i",
"+",
"1",
")",
";",
"String",
"altPrefix",
"=",
"prefix",
".",
"equals",
"(",
"\"KEY\"",
")",
"?",
"\"BTN\"",
":",
"prefix",
";",
"for",
"(",
"Field",
"field",
":",
"LinuxInput",
".",
"class",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"String",
"name",
"=",
"field",
".",
"getName",
"(",
")",
";",
"try",
"{",
"if",
"(",
"(",
"name",
".",
"startsWith",
"(",
"prefix",
")",
"||",
"name",
".",
"startsWith",
"(",
"altPrefix",
")",
")",
"&&",
"field",
".",
"getType",
"(",
")",
"==",
"Short",
".",
"TYPE",
"&&",
"field",
".",
"getShort",
"(",
"null",
")",
"==",
"code",
")",
"{",
"return",
"field",
".",
"getName",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"new",
"Formatter",
"(",
")",
".",
"format",
"(",
"\"0x%04x\"",
",",
"code",
"&",
"0xffff",
")",
".",
"out",
"(",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Convert an event code to its equivalent string, given its type string.
The type string is needed because event codes are context sensitive. For
example, the code 1 is "SYN_CONFIG" for an EV_SYN event but "KEY_ESC" for
an EV_KEY event. This method is inefficient and is for debugging use
only. | [
"Convert",
"an",
"event",
"code",
"to",
"its",
"equivalent",
"string",
"given",
"its",
"type",
"string",
".",
"The",
"type",
"string",
"is",
"needed",
"because",
"event",
"codes",
"are",
"context",
"sensitive",
".",
"For",
"example",
"the",
"code",
"1",
"is",
"SYN_CONFIG",
"for",
"an",
"EV_SYN",
"event",
"but",
"KEY_ESC",
"for",
"an",
"EV_KEY",
"event",
".",
"This",
"method",
"is",
"inefficient",
"and",
"is",
"for",
"debugging",
"use",
"only",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxInput.java#L759-L777 |
3,339 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/LinuxAbsoluteInputCapabilities.java | LinuxAbsoluteInputCapabilities.getCapabilities | static Map<Integer, LinuxAbsoluteInputCapabilities> getCapabilities(
File devNode, BitSet axes) throws IOException {
if (axes == null || axes.isEmpty()) {
return null;
}
LinuxSystem system = LinuxSystem.getLinuxSystem();
LinuxSystem.InputAbsInfo info = new LinuxSystem.InputAbsInfo();
long fd = system.open(devNode.getPath(), LinuxSystem.O_RDONLY);
if (fd == -1) {
throw new IOException(system.getErrorMessage());
}
Map<Integer, LinuxAbsoluteInputCapabilities> caps =
new HashMap<Integer, LinuxAbsoluteInputCapabilities>();
for (int i = 0; (i = axes.nextSetBit(i)) != -1; i++) {
caps.put(i, new LinuxAbsoluteInputCapabilities(system, info, fd, i));
}
system.close(fd);
return caps;
} | java | static Map<Integer, LinuxAbsoluteInputCapabilities> getCapabilities(
File devNode, BitSet axes) throws IOException {
if (axes == null || axes.isEmpty()) {
return null;
}
LinuxSystem system = LinuxSystem.getLinuxSystem();
LinuxSystem.InputAbsInfo info = new LinuxSystem.InputAbsInfo();
long fd = system.open(devNode.getPath(), LinuxSystem.O_RDONLY);
if (fd == -1) {
throw new IOException(system.getErrorMessage());
}
Map<Integer, LinuxAbsoluteInputCapabilities> caps =
new HashMap<Integer, LinuxAbsoluteInputCapabilities>();
for (int i = 0; (i = axes.nextSetBit(i)) != -1; i++) {
caps.put(i, new LinuxAbsoluteInputCapabilities(system, info, fd, i));
}
system.close(fd);
return caps;
} | [
"static",
"Map",
"<",
"Integer",
",",
"LinuxAbsoluteInputCapabilities",
">",
"getCapabilities",
"(",
"File",
"devNode",
",",
"BitSet",
"axes",
")",
"throws",
"IOException",
"{",
"if",
"(",
"axes",
"==",
"null",
"||",
"axes",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"LinuxSystem",
"system",
"=",
"LinuxSystem",
".",
"getLinuxSystem",
"(",
")",
";",
"LinuxSystem",
".",
"InputAbsInfo",
"info",
"=",
"new",
"LinuxSystem",
".",
"InputAbsInfo",
"(",
")",
";",
"long",
"fd",
"=",
"system",
".",
"open",
"(",
"devNode",
".",
"getPath",
"(",
")",
",",
"LinuxSystem",
".",
"O_RDONLY",
")",
";",
"if",
"(",
"fd",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"IOException",
"(",
"system",
".",
"getErrorMessage",
"(",
")",
")",
";",
"}",
"Map",
"<",
"Integer",
",",
"LinuxAbsoluteInputCapabilities",
">",
"caps",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"LinuxAbsoluteInputCapabilities",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"(",
"i",
"=",
"axes",
".",
"nextSetBit",
"(",
"i",
")",
")",
"!=",
"-",
"1",
";",
"i",
"++",
")",
"{",
"caps",
".",
"put",
"(",
"i",
",",
"new",
"LinuxAbsoluteInputCapabilities",
"(",
"system",
",",
"info",
",",
"fd",
",",
"i",
")",
")",
";",
"}",
"system",
".",
"close",
"(",
"fd",
")",
";",
"return",
"caps",
";",
"}"
] | Reads capabilities from a device node.
@return A Map of capabilities for each supported axis, or null if no
capabilities are available.
@throws IOException if an error occured when reading capabilities | [
"Reads",
"capabilities",
"from",
"a",
"device",
"node",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/LinuxAbsoluteInputCapabilities.java#L73-L91 |
3,340 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/AssignPointIDTouchFilter.java | AssignPointIDTouchFilter.releaseID | private void releaseID(int id) {
ids.removeInt(id);
nextID = 1;
for (int i = 0; i < ids.size(); i++) {
nextID = Math.max(ids.get(i) + 1, nextID);
}
} | java | private void releaseID(int id) {
ids.removeInt(id);
nextID = 1;
for (int i = 0; i < ids.size(); i++) {
nextID = Math.max(ids.get(i) + 1, nextID);
}
} | [
"private",
"void",
"releaseID",
"(",
"int",
"id",
")",
"{",
"ids",
".",
"removeInt",
"(",
"id",
")",
";",
"nextID",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ids",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"nextID",
"=",
"Math",
".",
"max",
"(",
"ids",
".",
"get",
"(",
"i",
")",
"+",
"1",
",",
"nextID",
")",
";",
"}",
"}"
] | Release a touch point ID | [
"Release",
"a",
"touch",
"point",
"ID"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/AssignPointIDTouchFilter.java#L48-L54 |
3,341 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/RunnableProcessor.java | RunnableProcessor.invokeAndWait | void invokeAndWait(final Runnable r) {
final CountDownLatch latch = new CountDownLatch(1);
queue.postRunnable(() -> {
try {
r.run();
} finally {
latch.countDown();
}
});
try {
latch.await();
} catch (InterruptedException e) { }
} | java | void invokeAndWait(final Runnable r) {
final CountDownLatch latch = new CountDownLatch(1);
queue.postRunnable(() -> {
try {
r.run();
} finally {
latch.countDown();
}
});
try {
latch.await();
} catch (InterruptedException e) { }
} | [
"void",
"invokeAndWait",
"(",
"final",
"Runnable",
"r",
")",
"{",
"final",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"queue",
".",
"postRunnable",
"(",
"(",
")",
"->",
"{",
"try",
"{",
"r",
".",
"run",
"(",
")",
";",
"}",
"finally",
"{",
"latch",
".",
"countDown",
"(",
")",
";",
"}",
"}",
")",
";",
"try",
"{",
"latch",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}"
] | Posts a Runnable to the JavaFX event queue and waits for the Runnable
to complete.
@param r an action to be performed on the JavaFX application thread. | [
"Posts",
"a",
"Runnable",
"to",
"the",
"JavaFX",
"event",
"queue",
"and",
"waits",
"for",
"the",
"Runnable",
"to",
"complete",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/RunnableProcessor.java#L69-L81 |
3,342 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/EGL.java | EGL.eglErrorToString | String eglErrorToString(int errorCode) {
if (errorCode >= 0x3000 && errorCode < 0x3020) {
for (Field field : EGL.class.getFields()) {
try {
if (field.getName().startsWith("EGL_")
&& field.getType() == Integer.TYPE
&& field.getInt(null) == errorCode) {
return field.getName();
}
} catch (IllegalAccessException e) {
}
}
}
return new Formatter()
.format("0x%04x", errorCode & 0xffff)
.out()
.toString();
} | java | String eglErrorToString(int errorCode) {
if (errorCode >= 0x3000 && errorCode < 0x3020) {
for (Field field : EGL.class.getFields()) {
try {
if (field.getName().startsWith("EGL_")
&& field.getType() == Integer.TYPE
&& field.getInt(null) == errorCode) {
return field.getName();
}
} catch (IllegalAccessException e) {
}
}
}
return new Formatter()
.format("0x%04x", errorCode & 0xffff)
.out()
.toString();
} | [
"String",
"eglErrorToString",
"(",
"int",
"errorCode",
")",
"{",
"if",
"(",
"errorCode",
">=",
"0x3000",
"&&",
"errorCode",
"<",
"0x3020",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"EGL",
".",
"class",
".",
"getFields",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"field",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"EGL_\"",
")",
"&&",
"field",
".",
"getType",
"(",
")",
"==",
"Integer",
".",
"TYPE",
"&&",
"field",
".",
"getInt",
"(",
"null",
")",
"==",
"errorCode",
")",
"{",
"return",
"field",
".",
"getName",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"new",
"Formatter",
"(",
")",
".",
"format",
"(",
"\"0x%04x\"",
",",
"errorCode",
"&",
"0xffff",
")",
".",
"out",
"(",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Convert an EGL error code such as EGL_BAD_CONTEXT to a string
representation.
@param errorCode the EGL error code
@return the constant name of the error code. If errorCode cannot be
matched to an EGL error, a string representation of the error code's
value is returned. | [
"Convert",
"an",
"EGL",
"error",
"code",
"such",
"as",
"EGL_BAD_CONTEXT",
"to",
"a",
"string",
"representation",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/EGL.java#L245-L262 |
3,343 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchInput.java | TouchInput.getBasePipeline | TouchPipeline getBasePipeline() {
if (basePipeline == null) {
basePipeline = new TouchPipeline();
String[] touchFilterNames = AccessController.doPrivileged(
(PrivilegedAction<String>) () -> System.getProperty(
"monocle.input.touchFilters",
"SmallMove")
).split(",");
if (touchFilterNames != null) {
for (String touchFilterName : touchFilterNames) {
basePipeline.addNamedFilter(touchFilterName.trim());
}
}
}
return basePipeline;
} | java | TouchPipeline getBasePipeline() {
if (basePipeline == null) {
basePipeline = new TouchPipeline();
String[] touchFilterNames = AccessController.doPrivileged(
(PrivilegedAction<String>) () -> System.getProperty(
"monocle.input.touchFilters",
"SmallMove")
).split(",");
if (touchFilterNames != null) {
for (String touchFilterName : touchFilterNames) {
basePipeline.addNamedFilter(touchFilterName.trim());
}
}
}
return basePipeline;
} | [
"TouchPipeline",
"getBasePipeline",
"(",
")",
"{",
"if",
"(",
"basePipeline",
"==",
"null",
")",
"{",
"basePipeline",
"=",
"new",
"TouchPipeline",
"(",
")",
";",
"String",
"[",
"]",
"touchFilterNames",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"(",
"PrivilegedAction",
"<",
"String",
">",
")",
"(",
")",
"->",
"System",
".",
"getProperty",
"(",
"\"monocle.input.touchFilters\"",
",",
"\"SmallMove\"",
")",
")",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
"(",
"touchFilterNames",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"touchFilterName",
":",
"touchFilterNames",
")",
"{",
"basePipeline",
".",
"addNamedFilter",
"(",
"touchFilterName",
".",
"trim",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"basePipeline",
";",
"}"
] | Gets the base touch filter pipeline common to all touch devices | [
"Gets",
"the",
"base",
"touch",
"filter",
"pipeline",
"common",
"to",
"all",
"touch",
"devices"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchInput.java#L70-L85 |
3,344 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchInput.java | TouchInput.setState | void setState(TouchState newState) {
if (MonocleSettings.settings.traceEvents) {
MonocleTrace.traceEvent("Set %s", newState);
}
newState.sortPointsByID();
newState.assignPrimaryID();
// Get the cached window for the old state and compute the window for
// the new state
MonocleWindow oldWindow = state.getWindow(false, null);
boolean recalculateWindow = state.getPointCount() == 0;
MonocleWindow window = newState.getWindow(recalculateWindow, oldWindow);
View oldView = oldWindow == null ? null : oldWindow.getView();
View view = window == null ? null : window.getView();
if (!newState.equalsSorted(state)) {
// Post touch events
if (view != oldView) {
postTouchEvent(state, TouchEvent.TOUCH_RELEASED);
postTouchEvent(newState,
TouchEvent.TOUCH_PRESSED);
} else if (view != null) {
postTouchEvent(window, view, newState);
}
// Post mouse events
MouseInputSynthesizer.getInstance().setState(newState);
}
newState.copyTo(state);
newState.clearWindow();
} | java | void setState(TouchState newState) {
if (MonocleSettings.settings.traceEvents) {
MonocleTrace.traceEvent("Set %s", newState);
}
newState.sortPointsByID();
newState.assignPrimaryID();
// Get the cached window for the old state and compute the window for
// the new state
MonocleWindow oldWindow = state.getWindow(false, null);
boolean recalculateWindow = state.getPointCount() == 0;
MonocleWindow window = newState.getWindow(recalculateWindow, oldWindow);
View oldView = oldWindow == null ? null : oldWindow.getView();
View view = window == null ? null : window.getView();
if (!newState.equalsSorted(state)) {
// Post touch events
if (view != oldView) {
postTouchEvent(state, TouchEvent.TOUCH_RELEASED);
postTouchEvent(newState,
TouchEvent.TOUCH_PRESSED);
} else if (view != null) {
postTouchEvent(window, view, newState);
}
// Post mouse events
MouseInputSynthesizer.getInstance().setState(newState);
}
newState.copyTo(state);
newState.clearWindow();
} | [
"void",
"setState",
"(",
"TouchState",
"newState",
")",
"{",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"traceEvents",
")",
"{",
"MonocleTrace",
".",
"traceEvent",
"(",
"\"Set %s\"",
",",
"newState",
")",
";",
"}",
"newState",
".",
"sortPointsByID",
"(",
")",
";",
"newState",
".",
"assignPrimaryID",
"(",
")",
";",
"// Get the cached window for the old state and compute the window for",
"// the new state",
"MonocleWindow",
"oldWindow",
"=",
"state",
".",
"getWindow",
"(",
"false",
",",
"null",
")",
";",
"boolean",
"recalculateWindow",
"=",
"state",
".",
"getPointCount",
"(",
")",
"==",
"0",
";",
"MonocleWindow",
"window",
"=",
"newState",
".",
"getWindow",
"(",
"recalculateWindow",
",",
"oldWindow",
")",
";",
"View",
"oldView",
"=",
"oldWindow",
"==",
"null",
"?",
"null",
":",
"oldWindow",
".",
"getView",
"(",
")",
";",
"View",
"view",
"=",
"window",
"==",
"null",
"?",
"null",
":",
"window",
".",
"getView",
"(",
")",
";",
"if",
"(",
"!",
"newState",
".",
"equalsSorted",
"(",
"state",
")",
")",
"{",
"// Post touch events",
"if",
"(",
"view",
"!=",
"oldView",
")",
"{",
"postTouchEvent",
"(",
"state",
",",
"TouchEvent",
".",
"TOUCH_RELEASED",
")",
";",
"postTouchEvent",
"(",
"newState",
",",
"TouchEvent",
".",
"TOUCH_PRESSED",
")",
";",
"}",
"else",
"if",
"(",
"view",
"!=",
"null",
")",
"{",
"postTouchEvent",
"(",
"window",
",",
"view",
",",
"newState",
")",
";",
"}",
"// Post mouse events",
"MouseInputSynthesizer",
".",
"getInstance",
"(",
")",
".",
"setState",
"(",
"newState",
")",
";",
"}",
"newState",
".",
"copyTo",
"(",
"state",
")",
";",
"newState",
".",
"clearWindow",
"(",
")",
";",
"}"
] | Called from the input processor to update the touch state and send
touch and mouse events.
@param newState The updated touch state | [
"Called",
"from",
"the",
"input",
"processor",
"to",
"update",
"the",
"touch",
"state",
"and",
"send",
"touch",
"and",
"mouse",
"events",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchInput.java#L100-L127 |
3,345 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchInput.java | TouchInput.postTouchEvent | private void postTouchEvent(TouchState state, int eventType) {
Window window = state.getWindow(false, null);
View view = window == null ? null : window.getView();
if (view != null) {
switch (state.getPointCount()) {
case 0:
postNoPoints(view);
break;
case 1:
postPoint(window, view, eventType, state.getPoint(0));
break;
default: {
int count = state.getPointCount();
int[] states = new int[count];
int[] ids = new int[count];
int[] xs = new int[count];
int[] ys = new int[count];
for (int i = 0; i < count; i++) {
states[i] = eventType;
TouchState.Point p = state.getPoint(i);
ids[i] = p.id;
xs[i] = p.x;
ys[i] = p.y;
}
postPoints(window, view, states, ids, xs, ys);
}
}
}
} | java | private void postTouchEvent(TouchState state, int eventType) {
Window window = state.getWindow(false, null);
View view = window == null ? null : window.getView();
if (view != null) {
switch (state.getPointCount()) {
case 0:
postNoPoints(view);
break;
case 1:
postPoint(window, view, eventType, state.getPoint(0));
break;
default: {
int count = state.getPointCount();
int[] states = new int[count];
int[] ids = new int[count];
int[] xs = new int[count];
int[] ys = new int[count];
for (int i = 0; i < count; i++) {
states[i] = eventType;
TouchState.Point p = state.getPoint(i);
ids[i] = p.id;
xs[i] = p.x;
ys[i] = p.y;
}
postPoints(window, view, states, ids, xs, ys);
}
}
}
} | [
"private",
"void",
"postTouchEvent",
"(",
"TouchState",
"state",
",",
"int",
"eventType",
")",
"{",
"Window",
"window",
"=",
"state",
".",
"getWindow",
"(",
"false",
",",
"null",
")",
";",
"View",
"view",
"=",
"window",
"==",
"null",
"?",
"null",
":",
"window",
".",
"getView",
"(",
")",
";",
"if",
"(",
"view",
"!=",
"null",
")",
"{",
"switch",
"(",
"state",
".",
"getPointCount",
"(",
")",
")",
"{",
"case",
"0",
":",
"postNoPoints",
"(",
"view",
")",
";",
"break",
";",
"case",
"1",
":",
"postPoint",
"(",
"window",
",",
"view",
",",
"eventType",
",",
"state",
".",
"getPoint",
"(",
"0",
")",
")",
";",
"break",
";",
"default",
":",
"{",
"int",
"count",
"=",
"state",
".",
"getPointCount",
"(",
")",
";",
"int",
"[",
"]",
"states",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"int",
"[",
"]",
"ids",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"int",
"[",
"]",
"xs",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"int",
"[",
"]",
"ys",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"states",
"[",
"i",
"]",
"=",
"eventType",
";",
"TouchState",
".",
"Point",
"p",
"=",
"state",
".",
"getPoint",
"(",
"i",
")",
";",
"ids",
"[",
"i",
"]",
"=",
"p",
".",
"id",
";",
"xs",
"[",
"i",
"]",
"=",
"p",
".",
"x",
";",
"ys",
"[",
"i",
"]",
"=",
"p",
".",
"y",
";",
"}",
"postPoints",
"(",
"window",
",",
"view",
",",
"states",
",",
"ids",
",",
"xs",
",",
"ys",
")",
";",
"}",
"}",
"}",
"}"
] | Sends the same event type for all points in the given state
@param state The state for which to process all points
@param eventType The type of TouchEvent to send (e.g. TouchEvent.PRESSED) | [
"Sends",
"the",
"same",
"event",
"type",
"for",
"all",
"points",
"in",
"the",
"given",
"state"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchInput.java#L172-L200 |
3,346 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchInput.java | TouchInput.postTouchEvent | private void postTouchEvent(MonocleWindow window,
View view,
TouchState newState) {
int count = countEvents(newState);
switch (count) {
case 0:
postNoPoints(view);
break;
case 1:
if (state.getPointCount() == 1) {
// There is one point and it already existed
TouchState.Point oldPoint = state.getPoint(0);
TouchState.Point newPoint = newState.getPointForID(
oldPoint.id);
if (newPoint != null) {
if (newPoint.x == oldPoint.x
&& newPoint.y == oldPoint.y) {
postPoint(window, view, TouchEvent.TOUCH_STILL, newPoint);
} else {
postPoint(window, view, TouchEvent.TOUCH_MOVED, newPoint);
}
} else {
postPoint(window, view, TouchEvent.TOUCH_RELEASED, oldPoint);
}
} else {
// There is one point and it is newly pressed
postPoint(window, view, TouchEvent.TOUCH_PRESSED, newState.getPoint(0));
}
break;
default: {
int[] states = new int[count];
int[] ids = new int[count];
int[] xs = new int[count];
int[] ys = new int[count];
for (int i = 0; i < state.getPointCount(); i++) {
TouchState.Point oldPoint = state.getPoint(i);
TouchState.Point newPoint = newState.getPointForID(
oldPoint.id);
if (newPoint != null) {
ids[i] = newPoint.id;
xs[i] = newPoint.x;
ys[i] = newPoint.y;
if (newPoint.x == oldPoint.x
&& newPoint.y == oldPoint.y) {
states[i] = TouchEvent.TOUCH_STILL;
} else {
states[i] = TouchEvent.TOUCH_MOVED;
}
} else {
states[i] = TouchEvent.TOUCH_RELEASED;
ids[i] = oldPoint.id;
xs[i] = oldPoint.x;
ys[i] = oldPoint.y;
}
}
// Once we have dealt with updates to old points, all that are left
// are new points.
for (int i = 0, j = state.getPointCount();
i < newState.getPointCount(); i++) {
TouchState.Point newPoint = newState.getPoint(i);
TouchState.Point oldPoint = state.getPointForID(
newPoint.id);
if (oldPoint == null) {
states[j] = TouchEvent.TOUCH_PRESSED;
ids[j] = newPoint.id;
xs[j] = newPoint.x;
ys[j] = newPoint.y;
j++;
}
}
postPoints(window, view, states, ids, xs, ys);
}
}
} | java | private void postTouchEvent(MonocleWindow window,
View view,
TouchState newState) {
int count = countEvents(newState);
switch (count) {
case 0:
postNoPoints(view);
break;
case 1:
if (state.getPointCount() == 1) {
// There is one point and it already existed
TouchState.Point oldPoint = state.getPoint(0);
TouchState.Point newPoint = newState.getPointForID(
oldPoint.id);
if (newPoint != null) {
if (newPoint.x == oldPoint.x
&& newPoint.y == oldPoint.y) {
postPoint(window, view, TouchEvent.TOUCH_STILL, newPoint);
} else {
postPoint(window, view, TouchEvent.TOUCH_MOVED, newPoint);
}
} else {
postPoint(window, view, TouchEvent.TOUCH_RELEASED, oldPoint);
}
} else {
// There is one point and it is newly pressed
postPoint(window, view, TouchEvent.TOUCH_PRESSED, newState.getPoint(0));
}
break;
default: {
int[] states = new int[count];
int[] ids = new int[count];
int[] xs = new int[count];
int[] ys = new int[count];
for (int i = 0; i < state.getPointCount(); i++) {
TouchState.Point oldPoint = state.getPoint(i);
TouchState.Point newPoint = newState.getPointForID(
oldPoint.id);
if (newPoint != null) {
ids[i] = newPoint.id;
xs[i] = newPoint.x;
ys[i] = newPoint.y;
if (newPoint.x == oldPoint.x
&& newPoint.y == oldPoint.y) {
states[i] = TouchEvent.TOUCH_STILL;
} else {
states[i] = TouchEvent.TOUCH_MOVED;
}
} else {
states[i] = TouchEvent.TOUCH_RELEASED;
ids[i] = oldPoint.id;
xs[i] = oldPoint.x;
ys[i] = oldPoint.y;
}
}
// Once we have dealt with updates to old points, all that are left
// are new points.
for (int i = 0, j = state.getPointCount();
i < newState.getPointCount(); i++) {
TouchState.Point newPoint = newState.getPoint(i);
TouchState.Point oldPoint = state.getPointForID(
newPoint.id);
if (oldPoint == null) {
states[j] = TouchEvent.TOUCH_PRESSED;
ids[j] = newPoint.id;
xs[j] = newPoint.x;
ys[j] = newPoint.y;
j++;
}
}
postPoints(window, view, states, ids, xs, ys);
}
}
} | [
"private",
"void",
"postTouchEvent",
"(",
"MonocleWindow",
"window",
",",
"View",
"view",
",",
"TouchState",
"newState",
")",
"{",
"int",
"count",
"=",
"countEvents",
"(",
"newState",
")",
";",
"switch",
"(",
"count",
")",
"{",
"case",
"0",
":",
"postNoPoints",
"(",
"view",
")",
";",
"break",
";",
"case",
"1",
":",
"if",
"(",
"state",
".",
"getPointCount",
"(",
")",
"==",
"1",
")",
"{",
"// There is one point and it already existed",
"TouchState",
".",
"Point",
"oldPoint",
"=",
"state",
".",
"getPoint",
"(",
"0",
")",
";",
"TouchState",
".",
"Point",
"newPoint",
"=",
"newState",
".",
"getPointForID",
"(",
"oldPoint",
".",
"id",
")",
";",
"if",
"(",
"newPoint",
"!=",
"null",
")",
"{",
"if",
"(",
"newPoint",
".",
"x",
"==",
"oldPoint",
".",
"x",
"&&",
"newPoint",
".",
"y",
"==",
"oldPoint",
".",
"y",
")",
"{",
"postPoint",
"(",
"window",
",",
"view",
",",
"TouchEvent",
".",
"TOUCH_STILL",
",",
"newPoint",
")",
";",
"}",
"else",
"{",
"postPoint",
"(",
"window",
",",
"view",
",",
"TouchEvent",
".",
"TOUCH_MOVED",
",",
"newPoint",
")",
";",
"}",
"}",
"else",
"{",
"postPoint",
"(",
"window",
",",
"view",
",",
"TouchEvent",
".",
"TOUCH_RELEASED",
",",
"oldPoint",
")",
";",
"}",
"}",
"else",
"{",
"// There is one point and it is newly pressed",
"postPoint",
"(",
"window",
",",
"view",
",",
"TouchEvent",
".",
"TOUCH_PRESSED",
",",
"newState",
".",
"getPoint",
"(",
"0",
")",
")",
";",
"}",
"break",
";",
"default",
":",
"{",
"int",
"[",
"]",
"states",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"int",
"[",
"]",
"ids",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"int",
"[",
"]",
"xs",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"int",
"[",
"]",
"ys",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"state",
".",
"getPointCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"TouchState",
".",
"Point",
"oldPoint",
"=",
"state",
".",
"getPoint",
"(",
"i",
")",
";",
"TouchState",
".",
"Point",
"newPoint",
"=",
"newState",
".",
"getPointForID",
"(",
"oldPoint",
".",
"id",
")",
";",
"if",
"(",
"newPoint",
"!=",
"null",
")",
"{",
"ids",
"[",
"i",
"]",
"=",
"newPoint",
".",
"id",
";",
"xs",
"[",
"i",
"]",
"=",
"newPoint",
".",
"x",
";",
"ys",
"[",
"i",
"]",
"=",
"newPoint",
".",
"y",
";",
"if",
"(",
"newPoint",
".",
"x",
"==",
"oldPoint",
".",
"x",
"&&",
"newPoint",
".",
"y",
"==",
"oldPoint",
".",
"y",
")",
"{",
"states",
"[",
"i",
"]",
"=",
"TouchEvent",
".",
"TOUCH_STILL",
";",
"}",
"else",
"{",
"states",
"[",
"i",
"]",
"=",
"TouchEvent",
".",
"TOUCH_MOVED",
";",
"}",
"}",
"else",
"{",
"states",
"[",
"i",
"]",
"=",
"TouchEvent",
".",
"TOUCH_RELEASED",
";",
"ids",
"[",
"i",
"]",
"=",
"oldPoint",
".",
"id",
";",
"xs",
"[",
"i",
"]",
"=",
"oldPoint",
".",
"x",
";",
"ys",
"[",
"i",
"]",
"=",
"oldPoint",
".",
"y",
";",
"}",
"}",
"// Once we have dealt with updates to old points, all that are left",
"// are new points.",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"state",
".",
"getPointCount",
"(",
")",
";",
"i",
"<",
"newState",
".",
"getPointCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"TouchState",
".",
"Point",
"newPoint",
"=",
"newState",
".",
"getPoint",
"(",
"i",
")",
";",
"TouchState",
".",
"Point",
"oldPoint",
"=",
"state",
".",
"getPointForID",
"(",
"newPoint",
".",
"id",
")",
";",
"if",
"(",
"oldPoint",
"==",
"null",
")",
"{",
"states",
"[",
"j",
"]",
"=",
"TouchEvent",
".",
"TOUCH_PRESSED",
";",
"ids",
"[",
"j",
"]",
"=",
"newPoint",
".",
"id",
";",
"xs",
"[",
"j",
"]",
"=",
"newPoint",
".",
"x",
";",
"ys",
"[",
"j",
"]",
"=",
"newPoint",
".",
"y",
";",
"j",
"++",
";",
"}",
"}",
"postPoints",
"(",
"window",
",",
"view",
",",
"states",
",",
"ids",
",",
"xs",
",",
"ys",
")",
";",
"}",
"}",
"}"
] | Sends updated touch points within the same View as last processed
touch points.
@param window The current Window
@param view The current View
@param newState The updated touch points | [
"Sends",
"updated",
"touch",
"points",
"within",
"the",
"same",
"View",
"as",
"last",
"processed",
"touch",
"points",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchInput.java#L209-L282 |
3,347 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/MonocleWindow.java | MonocleWindow._createWindow | @Override
protected long _createWindow(long NativeWindow, long NativeScreen,
int mask) {
id = MonocleWindowManager.getInstance().addWindow(this);
return id;
} | java | @Override
protected long _createWindow(long NativeWindow, long NativeScreen,
int mask) {
id = MonocleWindowManager.getInstance().addWindow(this);
return id;
} | [
"@",
"Override",
"protected",
"long",
"_createWindow",
"(",
"long",
"NativeWindow",
",",
"long",
"NativeScreen",
",",
"int",
"mask",
")",
"{",
"id",
"=",
"MonocleWindowManager",
".",
"getInstance",
"(",
")",
".",
"addWindow",
"(",
"this",
")",
";",
"return",
"id",
";",
"}"
] | creates the native window | [
"creates",
"the",
"native",
"window"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/MonocleWindow.java#L163-L168 |
3,348 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/NativePlatform.java | NativePlatform.shutdown | void shutdown() {
runnableProcessor.shutdown();
if (cursor != null) {
cursor.shutdown();
}
if (screen != null) {
screen.shutdown();
}
} | java | void shutdown() {
runnableProcessor.shutdown();
if (cursor != null) {
cursor.shutdown();
}
if (screen != null) {
screen.shutdown();
}
} | [
"void",
"shutdown",
"(",
")",
"{",
"runnableProcessor",
".",
"shutdown",
"(",
")",
";",
"if",
"(",
"cursor",
"!=",
"null",
")",
"{",
"cursor",
".",
"shutdown",
"(",
")",
";",
"}",
"if",
"(",
"screen",
"!=",
"null",
")",
"{",
"screen",
".",
"shutdown",
"(",
")",
";",
"}",
"}"
] | Called once during JavaFX shutdown to release platform resources. | [
"Called",
"once",
"during",
"JavaFX",
"shutdown",
"to",
"release",
"platform",
"resources",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/NativePlatform.java#L44-L52 |
3,349 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/NativePlatform.java | NativePlatform.getAcceleratedScreen | public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes)
throws GLException, UnsatisfiedLinkError {
if (accScreen == null) {
accScreen = new AcceleratedScreen(attributes);
}
return accScreen;
} | java | public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes)
throws GLException, UnsatisfiedLinkError {
if (accScreen == null) {
accScreen = new AcceleratedScreen(attributes);
}
return accScreen;
} | [
"public",
"synchronized",
"AcceleratedScreen",
"getAcceleratedScreen",
"(",
"int",
"[",
"]",
"attributes",
")",
"throws",
"GLException",
",",
"UnsatisfiedLinkError",
"{",
"if",
"(",
"accScreen",
"==",
"null",
")",
"{",
"accScreen",
"=",
"new",
"AcceleratedScreen",
"(",
"attributes",
")",
";",
"}",
"return",
"accScreen",
";",
"}"
] | Gets the AcceleratedScreen for this platform
@param attributes a sequence of pairs (GLAttibute, value)
@return an AcceleratedScreen for rendering using OpenGL
@throws GLException if no OpenGL surface could be created
@throws UnsatisfiedLinkError if native graphics libraries could not be loaded for this platform. | [
"Gets",
"the",
"AcceleratedScreen",
"for",
"this",
"platform"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/NativePlatform.java#L124-L130 |
3,350 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/AndroidPlatform.java | AndroidPlatform.getAcceleratedScreen | @Override
public synchronized AcceleratedScreen getAcceleratedScreen(
int[] attributes) throws GLException {
if (accScreen == null) {
accScreen = new AndroidAcceleratedScreen(attributes);
}
return accScreen;
} | java | @Override
public synchronized AcceleratedScreen getAcceleratedScreen(
int[] attributes) throws GLException {
if (accScreen == null) {
accScreen = new AndroidAcceleratedScreen(attributes);
}
return accScreen;
} | [
"@",
"Override",
"public",
"synchronized",
"AcceleratedScreen",
"getAcceleratedScreen",
"(",
"int",
"[",
"]",
"attributes",
")",
"throws",
"GLException",
"{",
"if",
"(",
"accScreen",
"==",
"null",
")",
"{",
"accScreen",
"=",
"new",
"AndroidAcceleratedScreen",
"(",
"attributes",
")",
";",
"}",
"return",
"accScreen",
";",
"}"
] | Create the accelerated screen for this platform
@param attributes a sequence of pairs (GLAttibute, value)
@throws GLException | [
"Create",
"the",
"accelerated",
"screen",
"for",
"this",
"platform"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/AndroidPlatform.java#L55-L62 |
3,351 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/SysFS.java | SysFS.readCapabilities | static Map<String, BitSet> readCapabilities(File sysPath) {
Map<String, BitSet> capsMap = new HashMap<String, BitSet>();
File[] capsFiles = new File(sysPath, "device/capabilities").listFiles();
if (capsFiles == null) {
return capsMap;
}
for (int i = 0; i < capsFiles.length; i++) {
try {
BufferedReader r = new BufferedReader(new FileReader(capsFiles[i]));
String s = r.readLine();
r.close();
if (s == null) {
continue;
}
String[] elements = s.split(" ");
if (elements == null) {
continue;
}
byte[] b = new byte[elements.length * (LinuxArch.is64Bit() ? 8 : 4)];
ByteBuffer bb = ByteBuffer.wrap(b);
bb.order(ByteOrder.LITTLE_ENDIAN);
for (int j = elements.length - 1; j >= 0; j--) {
if (LinuxArch.is64Bit()) {
bb.putLong(Long.parseUnsignedLong(elements[j], 16));
} else {
bb.putInt(Integer.parseUnsignedInt(elements[j], 16));
}
}
capsMap.put(capsFiles[i].getName(), BitSet.valueOf(b));
} catch (IOException | RuntimeException e) {
e.printStackTrace();
}
}
return capsMap;
} | java | static Map<String, BitSet> readCapabilities(File sysPath) {
Map<String, BitSet> capsMap = new HashMap<String, BitSet>();
File[] capsFiles = new File(sysPath, "device/capabilities").listFiles();
if (capsFiles == null) {
return capsMap;
}
for (int i = 0; i < capsFiles.length; i++) {
try {
BufferedReader r = new BufferedReader(new FileReader(capsFiles[i]));
String s = r.readLine();
r.close();
if (s == null) {
continue;
}
String[] elements = s.split(" ");
if (elements == null) {
continue;
}
byte[] b = new byte[elements.length * (LinuxArch.is64Bit() ? 8 : 4)];
ByteBuffer bb = ByteBuffer.wrap(b);
bb.order(ByteOrder.LITTLE_ENDIAN);
for (int j = elements.length - 1; j >= 0; j--) {
if (LinuxArch.is64Bit()) {
bb.putLong(Long.parseUnsignedLong(elements[j], 16));
} else {
bb.putInt(Integer.parseUnsignedInt(elements[j], 16));
}
}
capsMap.put(capsFiles[i].getName(), BitSet.valueOf(b));
} catch (IOException | RuntimeException e) {
e.printStackTrace();
}
}
return capsMap;
} | [
"static",
"Map",
"<",
"String",
",",
"BitSet",
">",
"readCapabilities",
"(",
"File",
"sysPath",
")",
"{",
"Map",
"<",
"String",
",",
"BitSet",
">",
"capsMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"BitSet",
">",
"(",
")",
";",
"File",
"[",
"]",
"capsFiles",
"=",
"new",
"File",
"(",
"sysPath",
",",
"\"device/capabilities\"",
")",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"capsFiles",
"==",
"null",
")",
"{",
"return",
"capsMap",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"capsFiles",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"BufferedReader",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"capsFiles",
"[",
"i",
"]",
")",
")",
";",
"String",
"s",
"=",
"r",
".",
"readLine",
"(",
")",
";",
"r",
".",
"close",
"(",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"String",
"[",
"]",
"elements",
"=",
"s",
".",
"split",
"(",
"\" \"",
")",
";",
"if",
"(",
"elements",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"elements",
".",
"length",
"*",
"(",
"LinuxArch",
".",
"is64Bit",
"(",
")",
"?",
"8",
":",
"4",
")",
"]",
";",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"b",
")",
";",
"bb",
".",
"order",
"(",
"ByteOrder",
".",
"LITTLE_ENDIAN",
")",
";",
"for",
"(",
"int",
"j",
"=",
"elements",
".",
"length",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",
"--",
")",
"{",
"if",
"(",
"LinuxArch",
".",
"is64Bit",
"(",
")",
")",
"{",
"bb",
".",
"putLong",
"(",
"Long",
".",
"parseUnsignedLong",
"(",
"elements",
"[",
"j",
"]",
",",
"16",
")",
")",
";",
"}",
"else",
"{",
"bb",
".",
"putInt",
"(",
"Integer",
".",
"parseUnsignedInt",
"(",
"elements",
"[",
"j",
"]",
",",
"16",
")",
")",
";",
"}",
"}",
"capsMap",
".",
"put",
"(",
"capsFiles",
"[",
"i",
"]",
".",
"getName",
"(",
")",
",",
"BitSet",
".",
"valueOf",
"(",
"b",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"|",
"RuntimeException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"return",
"capsMap",
";",
"}"
] | Read input device capability data from sysfs | [
"Read",
"input",
"device",
"capability",
"data",
"from",
"sysfs"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/SysFS.java#L47-L81 |
3,352 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/SysFS.java | SysFS.triggerUdevNotification | static void triggerUdevNotification(String sysClass) {
File[] devices = new File("/sys/class/" + sysClass).listFiles();
byte[] action = "change".getBytes();
for (File device: devices) {
File uevent = new File(device, "uevent");
if (uevent.exists()) {
try {
write(uevent.getAbsolutePath(), action);
} catch (IOException e) {
System.err.println("Udev: Failed to write to " + uevent);
System.err.println(" Check that you have permission to access input devices");
if (!e.getMessage().contains("Permission denied")) {
e.printStackTrace();
}
}
}
}
} | java | static void triggerUdevNotification(String sysClass) {
File[] devices = new File("/sys/class/" + sysClass).listFiles();
byte[] action = "change".getBytes();
for (File device: devices) {
File uevent = new File(device, "uevent");
if (uevent.exists()) {
try {
write(uevent.getAbsolutePath(), action);
} catch (IOException e) {
System.err.println("Udev: Failed to write to " + uevent);
System.err.println(" Check that you have permission to access input devices");
if (!e.getMessage().contains("Permission denied")) {
e.printStackTrace();
}
}
}
}
} | [
"static",
"void",
"triggerUdevNotification",
"(",
"String",
"sysClass",
")",
"{",
"File",
"[",
"]",
"devices",
"=",
"new",
"File",
"(",
"\"/sys/class/\"",
"+",
"sysClass",
")",
".",
"listFiles",
"(",
")",
";",
"byte",
"[",
"]",
"action",
"=",
"\"change\"",
".",
"getBytes",
"(",
")",
";",
"for",
"(",
"File",
"device",
":",
"devices",
")",
"{",
"File",
"uevent",
"=",
"new",
"File",
"(",
"device",
",",
"\"uevent\"",
")",
";",
"if",
"(",
"uevent",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"write",
"(",
"uevent",
".",
"getAbsolutePath",
"(",
")",
",",
"action",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Udev: Failed to write to \"",
"+",
"uevent",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\" Check that you have permission to access input devices\"",
")",
";",
"if",
"(",
"!",
"e",
".",
"getMessage",
"(",
")",
".",
"contains",
"(",
"\"Permission denied\"",
")",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Fires udev notification events for devices of the given type | [
"Fires",
"udev",
"notification",
"events",
"for",
"devices",
"of",
"the",
"given",
"type"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/SysFS.java#L101-L118 |
3,353 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/SysFS.java | SysFS.readInts | static int[] readInts(String location, int expectedLength) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(location));
String s = r.readLine();
r.close();
if (s != null && s.length() > 0) {
String[] elements = s.split(",");
try {
if (expectedLength == 0 || elements.length == expectedLength) {
int[] xs = new int[elements.length];
for (int i = 0; i < xs.length; i++) {
xs[i] = Integer.parseInt(elements[i]);
}
return xs;
}
} catch (NumberFormatException e) {
// fall through to throw an IOException
}
}
if (expectedLength != 0) {
throw new IOException("Expected to find " + expectedLength
+ " integers in " + location + " but found '"
+ s + "'");
} else {
return new int[0];
}
} | java | static int[] readInts(String location, int expectedLength) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(location));
String s = r.readLine();
r.close();
if (s != null && s.length() > 0) {
String[] elements = s.split(",");
try {
if (expectedLength == 0 || elements.length == expectedLength) {
int[] xs = new int[elements.length];
for (int i = 0; i < xs.length; i++) {
xs[i] = Integer.parseInt(elements[i]);
}
return xs;
}
} catch (NumberFormatException e) {
// fall through to throw an IOException
}
}
if (expectedLength != 0) {
throw new IOException("Expected to find " + expectedLength
+ " integers in " + location + " but found '"
+ s + "'");
} else {
return new int[0];
}
} | [
"static",
"int",
"[",
"]",
"readInts",
"(",
"String",
"location",
",",
"int",
"expectedLength",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"location",
")",
")",
";",
"String",
"s",
"=",
"r",
".",
"readLine",
"(",
")",
";",
"r",
".",
"close",
"(",
")",
";",
"if",
"(",
"s",
"!=",
"null",
"&&",
"s",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"String",
"[",
"]",
"elements",
"=",
"s",
".",
"split",
"(",
"\",\"",
")",
";",
"try",
"{",
"if",
"(",
"expectedLength",
"==",
"0",
"||",
"elements",
".",
"length",
"==",
"expectedLength",
")",
"{",
"int",
"[",
"]",
"xs",
"=",
"new",
"int",
"[",
"elements",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"xs",
".",
"length",
";",
"i",
"++",
")",
"{",
"xs",
"[",
"i",
"]",
"=",
"Integer",
".",
"parseInt",
"(",
"elements",
"[",
"i",
"]",
")",
";",
"}",
"return",
"xs",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"// fall through to throw an IOException",
"}",
"}",
"if",
"(",
"expectedLength",
"!=",
"0",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Expected to find \"",
"+",
"expectedLength",
"+",
"\" integers in \"",
"+",
"location",
"+",
"\" but found '\"",
"+",
"s",
"+",
"\"'\"",
")",
";",
"}",
"else",
"{",
"return",
"new",
"int",
"[",
"0",
"]",
";",
"}",
"}"
] | Read a comma-separated list of integer values from a file | [
"Read",
"a",
"comma",
"-",
"separated",
"list",
"of",
"integer",
"values",
"from",
"a",
"file"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/SysFS.java#L134-L159 |
3,354 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/SysFS.java | SysFS.readInt | static int readInt(String location) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(location));
String s = r.readLine();
r.close();
try {
if (s != null && s.length() > 0) {
return Integer.parseInt(s);
} else {
throw new IOException(location + " does not contain an integer");
}
} catch (NumberFormatException e) {
throw new IOException(
location + " does not contain an integer ('" + s + "'");
}
} | java | static int readInt(String location) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(location));
String s = r.readLine();
r.close();
try {
if (s != null && s.length() > 0) {
return Integer.parseInt(s);
} else {
throw new IOException(location + " does not contain an integer");
}
} catch (NumberFormatException e) {
throw new IOException(
location + " does not contain an integer ('" + s + "'");
}
} | [
"static",
"int",
"readInt",
"(",
"String",
"location",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"location",
")",
")",
";",
"String",
"s",
"=",
"r",
".",
"readLine",
"(",
")",
";",
"r",
".",
"close",
"(",
")",
";",
"try",
"{",
"if",
"(",
"s",
"!=",
"null",
"&&",
"s",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"s",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IOException",
"(",
"location",
"+",
"\" does not contain an integer\"",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"location",
"+",
"\" does not contain an integer ('\"",
"+",
"s",
"+",
"\"'\"",
")",
";",
"}",
"}"
] | Read a single integer value from a file | [
"Read",
"a",
"single",
"integer",
"value",
"from",
"a",
"file"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/SysFS.java#L164-L178 |
3,355 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java | AcceleratedScreen.enableRendering | public void enableRendering(boolean flag) {
if (flag) {
egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface,
eglContext);
} else {
egl.eglMakeCurrent(eglDisplay, 0, 0, eglContext);
}
} | java | public void enableRendering(boolean flag) {
if (flag) {
egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface,
eglContext);
} else {
egl.eglMakeCurrent(eglDisplay, 0, 0, eglContext);
}
} | [
"public",
"void",
"enableRendering",
"(",
"boolean",
"flag",
")",
"{",
"if",
"(",
"flag",
")",
"{",
"egl",
".",
"eglMakeCurrent",
"(",
"eglDisplay",
",",
"eglSurface",
",",
"eglSurface",
",",
"eglContext",
")",
";",
"}",
"else",
"{",
"egl",
".",
"eglMakeCurrent",
"(",
"eglDisplay",
",",
"0",
",",
"0",
",",
"eglContext",
")",
";",
"}",
"}"
] | Make the EGL drawing surface current or not
@param flag | [
"Make",
"the",
"EGL",
"drawing",
"surface",
"current",
"or",
"not"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java#L134-L141 |
3,356 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java | AcceleratedScreen.initPlatformLibraries | boolean initPlatformLibraries() throws UnsatisfiedLinkError{
if (!initialized) {
glesLibraryHandle = ls.dlopen("libGLESv2.so",
LinuxSystem.RTLD_LAZY | LinuxSystem.RTLD_GLOBAL);
if (glesLibraryHandle == 0l) {
throw new UnsatisfiedLinkError("Error loading libGLESv2.so");
}
eglLibraryHandle = ls.dlopen("libEGL.so",
LinuxSystem.RTLD_LAZY | LinuxSystem.RTLD_GLOBAL);
if (eglLibraryHandle == 0l) {
throw new UnsatisfiedLinkError("Error loading libEGL.so");
}
initialized = true;
}
return true;
} | java | boolean initPlatformLibraries() throws UnsatisfiedLinkError{
if (!initialized) {
glesLibraryHandle = ls.dlopen("libGLESv2.so",
LinuxSystem.RTLD_LAZY | LinuxSystem.RTLD_GLOBAL);
if (glesLibraryHandle == 0l) {
throw new UnsatisfiedLinkError("Error loading libGLESv2.so");
}
eglLibraryHandle = ls.dlopen("libEGL.so",
LinuxSystem.RTLD_LAZY | LinuxSystem.RTLD_GLOBAL);
if (eglLibraryHandle == 0l) {
throw new UnsatisfiedLinkError("Error loading libEGL.so");
}
initialized = true;
}
return true;
} | [
"boolean",
"initPlatformLibraries",
"(",
")",
"throws",
"UnsatisfiedLinkError",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"glesLibraryHandle",
"=",
"ls",
".",
"dlopen",
"(",
"\"libGLESv2.so\"",
",",
"LinuxSystem",
".",
"RTLD_LAZY",
"|",
"LinuxSystem",
".",
"RTLD_GLOBAL",
")",
";",
"if",
"(",
"glesLibraryHandle",
"==",
"0l",
")",
"{",
"throw",
"new",
"UnsatisfiedLinkError",
"(",
"\"Error loading libGLESv2.so\"",
")",
";",
"}",
"eglLibraryHandle",
"=",
"ls",
".",
"dlopen",
"(",
"\"libEGL.so\"",
",",
"LinuxSystem",
".",
"RTLD_LAZY",
"|",
"LinuxSystem",
".",
"RTLD_GLOBAL",
")",
";",
"if",
"(",
"eglLibraryHandle",
"==",
"0l",
")",
"{",
"throw",
"new",
"UnsatisfiedLinkError",
"(",
"\"Error loading libEGL.so\"",
")",
";",
"}",
"initialized",
"=",
"true",
";",
"}",
"return",
"true",
";",
"}"
] | Load any native libraries needed to instantiate and initialize the
native drawing surface and rendering context
@return success or failure
@throws UnsatisfiedLinkError | [
"Load",
"any",
"native",
"libraries",
"needed",
"to",
"instantiate",
"and",
"initialize",
"the",
"native",
"drawing",
"surface",
"and",
"rendering",
"context"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java#L148-L163 |
3,357 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java | AcceleratedScreen.swapBuffers | public boolean swapBuffers() {
boolean result = false;
synchronized(NativeScreen.framebufferSwapLock) {
result = egl.eglSwapBuffers(eglDisplay, eglSurface);
// TODO this shouldn't happen. In case the surface is invalid, we need to have recreated it before this method is called
if (!result) {
createSurface();
result = egl.eglSwapBuffers(eglDisplay, eglSurface);
}
}
return result;
} | java | public boolean swapBuffers() {
boolean result = false;
synchronized(NativeScreen.framebufferSwapLock) {
result = egl.eglSwapBuffers(eglDisplay, eglSurface);
// TODO this shouldn't happen. In case the surface is invalid, we need to have recreated it before this method is called
if (!result) {
createSurface();
result = egl.eglSwapBuffers(eglDisplay, eglSurface);
}
}
return result;
} | [
"public",
"boolean",
"swapBuffers",
"(",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"synchronized",
"(",
"NativeScreen",
".",
"framebufferSwapLock",
")",
"{",
"result",
"=",
"egl",
".",
"eglSwapBuffers",
"(",
"eglDisplay",
",",
"eglSurface",
")",
";",
"// TODO this shouldn't happen. In case the surface is invalid, we need to have recreated it before this method is called",
"if",
"(",
"!",
"result",
")",
"{",
"createSurface",
"(",
")",
";",
"result",
"=",
"egl",
".",
"eglSwapBuffers",
"(",
"eglDisplay",
",",
"eglSurface",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Copy the contents of the GL backbuffer to the screen
@return success or failure | [
"Copy",
"the",
"contents",
"of",
"the",
"GL",
"backbuffer",
"to",
"the",
"screen"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/AcceleratedScreen.java#L181-L193 |
3,358 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/X11InputDeviceRegistry.java | X11InputDeviceRegistry.processXEvent | private void processXEvent(X.XEvent event,
RunnableProcessor runnableProcessor) {
switch (X.XEvent.getType(event.p)) {
case X.ButtonPress: {
X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
int button = X.XButtonEvent.getButton(buttonEvent.p);
runnableProcessor.invokeLater(new ButtonPressProcessor(button));
break;
}
case X.ButtonRelease: {
X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
int button = X.XButtonEvent.getButton(buttonEvent.p);
runnableProcessor.invokeLater(
new ButtonReleaseProcessor(button));
break;
}
case X.MotionNotify: {
X.XMotionEvent motionEvent = new X.XMotionEvent(event);
int x = X.XMotionEvent.getX(motionEvent.p);
int y = X.XMotionEvent.getY(motionEvent.p);
runnableProcessor.invokeLater(new MotionProcessor(x, y));
break;
}
}
} | java | private void processXEvent(X.XEvent event,
RunnableProcessor runnableProcessor) {
switch (X.XEvent.getType(event.p)) {
case X.ButtonPress: {
X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
int button = X.XButtonEvent.getButton(buttonEvent.p);
runnableProcessor.invokeLater(new ButtonPressProcessor(button));
break;
}
case X.ButtonRelease: {
X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
int button = X.XButtonEvent.getButton(buttonEvent.p);
runnableProcessor.invokeLater(
new ButtonReleaseProcessor(button));
break;
}
case X.MotionNotify: {
X.XMotionEvent motionEvent = new X.XMotionEvent(event);
int x = X.XMotionEvent.getX(motionEvent.p);
int y = X.XMotionEvent.getY(motionEvent.p);
runnableProcessor.invokeLater(new MotionProcessor(x, y));
break;
}
}
} | [
"private",
"void",
"processXEvent",
"(",
"X",
".",
"XEvent",
"event",
",",
"RunnableProcessor",
"runnableProcessor",
")",
"{",
"switch",
"(",
"X",
".",
"XEvent",
".",
"getType",
"(",
"event",
".",
"p",
")",
")",
"{",
"case",
"X",
".",
"ButtonPress",
":",
"{",
"X",
".",
"XButtonEvent",
"buttonEvent",
"=",
"new",
"X",
".",
"XButtonEvent",
"(",
"event",
")",
";",
"int",
"button",
"=",
"X",
".",
"XButtonEvent",
".",
"getButton",
"(",
"buttonEvent",
".",
"p",
")",
";",
"runnableProcessor",
".",
"invokeLater",
"(",
"new",
"ButtonPressProcessor",
"(",
"button",
")",
")",
";",
"break",
";",
"}",
"case",
"X",
".",
"ButtonRelease",
":",
"{",
"X",
".",
"XButtonEvent",
"buttonEvent",
"=",
"new",
"X",
".",
"XButtonEvent",
"(",
"event",
")",
";",
"int",
"button",
"=",
"X",
".",
"XButtonEvent",
".",
"getButton",
"(",
"buttonEvent",
".",
"p",
")",
";",
"runnableProcessor",
".",
"invokeLater",
"(",
"new",
"ButtonReleaseProcessor",
"(",
"button",
")",
")",
";",
"break",
";",
"}",
"case",
"X",
".",
"MotionNotify",
":",
"{",
"X",
".",
"XMotionEvent",
"motionEvent",
"=",
"new",
"X",
".",
"XMotionEvent",
"(",
"event",
")",
";",
"int",
"x",
"=",
"X",
".",
"XMotionEvent",
".",
"getX",
"(",
"motionEvent",
".",
"p",
")",
";",
"int",
"y",
"=",
"X",
".",
"XMotionEvent",
".",
"getY",
"(",
"motionEvent",
".",
"p",
")",
";",
"runnableProcessor",
".",
"invokeLater",
"(",
"new",
"MotionProcessor",
"(",
"x",
",",
"y",
")",
")",
";",
"break",
";",
"}",
"}",
"}"
] | Dispatch the X Event to the appropriate processor. All processors run
via invokeLater
@param event
@param runnableProcessor | [
"Dispatch",
"the",
"X",
"Event",
"to",
"the",
"appropriate",
"processor",
".",
"All",
"processors",
"run",
"via",
"invokeLater"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/X11InputDeviceRegistry.java#L98-L122 |
3,359 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/X11InputDeviceRegistry.java | X11InputDeviceRegistry.buttonToGlassButton | private static int buttonToGlassButton(int button) {
switch (button) {
case X.Button1: return MouseEvent.BUTTON_LEFT;
case X.Button2: return MouseEvent.BUTTON_OTHER;
case X.Button3: return MouseEvent.BUTTON_RIGHT;
default: return MouseEvent.BUTTON_NONE;
}
} | java | private static int buttonToGlassButton(int button) {
switch (button) {
case X.Button1: return MouseEvent.BUTTON_LEFT;
case X.Button2: return MouseEvent.BUTTON_OTHER;
case X.Button3: return MouseEvent.BUTTON_RIGHT;
default: return MouseEvent.BUTTON_NONE;
}
} | [
"private",
"static",
"int",
"buttonToGlassButton",
"(",
"int",
"button",
")",
"{",
"switch",
"(",
"button",
")",
"{",
"case",
"X",
".",
"Button1",
":",
"return",
"MouseEvent",
".",
"BUTTON_LEFT",
";",
"case",
"X",
".",
"Button2",
":",
"return",
"MouseEvent",
".",
"BUTTON_OTHER",
";",
"case",
"X",
".",
"Button3",
":",
"return",
"MouseEvent",
".",
"BUTTON_RIGHT",
";",
"default",
":",
"return",
"MouseEvent",
".",
"BUTTON_NONE",
";",
"}",
"}"
] | Convenience method to convert X11 button codes to glass button codes
@param button | [
"Convenience",
"method",
"to",
"convert",
"X11",
"button",
"codes",
"to",
"glass",
"button",
"codes"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/X11InputDeviceRegistry.java#L176-L183 |
3,360 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/MouseState.java | MouseState.getWindow | MonocleWindow getWindow(boolean recalculateCache) {
if (window == null || recalculateCache) {
window = (MonocleWindow)
MonocleWindowManager.getInstance().getWindowForLocation(x, y);
}
return window;
} | java | MonocleWindow getWindow(boolean recalculateCache) {
if (window == null || recalculateCache) {
window = (MonocleWindow)
MonocleWindowManager.getInstance().getWindowForLocation(x, y);
}
return window;
} | [
"MonocleWindow",
"getWindow",
"(",
"boolean",
"recalculateCache",
")",
"{",
"if",
"(",
"window",
"==",
"null",
"||",
"recalculateCache",
")",
"{",
"window",
"=",
"(",
"MonocleWindow",
")",
"MonocleWindowManager",
".",
"getInstance",
"(",
")",
".",
"getWindowForLocation",
"(",
"x",
",",
"y",
")",
";",
"}",
"return",
"window",
";",
"}"
] | Returns the Glass window on which the coordinates of this state are located.
@param recalculateCache true if the cached value for the target window
should be recalculated; false if the cached
value should be used to determine the result
of this method.
@return the MonocleWindow at the top of the stack at the coordinates
described by this state object. | [
"Returns",
"the",
"Glass",
"window",
"on",
"which",
"the",
"coordinates",
"of",
"this",
"state",
"are",
"located",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/MouseState.java#L89-L95 |
3,361 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/MouseState.java | MouseState.getModifiers | int getModifiers() {
int modifiers = KeyEvent.MODIFIER_NONE;
for (int i = 0; i < buttonsPressed.size(); i++) {
switch(buttonsPressed.get(i)) {
case MouseEvent.BUTTON_LEFT:
modifiers |= KeyEvent.MODIFIER_BUTTON_PRIMARY;
break;
case MouseEvent.BUTTON_OTHER:
modifiers |= KeyEvent.MODIFIER_BUTTON_MIDDLE;
break;
case MouseEvent.BUTTON_RIGHT:
modifiers |= KeyEvent.MODIFIER_BUTTON_SECONDARY;
break;
}
}
return modifiers;
} | java | int getModifiers() {
int modifiers = KeyEvent.MODIFIER_NONE;
for (int i = 0; i < buttonsPressed.size(); i++) {
switch(buttonsPressed.get(i)) {
case MouseEvent.BUTTON_LEFT:
modifiers |= KeyEvent.MODIFIER_BUTTON_PRIMARY;
break;
case MouseEvent.BUTTON_OTHER:
modifiers |= KeyEvent.MODIFIER_BUTTON_MIDDLE;
break;
case MouseEvent.BUTTON_RIGHT:
modifiers |= KeyEvent.MODIFIER_BUTTON_SECONDARY;
break;
}
}
return modifiers;
} | [
"int",
"getModifiers",
"(",
")",
"{",
"int",
"modifiers",
"=",
"KeyEvent",
".",
"MODIFIER_NONE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buttonsPressed",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"switch",
"(",
"buttonsPressed",
".",
"get",
"(",
"i",
")",
")",
"{",
"case",
"MouseEvent",
".",
"BUTTON_LEFT",
":",
"modifiers",
"|=",
"KeyEvent",
".",
"MODIFIER_BUTTON_PRIMARY",
";",
"break",
";",
"case",
"MouseEvent",
".",
"BUTTON_OTHER",
":",
"modifiers",
"|=",
"KeyEvent",
".",
"MODIFIER_BUTTON_MIDDLE",
";",
"break",
";",
"case",
"MouseEvent",
".",
"BUTTON_RIGHT",
":",
"modifiers",
"|=",
"KeyEvent",
".",
"MODIFIER_BUTTON_SECONDARY",
";",
"break",
";",
"}",
"}",
"return",
"modifiers",
";",
"}"
] | Returns the Glass event modifiers for this state | [
"Returns",
"the",
"Glass",
"event",
"modifiers",
"for",
"this",
"state"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/MouseState.java#L105-L121 |
3,362 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/MouseState.java | MouseState.canBeFoldedWith | boolean canBeFoldedWith(MouseState ms) {
return ms.buttonsPressed.equals(buttonsPressed) && ms.wheel == wheel;
} | java | boolean canBeFoldedWith(MouseState ms) {
return ms.buttonsPressed.equals(buttonsPressed) && ms.wheel == wheel;
} | [
"boolean",
"canBeFoldedWith",
"(",
"MouseState",
"ms",
")",
"{",
"return",
"ms",
".",
"buttonsPressed",
".",
"equals",
"(",
"buttonsPressed",
")",
"&&",
"ms",
".",
"wheel",
"==",
"wheel",
";",
"}"
] | Finds out whether two non-null states are identical in everything but
their coordinates
@param ms the MouseState to compare to | [
"Finds",
"out",
"whether",
"two",
"non",
"-",
"null",
"states",
"are",
"identical",
"in",
"everything",
"but",
"their",
"coordinates"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/MouseState.java#L151-L153 |
3,363 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/IntSet.java | IntSet.difference | void difference(IntSet dest, IntSet compared) {
int i = 0;
int j = 0;
while (i < size && j < compared.size) {
int a = elements[i];
int b = compared.elements[j];
if (a < b) {
// our set has a value that is not in "compared"
dest.addInt(a);
i ++;
} else if (a > b) {
// "compared" has a value that is not in our set.
j ++;
} else {
// the sets match at this index.
i ++;
j ++;
}
}
// anything left in our set is part of the delta and belongs in "dest".
while (i < size) {
dest.addInt(elements[i]);
i ++;
}
} | java | void difference(IntSet dest, IntSet compared) {
int i = 0;
int j = 0;
while (i < size && j < compared.size) {
int a = elements[i];
int b = compared.elements[j];
if (a < b) {
// our set has a value that is not in "compared"
dest.addInt(a);
i ++;
} else if (a > b) {
// "compared" has a value that is not in our set.
j ++;
} else {
// the sets match at this index.
i ++;
j ++;
}
}
// anything left in our set is part of the delta and belongs in "dest".
while (i < size) {
dest.addInt(elements[i]);
i ++;
}
} | [
"void",
"difference",
"(",
"IntSet",
"dest",
",",
"IntSet",
"compared",
")",
"{",
"int",
"i",
"=",
"0",
";",
"int",
"j",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"size",
"&&",
"j",
"<",
"compared",
".",
"size",
")",
"{",
"int",
"a",
"=",
"elements",
"[",
"i",
"]",
";",
"int",
"b",
"=",
"compared",
".",
"elements",
"[",
"j",
"]",
";",
"if",
"(",
"a",
"<",
"b",
")",
"{",
"// our set has a value that is not in \"compared\"",
"dest",
".",
"addInt",
"(",
"a",
")",
";",
"i",
"++",
";",
"}",
"else",
"if",
"(",
"a",
">",
"b",
")",
"{",
"// \"compared\" has a value that is not in our set.",
"j",
"++",
";",
"}",
"else",
"{",
"// the sets match at this index.",
"i",
"++",
";",
"j",
"++",
";",
"}",
"}",
"// anything left in our set is part of the delta and belongs in \"dest\".",
"while",
"(",
"i",
"<",
"size",
")",
"{",
"dest",
".",
"addInt",
"(",
"elements",
"[",
"i",
"]",
")",
";",
"i",
"++",
";",
"}",
"}"
] | Adds to the set "dest" values that in this set but are not in the set
"compared". | [
"Adds",
"to",
"the",
"set",
"dest",
"values",
"that",
"in",
"this",
"set",
"but",
"are",
"not",
"in",
"the",
"set",
"compared",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/IntSet.java#L86-L110 |
3,364 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/IntSet.java | IntSet.copyTo | void copyTo(IntSet target) {
if (target.elements.length < size) {
target.elements = Arrays.copyOf(elements, elements.length);
} else {
System.arraycopy(elements, 0, target.elements, 0, size);
}
target.size = size;
} | java | void copyTo(IntSet target) {
if (target.elements.length < size) {
target.elements = Arrays.copyOf(elements, elements.length);
} else {
System.arraycopy(elements, 0, target.elements, 0, size);
}
target.size = size;
} | [
"void",
"copyTo",
"(",
"IntSet",
"target",
")",
"{",
"if",
"(",
"target",
".",
"elements",
".",
"length",
"<",
"size",
")",
"{",
"target",
".",
"elements",
"=",
"Arrays",
".",
"copyOf",
"(",
"elements",
",",
"elements",
".",
"length",
")",
";",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"elements",
",",
"0",
",",
"target",
".",
"elements",
",",
"0",
",",
"size",
")",
";",
"}",
"target",
".",
"size",
"=",
"size",
";",
"}"
] | Copies the contents of this set to the target set. | [
"Copies",
"the",
"contents",
"of",
"this",
"set",
"to",
"the",
"target",
"set",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/IntSet.java#L125-L132 |
3,365 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/KeyInput.java | KeyInput.setState | void setState(KeyState newState) {
if (MonocleSettings.settings.traceEvents) {
MonocleTrace.traceEvent("Set %s", newState);
}
newState.getWindow(true);
// send release events
state.getKeysPressed().difference(keys, newState.getKeysPressed());
if (!keys.isEmpty()) {
for (int i = 0; i < keys.size(); i++) {
int key = keys.get(i);
dispatchKeyEvent(newState, KeyEvent.RELEASE, key);
}
}
keys.clear();
// send press events
newState.getKeysPressed().difference(keys, state.getKeysPressed());
if (!keys.isEmpty()) {
for (int i = 0; i < keys.size(); i++) {
int key = keys.get(i);
if (key == KeyEvent.VK_CAPS_LOCK) {
capsLock = !capsLock;
} else if (key == KeyEvent.VK_NUM_LOCK) {
numLock = !numLock;
} else if (key == KeyEvent.VK_C && newState.isControlPressed()) {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if ("1".equals(System.getenv("JAVAFX_DEBUG"))) {
System.exit(0);
}
return null;
});
}
dispatchKeyEvent(newState, KeyEvent.PRESS, key);
}
}
keys.clear();
newState.copyTo(state);
} | java | void setState(KeyState newState) {
if (MonocleSettings.settings.traceEvents) {
MonocleTrace.traceEvent("Set %s", newState);
}
newState.getWindow(true);
// send release events
state.getKeysPressed().difference(keys, newState.getKeysPressed());
if (!keys.isEmpty()) {
for (int i = 0; i < keys.size(); i++) {
int key = keys.get(i);
dispatchKeyEvent(newState, KeyEvent.RELEASE, key);
}
}
keys.clear();
// send press events
newState.getKeysPressed().difference(keys, state.getKeysPressed());
if (!keys.isEmpty()) {
for (int i = 0; i < keys.size(); i++) {
int key = keys.get(i);
if (key == KeyEvent.VK_CAPS_LOCK) {
capsLock = !capsLock;
} else if (key == KeyEvent.VK_NUM_LOCK) {
numLock = !numLock;
} else if (key == KeyEvent.VK_C && newState.isControlPressed()) {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if ("1".equals(System.getenv("JAVAFX_DEBUG"))) {
System.exit(0);
}
return null;
});
}
dispatchKeyEvent(newState, KeyEvent.PRESS, key);
}
}
keys.clear();
newState.copyTo(state);
} | [
"void",
"setState",
"(",
"KeyState",
"newState",
")",
"{",
"if",
"(",
"MonocleSettings",
".",
"settings",
".",
"traceEvents",
")",
"{",
"MonocleTrace",
".",
"traceEvent",
"(",
"\"Set %s\"",
",",
"newState",
")",
";",
"}",
"newState",
".",
"getWindow",
"(",
"true",
")",
";",
"// send release events",
"state",
".",
"getKeysPressed",
"(",
")",
".",
"difference",
"(",
"keys",
",",
"newState",
".",
"getKeysPressed",
"(",
")",
")",
";",
"if",
"(",
"!",
"keys",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"key",
"=",
"keys",
".",
"get",
"(",
"i",
")",
";",
"dispatchKeyEvent",
"(",
"newState",
",",
"KeyEvent",
".",
"RELEASE",
",",
"key",
")",
";",
"}",
"}",
"keys",
".",
"clear",
"(",
")",
";",
"// send press events",
"newState",
".",
"getKeysPressed",
"(",
")",
".",
"difference",
"(",
"keys",
",",
"state",
".",
"getKeysPressed",
"(",
")",
")",
";",
"if",
"(",
"!",
"keys",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"key",
"=",
"keys",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"key",
"==",
"KeyEvent",
".",
"VK_CAPS_LOCK",
")",
"{",
"capsLock",
"=",
"!",
"capsLock",
";",
"}",
"else",
"if",
"(",
"key",
"==",
"KeyEvent",
".",
"VK_NUM_LOCK",
")",
"{",
"numLock",
"=",
"!",
"numLock",
";",
"}",
"else",
"if",
"(",
"key",
"==",
"KeyEvent",
".",
"VK_C",
"&&",
"newState",
".",
"isControlPressed",
"(",
")",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"(",
"PrivilegedAction",
"<",
"Void",
">",
")",
"(",
")",
"->",
"{",
"if",
"(",
"\"1\"",
".",
"equals",
"(",
"System",
".",
"getenv",
"(",
"\"JAVAFX_DEBUG\"",
")",
")",
")",
"{",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"return",
"null",
";",
"}",
")",
";",
"}",
"dispatchKeyEvent",
"(",
"newState",
",",
"KeyEvent",
".",
"PRESS",
",",
"key",
")",
";",
"}",
"}",
"keys",
".",
"clear",
"(",
")",
";",
"newState",
".",
"copyTo",
"(",
"state",
")",
";",
"}"
] | Called from the input processor to update the key state and send
key events.
@param newState The updated key state | [
"Called",
"from",
"the",
"input",
"processor",
"to",
"update",
"the",
"key",
"state",
"and",
"send",
"key",
"events",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/KeyInput.java#L64-L100 |
3,366 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/NativeCursors.java | NativeCursors.colorKeyCursor | static void colorKeyCursor(byte[] source,
Buffer dest,
int targetDepth,
int transparentPixel) {
switch (targetDepth) {
case 32:
colorKeyCursor32(source,
(IntBuffer) dest, transparentPixel);
break;
case 16:
colorKeyCursor16(source,
(ShortBuffer) dest, transparentPixel);
break;
default:
throw new UnsupportedOperationException();
}
} | java | static void colorKeyCursor(byte[] source,
Buffer dest,
int targetDepth,
int transparentPixel) {
switch (targetDepth) {
case 32:
colorKeyCursor32(source,
(IntBuffer) dest, transparentPixel);
break;
case 16:
colorKeyCursor16(source,
(ShortBuffer) dest, transparentPixel);
break;
default:
throw new UnsupportedOperationException();
}
} | [
"static",
"void",
"colorKeyCursor",
"(",
"byte",
"[",
"]",
"source",
",",
"Buffer",
"dest",
",",
"int",
"targetDepth",
",",
"int",
"transparentPixel",
")",
"{",
"switch",
"(",
"targetDepth",
")",
"{",
"case",
"32",
":",
"colorKeyCursor32",
"(",
"source",
",",
"(",
"IntBuffer",
")",
"dest",
",",
"transparentPixel",
")",
";",
"break",
";",
"case",
"16",
":",
"colorKeyCursor16",
"(",
"source",
",",
"(",
"ShortBuffer",
")",
"dest",
",",
"transparentPixel",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"}",
"}"
] | Convert a cursor in 32-bit BYTE_ARGB_PRE format to a 16-bit or 32-bit
color-keyed format
@param source the cursor pixels
@param dest a target ShortBuffer or IntBuffer
@param targetDepth the depth of the target format (16 or 32)
@param transparentPixel the color key used for transparent pixels | [
"Convert",
"a",
"cursor",
"in",
"32",
"-",
"bit",
"BYTE_ARGB_PRE",
"format",
"to",
"a",
"16",
"-",
"bit",
"or",
"32",
"-",
"bit",
"color",
"-",
"keyed",
"format"
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/NativeCursors.java#L44-L60 |
3,367 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/NativeCursors.java | NativeCursors.offsetCursor | static void offsetCursor(Buffer sourceBuffer,
Buffer destBuffer,
int offsetX, int offsetY,
int width, int height,
int depth, int transparentPixel) {
switch (depth) {
case 32:
offsetCursor32((IntBuffer) sourceBuffer,
(IntBuffer) destBuffer,
offsetX, offsetY,
width, height,
transparentPixel);
break;
case 16:
offsetCursor16((ShortBuffer) sourceBuffer,
(ShortBuffer) destBuffer,
offsetX, offsetY,
width, height,
transparentPixel);
break;
default:
throw new UnsupportedOperationException();
}
} | java | static void offsetCursor(Buffer sourceBuffer,
Buffer destBuffer,
int offsetX, int offsetY,
int width, int height,
int depth, int transparentPixel) {
switch (depth) {
case 32:
offsetCursor32((IntBuffer) sourceBuffer,
(IntBuffer) destBuffer,
offsetX, offsetY,
width, height,
transparentPixel);
break;
case 16:
offsetCursor16((ShortBuffer) sourceBuffer,
(ShortBuffer) destBuffer,
offsetX, offsetY,
width, height,
transparentPixel);
break;
default:
throw new UnsupportedOperationException();
}
} | [
"static",
"void",
"offsetCursor",
"(",
"Buffer",
"sourceBuffer",
",",
"Buffer",
"destBuffer",
",",
"int",
"offsetX",
",",
"int",
"offsetY",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"depth",
",",
"int",
"transparentPixel",
")",
"{",
"switch",
"(",
"depth",
")",
"{",
"case",
"32",
":",
"offsetCursor32",
"(",
"(",
"IntBuffer",
")",
"sourceBuffer",
",",
"(",
"IntBuffer",
")",
"destBuffer",
",",
"offsetX",
",",
"offsetY",
",",
"width",
",",
"height",
",",
"transparentPixel",
")",
";",
"break",
";",
"case",
"16",
":",
"offsetCursor16",
"(",
"(",
"ShortBuffer",
")",
"sourceBuffer",
",",
"(",
"ShortBuffer",
")",
"destBuffer",
",",
"offsetX",
",",
"offsetY",
",",
"width",
",",
"height",
",",
"transparentPixel",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"}",
"}"
] | Creates a shifted version of the source cursor. Buffers must be
ShortBuffers for a bit depth of 16 or IntBuffers for a bit depth of 32.
@param sourceBuffer The original cursor to be shifted
@param destBuffer A buffer to receive the shifted cursor
@param offsetX the number of pixels the cursor is to be shifted right
@param offsetY the number of pixels the cursor is to be shifted down
@param width the pixel width of the cursor
@param height the pixel height of the cursor
@param depth the pixel depth of the cursor (16 or 32)
@param transparentPixel the color key used for transparent pixels | [
"Creates",
"a",
"shifted",
"version",
"of",
"the",
"source",
"cursor",
".",
"Buffers",
"must",
"be",
"ShortBuffers",
"for",
"a",
"bit",
"depth",
"of",
"16",
"or",
"IntBuffers",
"for",
"a",
"bit",
"depth",
"of",
"32",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/NativeCursors.java#L74-L97 |
3,368 | TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/AndroidScreen.java | AndroidScreen.uploadPixels | public void uploadPixels(Buffer b,
int x, int y, int width, int height, float alpha) {
_uploadPixels (b, x, y, width, height, alpha);
} | java | public void uploadPixels(Buffer b,
int x, int y, int width, int height, float alpha) {
_uploadPixels (b, x, y, width, height, alpha);
} | [
"public",
"void",
"uploadPixels",
"(",
"Buffer",
"b",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
",",
"float",
"alpha",
")",
"{",
"_uploadPixels",
"(",
"b",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"alpha",
")",
";",
"}"
] | Uploads a pixel buffer to the screen. Called on the JavaFX application thread.
@param b Pixel data, in BYTE_BGRA_PRE format. The byte stride of the
data is equal to width * 4.
@param x The X offset of the pixel data on the screen
@param y The Y offset of the pixel data on the screen
@param width The pixel width of the data
@param height The pixel height of the data
@param alpha The alpha level to use to compose the data over existing
pixels | [
"Uploads",
"a",
"pixel",
"buffer",
"to",
"the",
"screen",
".",
"Called",
"on",
"the",
"JavaFX",
"application",
"thread",
"."
] | 267ccba8889cab244bf8c562dbaa0345a612874c | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/AndroidScreen.java#L104-L107 |
3,369 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/BasicResourceLoader.java | BasicResourceLoader.resourceName | protected String resourceName(final String className) {
String name = className;
if (!name.startsWith("/")) {
name = "/" + name;
}
if (!name.endsWith(DOT_GROOVY)) {
name = name.replace('.', '/');
name += DOT_GROOVY;
}
return name;
} | java | protected String resourceName(final String className) {
String name = className;
if (!name.startsWith("/")) {
name = "/" + name;
}
if (!name.endsWith(DOT_GROOVY)) {
name = name.replace('.', '/');
name += DOT_GROOVY;
}
return name;
} | [
"protected",
"String",
"resourceName",
"(",
"final",
"String",
"className",
")",
"{",
"String",
"name",
"=",
"className",
";",
"if",
"(",
"!",
"name",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"name",
"=",
"\"/\"",
"+",
"name",
";",
"}",
"if",
"(",
"!",
"name",
".",
"endsWith",
"(",
"DOT_GROOVY",
")",
")",
"{",
"name",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"name",
"+=",
"DOT_GROOVY",
";",
"}",
"return",
"name",
";",
"}"
] | Translate class-name into resource-name. | [
"Translate",
"class",
"-",
"name",
"into",
"resource",
"-",
"name",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/BasicResourceLoader.java#L77-L90 |
3,370 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/util/GroovyVersionHelper.java | GroovyVersionHelper.getVersion | private String getVersion(final ClassLoader classLoader, final String className, final String methodName) {
log.trace("Getting version; class-loader: {}, class-name: {}, method-name: {}",
classLoader, className, methodName);
try {
Class<?> type = classLoader.loadClass(className);
Method method = type.getMethod(methodName);
Object result = method.invoke(null);
if (result != null) {
return result.toString();
}
}
catch (Throwable e) {
log.trace("Unable determine version from: {}", className);
}
return null;
} | java | private String getVersion(final ClassLoader classLoader, final String className, final String methodName) {
log.trace("Getting version; class-loader: {}, class-name: {}, method-name: {}",
classLoader, className, methodName);
try {
Class<?> type = classLoader.loadClass(className);
Method method = type.getMethod(methodName);
Object result = method.invoke(null);
if (result != null) {
return result.toString();
}
}
catch (Throwable e) {
log.trace("Unable determine version from: {}", className);
}
return null;
} | [
"private",
"String",
"getVersion",
"(",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"String",
"className",
",",
"final",
"String",
"methodName",
")",
"{",
"log",
".",
"trace",
"(",
"\"Getting version; class-loader: {}, class-name: {}, method-name: {}\"",
",",
"classLoader",
",",
"className",
",",
"methodName",
")",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"classLoader",
".",
"loadClass",
"(",
"className",
")",
";",
"Method",
"method",
"=",
"type",
".",
"getMethod",
"(",
"methodName",
")",
";",
"Object",
"result",
"=",
"method",
".",
"invoke",
"(",
"null",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"log",
".",
"trace",
"(",
"\"Unable determine version from: {}\"",
",",
"className",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Get version from Groovy version helper utilities via reflection. | [
"Get",
"version",
"from",
"Groovy",
"version",
"helper",
"utilities",
"via",
"reflection",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/util/GroovyVersionHelper.java#L77-L94 |
3,371 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/util/VersionHelper.java | VersionHelper.before | public VersionRange before(final int... parts) {
checkNotNull(parts);
checkArgument(parts.length != 0);
StringBuilder buff = new StringBuilder()
.append("(,");
for (int i = 0; i < parts.length; i++) {
buff.append(parts[i]);
if (i + 1 < parts.length) {
buff.append(".");
}
}
buff.append("-")
.append(EARLIEST_SUFFIX)
.append(")");
log.trace("Range pattern: {}", buff);
return parseRange(buff.toString());
} | java | public VersionRange before(final int... parts) {
checkNotNull(parts);
checkArgument(parts.length != 0);
StringBuilder buff = new StringBuilder()
.append("(,");
for (int i = 0; i < parts.length; i++) {
buff.append(parts[i]);
if (i + 1 < parts.length) {
buff.append(".");
}
}
buff.append("-")
.append(EARLIEST_SUFFIX)
.append(")");
log.trace("Range pattern: {}", buff);
return parseRange(buff.toString());
} | [
"public",
"VersionRange",
"before",
"(",
"final",
"int",
"...",
"parts",
")",
"{",
"checkNotNull",
"(",
"parts",
")",
";",
"checkArgument",
"(",
"parts",
".",
"length",
"!=",
"0",
")",
";",
"StringBuilder",
"buff",
"=",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"\"(,\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"length",
";",
"i",
"++",
")",
"{",
"buff",
".",
"append",
"(",
"parts",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"+",
"1",
"<",
"parts",
".",
"length",
")",
"{",
"buff",
".",
"append",
"(",
"\".\"",
")",
";",
"}",
"}",
"buff",
".",
"append",
"(",
"\"-\"",
")",
".",
"append",
"(",
"EARLIEST_SUFFIX",
")",
".",
"append",
"(",
"\")\"",
")",
";",
"log",
".",
"trace",
"(",
"\"Range pattern: {}\"",
",",
"buff",
")",
";",
"return",
"parseRange",
"(",
"buff",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Builds a range before version parts. | [
"Builds",
"a",
"range",
"before",
"version",
"parts",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/util/VersionHelper.java#L129-L150 |
3,372 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java | RuntimeMojoSupport.resolveBasedir | private File resolveBasedir() throws IOException {
String path = null;
if (project != null) {
File file = project.getBasedir();
if (file != null) {
path = file.getAbsolutePath();
}
}
if (path == null) {
path = session.getExecutionRootDirectory();
}
if (path == null) {
path = System.getProperty("user.dir");
}
return new File(path).getCanonicalFile();
} | java | private File resolveBasedir() throws IOException {
String path = null;
if (project != null) {
File file = project.getBasedir();
if (file != null) {
path = file.getAbsolutePath();
}
}
if (path == null) {
path = session.getExecutionRootDirectory();
}
if (path == null) {
path = System.getProperty("user.dir");
}
return new File(path).getCanonicalFile();
} | [
"private",
"File",
"resolveBasedir",
"(",
")",
"throws",
"IOException",
"{",
"String",
"path",
"=",
"null",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{",
"File",
"file",
"=",
"project",
".",
"getBasedir",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"path",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"}",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"path",
"=",
"session",
".",
"getExecutionRootDirectory",
"(",
")",
";",
"}",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"path",
"=",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
";",
"}",
"return",
"new",
"File",
"(",
"path",
")",
".",
"getCanonicalFile",
"(",
")",
";",
"}"
] | Resolves the base directory for the current execution. | [
"Resolves",
"the",
"base",
"directory",
"for",
"the",
"current",
"execution",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java#L183-L202 |
3,373 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java | RuntimeMojoSupport.ensureMavenCompatibility | private void ensureMavenCompatibility(final ClassLoader classLoader) throws MojoExecutionException {
Version mavenVersion = mavenVersionHelper.detectVersion(classLoader);
if (mavenVersion == null) {
// complain and continue
log.error("Unable to determine Maven version");
}
else {
log.debug("Detected Maven version: {}", mavenVersion);
if (versionHelper.before(3).containsVersion(mavenVersion)) {
throw new MojoExecutionException("Unsupported Maven version: " + mavenVersion);
}
}
} | java | private void ensureMavenCompatibility(final ClassLoader classLoader) throws MojoExecutionException {
Version mavenVersion = mavenVersionHelper.detectVersion(classLoader);
if (mavenVersion == null) {
// complain and continue
log.error("Unable to determine Maven version");
}
else {
log.debug("Detected Maven version: {}", mavenVersion);
if (versionHelper.before(3).containsVersion(mavenVersion)) {
throw new MojoExecutionException("Unsupported Maven version: " + mavenVersion);
}
}
} | [
"private",
"void",
"ensureMavenCompatibility",
"(",
"final",
"ClassLoader",
"classLoader",
")",
"throws",
"MojoExecutionException",
"{",
"Version",
"mavenVersion",
"=",
"mavenVersionHelper",
".",
"detectVersion",
"(",
"classLoader",
")",
";",
"if",
"(",
"mavenVersion",
"==",
"null",
")",
"{",
"// complain and continue",
"log",
".",
"error",
"(",
"\"Unable to determine Maven version\"",
")",
";",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"Detected Maven version: {}\"",
",",
"mavenVersion",
")",
";",
"if",
"(",
"versionHelper",
".",
"before",
"(",
"3",
")",
".",
"containsVersion",
"(",
"mavenVersion",
")",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Unsupported Maven version: \"",
"+",
"mavenVersion",
")",
";",
"}",
"}",
"}"
] | Ensure Maven compatibility. Requires Maven 3+ | [
"Ensure",
"Maven",
"compatibility",
".",
"Requires",
"Maven",
"3",
"+"
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java#L224-L236 |
3,374 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java | RuntimeMojoSupport.ensureGroovyComparability | private void ensureGroovyComparability(final ClassLoader classLoader) throws MojoExecutionException {
Version groovyVersion = groovyVersionHelper.detectVersion(classLoader);
if (groovyVersion == null) {
// complain and continue
log.error("Unable to determine Groovy version");
}
else {
log.debug("Detected Groovy version: {}", groovyVersion);
if (versionHelper.before(2).containsVersion(groovyVersion)) {
throw new MojoExecutionException("Unsupported Groovy version: " + groovyVersion);
}
}
} | java | private void ensureGroovyComparability(final ClassLoader classLoader) throws MojoExecutionException {
Version groovyVersion = groovyVersionHelper.detectVersion(classLoader);
if (groovyVersion == null) {
// complain and continue
log.error("Unable to determine Groovy version");
}
else {
log.debug("Detected Groovy version: {}", groovyVersion);
if (versionHelper.before(2).containsVersion(groovyVersion)) {
throw new MojoExecutionException("Unsupported Groovy version: " + groovyVersion);
}
}
} | [
"private",
"void",
"ensureGroovyComparability",
"(",
"final",
"ClassLoader",
"classLoader",
")",
"throws",
"MojoExecutionException",
"{",
"Version",
"groovyVersion",
"=",
"groovyVersionHelper",
".",
"detectVersion",
"(",
"classLoader",
")",
";",
"if",
"(",
"groovyVersion",
"==",
"null",
")",
"{",
"// complain and continue",
"log",
".",
"error",
"(",
"\"Unable to determine Groovy version\"",
")",
";",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"Detected Groovy version: {}\"",
",",
"groovyVersion",
")",
";",
"if",
"(",
"versionHelper",
".",
"before",
"(",
"2",
")",
".",
"containsVersion",
"(",
"groovyVersion",
")",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Unsupported Groovy version: \"",
"+",
"groovyVersion",
")",
";",
"}",
"}",
"}"
] | Ensure Groovy compatibility. Requires Groovy 2+ | [
"Ensure",
"Groovy",
"compatibility",
".",
"Requires",
"Groovy",
"2",
"+"
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java#L241-L253 |
3,375 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java | RuntimeMojoSupport.configureAdditionalClasspath | private void configureAdditionalClasspath(final ClassRealm realm) {
log.debug("Configuring additional classpath with scope: {}", classpathScope);
List<File> classpath = Lists.newArrayList();
// add build output directory if scope includes 'compile'
if (classpathScope.matches(compile)) {
classpath.add(new File(project.getBuild().getOutputDirectory()));
}
// add build test output directory if scope includes 'test'
if (classpathScope.matches(test)) {
classpath.add(new File(project.getBuild().getTestOutputDirectory()));
}
// add matching project dependency artifacts
if (!project.getArtifacts().isEmpty()) {
for (Artifact artifact : project.getArtifacts()) {
if (classpathScope.matches(artifact.getScope())) {
File file = artifact.getFile();
if (!file.exists()) {
// for sanity, this should not really ever happen
log.warn("Artifact not resolved; ignoring: {}", artifact);
continue;
}
classpath.add(file);
}
}
}
if (!classpath.isEmpty()) {
log.debug("Additional classpath:");
for (File file : classpath) {
log.debug(" {}", file);
try {
realm.addURL(file.toURI().toURL());
}
catch (MalformedURLException e) {
throw Throwables.propagate(e);
}
}
}
} | java | private void configureAdditionalClasspath(final ClassRealm realm) {
log.debug("Configuring additional classpath with scope: {}", classpathScope);
List<File> classpath = Lists.newArrayList();
// add build output directory if scope includes 'compile'
if (classpathScope.matches(compile)) {
classpath.add(new File(project.getBuild().getOutputDirectory()));
}
// add build test output directory if scope includes 'test'
if (classpathScope.matches(test)) {
classpath.add(new File(project.getBuild().getTestOutputDirectory()));
}
// add matching project dependency artifacts
if (!project.getArtifacts().isEmpty()) {
for (Artifact artifact : project.getArtifacts()) {
if (classpathScope.matches(artifact.getScope())) {
File file = artifact.getFile();
if (!file.exists()) {
// for sanity, this should not really ever happen
log.warn("Artifact not resolved; ignoring: {}", artifact);
continue;
}
classpath.add(file);
}
}
}
if (!classpath.isEmpty()) {
log.debug("Additional classpath:");
for (File file : classpath) {
log.debug(" {}", file);
try {
realm.addURL(file.toURI().toURL());
}
catch (MalformedURLException e) {
throw Throwables.propagate(e);
}
}
}
} | [
"private",
"void",
"configureAdditionalClasspath",
"(",
"final",
"ClassRealm",
"realm",
")",
"{",
"log",
".",
"debug",
"(",
"\"Configuring additional classpath with scope: {}\"",
",",
"classpathScope",
")",
";",
"List",
"<",
"File",
">",
"classpath",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"// add build output directory if scope includes 'compile'",
"if",
"(",
"classpathScope",
".",
"matches",
"(",
"compile",
")",
")",
"{",
"classpath",
".",
"add",
"(",
"new",
"File",
"(",
"project",
".",
"getBuild",
"(",
")",
".",
"getOutputDirectory",
"(",
")",
")",
")",
";",
"}",
"// add build test output directory if scope includes 'test'",
"if",
"(",
"classpathScope",
".",
"matches",
"(",
"test",
")",
")",
"{",
"classpath",
".",
"add",
"(",
"new",
"File",
"(",
"project",
".",
"getBuild",
"(",
")",
".",
"getTestOutputDirectory",
"(",
")",
")",
")",
";",
"}",
"// add matching project dependency artifacts",
"if",
"(",
"!",
"project",
".",
"getArtifacts",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"Artifact",
"artifact",
":",
"project",
".",
"getArtifacts",
"(",
")",
")",
"{",
"if",
"(",
"classpathScope",
".",
"matches",
"(",
"artifact",
".",
"getScope",
"(",
")",
")",
")",
"{",
"File",
"file",
"=",
"artifact",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"// for sanity, this should not really ever happen",
"log",
".",
"warn",
"(",
"\"Artifact not resolved; ignoring: {}\"",
",",
"artifact",
")",
";",
"continue",
";",
"}",
"classpath",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"classpath",
".",
"isEmpty",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Additional classpath:\"",
")",
";",
"for",
"(",
"File",
"file",
":",
"classpath",
")",
"{",
"log",
".",
"debug",
"(",
"\" {}\"",
",",
"file",
")",
";",
"try",
"{",
"realm",
".",
"addURL",
"(",
"file",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"throw",
"Throwables",
".",
"propagate",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}"
] | Configure additional classpath elements for the runtime realm. | [
"Configure",
"additional",
"classpath",
"elements",
"for",
"the",
"runtime",
"realm",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java#L258-L300 |
3,376 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java | RuntimeMojoSupport.createLogger | private Logger createLogger() {
String loggerName = String.format("%s.%s.Script", project.getGroupId(), project.getArtifactId());
return LoggerFactory.getLogger(loggerName);
} | java | private Logger createLogger() {
String loggerName = String.format("%s.%s.Script", project.getGroupId(), project.getArtifactId());
return LoggerFactory.getLogger(loggerName);
} | [
"private",
"Logger",
"createLogger",
"(",
")",
"{",
"String",
"loggerName",
"=",
"String",
".",
"format",
"(",
"\"%s.%s.Script\"",
",",
"project",
".",
"getGroupId",
"(",
")",
",",
"project",
".",
"getArtifactId",
"(",
")",
")",
";",
"return",
"LoggerFactory",
".",
"getLogger",
"(",
"loggerName",
")",
";",
"}"
] | Create script logger. | [
"Create",
"script",
"logger",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java#L305-L308 |
3,377 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java | RuntimeMojoSupport.createProperties | private Properties createProperties() {
propertiesBuilder
.setProject(project)
.setSession(session);
customizeProperties(propertiesBuilder);
// convert to Properties for better compatibility, groovy doesn't care about types so its not a big deal
Properties props = new Properties();
props.putAll(propertiesBuilder.build());
return props;
} | java | private Properties createProperties() {
propertiesBuilder
.setProject(project)
.setSession(session);
customizeProperties(propertiesBuilder);
// convert to Properties for better compatibility, groovy doesn't care about types so its not a big deal
Properties props = new Properties();
props.putAll(propertiesBuilder.build());
return props;
} | [
"private",
"Properties",
"createProperties",
"(",
")",
"{",
"propertiesBuilder",
".",
"setProject",
"(",
"project",
")",
".",
"setSession",
"(",
"session",
")",
";",
"customizeProperties",
"(",
"propertiesBuilder",
")",
";",
"// convert to Properties for better compatibility, groovy doesn't care about types so its not a big deal",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
".",
"putAll",
"(",
"propertiesBuilder",
".",
"build",
"(",
")",
")",
";",
"return",
"props",
";",
"}"
] | Create script execution properties. | [
"Create",
"script",
"execution",
"properties",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java#L313-L324 |
3,378 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java | RuntimeMojoSupport.createContext | protected Map<String, Object> createContext() {
Map<String, Object> context = Maps.newHashMap();
context.put("log", createLogger());
context.put("container", containerHelper);
context.put("plugin", pluginDescriptor);
context.put("pluginContext", getPluginContext());
context.put("mojo", mojoExecution);
context.put("basedir", basedir);
context.put("project", project);
context.put("properties", createProperties());
context.put("session", session);
context.put("settings", settings);
context.put("ant", MagicContext.ANT_BUILDER);
context.put("fail", new FailClosureTarget());
return context;
} | java | protected Map<String, Object> createContext() {
Map<String, Object> context = Maps.newHashMap();
context.put("log", createLogger());
context.put("container", containerHelper);
context.put("plugin", pluginDescriptor);
context.put("pluginContext", getPluginContext());
context.put("mojo", mojoExecution);
context.put("basedir", basedir);
context.put("project", project);
context.put("properties", createProperties());
context.put("session", session);
context.put("settings", settings);
context.put("ant", MagicContext.ANT_BUILDER);
context.put("fail", new FailClosureTarget());
return context;
} | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"createContext",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"context",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"context",
".",
"put",
"(",
"\"log\"",
",",
"createLogger",
"(",
")",
")",
";",
"context",
".",
"put",
"(",
"\"container\"",
",",
"containerHelper",
")",
";",
"context",
".",
"put",
"(",
"\"plugin\"",
",",
"pluginDescriptor",
")",
";",
"context",
".",
"put",
"(",
"\"pluginContext\"",
",",
"getPluginContext",
"(",
")",
")",
";",
"context",
".",
"put",
"(",
"\"mojo\"",
",",
"mojoExecution",
")",
";",
"context",
".",
"put",
"(",
"\"basedir\"",
",",
"basedir",
")",
";",
"context",
".",
"put",
"(",
"\"project\"",
",",
"project",
")",
";",
"context",
".",
"put",
"(",
"\"properties\"",
",",
"createProperties",
"(",
")",
")",
";",
"context",
".",
"put",
"(",
"\"session\"",
",",
"session",
")",
";",
"context",
".",
"put",
"(",
"\"settings\"",
",",
"settings",
")",
";",
"context",
".",
"put",
"(",
"\"ant\"",
",",
"MagicContext",
".",
"ANT_BUILDER",
")",
";",
"context",
".",
"put",
"(",
"\"fail\"",
",",
"new",
"FailClosureTarget",
"(",
")",
")",
";",
"return",
"context",
";",
"}"
] | Configures the context which will be available to executed scripts as binding variables. | [
"Configures",
"the",
"context",
"which",
"will",
"be",
"available",
"to",
"executed",
"scripts",
"as",
"binding",
"variables",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/RuntimeMojoSupport.java#L336-L353 |
3,379 | groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ClassSourceFactory.java | ClassSourceFactory.create | public ClassSource create(final String source) {
checkNotNull(source);
String trimmed = source.trim();
log.trace("Creating class-source from: {}", trimmed);
// First try and parse the source as a URL
try {
return new ClassSourceImpl(new URL(trimmed), null, null);
}
catch (MalformedURLException e) {
log.trace("Not a URL", e);
}
// FIXME: This is _slightly_ problematic as if you have a valid file ref
// FIXME: but the file is missing then it will be treated as inline instead of as a file
// Then as a File
try {
File file = new File(trimmed).getCanonicalFile();
if (file.exists()) {
return new ClassSourceImpl(null, file, null);
}
}
catch (IOException e) {
log.trace("Not a File", e);
}
// Else it is an inline
return new ClassSourceImpl(null, null, new InlineImpl(source));
} | java | public ClassSource create(final String source) {
checkNotNull(source);
String trimmed = source.trim();
log.trace("Creating class-source from: {}", trimmed);
// First try and parse the source as a URL
try {
return new ClassSourceImpl(new URL(trimmed), null, null);
}
catch (MalformedURLException e) {
log.trace("Not a URL", e);
}
// FIXME: This is _slightly_ problematic as if you have a valid file ref
// FIXME: but the file is missing then it will be treated as inline instead of as a file
// Then as a File
try {
File file = new File(trimmed).getCanonicalFile();
if (file.exists()) {
return new ClassSourceImpl(null, file, null);
}
}
catch (IOException e) {
log.trace("Not a File", e);
}
// Else it is an inline
return new ClassSourceImpl(null, null, new InlineImpl(source));
} | [
"public",
"ClassSource",
"create",
"(",
"final",
"String",
"source",
")",
"{",
"checkNotNull",
"(",
"source",
")",
";",
"String",
"trimmed",
"=",
"source",
".",
"trim",
"(",
")",
";",
"log",
".",
"trace",
"(",
"\"Creating class-source from: {}\"",
",",
"trimmed",
")",
";",
"// First try and parse the source as a URL",
"try",
"{",
"return",
"new",
"ClassSourceImpl",
"(",
"new",
"URL",
"(",
"trimmed",
")",
",",
"null",
",",
"null",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"log",
".",
"trace",
"(",
"\"Not a URL\"",
",",
"e",
")",
";",
"}",
"// FIXME: This is _slightly_ problematic as if you have a valid file ref",
"// FIXME: but the file is missing then it will be treated as inline instead of as a file",
"// Then as a File",
"try",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"trimmed",
")",
".",
"getCanonicalFile",
"(",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"ClassSourceImpl",
"(",
"null",
",",
"file",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"trace",
"(",
"\"Not a File\"",
",",
"e",
")",
";",
"}",
"// Else it is an inline",
"return",
"new",
"ClassSourceImpl",
"(",
"null",
",",
"null",
",",
"new",
"InlineImpl",
"(",
"source",
")",
")",
";",
"}"
] | Create a class-source from the given source. | [
"Create",
"a",
"class",
"-",
"source",
"from",
"the",
"given",
"source",
"."
] | 6978316bbc29d9cc6793494e0d1a0a057e47de6c | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ClassSourceFactory.java#L130-L160 |
3,380 | scalecube/socketio | src/main/java/io/scalecube/socketio/SocketIOServer.java | SocketIOServer.start | public synchronized void start() {
if (isStarted()) {
throw new IllegalStateException("Failed to start Socket.IO server: server already started");
}
log.info("Socket.IO server starting");
// Configure heartbeat scheduler
timer = new HashedWheelTimer();
timer.start();
SocketIOHeartbeatScheduler.setHashedWheelTimer(timer);
SocketIOHeartbeatScheduler.setHeartbeatInterval(configuration.getHeartbeatInterval());
SocketIOHeartbeatScheduler.setHeartbeatTimeout(configuration.getHeartbeatTimeout());
// Configure and bind server
ServerBootstrapFactory bootstrapFactory = serverBootstrapFactory != null
? serverBootstrapFactory
: new DefaultServerBootstrapFactory(configuration);
bootstrap = bootstrapFactory.createServerBootstrap();
bootstrap.childHandler(new SocketIOChannelInitializer(configuration, listener, pipelineModifier));
bootstrap.bind(configuration.getPort()).syncUninterruptibly();
state = State.STARTED;
log.info("Socket.IO server started: {}", configuration);
} | java | public synchronized void start() {
if (isStarted()) {
throw new IllegalStateException("Failed to start Socket.IO server: server already started");
}
log.info("Socket.IO server starting");
// Configure heartbeat scheduler
timer = new HashedWheelTimer();
timer.start();
SocketIOHeartbeatScheduler.setHashedWheelTimer(timer);
SocketIOHeartbeatScheduler.setHeartbeatInterval(configuration.getHeartbeatInterval());
SocketIOHeartbeatScheduler.setHeartbeatTimeout(configuration.getHeartbeatTimeout());
// Configure and bind server
ServerBootstrapFactory bootstrapFactory = serverBootstrapFactory != null
? serverBootstrapFactory
: new DefaultServerBootstrapFactory(configuration);
bootstrap = bootstrapFactory.createServerBootstrap();
bootstrap.childHandler(new SocketIOChannelInitializer(configuration, listener, pipelineModifier));
bootstrap.bind(configuration.getPort()).syncUninterruptibly();
state = State.STARTED;
log.info("Socket.IO server started: {}", configuration);
} | [
"public",
"synchronized",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Failed to start Socket.IO server: server already started\"",
")",
";",
"}",
"log",
".",
"info",
"(",
"\"Socket.IO server starting\"",
")",
";",
"// Configure heartbeat scheduler",
"timer",
"=",
"new",
"HashedWheelTimer",
"(",
")",
";",
"timer",
".",
"start",
"(",
")",
";",
"SocketIOHeartbeatScheduler",
".",
"setHashedWheelTimer",
"(",
"timer",
")",
";",
"SocketIOHeartbeatScheduler",
".",
"setHeartbeatInterval",
"(",
"configuration",
".",
"getHeartbeatInterval",
"(",
")",
")",
";",
"SocketIOHeartbeatScheduler",
".",
"setHeartbeatTimeout",
"(",
"configuration",
".",
"getHeartbeatTimeout",
"(",
")",
")",
";",
"// Configure and bind server",
"ServerBootstrapFactory",
"bootstrapFactory",
"=",
"serverBootstrapFactory",
"!=",
"null",
"?",
"serverBootstrapFactory",
":",
"new",
"DefaultServerBootstrapFactory",
"(",
"configuration",
")",
";",
"bootstrap",
"=",
"bootstrapFactory",
".",
"createServerBootstrap",
"(",
")",
";",
"bootstrap",
".",
"childHandler",
"(",
"new",
"SocketIOChannelInitializer",
"(",
"configuration",
",",
"listener",
",",
"pipelineModifier",
")",
")",
";",
"bootstrap",
".",
"bind",
"(",
"configuration",
".",
"getPort",
"(",
")",
")",
".",
"syncUninterruptibly",
"(",
")",
";",
"state",
"=",
"State",
".",
"STARTED",
";",
"log",
".",
"info",
"(",
"\"Socket.IO server started: {}\"",
",",
"configuration",
")",
";",
"}"
] | Starts Socket.IO server with current configuration settings.
@throws IllegalStateException
if server already started | [
"Starts",
"Socket",
".",
"IO",
"server",
"with",
"current",
"configuration",
"settings",
"."
] | bad28fe7a132320750173e7cb71ad6d3688fb626 | https://github.com/scalecube/socketio/blob/bad28fe7a132320750173e7cb71ad6d3688fb626/src/main/java/io/scalecube/socketio/SocketIOServer.java#L103-L127 |
3,381 | scalecube/socketio | src/main/java/io/scalecube/socketio/SocketIOServer.java | SocketIOServer.stop | public synchronized void stop() {
if (isStopped()) {
throw new IllegalStateException("Failed to stop Socket.IO server: server already stopped");
}
log.info("Socket.IO server stopping");
timer.stop();
bootstrap.config().group().shutdownGracefully().syncUninterruptibly();
state = State.STOPPED;
log.info("Socket.IO server stopped");
} | java | public synchronized void stop() {
if (isStopped()) {
throw new IllegalStateException("Failed to stop Socket.IO server: server already stopped");
}
log.info("Socket.IO server stopping");
timer.stop();
bootstrap.config().group().shutdownGracefully().syncUninterruptibly();
state = State.STOPPED;
log.info("Socket.IO server stopped");
} | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"isStopped",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Failed to stop Socket.IO server: server already stopped\"",
")",
";",
"}",
"log",
".",
"info",
"(",
"\"Socket.IO server stopping\"",
")",
";",
"timer",
".",
"stop",
"(",
")",
";",
"bootstrap",
".",
"config",
"(",
")",
".",
"group",
"(",
")",
".",
"shutdownGracefully",
"(",
")",
".",
"syncUninterruptibly",
"(",
")",
";",
"state",
"=",
"State",
".",
"STOPPED",
";",
"log",
".",
"info",
"(",
"\"Socket.IO server stopped\"",
")",
";",
"}"
] | Stops Socket.IO server.
@throws IllegalStateException
if server already stopped | [
"Stops",
"Socket",
".",
"IO",
"server",
"."
] | bad28fe7a132320750173e7cb71ad6d3688fb626 | https://github.com/scalecube/socketio/blob/bad28fe7a132320750173e7cb71ad6d3688fb626/src/main/java/io/scalecube/socketio/SocketIOServer.java#L135-L147 |
3,382 | scalecube/socketio | src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java | ResourceHandler.sendError | private void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) {
HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8");
ByteBuf content = Unpooled.copiedBuffer("Failure: " + status.toString() + "\r\n", CharsetUtil.UTF_8);
ctx.write(response);
// Close the connection as soon as the error message is sent.
ctx.writeAndFlush(content).addListener(ChannelFutureListener.CLOSE);
} | java | private void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) {
HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8");
ByteBuf content = Unpooled.copiedBuffer("Failure: " + status.toString() + "\r\n", CharsetUtil.UTF_8);
ctx.write(response);
// Close the connection as soon as the error message is sent.
ctx.writeAndFlush(content).addListener(ChannelFutureListener.CLOSE);
} | [
"private",
"void",
"sendError",
"(",
"ChannelHandlerContext",
"ctx",
",",
"HttpResponseStatus",
"status",
")",
"{",
"HttpResponse",
"response",
"=",
"new",
"DefaultHttpResponse",
"(",
"HttpVersion",
".",
"HTTP_1_1",
",",
"status",
")",
";",
"response",
".",
"headers",
"(",
")",
".",
"set",
"(",
"HttpHeaderNames",
".",
"CONTENT_TYPE",
",",
"\"text/plain; charset=UTF-8\"",
")",
";",
"ByteBuf",
"content",
"=",
"Unpooled",
".",
"copiedBuffer",
"(",
"\"Failure: \"",
"+",
"status",
".",
"toString",
"(",
")",
"+",
"\"\\r\\n\"",
",",
"CharsetUtil",
".",
"UTF_8",
")",
";",
"ctx",
".",
"write",
"(",
"response",
")",
";",
"// Close the connection as soon as the error message is sent.",
"ctx",
".",
"writeAndFlush",
"(",
"content",
")",
".",
"addListener",
"(",
"ChannelFutureListener",
".",
"CLOSE",
")",
";",
"}"
] | Sends an Error response with status message
@param ctx channel context
@param status status | [
"Sends",
"an",
"Error",
"response",
"with",
"status",
"message"
] | bad28fe7a132320750173e7cb71ad6d3688fb626 | https://github.com/scalecube/socketio/blob/bad28fe7a132320750173e7cb71ad6d3688fb626/src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java#L168-L176 |
3,383 | amazon-archives/aws-scala-sdk | project-generator/src/main/java/com/amazonaws/scala/ProjectGenerator.java | ProjectGenerator.main | public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("usage: generator <basedir>");
System.exit(-1);
}
File baseDir = new File(args[0]);
System.out.println("Using baseDir: " + baseDir.getAbsolutePath());
new ProjectGenerator(baseDir).generate();
} | java | public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("usage: generator <basedir>");
System.exit(-1);
}
File baseDir = new File(args[0]);
System.out.println("Using baseDir: " + baseDir.getAbsolutePath());
new ProjectGenerator(baseDir).generate();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"usage: generator <basedir>\"",
")",
";",
"System",
".",
"exit",
"(",
"-",
"1",
")",
";",
"}",
"File",
"baseDir",
"=",
"new",
"File",
"(",
"args",
"[",
"0",
"]",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Using baseDir: \"",
"+",
"baseDir",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"new",
"ProjectGenerator",
"(",
"baseDir",
")",
".",
"generate",
"(",
")",
";",
"}"
] | Main point of entry from the command line. Pass the base directory for
generation as the only argument. | [
"Main",
"point",
"of",
"entry",
"from",
"the",
"command",
"line",
".",
"Pass",
"the",
"base",
"directory",
"for",
"generation",
"as",
"the",
"only",
"argument",
"."
] | b999cdb8342231a8dce7c59cb40dc2b0b4684224 | https://github.com/amazon-archives/aws-scala-sdk/blob/b999cdb8342231a8dce7c59cb40dc2b0b4684224/project-generator/src/main/java/com/amazonaws/scala/ProjectGenerator.java#L123-L133 |
3,384 | open-pay/openpay-java | src/main/java/mx/openpay/client/Plan.java | Plan.repeatEvery | public Plan repeatEvery(final Integer repeatEvery, final PlanRepeatUnit unit) {
this.repeatEvery = repeatEvery;
this.repeatUnit = unit == null ? null : unit.name().toLowerCase();
return this;
} | java | public Plan repeatEvery(final Integer repeatEvery, final PlanRepeatUnit unit) {
this.repeatEvery = repeatEvery;
this.repeatUnit = unit == null ? null : unit.name().toLowerCase();
return this;
} | [
"public",
"Plan",
"repeatEvery",
"(",
"final",
"Integer",
"repeatEvery",
",",
"final",
"PlanRepeatUnit",
"unit",
")",
"{",
"this",
".",
"repeatEvery",
"=",
"repeatEvery",
";",
"this",
".",
"repeatUnit",
"=",
"unit",
"==",
"null",
"?",
"null",
":",
"unit",
".",
"name",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"return",
"this",
";",
"}"
] | The duration of each cycle. Required. | [
"The",
"duration",
"of",
"each",
"cycle",
".",
"Required",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/Plan.java#L84-L88 |
3,385 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/ChargeOperations.java | ChargeOperations.createCharge | public Charge createCharge(RequestBuilder request) throws OpenpayServiceException, ServiceUnavailableException {
String path = String.format(FOR_MERCHANT_PATH, this.getMerchantId());
return this.getJsonClient().post(path, request.asMap(), Charge.class);
} | java | public Charge createCharge(RequestBuilder request) throws OpenpayServiceException, ServiceUnavailableException {
String path = String.format(FOR_MERCHANT_PATH, this.getMerchantId());
return this.getJsonClient().post(path, request.asMap(), Charge.class);
} | [
"public",
"Charge",
"createCharge",
"(",
"RequestBuilder",
"request",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"FOR_MERCHANT_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"post",
"(",
"path",
",",
"request",
".",
"asMap",
"(",
")",
",",
"Charge",
".",
"class",
")",
";",
"}"
] | Creates any kind of charge at the Merchant level.
@param request Generic request params.
@return Charge data returned by Openpay
@throws OpenpayServiceException When Openpay returns an error response
@throws ServiceUnavailableException When an unexpected communication error occurs.
@since 1.0.10 | [
"Creates",
"any",
"kind",
"of",
"charge",
"at",
"the",
"Merchant",
"level",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/ChargeOperations.java#L84-L87 |
3,386 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/ChargeOperations.java | ChargeOperations.confirmCapture | public Charge confirmCapture(final ConfirmCaptureParams params) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(CAPTURE_FOR_MERCHANT_PATH, this.getMerchantId(), params.getChargeId());
return this.getJsonClient().post(path, params.asMap(), Charge.class);
} | java | public Charge confirmCapture(final ConfirmCaptureParams params) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(CAPTURE_FOR_MERCHANT_PATH, this.getMerchantId(), params.getChargeId());
return this.getJsonClient().post(path, params.asMap(), Charge.class);
} | [
"public",
"Charge",
"confirmCapture",
"(",
"final",
"ConfirmCaptureParams",
"params",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"CAPTURE_FOR_MERCHANT_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
",",
"params",
".",
"getChargeId",
"(",
")",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"post",
"(",
"path",
",",
"params",
".",
"asMap",
"(",
")",
",",
"Charge",
".",
"class",
")",
";",
"}"
] | Confirms a charge that was made with the option capture set to false. | [
"Confirms",
"a",
"charge",
"that",
"was",
"made",
"with",
"the",
"option",
"capture",
"set",
"to",
"false",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/ChargeOperations.java#L155-L159 |
3,387 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/ChargeOperations.java | ChargeOperations.confirmCharge | public Charge confirmCharge(final ConfirmChargeParams params) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(CONFIRM_FOR_MERCHANT_PATH, this.getMerchantId(), params.getChargeId());
return this.getJsonClient().post(path, params.asMap(), Charge.class);
} | java | public Charge confirmCharge(final ConfirmChargeParams params) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(CONFIRM_FOR_MERCHANT_PATH, this.getMerchantId(), params.getChargeId());
return this.getJsonClient().post(path, params.asMap(), Charge.class);
} | [
"public",
"Charge",
"confirmCharge",
"(",
"final",
"ConfirmChargeParams",
"params",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"CONFIRM_FOR_MERCHANT_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
",",
"params",
".",
"getChargeId",
"(",
")",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"post",
"(",
"path",
",",
"params",
".",
"asMap",
"(",
")",
",",
"Charge",
".",
"class",
")",
";",
"}"
] | Confirms a charge that was made with the option confirm set to false. | [
"Confirms",
"a",
"charge",
"that",
"was",
"made",
"with",
"the",
"option",
"confirm",
"set",
"to",
"false",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/ChargeOperations.java#L174-L178 |
3,388 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/ChargeOperations.java | ChargeOperations.create | @Deprecated
public Charge create(final String customerId, final CreateStoreChargeParams request)
throws OpenpayServiceException, ServiceUnavailableException {
return createCharge(customerId, request);
} | java | @Deprecated
public Charge create(final String customerId, final CreateStoreChargeParams request)
throws OpenpayServiceException, ServiceUnavailableException {
return createCharge(customerId, request);
} | [
"@",
"Deprecated",
"public",
"Charge",
"create",
"(",
"final",
"String",
"customerId",
",",
"final",
"CreateStoreChargeParams",
"request",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"return",
"createCharge",
"(",
"customerId",
",",
"request",
")",
";",
"}"
] | Creates a store charge at the Customer level.
@param customerId ID of the Customer created previously in Openpay.
@param request Store charge params
@return Charge data returned by Openpay
@throws OpenpayServiceException When Openpay returns an error response
@throws ServiceUnavailableException When an unexpected communication error occurs.
@deprecated You can use {@link #createCharge(String, RequestBuilder)} for all charge methods. | [
"Creates",
"a",
"store",
"charge",
"at",
"the",
"Customer",
"level",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/ChargeOperations.java#L341-L345 |
3,389 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java | OpenpayFeesOperations.getSummary | public OpenpayFeesSummary getSummary(final int year, final int month) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(FEES_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
return this.getJsonClient().get(path, params, OpenpayFeesSummary.class);
} | java | public OpenpayFeesSummary getSummary(final int year, final int month) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(FEES_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
return this.getJsonClient().get(path, params, OpenpayFeesSummary.class);
} | [
"public",
"OpenpayFeesSummary",
"getSummary",
"(",
"final",
"int",
"year",
",",
"final",
"int",
"month",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"FEES_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"year\"",
",",
"String",
".",
"valueOf",
"(",
"year",
")",
")",
";",
"params",
".",
"put",
"(",
"\"month\"",
",",
"String",
".",
"valueOf",
"(",
"month",
")",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"get",
"(",
"path",
",",
"params",
",",
"OpenpayFeesSummary",
".",
"class",
")",
";",
"}"
] | Retrieve the summary of the charged fees in the given month. The amounts retrieved in the current month may
change on a daily basis.
@param year Year of the date to retrieve
@param month Month to retrieve
@return The summary of the fees charged by Openpay.
@throws OpenpayServiceException If the service returns an error
@throws ServiceUnavailableException If the service is not available | [
"Retrieve",
"the",
"summary",
"of",
"the",
"charged",
"fees",
"in",
"the",
"given",
"month",
".",
"The",
"amounts",
"retrieved",
"in",
"the",
"current",
"month",
"may",
"change",
"on",
"a",
"daily",
"basis",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java#L58-L65 |
3,390 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java | OpenpayFeesOperations.getDetails | public List<GenericTransaction> getDetails(final int year, final int month, final FeeDetailsType feeType,
final PaginationParams pagination) throws OpenpayServiceException, ServiceUnavailableException {
String path = String.format(FEES_DETAILS_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
if (pagination != null) {
params.putAll(pagination.asMap());
}
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
params.put("fee_type", feeType.name().toLowerCase());
return this.getJsonClient().list(path, params, GenericTransaction.class);
} | java | public List<GenericTransaction> getDetails(final int year, final int month, final FeeDetailsType feeType,
final PaginationParams pagination) throws OpenpayServiceException, ServiceUnavailableException {
String path = String.format(FEES_DETAILS_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
if (pagination != null) {
params.putAll(pagination.asMap());
}
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
params.put("fee_type", feeType.name().toLowerCase());
return this.getJsonClient().list(path, params, GenericTransaction.class);
} | [
"public",
"List",
"<",
"GenericTransaction",
">",
"getDetails",
"(",
"final",
"int",
"year",
",",
"final",
"int",
"month",
",",
"final",
"FeeDetailsType",
"feeType",
",",
"final",
"PaginationParams",
"pagination",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"FEES_DETAILS_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",
"pagination",
"!=",
"null",
")",
"{",
"params",
".",
"putAll",
"(",
"pagination",
".",
"asMap",
"(",
")",
")",
";",
"}",
"params",
".",
"put",
"(",
"\"year\"",
",",
"String",
".",
"valueOf",
"(",
"year",
")",
")",
";",
"params",
".",
"put",
"(",
"\"month\"",
",",
"String",
".",
"valueOf",
"(",
"month",
")",
")",
";",
"params",
".",
"put",
"(",
"\"fee_type\"",
",",
"feeType",
".",
"name",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"list",
"(",
"path",
",",
"params",
",",
"GenericTransaction",
".",
"class",
")",
";",
"}"
] | Retrieves the list of transactions that affected the charged or refunded fees on a given month. Transactions in
the CHARGED or REFUNDED type of detail add their fee to the total, while the ones in CHARGED_ADJUSTMENTS and
REFUNDED_ADJUSTMENTS add their amount.
@param year Year to report
@param month Month to report
@param feeType Type of the details to get.
@param pagination Pagination. Optional, retrieves the latest 10 transactions if ommited.
@return List of transactions that affect the fees in the given month.
@throws ServiceUnavailableException
@throws OpenpayServiceException | [
"Retrieves",
"the",
"list",
"of",
"transactions",
"that",
"affected",
"the",
"charged",
"or",
"refunded",
"fees",
"on",
"a",
"given",
"month",
".",
"Transactions",
"in",
"the",
"CHARGED",
"or",
"REFUNDED",
"type",
"of",
"detail",
"add",
"their",
"fee",
"to",
"the",
"total",
"while",
"the",
"ones",
"in",
"CHARGED_ADJUSTMENTS",
"and",
"REFUNDED_ADJUSTMENTS",
"add",
"their",
"amount",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java#L79-L90 |
3,391 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/requests/RequestBuilder.java | RequestBuilder.with | @SuppressWarnings("unchecked")
public <T extends RequestBuilder> T with(final String jsonParam, final Object obj) {
this.parameters.put(jsonParam, obj);
return (T) this;
} | java | @SuppressWarnings("unchecked")
public <T extends RequestBuilder> T with(final String jsonParam, final Object obj) {
this.parameters.put(jsonParam, obj);
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"RequestBuilder",
">",
"T",
"with",
"(",
"final",
"String",
"jsonParam",
",",
"final",
"Object",
"obj",
")",
"{",
"this",
".",
"parameters",
".",
"put",
"(",
"jsonParam",
",",
"obj",
")",
";",
"return",
"(",
"T",
")",
"this",
";",
"}"
] | Adds the given parameter to the map and returns this same object.
@param jsonParam JSON name of the parameter to add
@param obj Object to add to the map
@return This same object | [
"Adds",
"the",
"given",
"parameter",
"to",
"the",
"map",
"and",
"returns",
"this",
"same",
"object",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/requests/RequestBuilder.java#L37-L41 |
3,392 | open-pay/openpay-java | src/main/java/mx/openpay/client/Webhook.java | Webhook.addEventTypes | public Webhook addEventTypes(final String eventType) {
if (this.eventTypes == null) {
this.eventTypes = new ArrayList<String>();
}
this.eventTypes.add(eventType);
return this;
} | java | public Webhook addEventTypes(final String eventType) {
if (this.eventTypes == null) {
this.eventTypes = new ArrayList<String>();
}
this.eventTypes.add(eventType);
return this;
} | [
"public",
"Webhook",
"addEventTypes",
"(",
"final",
"String",
"eventType",
")",
"{",
"if",
"(",
"this",
".",
"eventTypes",
"==",
"null",
")",
"{",
"this",
".",
"eventTypes",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"}",
"this",
".",
"eventTypes",
".",
"add",
"(",
"eventType",
")",
";",
"return",
"this",
";",
"}"
] | Webhook eventType. Required.
@return Returns the object Webhook | [
"Webhook",
"eventType",
".",
"Required",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/Webhook.java#L112-L118 |
3,393 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/TransactionsPayoutOperations.java | TransactionsPayoutOperations.getResume | public TransactionsPayoutResume getResume(final String payoutId) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(PAYOUT_TRANSACTIONS_PATH, this.getMerchantId(), payoutId);
return this.getJsonClient().get(path, TransactionsPayoutResume.class);
} | java | public TransactionsPayoutResume getResume(final String payoutId) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(PAYOUT_TRANSACTIONS_PATH, this.getMerchantId(), payoutId);
return this.getJsonClient().get(path, TransactionsPayoutResume.class);
} | [
"public",
"TransactionsPayoutResume",
"getResume",
"(",
"final",
"String",
"payoutId",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"PAYOUT_TRANSACTIONS_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
",",
"payoutId",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"get",
"(",
"path",
",",
"TransactionsPayoutResume",
".",
"class",
")",
";",
"}"
] | Retrieve the resume of the transactions of the given payoutid.
@param payoutId
The payoutid.
@return The transactions resume.
@throws OpenpayServiceException
If the service returns an error
@throws ServiceUnavailableException
If the service is not available | [
"Retrieve",
"the",
"resume",
"of",
"the",
"transactions",
"of",
"the",
"given",
"payoutid",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/TransactionsPayoutOperations.java#L62-L66 |
3,394 | open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/TransactionsPayoutOperations.java | TransactionsPayoutOperations.getDetails | public List<GenericTransaction> getDetails(final String payoutId,
final TransactionsPayoutType transactionsPayoutType,
final PaginationParams pagination) throws OpenpayServiceException, ServiceUnavailableException {
String path = String.format(PAYOUT_TRANSACTIONS_DETAILS_PATH, this.getMerchantId(), payoutId);
Map<String, String> params = new HashMap<String, String>();
if (pagination != null) {
params.putAll(pagination.asMap());
}
params.put("detail_type", transactionsPayoutType.name().toLowerCase());
return this.getJsonClient().list(path, params, GenericTransaction.class);
} | java | public List<GenericTransaction> getDetails(final String payoutId,
final TransactionsPayoutType transactionsPayoutType,
final PaginationParams pagination) throws OpenpayServiceException, ServiceUnavailableException {
String path = String.format(PAYOUT_TRANSACTIONS_DETAILS_PATH, this.getMerchantId(), payoutId);
Map<String, String> params = new HashMap<String, String>();
if (pagination != null) {
params.putAll(pagination.asMap());
}
params.put("detail_type", transactionsPayoutType.name().toLowerCase());
return this.getJsonClient().list(path, params, GenericTransaction.class);
} | [
"public",
"List",
"<",
"GenericTransaction",
">",
"getDetails",
"(",
"final",
"String",
"payoutId",
",",
"final",
"TransactionsPayoutType",
"transactionsPayoutType",
",",
"final",
"PaginationParams",
"pagination",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"PAYOUT_TRANSACTIONS_DETAILS_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
",",
"payoutId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",
"pagination",
"!=",
"null",
")",
"{",
"params",
".",
"putAll",
"(",
"pagination",
".",
"asMap",
"(",
")",
")",
";",
"}",
"params",
".",
"put",
"(",
"\"detail_type\"",
",",
"transactionsPayoutType",
".",
"name",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"list",
"(",
"path",
",",
"params",
",",
"GenericTransaction",
".",
"class",
")",
";",
"}"
] | Retrieves the list of transactions that affected the payout. .
Transactions in the IN or OUT type of detail add their fee to the total,
while the ones in CHARGED_ADJUSTMENTS and REFUNDED_ADJUSTMENTS add their
amount.
@param payoutId
the payout id
@param transactionsPayoutType
the transactions payout type
@param pagination
Pagination. Optional, retrieves the latest 10 transactions if
ommited.
@return List of transactions .
@throws OpenpayServiceException
the openpay service exception
@throws ServiceUnavailableException
the service unavailable exception | [
"Retrieves",
"the",
"list",
"of",
"transactions",
"that",
"affected",
"the",
"payout",
".",
".",
"Transactions",
"in",
"the",
"IN",
"or",
"OUT",
"type",
"of",
"detail",
"add",
"their",
"fee",
"to",
"the",
"total",
"while",
"the",
"ones",
"in",
"CHARGED_ADJUSTMENTS",
"and",
"REFUNDED_ADJUSTMENTS",
"add",
"their",
"amount",
"."
] | 7f4220466b394dd54e2b1642821dde7daebc5433 | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/TransactionsPayoutOperations.java#L87-L97 |
3,395 | fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/activation/First.java | First.configure | @Override
public void configure(String parameters) {
if (parameters.isEmpty()) {
return;
}
List<String> values = Op.split(parameters, " ", true);
final int required = 2;
if (values.size() < required) {
throw new RuntimeException(MessageFormat.format(
"[configuration error] activation {0} requires {1} parameters",
this.getClass().getSimpleName(), required));
}
setNumberOfRules(Integer.parseInt(values.get(0)));
setThreshold(Op.toDouble(values.get(1)));
} | java | @Override
public void configure(String parameters) {
if (parameters.isEmpty()) {
return;
}
List<String> values = Op.split(parameters, " ", true);
final int required = 2;
if (values.size() < required) {
throw new RuntimeException(MessageFormat.format(
"[configuration error] activation {0} requires {1} parameters",
this.getClass().getSimpleName(), required));
}
setNumberOfRules(Integer.parseInt(values.get(0)));
setThreshold(Op.toDouble(values.get(1)));
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
"String",
"parameters",
")",
"{",
"if",
"(",
"parameters",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"List",
"<",
"String",
">",
"values",
"=",
"Op",
".",
"split",
"(",
"parameters",
",",
"\" \"",
",",
"true",
")",
";",
"final",
"int",
"required",
"=",
"2",
";",
"if",
"(",
"values",
".",
"size",
"(",
")",
"<",
"required",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"MessageFormat",
".",
"format",
"(",
"\"[configuration error] activation {0} requires {1} parameters\"",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"required",
")",
")",
";",
"}",
"setNumberOfRules",
"(",
"Integer",
".",
"parseInt",
"(",
"values",
".",
"get",
"(",
"0",
")",
")",
")",
";",
"setThreshold",
"(",
"Op",
".",
"toDouble",
"(",
"values",
".",
"get",
"(",
"1",
")",
")",
")",
";",
"}"
] | Configures the activation method with the given number of rules and
threshold
@param parameters as "numberOfRules threshold" | [
"Configures",
"the",
"activation",
"method",
"with",
"the",
"given",
"number",
"of",
"rules",
"and",
"threshold"
] | 583ac1928f39512af75de80d560e67448039595a | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/activation/First.java#L77-L92 |
3,396 | fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/term/Linear.java | Linear.create | public static Linear create(String name, Engine engine,
double... coefficients) {
List<Double> coefficientsList = new ArrayList<Double>(coefficients.length);
for (double coefficient : coefficients) {
coefficientsList.add(coefficient);
}
return new Linear(name, coefficientsList, engine);
} | java | public static Linear create(String name, Engine engine,
double... coefficients) {
List<Double> coefficientsList = new ArrayList<Double>(coefficients.length);
for (double coefficient : coefficients) {
coefficientsList.add(coefficient);
}
return new Linear(name, coefficientsList, engine);
} | [
"public",
"static",
"Linear",
"create",
"(",
"String",
"name",
",",
"Engine",
"engine",
",",
"double",
"...",
"coefficients",
")",
"{",
"List",
"<",
"Double",
">",
"coefficientsList",
"=",
"new",
"ArrayList",
"<",
"Double",
">",
"(",
"coefficients",
".",
"length",
")",
";",
"for",
"(",
"double",
"coefficient",
":",
"coefficients",
")",
"{",
"coefficientsList",
".",
"add",
"(",
"coefficient",
")",
";",
"}",
"return",
"new",
"Linear",
"(",
"name",
",",
"coefficientsList",
",",
"engine",
")",
";",
"}"
] | Creates a Linear term from a variadic set of coefficients. The number of
variadic arguments should be the same as the number of input variables in
the engine plus one in order to match the size of the list
`\mathbf{c}^\star`
@param name is the name of the term
@param engine is the engine from which the vector `\mathbf{v}` will be
obtained
@param coefficients is a variadic number of coefficients
@return a new Linear term with the given parameters | [
"Creates",
"a",
"Linear",
"term",
"from",
"a",
"variadic",
"set",
"of",
"coefficients",
".",
"The",
"number",
"of",
"variadic",
"arguments",
"should",
"be",
"the",
"same",
"as",
"the",
"number",
"of",
"input",
"variables",
"in",
"the",
"engine",
"plus",
"one",
"in",
"order",
"to",
"match",
"the",
"size",
"of",
"the",
"list"
] | 583ac1928f39512af75de80d560e67448039595a | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/term/Linear.java#L108-L115 |
3,397 | fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/factory/CloningFactory.java | CloningFactory.getObject | public T getObject(String key) {
if (this.objects.containsKey(key)) {
return this.objects.get(key);
}
return null;
} | java | public T getObject(String key) {
if (this.objects.containsKey(key)) {
return this.objects.get(key);
}
return null;
} | [
"public",
"T",
"getObject",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"this",
".",
"objects",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"this",
".",
"objects",
".",
"get",
"(",
"key",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Gets the object registered by the given key, not a clone of the object
@param key is the unique name by which objects are registered
@return the object registered by the given key | [
"Gets",
"the",
"object",
"registered",
"by",
"the",
"given",
"key",
"not",
"a",
"clone",
"of",
"the",
"object"
] | 583ac1928f39512af75de80d560e67448039595a | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/factory/CloningFactory.java#L81-L86 |
3,398 | fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/factory/CloningFactory.java | CloningFactory.cloneObject | @SuppressWarnings("unchecked")
public T cloneObject(String key) {
if (this.objects.containsKey(key)) {
T object = this.objects.get(key);
if (object != null) {
try {
return (T) object.clone();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
return null;
}
throw new RuntimeException("[cloning error] object by name <" + key
+ "> not registered in " + getClass().getSimpleName());
} | java | @SuppressWarnings("unchecked")
public T cloneObject(String key) {
if (this.objects.containsKey(key)) {
T object = this.objects.get(key);
if (object != null) {
try {
return (T) object.clone();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
return null;
}
throw new RuntimeException("[cloning error] object by name <" + key
+ "> not registered in " + getClass().getSimpleName());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"cloneObject",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"this",
".",
"objects",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"T",
"object",
"=",
"this",
".",
"objects",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"object",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"object",
".",
"clone",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ex",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"throw",
"new",
"RuntimeException",
"(",
"\"[cloning error] object by name <\"",
"+",
"key",
"+",
"\"> not registered in \"",
"+",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] | Creates a cloned object by executing the clone method on the registered
object
@param key is the unique name by which objects are registered
@return a cloned object by executing the clone method on the registered
object | [
"Creates",
"a",
"cloned",
"object",
"by",
"executing",
"the",
"clone",
"method",
"on",
"the",
"registered",
"object"
] | 583ac1928f39512af75de80d560e67448039595a | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/factory/CloningFactory.java#L96-L111 |
3,399 | fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/Engine.java | Engine.configure | public void configure(String conjunction, String disjunction,
String implication, String aggregation,
String defuzzifier, String activation) {
TNormFactory tnormFactory = FactoryManager.instance().tnorm();
SNormFactory snormFactory = FactoryManager.instance().snorm();
TNorm conjunctionObject = tnormFactory.constructObject(conjunction);
SNorm disjunctionObject = snormFactory.constructObject(disjunction);
TNorm implicationObject = tnormFactory.constructObject(implication);
SNorm aggregationObject = snormFactory.constructObject(aggregation);
Defuzzifier defuzzifierObject = FactoryManager.instance().defuzzifier().constructObject(defuzzifier);
Activation activationObject = FactoryManager.instance().activation().constructObject(activation);
configure(conjunctionObject, disjunctionObject, implicationObject,
aggregationObject, defuzzifierObject, activationObject);
} | java | public void configure(String conjunction, String disjunction,
String implication, String aggregation,
String defuzzifier, String activation) {
TNormFactory tnormFactory = FactoryManager.instance().tnorm();
SNormFactory snormFactory = FactoryManager.instance().snorm();
TNorm conjunctionObject = tnormFactory.constructObject(conjunction);
SNorm disjunctionObject = snormFactory.constructObject(disjunction);
TNorm implicationObject = tnormFactory.constructObject(implication);
SNorm aggregationObject = snormFactory.constructObject(aggregation);
Defuzzifier defuzzifierObject = FactoryManager.instance().defuzzifier().constructObject(defuzzifier);
Activation activationObject = FactoryManager.instance().activation().constructObject(activation);
configure(conjunctionObject, disjunctionObject, implicationObject,
aggregationObject, defuzzifierObject, activationObject);
} | [
"public",
"void",
"configure",
"(",
"String",
"conjunction",
",",
"String",
"disjunction",
",",
"String",
"implication",
",",
"String",
"aggregation",
",",
"String",
"defuzzifier",
",",
"String",
"activation",
")",
"{",
"TNormFactory",
"tnormFactory",
"=",
"FactoryManager",
".",
"instance",
"(",
")",
".",
"tnorm",
"(",
")",
";",
"SNormFactory",
"snormFactory",
"=",
"FactoryManager",
".",
"instance",
"(",
")",
".",
"snorm",
"(",
")",
";",
"TNorm",
"conjunctionObject",
"=",
"tnormFactory",
".",
"constructObject",
"(",
"conjunction",
")",
";",
"SNorm",
"disjunctionObject",
"=",
"snormFactory",
".",
"constructObject",
"(",
"disjunction",
")",
";",
"TNorm",
"implicationObject",
"=",
"tnormFactory",
".",
"constructObject",
"(",
"implication",
")",
";",
"SNorm",
"aggregationObject",
"=",
"snormFactory",
".",
"constructObject",
"(",
"aggregation",
")",
";",
"Defuzzifier",
"defuzzifierObject",
"=",
"FactoryManager",
".",
"instance",
"(",
")",
".",
"defuzzifier",
"(",
")",
".",
"constructObject",
"(",
"defuzzifier",
")",
";",
"Activation",
"activationObject",
"=",
"FactoryManager",
".",
"instance",
"(",
")",
".",
"activation",
"(",
")",
".",
"constructObject",
"(",
"activation",
")",
";",
"configure",
"(",
"conjunctionObject",
",",
"disjunctionObject",
",",
"implicationObject",
",",
"aggregationObject",
",",
"defuzzifierObject",
",",
"activationObject",
")",
";",
"}"
] | Configures the engine with the given operators
@param conjunction is a TNorm registered in the TNormFactory
@param disjunction is an SNorm registered in the SNormFactory
@param implication is an TNorm registered in the TNormFactory
@param aggregation is an SNorm registered in the SNormFactory
@param defuzzifier is a defuzzifier registered in the DefuzzifierFactory
@param activation is an activation method registered in the
ActivationFactory | [
"Configures",
"the",
"engine",
"with",
"the",
"given",
"operators"
] | 583ac1928f39512af75de80d560e67448039595a | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/Engine.java#L124-L139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.