repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
204
| func_name
stringlengths 5
103
| whole_func_string
stringlengths 87
3.44k
| language
stringclasses 1
value | func_code_string
stringlengths 87
3.44k
| func_code_tokens
sequencelengths 21
714
| func_documentation_string
stringlengths 61
1.95k
| func_documentation_tokens
sequencelengths 1
482
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
309
|
---|---|---|---|---|---|---|---|---|---|---|
threerings/nenya | tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java | MapFileTileSetIDBroker.readMapFile | public static void readMapFile (BufferedReader bin, HashMap<String, Integer> map)
throws IOException
{
String line;
while ((line = bin.readLine()) != null) {
int eidx = line.indexOf(SEP_STR);
if (eidx == -1) {
throw new IOException("Malformed line, no '" + SEP_STR +
"': '" + line + "'");
}
try {
String code = line.substring(eidx+SEP_STR.length());
map.put(line.substring(0, eidx), Integer.valueOf(code));
} catch (NumberFormatException nfe) {
String errmsg = "Malformed line, invalid code: '" + line + "'";
throw new IOException(errmsg);
}
}
} | java | public static void readMapFile (BufferedReader bin, HashMap<String, Integer> map)
throws IOException
{
String line;
while ((line = bin.readLine()) != null) {
int eidx = line.indexOf(SEP_STR);
if (eidx == -1) {
throw new IOException("Malformed line, no '" + SEP_STR +
"': '" + line + "'");
}
try {
String code = line.substring(eidx+SEP_STR.length());
map.put(line.substring(0, eidx), Integer.valueOf(code));
} catch (NumberFormatException nfe) {
String errmsg = "Malformed line, invalid code: '" + line + "'";
throw new IOException(errmsg);
}
}
} | [
"public",
"static",
"void",
"readMapFile",
"(",
"BufferedReader",
"bin",
",",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"map",
")",
"throws",
"IOException",
"{",
"String",
"line",
";",
"while",
"(",
"(",
"line",
"=",
"bin",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"int",
"eidx",
"=",
"line",
".",
"indexOf",
"(",
"SEP_STR",
")",
";",
"if",
"(",
"eidx",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Malformed line, no '\"",
"+",
"SEP_STR",
"+",
"\"': '\"",
"+",
"line",
"+",
"\"'\"",
")",
";",
"}",
"try",
"{",
"String",
"code",
"=",
"line",
".",
"substring",
"(",
"eidx",
"+",
"SEP_STR",
".",
"length",
"(",
")",
")",
";",
"map",
".",
"put",
"(",
"line",
".",
"substring",
"(",
"0",
",",
"eidx",
")",
",",
"Integer",
".",
"valueOf",
"(",
"code",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"String",
"errmsg",
"=",
"\"Malformed line, invalid code: '\"",
"+",
"line",
"+",
"\"'\"",
";",
"throw",
"new",
"IOException",
"(",
"errmsg",
")",
";",
"}",
"}",
"}"
] | Reads in a mapping from strings to integers, which should have been
written via {@link #writeMapFile}. | [
"Reads",
"in",
"a",
"mapping",
"from",
"strings",
"to",
"integers",
"which",
"should",
"have",
"been",
"written",
"via",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/tools/MapFileTileSetIDBroker.java#L138-L156 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java | ScenarioPortrayal.updateDataSerieToHistogram | public void updateDataSerieToHistogram(String histogramID, double[] dataSerie, int index){
this.histograms.get(histogramID).updateSeries(index, dataSerie);
} | java | public void updateDataSerieToHistogram(String histogramID, double[] dataSerie, int index){
this.histograms.get(histogramID).updateSeries(index, dataSerie);
} | [
"public",
"void",
"updateDataSerieToHistogram",
"(",
"String",
"histogramID",
",",
"double",
"[",
"]",
"dataSerie",
",",
"int",
"index",
")",
"{",
"this",
".",
"histograms",
".",
"get",
"(",
"histogramID",
")",
".",
"updateSeries",
"(",
"index",
",",
"dataSerie",
")",
";",
"}"
] | Updates the given Histogram (index).
The index will be the order of the histogram.
@param histogramID
@param dataSerie
@param index | [
"Updates",
"the",
"given",
"Histogram",
"(",
"index",
")",
".",
"The",
"index",
"will",
"be",
"the",
"order",
"of",
"the",
"histogram",
"."
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L442-L444 |
avarabyeu/restendpoint | src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java | StringSerializer.canRead | @Override
public boolean canRead(@Nonnull MediaType mimeType, Type resultType) {
MediaType type = mimeType.withoutParameters();
return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type)
|| MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(TypeToken.of(resultType).getRawType());
} | java | @Override
public boolean canRead(@Nonnull MediaType mimeType, Type resultType) {
MediaType type = mimeType.withoutParameters();
return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type)
|| MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(TypeToken.of(resultType).getRawType());
} | [
"@",
"Override",
"public",
"boolean",
"canRead",
"(",
"@",
"Nonnull",
"MediaType",
"mimeType",
",",
"Type",
"resultType",
")",
"{",
"MediaType",
"type",
"=",
"mimeType",
".",
"withoutParameters",
"(",
")",
";",
"return",
"(",
"type",
".",
"is",
"(",
"MediaType",
".",
"ANY_TEXT_TYPE",
")",
"||",
"MediaType",
".",
"APPLICATION_XML_UTF_8",
".",
"withoutParameters",
"(",
")",
".",
"is",
"(",
"type",
")",
"||",
"MediaType",
".",
"JSON_UTF_8",
".",
"withoutParameters",
"(",
")",
".",
"is",
"(",
"type",
")",
")",
"&&",
"String",
".",
"class",
".",
"equals",
"(",
"TypeToken",
".",
"of",
"(",
"resultType",
")",
".",
"getRawType",
"(",
")",
")",
";",
"}"
] | Checks whether mime types is supported by this serializer implementation | [
"Checks",
"whether",
"mime",
"types",
"is",
"supported",
"by",
"this",
"serializer",
"implementation"
] | train | https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java#L87-L92 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketFactory.java | SocketFactory.createWebSocketAdapter | protected WebSocketAdapter createWebSocketAdapter(@NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) {
return new WebSocketAdapter() {
@Override
public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception {
super.onConnected(websocket, headers);
final SocketStateListener stateListener = stateListenerWeakReference.get();
if (stateListener != null) {
stateListener.onConnected();
}
}
@Override
public void onConnectError(WebSocket websocket, WebSocketException exception) throws Exception {
super.onConnectError(websocket, exception);
final SocketStateListener stateListener = stateListenerWeakReference.get();
if (stateListener != null) {
stateListener.onError(uri.getRawPath(), proxyAddress, exception);
}
}
@Override
public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception {
super.onDisconnected(websocket, serverCloseFrame, clientCloseFrame, closedByServer);
final SocketStateListener stateListener = stateListenerWeakReference.get();
if (stateListener != null) {
stateListener.onDisconnected();
}
}
@Override
public void onTextMessage(WebSocket websocket, String text) throws Exception {
super.onTextMessage(websocket, text);
log.d("Socket message received = " + text);
messageListener.onMessage(text);
}
@Override
public void onBinaryMessage(WebSocket websocket, byte[] binary) throws Exception {
super.onBinaryMessage(websocket, binary);
log.d("Socket binary message received.");
}
};
} | java | protected WebSocketAdapter createWebSocketAdapter(@NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) {
return new WebSocketAdapter() {
@Override
public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception {
super.onConnected(websocket, headers);
final SocketStateListener stateListener = stateListenerWeakReference.get();
if (stateListener != null) {
stateListener.onConnected();
}
}
@Override
public void onConnectError(WebSocket websocket, WebSocketException exception) throws Exception {
super.onConnectError(websocket, exception);
final SocketStateListener stateListener = stateListenerWeakReference.get();
if (stateListener != null) {
stateListener.onError(uri.getRawPath(), proxyAddress, exception);
}
}
@Override
public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception {
super.onDisconnected(websocket, serverCloseFrame, clientCloseFrame, closedByServer);
final SocketStateListener stateListener = stateListenerWeakReference.get();
if (stateListener != null) {
stateListener.onDisconnected();
}
}
@Override
public void onTextMessage(WebSocket websocket, String text) throws Exception {
super.onTextMessage(websocket, text);
log.d("Socket message received = " + text);
messageListener.onMessage(text);
}
@Override
public void onBinaryMessage(WebSocket websocket, byte[] binary) throws Exception {
super.onBinaryMessage(websocket, binary);
log.d("Socket binary message received.");
}
};
} | [
"protected",
"WebSocketAdapter",
"createWebSocketAdapter",
"(",
"@",
"NonNull",
"final",
"WeakReference",
"<",
"SocketStateListener",
">",
"stateListenerWeakReference",
")",
"{",
"return",
"new",
"WebSocketAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onConnected",
"(",
"WebSocket",
"websocket",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
")",
"throws",
"Exception",
"{",
"super",
".",
"onConnected",
"(",
"websocket",
",",
"headers",
")",
";",
"final",
"SocketStateListener",
"stateListener",
"=",
"stateListenerWeakReference",
".",
"get",
"(",
")",
";",
"if",
"(",
"stateListener",
"!=",
"null",
")",
"{",
"stateListener",
".",
"onConnected",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"onConnectError",
"(",
"WebSocket",
"websocket",
",",
"WebSocketException",
"exception",
")",
"throws",
"Exception",
"{",
"super",
".",
"onConnectError",
"(",
"websocket",
",",
"exception",
")",
";",
"final",
"SocketStateListener",
"stateListener",
"=",
"stateListenerWeakReference",
".",
"get",
"(",
")",
";",
"if",
"(",
"stateListener",
"!=",
"null",
")",
"{",
"stateListener",
".",
"onError",
"(",
"uri",
".",
"getRawPath",
"(",
")",
",",
"proxyAddress",
",",
"exception",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"onDisconnected",
"(",
"WebSocket",
"websocket",
",",
"WebSocketFrame",
"serverCloseFrame",
",",
"WebSocketFrame",
"clientCloseFrame",
",",
"boolean",
"closedByServer",
")",
"throws",
"Exception",
"{",
"super",
".",
"onDisconnected",
"(",
"websocket",
",",
"serverCloseFrame",
",",
"clientCloseFrame",
",",
"closedByServer",
")",
";",
"final",
"SocketStateListener",
"stateListener",
"=",
"stateListenerWeakReference",
".",
"get",
"(",
")",
";",
"if",
"(",
"stateListener",
"!=",
"null",
")",
"{",
"stateListener",
".",
"onDisconnected",
"(",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"onTextMessage",
"(",
"WebSocket",
"websocket",
",",
"String",
"text",
")",
"throws",
"Exception",
"{",
"super",
".",
"onTextMessage",
"(",
"websocket",
",",
"text",
")",
";",
"log",
".",
"d",
"(",
"\"Socket message received = \"",
"+",
"text",
")",
";",
"messageListener",
".",
"onMessage",
"(",
"text",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onBinaryMessage",
"(",
"WebSocket",
"websocket",
",",
"byte",
"[",
"]",
"binary",
")",
"throws",
"Exception",
"{",
"super",
".",
"onBinaryMessage",
"(",
"websocket",
",",
"binary",
")",
";",
"log",
".",
"d",
"(",
"\"Socket binary message received.\"",
")",
";",
"}",
"}",
";",
"}"
] | Create adapter for websocket library events.
@param stateListenerWeakReference Listener for socket state changes.
@return Adapter for websocket library events. | [
"Create",
"adapter",
"for",
"websocket",
"library",
"events",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketFactory.java#L136-L180 |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/form/FormErrorList.java | FormErrorList.addFieldWarning | public void addFieldWarning (@Nonnull @Nonempty final String sFieldName, @Nonnull @Nonempty final String sText)
{
add (SingleError.builderWarn ().setErrorFieldName (sFieldName).setErrorText (sText).build ());
} | java | public void addFieldWarning (@Nonnull @Nonempty final String sFieldName, @Nonnull @Nonempty final String sText)
{
add (SingleError.builderWarn ().setErrorFieldName (sFieldName).setErrorText (sText).build ());
} | [
"public",
"void",
"addFieldWarning",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sFieldName",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sText",
")",
"{",
"add",
"(",
"SingleError",
".",
"builderWarn",
"(",
")",
".",
"setErrorFieldName",
"(",
"sFieldName",
")",
".",
"setErrorText",
"(",
"sText",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] | Add a field specific warning message.
@param sFieldName
The field name for which the message is to be recorded. May neither
be <code>null</code> nor empty.
@param sText
The text to use. May neither be <code>null</code> nor empty. | [
"Add",
"a",
"field",
"specific",
"warning",
"message",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/form/FormErrorList.java#L66-L69 |
mozilla/rhino | src/org/mozilla/javascript/ScriptRuntime.java | ScriptRuntime.getPropFunctionAndThis | public static Callable getPropFunctionAndThis(Object obj,
String property,
Context cx, Scriptable scope)
{
Scriptable thisObj = toObjectOrNull(cx, obj, scope);
return getPropFunctionAndThisHelper(obj, property, cx, thisObj);
} | java | public static Callable getPropFunctionAndThis(Object obj,
String property,
Context cx, Scriptable scope)
{
Scriptable thisObj = toObjectOrNull(cx, obj, scope);
return getPropFunctionAndThisHelper(obj, property, cx, thisObj);
} | [
"public",
"static",
"Callable",
"getPropFunctionAndThis",
"(",
"Object",
"obj",
",",
"String",
"property",
",",
"Context",
"cx",
",",
"Scriptable",
"scope",
")",
"{",
"Scriptable",
"thisObj",
"=",
"toObjectOrNull",
"(",
"cx",
",",
"obj",
",",
"scope",
")",
";",
"return",
"getPropFunctionAndThisHelper",
"(",
"obj",
",",
"property",
",",
"cx",
",",
"thisObj",
")",
";",
"}"
] | Prepare for calling obj.property(...): return function corresponding to
obj.property and make obj properly converted to Scriptable available
as ScriptRuntime.lastStoredScriptable() for consumption as thisObj.
The caller must call ScriptRuntime.lastStoredScriptable() immediately
after calling this method. | [
"Prepare",
"for",
"calling",
"obj",
".",
"property",
"(",
"...",
")",
":",
"return",
"function",
"corresponding",
"to",
"obj",
".",
"property",
"and",
"make",
"obj",
"properly",
"converted",
"to",
"Scriptable",
"available",
"as",
"ScriptRuntime",
".",
"lastStoredScriptable",
"()",
"for",
"consumption",
"as",
"thisObj",
".",
"The",
"caller",
"must",
"call",
"ScriptRuntime",
".",
"lastStoredScriptable",
"()",
"immediately",
"after",
"calling",
"this",
"method",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L2557-L2563 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java | AbstractCasView.prepareViewModelWithAuthenticationPrincipal | protected Map prepareViewModelWithAuthenticationPrincipal(final Map<String, Object> model) {
putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL, getPrincipal(model));
putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_CHAINED_AUTHENTICATIONS, getChainedAuthentications(model));
putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRIMARY_AUTHENTICATION, getPrimaryAuthenticationFrom(model));
LOGGER.trace("Prepared CAS response output model with attribute names [{}]", model.keySet());
return model;
} | java | protected Map prepareViewModelWithAuthenticationPrincipal(final Map<String, Object> model) {
putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL, getPrincipal(model));
putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_CHAINED_AUTHENTICATIONS, getChainedAuthentications(model));
putIntoModel(model, CasViewConstants.MODEL_ATTRIBUTE_NAME_PRIMARY_AUTHENTICATION, getPrimaryAuthenticationFrom(model));
LOGGER.trace("Prepared CAS response output model with attribute names [{}]", model.keySet());
return model;
} | [
"protected",
"Map",
"prepareViewModelWithAuthenticationPrincipal",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
")",
"{",
"putIntoModel",
"(",
"model",
",",
"CasViewConstants",
".",
"MODEL_ATTRIBUTE_NAME_PRINCIPAL",
",",
"getPrincipal",
"(",
"model",
")",
")",
";",
"putIntoModel",
"(",
"model",
",",
"CasViewConstants",
".",
"MODEL_ATTRIBUTE_NAME_CHAINED_AUTHENTICATIONS",
",",
"getChainedAuthentications",
"(",
"model",
")",
")",
";",
"putIntoModel",
"(",
"model",
",",
"CasViewConstants",
".",
"MODEL_ATTRIBUTE_NAME_PRIMARY_AUTHENTICATION",
",",
"getPrimaryAuthenticationFrom",
"(",
"model",
")",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Prepared CAS response output model with attribute names [{}]\"",
",",
"model",
".",
"keySet",
"(",
")",
")",
";",
"return",
"model",
";",
"}"
] | Prepare view model with authentication principal.
@param model the model
@return the map | [
"Prepare",
"view",
"model",
"with",
"authentication",
"principal",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java#L219-L225 |
mjiderhamn/classloader-leak-prevention | classloader-leak-prevention/classloader-leak-prevention-core/src/main/java/se/jiderhamn/classloader/leak/prevention/cleanup/RmiTargetsCleanUp.java | RmiTargetsCleanUp.clearRmiTargetsMap | @SuppressWarnings("WeakerAccess")
protected void clearRmiTargetsMap(ClassLoaderLeakPreventor preventor, Map<?, ?> rmiTargetsMap) {
try {
final Field cclField = preventor.findFieldOfClass("sun.rmi.transport.Target", "ccl");
preventor.debug("Looping " + rmiTargetsMap.size() + " RMI Targets to find leaks");
for(Iterator<?> iter = rmiTargetsMap.values().iterator(); iter.hasNext(); ) {
Object target = iter.next(); // sun.rmi.transport.Target
ClassLoader ccl = (ClassLoader) cclField.get(target);
if(preventor.isClassLoaderOrChild(ccl)) {
preventor.warn("Removing RMI Target: " + target);
iter.remove();
}
}
}
catch (Exception ex) {
preventor.error(ex);
}
} | java | @SuppressWarnings("WeakerAccess")
protected void clearRmiTargetsMap(ClassLoaderLeakPreventor preventor, Map<?, ?> rmiTargetsMap) {
try {
final Field cclField = preventor.findFieldOfClass("sun.rmi.transport.Target", "ccl");
preventor.debug("Looping " + rmiTargetsMap.size() + " RMI Targets to find leaks");
for(Iterator<?> iter = rmiTargetsMap.values().iterator(); iter.hasNext(); ) {
Object target = iter.next(); // sun.rmi.transport.Target
ClassLoader ccl = (ClassLoader) cclField.get(target);
if(preventor.isClassLoaderOrChild(ccl)) {
preventor.warn("Removing RMI Target: " + target);
iter.remove();
}
}
}
catch (Exception ex) {
preventor.error(ex);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"protected",
"void",
"clearRmiTargetsMap",
"(",
"ClassLoaderLeakPreventor",
"preventor",
",",
"Map",
"<",
"?",
",",
"?",
">",
"rmiTargetsMap",
")",
"{",
"try",
"{",
"final",
"Field",
"cclField",
"=",
"preventor",
".",
"findFieldOfClass",
"(",
"\"sun.rmi.transport.Target\"",
",",
"\"ccl\"",
")",
";",
"preventor",
".",
"debug",
"(",
"\"Looping \"",
"+",
"rmiTargetsMap",
".",
"size",
"(",
")",
"+",
"\" RMI Targets to find leaks\"",
")",
";",
"for",
"(",
"Iterator",
"<",
"?",
">",
"iter",
"=",
"rmiTargetsMap",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"target",
"=",
"iter",
".",
"next",
"(",
")",
";",
"// sun.rmi.transport.Target",
"ClassLoader",
"ccl",
"=",
"(",
"ClassLoader",
")",
"cclField",
".",
"get",
"(",
"target",
")",
";",
"if",
"(",
"preventor",
".",
"isClassLoaderOrChild",
"(",
"ccl",
")",
")",
"{",
"preventor",
".",
"warn",
"(",
"\"Removing RMI Target: \"",
"+",
"target",
")",
";",
"iter",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"preventor",
".",
"error",
"(",
"ex",
")",
";",
"}",
"}"
] | Iterate RMI Targets Map and remove entries loaded by protected ClassLoader | [
"Iterate",
"RMI",
"Targets",
"Map",
"and",
"remove",
"entries",
"loaded",
"by",
"protected",
"ClassLoader"
] | train | https://github.com/mjiderhamn/classloader-leak-prevention/blob/eea8e3cef64f8096dbbb87552df0a1bd272bcb63/classloader-leak-prevention/classloader-leak-prevention-core/src/main/java/se/jiderhamn/classloader/leak/prevention/cleanup/RmiTargetsCleanUp.java#L30-L47 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java | Jsr250Utils.createJsr250Executor | public static Jsr250Executor createJsr250Executor(Injector injector, final Logger log, Scope... scopes ) {
final Set<Object> instances = findInstancesInScopes(injector, scopes);
final List<Object> reverseInstances = new ArrayList<Object>(instances);
Collections.reverse(reverseInstances);
return new Jsr250Executor() {
@Override
public Set<Object> getInstances() {
return instances;
}
@Override
public void postConstruct() {
for( Object instance : instances ) {
postConstructQuietly(instance, log);
}
}
@Override
public void preDestroy() {
for( Object instance : reverseInstances ) {
preDestroyQuietly(instance, log);
}
}
};
} | java | public static Jsr250Executor createJsr250Executor(Injector injector, final Logger log, Scope... scopes ) {
final Set<Object> instances = findInstancesInScopes(injector, scopes);
final List<Object> reverseInstances = new ArrayList<Object>(instances);
Collections.reverse(reverseInstances);
return new Jsr250Executor() {
@Override
public Set<Object> getInstances() {
return instances;
}
@Override
public void postConstruct() {
for( Object instance : instances ) {
postConstructQuietly(instance, log);
}
}
@Override
public void preDestroy() {
for( Object instance : reverseInstances ) {
preDestroyQuietly(instance, log);
}
}
};
} | [
"public",
"static",
"Jsr250Executor",
"createJsr250Executor",
"(",
"Injector",
"injector",
",",
"final",
"Logger",
"log",
",",
"Scope",
"...",
"scopes",
")",
"{",
"final",
"Set",
"<",
"Object",
">",
"instances",
"=",
"findInstancesInScopes",
"(",
"injector",
",",
"scopes",
")",
";",
"final",
"List",
"<",
"Object",
">",
"reverseInstances",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
"instances",
")",
";",
"Collections",
".",
"reverse",
"(",
"reverseInstances",
")",
";",
"return",
"new",
"Jsr250Executor",
"(",
")",
"{",
"@",
"Override",
"public",
"Set",
"<",
"Object",
">",
"getInstances",
"(",
")",
"{",
"return",
"instances",
";",
"}",
"@",
"Override",
"public",
"void",
"postConstruct",
"(",
")",
"{",
"for",
"(",
"Object",
"instance",
":",
"instances",
")",
"{",
"postConstructQuietly",
"(",
"instance",
",",
"log",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"preDestroy",
"(",
")",
"{",
"for",
"(",
"Object",
"instance",
":",
"reverseInstances",
")",
"{",
"preDestroyQuietly",
"(",
"instance",
",",
"log",
")",
";",
"}",
"}",
"}",
";",
"}"
] | Creates a Jsr250Executor for the specified scopes.
@param injector
@param log
@param scopes
@return | [
"Creates",
"a",
"Jsr250Executor",
"for",
"the",
"specified",
"scopes",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L237-L263 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java | AuditorFactory.getAuditor | public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, AuditorModuleContext context)
{
Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className);
return getAuditor(clazz, config, context);
} | java | public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, AuditorModuleContext context)
{
Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className);
return getAuditor(clazz, config, context);
} | [
"public",
"static",
"IHEAuditor",
"getAuditor",
"(",
"String",
"className",
",",
"AuditorModuleConfig",
"config",
",",
"AuditorModuleContext",
"context",
")",
"{",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"clazz",
"=",
"AuditorFactory",
".",
"getAuditorClassForClassName",
"(",
"className",
")",
";",
"return",
"getAuditor",
"(",
"clazz",
",",
"config",
",",
"context",
")",
";",
"}"
] | Get an auditor instance for the specified auditor class name,
auditor configuration, and auditor context.
@param className Class name of the auditor class to instantiate
@param config Auditor configuration to use
@param context Auditor context to use
@return Instance of an IHE Auditor | [
"Get",
"an",
"auditor",
"instance",
"for",
"the",
"specified",
"auditor",
"class",
"name",
"auditor",
"configuration",
"and",
"auditor",
"context",
"."
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L106-L110 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java | CmsResultsTab.displayResultCount | private void displayResultCount(int displayed, int total) {
String message = Messages.get().key(
Messages.GUI_LABEL_NUM_RESULTS_2,
new Integer(displayed),
new Integer(total));
m_infoLabel.setText(message);
} | java | private void displayResultCount(int displayed, int total) {
String message = Messages.get().key(
Messages.GUI_LABEL_NUM_RESULTS_2,
new Integer(displayed),
new Integer(total));
m_infoLabel.setText(message);
} | [
"private",
"void",
"displayResultCount",
"(",
"int",
"displayed",
",",
"int",
"total",
")",
"{",
"String",
"message",
"=",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_LABEL_NUM_RESULTS_2",
",",
"new",
"Integer",
"(",
"displayed",
")",
",",
"new",
"Integer",
"(",
"total",
")",
")",
";",
"m_infoLabel",
".",
"setText",
"(",
"message",
")",
";",
"}"
] | Displays the result count.<p>
@param displayed the displayed result items
@param total the total of result items | [
"Displays",
"the",
"result",
"count",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java#L707-L714 |
lessthanoptimal/BoofCV | main/boofcv-simulation/src/main/java/boofcv/simulation/SimulatePlanarWorld.java | SimulatePlanarWorld.computeProjectionTable | void computeProjectionTable( int width , int height ) {
output.reshape(width,height);
depthMap.reshape(width,height);
ImageMiscOps.fill(depthMap,-1);
pointing = new float[width*height*3];
for (int y = 0; y < output.height; y++) {
for (int x = 0; x < output.width; x++) {
// Should this add 0.5 so that the ray goes out of the pixel's center? Seems to increase reprojection
// error in calibration tests if I do...
pixelTo3.compute(x, y, p3);
if(UtilEjml.isUncountable(p3.x)) {
depthMap.unsafe_set(x,y,Float.NaN);
} else {
pointing[(y*output.width+x)*3 ] = (float)p3.x;
pointing[(y*output.width+x)*3+1 ] = (float)p3.y;
pointing[(y*output.width+x)*3+2 ] = (float)p3.z;
}
}
}
} | java | void computeProjectionTable( int width , int height ) {
output.reshape(width,height);
depthMap.reshape(width,height);
ImageMiscOps.fill(depthMap,-1);
pointing = new float[width*height*3];
for (int y = 0; y < output.height; y++) {
for (int x = 0; x < output.width; x++) {
// Should this add 0.5 so that the ray goes out of the pixel's center? Seems to increase reprojection
// error in calibration tests if I do...
pixelTo3.compute(x, y, p3);
if(UtilEjml.isUncountable(p3.x)) {
depthMap.unsafe_set(x,y,Float.NaN);
} else {
pointing[(y*output.width+x)*3 ] = (float)p3.x;
pointing[(y*output.width+x)*3+1 ] = (float)p3.y;
pointing[(y*output.width+x)*3+2 ] = (float)p3.z;
}
}
}
} | [
"void",
"computeProjectionTable",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"output",
".",
"reshape",
"(",
"width",
",",
"height",
")",
";",
"depthMap",
".",
"reshape",
"(",
"width",
",",
"height",
")",
";",
"ImageMiscOps",
".",
"fill",
"(",
"depthMap",
",",
"-",
"1",
")",
";",
"pointing",
"=",
"new",
"float",
"[",
"width",
"*",
"height",
"*",
"3",
"]",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"output",
".",
"height",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"output",
".",
"width",
";",
"x",
"++",
")",
"{",
"// Should this add 0.5 so that the ray goes out of the pixel's center? Seems to increase reprojection",
"// error in calibration tests if I do...",
"pixelTo3",
".",
"compute",
"(",
"x",
",",
"y",
",",
"p3",
")",
";",
"if",
"(",
"UtilEjml",
".",
"isUncountable",
"(",
"p3",
".",
"x",
")",
")",
"{",
"depthMap",
".",
"unsafe_set",
"(",
"x",
",",
"y",
",",
"Float",
".",
"NaN",
")",
";",
"}",
"else",
"{",
"pointing",
"[",
"(",
"y",
"*",
"output",
".",
"width",
"+",
"x",
")",
"*",
"3",
"]",
"=",
"(",
"float",
")",
"p3",
".",
"x",
";",
"pointing",
"[",
"(",
"y",
"*",
"output",
".",
"width",
"+",
"x",
")",
"*",
"3",
"+",
"1",
"]",
"=",
"(",
"float",
")",
"p3",
".",
"y",
";",
"pointing",
"[",
"(",
"y",
"*",
"output",
".",
"width",
"+",
"x",
")",
"*",
"3",
"+",
"2",
"]",
"=",
"(",
"float",
")",
"p3",
".",
"z",
";",
"}",
"}",
"}",
"}"
] | Computes 3D pointing vector for every pixel in the simulated camera frame
@param width width of simulated camera
@param height height of simulated camera | [
"Computes",
"3D",
"pointing",
"vector",
"for",
"every",
"pixel",
"in",
"the",
"simulated",
"camera",
"frame"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-simulation/src/main/java/boofcv/simulation/SimulatePlanarWorld.java#L120-L142 |
phax/ph-web | ph-servlet/src/main/java/com/helger/servlet/request/RequestHelper.java | RequestHelper.getRequestClientCertificates | @Nullable
public static X509Certificate [] getRequestClientCertificates (@Nonnull final HttpServletRequest aHttpRequest)
{
return _getRequestAttr (aHttpRequest, SERVLET_ATTR_CLIENT_CERTIFICATE, X509Certificate [].class);
} | java | @Nullable
public static X509Certificate [] getRequestClientCertificates (@Nonnull final HttpServletRequest aHttpRequest)
{
return _getRequestAttr (aHttpRequest, SERVLET_ATTR_CLIENT_CERTIFICATE, X509Certificate [].class);
} | [
"@",
"Nullable",
"public",
"static",
"X509Certificate",
"[",
"]",
"getRequestClientCertificates",
"(",
"@",
"Nonnull",
"final",
"HttpServletRequest",
"aHttpRequest",
")",
"{",
"return",
"_getRequestAttr",
"(",
"aHttpRequest",
",",
"SERVLET_ATTR_CLIENT_CERTIFICATE",
",",
"X509Certificate",
"[",
"]",
".",
"class",
")",
";",
"}"
] | Get the client certificates provided by a HTTP servlet request.
@param aHttpRequest
The HTTP servlet request to extract the information from. May not be
<code>null</code>.
@return <code>null</code> if the passed request does not contain any client
certificate | [
"Get",
"the",
"client",
"certificates",
"provided",
"by",
"a",
"HTTP",
"servlet",
"request",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/request/RequestHelper.java#L668-L672 |
johnkil/Print | print/src/main/java/com/github/johnkil/print/PrintConfig.java | PrintConfig.initDefault | public static void initDefault(AssetManager assets, String defaultFontPath) {
Typeface defaultFont = TypefaceManager.load(assets, defaultFontPath);
initDefault(defaultFont);
} | java | public static void initDefault(AssetManager assets, String defaultFontPath) {
Typeface defaultFont = TypefaceManager.load(assets, defaultFontPath);
initDefault(defaultFont);
} | [
"public",
"static",
"void",
"initDefault",
"(",
"AssetManager",
"assets",
",",
"String",
"defaultFontPath",
")",
"{",
"Typeface",
"defaultFont",
"=",
"TypefaceManager",
".",
"load",
"(",
"assets",
",",
"defaultFontPath",
")",
";",
"initDefault",
"(",
"defaultFont",
")",
";",
"}"
] | Define the default iconic font.
@param assets The application's asset manager.
@param defaultFontPath The file name of the font in the assets directory,
e.g. "fonts/iconic-font.ttf".
@see #initDefault(Typeface) | [
"Define",
"the",
"default",
"iconic",
"font",
"."
] | train | https://github.com/johnkil/Print/blob/535f3ca466289c491b8c29f41c32e72f0bb95127/print/src/main/java/com/github/johnkil/print/PrintConfig.java#L34-L37 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.retrieveBeans | @Override
public <T, C> List<T> retrieveBeans(String name, C criteria, T result) throws CpoException {
return processSelectGroup(name, criteria, result, null, null, null, false);
} | java | @Override
public <T, C> List<T> retrieveBeans(String name, C criteria, T result) throws CpoException {
return processSelectGroup(name, criteria, result, null, null, null, false);
} | [
"@",
"Override",
"public",
"<",
"T",
",",
"C",
">",
"List",
"<",
"T",
">",
"retrieveBeans",
"(",
"String",
"name",
",",
"C",
"criteria",
",",
"T",
"result",
")",
"throws",
"CpoException",
"{",
"return",
"processSelectGroup",
"(",
"name",
",",
"criteria",
",",
"result",
",",
"null",
",",
"null",
",",
"null",
",",
"false",
")",
";",
"}"
] | Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.
@param name The filter name which tells the datasource which beans should be returned. The name also signifies what
data in the bean will be populated.
@param criteria This is an bean that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown.
This bean is used to specify the arguments used to retrieve the collection of beans.
@param result This is an bean that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown.
This bean is used to specify the bean type that will be returned in the collection.
@return A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the
same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
@throws CpoException Thrown if there are errors accessing the datasource | [
"Retrieves",
"the",
"bean",
"from",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"bean",
"exists",
"in",
"the",
"datasource",
"."
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1531-L1534 |
interedition/collatex | collatex-core/src/main/java/eu/interedition/collatex/suffixtree/ActivePoint.java | ActivePoint.fixActiveEdgeAfterSuffixLink | private void fixActiveEdgeAfterSuffixLink(Suffix<T, S> suffix) {
while (activeEdge != null && activeLength > activeEdge.getLength()) {
activeLength = activeLength - activeEdge.getLength();
activeNode = activeEdge.getTerminal();
Object item = suffix.getItemXFromEnd(activeLength + 1);
activeEdge = activeNode.getEdgeStarting(item);
}
resetActivePointToTerminal();
} | java | private void fixActiveEdgeAfterSuffixLink(Suffix<T, S> suffix) {
while (activeEdge != null && activeLength > activeEdge.getLength()) {
activeLength = activeLength - activeEdge.getLength();
activeNode = activeEdge.getTerminal();
Object item = suffix.getItemXFromEnd(activeLength + 1);
activeEdge = activeNode.getEdgeStarting(item);
}
resetActivePointToTerminal();
} | [
"private",
"void",
"fixActiveEdgeAfterSuffixLink",
"(",
"Suffix",
"<",
"T",
",",
"S",
">",
"suffix",
")",
"{",
"while",
"(",
"activeEdge",
"!=",
"null",
"&&",
"activeLength",
">",
"activeEdge",
".",
"getLength",
"(",
")",
")",
"{",
"activeLength",
"=",
"activeLength",
"-",
"activeEdge",
".",
"getLength",
"(",
")",
";",
"activeNode",
"=",
"activeEdge",
".",
"getTerminal",
"(",
")",
";",
"Object",
"item",
"=",
"suffix",
".",
"getItemXFromEnd",
"(",
"activeLength",
"+",
"1",
")",
";",
"activeEdge",
"=",
"activeNode",
".",
"getEdgeStarting",
"(",
"item",
")",
";",
"}",
"resetActivePointToTerminal",
"(",
")",
";",
"}"
] | Deal with the case when we follow a suffix link but the active length is
greater than the new active edge length. In this situation we must walk
down the tree updating the entire active point. | [
"Deal",
"with",
"the",
"case",
"when",
"we",
"follow",
"a",
"suffix",
"link",
"but",
"the",
"active",
"length",
"is",
"greater",
"than",
"the",
"new",
"active",
"edge",
"length",
".",
"In",
"this",
"situation",
"we",
"must",
"walk",
"down",
"the",
"tree",
"updating",
"the",
"entire",
"active",
"point",
"."
] | train | https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixtree/ActivePoint.java#L157-L165 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/IoFilterManager.java | IoFilterManager.resolveInstallationErrorsOnHost_Task | public Task resolveInstallationErrorsOnHost_Task(String filterId, HostSystem host) throws NotFound, RuntimeFault, RemoteException {
return new Task(getServerConnection(), getVimService().resolveInstallationErrorsOnHost_Task(getMOR(), filterId, host.getMOR()));
} | java | public Task resolveInstallationErrorsOnHost_Task(String filterId, HostSystem host) throws NotFound, RuntimeFault, RemoteException {
return new Task(getServerConnection(), getVimService().resolveInstallationErrorsOnHost_Task(getMOR(), filterId, host.getMOR()));
} | [
"public",
"Task",
"resolveInstallationErrorsOnHost_Task",
"(",
"String",
"filterId",
",",
"HostSystem",
"host",
")",
"throws",
"NotFound",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"return",
"new",
"Task",
"(",
"getServerConnection",
"(",
")",
",",
"getVimService",
"(",
")",
".",
"resolveInstallationErrorsOnHost_Task",
"(",
"getMOR",
"(",
")",
",",
"filterId",
",",
"host",
".",
"getMOR",
"(",
")",
")",
")",
";",
"}"
] | Resolve the errors occured during an installation/uninstallation/upgrade operation of an IO Filter on a host.
Depending on the nature of the installation failure, vCenter will take the appropriate actions to resolve it. For
example, retry or resume installation.
@param filterId
- ID of the filter.
@param host
- The host to fix the issues on.
@return - This method returns a Task object with which to monitor the operation. The task is set to success if
all the errors related to the filter are resolved on the cluster. If the task fails, first check error to
see the error. If the error indicates that issues persist on the cluster, use QueryIoFilterIssues to get
the detailed errors on the hosts in the cluster. The dynamic privilege check will ensure that the
appropriate privileges must be acquired for all the hosts in the cluster based on the remediation
actions. For example, Host.Config.Maintenance privilege and Host.Config.Patch privileges must be required
for upgrading a VIB.
@throws RuntimeFault
- Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example,
a communication error.
@throws NotFound
@throws RemoteException | [
"Resolve",
"the",
"errors",
"occured",
"during",
"an",
"installation",
"/",
"uninstallation",
"/",
"upgrade",
"operation",
"of",
"an",
"IO",
"Filter",
"on",
"a",
"host",
".",
"Depending",
"on",
"the",
"nature",
"of",
"the",
"installation",
"failure",
"vCenter",
"will",
"take",
"the",
"appropriate",
"actions",
"to",
"resolve",
"it",
".",
"For",
"example",
"retry",
"or",
"resume",
"installation",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/IoFilterManager.java#L177-L179 |
headius/invokebinder | src/main/java/com/headius/invokebinder/transform/Transform.java | Transform.buildClass | private static void buildClass(StringBuilder builder, Class cls) {
int arrayDims = 0;
Class tmp = cls;
while (tmp.isArray()) {
arrayDims++;
tmp = tmp.getComponentType();
}
builder.append(tmp.getName());
if (arrayDims > 0) {
for (; arrayDims > 0 ; arrayDims--) {
builder.append("[]");
}
}
} | java | private static void buildClass(StringBuilder builder, Class cls) {
int arrayDims = 0;
Class tmp = cls;
while (tmp.isArray()) {
arrayDims++;
tmp = tmp.getComponentType();
}
builder.append(tmp.getName());
if (arrayDims > 0) {
for (; arrayDims > 0 ; arrayDims--) {
builder.append("[]");
}
}
} | [
"private",
"static",
"void",
"buildClass",
"(",
"StringBuilder",
"builder",
",",
"Class",
"cls",
")",
"{",
"int",
"arrayDims",
"=",
"0",
";",
"Class",
"tmp",
"=",
"cls",
";",
"while",
"(",
"tmp",
".",
"isArray",
"(",
")",
")",
"{",
"arrayDims",
"++",
";",
"tmp",
"=",
"tmp",
".",
"getComponentType",
"(",
")",
";",
"}",
"builder",
".",
"append",
"(",
"tmp",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"arrayDims",
">",
"0",
")",
"{",
"for",
"(",
";",
"arrayDims",
">",
"0",
";",
"arrayDims",
"--",
")",
"{",
"builder",
".",
"append",
"(",
"\"[]\"",
")",
";",
"}",
"}",
"}"
] | Build Java code to represent a type reference to the given class.
This will be of the form "pkg.Cls1" or "pkc.Cls2[]" or "primtype".
@param builder the builder in which to build the type reference
@param cls the type for the reference | [
"Build",
"Java",
"code",
"to",
"represent",
"a",
"type",
"reference",
"to",
"the",
"given",
"class",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/transform/Transform.java#L123-L136 |
eliwan/ew-profiling | profiling-core/src/main/java/be/eliwan/profiling/jdbc/ProfilingDriver.java | ProfilingDriver.registerQuery | static void registerQuery(String group, String query, long durationMillis) {
for (ProfilingListener listener : LISTENERS) {
listener.registerQuery(group, query, durationMillis);
}
} | java | static void registerQuery(String group, String query, long durationMillis) {
for (ProfilingListener listener : LISTENERS) {
listener.registerQuery(group, query, durationMillis);
}
} | [
"static",
"void",
"registerQuery",
"(",
"String",
"group",
",",
"String",
"query",
",",
"long",
"durationMillis",
")",
"{",
"for",
"(",
"ProfilingListener",
"listener",
":",
"LISTENERS",
")",
"{",
"listener",
".",
"registerQuery",
"(",
"group",
",",
"query",
",",
"durationMillis",
")",
";",
"}",
"}"
] | Register a duration in milliseconds for running a JDBC method with specific query.
<p>
When a query is known, {@link #register(String, long)} is called first.
</p>
@param group indication of type of command.
@param query the SQL query which is used
@param durationMillis duration in milliseconds | [
"Register",
"a",
"duration",
"in",
"milliseconds",
"for",
"running",
"a",
"JDBC",
"method",
"with",
"specific",
"query",
".",
"<p",
">",
"When",
"a",
"query",
"is",
"known",
"{",
"@link",
"#register",
"(",
"String",
"long",
")",
"}",
"is",
"called",
"first",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/eliwan/ew-profiling/blob/3315a0038de967fceb2f4be3c29393857d7b15a2/profiling-core/src/main/java/be/eliwan/profiling/jdbc/ProfilingDriver.java#L72-L76 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XSwitchExpression expression, ISideEffectContext context) {
context.open();
if (hasSideEffects(expression.getSwitch(), context)) {
return true;
}
final List<Map<String, List<XExpression>>> buffers = new ArrayList<>();
for (final XCasePart ex : expression.getCases()) {
context.open();
if (hasSideEffects(ex.getCase(), context)) {
return true;
}
final Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(ex.getThen(), context.branch(buffer))) {
return true;
}
buffers.add(buffer);
context.close();
}
final Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getDefault(), context.branch(buffer))) {
return true;
}
buffers.add(buffer);
context.mergeBranchVariableAssignments(buffers);
context.close();
return false;
} | java | protected Boolean _hasSideEffects(XSwitchExpression expression, ISideEffectContext context) {
context.open();
if (hasSideEffects(expression.getSwitch(), context)) {
return true;
}
final List<Map<String, List<XExpression>>> buffers = new ArrayList<>();
for (final XCasePart ex : expression.getCases()) {
context.open();
if (hasSideEffects(ex.getCase(), context)) {
return true;
}
final Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(ex.getThen(), context.branch(buffer))) {
return true;
}
buffers.add(buffer);
context.close();
}
final Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getDefault(), context.branch(buffer))) {
return true;
}
buffers.add(buffer);
context.mergeBranchVariableAssignments(buffers);
context.close();
return false;
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XSwitchExpression",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"context",
".",
"open",
"(",
")",
";",
"if",
"(",
"hasSideEffects",
"(",
"expression",
".",
"getSwitch",
"(",
")",
",",
"context",
")",
")",
"{",
"return",
"true",
";",
"}",
"final",
"List",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"XExpression",
">",
">",
">",
"buffers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"XCasePart",
"ex",
":",
"expression",
".",
"getCases",
"(",
")",
")",
"{",
"context",
".",
"open",
"(",
")",
";",
"if",
"(",
"hasSideEffects",
"(",
"ex",
".",
"getCase",
"(",
")",
",",
"context",
")",
")",
"{",
"return",
"true",
";",
"}",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"XExpression",
">",
">",
"buffer",
"=",
"context",
".",
"createVariableAssignmentBufferForBranch",
"(",
")",
";",
"if",
"(",
"hasSideEffects",
"(",
"ex",
".",
"getThen",
"(",
")",
",",
"context",
".",
"branch",
"(",
"buffer",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"buffers",
".",
"add",
"(",
"buffer",
")",
";",
"context",
".",
"close",
"(",
")",
";",
"}",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"XExpression",
">",
">",
"buffer",
"=",
"context",
".",
"createVariableAssignmentBufferForBranch",
"(",
")",
";",
"if",
"(",
"hasSideEffects",
"(",
"expression",
".",
"getDefault",
"(",
")",
",",
"context",
".",
"branch",
"(",
"buffer",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"buffers",
".",
"add",
"(",
"buffer",
")",
";",
"context",
".",
"mergeBranchVariableAssignments",
"(",
"buffers",
")",
";",
"context",
".",
"close",
"(",
")",
";",
"return",
"false",
";",
"}"
] | Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L430-L456 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/util/AstState.java | AstState.str2state | public static Integer str2state(String str)
{
Integer state;
if (str == null)
{
return null;
}
state = inverseStateMap.get(str);
if (state == null)
{
Matcher matcher = UNKNOWN_STATE_PATTERN.matcher(str);
if (matcher.matches())
{
try
{
state = Integer.valueOf(matcher.group(1));
}
catch (NumberFormatException e)
{
// should not happen as the pattern requires \d+ for the state.
throw new IllegalArgumentException("Unable to convert state '" + str + "' to integer representation", e);
}
}
}
return state;
} | java | public static Integer str2state(String str)
{
Integer state;
if (str == null)
{
return null;
}
state = inverseStateMap.get(str);
if (state == null)
{
Matcher matcher = UNKNOWN_STATE_PATTERN.matcher(str);
if (matcher.matches())
{
try
{
state = Integer.valueOf(matcher.group(1));
}
catch (NumberFormatException e)
{
// should not happen as the pattern requires \d+ for the state.
throw new IllegalArgumentException("Unable to convert state '" + str + "' to integer representation", e);
}
}
}
return state;
} | [
"public",
"static",
"Integer",
"str2state",
"(",
"String",
"str",
")",
"{",
"Integer",
"state",
";",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"state",
"=",
"inverseStateMap",
".",
"get",
"(",
"str",
")",
";",
"if",
"(",
"state",
"==",
"null",
")",
"{",
"Matcher",
"matcher",
"=",
"UNKNOWN_STATE_PATTERN",
".",
"matcher",
"(",
"str",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"try",
"{",
"state",
"=",
"Integer",
".",
"valueOf",
"(",
"matcher",
".",
"group",
"(",
"1",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"// should not happen as the pattern requires \\d+ for the state.",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable to convert state '\"",
"+",
"str",
"+",
"\"' to integer representation\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"state",
";",
"}"
] | This is the inverse to <code>ast_state2str</code> in <code>channel.c</code>.
@param str state as a descriptive text.
@return numeric state. | [
"This",
"is",
"the",
"inverse",
"to",
"<code",
">",
"ast_state2str<",
"/",
"code",
">",
"in",
"<code",
">",
"channel",
".",
"c<",
"/",
"code",
">",
"."
] | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/util/AstState.java#L101-L130 |
padrig64/ValidationFramework | validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableMapProperty.java | AbstractReadableMapProperty.doNotifyListenersOfChangedValues | protected void doNotifyListenersOfChangedValues(Map<K, R> oldValues, Map<K, R> newValues) {
List<MapValueChangeListener<K, R>> listenersCopy = new ArrayList<MapValueChangeListener<K, R>>(listeners);
Map<K, R> oldUnmodifiable = Collections.unmodifiableMap(oldValues);
Map<K, R> newUnmodifiable = Collections.unmodifiableMap(newValues);
for (MapValueChangeListener<K, R> listener : listenersCopy) {
listener.valuesChanged(this, oldUnmodifiable, newUnmodifiable);
}
} | java | protected void doNotifyListenersOfChangedValues(Map<K, R> oldValues, Map<K, R> newValues) {
List<MapValueChangeListener<K, R>> listenersCopy = new ArrayList<MapValueChangeListener<K, R>>(listeners);
Map<K, R> oldUnmodifiable = Collections.unmodifiableMap(oldValues);
Map<K, R> newUnmodifiable = Collections.unmodifiableMap(newValues);
for (MapValueChangeListener<K, R> listener : listenersCopy) {
listener.valuesChanged(this, oldUnmodifiable, newUnmodifiable);
}
} | [
"protected",
"void",
"doNotifyListenersOfChangedValues",
"(",
"Map",
"<",
"K",
",",
"R",
">",
"oldValues",
",",
"Map",
"<",
"K",
",",
"R",
">",
"newValues",
")",
"{",
"List",
"<",
"MapValueChangeListener",
"<",
"K",
",",
"R",
">",
">",
"listenersCopy",
"=",
"new",
"ArrayList",
"<",
"MapValueChangeListener",
"<",
"K",
",",
"R",
">",
">",
"(",
"listeners",
")",
";",
"Map",
"<",
"K",
",",
"R",
">",
"oldUnmodifiable",
"=",
"Collections",
".",
"unmodifiableMap",
"(",
"oldValues",
")",
";",
"Map",
"<",
"K",
",",
"R",
">",
"newUnmodifiable",
"=",
"Collections",
".",
"unmodifiableMap",
"(",
"newValues",
")",
";",
"for",
"(",
"MapValueChangeListener",
"<",
"K",
",",
"R",
">",
"listener",
":",
"listenersCopy",
")",
"{",
"listener",
".",
"valuesChanged",
"(",
"this",
",",
"oldUnmodifiable",
",",
"newUnmodifiable",
")",
";",
"}",
"}"
] | Notifies the change listeners that values have been replaced.
<p>
Note that the specified maps of values will be wrapped in unmodifiable maps before being passed to the listeners.
@param oldValues Previous values.
@param newValues New values. | [
"Notifies",
"the",
"change",
"listeners",
"that",
"values",
"have",
"been",
"replaced",
".",
"<p",
">",
"Note",
"that",
"the",
"specified",
"maps",
"of",
"values",
"will",
"be",
"wrapped",
"in",
"unmodifiable",
"maps",
"before",
"being",
"passed",
"to",
"the",
"listeners",
"."
] | train | https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableMapProperty.java#L108-L115 |
ZuInnoTe/hadoopcryptoledger | inputformat/src/main/java/org/zuinnote/hadoop/ethereum/format/common/EthereumUtil.java | EthereumUtil.convertVarNumberToBigInteger | public static BigInteger convertVarNumberToBigInteger(byte[] rawData) {
BigInteger result=BigInteger.ZERO;
if (rawData!=null) {
if (rawData.length>0) {
result = new BigInteger(1,rawData); // we know it is always positive
}
}
return result;
} | java | public static BigInteger convertVarNumberToBigInteger(byte[] rawData) {
BigInteger result=BigInteger.ZERO;
if (rawData!=null) {
if (rawData.length>0) {
result = new BigInteger(1,rawData); // we know it is always positive
}
}
return result;
} | [
"public",
"static",
"BigInteger",
"convertVarNumberToBigInteger",
"(",
"byte",
"[",
"]",
"rawData",
")",
"{",
"BigInteger",
"result",
"=",
"BigInteger",
".",
"ZERO",
";",
"if",
"(",
"rawData",
"!=",
"null",
")",
"{",
"if",
"(",
"rawData",
".",
"length",
">",
"0",
")",
"{",
"result",
"=",
"new",
"BigInteger",
"(",
"1",
",",
"rawData",
")",
";",
"// we know it is always positive",
"}",
"}",
"return",
"result",
";",
"}"
] | *
Converts a variable size number (e.g. byte,short,int,long) in a RLPElement to long
@param rawData byte array containing variable number
@return number as long or null if not a correct number | [
"*",
"Converts",
"a",
"variable",
"size",
"number",
"(",
"e",
".",
"g",
".",
"byte",
"short",
"int",
"long",
")",
"in",
"a",
"RLPElement",
"to",
"long"
] | train | https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/inputformat/src/main/java/org/zuinnote/hadoop/ethereum/format/common/EthereumUtil.java#L540-L548 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java | Configuration.registerTableOverride | @Deprecated
public SchemaAndTable registerTableOverride(SchemaAndTable from, SchemaAndTable to) {
return internalNameMapping.registerTableOverride(from, to);
} | java | @Deprecated
public SchemaAndTable registerTableOverride(SchemaAndTable from, SchemaAndTable to) {
return internalNameMapping.registerTableOverride(from, to);
} | [
"@",
"Deprecated",
"public",
"SchemaAndTable",
"registerTableOverride",
"(",
"SchemaAndTable",
"from",
",",
"SchemaAndTable",
"to",
")",
"{",
"return",
"internalNameMapping",
".",
"registerTableOverride",
"(",
"from",
",",
"to",
")",
";",
"}"
] | Register a schema specific table override
@param from schema and table to override
@param to override
@return previous override
@deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead. | [
"Register",
"a",
"schema",
"specific",
"table",
"override"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L382-L385 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java | GenericGenerators.combineObjectArrays | public static InsnList combineObjectArrays(Variable destArrayVar, Variable firstArrayVar, Variable secondArrayVar) {
Validate.notNull(destArrayVar);
Validate.notNull(firstArrayVar);
Validate.notNull(secondArrayVar);
Validate.isTrue(destArrayVar.getType().equals(Type.getType(Object[].class)));
Validate.isTrue(firstArrayVar.getType().equals(Type.getType(Object[].class)));
Validate.isTrue(secondArrayVar.getType().equals(Type.getType(Object[].class)));
validateLocalIndicies(destArrayVar.getIndex(), firstArrayVar.getIndex(), secondArrayVar.getIndex());
InsnList ret = merge(
// destArrayVar = new Object[firstArrayVar.length + secondArrayVar.length]
createNewObjectArray(
addIntegers(
loadArrayLength(loadVar(firstArrayVar)),
loadArrayLength(loadVar(secondArrayVar))
)
),
saveVar(destArrayVar),
// System.arrayCopy(firstArrayVar, 0, destArrayVar, 0, firstArrayVar.length)
call(SYSTEM_ARRAY_COPY_METHOD,
loadVar(firstArrayVar),
loadIntConst(0),
loadVar(destArrayVar),
loadIntConst(0),
loadArrayLength(loadVar(firstArrayVar))
),
// System.arrayCopy(secondArrayVar, 0, destArrayVar, firstArrayVar.length, secondArrayVar.length)
call(SYSTEM_ARRAY_COPY_METHOD,
loadVar(secondArrayVar),
loadIntConst(0),
loadVar(destArrayVar),
loadArrayLength(loadVar(firstArrayVar)),
loadArrayLength(loadVar(secondArrayVar))
)
);
return ret;
} | java | public static InsnList combineObjectArrays(Variable destArrayVar, Variable firstArrayVar, Variable secondArrayVar) {
Validate.notNull(destArrayVar);
Validate.notNull(firstArrayVar);
Validate.notNull(secondArrayVar);
Validate.isTrue(destArrayVar.getType().equals(Type.getType(Object[].class)));
Validate.isTrue(firstArrayVar.getType().equals(Type.getType(Object[].class)));
Validate.isTrue(secondArrayVar.getType().equals(Type.getType(Object[].class)));
validateLocalIndicies(destArrayVar.getIndex(), firstArrayVar.getIndex(), secondArrayVar.getIndex());
InsnList ret = merge(
// destArrayVar = new Object[firstArrayVar.length + secondArrayVar.length]
createNewObjectArray(
addIntegers(
loadArrayLength(loadVar(firstArrayVar)),
loadArrayLength(loadVar(secondArrayVar))
)
),
saveVar(destArrayVar),
// System.arrayCopy(firstArrayVar, 0, destArrayVar, 0, firstArrayVar.length)
call(SYSTEM_ARRAY_COPY_METHOD,
loadVar(firstArrayVar),
loadIntConst(0),
loadVar(destArrayVar),
loadIntConst(0),
loadArrayLength(loadVar(firstArrayVar))
),
// System.arrayCopy(secondArrayVar, 0, destArrayVar, firstArrayVar.length, secondArrayVar.length)
call(SYSTEM_ARRAY_COPY_METHOD,
loadVar(secondArrayVar),
loadIntConst(0),
loadVar(destArrayVar),
loadArrayLength(loadVar(firstArrayVar)),
loadArrayLength(loadVar(secondArrayVar))
)
);
return ret;
} | [
"public",
"static",
"InsnList",
"combineObjectArrays",
"(",
"Variable",
"destArrayVar",
",",
"Variable",
"firstArrayVar",
",",
"Variable",
"secondArrayVar",
")",
"{",
"Validate",
".",
"notNull",
"(",
"destArrayVar",
")",
";",
"Validate",
".",
"notNull",
"(",
"firstArrayVar",
")",
";",
"Validate",
".",
"notNull",
"(",
"secondArrayVar",
")",
";",
"Validate",
".",
"isTrue",
"(",
"destArrayVar",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Type",
".",
"getType",
"(",
"Object",
"[",
"]",
".",
"class",
")",
")",
")",
";",
"Validate",
".",
"isTrue",
"(",
"firstArrayVar",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Type",
".",
"getType",
"(",
"Object",
"[",
"]",
".",
"class",
")",
")",
")",
";",
"Validate",
".",
"isTrue",
"(",
"secondArrayVar",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"Type",
".",
"getType",
"(",
"Object",
"[",
"]",
".",
"class",
")",
")",
")",
";",
"validateLocalIndicies",
"(",
"destArrayVar",
".",
"getIndex",
"(",
")",
",",
"firstArrayVar",
".",
"getIndex",
"(",
")",
",",
"secondArrayVar",
".",
"getIndex",
"(",
")",
")",
";",
"InsnList",
"ret",
"=",
"merge",
"(",
"// destArrayVar = new Object[firstArrayVar.length + secondArrayVar.length]",
"createNewObjectArray",
"(",
"addIntegers",
"(",
"loadArrayLength",
"(",
"loadVar",
"(",
"firstArrayVar",
")",
")",
",",
"loadArrayLength",
"(",
"loadVar",
"(",
"secondArrayVar",
")",
")",
")",
")",
",",
"saveVar",
"(",
"destArrayVar",
")",
",",
"// System.arrayCopy(firstArrayVar, 0, destArrayVar, 0, firstArrayVar.length)",
"call",
"(",
"SYSTEM_ARRAY_COPY_METHOD",
",",
"loadVar",
"(",
"firstArrayVar",
")",
",",
"loadIntConst",
"(",
"0",
")",
",",
"loadVar",
"(",
"destArrayVar",
")",
",",
"loadIntConst",
"(",
"0",
")",
",",
"loadArrayLength",
"(",
"loadVar",
"(",
"firstArrayVar",
")",
")",
")",
",",
"// System.arrayCopy(secondArrayVar, 0, destArrayVar, firstArrayVar.length, secondArrayVar.length)",
"call",
"(",
"SYSTEM_ARRAY_COPY_METHOD",
",",
"loadVar",
"(",
"secondArrayVar",
")",
",",
"loadIntConst",
"(",
"0",
")",
",",
"loadVar",
"(",
"destArrayVar",
")",
",",
"loadArrayLength",
"(",
"loadVar",
"(",
"firstArrayVar",
")",
")",
",",
"loadArrayLength",
"(",
"loadVar",
"(",
"secondArrayVar",
")",
")",
")",
")",
";",
"return",
"ret",
";",
"}"
] | Concatenates two object arrays together.
@param destArrayVar variable to put concatenated object array in
@param firstArrayVar variable of first object array
@param secondArrayVar variable of second object array
@return instructions to create a new object array where the first part of the array is the contents of {@code firstArrayVar} and the
second part of the array is the contents of {@code secondArrayVar}
@throws NullPointerException if any argument is {@code null}
@throws IllegalArgumentException if variables have the same index, or if variables have been released, or if variables are of wrong
type | [
"Concatenates",
"two",
"object",
"arrays",
"together",
"."
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L850-L887 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/DualInputSemanticProperties.java | DualInputSemanticProperties.addForwardedField2 | public void addForwardedField2(int sourceField, FieldSet destinationFields) {
FieldSet fs;
if((fs = this.forwardedFields2.get(sourceField)) != null) {
fs.addAll(destinationFields);
} else {
fs = new FieldSet(destinationFields);
this.forwardedFields2.put(sourceField, fs);
}
} | java | public void addForwardedField2(int sourceField, FieldSet destinationFields) {
FieldSet fs;
if((fs = this.forwardedFields2.get(sourceField)) != null) {
fs.addAll(destinationFields);
} else {
fs = new FieldSet(destinationFields);
this.forwardedFields2.put(sourceField, fs);
}
} | [
"public",
"void",
"addForwardedField2",
"(",
"int",
"sourceField",
",",
"FieldSet",
"destinationFields",
")",
"{",
"FieldSet",
"fs",
";",
"if",
"(",
"(",
"fs",
"=",
"this",
".",
"forwardedFields2",
".",
"get",
"(",
"sourceField",
")",
")",
"!=",
"null",
")",
"{",
"fs",
".",
"addAll",
"(",
"destinationFields",
")",
";",
"}",
"else",
"{",
"fs",
"=",
"new",
"FieldSet",
"(",
"destinationFields",
")",
";",
"this",
".",
"forwardedFields2",
".",
"put",
"(",
"sourceField",
",",
"fs",
")",
";",
"}",
"}"
] | Adds, to the existing information, a field that is forwarded directly
from the source record(s) in the second input to multiple fields in
the destination record(s).
@param sourceField the position in the source record(s)
@param destinationFields the position in the destination record(s) | [
"Adds",
"to",
"the",
"existing",
"information",
"a",
"field",
"that",
"is",
"forwarded",
"directly",
"from",
"the",
"source",
"record",
"(",
"s",
")",
"in",
"the",
"second",
"input",
"to",
"multiple",
"fields",
"in",
"the",
"destination",
"record",
"(",
"s",
")",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/DualInputSemanticProperties.java#L142-L150 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java | CmsXmlContentPropertyHelper.getMacroResolverForProperties | public static CmsMacroResolver getMacroResolverForProperties(
final CmsObject cms,
final I_CmsXmlContentHandler contentHandler,
final CmsXmlContent content,
final Function<String, String> stringtemplateSource,
final CmsResource containerPage) {
Locale locale = OpenCms.getLocaleManager().getBestAvailableLocaleForXmlContent(cms, content.getFile(), content);
final CmsGalleryNameMacroResolver resolver = new CmsGalleryNameMacroResolver(cms, content, locale) {
@SuppressWarnings("synthetic-access")
@Override
public String getMacroValue(String macro) {
if (macro.startsWith(PAGE_PROPERTY_PREFIX)) {
String remainder = macro.substring(PAGE_PROPERTY_PREFIX.length());
int secondColonPos = remainder.indexOf(":");
String defaultValue = "";
String propName = null;
if (secondColonPos >= 0) {
propName = remainder.substring(0, secondColonPos);
defaultValue = remainder.substring(secondColonPos + 1);
} else {
propName = remainder;
}
if (containerPage != null) {
try {
CmsProperty prop = cms.readPropertyObject(containerPage, propName, true);
String propValue = prop.getValue();
if ((propValue == null) || PROPERTY_EMPTY_MARKER.equals(propValue)) {
propValue = defaultValue;
}
return propValue;
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
return defaultValue;
}
}
}
return super.getMacroValue(macro);
}
};
resolver.setStringTemplateSource(stringtemplateSource);
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
CmsMultiMessages messages = new CmsMultiMessages(wpLocale);
messages.addMessages(OpenCms.getWorkplaceManager().getMessages(wpLocale));
messages.addMessages(content.getContentDefinition().getContentHandler().getMessages(wpLocale));
resolver.setCmsObject(cms);
resolver.setKeepEmptyMacros(true);
resolver.setMessages(messages);
return resolver;
} | java | public static CmsMacroResolver getMacroResolverForProperties(
final CmsObject cms,
final I_CmsXmlContentHandler contentHandler,
final CmsXmlContent content,
final Function<String, String> stringtemplateSource,
final CmsResource containerPage) {
Locale locale = OpenCms.getLocaleManager().getBestAvailableLocaleForXmlContent(cms, content.getFile(), content);
final CmsGalleryNameMacroResolver resolver = new CmsGalleryNameMacroResolver(cms, content, locale) {
@SuppressWarnings("synthetic-access")
@Override
public String getMacroValue(String macro) {
if (macro.startsWith(PAGE_PROPERTY_PREFIX)) {
String remainder = macro.substring(PAGE_PROPERTY_PREFIX.length());
int secondColonPos = remainder.indexOf(":");
String defaultValue = "";
String propName = null;
if (secondColonPos >= 0) {
propName = remainder.substring(0, secondColonPos);
defaultValue = remainder.substring(secondColonPos + 1);
} else {
propName = remainder;
}
if (containerPage != null) {
try {
CmsProperty prop = cms.readPropertyObject(containerPage, propName, true);
String propValue = prop.getValue();
if ((propValue == null) || PROPERTY_EMPTY_MARKER.equals(propValue)) {
propValue = defaultValue;
}
return propValue;
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
return defaultValue;
}
}
}
return super.getMacroValue(macro);
}
};
resolver.setStringTemplateSource(stringtemplateSource);
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
CmsMultiMessages messages = new CmsMultiMessages(wpLocale);
messages.addMessages(OpenCms.getWorkplaceManager().getMessages(wpLocale));
messages.addMessages(content.getContentDefinition().getContentHandler().getMessages(wpLocale));
resolver.setCmsObject(cms);
resolver.setKeepEmptyMacros(true);
resolver.setMessages(messages);
return resolver;
} | [
"public",
"static",
"CmsMacroResolver",
"getMacroResolverForProperties",
"(",
"final",
"CmsObject",
"cms",
",",
"final",
"I_CmsXmlContentHandler",
"contentHandler",
",",
"final",
"CmsXmlContent",
"content",
",",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"stringtemplateSource",
",",
"final",
"CmsResource",
"containerPage",
")",
"{",
"Locale",
"locale",
"=",
"OpenCms",
".",
"getLocaleManager",
"(",
")",
".",
"getBestAvailableLocaleForXmlContent",
"(",
"cms",
",",
"content",
".",
"getFile",
"(",
")",
",",
"content",
")",
";",
"final",
"CmsGalleryNameMacroResolver",
"resolver",
"=",
"new",
"CmsGalleryNameMacroResolver",
"(",
"cms",
",",
"content",
",",
"locale",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"@",
"Override",
"public",
"String",
"getMacroValue",
"(",
"String",
"macro",
")",
"{",
"if",
"(",
"macro",
".",
"startsWith",
"(",
"PAGE_PROPERTY_PREFIX",
")",
")",
"{",
"String",
"remainder",
"=",
"macro",
".",
"substring",
"(",
"PAGE_PROPERTY_PREFIX",
".",
"length",
"(",
")",
")",
";",
"int",
"secondColonPos",
"=",
"remainder",
".",
"indexOf",
"(",
"\":\"",
")",
";",
"String",
"defaultValue",
"=",
"\"\"",
";",
"String",
"propName",
"=",
"null",
";",
"if",
"(",
"secondColonPos",
">=",
"0",
")",
"{",
"propName",
"=",
"remainder",
".",
"substring",
"(",
"0",
",",
"secondColonPos",
")",
";",
"defaultValue",
"=",
"remainder",
".",
"substring",
"(",
"secondColonPos",
"+",
"1",
")",
";",
"}",
"else",
"{",
"propName",
"=",
"remainder",
";",
"}",
"if",
"(",
"containerPage",
"!=",
"null",
")",
"{",
"try",
"{",
"CmsProperty",
"prop",
"=",
"cms",
".",
"readPropertyObject",
"(",
"containerPage",
",",
"propName",
",",
"true",
")",
";",
"String",
"propValue",
"=",
"prop",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"(",
"propValue",
"==",
"null",
")",
"||",
"PROPERTY_EMPTY_MARKER",
".",
"equals",
"(",
"propValue",
")",
")",
"{",
"propValue",
"=",
"defaultValue",
";",
"}",
"return",
"propValue",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"defaultValue",
";",
"}",
"}",
"}",
"return",
"super",
".",
"getMacroValue",
"(",
"macro",
")",
";",
"}",
"}",
";",
"resolver",
".",
"setStringTemplateSource",
"(",
"stringtemplateSource",
")",
";",
"Locale",
"wpLocale",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getWorkplaceLocale",
"(",
"cms",
")",
";",
"CmsMultiMessages",
"messages",
"=",
"new",
"CmsMultiMessages",
"(",
"wpLocale",
")",
";",
"messages",
".",
"addMessages",
"(",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getMessages",
"(",
"wpLocale",
")",
")",
";",
"messages",
".",
"addMessages",
"(",
"content",
".",
"getContentDefinition",
"(",
")",
".",
"getContentHandler",
"(",
")",
".",
"getMessages",
"(",
"wpLocale",
")",
")",
";",
"resolver",
".",
"setCmsObject",
"(",
"cms",
")",
";",
"resolver",
".",
"setKeepEmptyMacros",
"(",
"true",
")",
";",
"resolver",
".",
"setMessages",
"(",
"messages",
")",
";",
"return",
"resolver",
";",
"}"
] | Creates and configures a new macro resolver for resolving macros which occur in property definitions.<p>
@param cms the CMS context
@param contentHandler the content handler which contains the message bundle that should be available in the macro resolver
@param content the XML content object
@param stringtemplateSource provides stringtemplate templates for use in %(stringtemplate:...) macros
@param containerPage the current container page
@return a new macro resolver | [
"Creates",
"and",
"configures",
"a",
"new",
"macro",
"resolver",
"for",
"resolving",
"macros",
"which",
"occur",
"in",
"property",
"definitions",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L214-L268 |
taimos/GPSd4Java | src/main/java/de/taimos/gpsd4java/backend/GISTool.java | GISTool.getDistance | public static double getDistance(final double x1, final double x2, final double y1, final double y2) {
// transform to radian
final double deg2rad = Math.PI / 180;
final double x1rad = x1 * deg2rad;
final double x2rad = x2 * deg2rad;
final double y1rad = y1 * deg2rad;
final double y2rad = y2 * deg2rad;
// great-circle-distance with hypersine formula
final double dlong = x1rad - x2rad;
final double dlat = y1rad - y2rad;
final double a = Math.pow(Math.sin(dlat / 2), 2) + (Math.cos(y1rad) * Math.cos(y2rad) * Math.pow(Math.sin(dlong / 2), 2));
final double c = 2 * Math.asin(Math.sqrt(a));
return GISTool.EARTH_RADIUS_KILOMETERS * c;
} | java | public static double getDistance(final double x1, final double x2, final double y1, final double y2) {
// transform to radian
final double deg2rad = Math.PI / 180;
final double x1rad = x1 * deg2rad;
final double x2rad = x2 * deg2rad;
final double y1rad = y1 * deg2rad;
final double y2rad = y2 * deg2rad;
// great-circle-distance with hypersine formula
final double dlong = x1rad - x2rad;
final double dlat = y1rad - y2rad;
final double a = Math.pow(Math.sin(dlat / 2), 2) + (Math.cos(y1rad) * Math.cos(y2rad) * Math.pow(Math.sin(dlong / 2), 2));
final double c = 2 * Math.asin(Math.sqrt(a));
return GISTool.EARTH_RADIUS_KILOMETERS * c;
} | [
"public",
"static",
"double",
"getDistance",
"(",
"final",
"double",
"x1",
",",
"final",
"double",
"x2",
",",
"final",
"double",
"y1",
",",
"final",
"double",
"y2",
")",
"{",
"// transform to radian",
"final",
"double",
"deg2rad",
"=",
"Math",
".",
"PI",
"/",
"180",
";",
"final",
"double",
"x1rad",
"=",
"x1",
"*",
"deg2rad",
";",
"final",
"double",
"x2rad",
"=",
"x2",
"*",
"deg2rad",
";",
"final",
"double",
"y1rad",
"=",
"y1",
"*",
"deg2rad",
";",
"final",
"double",
"y2rad",
"=",
"y2",
"*",
"deg2rad",
";",
"// great-circle-distance with hypersine formula",
"final",
"double",
"dlong",
"=",
"x1rad",
"-",
"x2rad",
";",
"final",
"double",
"dlat",
"=",
"y1rad",
"-",
"y2rad",
";",
"final",
"double",
"a",
"=",
"Math",
".",
"pow",
"(",
"Math",
".",
"sin",
"(",
"dlat",
"/",
"2",
")",
",",
"2",
")",
"+",
"(",
"Math",
".",
"cos",
"(",
"y1rad",
")",
"*",
"Math",
".",
"cos",
"(",
"y2rad",
")",
"*",
"Math",
".",
"pow",
"(",
"Math",
".",
"sin",
"(",
"dlong",
"/",
"2",
")",
",",
"2",
")",
")",
";",
"final",
"double",
"c",
"=",
"2",
"*",
"Math",
".",
"asin",
"(",
"Math",
".",
"sqrt",
"(",
"a",
")",
")",
";",
"return",
"GISTool",
".",
"EARTH_RADIUS_KILOMETERS",
"*",
"c",
";",
"}"
] | calculates the distance between two locations, which are given as coordinates, in kilometers<br>
the method used is the great-circle-distance with hypersine formula
@param x1 - longitude of position 1
@param x2 - longitude of position 2
@param y1 - latitude of position 1
@param y2 - latitude of position 2
@return distance in kilometers | [
"calculates",
"the",
"distance",
"between",
"two",
"locations",
"which",
"are",
"given",
"as",
"coordinates",
"in",
"kilometers<br",
">",
"the",
"method",
"used",
"is",
"the",
"great",
"-",
"circle",
"-",
"distance",
"with",
"hypersine",
"formula"
] | train | https://github.com/taimos/GPSd4Java/blob/f3bdfcc5eed628417ea72bf20d108519f24d105b/src/main/java/de/taimos/gpsd4java/backend/GISTool.java#L60-L76 |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadEditSelection.java | TypeaheadEditSelection.getSelectionForRequiredObject | @Nonnull
public static TypeaheadEditSelection getSelectionForRequiredObject (@Nonnull final IWebPageExecutionContext aWPEC,
@Nullable final String sEditFieldName,
@Nullable final String sHiddenFieldName)
{
ValueEnforcer.notNull (aWPEC, "WPEC");
String sEditValue = aWPEC.params ().getAsString (sEditFieldName);
String sHiddenFieldValue = aWPEC.params ().getAsString (sHiddenFieldName);
if (StringHelper.hasText (sHiddenFieldValue))
{
if (StringHelper.hasNoText (sEditValue))
{
// The content of the edit field was deleted after a valid item was once
// selected
sHiddenFieldValue = null;
}
}
else
{
if (StringHelper.hasText (sEditValue))
{
// No ID but a text -> no object selected but only a string typed
sEditValue = null;
}
}
return new TypeaheadEditSelection (sEditValue, sHiddenFieldValue);
} | java | @Nonnull
public static TypeaheadEditSelection getSelectionForRequiredObject (@Nonnull final IWebPageExecutionContext aWPEC,
@Nullable final String sEditFieldName,
@Nullable final String sHiddenFieldName)
{
ValueEnforcer.notNull (aWPEC, "WPEC");
String sEditValue = aWPEC.params ().getAsString (sEditFieldName);
String sHiddenFieldValue = aWPEC.params ().getAsString (sHiddenFieldName);
if (StringHelper.hasText (sHiddenFieldValue))
{
if (StringHelper.hasNoText (sEditValue))
{
// The content of the edit field was deleted after a valid item was once
// selected
sHiddenFieldValue = null;
}
}
else
{
if (StringHelper.hasText (sEditValue))
{
// No ID but a text -> no object selected but only a string typed
sEditValue = null;
}
}
return new TypeaheadEditSelection (sEditValue, sHiddenFieldValue);
} | [
"@",
"Nonnull",
"public",
"static",
"TypeaheadEditSelection",
"getSelectionForRequiredObject",
"(",
"@",
"Nonnull",
"final",
"IWebPageExecutionContext",
"aWPEC",
",",
"@",
"Nullable",
"final",
"String",
"sEditFieldName",
",",
"@",
"Nullable",
"final",
"String",
"sHiddenFieldName",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aWPEC",
",",
"\"WPEC\"",
")",
";",
"String",
"sEditValue",
"=",
"aWPEC",
".",
"params",
"(",
")",
".",
"getAsString",
"(",
"sEditFieldName",
")",
";",
"String",
"sHiddenFieldValue",
"=",
"aWPEC",
".",
"params",
"(",
")",
".",
"getAsString",
"(",
"sHiddenFieldName",
")",
";",
"if",
"(",
"StringHelper",
".",
"hasText",
"(",
"sHiddenFieldValue",
")",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sEditValue",
")",
")",
"{",
"// The content of the edit field was deleted after a valid item was once",
"// selected",
"sHiddenFieldValue",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"StringHelper",
".",
"hasText",
"(",
"sEditValue",
")",
")",
"{",
"// No ID but a text -> no object selected but only a string typed",
"sEditValue",
"=",
"null",
";",
"}",
"}",
"return",
"new",
"TypeaheadEditSelection",
"(",
"sEditValue",
",",
"sHiddenFieldValue",
")",
";",
"}"
] | Get the current selection in the case that it is mandatory to select an
available object.
@param aWPEC
The current web page execution context. May not be <code>null</code>
.
@param sEditFieldName
The name of the edit input field.
@param sHiddenFieldName
The name of the hidden field with the ID.
@return Never <code>null</code>. | [
"Get",
"the",
"current",
"selection",
"in",
"the",
"case",
"that",
"it",
"is",
"mandatory",
"to",
"select",
"an",
"available",
"object",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadEditSelection.java#L93-L121 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/MalisisGui.java | MalisisGui.sendAction | public static void sendAction(ActionType action, MalisisSlot slot, int code)
{
if (action == null || current() == null || current().inventoryContainer == null)
return;
int inventoryId = slot != null ? slot.getInventoryId() : 0;
int slotNumber = slot != null ? slot.getSlotIndex() : 0;
current().inventoryContainer.handleAction(action, inventoryId, slotNumber, code);
InventoryActionMessage.sendAction(action, inventoryId, slotNumber, code);
} | java | public static void sendAction(ActionType action, MalisisSlot slot, int code)
{
if (action == null || current() == null || current().inventoryContainer == null)
return;
int inventoryId = slot != null ? slot.getInventoryId() : 0;
int slotNumber = slot != null ? slot.getSlotIndex() : 0;
current().inventoryContainer.handleAction(action, inventoryId, slotNumber, code);
InventoryActionMessage.sendAction(action, inventoryId, slotNumber, code);
} | [
"public",
"static",
"void",
"sendAction",
"(",
"ActionType",
"action",
",",
"MalisisSlot",
"slot",
",",
"int",
"code",
")",
"{",
"if",
"(",
"action",
"==",
"null",
"||",
"current",
"(",
")",
"==",
"null",
"||",
"current",
"(",
")",
".",
"inventoryContainer",
"==",
"null",
")",
"return",
";",
"int",
"inventoryId",
"=",
"slot",
"!=",
"null",
"?",
"slot",
".",
"getInventoryId",
"(",
")",
":",
"0",
";",
"int",
"slotNumber",
"=",
"slot",
"!=",
"null",
"?",
"slot",
".",
"getSlotIndex",
"(",
")",
":",
"0",
";",
"current",
"(",
")",
".",
"inventoryContainer",
".",
"handleAction",
"(",
"action",
",",
"inventoryId",
",",
"slotNumber",
",",
"code",
")",
";",
"InventoryActionMessage",
".",
"sendAction",
"(",
"action",
",",
"inventoryId",
",",
"slotNumber",
",",
"code",
")",
";",
"}"
] | Sends a GUI action to the server.
@param action the action
@param slot the slot
@param code the keyboard code | [
"Sends",
"a",
"GUI",
"action",
"to",
"the",
"server",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/MalisisGui.java#L773-L783 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketUtil.java | WebSocketUtil.randomNumber | static int randomNumber(int minimum, int maximum) {
assert minimum < maximum;
double fraction = PlatformDependent.threadLocalRandom().nextDouble();
// the idea here is that nextDouble gives us a random value
//
// 0 <= fraction <= 1
//
// the distance from min to max declared as
//
// dist = max - min
//
// satisfies the following
//
// min + dist = max
//
// taking into account
//
// 0 <= fraction * dist <= dist
//
// we've got
//
// min <= min + fraction * dist <= max
return (int) (minimum + fraction * (maximum - minimum));
} | java | static int randomNumber(int minimum, int maximum) {
assert minimum < maximum;
double fraction = PlatformDependent.threadLocalRandom().nextDouble();
// the idea here is that nextDouble gives us a random value
//
// 0 <= fraction <= 1
//
// the distance from min to max declared as
//
// dist = max - min
//
// satisfies the following
//
// min + dist = max
//
// taking into account
//
// 0 <= fraction * dist <= dist
//
// we've got
//
// min <= min + fraction * dist <= max
return (int) (minimum + fraction * (maximum - minimum));
} | [
"static",
"int",
"randomNumber",
"(",
"int",
"minimum",
",",
"int",
"maximum",
")",
"{",
"assert",
"minimum",
"<",
"maximum",
";",
"double",
"fraction",
"=",
"PlatformDependent",
".",
"threadLocalRandom",
"(",
")",
".",
"nextDouble",
"(",
")",
";",
"// the idea here is that nextDouble gives us a random value",
"//",
"// 0 <= fraction <= 1",
"//",
"// the distance from min to max declared as",
"//",
"// dist = max - min",
"//",
"// satisfies the following",
"//",
"// min + dist = max",
"//",
"// taking into account",
"//",
"// 0 <= fraction * dist <= dist",
"//",
"// we've got",
"//",
"// min <= min + fraction * dist <= max",
"return",
"(",
"int",
")",
"(",
"minimum",
"+",
"fraction",
"*",
"(",
"maximum",
"-",
"minimum",
")",
")",
";",
"}"
] | Generates a pseudo-random number
@param minimum The minimum allowable value
@param maximum The maximum allowable value
@return A pseudo-random number | [
"Generates",
"a",
"pseudo",
"-",
"random",
"number"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketUtil.java#L120-L144 |
javabits/yar | yar-api/src/main/java/org/javabits/yar/TimeoutException.java | TimeoutException.getTimeoutMessage | public static String getTimeoutMessage(long timeout, TimeUnit unit) {
return String.format("Timeout of %d %s reached", timeout, requireNonNull(unit, "unit"));
} | java | public static String getTimeoutMessage(long timeout, TimeUnit unit) {
return String.format("Timeout of %d %s reached", timeout, requireNonNull(unit, "unit"));
} | [
"public",
"static",
"String",
"getTimeoutMessage",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"Timeout of %d %s reached\"",
",",
"timeout",
",",
"requireNonNull",
"(",
"unit",
",",
"\"unit\"",
")",
")",
";",
"}"
] | Utility method that produce the message of the timeout.
@param timeout the maximum time to wait.
@param unit the time unit of the timeout argument
@return formatted string that contains the timeout information. | [
"Utility",
"method",
"that",
"produce",
"the",
"message",
"of",
"the",
"timeout",
"."
] | train | https://github.com/javabits/yar/blob/e146a86611ca4831e8334c9a98fd7086cee9c03e/yar-api/src/main/java/org/javabits/yar/TimeoutException.java#L91-L93 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java | BugInstance.addMethod | @Nonnull
public BugInstance addMethod(@SlashedClassName String className, String methodName, String methodSig, int accessFlags) {
addMethod(MethodAnnotation.fromForeignMethod(className, methodName, methodSig, accessFlags));
return this;
} | java | @Nonnull
public BugInstance addMethod(@SlashedClassName String className, String methodName, String methodSig, int accessFlags) {
addMethod(MethodAnnotation.fromForeignMethod(className, methodName, methodSig, accessFlags));
return this;
} | [
"@",
"Nonnull",
"public",
"BugInstance",
"addMethod",
"(",
"@",
"SlashedClassName",
"String",
"className",
",",
"String",
"methodName",
",",
"String",
"methodSig",
",",
"int",
"accessFlags",
")",
"{",
"addMethod",
"(",
"MethodAnnotation",
".",
"fromForeignMethod",
"(",
"className",
",",
"methodName",
",",
"methodSig",
",",
"accessFlags",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a method annotation. If this is the first method annotation added, it
becomes the primary method annotation.
@param className
name of the class containing the method
@param methodName
name of the method
@param methodSig
type signature of the method
@param accessFlags
accessFlags for the method
@return this object | [
"Add",
"a",
"method",
"annotation",
".",
"If",
"this",
"is",
"the",
"first",
"method",
"annotation",
"added",
"it",
"becomes",
"the",
"primary",
"method",
"annotation",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1325-L1329 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java | PropertyColumnTableDescription.addPropertyColumn | public void addPropertyColumn(String propertyName, Class propertyType, TableCellEditor editor)
{
addPropertyColumn(propertyName).withEditor(editor);
} | java | public void addPropertyColumn(String propertyName, Class propertyType, TableCellEditor editor)
{
addPropertyColumn(propertyName).withEditor(editor);
} | [
"public",
"void",
"addPropertyColumn",
"(",
"String",
"propertyName",
",",
"Class",
"propertyType",
",",
"TableCellEditor",
"editor",
")",
"{",
"addPropertyColumn",
"(",
"propertyName",
")",
".",
"withEditor",
"(",
"editor",
")",
";",
"}"
] | WARNING: propertyType is discarded, it should be fetched from the entityType through introspection.
@deprecated
@see #addPropertyColumn(String)
@see PropertyColumn#withEditor(javax.swing.table.TableCellEditor) | [
"WARNING",
":",
"propertyType",
"is",
"discarded",
"it",
"should",
"be",
"fetched",
"from",
"the",
"entityType",
"through",
"introspection",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java#L240-L243 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasView.java | CmsAliasView.setData | public void setData(List<CmsAliasTableRow> data, List<CmsRewriteAliasTableRow> rewriteData) {
m_table.getLiveDataList().clear();
m_table.getLiveDataList().addAll(data);
m_rewriteTable.getLiveDataList().clear();
m_rewriteTable.getLiveDataList().addAll(rewriteData);
} | java | public void setData(List<CmsAliasTableRow> data, List<CmsRewriteAliasTableRow> rewriteData) {
m_table.getLiveDataList().clear();
m_table.getLiveDataList().addAll(data);
m_rewriteTable.getLiveDataList().clear();
m_rewriteTable.getLiveDataList().addAll(rewriteData);
} | [
"public",
"void",
"setData",
"(",
"List",
"<",
"CmsAliasTableRow",
">",
"data",
",",
"List",
"<",
"CmsRewriteAliasTableRow",
">",
"rewriteData",
")",
"{",
"m_table",
".",
"getLiveDataList",
"(",
")",
".",
"clear",
"(",
")",
";",
"m_table",
".",
"getLiveDataList",
"(",
")",
".",
"addAll",
"(",
"data",
")",
";",
"m_rewriteTable",
".",
"getLiveDataList",
"(",
")",
".",
"clear",
"(",
")",
";",
"m_rewriteTable",
".",
"getLiveDataList",
"(",
")",
".",
"addAll",
"(",
"rewriteData",
")",
";",
"}"
] | Replaces the contents of the live data row list with another list of rows.<p>
@param data the new list of rows to be placed into the live data list
@param rewriteData the list of rewrite alias data | [
"Replaces",
"the",
"contents",
"of",
"the",
"live",
"data",
"row",
"list",
"with",
"another",
"list",
"of",
"rows",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasView.java#L299-L305 |
bazaarvoice/emodb | table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java | AstyanaxTableDAO.tableFromJson | @VisibleForTesting
Table tableFromJson(TableJson json) {
if (json.isDropped()) {
return null;
}
String name = json.getTable();
Map<String, Object> attributes = json.getAttributeMap();
Storage masterStorage = json.getMasterStorage();
String masterPlacement = masterStorage.getPlacement();
Collection<Storage> facades = json.getFacades();
TableOptions options = new TableOptionsBuilder()
.setPlacement(masterPlacement)
.setFacades(ImmutableList.copyOf(Iterables.transform(facades, new Function<Storage, FacadeOptions>() {
@Override
public FacadeOptions apply(Storage facade) {
return new FacadeOptions(facade.getPlacement());
}
})))
.build();
Storage storageForDc = masterStorage;
boolean available = true;
if (!_placementFactory.isAvailablePlacement(masterPlacement)) {
available = false;
// The master placement does not belong to this datacenter. Let's see if we have a
// facade that belongs to this datacenter. If not, we'll stick with the masterStorage.
for (Storage facade : facades) {
if (_placementFactory.isAvailablePlacement(facade.getPlacement())) {
if (storageForDc.isFacade()) {
// We found multiple facades for the same datacenter.
throw new TableExistsException(format("Multiple facades found for table %s in %s", name, _selfDataCenter), name);
}
storageForDc = facade;
available = true;
}
}
}
return newTable(name, options, attributes, available, storageForDc);
} | java | @VisibleForTesting
Table tableFromJson(TableJson json) {
if (json.isDropped()) {
return null;
}
String name = json.getTable();
Map<String, Object> attributes = json.getAttributeMap();
Storage masterStorage = json.getMasterStorage();
String masterPlacement = masterStorage.getPlacement();
Collection<Storage> facades = json.getFacades();
TableOptions options = new TableOptionsBuilder()
.setPlacement(masterPlacement)
.setFacades(ImmutableList.copyOf(Iterables.transform(facades, new Function<Storage, FacadeOptions>() {
@Override
public FacadeOptions apply(Storage facade) {
return new FacadeOptions(facade.getPlacement());
}
})))
.build();
Storage storageForDc = masterStorage;
boolean available = true;
if (!_placementFactory.isAvailablePlacement(masterPlacement)) {
available = false;
// The master placement does not belong to this datacenter. Let's see if we have a
// facade that belongs to this datacenter. If not, we'll stick with the masterStorage.
for (Storage facade : facades) {
if (_placementFactory.isAvailablePlacement(facade.getPlacement())) {
if (storageForDc.isFacade()) {
// We found multiple facades for the same datacenter.
throw new TableExistsException(format("Multiple facades found for table %s in %s", name, _selfDataCenter), name);
}
storageForDc = facade;
available = true;
}
}
}
return newTable(name, options, attributes, available, storageForDc);
} | [
"@",
"VisibleForTesting",
"Table",
"tableFromJson",
"(",
"TableJson",
"json",
")",
"{",
"if",
"(",
"json",
".",
"isDropped",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"name",
"=",
"json",
".",
"getTable",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
"=",
"json",
".",
"getAttributeMap",
"(",
")",
";",
"Storage",
"masterStorage",
"=",
"json",
".",
"getMasterStorage",
"(",
")",
";",
"String",
"masterPlacement",
"=",
"masterStorage",
".",
"getPlacement",
"(",
")",
";",
"Collection",
"<",
"Storage",
">",
"facades",
"=",
"json",
".",
"getFacades",
"(",
")",
";",
"TableOptions",
"options",
"=",
"new",
"TableOptionsBuilder",
"(",
")",
".",
"setPlacement",
"(",
"masterPlacement",
")",
".",
"setFacades",
"(",
"ImmutableList",
".",
"copyOf",
"(",
"Iterables",
".",
"transform",
"(",
"facades",
",",
"new",
"Function",
"<",
"Storage",
",",
"FacadeOptions",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FacadeOptions",
"apply",
"(",
"Storage",
"facade",
")",
"{",
"return",
"new",
"FacadeOptions",
"(",
"facade",
".",
"getPlacement",
"(",
")",
")",
";",
"}",
"}",
")",
")",
")",
".",
"build",
"(",
")",
";",
"Storage",
"storageForDc",
"=",
"masterStorage",
";",
"boolean",
"available",
"=",
"true",
";",
"if",
"(",
"!",
"_placementFactory",
".",
"isAvailablePlacement",
"(",
"masterPlacement",
")",
")",
"{",
"available",
"=",
"false",
";",
"// The master placement does not belong to this datacenter. Let's see if we have a",
"// facade that belongs to this datacenter. If not, we'll stick with the masterStorage.",
"for",
"(",
"Storage",
"facade",
":",
"facades",
")",
"{",
"if",
"(",
"_placementFactory",
".",
"isAvailablePlacement",
"(",
"facade",
".",
"getPlacement",
"(",
")",
")",
")",
"{",
"if",
"(",
"storageForDc",
".",
"isFacade",
"(",
")",
")",
"{",
"// We found multiple facades for the same datacenter.",
"throw",
"new",
"TableExistsException",
"(",
"format",
"(",
"\"Multiple facades found for table %s in %s\"",
",",
"name",
",",
"_selfDataCenter",
")",
",",
"name",
")",
";",
"}",
"storageForDc",
"=",
"facade",
";",
"available",
"=",
"true",
";",
"}",
"}",
"}",
"return",
"newTable",
"(",
"name",
",",
"options",
",",
"attributes",
",",
"available",
",",
"storageForDc",
")",
";",
"}"
] | Parse the persistent JSON object into an AstyanaxTable.
If the master placement doesn't belong to this datacenter, this method will:
a. try to find a facade for this table that belongs to this datacenter
b. If no facade is found, it will return the table in the master placement. | [
"Parse",
"the",
"persistent",
"JSON",
"object",
"into",
"an",
"AstyanaxTable",
".",
"If",
"the",
"master",
"placement",
"doesn",
"t",
"belong",
"to",
"this",
"datacenter",
"this",
"method",
"will",
":",
"a",
".",
"try",
"to",
"find",
"a",
"facade",
"for",
"this",
"table",
"that",
"belongs",
"to",
"this",
"datacenter",
"b",
".",
"If",
"no",
"facade",
"is",
"found",
"it",
"will",
"return",
"the",
"table",
"in",
"the",
"master",
"placement",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java#L1228-L1268 |
allengeorge/libraft | libraft-agent/src/main/java/io/libraft/agent/protocol/RaftRPC.java | RaftRPC.setupCustomCommandSerializationAndDeserialization | public static void setupCustomCommandSerializationAndDeserialization(ObjectMapper mapper, CommandSerializer commandSerializer, CommandDeserializer commandDeserializer) {
SimpleModule module = new SimpleModule("raftrpc-custom-command-module", new Version(0, 0, 0, "inline", "io.libraft", "raftrpc-command-module"));
module.addSerializer(Command.class, new RaftRPCCommand.Serializer(commandSerializer));
module.addDeserializer(Command.class, new RaftRPCCommand.Deserializer(commandDeserializer));
mapper.registerModule(module);
} | java | public static void setupCustomCommandSerializationAndDeserialization(ObjectMapper mapper, CommandSerializer commandSerializer, CommandDeserializer commandDeserializer) {
SimpleModule module = new SimpleModule("raftrpc-custom-command-module", new Version(0, 0, 0, "inline", "io.libraft", "raftrpc-command-module"));
module.addSerializer(Command.class, new RaftRPCCommand.Serializer(commandSerializer));
module.addDeserializer(Command.class, new RaftRPCCommand.Deserializer(commandDeserializer));
mapper.registerModule(module);
} | [
"public",
"static",
"void",
"setupCustomCommandSerializationAndDeserialization",
"(",
"ObjectMapper",
"mapper",
",",
"CommandSerializer",
"commandSerializer",
",",
"CommandDeserializer",
"commandDeserializer",
")",
"{",
"SimpleModule",
"module",
"=",
"new",
"SimpleModule",
"(",
"\"raftrpc-custom-command-module\"",
",",
"new",
"Version",
"(",
"0",
",",
"0",
",",
"0",
",",
"\"inline\"",
",",
"\"io.libraft\"",
",",
"\"raftrpc-command-module\"",
")",
")",
";",
"module",
".",
"addSerializer",
"(",
"Command",
".",
"class",
",",
"new",
"RaftRPCCommand",
".",
"Serializer",
"(",
"commandSerializer",
")",
")",
";",
"module",
".",
"addDeserializer",
"(",
"Command",
".",
"class",
",",
"new",
"RaftRPCCommand",
".",
"Deserializer",
"(",
"commandDeserializer",
")",
")",
";",
"mapper",
".",
"registerModule",
"(",
"module",
")",
";",
"}"
] | Setup custom serialization and deserialization for POJO {@link Command} subclasses.
<p/>
See {@code RaftAgent} for more on which {@code Command} types are supported.
@param mapper instance of {@code ObjectMapper} with which the serialization/deserialization mapping is registered
@param commandSerializer instance of {@code CommandSerializer} that can serialize a POJO {@code Command} instance into binary
@param commandDeserializer instance of {@code CommandDeserializer} that can deserialize binary into a POJO {@code Command} instance
@see io.libraft.agent.RaftAgent | [
"Setup",
"custom",
"serialization",
"and",
"deserialization",
"for",
"POJO",
"{",
"@link",
"Command",
"}",
"subclasses",
".",
"<p",
"/",
">",
"See",
"{",
"@code",
"RaftAgent",
"}",
"for",
"more",
"on",
"which",
"{",
"@code",
"Command",
"}",
"types",
"are",
"supported",
"."
] | train | https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/protocol/RaftRPC.java#L113-L120 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java | DictionaryFactory.createSingletonDictionary | public static ADictionary createSingletonDictionary(JcsegTaskConfig config, boolean loadDic)
{
synchronized (LOCK) {
if ( singletonDic == null ) {
singletonDic = createDefaultDictionary(config, loadDic);
}
}
return singletonDic;
} | java | public static ADictionary createSingletonDictionary(JcsegTaskConfig config, boolean loadDic)
{
synchronized (LOCK) {
if ( singletonDic == null ) {
singletonDic = createDefaultDictionary(config, loadDic);
}
}
return singletonDic;
} | [
"public",
"static",
"ADictionary",
"createSingletonDictionary",
"(",
"JcsegTaskConfig",
"config",
",",
"boolean",
"loadDic",
")",
"{",
"synchronized",
"(",
"LOCK",
")",
"{",
"if",
"(",
"singletonDic",
"==",
"null",
")",
"{",
"singletonDic",
"=",
"createDefaultDictionary",
"(",
"config",
",",
"loadDic",
")",
";",
"}",
"}",
"return",
"singletonDic",
";",
"}"
] | create a singleton ADictionary object according to the JcsegTaskConfig
@param config
@param loadDic
@return ADictionary | [
"create",
"a",
"singleton",
"ADictionary",
"object",
"according",
"to",
"the",
"JcsegTaskConfig"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java#L147-L156 |
optimaize/anythingworks | client/rest/src/main/java/com/optimaize/anythingworks/client/rest/http/HeaderParams.java | HeaderParams.put | public HeaderParams put(String name, String value) {
values.put(cleanAndValidate(name), cleanAndValidate(value));
return this;
} | java | public HeaderParams put(String name, String value) {
values.put(cleanAndValidate(name), cleanAndValidate(value));
return this;
} | [
"public",
"HeaderParams",
"put",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"values",
".",
"put",
"(",
"cleanAndValidate",
"(",
"name",
")",
",",
"cleanAndValidate",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | Overwrites in case there is a value already associated with that name.
@return the same instance | [
"Overwrites",
"in",
"case",
"there",
"is",
"a",
"value",
"already",
"associated",
"with",
"that",
"name",
"."
] | train | https://github.com/optimaize/anythingworks/blob/23e5f1c63cd56d935afaac4ad033c7996b32a1f2/client/rest/src/main/java/com/optimaize/anythingworks/client/rest/http/HeaderParams.java#L47-L50 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.optionsAsync | public <T> CompletableFuture<T> optionsAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> options(type, closure), getExecutor());
} | java | public <T> CompletableFuture<T> optionsAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> options(type, closure), getExecutor());
} | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"optionsAsync",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"@",
"DelegatesTo",
"(",
"HttpConfig",
".",
"class",
")",
"final",
"Closure",
"closure",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"(",
")",
"->",
"options",
"(",
"type",
",",
"closure",
")",
",",
"getExecutor",
"(",
")",
")",
";",
"}"
] | Executes an asynchronous OPTIONS request on the configured URI (asynchronous alias to the `options(Class,Closure)` method), with additional
configuration provided by the configuration closure. The result will be cast to the specified `type`. A response to a OPTIONS request contains no
data; however, the `response.when()` methods may provide data based on response headers, which will be cast to the specified type.
[source,groovy]
----
def http = HttpBuilder.configure {
request.uri = 'http://localhost:10101/date'
}
CompletableFuture future = http.optionsAsync(Date){
response.success { FromServer fromServer ->
Date.parse('yyyy.MM.dd HH:mm', fromServer.headers.find { it.key == 'stamp' }.value)
}
}
Date result = future.get()
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
@param type the type of the response content
@param closure the additional configuration closure (delegated to {@link HttpConfig})
@return a {@link CompletableFuture} which may be used to access the resulting content (if present) | [
"Executes",
"an",
"asynchronous",
"OPTIONS",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"the",
"options",
"(",
"Class",
"Closure",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration",
"closure",
".",
"The",
"result",
"will",
"be",
"cast",
"to",
"the",
"specified",
"type",
".",
"A",
"response",
"to",
"a",
"OPTIONS",
"request",
"contains",
"no",
"data",
";",
"however",
"the",
"response",
".",
"when",
"()",
"methods",
"may",
"provide",
"data",
"based",
"on",
"response",
"headers",
"which",
"will",
"be",
"cast",
"to",
"the",
"specified",
"type",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1956-L1958 |
OpenLiberty/open-liberty | dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/java/NetworkInterfaces.java | NetworkInterfaces.getInterfaceInfo | private void getInterfaceInfo(NetworkInterface networkInterface, PrintWriter out) throws IOException {
final String indent = " ";
// Basic information from the interface
out.println();
out.append("Interface: ").append(networkInterface.getDisplayName()).println();
out.append(indent).append(" loopback: ").append(Boolean.toString(networkInterface.isLoopback())).println();
out.append(indent).append(" mtu: ").append(Integer.toString(networkInterface.getMTU())).println();
out.append(indent).append(" point-to-point: ").append(Boolean.toString(networkInterface.isPointToPoint())).println();
out.append(indent).append("supports multicast: ").append(Boolean.toString(networkInterface.supportsMulticast())).println();
out.append(indent).append(" up: ").append(Boolean.toString(networkInterface.isUp())).println();
out.append(indent).append(" virtual: ").append(Boolean.toString(networkInterface.isVirtual())).println();
// Interface address information
List<InterfaceAddress> intfAddresses = networkInterface.getInterfaceAddresses();
for (int i = 0; i < intfAddresses.size(); i++) {
out.append(indent).append("InterfaceAddress #").append(Integer.toString(i + 1)).append(": ").append(String.valueOf(intfAddresses.get(i))).println();
}
// Network interface information
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
for (int i = 1; inetAddresses.hasMoreElements(); i++) {
InetAddress inetAddress = inetAddresses.nextElement();
out.append(indent).append("InetAddress #").append(Integer.toString(i)).println(":");
out.append(indent).append(indent).append(" IP address: ").append(inetAddress.getHostAddress()).println();
out.append(indent).append(indent).append(" host name: ").append(inetAddress.getHostName()).println();
out.append(indent).append(indent).append("FQDN host name: ").append(inetAddress.getCanonicalHostName()).println();
}
} | java | private void getInterfaceInfo(NetworkInterface networkInterface, PrintWriter out) throws IOException {
final String indent = " ";
// Basic information from the interface
out.println();
out.append("Interface: ").append(networkInterface.getDisplayName()).println();
out.append(indent).append(" loopback: ").append(Boolean.toString(networkInterface.isLoopback())).println();
out.append(indent).append(" mtu: ").append(Integer.toString(networkInterface.getMTU())).println();
out.append(indent).append(" point-to-point: ").append(Boolean.toString(networkInterface.isPointToPoint())).println();
out.append(indent).append("supports multicast: ").append(Boolean.toString(networkInterface.supportsMulticast())).println();
out.append(indent).append(" up: ").append(Boolean.toString(networkInterface.isUp())).println();
out.append(indent).append(" virtual: ").append(Boolean.toString(networkInterface.isVirtual())).println();
// Interface address information
List<InterfaceAddress> intfAddresses = networkInterface.getInterfaceAddresses();
for (int i = 0; i < intfAddresses.size(); i++) {
out.append(indent).append("InterfaceAddress #").append(Integer.toString(i + 1)).append(": ").append(String.valueOf(intfAddresses.get(i))).println();
}
// Network interface information
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
for (int i = 1; inetAddresses.hasMoreElements(); i++) {
InetAddress inetAddress = inetAddresses.nextElement();
out.append(indent).append("InetAddress #").append(Integer.toString(i)).println(":");
out.append(indent).append(indent).append(" IP address: ").append(inetAddress.getHostAddress()).println();
out.append(indent).append(indent).append(" host name: ").append(inetAddress.getHostName()).println();
out.append(indent).append(indent).append("FQDN host name: ").append(inetAddress.getCanonicalHostName()).println();
}
} | [
"private",
"void",
"getInterfaceInfo",
"(",
"NetworkInterface",
"networkInterface",
",",
"PrintWriter",
"out",
")",
"throws",
"IOException",
"{",
"final",
"String",
"indent",
"=",
"\" \"",
";",
"// Basic information from the interface",
"out",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"\"Interface: \"",
")",
".",
"append",
"(",
"networkInterface",
".",
"getDisplayName",
"(",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\" loopback: \"",
")",
".",
"append",
"(",
"Boolean",
".",
"toString",
"(",
"networkInterface",
".",
"isLoopback",
"(",
")",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\" mtu: \"",
")",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"networkInterface",
".",
"getMTU",
"(",
")",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\" point-to-point: \"",
")",
".",
"append",
"(",
"Boolean",
".",
"toString",
"(",
"networkInterface",
".",
"isPointToPoint",
"(",
")",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\"supports multicast: \"",
")",
".",
"append",
"(",
"Boolean",
".",
"toString",
"(",
"networkInterface",
".",
"supportsMulticast",
"(",
")",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\" up: \"",
")",
".",
"append",
"(",
"Boolean",
".",
"toString",
"(",
"networkInterface",
".",
"isUp",
"(",
")",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\" virtual: \"",
")",
".",
"append",
"(",
"Boolean",
".",
"toString",
"(",
"networkInterface",
".",
"isVirtual",
"(",
")",
")",
")",
".",
"println",
"(",
")",
";",
"// Interface address information",
"List",
"<",
"InterfaceAddress",
">",
"intfAddresses",
"=",
"networkInterface",
".",
"getInterfaceAddresses",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intfAddresses",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\"InterfaceAddress #\"",
")",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"i",
"+",
"1",
")",
")",
".",
"append",
"(",
"\": \"",
")",
".",
"append",
"(",
"String",
".",
"valueOf",
"(",
"intfAddresses",
".",
"get",
"(",
"i",
")",
")",
")",
".",
"println",
"(",
")",
";",
"}",
"// Network interface information",
"Enumeration",
"<",
"InetAddress",
">",
"inetAddresses",
"=",
"networkInterface",
".",
"getInetAddresses",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"inetAddresses",
".",
"hasMoreElements",
"(",
")",
";",
"i",
"++",
")",
"{",
"InetAddress",
"inetAddress",
"=",
"inetAddresses",
".",
"nextElement",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\"InetAddress #\"",
")",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"i",
")",
")",
".",
"println",
"(",
"\":\"",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\" IP address: \"",
")",
".",
"append",
"(",
"inetAddress",
".",
"getHostAddress",
"(",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\" host name: \"",
")",
".",
"append",
"(",
"inetAddress",
".",
"getHostName",
"(",
")",
")",
".",
"println",
"(",
")",
";",
"out",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"indent",
")",
".",
"append",
"(",
"\"FQDN host name: \"",
")",
".",
"append",
"(",
"inetAddress",
".",
"getCanonicalHostName",
"(",
")",
")",
".",
"println",
"(",
")",
";",
"}",
"}"
] | Capture interface specific information and write it to the provided writer.
@param networkInterface the interface to introspect
@param writer the print writer to write information to | [
"Capture",
"interface",
"specific",
"information",
"and",
"write",
"it",
"to",
"the",
"provided",
"writer",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/java/NetworkInterfaces.java#L77-L105 |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java | AbstractCommonShapeFileReader.setReadingPosition | protected void setReadingPosition(int recordIndex, int byteIndex) throws IOException {
if (this.seekEnabled) {
this.nextExpectedRecordIndex = recordIndex;
this.buffer.position(byteIndex);
} else {
throw new SeekOperationDisabledException();
}
} | java | protected void setReadingPosition(int recordIndex, int byteIndex) throws IOException {
if (this.seekEnabled) {
this.nextExpectedRecordIndex = recordIndex;
this.buffer.position(byteIndex);
} else {
throw new SeekOperationDisabledException();
}
} | [
"protected",
"void",
"setReadingPosition",
"(",
"int",
"recordIndex",
",",
"int",
"byteIndex",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"seekEnabled",
")",
"{",
"this",
".",
"nextExpectedRecordIndex",
"=",
"recordIndex",
";",
"this",
".",
"buffer",
".",
"position",
"(",
"byteIndex",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"SeekOperationDisabledException",
"(",
")",
";",
"}",
"}"
] | Set the reading position, excluding the header.
@param recordIndex is the index of the next record to read.
@param byteIndex is the index of the next byte to read (excluding the header).
@throws IOException in case of error. | [
"Set",
"the",
"reading",
"position",
"excluding",
"the",
"header",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java#L614-L621 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/windowing/WindowManager.java | WindowManager.getEarliestEventTs | public long getEarliestEventTs(long startTs, long endTs) {
long minTs = Long.MAX_VALUE;
for (Event<T> event : queue) {
if (event.getTimestamp() > startTs && event.getTimestamp() <= endTs) {
minTs = Math.min(minTs, event.getTimestamp());
}
}
return minTs;
} | java | public long getEarliestEventTs(long startTs, long endTs) {
long minTs = Long.MAX_VALUE;
for (Event<T> event : queue) {
if (event.getTimestamp() > startTs && event.getTimestamp() <= endTs) {
minTs = Math.min(minTs, event.getTimestamp());
}
}
return minTs;
} | [
"public",
"long",
"getEarliestEventTs",
"(",
"long",
"startTs",
",",
"long",
"endTs",
")",
"{",
"long",
"minTs",
"=",
"Long",
".",
"MAX_VALUE",
";",
"for",
"(",
"Event",
"<",
"T",
">",
"event",
":",
"queue",
")",
"{",
"if",
"(",
"event",
".",
"getTimestamp",
"(",
")",
">",
"startTs",
"&&",
"event",
".",
"getTimestamp",
"(",
")",
"<=",
"endTs",
")",
"{",
"minTs",
"=",
"Math",
".",
"min",
"(",
"minTs",
",",
"event",
".",
"getTimestamp",
"(",
")",
")",
";",
"}",
"}",
"return",
"minTs",
";",
"}"
] | Scans the event queue and returns the next earliest event ts
between the startTs and endTs
@param startTs the start ts (exclusive)
@param endTs the end ts (inclusive)
@return the earliest event ts between startTs and endTs | [
"Scans",
"the",
"event",
"queue",
"and",
"returns",
"the",
"next",
"earliest",
"event",
"ts",
"between",
"the",
"startTs",
"and",
"endTs"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/windowing/WindowManager.java#L225-L233 |
lisicnu/droidUtil | src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java | ShellUtils.execCommand | public static CommandResult execCommand(String command, boolean isRoot) {
return execCommand(new String[]{command}, isRoot, true);
} | java | public static CommandResult execCommand(String command, boolean isRoot) {
return execCommand(new String[]{command}, isRoot, true);
} | [
"public",
"static",
"CommandResult",
"execCommand",
"(",
"String",
"command",
",",
"boolean",
"isRoot",
")",
"{",
"return",
"execCommand",
"(",
"new",
"String",
"[",
"]",
"{",
"command",
"}",
",",
"isRoot",
",",
"true",
")",
";",
"}"
] | execute shell command, default return result msg
@param command command
@param isRoot whether need to run with root
@return
@see ShellUtils#execCommand(String[], boolean, boolean) | [
"execute",
"shell",
"command",
"default",
"return",
"result",
"msg"
] | train | https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java#L44-L46 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java | SpiderSession.objectQuery | public QueryResult objectQuery(String tableName,
String queryText,
String fieldNames,
int pageSize,
String afterObjID,
String sortOrder) {
Map<String, String> params = new HashMap<>();
if (!Utils.isEmpty(queryText)) {
params.put("q", queryText);
}
if (!Utils.isEmpty(fieldNames)) {
params.put("f", fieldNames);
}
if (pageSize >= 0) {
params.put("s", Integer.toString(pageSize));
}
if (!Utils.isEmpty(afterObjID)) {
params.put("g", afterObjID);
}
if (!Utils.isEmpty(sortOrder)) {
params.put("o", sortOrder);
}
return objectQuery(tableName, params);
} | java | public QueryResult objectQuery(String tableName,
String queryText,
String fieldNames,
int pageSize,
String afterObjID,
String sortOrder) {
Map<String, String> params = new HashMap<>();
if (!Utils.isEmpty(queryText)) {
params.put("q", queryText);
}
if (!Utils.isEmpty(fieldNames)) {
params.put("f", fieldNames);
}
if (pageSize >= 0) {
params.put("s", Integer.toString(pageSize));
}
if (!Utils.isEmpty(afterObjID)) {
params.put("g", afterObjID);
}
if (!Utils.isEmpty(sortOrder)) {
params.put("o", sortOrder);
}
return objectQuery(tableName, params);
} | [
"public",
"QueryResult",
"objectQuery",
"(",
"String",
"tableName",
",",
"String",
"queryText",
",",
"String",
"fieldNames",
",",
"int",
"pageSize",
",",
"String",
"afterObjID",
",",
"String",
"sortOrder",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"queryText",
")",
")",
"{",
"params",
".",
"put",
"(",
"\"q\"",
",",
"queryText",
")",
";",
"}",
"if",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"fieldNames",
")",
")",
"{",
"params",
".",
"put",
"(",
"\"f\"",
",",
"fieldNames",
")",
";",
"}",
"if",
"(",
"pageSize",
">=",
"0",
")",
"{",
"params",
".",
"put",
"(",
"\"s\"",
",",
"Integer",
".",
"toString",
"(",
"pageSize",
")",
")",
";",
"}",
"if",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"afterObjID",
")",
")",
"{",
"params",
".",
"put",
"(",
"\"g\"",
",",
"afterObjID",
")",
";",
"}",
"if",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"sortOrder",
")",
")",
"{",
"params",
".",
"put",
"(",
"\"o\"",
",",
"sortOrder",
")",
";",
"}",
"return",
"objectQuery",
"(",
"tableName",
",",
"params",
")",
";",
"}"
] | Perform an object query for the given table and query parameters. This is a
convenience method for Spider applications that bundles the given parameters into
a Map<String,String> and calls {@link #objectQuery(String, Map)}. String parameters
should *not* be URL-encoded. Optional, unused parameters can be null or empty (for
strings) or -1 (for integers).
@param tableName Name of table to query. Must belong to this session's
application.
@param queryText Query expression ('q') parameter. Required.
@param fieldNames Comma-separated field names to retrieve. Optional.
@param pageSize Page size ('s'). Optional.
@param afterObjID Continue-after continuation token ('g'). Optional.
@param sortOrder Sort order parameter ('o'). Optional.
@return Query results as a {@link QueryResult} object. | [
"Perform",
"an",
"object",
"query",
"for",
"the",
"given",
"table",
"and",
"query",
"parameters",
".",
"This",
"is",
"a",
"convenience",
"method",
"for",
"Spider",
"applications",
"that",
"bundles",
"the",
"given",
"parameters",
"into",
"a",
"Map<String",
"String",
">",
"and",
"calls",
"{",
"@link",
"#objectQuery",
"(",
"String",
"Map",
")",
"}",
".",
"String",
"parameters",
"should",
"*",
"not",
"*",
"be",
"URL",
"-",
"encoded",
".",
"Optional",
"unused",
"parameters",
"can",
"be",
"null",
"or",
"empty",
"(",
"for",
"strings",
")",
"or",
"-",
"1",
"(",
"for",
"integers",
")",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java#L506-L529 |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java | JsonUtils.fromInputStream | public static Object fromInputStream(InputStream input, String enc) throws IOException {
return fromInputStream(input, Charset.forName(enc));
} | java | public static Object fromInputStream(InputStream input, String enc) throws IOException {
return fromInputStream(input, Charset.forName(enc));
} | [
"public",
"static",
"Object",
"fromInputStream",
"(",
"InputStream",
"input",
",",
"String",
"enc",
")",
"throws",
"IOException",
"{",
"return",
"fromInputStream",
"(",
"input",
",",
"Charset",
".",
"forName",
"(",
"enc",
")",
")",
";",
"}"
] | Parses a JSON-LD document from the given {@link InputStream} to an object
that can be used as input for the {@link JsonLdApi} and
{@link JsonLdProcessor} methods.
@param input
The JSON-LD document in an InputStream.
@param enc
The character encoding to use when interpreting the characters
in the InputStream.
@return A JSON Object.
@throws JsonParseException
If there was a JSON related error during parsing.
@throws IOException
If there was an IO error during parsing. | [
"Parses",
"a",
"JSON",
"-",
"LD",
"document",
"from",
"the",
"given",
"{",
"@link",
"InputStream",
"}",
"to",
"an",
"object",
"that",
"can",
"be",
"used",
"as",
"input",
"for",
"the",
"{",
"@link",
"JsonLdApi",
"}",
"and",
"{",
"@link",
"JsonLdProcessor",
"}",
"methods",
"."
] | train | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java#L131-L133 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java | RtcpHandler.scheduleRtcp | private void scheduleRtcp(long timestamp, RtcpPacketType packetType) {
// Create the task and schedule it
long interval = resolveInterval(timestamp);
this.scheduledTask = new TxTask(packetType);
try {
this.reportTaskFuture = this.scheduler.schedule(this.scheduledTask, interval, TimeUnit.MILLISECONDS);
// Let the RTP handler know what is the type of scheduled packet
this.statistics.setRtcpPacketType(packetType);
} catch (IllegalStateException e) {
logger.warn("RTCP timer already canceled. No more reports will be scheduled.");
}
} | java | private void scheduleRtcp(long timestamp, RtcpPacketType packetType) {
// Create the task and schedule it
long interval = resolveInterval(timestamp);
this.scheduledTask = new TxTask(packetType);
try {
this.reportTaskFuture = this.scheduler.schedule(this.scheduledTask, interval, TimeUnit.MILLISECONDS);
// Let the RTP handler know what is the type of scheduled packet
this.statistics.setRtcpPacketType(packetType);
} catch (IllegalStateException e) {
logger.warn("RTCP timer already canceled. No more reports will be scheduled.");
}
} | [
"private",
"void",
"scheduleRtcp",
"(",
"long",
"timestamp",
",",
"RtcpPacketType",
"packetType",
")",
"{",
"// Create the task and schedule it",
"long",
"interval",
"=",
"resolveInterval",
"(",
"timestamp",
")",
";",
"this",
".",
"scheduledTask",
"=",
"new",
"TxTask",
"(",
"packetType",
")",
";",
"try",
"{",
"this",
".",
"reportTaskFuture",
"=",
"this",
".",
"scheduler",
".",
"schedule",
"(",
"this",
".",
"scheduledTask",
",",
"interval",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"// Let the RTP handler know what is the type of scheduled packet",
"this",
".",
"statistics",
".",
"setRtcpPacketType",
"(",
"packetType",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"logger",
".",
"warn",
"(",
"\"RTCP timer already canceled. No more reports will be scheduled.\"",
")",
";",
"}",
"}"
] | Schedules an event to occur at a certain time.
@param timestamp The time (in milliseconds) when the event should be fired
@param packet The RTCP packet to be sent when the timer expires | [
"Schedules",
"an",
"event",
"to",
"occur",
"at",
"a",
"certain",
"time",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java#L225-L237 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginGetAdvertisedRoutes | public GatewayRouteListResultInner beginGetAdvertisedRoutes(String resourceGroupName, String virtualNetworkGatewayName, String peer) {
return beginGetAdvertisedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, peer).toBlocking().single().body();
} | java | public GatewayRouteListResultInner beginGetAdvertisedRoutes(String resourceGroupName, String virtualNetworkGatewayName, String peer) {
return beginGetAdvertisedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, peer).toBlocking().single().body();
} | [
"public",
"GatewayRouteListResultInner",
"beginGetAdvertisedRoutes",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
",",
"String",
"peer",
")",
"{",
"return",
"beginGetAdvertisedRoutesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
",",
"peer",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | This operation retrieves a list of routes the virtual network gateway is advertising to the specified peer.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@param peer The IP address of the peer
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the GatewayRouteListResultInner object if successful. | [
"This",
"operation",
"retrieves",
"a",
"list",
"of",
"routes",
"the",
"virtual",
"network",
"gateway",
"is",
"advertising",
"to",
"the",
"specified",
"peer",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2567-L2569 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getValueWithGivenYield | public double getValueWithGivenYield(double evaluationTime, double rate, AnalyticModel model) {
DiscountCurve referenceCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors("referenceCurve", new double[] {0.0, 1.0}, new double[] {1.0, 1.0});
return getValueWithGivenSpreadOverCurve(evaluationTime, referenceCurve, rate, model);
} | java | public double getValueWithGivenYield(double evaluationTime, double rate, AnalyticModel model) {
DiscountCurve referenceCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors("referenceCurve", new double[] {0.0, 1.0}, new double[] {1.0, 1.0});
return getValueWithGivenSpreadOverCurve(evaluationTime, referenceCurve, rate, model);
} | [
"public",
"double",
"getValueWithGivenYield",
"(",
"double",
"evaluationTime",
",",
"double",
"rate",
",",
"AnalyticModel",
"model",
")",
"{",
"DiscountCurve",
"referenceCurve",
"=",
"DiscountCurveInterpolation",
".",
"createDiscountCurveFromDiscountFactors",
"(",
"\"referenceCurve\"",
",",
"new",
"double",
"[",
"]",
"{",
"0.0",
",",
"1.0",
"}",
",",
"new",
"double",
"[",
"]",
"{",
"1.0",
",",
"1.0",
"}",
")",
";",
"return",
"getValueWithGivenSpreadOverCurve",
"(",
"evaluationTime",
",",
"referenceCurve",
",",
"rate",
",",
"model",
")",
";",
"}"
] | Returns the value of the sum of discounted cash flows of the bond where
the discounting is done with the given yield curve.
This method can be used for optimizer.
@param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered.
@param rate The yield which is used for discounted the coupon payments.
@param model The model under which the product is valued.
@return The value of the bond for the given yield. | [
"Returns",
"the",
"value",
"of",
"the",
"sum",
"of",
"discounted",
"cash",
"flows",
"of",
"the",
"bond",
"where",
"the",
"discounting",
"is",
"done",
"with",
"the",
"given",
"yield",
"curve",
".",
"This",
"method",
"can",
"be",
"used",
"for",
"optimizer",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L256-L259 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.copyClose | protected long copyClose(InputStream in, OutputStream out) throws IOException
{
try
{
try
{
return copy(in, out);
}
finally
{
in.close();
}
}
finally
{
out.close();
}
} | java | protected long copyClose(InputStream in, OutputStream out) throws IOException
{
try
{
try
{
return copy(in, out);
}
finally
{
in.close();
}
}
finally
{
out.close();
}
} | [
"protected",
"long",
"copyClose",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"try",
"{",
"try",
"{",
"return",
"copy",
"(",
"in",
",",
"out",
")",
";",
"}",
"finally",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Copy input to output data using NIO. Input and output streams will be closed after the
operation.
@param in
InputStream
@param out
OutputStream
@return The number of bytes, possibly zero, that were actually copied
@throws IOException
if error occurs | [
"Copy",
"input",
"to",
"output",
"data",
"using",
"NIO",
".",
"Input",
"and",
"output",
"streams",
"will",
"be",
"closed",
"after",
"the",
"operation",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L310-L327 |
kite-sdk/kite | kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Marker.java | Marker.getAs | public <T> T getAs(String name, Class<T> returnType) {
return Conversions.convert(get(name), returnType);
} | java | public <T> T getAs(String name, Class<T> returnType) {
return Conversions.convert(get(name), returnType);
} | [
"public",
"<",
"T",
">",
"T",
"getAs",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"returnType",
")",
"{",
"return",
"Conversions",
".",
"convert",
"(",
"get",
"(",
"name",
")",
",",
"returnType",
")",
";",
"}"
] | Returns the value for {@code name} coerced to the given type, T.
@param <T> the return type
@param name the String name of the value to return
@param returnType The return type, which must be assignable from Long,
Integer, String, or Object
@return the Object stored for {@code name} coerced to a T
@throws ClassCastException if the return type is unknown | [
"Returns",
"the",
"value",
"for",
"{",
"@code",
"name",
"}",
"coerced",
"to",
"the",
"given",
"type",
"T",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Marker.java#L93-L95 |
sniggle/simple-pgp | simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/BaseKeyPairGenerator.java | BaseKeyPairGenerator.generateKeyPair | public boolean generateKeyPair(String userId, String password, OutputStream publicKey, OutputStream secrectKey) {
LOGGER.trace("generateKeyPair(String, String, OutputStream, OutputStream)");
LOGGER.trace("User ID: {}, Password: ********, Public Key: {}, Secret Key: {}", userId, publicKey == null ? "not set" : "set", secrectKey == null ? "not set" : "set");
return generateKeyPair(userId, password, DEFAULT_KEY_SIZE, publicKey, secrectKey);
} | java | public boolean generateKeyPair(String userId, String password, OutputStream publicKey, OutputStream secrectKey) {
LOGGER.trace("generateKeyPair(String, String, OutputStream, OutputStream)");
LOGGER.trace("User ID: {}, Password: ********, Public Key: {}, Secret Key: {}", userId, publicKey == null ? "not set" : "set", secrectKey == null ? "not set" : "set");
return generateKeyPair(userId, password, DEFAULT_KEY_SIZE, publicKey, secrectKey);
} | [
"public",
"boolean",
"generateKeyPair",
"(",
"String",
"userId",
",",
"String",
"password",
",",
"OutputStream",
"publicKey",
",",
"OutputStream",
"secrectKey",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"generateKeyPair(String, String, OutputStream, OutputStream)\"",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"User ID: {}, Password: ********, Public Key: {}, Secret Key: {}\"",
",",
"userId",
",",
"publicKey",
"==",
"null",
"?",
"\"not set\"",
":",
"\"set\"",
",",
"secrectKey",
"==",
"null",
"?",
"\"not set\"",
":",
"\"set\"",
")",
";",
"return",
"generateKeyPair",
"(",
"userId",
",",
"password",
",",
"DEFAULT_KEY_SIZE",
",",
"publicKey",
",",
"secrectKey",
")",
";",
"}"
] | @see KeyPairGenerator#generateKeyPair(String, String, OutputStream, OutputStream)
@param userId
the user id for the PGP key pair
@param password
the password used to secure the secret (private) key
@param publicKey
the target stream for the public key
@param secrectKey
the target stream for the secret (private) key
@return | [
"@see",
"KeyPairGenerator#generateKeyPair",
"(",
"String",
"String",
"OutputStream",
"OutputStream",
")"
] | train | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/BaseKeyPairGenerator.java#L120-L124 |
ontop/ontop | engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/TreeWitnessRewriter.java | TreeWitnessRewriter.getHeadAtom | private Function getHeadAtom(String base, String suffix, List<Term> arguments) {
Predicate predicate = datalogFactory.getSubqueryPredicate(base + suffix, arguments.size());
return termFactory.getFunction(predicate, arguments);
} | java | private Function getHeadAtom(String base, String suffix, List<Term> arguments) {
Predicate predicate = datalogFactory.getSubqueryPredicate(base + suffix, arguments.size());
return termFactory.getFunction(predicate, arguments);
} | [
"private",
"Function",
"getHeadAtom",
"(",
"String",
"base",
",",
"String",
"suffix",
",",
"List",
"<",
"Term",
">",
"arguments",
")",
"{",
"Predicate",
"predicate",
"=",
"datalogFactory",
".",
"getSubqueryPredicate",
"(",
"base",
"+",
"suffix",
",",
"arguments",
".",
"size",
"(",
")",
")",
";",
"return",
"termFactory",
".",
"getFunction",
"(",
"predicate",
",",
"arguments",
")",
";",
"}"
] | /*
returns an atom with given arguments and the predicate name formed by the given URI basis and string fragment | [
"/",
"*",
"returns",
"an",
"atom",
"with",
"given",
"arguments",
"and",
"the",
"predicate",
"name",
"formed",
"by",
"the",
"given",
"URI",
"basis",
"and",
"string",
"fragment"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/TreeWitnessRewriter.java#L128-L131 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java | ComputeKNNOutlierScores.writeResult | void writeResult(PrintStream out, DBIDs ids, OutlierResult result, ScalingFunction scaling, String label) {
if(scaling instanceof OutlierScaling) {
((OutlierScaling) scaling).prepare(result);
}
out.append(label);
DoubleRelation scores = result.getScores();
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
double value = scores.doubleValue(iter);
value = scaling != null ? scaling.getScaled(value) : value;
out.append(' ').append(Double.toString(value));
}
out.append(FormatUtil.NEWLINE);
} | java | void writeResult(PrintStream out, DBIDs ids, OutlierResult result, ScalingFunction scaling, String label) {
if(scaling instanceof OutlierScaling) {
((OutlierScaling) scaling).prepare(result);
}
out.append(label);
DoubleRelation scores = result.getScores();
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
double value = scores.doubleValue(iter);
value = scaling != null ? scaling.getScaled(value) : value;
out.append(' ').append(Double.toString(value));
}
out.append(FormatUtil.NEWLINE);
} | [
"void",
"writeResult",
"(",
"PrintStream",
"out",
",",
"DBIDs",
"ids",
",",
"OutlierResult",
"result",
",",
"ScalingFunction",
"scaling",
",",
"String",
"label",
")",
"{",
"if",
"(",
"scaling",
"instanceof",
"OutlierScaling",
")",
"{",
"(",
"(",
"OutlierScaling",
")",
"scaling",
")",
".",
"prepare",
"(",
"result",
")",
";",
"}",
"out",
".",
"append",
"(",
"label",
")",
";",
"DoubleRelation",
"scores",
"=",
"result",
".",
"getScores",
"(",
")",
";",
"for",
"(",
"DBIDIter",
"iter",
"=",
"ids",
".",
"iter",
"(",
")",
";",
"iter",
".",
"valid",
"(",
")",
";",
"iter",
".",
"advance",
"(",
")",
")",
"{",
"double",
"value",
"=",
"scores",
".",
"doubleValue",
"(",
"iter",
")",
";",
"value",
"=",
"scaling",
"!=",
"null",
"?",
"scaling",
".",
"getScaled",
"(",
"value",
")",
":",
"value",
";",
"out",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"Double",
".",
"toString",
"(",
"value",
")",
")",
";",
"}",
"out",
".",
"append",
"(",
"FormatUtil",
".",
"NEWLINE",
")",
";",
"}"
] | Write a single output line.
@param out Output stream
@param ids DBIDs
@param result Outlier result
@param scaling Scaling function
@param label Identification label | [
"Write",
"a",
"single",
"output",
"line",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java#L336-L348 |
mikereedell/sunrisesunsetlib-java | src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java | SolarEventCalculator.computeSunriseTime | public String computeSunriseTime(Zenith solarZenith, Calendar date) {
return getLocalTimeAsString(computeSolarEventTime(solarZenith, date, true));
} | java | public String computeSunriseTime(Zenith solarZenith, Calendar date) {
return getLocalTimeAsString(computeSolarEventTime(solarZenith, date, true));
} | [
"public",
"String",
"computeSunriseTime",
"(",
"Zenith",
"solarZenith",
",",
"Calendar",
"date",
")",
"{",
"return",
"getLocalTimeAsString",
"(",
"computeSolarEventTime",
"(",
"solarZenith",
",",
"date",
",",
"true",
")",
")",
";",
"}"
] | Computes the sunrise time for the given zenith at the given date.
@param solarZenith
<code>Zenith</code> enum corresponding to the type of sunrise to compute.
@param date
<code>Calendar</code> object representing the date to compute the sunrise for.
@return the sunrise time, in HH:MM format (24-hour clock), 00:00 if the sun does not rise on the given
date. | [
"Computes",
"the",
"sunrise",
"time",
"for",
"the",
"given",
"zenith",
"at",
"the",
"given",
"date",
"."
] | train | https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java#L72-L74 |
Mthwate/DatLib | src/main/java/com/mthwate/datlib/HashUtils.java | HashUtils.hashHex | public static String hashHex(byte[] data, HashAlgorithm alg) throws NoSuchAlgorithmException {
return hashHex(data, alg.toString());
} | java | public static String hashHex(byte[] data, HashAlgorithm alg) throws NoSuchAlgorithmException {
return hashHex(data, alg.toString());
} | [
"public",
"static",
"String",
"hashHex",
"(",
"byte",
"[",
"]",
"data",
",",
"HashAlgorithm",
"alg",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"return",
"hashHex",
"(",
"data",
",",
"alg",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Hashes data with the specified hashing algorithm. Returns a hexadecimal result.
@since 1.1
@param data the data to hash
@param alg the hashing algorithm to use
@return the hexadecimal hash of the data
@throws NoSuchAlgorithmException the algorithm is not supported by existing providers | [
"Hashes",
"data",
"with",
"the",
"specified",
"hashing",
"algorithm",
".",
"Returns",
"a",
"hexadecimal",
"result",
"."
] | train | https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/HashUtils.java#L76-L78 |
ixa-ehu/ixa-pipe-ml | src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java | AbstractContextGenerator.punctbo | protected String punctbo(final Parse punct, final int i) {
final StringBuilder feat = new StringBuilder(5);
feat.append(i).append("=");
feat.append(punct.getType());
return feat.toString();
} | java | protected String punctbo(final Parse punct, final int i) {
final StringBuilder feat = new StringBuilder(5);
feat.append(i).append("=");
feat.append(punct.getType());
return feat.toString();
} | [
"protected",
"String",
"punctbo",
"(",
"final",
"Parse",
"punct",
",",
"final",
"int",
"i",
")",
"{",
"final",
"StringBuilder",
"feat",
"=",
"new",
"StringBuilder",
"(",
"5",
")",
";",
"feat",
".",
"append",
"(",
"i",
")",
".",
"append",
"(",
"\"=\"",
")",
";",
"feat",
".",
"append",
"(",
"punct",
".",
"getType",
"(",
")",
")",
";",
"return",
"feat",
".",
"toString",
"(",
")",
";",
"}"
] | Creates punctuation feature for the specified punctuation at the specfied
index based on the punctuation's tag.
@param punct
The punctuation which is in context.
@param i
The index of the punctuation relative to the parse.
@return Punctuation feature for the specified parse and the specified
punctuation at the specfied index. | [
"Creates",
"punctuation",
"feature",
"for",
"the",
"specified",
"punctuation",
"at",
"the",
"specfied",
"index",
"based",
"on",
"the",
"punctuation",
"s",
"tag",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java#L66-L71 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java | FileDownloadUtils.deleteDirectory | public static void deleteDirectory(Path dir) throws IOException {
if(dir == null || !Files.exists(dir))
return;
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
if (e != null) {
throw e;
}
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
} | java | public static void deleteDirectory(Path dir) throws IOException {
if(dir == null || !Files.exists(dir))
return;
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
if (e != null) {
throw e;
}
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
} | [
"public",
"static",
"void",
"deleteDirectory",
"(",
"Path",
"dir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dir",
"==",
"null",
"||",
"!",
"Files",
".",
"exists",
"(",
"dir",
")",
")",
"return",
";",
"Files",
".",
"walkFileTree",
"(",
"dir",
",",
"new",
"SimpleFileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"Path",
"file",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"file",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"Path",
"dir",
",",
"IOException",
"e",
")",
"throws",
"IOException",
"{",
"if",
"(",
"e",
"!=",
"null",
")",
"{",
"throw",
"e",
";",
"}",
"Files",
".",
"delete",
"(",
"dir",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"}",
")",
";",
"}"
] | Recursively delete a folder & contents
@param dir directory to delete | [
"Recursively",
"delete",
"a",
"folder",
"&",
"contents"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java#L255-L274 |
openengsb/openengsb | components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/PersistInterfaceService.java | PersistInterfaceService.performRevertLogic | private void performRevertLogic(String revision, UUID expectedContextHeadRevision, boolean expectedHeadCheck) {
String contextId = "";
try {
EDBCommit commit = edbService.getCommitByRevision(revision);
contextId = commit.getContextId();
lockContext(contextId);
if (expectedHeadCheck) {
checkForContextHeadRevision(contextId, expectedContextHeadRevision);
}
EDBCommit newCommit = edbService.createEDBCommit(new ArrayList<EDBObject>(),
new ArrayList<EDBObject>(), new ArrayList<EDBObject>());
for (EDBObject reverted : commit.getObjects()) {
// need to be done in order to avoid problems with conflict detection
reverted.remove(EDBConstants.MODEL_VERSION);
newCommit.update(reverted);
}
for (String delete : commit.getDeletions()) {
newCommit.delete(delete);
}
newCommit.setComment(String.format("revert [%s] %s", commit.getRevisionNumber().toString(),
commit.getComment() != null ? commit.getComment() : ""));
edbService.commit(newCommit);
} catch (EDBException e) {
throw new EKBException("Unable to revert to the given revision " + revision, e);
} finally {
releaseContext(contextId);
}
} | java | private void performRevertLogic(String revision, UUID expectedContextHeadRevision, boolean expectedHeadCheck) {
String contextId = "";
try {
EDBCommit commit = edbService.getCommitByRevision(revision);
contextId = commit.getContextId();
lockContext(contextId);
if (expectedHeadCheck) {
checkForContextHeadRevision(contextId, expectedContextHeadRevision);
}
EDBCommit newCommit = edbService.createEDBCommit(new ArrayList<EDBObject>(),
new ArrayList<EDBObject>(), new ArrayList<EDBObject>());
for (EDBObject reverted : commit.getObjects()) {
// need to be done in order to avoid problems with conflict detection
reverted.remove(EDBConstants.MODEL_VERSION);
newCommit.update(reverted);
}
for (String delete : commit.getDeletions()) {
newCommit.delete(delete);
}
newCommit.setComment(String.format("revert [%s] %s", commit.getRevisionNumber().toString(),
commit.getComment() != null ? commit.getComment() : ""));
edbService.commit(newCommit);
} catch (EDBException e) {
throw new EKBException("Unable to revert to the given revision " + revision, e);
} finally {
releaseContext(contextId);
}
} | [
"private",
"void",
"performRevertLogic",
"(",
"String",
"revision",
",",
"UUID",
"expectedContextHeadRevision",
",",
"boolean",
"expectedHeadCheck",
")",
"{",
"String",
"contextId",
"=",
"\"\"",
";",
"try",
"{",
"EDBCommit",
"commit",
"=",
"edbService",
".",
"getCommitByRevision",
"(",
"revision",
")",
";",
"contextId",
"=",
"commit",
".",
"getContextId",
"(",
")",
";",
"lockContext",
"(",
"contextId",
")",
";",
"if",
"(",
"expectedHeadCheck",
")",
"{",
"checkForContextHeadRevision",
"(",
"contextId",
",",
"expectedContextHeadRevision",
")",
";",
"}",
"EDBCommit",
"newCommit",
"=",
"edbService",
".",
"createEDBCommit",
"(",
"new",
"ArrayList",
"<",
"EDBObject",
">",
"(",
")",
",",
"new",
"ArrayList",
"<",
"EDBObject",
">",
"(",
")",
",",
"new",
"ArrayList",
"<",
"EDBObject",
">",
"(",
")",
")",
";",
"for",
"(",
"EDBObject",
"reverted",
":",
"commit",
".",
"getObjects",
"(",
")",
")",
"{",
"// need to be done in order to avoid problems with conflict detection",
"reverted",
".",
"remove",
"(",
"EDBConstants",
".",
"MODEL_VERSION",
")",
";",
"newCommit",
".",
"update",
"(",
"reverted",
")",
";",
"}",
"for",
"(",
"String",
"delete",
":",
"commit",
".",
"getDeletions",
"(",
")",
")",
"{",
"newCommit",
".",
"delete",
"(",
"delete",
")",
";",
"}",
"newCommit",
".",
"setComment",
"(",
"String",
".",
"format",
"(",
"\"revert [%s] %s\"",
",",
"commit",
".",
"getRevisionNumber",
"(",
")",
".",
"toString",
"(",
")",
",",
"commit",
".",
"getComment",
"(",
")",
"!=",
"null",
"?",
"commit",
".",
"getComment",
"(",
")",
":",
"\"\"",
")",
")",
";",
"edbService",
".",
"commit",
"(",
"newCommit",
")",
";",
"}",
"catch",
"(",
"EDBException",
"e",
")",
"{",
"throw",
"new",
"EKBException",
"(",
"\"Unable to revert to the given revision \"",
"+",
"revision",
",",
"e",
")",
";",
"}",
"finally",
"{",
"releaseContext",
"(",
"contextId",
")",
";",
"}",
"}"
] | Performs the actual revert logic including the context locking and the context head revision check if desired. | [
"Performs",
"the",
"actual",
"revert",
"logic",
"including",
"the",
"context",
"locking",
"and",
"the",
"context",
"head",
"revision",
"check",
"if",
"desired",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/PersistInterfaceService.java#L168-L195 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java | LocalNetworkGatewaysInner.beginDelete | public void beginDelete(String resourceGroupName, String localNetworkGatewayName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String localNetworkGatewayName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"localNetworkGatewayName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"localNetworkGatewayName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Deletes the specified local network gateway.
@param resourceGroupName The name of the resource group.
@param localNetworkGatewayName The name of the local network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"local",
"network",
"gateway",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java#L434-L436 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/FlowQueueService.java | FlowQueueService.moveFlow | public void moveFlow(FlowQueueKey oldKey, FlowQueueKey newKey)
throws DataException, IOException {
byte[] oldRowKey = queueKeyConverter.toBytes(oldKey);
Get get = new Get(oldRowKey);
Table flowQueueTable = null;
try {
flowQueueTable = hbaseConnection
.getTable(TableName.valueOf(Constants.FLOW_QUEUE_TABLE));
Result result = flowQueueTable.get(get);
if (result == null || result.isEmpty()) {
// no existing row
throw new DataException(
"No row for key " + Bytes.toStringBinary(oldRowKey));
}
// copy the existing row to the new key
Put p = new Put(queueKeyConverter.toBytes(newKey));
for (Cell c : result.rawCells()) {
p.addColumn(CellUtil.cloneFamily(c), CellUtil.cloneQualifier(c),
CellUtil.cloneValue(c));
}
flowQueueTable.put(p);
// delete the old row
Delete d = new Delete(oldRowKey);
flowQueueTable.delete(d);
} finally {
if (flowQueueTable != null) {
flowQueueTable.close();
}
}
} | java | public void moveFlow(FlowQueueKey oldKey, FlowQueueKey newKey)
throws DataException, IOException {
byte[] oldRowKey = queueKeyConverter.toBytes(oldKey);
Get get = new Get(oldRowKey);
Table flowQueueTable = null;
try {
flowQueueTable = hbaseConnection
.getTable(TableName.valueOf(Constants.FLOW_QUEUE_TABLE));
Result result = flowQueueTable.get(get);
if (result == null || result.isEmpty()) {
// no existing row
throw new DataException(
"No row for key " + Bytes.toStringBinary(oldRowKey));
}
// copy the existing row to the new key
Put p = new Put(queueKeyConverter.toBytes(newKey));
for (Cell c : result.rawCells()) {
p.addColumn(CellUtil.cloneFamily(c), CellUtil.cloneQualifier(c),
CellUtil.cloneValue(c));
}
flowQueueTable.put(p);
// delete the old row
Delete d = new Delete(oldRowKey);
flowQueueTable.delete(d);
} finally {
if (flowQueueTable != null) {
flowQueueTable.close();
}
}
} | [
"public",
"void",
"moveFlow",
"(",
"FlowQueueKey",
"oldKey",
",",
"FlowQueueKey",
"newKey",
")",
"throws",
"DataException",
",",
"IOException",
"{",
"byte",
"[",
"]",
"oldRowKey",
"=",
"queueKeyConverter",
".",
"toBytes",
"(",
"oldKey",
")",
";",
"Get",
"get",
"=",
"new",
"Get",
"(",
"oldRowKey",
")",
";",
"Table",
"flowQueueTable",
"=",
"null",
";",
"try",
"{",
"flowQueueTable",
"=",
"hbaseConnection",
".",
"getTable",
"(",
"TableName",
".",
"valueOf",
"(",
"Constants",
".",
"FLOW_QUEUE_TABLE",
")",
")",
";",
"Result",
"result",
"=",
"flowQueueTable",
".",
"get",
"(",
"get",
")",
";",
"if",
"(",
"result",
"==",
"null",
"||",
"result",
".",
"isEmpty",
"(",
")",
")",
"{",
"// no existing row",
"throw",
"new",
"DataException",
"(",
"\"No row for key \"",
"+",
"Bytes",
".",
"toStringBinary",
"(",
"oldRowKey",
")",
")",
";",
"}",
"// copy the existing row to the new key",
"Put",
"p",
"=",
"new",
"Put",
"(",
"queueKeyConverter",
".",
"toBytes",
"(",
"newKey",
")",
")",
";",
"for",
"(",
"Cell",
"c",
":",
"result",
".",
"rawCells",
"(",
")",
")",
"{",
"p",
".",
"addColumn",
"(",
"CellUtil",
".",
"cloneFamily",
"(",
"c",
")",
",",
"CellUtil",
".",
"cloneQualifier",
"(",
"c",
")",
",",
"CellUtil",
".",
"cloneValue",
"(",
"c",
")",
")",
";",
"}",
"flowQueueTable",
".",
"put",
"(",
"p",
")",
";",
"// delete the old row",
"Delete",
"d",
"=",
"new",
"Delete",
"(",
"oldRowKey",
")",
";",
"flowQueueTable",
".",
"delete",
"(",
"d",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"flowQueueTable",
"!=",
"null",
")",
"{",
"flowQueueTable",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
] | Moves a flow_queue record from one row key to another. All Cells in the
existing row will be written to the new row. This would primarily be used
for transitioning a flow's data from one status to another.
@param oldKey the existing row key to move
@param newKey the new row key to move to
@throws IOException | [
"Moves",
"a",
"flow_queue",
"record",
"from",
"one",
"row",
"key",
"to",
"another",
".",
"All",
"Cells",
"in",
"the",
"existing",
"row",
"will",
"be",
"written",
"to",
"the",
"new",
"row",
".",
"This",
"would",
"primarily",
"be",
"used",
"for",
"transitioning",
"a",
"flow",
"s",
"data",
"from",
"one",
"status",
"to",
"another",
"."
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/FlowQueueService.java#L96-L125 |
davidmarquis/fluent-interface-proxy | src/main/java/com/fluentinterface/beans/ObjectWrapper.java | ObjectWrapper.getMappedValue | @SuppressWarnings("unchecked")
private static Object getMappedValue(Object obj, Property property, Object key) {
if (property == null) {
throw new IllegalArgumentException("Cannot get the mapped value from a 'null' property.");
}
if (property.getType().isAssignableFrom(Map.class)) {
Map<Object, Object> map = (Map<Object, Object>) property.get(obj);
if (map == null) {
throw new NullPointerException("Invalid 'null' value found for mapped " + property + " in "
+ obj.getClass().getName() + ".");
}
return map.get(key);
} else {
throw new IllegalArgumentException("Cannot get a mapped value from the not mapped " + property
+ ". Only Map type is supported, but " + property.getType().getSimpleName() + " found.");
}
} | java | @SuppressWarnings("unchecked")
private static Object getMappedValue(Object obj, Property property, Object key) {
if (property == null) {
throw new IllegalArgumentException("Cannot get the mapped value from a 'null' property.");
}
if (property.getType().isAssignableFrom(Map.class)) {
Map<Object, Object> map = (Map<Object, Object>) property.get(obj);
if (map == null) {
throw new NullPointerException("Invalid 'null' value found for mapped " + property + " in "
+ obj.getClass().getName() + ".");
}
return map.get(key);
} else {
throw new IllegalArgumentException("Cannot get a mapped value from the not mapped " + property
+ ". Only Map type is supported, but " + property.getType().getSimpleName() + " found.");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"Object",
"getMappedValue",
"(",
"Object",
"obj",
",",
"Property",
"property",
",",
"Object",
"key",
")",
"{",
"if",
"(",
"property",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot get the mapped value from a 'null' property.\"",
")",
";",
"}",
"if",
"(",
"property",
".",
"getType",
"(",
")",
".",
"isAssignableFrom",
"(",
"Map",
".",
"class",
")",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"map",
"=",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
")",
"property",
".",
"get",
"(",
"obj",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Invalid 'null' value found for mapped \"",
"+",
"property",
"+",
"\" in \"",
"+",
"obj",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".\"",
")",
";",
"}",
"return",
"map",
".",
"get",
"(",
"key",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot get a mapped value from the not mapped \"",
"+",
"property",
"+",
"\". Only Map type is supported, but \"",
"+",
"property",
".",
"getType",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" found.\"",
")",
";",
"}",
"}"
] | /*
Internal: Static version of {@link ObjectWrapper#getMappedValue(Property, Object)}. | [
"/",
"*",
"Internal",
":",
"Static",
"version",
"of",
"{"
] | train | https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/ObjectWrapper.java#L648-L668 |
vst/commons-math-extensions | src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java | DMatrixUtils.roundDownTo | public static BigDecimal roundDownTo(double value, double steps) {
final BigDecimal bValue = BigDecimal.valueOf(value);
final BigDecimal bSteps = BigDecimal.valueOf(steps);
if (Objects.equals(bSteps, BigDecimal.ZERO)) {
return bValue;
} else {
return bValue.divide(bSteps, 0, RoundingMode.FLOOR).multiply(bSteps);
}
} | java | public static BigDecimal roundDownTo(double value, double steps) {
final BigDecimal bValue = BigDecimal.valueOf(value);
final BigDecimal bSteps = BigDecimal.valueOf(steps);
if (Objects.equals(bSteps, BigDecimal.ZERO)) {
return bValue;
} else {
return bValue.divide(bSteps, 0, RoundingMode.FLOOR).multiply(bSteps);
}
} | [
"public",
"static",
"BigDecimal",
"roundDownTo",
"(",
"double",
"value",
",",
"double",
"steps",
")",
"{",
"final",
"BigDecimal",
"bValue",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"value",
")",
";",
"final",
"BigDecimal",
"bSteps",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"steps",
")",
";",
"if",
"(",
"Objects",
".",
"equals",
"(",
"bSteps",
",",
"BigDecimal",
".",
"ZERO",
")",
")",
"{",
"return",
"bValue",
";",
"}",
"else",
"{",
"return",
"bValue",
".",
"divide",
"(",
"bSteps",
",",
"0",
",",
"RoundingMode",
".",
"FLOOR",
")",
".",
"multiply",
"(",
"bSteps",
")",
";",
"}",
"}"
] | Returns the DOWN rounded value of the given value for the given steps.
@param value The original value to be rounded.
@param steps The steps.
@return The DOWN rounded value of the given value for the given steps. | [
"Returns",
"the",
"DOWN",
"rounded",
"value",
"of",
"the",
"given",
"value",
"for",
"the",
"given",
"steps",
"."
] | train | https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java#L311-L320 |
Coveros/selenified | src/main/java/com/coveros/selenified/element/Element.java | Element.isNotInput | private boolean isNotInput(String action, String expected, String extra) {
// wait for element to be displayed
if (!is.input()) {
reporter.fail(action, expected, extra + prettyOutput() + NOT_AN_INPUT);
// indicates element not an input
return true;
}
return false;
} | java | private boolean isNotInput(String action, String expected, String extra) {
// wait for element to be displayed
if (!is.input()) {
reporter.fail(action, expected, extra + prettyOutput() + NOT_AN_INPUT);
// indicates element not an input
return true;
}
return false;
} | [
"private",
"boolean",
"isNotInput",
"(",
"String",
"action",
",",
"String",
"expected",
",",
"String",
"extra",
")",
"{",
"// wait for element to be displayed",
"if",
"(",
"!",
"is",
".",
"input",
"(",
")",
")",
"{",
"reporter",
".",
"fail",
"(",
"action",
",",
"expected",
",",
"extra",
"+",
"prettyOutput",
"(",
")",
"+",
"NOT_AN_INPUT",
")",
";",
"// indicates element not an input",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Determines if the element is an input.
@param action - what action is occurring
@param expected - what is the expected result
@param extra - what actually is occurring
@return Boolean: is the element enabled? | [
"Determines",
"if",
"the",
"element",
"is",
"an",
"input",
"."
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L658-L666 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java | JvmTypesBuilder.setExtension | public void setExtension(/* @Nullable */ JvmField field, EObject sourceElement, boolean value) {
if (field == null)
return;
internalSetExtension(field, sourceElement, value);
} | java | public void setExtension(/* @Nullable */ JvmField field, EObject sourceElement, boolean value) {
if (field == null)
return;
internalSetExtension(field, sourceElement, value);
} | [
"public",
"void",
"setExtension",
"(",
"/* @Nullable */",
"JvmField",
"field",
",",
"EObject",
"sourceElement",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"return",
";",
"internalSetExtension",
"(",
"field",
",",
"sourceElement",
",",
"value",
")",
";",
"}"
] | Adds or removes the annotation {@link Extension @Extension} from the given field. If the annotation is
already present, nothing is done if {@code value} is {@code true}. If it is not present and {@code value}
is {@code false}, this is a no-op, too.
@param field the field that will be processed
@param sourceElement the context that shall be used to lookup the {@link Extension annotation type}.
@param value <code>true</code> if the parameter shall be marked as extension, <code>false</code> if it should be unmarked. | [
"Adds",
"or",
"removes",
"the",
"annotation",
"{",
"@link",
"Extension",
"@Extension",
"}",
"from",
"the",
"given",
"field",
".",
"If",
"the",
"annotation",
"is",
"already",
"present",
"nothing",
"is",
"done",
"if",
"{",
"@code",
"value",
"}",
"is",
"{",
"@code",
"true",
"}",
".",
"If",
"it",
"is",
"not",
"present",
"and",
"{",
"@code",
"value",
"}",
"is",
"{",
"@code",
"false",
"}",
"this",
"is",
"a",
"no",
"-",
"op",
"too",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L605-L609 |
santhosh-tekuri/jlibs | xsd/src/main/java/jlibs/xml/xsd/XSParser.java | XSParser.parseString | public XSModel parseString(String schema, String baseURI){
return xsLoader.load(new DOMInputImpl(null, null, baseURI, schema, null));
} | java | public XSModel parseString(String schema, String baseURI){
return xsLoader.load(new DOMInputImpl(null, null, baseURI, schema, null));
} | [
"public",
"XSModel",
"parseString",
"(",
"String",
"schema",
",",
"String",
"baseURI",
")",
"{",
"return",
"xsLoader",
".",
"load",
"(",
"new",
"DOMInputImpl",
"(",
"null",
",",
"null",
",",
"baseURI",
",",
"schema",
",",
"null",
")",
")",
";",
"}"
] | Parse an XML Schema document from String specified
@param schema String data to parse. If provided, this will always be treated as a
sequence of 16-bit units (UTF-16 encoded characters). If an XML
declaration is present, the value of the encoding attribute
will be ignored.
@param baseURI The base URI to be used for resolving relative
URIs to absolute URIs. | [
"Parse",
"an",
"XML",
"Schema",
"document",
"from",
"String",
"specified"
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xsd/src/main/java/jlibs/xml/xsd/XSParser.java#L121-L123 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.convertNormToPixel | public static Point2D_F64 convertNormToPixel( DMatrixRMaj K, Point2D_F64 norm , Point2D_F64 pixel )
{
return ImplPerspectiveOps_F64.convertNormToPixel(K, norm, pixel);
} | java | public static Point2D_F64 convertNormToPixel( DMatrixRMaj K, Point2D_F64 norm , Point2D_F64 pixel )
{
return ImplPerspectiveOps_F64.convertNormToPixel(K, norm, pixel);
} | [
"public",
"static",
"Point2D_F64",
"convertNormToPixel",
"(",
"DMatrixRMaj",
"K",
",",
"Point2D_F64",
"norm",
",",
"Point2D_F64",
"pixel",
")",
"{",
"return",
"ImplPerspectiveOps_F64",
".",
"convertNormToPixel",
"(",
"K",
",",
"norm",
",",
"pixel",
")",
";",
"}"
] | <p>
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
If speed is a concern then {@link PinholeNtoP_F64} should be used instead.
</p>
NOTE: norm and pixel can be the same instance.
@param K Intrinsic camera calibration matrix
@param norm Normalized image coordinate.
@param pixel Optional storage for output. If null a new instance will be declared.
@return pixel image coordinate | [
"<p",
">",
"Convenient",
"function",
"for",
"converting",
"from",
"normalized",
"image",
"coordinates",
"to",
"the",
"original",
"image",
"pixel",
"coordinate",
".",
"If",
"speed",
"is",
"a",
"concern",
"then",
"{",
"@link",
"PinholeNtoP_F64",
"}",
"should",
"be",
"used",
"instead",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L427-L430 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/argparser/NamedArgumentDefinition.java | NamedArgumentDefinition.getValuePopulatedWithTags | private Object getValuePopulatedWithTags(final String originalTag, final String stringValue)
{
// See if the value is a surrogate key in the tag parser's map that was placed there during preprocessing,
// and if so, unpack the values retrieved via the key and use those to populate the field
final Object value = constructFromString(stringValue, getLongName());
if (TaggedArgument.class.isAssignableFrom(getUnderlyingFieldClass())) {
// NOTE: this propagates the tag name/attributes to the field BEFORE the value is set
TaggedArgument taggedArgument = (TaggedArgument) value;
TaggedArgumentParser.populateArgumentTags(
taggedArgument,
getLongName(),
originalTag);
} else if (originalTag != null) {
// a tag was found for a non-taggable argument
throw new CommandLineException(
String.format("The argument: \"%s/%s\" does not accept tags: \"%s\"",
getShortName(),
getFullName(),
originalTag));
}
return value;
} | java | private Object getValuePopulatedWithTags(final String originalTag, final String stringValue)
{
// See if the value is a surrogate key in the tag parser's map that was placed there during preprocessing,
// and if so, unpack the values retrieved via the key and use those to populate the field
final Object value = constructFromString(stringValue, getLongName());
if (TaggedArgument.class.isAssignableFrom(getUnderlyingFieldClass())) {
// NOTE: this propagates the tag name/attributes to the field BEFORE the value is set
TaggedArgument taggedArgument = (TaggedArgument) value;
TaggedArgumentParser.populateArgumentTags(
taggedArgument,
getLongName(),
originalTag);
} else if (originalTag != null) {
// a tag was found for a non-taggable argument
throw new CommandLineException(
String.format("The argument: \"%s/%s\" does not accept tags: \"%s\"",
getShortName(),
getFullName(),
originalTag));
}
return value;
} | [
"private",
"Object",
"getValuePopulatedWithTags",
"(",
"final",
"String",
"originalTag",
",",
"final",
"String",
"stringValue",
")",
"{",
"// See if the value is a surrogate key in the tag parser's map that was placed there during preprocessing,",
"// and if so, unpack the values retrieved via the key and use those to populate the field",
"final",
"Object",
"value",
"=",
"constructFromString",
"(",
"stringValue",
",",
"getLongName",
"(",
")",
")",
";",
"if",
"(",
"TaggedArgument",
".",
"class",
".",
"isAssignableFrom",
"(",
"getUnderlyingFieldClass",
"(",
")",
")",
")",
"{",
"// NOTE: this propagates the tag name/attributes to the field BEFORE the value is set",
"TaggedArgument",
"taggedArgument",
"=",
"(",
"TaggedArgument",
")",
"value",
";",
"TaggedArgumentParser",
".",
"populateArgumentTags",
"(",
"taggedArgument",
",",
"getLongName",
"(",
")",
",",
"originalTag",
")",
";",
"}",
"else",
"if",
"(",
"originalTag",
"!=",
"null",
")",
"{",
"// a tag was found for a non-taggable argument",
"throw",
"new",
"CommandLineException",
"(",
"String",
".",
"format",
"(",
"\"The argument: \\\"%s/%s\\\" does not accept tags: \\\"%s\\\"\"",
",",
"getShortName",
"(",
")",
",",
"getFullName",
"(",
")",
",",
"originalTag",
")",
")",
";",
"}",
"return",
"value",
";",
"}"
] | populated with the actual value and tags and attributes provided by the user for that argument. | [
"populated",
"with",
"the",
"actual",
"value",
"and",
"tags",
"and",
"attributes",
"provided",
"by",
"the",
"user",
"for",
"that",
"argument",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/NamedArgumentDefinition.java#L532-L554 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.internalAddContractions | void internalAddContractions(int c, UnicodeSet set) {
new ContractionsAndExpansions(set, null, null, false).forCodePoint(data, c);
} | java | void internalAddContractions(int c, UnicodeSet set) {
new ContractionsAndExpansions(set, null, null, false).forCodePoint(data, c);
} | [
"void",
"internalAddContractions",
"(",
"int",
"c",
",",
"UnicodeSet",
"set",
")",
"{",
"new",
"ContractionsAndExpansions",
"(",
"set",
",",
"null",
",",
"null",
",",
"false",
")",
".",
"forCodePoint",
"(",
"data",
",",
"c",
")",
";",
"}"
] | Adds the contractions that start with character c to the set.
Ignores prefixes. Used by AlphabeticIndex.
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Adds",
"the",
"contractions",
"that",
"start",
"with",
"character",
"c",
"to",
"the",
"set",
".",
"Ignores",
"prefixes",
".",
"Used",
"by",
"AlphabeticIndex",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L1006-L1008 |
elki-project/elki | addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/uncertain/UKMeans.java | UKMeans.logVarstat | protected void logVarstat(DoubleStatistic varstat, double[] varsum) {
if(varstat != null) {
double s = sum(varsum);
getLogger().statistics(varstat.setDouble(s));
}
} | java | protected void logVarstat(DoubleStatistic varstat, double[] varsum) {
if(varstat != null) {
double s = sum(varsum);
getLogger().statistics(varstat.setDouble(s));
}
} | [
"protected",
"void",
"logVarstat",
"(",
"DoubleStatistic",
"varstat",
",",
"double",
"[",
"]",
"varsum",
")",
"{",
"if",
"(",
"varstat",
"!=",
"null",
")",
"{",
"double",
"s",
"=",
"sum",
"(",
"varsum",
")",
";",
"getLogger",
"(",
")",
".",
"statistics",
"(",
"varstat",
".",
"setDouble",
"(",
"s",
")",
")",
";",
"}",
"}"
] | Log statistics on the variance sum.
@param varstat Statistics log instance
@param varsum Variance sum per cluster | [
"Log",
"statistics",
"on",
"the",
"variance",
"sum",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/uncertain/UKMeans.java#L306-L311 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cdnwebstorage/src/main/java/net/minidev/ovh/api/ApiOvhCdnwebstorage.java | ApiOvhCdnwebstorage.serviceName_statistics_GET | public ArrayList<OvhStatsDataType> serviceName_statistics_GET(String serviceName, OvhStatsPeriodEnum period, OvhStatsTypeEnum type) throws IOException {
String qPath = "/cdn/webstorage/{serviceName}/statistics";
StringBuilder sb = path(qPath, serviceName);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<OvhStatsDataType> serviceName_statistics_GET(String serviceName, OvhStatsPeriodEnum period, OvhStatsTypeEnum type) throws IOException {
String qPath = "/cdn/webstorage/{serviceName}/statistics";
StringBuilder sb = path(qPath, serviceName);
query(sb, "period", period);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"OvhStatsDataType",
">",
"serviceName_statistics_GET",
"(",
"String",
"serviceName",
",",
"OvhStatsPeriodEnum",
"period",
",",
"OvhStatsTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cdn/webstorage/{serviceName}/statistics\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"query",
"(",
"sb",
",",
"\"period\"",
",",
"period",
")",
";",
"query",
"(",
"sb",
",",
"\"type\"",
",",
"type",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Return stats about bandwidth consumption
REST: GET /cdn/webstorage/{serviceName}/statistics
@param type [required]
@param period [required]
@param serviceName [required] The internal name of your CDN Static offer | [
"Return",
"stats",
"about",
"bandwidth",
"consumption"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdnwebstorage/src/main/java/net/minidev/ovh/api/ApiOvhCdnwebstorage.java#L85-L92 |
wkgcass/Style | src/main/java/net/cassite/style/aggregation/MapFuncSup.java | MapFuncSup.forThose | public <R> R forThose(RFunc2<Boolean, K, V> predicate, def<R> func) {
Iterator<K> it = map.keySet().iterator();
IteratorInfo<R> info = new IteratorInfo<>();
ptr<Integer> i = Style.ptr(0);
return Style.While(it::hasNext, (loopInfo) -> {
K k = it.next();
V v = map.get(k);
try {
return If(predicate.apply(k, v), () -> {
return func.apply(k, v, info.setValues(i.item - 1, i.item + 1, i.item != 0, it.hasNext(),
loopInfo.currentIndex, loopInfo.effectiveIndex, loopInfo.lastRes));
}).Else(() -> null);
} catch (Throwable err) {
StyleRuntimeException sErr = Style.$(err);
Throwable t = sErr.origin();
if (t instanceof Remove) {
it.remove();
} else {
throw sErr;
}
} finally {
i.item += 1;
}
return null;
} | java | public <R> R forThose(RFunc2<Boolean, K, V> predicate, def<R> func) {
Iterator<K> it = map.keySet().iterator();
IteratorInfo<R> info = new IteratorInfo<>();
ptr<Integer> i = Style.ptr(0);
return Style.While(it::hasNext, (loopInfo) -> {
K k = it.next();
V v = map.get(k);
try {
return If(predicate.apply(k, v), () -> {
return func.apply(k, v, info.setValues(i.item - 1, i.item + 1, i.item != 0, it.hasNext(),
loopInfo.currentIndex, loopInfo.effectiveIndex, loopInfo.lastRes));
}).Else(() -> null);
} catch (Throwable err) {
StyleRuntimeException sErr = Style.$(err);
Throwable t = sErr.origin();
if (t instanceof Remove) {
it.remove();
} else {
throw sErr;
}
} finally {
i.item += 1;
}
return null;
} | [
"public",
"<",
"R",
">",
"R",
"forThose",
"(",
"RFunc2",
"<",
"Boolean",
",",
"K",
",",
"V",
">",
"predicate",
",",
"def",
"<",
"R",
">",
"func",
")",
"{",
"Iterator",
"<",
"K",
">",
"it",
"=",
"map",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"IteratorInfo",
"<",
"R",
">",
"info",
"=",
"new",
"IteratorInfo",
"<>",
"(",
")",
";",
"ptr",
"<",
"Integer",
">",
"i",
"=",
"Style",
".",
"ptr",
"(",
"0",
")",
";",
"return",
"Style",
".",
"While",
"(",
"it",
"::",
"hasNext",
",",
"(",
"loopInfo",
")",
"-",
">",
"{",
"K",
"k",
"=",
"it",
".",
"next",
"(",
")",
"",
";",
"V",
"v",
"=",
"map",
".",
"get",
"(",
"k",
")",
";",
"try",
"{",
"return",
"If",
"(",
"predicate",
".",
"apply",
"(",
"k",
",",
"v",
")",
",",
"(",
")",
"->",
"{",
"return",
"func",
".",
"apply",
"(",
"k",
",",
"v",
",",
"info",
".",
"setValues",
"(",
"i",
".",
"item",
"-",
"1",
",",
"i",
".",
"item",
"+",
"1",
",",
"i",
".",
"item",
"!=",
"0",
",",
"it",
".",
"hasNext",
"(",
")",
",",
"loopInfo",
".",
"currentIndex",
",",
"loopInfo",
".",
"effectiveIndex",
",",
"loopInfo",
".",
"lastRes",
")",
")",
";",
"}",
")",
".",
"Else",
"(",
"(",
")",
"->",
"null",
")",
";",
"}",
"catch",
"(",
"Throwable",
"err",
")",
"{",
"StyleRuntimeException",
"sErr",
"=",
"Style",
".",
"$",
"(",
"err",
")",
";",
"Throwable",
"t",
"=",
"sErr",
".",
"origin",
"(",
")",
";",
"if",
"(",
"t",
"instanceof",
"Remove",
")",
"{",
"it",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"sErr",
";",
"}",
"}",
"finally",
"{",
"i",
".",
"item",
"+=",
"1",
";",
"}",
"return",
"null",
";",
"}"
] | define a function to deal with each element in the map
@param predicate a function takes in each element from map and returns
true or false(or null)
@param func a function returns 'last loop result'
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value'
@see IteratorInfo | [
"define",
"a",
"function",
"to",
"deal",
"with",
"each",
"element",
"in",
"the",
"map"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L180-L204 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java | HtmlDocWriter.getHyperLink | public Content getHyperLink(SectionName sectionName, String where,
Content label) {
return getHyperLink(getDocLink(sectionName, where), label, "", "");
} | java | public Content getHyperLink(SectionName sectionName, String where,
Content label) {
return getHyperLink(getDocLink(sectionName, where), label, "", "");
} | [
"public",
"Content",
"getHyperLink",
"(",
"SectionName",
"sectionName",
",",
"String",
"where",
",",
"Content",
"label",
")",
"{",
"return",
"getHyperLink",
"(",
"getDocLink",
"(",
"sectionName",
",",
"where",
")",
",",
"label",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}"
] | Get Html Hyper Link Content.
@param sectionName The section name combined with where to which the link
will be created.
@param where The fragment combined with sectionName to which the link
will be created.
@param label Tag for the link.
@return a content tree for the hyper link | [
"Get",
"Html",
"Hyper",
"Link",
"Content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java#L121-L124 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java | BCELUtil.getMethodDescriptor | public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
method.getSignature(), method.isStatic());
} | java | public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
method.getSignature(), method.isStatic());
} | [
"public",
"static",
"MethodDescriptor",
"getMethodDescriptor",
"(",
"JavaClass",
"jclass",
",",
"Method",
"method",
")",
"{",
"return",
"DescriptorFactory",
".",
"instance",
"(",
")",
".",
"getMethodDescriptor",
"(",
"jclass",
".",
"getClassName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
",",
"method",
".",
"getName",
"(",
")",
",",
"method",
".",
"getSignature",
"(",
")",
",",
"method",
".",
"isStatic",
"(",
")",
")",
";",
"}"
] | Construct a MethodDescriptor from JavaClass and method.
@param jclass
a JavaClass
@param method
a Method belonging to the JavaClass
@return a MethodDescriptor identifying the method | [
"Construct",
"a",
"MethodDescriptor",
"from",
"JavaClass",
"and",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java#L52-L55 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.shopList | public static ShopListResult shopList(String accessToken, ShopList shopList) {
return shopList(accessToken, JsonUtil.toJSONString(shopList));
} | java | public static ShopListResult shopList(String accessToken, ShopList shopList) {
return shopList(accessToken, JsonUtil.toJSONString(shopList));
} | [
"public",
"static",
"ShopListResult",
"shopList",
"(",
"String",
"accessToken",
",",
"ShopList",
"shopList",
")",
"{",
"return",
"shopList",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"shopList",
")",
")",
";",
"}"
] | Wi-Fi门店管理-获取Wi-Fi门店列表
通过此接口获取WiFi的门店列表,该列表包括公众平台的门店信息、以及添加设备后的WiFi相关信息。
注:微信连Wi-Fi下的所有接口中的shop_id,必需先通过此接口获取。
@param accessToken accessToken
@param shopList shopList
@return ShopListResult | [
"Wi",
"-",
"Fi门店管理",
"-",
"获取Wi",
"-",
"Fi门店列表",
"通过此接口获取WiFi的门店列表,该列表包括公众平台的门店信息、以及添加设备后的WiFi相关信息。",
"注:微信连Wi",
"-",
"Fi下的所有接口中的shop_id,必需先通过此接口获取。"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L221-L223 |
telly/groundy | library/src/main/java/com/telly/groundy/Groundy.java | Groundy.arg | public Groundy arg(String key, CharSequence value) {
mArgs.putCharSequence(key, value);
return this;
} | java | public Groundy arg(String key, CharSequence value) {
mArgs.putCharSequence(key, value);
return this;
} | [
"public",
"Groundy",
"arg",
"(",
"String",
"key",
",",
"CharSequence",
"value",
")",
"{",
"mArgs",
".",
"putCharSequence",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a CharSequence value into the mapping of this Bundle, replacing any existing value for
the given key. Either key or value may be null.
@param key a String, or null
@param value a CharSequence, or null | [
"Inserts",
"a",
"CharSequence",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L524-L527 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.updateMultiRolePoolAsync | public Observable<WorkerPoolResourceInner> updateMultiRolePoolAsync(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
return updateMultiRolePoolWithServiceResponseAsync(resourceGroupName, name, multiRolePoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | java | public Observable<WorkerPoolResourceInner> updateMultiRolePoolAsync(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
return updateMultiRolePoolWithServiceResponseAsync(resourceGroupName, name, multiRolePoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkerPoolResourceInner",
">",
"updateMultiRolePoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"WorkerPoolResourceInner",
"multiRolePoolEnvelope",
")",
"{",
"return",
"updateMultiRolePoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"multiRolePoolEnvelope",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
",",
"WorkerPoolResourceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WorkerPoolResourceInner",
"call",
"(",
"ServiceResponse",
"<",
"WorkerPoolResourceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create or update a multi-role pool.
Create or update a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param multiRolePoolEnvelope Properties of the multi-role pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkerPoolResourceInner object | [
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"pool",
".",
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L2485-L2492 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java | JacksonUtils.getValue | public static JsonNode getValue(JsonNode node, String dPath) {
return DPathUtils.getValue(node, dPath);
} | java | public static JsonNode getValue(JsonNode node, String dPath) {
return DPathUtils.getValue(node, dPath);
} | [
"public",
"static",
"JsonNode",
"getValue",
"(",
"JsonNode",
"node",
",",
"String",
"dPath",
")",
"{",
"return",
"DPathUtils",
".",
"getValue",
"(",
"node",
",",
"dPath",
")",
";",
"}"
] | Extract a value from the target {@link JsonNode} using DPath expression.
@param node
@param dPath
@see DPathUtils | [
"Extract",
"a",
"value",
"from",
"the",
"target",
"{",
"@link",
"JsonNode",
"}",
"using",
"DPath",
"expression",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L260-L262 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/compiler/Compiler.java | Compiler.createSourceReader | protected SourceReader createSourceReader(CompilationUnit unit)
throws IOException {
Reader r = new BufferedReader(unit.getReader());
return new SourceReader(r, "<%", "%>");
} | java | protected SourceReader createSourceReader(CompilationUnit unit)
throws IOException {
Reader r = new BufferedReader(unit.getReader());
return new SourceReader(r, "<%", "%>");
} | [
"protected",
"SourceReader",
"createSourceReader",
"(",
"CompilationUnit",
"unit",
")",
"throws",
"IOException",
"{",
"Reader",
"r",
"=",
"new",
"BufferedReader",
"(",
"unit",
".",
"getReader",
"(",
")",
")",
";",
"return",
"new",
"SourceReader",
"(",
"r",
",",
"\"<%\"",
",",
"\"%>\"",
")",
";",
"}"
] | Default implementation returns a SourceReader that uses "<%" and "%>"
as code delimiters. | [
"Default",
"implementation",
"returns",
"a",
"SourceReader",
"that",
"uses",
"<%",
"and",
"%",
">",
"as",
"code",
"delimiters",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Compiler.java#L859-L864 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.copy | public static void copy(Reader reader, OutputStream out) throws IOException {
copy(reader, getOutputStreamWriter(out));
out.flush();
} | java | public static void copy(Reader reader, OutputStream out) throws IOException {
copy(reader, getOutputStreamWriter(out));
out.flush();
} | [
"public",
"static",
"void",
"copy",
"(",
"Reader",
"reader",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"reader",
",",
"getOutputStreamWriter",
"(",
"out",
")",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}"
] | Copies the content of a reader to an output stream.
@param reader the reader to read
@param out the output stream to write
@throws java.io.IOException if an I/O error occurs | [
"Copies",
"the",
"content",
"of",
"a",
"reader",
"to",
"an",
"output",
"stream",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L220-L223 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_phone_merchandiseAvailable_GET | public ArrayList<OvhHardwareOffer> billingAccount_line_serviceName_phone_merchandiseAvailable_GET(String billingAccount, String serviceName) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/merchandiseAvailable";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t7);
} | java | public ArrayList<OvhHardwareOffer> billingAccount_line_serviceName_phone_merchandiseAvailable_GET(String billingAccount, String serviceName) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/merchandiseAvailable";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t7);
} | [
"public",
"ArrayList",
"<",
"OvhHardwareOffer",
">",
"billingAccount_line_serviceName_phone_merchandiseAvailable_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/line/{serviceName}/phone/merchandiseAvailable\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t7",
")",
";",
"}"
] | List of available exchange merchandise brand
REST: GET /telephony/{billingAccount}/line/{serviceName}/phone/merchandiseAvailable
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"List",
"of",
"available",
"exchange",
"merchandise",
"brand"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1191-L1196 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java | UnsafeOperations.copyPrimitiveField | public final void copyPrimitiveField(Object source, Object copy, Field field) {
copyPrimitiveAtOffset(source, copy, field.getType(), getObjectFieldOffset(field));
} | java | public final void copyPrimitiveField(Object source, Object copy, Field field) {
copyPrimitiveAtOffset(source, copy, field.getType(), getObjectFieldOffset(field));
} | [
"public",
"final",
"void",
"copyPrimitiveField",
"(",
"Object",
"source",
",",
"Object",
"copy",
",",
"Field",
"field",
")",
"{",
"copyPrimitiveAtOffset",
"(",
"source",
",",
"copy",
",",
"field",
".",
"getType",
"(",
")",
",",
"getObjectFieldOffset",
"(",
"field",
")",
")",
";",
"}"
] | Copy the value from the given field from the source into the target.
The field specified must contain a primitive
@param source The object to copy from
@param copy The target object
@param field Field to be copied | [
"Copy",
"the",
"value",
"from",
"the",
"given",
"field",
"from",
"the",
"source",
"into",
"the",
"target",
".",
"The",
"field",
"specified",
"must",
"contain",
"a",
"primitive"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L194-L196 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/util/PropertyUtils.java | PropertyUtils.invokeMethod | private static Object invokeMethod(Method method, Object bean, Object[] values)
throws IllegalAccessException, InvocationTargetException {
try {
return method.invoke(bean, values);
} catch (IllegalArgumentException e) {
LOGGER.error("Method invocation failed.", e);
throw new IllegalArgumentException("Cannot invoke " + method.getDeclaringClass().getName() + "."
+ method.getName() + " - " + e.getMessage());
}
} | java | private static Object invokeMethod(Method method, Object bean, Object[] values)
throws IllegalAccessException, InvocationTargetException {
try {
return method.invoke(bean, values);
} catch (IllegalArgumentException e) {
LOGGER.error("Method invocation failed.", e);
throw new IllegalArgumentException("Cannot invoke " + method.getDeclaringClass().getName() + "."
+ method.getName() + " - " + e.getMessage());
}
} | [
"private",
"static",
"Object",
"invokeMethod",
"(",
"Method",
"method",
",",
"Object",
"bean",
",",
"Object",
"[",
"]",
"values",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"try",
"{",
"return",
"method",
".",
"invoke",
"(",
"bean",
",",
"values",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Method invocation failed.\"",
",",
"e",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot invoke \"",
"+",
"method",
".",
"getDeclaringClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".\"",
"+",
"method",
".",
"getName",
"(",
")",
"+",
"\" - \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | This utility method just catches and wraps IllegalArgumentException.
@param method
the method to call
@param bean
the bean
@param values
the values
@return the returned value of the method
@throws IllegalAccessException
if an exception occurs
@throws InvocationTargetException
if an exception occurs | [
"This",
"utility",
"method",
"just",
"catches",
"and",
"wraps",
"IllegalArgumentException",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/PropertyUtils.java#L234-L247 |
codescape/bitvunit | bitvunit-core/src/main/java/de/codescape/bitvunit/rule/AbstractRule.java | AbstractRule.createViolation | protected Violation createViolation(HtmlElement htmlElement, Page page, String message) {
if (htmlElement == null)
htmlElement = page.findHtmlTag();
return new Violation(this, htmlElement, message);
} | java | protected Violation createViolation(HtmlElement htmlElement, Page page, String message) {
if (htmlElement == null)
htmlElement = page.findHtmlTag();
return new Violation(this, htmlElement, message);
} | [
"protected",
"Violation",
"createViolation",
"(",
"HtmlElement",
"htmlElement",
",",
"Page",
"page",
",",
"String",
"message",
")",
"{",
"if",
"(",
"htmlElement",
"==",
"null",
")",
"htmlElement",
"=",
"page",
".",
"findHtmlTag",
"(",
")",
";",
"return",
"new",
"Violation",
"(",
"this",
",",
"htmlElement",
",",
"message",
")",
";",
"}"
] | Creates a new violation for that rule with the line number of the violating element in the given page and a
message that describes the violation in detail.
@param htmlElement the {@link com.gargoylesoftware.htmlunit.html.HtmlElement} where the violation occurs
@param page the page where the violation occurs
@param message description of the violation @return new violation to be added to the list of violations
@return Violation describing the error | [
"Creates",
"a",
"new",
"violation",
"for",
"that",
"rule",
"with",
"the",
"line",
"number",
"of",
"the",
"violating",
"element",
"in",
"the",
"given",
"page",
"and",
"a",
"message",
"that",
"describes",
"the",
"violation",
"in",
"detail",
"."
] | train | https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/rule/AbstractRule.java#L45-L49 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java | JDBC4PreparedStatement.setString | @Override
public void setString(int parameterIndex, String x) throws SQLException
{
checkParameterBounds(parameterIndex);
this.parameters[parameterIndex-1] = x == null ? VoltType.NULL_STRING_OR_VARBINARY : x;
} | java | @Override
public void setString(int parameterIndex, String x) throws SQLException
{
checkParameterBounds(parameterIndex);
this.parameters[parameterIndex-1] = x == null ? VoltType.NULL_STRING_OR_VARBINARY : x;
} | [
"@",
"Override",
"public",
"void",
"setString",
"(",
"int",
"parameterIndex",
",",
"String",
"x",
")",
"throws",
"SQLException",
"{",
"checkParameterBounds",
"(",
"parameterIndex",
")",
";",
"this",
".",
"parameters",
"[",
"parameterIndex",
"-",
"1",
"]",
"=",
"x",
"==",
"null",
"?",
"VoltType",
".",
"NULL_STRING_OR_VARBINARY",
":",
"x",
";",
"}"
] | Sets the designated parameter to the given Java String value. | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"Java",
"String",
"value",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L550-L555 |
plaid/plaid-java | src/main/java/com/plaid/client/internal/Util.java | Util.notEmpty | public static void notEmpty(Collection collection, String name) {
notNull(collection, name);
if (collection.isEmpty()) {
throw new IllegalArgumentException(name + " must not be empty");
}
} | java | public static void notEmpty(Collection collection, String name) {
notNull(collection, name);
if (collection.isEmpty()) {
throw new IllegalArgumentException(name + " must not be empty");
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"Collection",
"collection",
",",
"String",
"name",
")",
"{",
"notNull",
"(",
"collection",
",",
"name",
")",
";",
"if",
"(",
"collection",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" must not be empty\"",
")",
";",
"}",
"}"
] | Checks that a given collection is not null and not empty.
@param collection The collection to check
@param name The name of the collection to use when raising an error.
@throws IllegalArgumentException If the collection was null or empty. | [
"Checks",
"that",
"a",
"given",
"collection",
"is",
"not",
"null",
"and",
"not",
"empty",
"."
] | train | https://github.com/plaid/plaid-java/blob/360f1f8a5178fa0c3c2c2e07a58f8ccec5f33117/src/main/java/com/plaid/client/internal/Util.java#L30-L36 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java | CPOptionCategoryPersistenceImpl.fetchByUUID_G | @Override
public CPOptionCategory fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CPOptionCategory fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CPOptionCategory",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the cp option category where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cp option category, or <code>null</code> if a matching cp option category could not be found | [
"Returns",
"the",
"cp",
"option",
"category",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L702-L705 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NotificationHubsInner.java | NotificationHubsInner.checkAvailabilityAsync | public Observable<CheckAvailabilityResultInner> checkAvailabilityAsync(String resourceGroupName, String namespaceName, CheckAvailabilityParameters parameters) {
return checkAvailabilityWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1<ServiceResponse<CheckAvailabilityResultInner>, CheckAvailabilityResultInner>() {
@Override
public CheckAvailabilityResultInner call(ServiceResponse<CheckAvailabilityResultInner> response) {
return response.body();
}
});
} | java | public Observable<CheckAvailabilityResultInner> checkAvailabilityAsync(String resourceGroupName, String namespaceName, CheckAvailabilityParameters parameters) {
return checkAvailabilityWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1<ServiceResponse<CheckAvailabilityResultInner>, CheckAvailabilityResultInner>() {
@Override
public CheckAvailabilityResultInner call(ServiceResponse<CheckAvailabilityResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CheckAvailabilityResultInner",
">",
"checkAvailabilityAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"CheckAvailabilityParameters",
"parameters",
")",
"{",
"return",
"checkAvailabilityWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"namespaceName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"CheckAvailabilityResultInner",
">",
",",
"CheckAvailabilityResultInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"CheckAvailabilityResultInner",
"call",
"(",
"ServiceResponse",
"<",
"CheckAvailabilityResultInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Checks the availability of the given notificationHub in a namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param parameters The notificationHub name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CheckAvailabilityResultInner object | [
"Checks",
"the",
"availability",
"of",
"the",
"given",
"notificationHub",
"in",
"a",
"namespace",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NotificationHubsInner.java#L165-L172 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/internal/ResourceLoader.java | ResourceLoader.getResource | public ResourceHandle getResource(URL source, String name)
{
return getResource(source, name, new HashSet<>(), null);
} | java | public ResourceHandle getResource(URL source, String name)
{
return getResource(source, name, new HashSet<>(), null);
} | [
"public",
"ResourceHandle",
"getResource",
"(",
"URL",
"source",
",",
"String",
"name",
")",
"{",
"return",
"getResource",
"(",
"source",
",",
"name",
",",
"new",
"HashSet",
"<>",
"(",
")",
",",
"null",
")",
";",
"}"
] | Gets resource with given name at the given source URL. If the URL points to a directory, the name is the file
path relative to this directory. If the URL points to a JAR file, the name identifies an entry in that JAR file.
If the URL points to a JAR file, the resource is not found in that JAR file, and the JAR file has Class-Path
attribute, the JAR files identified in the Class-Path are also searched for the resource.
@param source the source URL
@param name the resource name
@return handle representing the resource, or null if not found | [
"Gets",
"resource",
"with",
"given",
"name",
"at",
"the",
"given",
"source",
"URL",
".",
"If",
"the",
"URL",
"points",
"to",
"a",
"directory",
"the",
"name",
"is",
"the",
"file",
"path",
"relative",
"to",
"this",
"directory",
".",
"If",
"the",
"URL",
"points",
"to",
"a",
"JAR",
"file",
"the",
"name",
"identifies",
"an",
"entry",
"in",
"that",
"JAR",
"file",
".",
"If",
"the",
"URL",
"points",
"to",
"a",
"JAR",
"file",
"the",
"resource",
"is",
"not",
"found",
"in",
"that",
"JAR",
"file",
"and",
"the",
"JAR",
"file",
"has",
"Class",
"-",
"Path",
"attribute",
"the",
"JAR",
"files",
"identified",
"in",
"the",
"Class",
"-",
"Path",
"are",
"also",
"searched",
"for",
"the",
"resource",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/internal/ResourceLoader.java#L115-L118 |
forge/core | maven/impl/src/main/java/org/jboss/forge/addon/maven/dependencies/MavenDependencyResolver.java | MavenDependencyResolver.getVersions | VersionRangeResult getVersions(DependencyQuery query)
{
Coordinate dep = query.getCoordinate();
try
{
String version = dep.getVersion();
if (version == null || version.isEmpty())
{
dep = CoordinateBuilder.create(dep).setVersion("[,)");
}
else if (!version.matches("(\\(|\\[).*?(\\)|\\])"))
{
dep = CoordinateBuilder.create(dep).setVersion("[" + version + "]");
}
RepositorySystem maven = container.getRepositorySystem();
Settings settings = container.getSettings();
DefaultRepositorySystemSession session = container.setupRepoSession(maven, settings);
Artifact artifact = MavenConvertUtils.coordinateToMavenArtifact(dep);
List<RemoteRepository> remoteRepos = MavenConvertUtils.convertToMavenRepos(query.getDependencyRepositories(),
settings);
remoteRepos.addAll(MavenRepositories.getRemoteRepositories(container, settings));
VersionRangeRequest rangeRequest = new VersionRangeRequest(artifact, remoteRepos, null);
VersionRangeResult rangeResult = maven.resolveVersionRange(session, rangeRequest);
return rangeResult;
}
catch (Exception e)
{
throw new RuntimeException("Failed to look up versions for [" + dep + "]", e);
}
} | java | VersionRangeResult getVersions(DependencyQuery query)
{
Coordinate dep = query.getCoordinate();
try
{
String version = dep.getVersion();
if (version == null || version.isEmpty())
{
dep = CoordinateBuilder.create(dep).setVersion("[,)");
}
else if (!version.matches("(\\(|\\[).*?(\\)|\\])"))
{
dep = CoordinateBuilder.create(dep).setVersion("[" + version + "]");
}
RepositorySystem maven = container.getRepositorySystem();
Settings settings = container.getSettings();
DefaultRepositorySystemSession session = container.setupRepoSession(maven, settings);
Artifact artifact = MavenConvertUtils.coordinateToMavenArtifact(dep);
List<RemoteRepository> remoteRepos = MavenConvertUtils.convertToMavenRepos(query.getDependencyRepositories(),
settings);
remoteRepos.addAll(MavenRepositories.getRemoteRepositories(container, settings));
VersionRangeRequest rangeRequest = new VersionRangeRequest(artifact, remoteRepos, null);
VersionRangeResult rangeResult = maven.resolveVersionRange(session, rangeRequest);
return rangeResult;
}
catch (Exception e)
{
throw new RuntimeException("Failed to look up versions for [" + dep + "]", e);
}
} | [
"VersionRangeResult",
"getVersions",
"(",
"DependencyQuery",
"query",
")",
"{",
"Coordinate",
"dep",
"=",
"query",
".",
"getCoordinate",
"(",
")",
";",
"try",
"{",
"String",
"version",
"=",
"dep",
".",
"getVersion",
"(",
")",
";",
"if",
"(",
"version",
"==",
"null",
"||",
"version",
".",
"isEmpty",
"(",
")",
")",
"{",
"dep",
"=",
"CoordinateBuilder",
".",
"create",
"(",
"dep",
")",
".",
"setVersion",
"(",
"\"[,)\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"version",
".",
"matches",
"(",
"\"(\\\\(|\\\\[).*?(\\\\)|\\\\])\"",
")",
")",
"{",
"dep",
"=",
"CoordinateBuilder",
".",
"create",
"(",
"dep",
")",
".",
"setVersion",
"(",
"\"[\"",
"+",
"version",
"+",
"\"]\"",
")",
";",
"}",
"RepositorySystem",
"maven",
"=",
"container",
".",
"getRepositorySystem",
"(",
")",
";",
"Settings",
"settings",
"=",
"container",
".",
"getSettings",
"(",
")",
";",
"DefaultRepositorySystemSession",
"session",
"=",
"container",
".",
"setupRepoSession",
"(",
"maven",
",",
"settings",
")",
";",
"Artifact",
"artifact",
"=",
"MavenConvertUtils",
".",
"coordinateToMavenArtifact",
"(",
"dep",
")",
";",
"List",
"<",
"RemoteRepository",
">",
"remoteRepos",
"=",
"MavenConvertUtils",
".",
"convertToMavenRepos",
"(",
"query",
".",
"getDependencyRepositories",
"(",
")",
",",
"settings",
")",
";",
"remoteRepos",
".",
"addAll",
"(",
"MavenRepositories",
".",
"getRemoteRepositories",
"(",
"container",
",",
"settings",
")",
")",
";",
"VersionRangeRequest",
"rangeRequest",
"=",
"new",
"VersionRangeRequest",
"(",
"artifact",
",",
"remoteRepos",
",",
"null",
")",
";",
"VersionRangeResult",
"rangeResult",
"=",
"maven",
".",
"resolveVersionRange",
"(",
"session",
",",
"rangeRequest",
")",
";",
"return",
"rangeResult",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Failed to look up versions for [\"",
"+",
"dep",
"+",
"\"]\"",
",",
"e",
")",
";",
"}",
"}"
] | Returns the versions of a specific artifact
@param query
@return | [
"Returns",
"the",
"versions",
"of",
"a",
"specific",
"artifact"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/maven/impl/src/main/java/org/jboss/forge/addon/maven/dependencies/MavenDependencyResolver.java#L141-L174 |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/DateUtil.java | DateUtil.setHours | public static Date setHours(Date d, int hours) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.set(Calendar.HOUR_OF_DAY, hours);
return cal.getTime();
} | java | public static Date setHours(Date d, int hours) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.set(Calendar.HOUR_OF_DAY, hours);
return cal.getTime();
} | [
"public",
"static",
"Date",
"setHours",
"(",
"Date",
"d",
",",
"int",
"hours",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"d",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"hours",
")",
";",
"return",
"cal",
".",
"getTime",
"(",
")",
";",
"}"
] | Set hours to a date
@param d date
@param hours hours
@return new date | [
"Set",
"hours",
"to",
"a",
"date"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L470-L475 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/JobExecutionStatusDetails.java | JobExecutionStatusDetails.withDetailsMap | public JobExecutionStatusDetails withDetailsMap(java.util.Map<String, String> detailsMap) {
setDetailsMap(detailsMap);
return this;
} | java | public JobExecutionStatusDetails withDetailsMap(java.util.Map<String, String> detailsMap) {
setDetailsMap(detailsMap);
return this;
} | [
"public",
"JobExecutionStatusDetails",
"withDetailsMap",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"detailsMap",
")",
"{",
"setDetailsMap",
"(",
"detailsMap",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The job execution status.
</p>
@param detailsMap
The job execution status.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"job",
"execution",
"status",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/JobExecutionStatusDetails.java#L70-L73 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/PayWithGoogleUtils.java | PayWithGoogleUtils.getPriceString | @NonNull
public static String getPriceString(@NonNull long price, @NonNull Currency currency) {
int fractionDigits = currency.getDefaultFractionDigits();
int totalLength = String.valueOf(price).length();
StringBuilder builder = new StringBuilder();
if (fractionDigits == 0) {
for (int i = 0; i < totalLength; i++) {
builder.append('#');
}
DecimalFormat noDecimalCurrencyFormat = new DecimalFormat(builder.toString());
noDecimalCurrencyFormat.setCurrency(currency);
noDecimalCurrencyFormat.setGroupingUsed(false);
return noDecimalCurrencyFormat.format(price);
}
int beforeDecimal = totalLength - fractionDigits;
for (int i = 0; i < beforeDecimal; i++) {
builder.append('#');
}
// So we display "0.55" instead of ".55"
if (totalLength <= fractionDigits) {
builder.append('0');
}
builder.append('.');
for (int i = 0; i < fractionDigits; i++) {
builder.append('0');
}
double modBreak = Math.pow(10, fractionDigits);
double decimalPrice = price / modBreak;
// No matter the Locale, Android Pay requires a dot for the decimal separator.
DecimalFormatSymbols symbolOverride = new DecimalFormatSymbols();
symbolOverride.setDecimalSeparator('.');
DecimalFormat decimalFormat = new DecimalFormat(builder.toString(), symbolOverride);
decimalFormat.setCurrency(currency);
decimalFormat.setGroupingUsed(false);
return decimalFormat.format(decimalPrice);
} | java | @NonNull
public static String getPriceString(@NonNull long price, @NonNull Currency currency) {
int fractionDigits = currency.getDefaultFractionDigits();
int totalLength = String.valueOf(price).length();
StringBuilder builder = new StringBuilder();
if (fractionDigits == 0) {
for (int i = 0; i < totalLength; i++) {
builder.append('#');
}
DecimalFormat noDecimalCurrencyFormat = new DecimalFormat(builder.toString());
noDecimalCurrencyFormat.setCurrency(currency);
noDecimalCurrencyFormat.setGroupingUsed(false);
return noDecimalCurrencyFormat.format(price);
}
int beforeDecimal = totalLength - fractionDigits;
for (int i = 0; i < beforeDecimal; i++) {
builder.append('#');
}
// So we display "0.55" instead of ".55"
if (totalLength <= fractionDigits) {
builder.append('0');
}
builder.append('.');
for (int i = 0; i < fractionDigits; i++) {
builder.append('0');
}
double modBreak = Math.pow(10, fractionDigits);
double decimalPrice = price / modBreak;
// No matter the Locale, Android Pay requires a dot for the decimal separator.
DecimalFormatSymbols symbolOverride = new DecimalFormatSymbols();
symbolOverride.setDecimalSeparator('.');
DecimalFormat decimalFormat = new DecimalFormat(builder.toString(), symbolOverride);
decimalFormat.setCurrency(currency);
decimalFormat.setGroupingUsed(false);
return decimalFormat.format(decimalPrice);
} | [
"@",
"NonNull",
"public",
"static",
"String",
"getPriceString",
"(",
"@",
"NonNull",
"long",
"price",
",",
"@",
"NonNull",
"Currency",
"currency",
")",
"{",
"int",
"fractionDigits",
"=",
"currency",
".",
"getDefaultFractionDigits",
"(",
")",
";",
"int",
"totalLength",
"=",
"String",
".",
"valueOf",
"(",
"price",
")",
".",
"length",
"(",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"fractionDigits",
"==",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"totalLength",
";",
"i",
"++",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"DecimalFormat",
"noDecimalCurrencyFormat",
"=",
"new",
"DecimalFormat",
"(",
"builder",
".",
"toString",
"(",
")",
")",
";",
"noDecimalCurrencyFormat",
".",
"setCurrency",
"(",
"currency",
")",
";",
"noDecimalCurrencyFormat",
".",
"setGroupingUsed",
"(",
"false",
")",
";",
"return",
"noDecimalCurrencyFormat",
".",
"format",
"(",
"price",
")",
";",
"}",
"int",
"beforeDecimal",
"=",
"totalLength",
"-",
"fractionDigits",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"beforeDecimal",
";",
"i",
"++",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"// So we display \"0.55\" instead of \".55\"",
"if",
"(",
"totalLength",
"<=",
"fractionDigits",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fractionDigits",
";",
"i",
"++",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"double",
"modBreak",
"=",
"Math",
".",
"pow",
"(",
"10",
",",
"fractionDigits",
")",
";",
"double",
"decimalPrice",
"=",
"price",
"/",
"modBreak",
";",
"// No matter the Locale, Android Pay requires a dot for the decimal separator.",
"DecimalFormatSymbols",
"symbolOverride",
"=",
"new",
"DecimalFormatSymbols",
"(",
")",
";",
"symbolOverride",
".",
"setDecimalSeparator",
"(",
"'",
"'",
")",
";",
"DecimalFormat",
"decimalFormat",
"=",
"new",
"DecimalFormat",
"(",
"builder",
".",
"toString",
"(",
")",
",",
"symbolOverride",
")",
";",
"decimalFormat",
".",
"setCurrency",
"(",
"currency",
")",
";",
"decimalFormat",
".",
"setGroupingUsed",
"(",
"false",
")",
";",
"return",
"decimalFormat",
".",
"format",
"(",
"decimalPrice",
")",
";",
"}"
] | Converts an integer price in the lowest currency denomination to a Google string value.
For instance: (100L, USD) -> "1.00", but (100L, JPY) -> "100".
@param price the price in the lowest available currency denomination
@param currency the {@link Currency} used to determine how many digits after the decimal
@return a String that can be used as a Pay with Google price string | [
"Converts",
"an",
"integer",
"price",
"in",
"the",
"lowest",
"currency",
"denomination",
"to",
"a",
"Google",
"string",
"value",
".",
"For",
"instance",
":",
"(",
"100L",
"USD",
")",
"-",
">",
"1",
".",
"00",
"but",
"(",
"100L",
"JPY",
")",
"-",
">",
"100",
"."
] | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/PayWithGoogleUtils.java#L21-L61 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java | SeaGlassSynthPainterImpl.paintTabbedPaneTabAreaBackground | public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
paintBackground(context, g, x, y, w, h, null);
} | java | public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
paintBackground(context, g, x, y, w, h, null);
} | [
"public",
"void",
"paintTabbedPaneTabAreaBackground",
"(",
"SynthContext",
"context",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"paintBackground",
"(",
"context",
",",
"g",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"null",
")",
";",
"}"
] | Paints the background of the area behind the tabs of a tabbed pane.
@param context SynthContext identifying the <code>JComponent</code> and
<code>Region</code> to paint to
@param g <code>Graphics</code> to paint to
@param x X coordinate of the area to paint to
@param y Y coordinate of the area to paint to
@param w Width of the area to paint to
@param h Height of the area to paint to | [
"Paints",
"the",
"background",
"of",
"the",
"area",
"behind",
"the",
"tabs",
"of",
"a",
"tabbed",
"pane",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1956-L1958 |
Whiley/WhileyCompiler | src/main/java/wyil/util/AbstractTypedVisitor.java | AbstractTypedVisitor.selectRecord | public Type.Record selectRecord(Type target, Expr expr, Environment environment) {
Type.Record type = asType(expr.getType(), Type.Record.class);
Type.Record[] records = TYPE_RECORD_FILTER.apply(target);
return selectCandidate(records, type, environment);
} | java | public Type.Record selectRecord(Type target, Expr expr, Environment environment) {
Type.Record type = asType(expr.getType(), Type.Record.class);
Type.Record[] records = TYPE_RECORD_FILTER.apply(target);
return selectCandidate(records, type, environment);
} | [
"public",
"Type",
".",
"Record",
"selectRecord",
"(",
"Type",
"target",
",",
"Expr",
"expr",
",",
"Environment",
"environment",
")",
"{",
"Type",
".",
"Record",
"type",
"=",
"asType",
"(",
"expr",
".",
"getType",
"(",
")",
",",
"Type",
".",
"Record",
".",
"class",
")",
";",
"Type",
".",
"Record",
"[",
"]",
"records",
"=",
"TYPE_RECORD_FILTER",
".",
"apply",
"(",
"target",
")",
";",
"return",
"selectCandidate",
"(",
"records",
",",
"type",
",",
"environment",
")",
";",
"}"
] | <p>
Given an arbitrary target type, filter out the target record types. For
example, consider the following method:
</p>
<pre>
method f(int x):
{int f}|null xs = {f: x}
...
</pre>
<p>
When type checking the expression <code>{f: x}</code> the flow type checker
will attempt to determine an <i>expected</i> record type. In order to then
determine the appropriate expected type for field initialiser expression
<code>x</code> it filters <code>{int f}|null</code> down to just
<code>{int f}</code>.
</p>
@param target
Target type for this value
@param expr
Source expression for this value
@author David J. Pearce | [
"<p",
">",
"Given",
"an",
"arbitrary",
"target",
"type",
"filter",
"out",
"the",
"target",
"record",
"types",
".",
"For",
"example",
"consider",
"the",
"following",
"method",
":",
"<",
"/",
"p",
">"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/util/AbstractTypedVisitor.java#L1140-L1144 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/EventHelper.java | EventHelper.renderHeader | private final void renderHeader(PdfWriter writer, Document document) throws DocumentException, VectorPrintException {
if ((!debugHereAfter && getSettings().getBooleanProperty(false, DEBUG))
|| (!failuresHereAfter && !getSettings().getBooleanProperty(false, DEBUG))) {
writer.getDirectContent().addImage(getTemplateImage(template));
if (getSettings().getBooleanProperty(false, DEBUG)) {
ArrayList a = new ArrayList(2);
a.add(PdfName.TOGGLE);
a.add(elementProducer.initLayerGroup(DEBUG, writer.getDirectContent()));
PdfAction act = PdfAction.setOCGstate(a, true);
Chunk h = new Chunk("toggle debug info", DebugHelper.debugFontLink(writer.getDirectContent(), getSettings())).setAction(act);
ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 15, 0);
Font f = DebugHelper.debugFontLink(writer.getDirectContent(), getSettings());
// act = PdfAction.gotoLocalPage("debugpage", true);
elementProducer.startLayerInGroup(DEBUG, writer.getDirectContent());
h = new Chunk(getSettings().getProperty("go to debug legend", "debugheader"), f).setLocalGoto(BaseReportGenerator.DEBUGPAGE);
ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 3, 0);
writer.getDirectContent().endLayer();
}
}
} | java | private final void renderHeader(PdfWriter writer, Document document) throws DocumentException, VectorPrintException {
if ((!debugHereAfter && getSettings().getBooleanProperty(false, DEBUG))
|| (!failuresHereAfter && !getSettings().getBooleanProperty(false, DEBUG))) {
writer.getDirectContent().addImage(getTemplateImage(template));
if (getSettings().getBooleanProperty(false, DEBUG)) {
ArrayList a = new ArrayList(2);
a.add(PdfName.TOGGLE);
a.add(elementProducer.initLayerGroup(DEBUG, writer.getDirectContent()));
PdfAction act = PdfAction.setOCGstate(a, true);
Chunk h = new Chunk("toggle debug info", DebugHelper.debugFontLink(writer.getDirectContent(), getSettings())).setAction(act);
ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 15, 0);
Font f = DebugHelper.debugFontLink(writer.getDirectContent(), getSettings());
// act = PdfAction.gotoLocalPage("debugpage", true);
elementProducer.startLayerInGroup(DEBUG, writer.getDirectContent());
h = new Chunk(getSettings().getProperty("go to debug legend", "debugheader"), f).setLocalGoto(BaseReportGenerator.DEBUGPAGE);
ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(h), 10, document.top() - 3, 0);
writer.getDirectContent().endLayer();
}
}
} | [
"private",
"final",
"void",
"renderHeader",
"(",
"PdfWriter",
"writer",
",",
"Document",
"document",
")",
"throws",
"DocumentException",
",",
"VectorPrintException",
"{",
"if",
"(",
"(",
"!",
"debugHereAfter",
"&&",
"getSettings",
"(",
")",
".",
"getBooleanProperty",
"(",
"false",
",",
"DEBUG",
")",
")",
"||",
"(",
"!",
"failuresHereAfter",
"&&",
"!",
"getSettings",
"(",
")",
".",
"getBooleanProperty",
"(",
"false",
",",
"DEBUG",
")",
")",
")",
"{",
"writer",
".",
"getDirectContent",
"(",
")",
".",
"addImage",
"(",
"getTemplateImage",
"(",
"template",
")",
")",
";",
"if",
"(",
"getSettings",
"(",
")",
".",
"getBooleanProperty",
"(",
"false",
",",
"DEBUG",
")",
")",
"{",
"ArrayList",
"a",
"=",
"new",
"ArrayList",
"(",
"2",
")",
";",
"a",
".",
"add",
"(",
"PdfName",
".",
"TOGGLE",
")",
";",
"a",
".",
"add",
"(",
"elementProducer",
".",
"initLayerGroup",
"(",
"DEBUG",
",",
"writer",
".",
"getDirectContent",
"(",
")",
")",
")",
";",
"PdfAction",
"act",
"=",
"PdfAction",
".",
"setOCGstate",
"(",
"a",
",",
"true",
")",
";",
"Chunk",
"h",
"=",
"new",
"Chunk",
"(",
"\"toggle debug info\"",
",",
"DebugHelper",
".",
"debugFontLink",
"(",
"writer",
".",
"getDirectContent",
"(",
")",
",",
"getSettings",
"(",
")",
")",
")",
".",
"setAction",
"(",
"act",
")",
";",
"ColumnText",
".",
"showTextAligned",
"(",
"writer",
".",
"getDirectContent",
"(",
")",
",",
"Element",
".",
"ALIGN_LEFT",
",",
"new",
"Phrase",
"(",
"h",
")",
",",
"10",
",",
"document",
".",
"top",
"(",
")",
"-",
"15",
",",
"0",
")",
";",
"Font",
"f",
"=",
"DebugHelper",
".",
"debugFontLink",
"(",
"writer",
".",
"getDirectContent",
"(",
")",
",",
"getSettings",
"(",
")",
")",
";",
"// act = PdfAction.gotoLocalPage(\"debugpage\", true);",
"elementProducer",
".",
"startLayerInGroup",
"(",
"DEBUG",
",",
"writer",
".",
"getDirectContent",
"(",
")",
")",
";",
"h",
"=",
"new",
"Chunk",
"(",
"getSettings",
"(",
")",
".",
"getProperty",
"(",
"\"go to debug legend\"",
",",
"\"debugheader\"",
")",
",",
"f",
")",
".",
"setLocalGoto",
"(",
"BaseReportGenerator",
".",
"DEBUGPAGE",
")",
";",
"ColumnText",
".",
"showTextAligned",
"(",
"writer",
".",
"getDirectContent",
"(",
")",
",",
"Element",
".",
"ALIGN_LEFT",
",",
"new",
"Phrase",
"(",
"h",
")",
",",
"10",
",",
"document",
".",
"top",
"(",
")",
"-",
"3",
",",
"0",
")",
";",
"writer",
".",
"getDirectContent",
"(",
")",
".",
"endLayer",
"(",
")",
";",
"}",
"}",
"}"
] | prints a failure and / or a debug header when applicable.
@see #getTemplateImage(com.itextpdf.text.pdf.PdfTemplate)
@param writer
@param document
@throws DocumentException
@throws VectorPrintException | [
"prints",
"a",
"failure",
"and",
"/",
"or",
"a",
"debug",
"header",
"when",
"applicable",
"."
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L273-L299 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/URLUtils.java | URLUtils.setElementID | public static URI setElementID(final URI relativePath, final String id) {
String topic = getTopicID(relativePath);
if (topic != null) {
return setFragment(relativePath, topic + (id != null ? SLASH + id : ""));
} else if (id == null) {
return stripFragment(relativePath);
} else {
throw new IllegalArgumentException(relativePath.toString());
}
} | java | public static URI setElementID(final URI relativePath, final String id) {
String topic = getTopicID(relativePath);
if (topic != null) {
return setFragment(relativePath, topic + (id != null ? SLASH + id : ""));
} else if (id == null) {
return stripFragment(relativePath);
} else {
throw new IllegalArgumentException(relativePath.toString());
}
} | [
"public",
"static",
"URI",
"setElementID",
"(",
"final",
"URI",
"relativePath",
",",
"final",
"String",
"id",
")",
"{",
"String",
"topic",
"=",
"getTopicID",
"(",
"relativePath",
")",
";",
"if",
"(",
"topic",
"!=",
"null",
")",
"{",
"return",
"setFragment",
"(",
"relativePath",
",",
"topic",
"+",
"(",
"id",
"!=",
"null",
"?",
"SLASH",
"+",
"id",
":",
"\"\"",
")",
")",
";",
"}",
"else",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"return",
"stripFragment",
"(",
"relativePath",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"relativePath",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | Set the element ID from the path
@param relativePath path
@param id element ID
@return element ID, may be {@code null} | [
"Set",
"the",
"element",
"ID",
"from",
"the",
"path"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L722-L731 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.putShort | public final void putShort(int index, short value) {
final long pos = address + index;
if (index >= 0 && pos <= addressLimit - 2) {
UNSAFE.putShort(heapMemory, pos, value);
}
else if (address > addressLimit) {
throw new IllegalStateException("segment has been freed");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
} | java | public final void putShort(int index, short value) {
final long pos = address + index;
if (index >= 0 && pos <= addressLimit - 2) {
UNSAFE.putShort(heapMemory, pos, value);
}
else if (address > addressLimit) {
throw new IllegalStateException("segment has been freed");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
} | [
"public",
"final",
"void",
"putShort",
"(",
"int",
"index",
",",
"short",
"value",
")",
"{",
"final",
"long",
"pos",
"=",
"address",
"+",
"index",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"pos",
"<=",
"addressLimit",
"-",
"2",
")",
"{",
"UNSAFE",
".",
"putShort",
"(",
"heapMemory",
",",
"pos",
",",
"value",
")",
";",
"}",
"else",
"if",
"(",
"address",
">",
"addressLimit",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"segment has been freed\"",
")",
";",
"}",
"else",
"{",
"// index is in fact invalid",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"}"
] | Writes the given short value into this buffer at the given position, using
the native byte order of the system.
@param index The position at which the value will be written.
@param value The short value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment
size minus 2. | [
"Writes",
"the",
"given",
"short",
"value",
"into",
"this",
"buffer",
"at",
"the",
"given",
"position",
"using",
"the",
"native",
"byte",
"order",
"of",
"the",
"system",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L620-L632 |
tiesebarrell/process-assertions | process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java | ProcessAssert.assertProcessEndedAndInExclusiveEndEvent | public static void assertProcessEndedAndInExclusiveEndEvent(final String processInstanceId, final String endEventId) {
Validate.notNull(processInstanceId);
Validate.notNull(endEventId);
apiCallback.debug(LogMessage.PROCESS_9, processInstanceId, endEventId);
try {
getEndEventAssertable().processEndedAndInExclusiveEndEvent(processInstanceId, endEventId);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_3, processInstanceId, endEventId);
}
} | java | public static void assertProcessEndedAndInExclusiveEndEvent(final String processInstanceId, final String endEventId) {
Validate.notNull(processInstanceId);
Validate.notNull(endEventId);
apiCallback.debug(LogMessage.PROCESS_9, processInstanceId, endEventId);
try {
getEndEventAssertable().processEndedAndInExclusiveEndEvent(processInstanceId, endEventId);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_3, processInstanceId, endEventId);
}
} | [
"public",
"static",
"void",
"assertProcessEndedAndInExclusiveEndEvent",
"(",
"final",
"String",
"processInstanceId",
",",
"final",
"String",
"endEventId",
")",
"{",
"Validate",
".",
"notNull",
"(",
"processInstanceId",
")",
";",
"Validate",
".",
"notNull",
"(",
"endEventId",
")",
";",
"apiCallback",
".",
"debug",
"(",
"LogMessage",
".",
"PROCESS_9",
",",
"processInstanceId",
",",
"endEventId",
")",
";",
"try",
"{",
"getEndEventAssertable",
"(",
")",
".",
"processEndedAndInExclusiveEndEvent",
"(",
"processInstanceId",
",",
"endEventId",
")",
";",
"}",
"catch",
"(",
"final",
"AssertionError",
"ae",
")",
"{",
"apiCallback",
".",
"fail",
"(",
"ae",
",",
"LogMessage",
".",
"ERROR_PROCESS_3",
",",
"processInstanceId",
",",
"endEventId",
")",
";",
"}",
"}"
] | Asserts the process instance with the provided id is ended and has reached <strong>only</strong> the end event
with the provided id.
<p>
<strong>Note:</strong> this assertion should be used for processes that have exclusive end events and no
intermediate end events. This generally only applies to simple processes. If the process definition branches into
non-exclusive branches with distinct end events or the process potentially has multiple end events that are
reached, this method should not be used.
<p>
To test that a process ended in an end event and that particular end event was the final event reached, use
{@link #assertProcessEndedAndReachedEndStateLast(String, String)} instead.
<p>
To assert that a process ended in an exact set of end events, use
{@link #assertProcessEndedAndInEndEvents(String, String...)} instead.
@see #assertProcessEndedAndReachedEndStateLast(String, String)
@see #assertProcessEndedAndInEndEvents(String, String...)
@param processInstanceId
the process instance's id to check for. May not be <code>null</code>
@param endEventId
the end event's id to check for. May not be <code>null</code> | [
"Asserts",
"the",
"process",
"instance",
"with",
"the",
"provided",
"id",
"is",
"ended",
"and",
"has",
"reached",
"<strong",
">",
"only<",
"/",
"strong",
">",
"the",
"end",
"event",
"with",
"the",
"provided",
"id",
"."
] | train | https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java#L184-L194 |
codescape/bitvunit | bitvunit-core/src/main/java/de/codescape/bitvunit/report/TextReportWriter.java | TextReportWriter.printViolations | private void printViolations(Violations violations, PrintWriter out) {
out.println("Violations found:");
if (violations.hasViolations()) {
for (Violation violation : violations.asList()) {
out.println(" - " + violation);
}
} else {
out.println(" - No violations found.");
}
} | java | private void printViolations(Violations violations, PrintWriter out) {
out.println("Violations found:");
if (violations.hasViolations()) {
for (Violation violation : violations.asList()) {
out.println(" - " + violation);
}
} else {
out.println(" - No violations found.");
}
} | [
"private",
"void",
"printViolations",
"(",
"Violations",
"violations",
",",
"PrintWriter",
"out",
")",
"{",
"out",
".",
"println",
"(",
"\"Violations found:\"",
")",
";",
"if",
"(",
"violations",
".",
"hasViolations",
"(",
")",
")",
"{",
"for",
"(",
"Violation",
"violation",
":",
"violations",
".",
"asList",
"(",
")",
")",
"{",
"out",
".",
"println",
"(",
"\" - \"",
"+",
"violation",
")",
";",
"}",
"}",
"else",
"{",
"out",
".",
"println",
"(",
"\" - No violations found.\"",
")",
";",
"}",
"}"
] | Writes the part where all {@link Violations} that were found are listed.
@param violations {@link Violations} that were found
@param out target where the report is written to | [
"Writes",
"the",
"part",
"where",
"all",
"{",
"@link",
"Violations",
"}",
"that",
"were",
"found",
"are",
"listed",
"."
] | train | https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/report/TextReportWriter.java#L72-L81 |