repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.removeHeader | @Deprecated
public static void removeHeader(HttpMessage message, String name) {
message.headers().remove(name);
} | java | @Deprecated
public static void removeHeader(HttpMessage message, String name) {
message.headers().remove(name);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"removeHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"remove",
"(",
"name",
")",
";",
"}"
] | @deprecated Use {@link #remove(CharSequence)} instead.
@see #removeHeader(HttpMessage, CharSequence) | [
"@deprecated",
"Use",
"{",
"@link",
"#remove",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L679-L682 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/compiler/Parser.java | Parser.parseAssignmentStatement | private AssignmentStatement parseAssignmentStatement(Token token)
throws IOException {
// TODO: allow lvalue to support dot notations
// ie: field = x (store local variable)
// obj.field = x (obj.setField)
// obj.field.field = x (obj.getField().setField)
// array[idx] = x (array[idx])
// list[idx] = x (list.set(idx, x))
// map[key] = x (map.put(key, x))
// map[obj.name] = x (map.put(obj.getName(), x)
SourceInfo info = token.getSourceInfo();
VariableRef lvalue = parseLValue(token);
if (peek().getID() == Token.ASSIGN) {
read();
}
else {
error("assignment.equals.expected", peek());
}
Expression rvalue = parseExpression();
info = info.setEndPosition(rvalue.getSourceInfo());
// Start mod for 'as' keyword for declarative typing
if (peek().getID() == Token.AS) {
read();
TypeName typeName = parseTypeName();
SourceInfo info2 = peek().getSourceInfo();
lvalue.setVariable(new Variable(info2, lvalue.getName(), typeName, true));
}
// End mod
return new AssignmentStatement(info, lvalue, rvalue);
} | java | private AssignmentStatement parseAssignmentStatement(Token token)
throws IOException {
// TODO: allow lvalue to support dot notations
// ie: field = x (store local variable)
// obj.field = x (obj.setField)
// obj.field.field = x (obj.getField().setField)
// array[idx] = x (array[idx])
// list[idx] = x (list.set(idx, x))
// map[key] = x (map.put(key, x))
// map[obj.name] = x (map.put(obj.getName(), x)
SourceInfo info = token.getSourceInfo();
VariableRef lvalue = parseLValue(token);
if (peek().getID() == Token.ASSIGN) {
read();
}
else {
error("assignment.equals.expected", peek());
}
Expression rvalue = parseExpression();
info = info.setEndPosition(rvalue.getSourceInfo());
// Start mod for 'as' keyword for declarative typing
if (peek().getID() == Token.AS) {
read();
TypeName typeName = parseTypeName();
SourceInfo info2 = peek().getSourceInfo();
lvalue.setVariable(new Variable(info2, lvalue.getName(), typeName, true));
}
// End mod
return new AssignmentStatement(info, lvalue, rvalue);
} | [
"private",
"AssignmentStatement",
"parseAssignmentStatement",
"(",
"Token",
"token",
")",
"throws",
"IOException",
"{",
"// TODO: allow lvalue to support dot notations",
"// ie: field = x (store local variable)",
"// obj.field = x (obj.setField)",
"// obj.field.field = x (obj.getFi... | When this is called, the identifier token has already been read. | [
"When",
"this",
"is",
"called",
"the",
"identifier",
"token",
"has",
"already",
"been",
"read",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Parser.java#L728-L763 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java | VoronoiDraw.drawFakeVoronoi | public static SVGPath drawFakeVoronoi(Projection2D proj, List<double[]> means) {
CanvasSize viewport = proj.estimateViewport();
final SVGPath path = new SVGPath();
// Difference
final double[] dirv = VMath.minus(means.get(1), means.get(0));
VMath.rotate90Equals(dirv);
double[] dir = proj.fastProjectRelativeDataToRenderSpace(dirv);
// Mean
final double[] mean = VMath.plus(means.get(0), means.get(1));
VMath.timesEquals(mean, 0.5);
double[] projmean = proj.fastProjectDataToRenderSpace(mean);
double factor = viewport.continueToMargin(projmean, dir);
path.moveTo(projmean[0] + factor * dir[0], projmean[1] + factor * dir[1]);
// Inverse direction:
dir[0] *= -1;
dir[1] *= -1;
factor = viewport.continueToMargin(projmean, dir);
path.drawTo(projmean[0] + factor * dir[0], projmean[1] + factor * dir[1]);
return path;
} | java | public static SVGPath drawFakeVoronoi(Projection2D proj, List<double[]> means) {
CanvasSize viewport = proj.estimateViewport();
final SVGPath path = new SVGPath();
// Difference
final double[] dirv = VMath.minus(means.get(1), means.get(0));
VMath.rotate90Equals(dirv);
double[] dir = proj.fastProjectRelativeDataToRenderSpace(dirv);
// Mean
final double[] mean = VMath.plus(means.get(0), means.get(1));
VMath.timesEquals(mean, 0.5);
double[] projmean = proj.fastProjectDataToRenderSpace(mean);
double factor = viewport.continueToMargin(projmean, dir);
path.moveTo(projmean[0] + factor * dir[0], projmean[1] + factor * dir[1]);
// Inverse direction:
dir[0] *= -1;
dir[1] *= -1;
factor = viewport.continueToMargin(projmean, dir);
path.drawTo(projmean[0] + factor * dir[0], projmean[1] + factor * dir[1]);
return path;
} | [
"public",
"static",
"SVGPath",
"drawFakeVoronoi",
"(",
"Projection2D",
"proj",
",",
"List",
"<",
"double",
"[",
"]",
">",
"means",
")",
"{",
"CanvasSize",
"viewport",
"=",
"proj",
".",
"estimateViewport",
"(",
")",
";",
"final",
"SVGPath",
"path",
"=",
"ne... | Fake Voronoi diagram. For two means only
@param proj Projection
@param means Mean vectors
@return SVG path | [
"Fake",
"Voronoi",
"diagram",
".",
"For",
"two",
"means",
"only"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/VoronoiDraw.java#L150-L170 |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/transport/blockingqueue/BlockingQueueReceiver.java | BlockingQueueReceiver.start | @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public synchronized void start(final Listener listener, final Infrastructure infra) {
if (listener == null)
throw new IllegalArgumentException("Cannot pass null to " + BlockingQueueReceiver.class.getSimpleName() + ".setListener");
if (this.listener != null)
throw new IllegalStateException(
"Cannot set a new Listener (" + SafeString.objectDescription(listener) + ") on a " + BlockingQueueReceiver.class.getSimpleName()
+ " when there's one already set (" + SafeString.objectDescription(this.listener) + ")");
this.listener = listener;
infra.getThreadingModel().runDaemon(this, "BQReceiver-" + address.toString());
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public synchronized void start(final Listener listener, final Infrastructure infra) {
if (listener == null)
throw new IllegalArgumentException("Cannot pass null to " + BlockingQueueReceiver.class.getSimpleName() + ".setListener");
if (this.listener != null)
throw new IllegalStateException(
"Cannot set a new Listener (" + SafeString.objectDescription(listener) + ") on a " + BlockingQueueReceiver.class.getSimpleName()
+ " when there's one already set (" + SafeString.objectDescription(this.listener) + ")");
this.listener = listener;
infra.getThreadingModel().runDaemon(this, "BQReceiver-" + address.toString());
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"@",
"Override",
"public",
"synchronized",
"void",
"start",
"(",
"final",
"Listener",
"listener",
",",
"final",
"Infrastructure",
"infra",
")",
"{",
"if",
"(",
"listener",
"==",... | A BlockingQueueAdaptor requires a MessageTransportListener to be set in order to adapt a client side.
@param listener
is the MessageTransportListener to push messages to when they come in. | [
"A",
"BlockingQueueAdaptor",
"requires",
"a",
"MessageTransportListener",
"to",
"be",
"set",
"in",
"order",
"to",
"adapt",
"a",
"client",
"side",
"."
] | train | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/transport/blockingqueue/BlockingQueueReceiver.java#L120-L131 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java | VirtualNetworkRulesInner.createOrUpdate | public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String accountName, String virtualNetworkRuleName, CreateOrUpdateVirtualNetworkRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).toBlocking().single().body();
} | java | public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String accountName, String virtualNetworkRuleName, CreateOrUpdateVirtualNetworkRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).toBlocking().single().body();
} | [
"public",
"VirtualNetworkRuleInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"virtualNetworkRuleName",
",",
"CreateOrUpdateVirtualNetworkRuleParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceRespons... | Creates or updates the specified virtual network rule. During update, the virtual network rule with the specified name will be replaced with this new virtual network rule.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param virtualNetworkRuleName The name of the virtual network rule to create or update.
@param parameters Parameters supplied to create or update the virtual network rule.
@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 VirtualNetworkRuleInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"virtual",
"network",
"rule",
".",
"During",
"update",
"the",
"virtual",
"network",
"rule",
"with",
"the",
"specified",
"name",
"will",
"be",
"replaced",
"with",
"this",
"new",
"virtual",
"network",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java#L228-L230 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Obj | public JBBPTextWriter Obj(final int objId, final Object... obj) throws IOException {
if (this.extras.isEmpty()) {
throw new IllegalStateException("There is not any registered extras");
}
for (final Object c : obj) {
String str = null;
for (final Extra e : this.extras) {
str = e.doConvertObjToStr(this, objId, c);
if (str != null) {
break;
}
}
if (str != null) {
ensureValueMode();
printValueString(str);
}
}
return this;
} | java | public JBBPTextWriter Obj(final int objId, final Object... obj) throws IOException {
if (this.extras.isEmpty()) {
throw new IllegalStateException("There is not any registered extras");
}
for (final Object c : obj) {
String str = null;
for (final Extra e : this.extras) {
str = e.doConvertObjToStr(this, objId, c);
if (str != null) {
break;
}
}
if (str != null) {
ensureValueMode();
printValueString(str);
}
}
return this;
} | [
"public",
"JBBPTextWriter",
"Obj",
"(",
"final",
"int",
"objId",
",",
"final",
"Object",
"...",
"obj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"extras",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
... | Print objects.
@param objId object id which will be provided to a converter as extra info
@param obj objects to be converted and printed, must not be null
@return the context
@throws IOException it will be thrown for transport errors | [
"Print",
"objects",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L1273-L1293 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java | NetUtil.getInputStreamHttp | public static InputStream getInputStreamHttp(URL pURL, int pTimeout) throws IOException {
return getInputStreamHttp(pURL, null, true, pTimeout);
} | java | public static InputStream getInputStreamHttp(URL pURL, int pTimeout) throws IOException {
return getInputStreamHttp(pURL, null, true, pTimeout);
} | [
"public",
"static",
"InputStream",
"getInputStreamHttp",
"(",
"URL",
"pURL",
",",
"int",
"pTimeout",
")",
"throws",
"IOException",
"{",
"return",
"getInputStreamHttp",
"(",
"pURL",
",",
"null",
",",
"true",
",",
"pTimeout",
")",
";",
"}"
] | Gets the InputStream from a given URL, with the given timeout.
The timeout must be > 0. A timeout of zero is interpreted as an
infinite timeout.
<P/>
<SMALL>Implementation note: If the timeout parameter is greater than 0,
this method uses my own implementation of
java.net.HttpURLConnection, that uses plain sockets, to create an
HTTP connection to the given URL. The {@code read} methods called
on the returned InputStream, will block only for the specified timeout.
If the timeout expires, a java.io.InterruptedIOException is raised. This
might happen BEFORE OR AFTER this method returns, as the HTTP headers
will be read and parsed from the InputStream before this method returns,
while further read operations on the returned InputStream might be
performed at a later stage.
<BR/>
</SMALL>
@param pURL the URL to get.
@param pTimeout the specified timeout, in milliseconds.
@return an input stream that reads from the socket connection, created
from the given URL.
@throws UnknownHostException if the IP address for the given URL cannot
be resolved.
@throws FileNotFoundException if there is no file at the given URL.
@throws IOException if an error occurs during transfer.
@see com.twelvemonkeys.net.HttpURLConnection
@see java.net.Socket
@see java.net.Socket#setSoTimeout(int) setSoTimeout
@see HttpURLConnection
@see java.io.InterruptedIOException
@see <A href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</A> | [
"Gets",
"the",
"InputStream",
"from",
"a",
"given",
"URL",
"with",
"the",
"given",
"timeout",
".",
"The",
"timeout",
"must",
"be",
">",
"0",
".",
"A",
"timeout",
"of",
"zero",
"is",
"interpreted",
"as",
"an",
"infinite",
"timeout",
".",
"<P",
"/",
">",... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java#L666-L668 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java | XBasePanel.printDataStartForm | public void printDataStartForm(PrintWriter out, int iPrintOptions)
{
String strRecordName = "norecord";
Record record = this.getMainRecord();
if (record != null)
strRecordName = record.getTableNames(false);
if ((iPrintOptions & HtmlConstants.MAIN_HEADING_SCREEN) == HtmlConstants.MAIN_HEADING_SCREEN)
{
out.println(Utility.startTag(XMLTags.HEADING));
out.println(Utility.startTag(XMLTags.FILE));
out.println(Utility.startTag(strRecordName));
}
if ((iPrintOptions & HtmlConstants.MAIN_FOOTING_SCREEN) == HtmlConstants.MAIN_FOOTING_SCREEN)
{
out.println(Utility.startTag(XMLTags.FOOTING));
out.println(Utility.startTag(XMLTags.FILE));
out.println(Utility.startTag(strRecordName));
}
if ((iPrintOptions & HtmlConstants.REPORT_SCREEN) != HtmlConstants.REPORT_SCREEN)
out.println(Utility.startTag(XMLTags.DATA)); // If not a report
} | java | public void printDataStartForm(PrintWriter out, int iPrintOptions)
{
String strRecordName = "norecord";
Record record = this.getMainRecord();
if (record != null)
strRecordName = record.getTableNames(false);
if ((iPrintOptions & HtmlConstants.MAIN_HEADING_SCREEN) == HtmlConstants.MAIN_HEADING_SCREEN)
{
out.println(Utility.startTag(XMLTags.HEADING));
out.println(Utility.startTag(XMLTags.FILE));
out.println(Utility.startTag(strRecordName));
}
if ((iPrintOptions & HtmlConstants.MAIN_FOOTING_SCREEN) == HtmlConstants.MAIN_FOOTING_SCREEN)
{
out.println(Utility.startTag(XMLTags.FOOTING));
out.println(Utility.startTag(XMLTags.FILE));
out.println(Utility.startTag(strRecordName));
}
if ((iPrintOptions & HtmlConstants.REPORT_SCREEN) != HtmlConstants.REPORT_SCREEN)
out.println(Utility.startTag(XMLTags.DATA)); // If not a report
} | [
"public",
"void",
"printDataStartForm",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"String",
"strRecordName",
"=",
"\"norecord\"",
";",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"record",
"!=",
"n... | Display the start form in input format.
@param out The out stream.
@param iPrintOptions The view specific attributes. | [
"Display",
"the",
"start",
"form",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L462-L482 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java | LiveOutputsInner.beginDelete | public void beginDelete(String resourceGroupName, String accountName, String liveEventName, String liveOutputName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String accountName, String liveEventName, String liveOutputName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
",",
"String",
"liveOutputName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"liveE... | Delete Live Output.
Deletes a Live Output.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@param liveOutputName The name of the Live Output.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Delete",
"Live",
"Output",
".",
"Deletes",
"a",
"Live",
"Output",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java#L641-L643 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/GeomUtil.java | GeomUtil.onPath | private boolean onPath(Shape path, float x, float y) {
for (int i=0;i<path.getPointCount()+1;i++) {
int n = rationalPoint(path, i+1);
Line line = getLine(path, rationalPoint(path, i), n);
if (line.distance(new Vector2f(x,y)) < EPSILON*100) {
return true;
}
}
return false;
} | java | private boolean onPath(Shape path, float x, float y) {
for (int i=0;i<path.getPointCount()+1;i++) {
int n = rationalPoint(path, i+1);
Line line = getLine(path, rationalPoint(path, i), n);
if (line.distance(new Vector2f(x,y)) < EPSILON*100) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"onPath",
"(",
"Shape",
"path",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"path",
".",
"getPointCount",
"(",
")",
"+",
"1",
";",
"i",
"++",
")",
"{",
"int",
"n",
"="... | Check if the given point is on the path
@param path The path to check
@param x The x coordinate of the point to check
@param y The y coordiante of teh point to check
@return True if the point is on the path | [
"Check",
"if",
"the",
"given",
"point",
"is",
"on",
"the",
"path"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/GeomUtil.java#L79-L89 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.viewTranscription | public TranscriptionResponse viewTranscription(String callID, String legId, String recordingId, Integer page, Integer pageSize) throws UnauthorizedException, GeneralException {
if (callID == null) {
throw new IllegalArgumentException("Voice call ID must be specified.");
}
if (legId == null) {
throw new IllegalArgumentException("Leg ID must be specified.");
}
if (recordingId == null) {
throw new IllegalArgumentException("Recording ID must be specified.");
}
String url = String.format(
"%s%s/%s%s/%s%s/%s",
VOICE_CALLS_BASE_URL,
VOICECALLSPATH,
callID,
LEGSPATH,
legId,
RECORDINGPATH,
recordingId);
return messageBirdService.requestList(url, new PagedPaging(page, pageSize), TranscriptionResponse.class);
} | java | public TranscriptionResponse viewTranscription(String callID, String legId, String recordingId, Integer page, Integer pageSize) throws UnauthorizedException, GeneralException {
if (callID == null) {
throw new IllegalArgumentException("Voice call ID must be specified.");
}
if (legId == null) {
throw new IllegalArgumentException("Leg ID must be specified.");
}
if (recordingId == null) {
throw new IllegalArgumentException("Recording ID must be specified.");
}
String url = String.format(
"%s%s/%s%s/%s%s/%s",
VOICE_CALLS_BASE_URL,
VOICECALLSPATH,
callID,
LEGSPATH,
legId,
RECORDINGPATH,
recordingId);
return messageBirdService.requestList(url, new PagedPaging(page, pageSize), TranscriptionResponse.class);
} | [
"public",
"TranscriptionResponse",
"viewTranscription",
"(",
"String",
"callID",
",",
"String",
"legId",
",",
"String",
"recordingId",
",",
"Integer",
"page",
",",
"Integer",
"pageSize",
")",
"throws",
"UnauthorizedException",
",",
"GeneralException",
"{",
"if",
"("... | Function to view recording by call id, leg id and recording id
@param callID Voice call ID
@param legId Leg ID
@param recordingId Recording ID
@return TranscriptionResponseList
@throws UnauthorizedException if client is unauthorized
@throws GeneralException general exception | [
"Function",
"to",
"view",
"recording",
"by",
"call",
"id",
"leg",
"id",
"and",
"recording",
"id"
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L1130-L1154 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java | ClassicLayoutManager.findTotalOffset | protected int findTotalOffset(ArrayList aligments, byte position) {
int total = 0;
for (Object aligment : aligments) {
HorizontalBandAlignment currentAlignment = (HorizontalBandAlignment) aligment;
int aux = 0;
for (AutoText autotext : getReport().getAutoTexts()) {
if (autotext.getPosition() == position && currentAlignment.equals(autotext.getAlignment())) {
aux += autotext.getHeight();
}
}
if (aux > total)
total = aux;
}
return total;
} | java | protected int findTotalOffset(ArrayList aligments, byte position) {
int total = 0;
for (Object aligment : aligments) {
HorizontalBandAlignment currentAlignment = (HorizontalBandAlignment) aligment;
int aux = 0;
for (AutoText autotext : getReport().getAutoTexts()) {
if (autotext.getPosition() == position && currentAlignment.equals(autotext.getAlignment())) {
aux += autotext.getHeight();
}
}
if (aux > total)
total = aux;
}
return total;
} | [
"protected",
"int",
"findTotalOffset",
"(",
"ArrayList",
"aligments",
",",
"byte",
"position",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"Object",
"aligment",
":",
"aligments",
")",
"{",
"HorizontalBandAlignment",
"currentAlignment",
"=",
"(",
"Hori... | Finds the highest sum of height for each possible alignment (left, center, right)
@param aligments
@return | [
"Finds",
"the",
"highest",
"sum",
"of",
"height",
"for",
"each",
"possible",
"alignment",
"(",
"left",
"center",
"right",
")"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L172-L186 |
hypercube1024/firefly | firefly-wechat/src/main/java/com/firefly/wechat/utils/WXBizMsgCrypt.java | WXBizMsgCrypt.decryptMsg | public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData)
throws AesException {
// 密钥,公众账号的app secret
// 提取密文
Object[] encrypt = XMLParser.extract(postData);
// 验证安全签名
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString());
// 和URL中的签名比较是否相等
if (!signature.equals(msgSignature)) {
throw new AesException(AesException.ValidateSignatureError);
}
// 解密
return decrypt(encrypt[1].toString());
} | java | public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData)
throws AesException {
// 密钥,公众账号的app secret
// 提取密文
Object[] encrypt = XMLParser.extract(postData);
// 验证安全签名
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString());
// 和URL中的签名比较是否相等
if (!signature.equals(msgSignature)) {
throw new AesException(AesException.ValidateSignatureError);
}
// 解密
return decrypt(encrypt[1].toString());
} | [
"public",
"String",
"decryptMsg",
"(",
"String",
"msgSignature",
",",
"String",
"timeStamp",
",",
"String",
"nonce",
",",
"String",
"postData",
")",
"throws",
"AesException",
"{",
"// 密钥,公众账号的app secret",
"// 提取密文",
"Object",
"[",
"]",
"encrypt",
"=",
"XMLParser",... | 检验消息的真实性,并且获取解密后的明文.
<ol>
<li>利用收到的密文生成安全签名,进行签名验证</li>
<li>若验证通过,则提取xml中的加密消息</li>
<li>对消息进行解密</li>
</ol>
@param msgSignature 签名串,对应URL参数的msg_signature
@param timeStamp 时间戳,对应URL参数的timestamp
@param nonce 随机串,对应URL参数的nonce
@param postData 密文,对应POST请求的数据
@return 解密后的原文
@throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 | [
"检验消息的真实性,并且获取解密后的明文",
".",
"<ol",
">",
"<li",
">",
"利用收到的密文生成安全签名,进行签名验证<",
"/",
"li",
">",
"<li",
">",
"若验证通过,则提取xml中的加密消息<",
"/",
"li",
">",
"<li",
">",
"对消息进行解密<",
"/",
"li",
">",
"<",
"/",
"ol",
">"
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-wechat/src/main/java/com/firefly/wechat/utils/WXBizMsgCrypt.java#L224-L241 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java | CPOptionPersistenceImpl.findByGroupId | @Override
public List<CPOption> findByGroupId(long groupId, int start, int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CPOption> findByGroupId(long groupId, int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPOption",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp options where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp options
@param end the upper bound of the range of cp options (not inclusive)
@return the range of matching cp options | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"options",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L1517-L1520 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbConnection.java | MariaDbConnection.setSavepoint | public Savepoint setSavepoint(final String name) throws SQLException {
Savepoint savepoint = new MariaDbSavepoint(name, savepointCount++);
try (Statement st = createStatement()) {
st.execute("SAVEPOINT " + savepoint.toString());
}
return savepoint;
} | java | public Savepoint setSavepoint(final String name) throws SQLException {
Savepoint savepoint = new MariaDbSavepoint(name, savepointCount++);
try (Statement st = createStatement()) {
st.execute("SAVEPOINT " + savepoint.toString());
}
return savepoint;
} | [
"public",
"Savepoint",
"setSavepoint",
"(",
"final",
"String",
"name",
")",
"throws",
"SQLException",
"{",
"Savepoint",
"savepoint",
"=",
"new",
"MariaDbSavepoint",
"(",
"name",
",",
"savepointCount",
"++",
")",
";",
"try",
"(",
"Statement",
"st",
"=",
"create... | <p>Creates a savepoint with the given name in the current transaction and returns the new
<code>Savepoint</code>
object that represents it.</p> if setSavepoint is invoked outside of an active transaction, a
transaction will be started at this newly created savepoint.
@param name a <code>String</code> containing the name of the savepoint
@return the new <code>Savepoint</code> object
@throws SQLException if a database access error occurs, this method is
called while participating in a distributed
transaction, this method is called on a closed
connection or this <code>Connection</code> object is
currently in auto-commit mode
@see Savepoint
@since 1.4 | [
"<p",
">",
"Creates",
"a",
"savepoint",
"with",
"the",
"given",
"name",
"in",
"the",
"current",
"transaction",
"and",
"returns",
"the",
"new",
"<code",
">",
"Savepoint<",
"/",
"code",
">",
"object",
"that",
"represents",
"it",
".",
"<",
"/",
"p",
">",
... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L1148-L1155 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/util/ZaurusTableForm.java | ZaurusTableForm.getColIndex | private int getColIndex(String colName, String tabName) {
int ordPos = 0;
try {
if (cConn == null) {
return -1;
}
if (dbmeta == null) {
dbmeta = cConn.getMetaData();
}
ResultSet colList = dbmeta.getColumns(null, null, tabName,
colName);
colList.next();
ordPos = colList.getInt("ORDINAL_POSITION");
colList.close();
} catch (SQLException e) {
System.out.println("SQL Exception: " + e.getMessage());
}
return ordPos - 1;
} | java | private int getColIndex(String colName, String tabName) {
int ordPos = 0;
try {
if (cConn == null) {
return -1;
}
if (dbmeta == null) {
dbmeta = cConn.getMetaData();
}
ResultSet colList = dbmeta.getColumns(null, null, tabName,
colName);
colList.next();
ordPos = colList.getInt("ORDINAL_POSITION");
colList.close();
} catch (SQLException e) {
System.out.println("SQL Exception: " + e.getMessage());
}
return ordPos - 1;
} | [
"private",
"int",
"getColIndex",
"(",
"String",
"colName",
",",
"String",
"tabName",
")",
"{",
"int",
"ordPos",
"=",
"0",
";",
"try",
"{",
"if",
"(",
"cConn",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"dbmeta",
"==",
"null",
... | answer the index of the column named colName in the table tabName | [
"answer",
"the",
"index",
"of",
"the",
"column",
"named",
"colName",
"in",
"the",
"table",
"tabName"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/util/ZaurusTableForm.java#L876-L902 |
BioPAX/Paxtools | paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java | QueryExecuter.runNeighborhood | public static Set<BioPAXElement> runNeighborhood(
Set<BioPAXElement> sourceSet,
Model model,
int limit,
Direction direction,
Filter... filters)
{
Graph graph;
if (model.getLevel() == BioPAXLevel.L3)
{
if (direction == Direction.UNDIRECTED)
{
graph = new GraphL3Undirected(model, filters);
direction = Direction.BOTHSTREAM;
}
else
{
graph = new GraphL3(model, filters);
}
}
else return Collections.emptySet();
Set<Node> source = prepareSingleNodeSet(sourceSet, graph);
if (sourceSet.isEmpty()) return Collections.emptySet();
NeighborhoodQuery query = new NeighborhoodQuery(source, direction, limit);
Set<GraphObject> resultWrappers = query.run();
return convertQueryResult(resultWrappers, graph, true);
} | java | public static Set<BioPAXElement> runNeighborhood(
Set<BioPAXElement> sourceSet,
Model model,
int limit,
Direction direction,
Filter... filters)
{
Graph graph;
if (model.getLevel() == BioPAXLevel.L3)
{
if (direction == Direction.UNDIRECTED)
{
graph = new GraphL3Undirected(model, filters);
direction = Direction.BOTHSTREAM;
}
else
{
graph = new GraphL3(model, filters);
}
}
else return Collections.emptySet();
Set<Node> source = prepareSingleNodeSet(sourceSet, graph);
if (sourceSet.isEmpty()) return Collections.emptySet();
NeighborhoodQuery query = new NeighborhoodQuery(source, direction, limit);
Set<GraphObject> resultWrappers = query.run();
return convertQueryResult(resultWrappers, graph, true);
} | [
"public",
"static",
"Set",
"<",
"BioPAXElement",
">",
"runNeighborhood",
"(",
"Set",
"<",
"BioPAXElement",
">",
"sourceSet",
",",
"Model",
"model",
",",
"int",
"limit",
",",
"Direction",
"direction",
",",
"Filter",
"...",
"filters",
")",
"{",
"Graph",
"graph... | Gets neighborhood of the source set.
@param sourceSet seed to the query
@param model BioPAX model
@param limit neigborhood distance to get
@param direction UPSTREAM, DOWNSTREAM or BOTHSTREAM
@param filters for filtering graph elements
@return BioPAX elements in the result set | [
"Gets",
"neighborhood",
"of",
"the",
"source",
"set",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L35-L65 |
DiUS/pact-jvm | pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java | LambdaDslJsonArray.eachLike | public LambdaDslJsonArray eachLike(int numberExamples, Consumer<LambdaDslJsonBody> nestedObject) {
final PactDslJsonBody arrayLike = pactArray.eachLike(numberExamples);
final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike);
nestedObject.accept(dslBody);
arrayLike.closeArray();
return this;
} | java | public LambdaDslJsonArray eachLike(int numberExamples, Consumer<LambdaDslJsonBody> nestedObject) {
final PactDslJsonBody arrayLike = pactArray.eachLike(numberExamples);
final LambdaDslJsonBody dslBody = new LambdaDslJsonBody(arrayLike);
nestedObject.accept(dslBody);
arrayLike.closeArray();
return this;
} | [
"public",
"LambdaDslJsonArray",
"eachLike",
"(",
"int",
"numberExamples",
",",
"Consumer",
"<",
"LambdaDslJsonBody",
">",
"nestedObject",
")",
"{",
"final",
"PactDslJsonBody",
"arrayLike",
"=",
"pactArray",
".",
"eachLike",
"(",
"numberExamples",
")",
";",
"final",
... | Element that is an array where each item must match the following example
@param numberExamples Number of examples to generate | [
"Element",
"that",
"is",
"an",
"array",
"where",
"each",
"item",
"must",
"match",
"the",
"following",
"example"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslJsonArray.java#L300-L306 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/result/KMLOutputHandler.java | KMLOutputHandler.getColorForValue | public static final Color getColorForValue(double val) {
// Color positions
double[] pos = new double[] { 0.0, 0.6, 0.8, 1.0 };
// Colors at these positions
Color[] cols = new Color[] { new Color(0.0f, 0.0f, 0.0f, 0.6f), new Color(0.0f, 0.0f, 1.0f, 0.8f), new Color(1.0f, 0.0f, 0.0f, 0.9f), new Color(1.0f, 1.0f, 0.0f, 1.0f) };
assert (pos.length == cols.length);
if(val < pos[0]) {
val = pos[0];
}
// Linear interpolation:
for(int i = 1; i < pos.length; i++) {
if(val <= pos[i]) {
Color prev = cols[i - 1];
Color next = cols[i];
final double mix = (val - pos[i - 1]) / (pos[i] - pos[i - 1]);
final int r = (int) ((1 - mix) * prev.getRed() + mix * next.getRed());
final int g = (int) ((1 - mix) * prev.getGreen() + mix * next.getGreen());
final int b = (int) ((1 - mix) * prev.getBlue() + mix * next.getBlue());
final int a = (int) ((1 - mix) * prev.getAlpha() + mix * next.getAlpha());
Color col = new Color(r, g, b, a);
return col;
}
}
return cols[cols.length - 1];
} | java | public static final Color getColorForValue(double val) {
// Color positions
double[] pos = new double[] { 0.0, 0.6, 0.8, 1.0 };
// Colors at these positions
Color[] cols = new Color[] { new Color(0.0f, 0.0f, 0.0f, 0.6f), new Color(0.0f, 0.0f, 1.0f, 0.8f), new Color(1.0f, 0.0f, 0.0f, 0.9f), new Color(1.0f, 1.0f, 0.0f, 1.0f) };
assert (pos.length == cols.length);
if(val < pos[0]) {
val = pos[0];
}
// Linear interpolation:
for(int i = 1; i < pos.length; i++) {
if(val <= pos[i]) {
Color prev = cols[i - 1];
Color next = cols[i];
final double mix = (val - pos[i - 1]) / (pos[i] - pos[i - 1]);
final int r = (int) ((1 - mix) * prev.getRed() + mix * next.getRed());
final int g = (int) ((1 - mix) * prev.getGreen() + mix * next.getGreen());
final int b = (int) ((1 - mix) * prev.getBlue() + mix * next.getBlue());
final int a = (int) ((1 - mix) * prev.getAlpha() + mix * next.getAlpha());
Color col = new Color(r, g, b, a);
return col;
}
}
return cols[cols.length - 1];
} | [
"public",
"static",
"final",
"Color",
"getColorForValue",
"(",
"double",
"val",
")",
"{",
"// Color positions",
"double",
"[",
"]",
"pos",
"=",
"new",
"double",
"[",
"]",
"{",
"0.0",
",",
"0.6",
",",
"0.8",
",",
"1.0",
"}",
";",
"// Colors at these positio... | Get color from a simple heatmap.
@param val Score value
@return Color in heatmap | [
"Get",
"color",
"from",
"a",
"simple",
"heatmap",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/result/KMLOutputHandler.java#L602-L626 |
Azure/azure-sdk-for-java | locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java | ManagementLocksInner.createOrUpdateAtResourceLevelAsync | public Observable<ManagementLockObjectInner> createOrUpdateAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObjectInner parameters) {
return createOrUpdateAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() {
@Override
public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) {
return response.body();
}
});
} | java | public Observable<ManagementLockObjectInner> createOrUpdateAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObjectInner parameters) {
return createOrUpdateAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() {
@Override
public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagementLockObjectInner",
">",
"createOrUpdateAtResourceLevelAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceProviderNamespace",
",",
"String",
"parentResourcePath",
",",
"String",
"resourceType",
",",
"String",
"resourceNam... | Creates or updates a management lock at the resource level or any level below the resource.
When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
@param resourceGroupName The name of the resource group containing the resource to lock.
@param resourceProviderNamespace The resource provider namespace of the resource to lock.
@param parentResourcePath The parent resource identity.
@param resourceType The resource type of the resource to lock.
@param resourceName The name of the resource to lock.
@param lockName The name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, ?, /, or any control characters.
@param parameters Parameters for creating or updating a management lock.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagementLockObjectInner object | [
"Creates",
"or",
"updates",
"a",
"management",
"lock",
"at",
"the",
"resource",
"level",
"or",
"any",
"level",
"below",
"the",
"resource",
".",
"When",
"you",
"apply",
"a",
"lock",
"at",
"a",
"parent",
"scope",
"all",
"child",
"resources",
"inherit",
"the"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L726-L733 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java | EventCountCircuitBreaker.nextCheckIntervalData | private CheckIntervalData nextCheckIntervalData(final int increment,
final CheckIntervalData currentData, final State currentState, final long time) {
CheckIntervalData nextData;
if (stateStrategy(currentState).isCheckIntervalFinished(this, currentData, time)) {
nextData = new CheckIntervalData(increment, time);
} else {
nextData = currentData.increment(increment);
}
return nextData;
} | java | private CheckIntervalData nextCheckIntervalData(final int increment,
final CheckIntervalData currentData, final State currentState, final long time) {
CheckIntervalData nextData;
if (stateStrategy(currentState).isCheckIntervalFinished(this, currentData, time)) {
nextData = new CheckIntervalData(increment, time);
} else {
nextData = currentData.increment(increment);
}
return nextData;
} | [
"private",
"CheckIntervalData",
"nextCheckIntervalData",
"(",
"final",
"int",
"increment",
",",
"final",
"CheckIntervalData",
"currentData",
",",
"final",
"State",
"currentState",
",",
"final",
"long",
"time",
")",
"{",
"CheckIntervalData",
"nextData",
";",
"if",
"(... | Calculates the next {@code CheckIntervalData} object based on the current data and
the current state. The next data object takes the counter increment and the current
time into account.
@param increment the increment for the internal counter
@param currentData the current check data object
@param currentState the current state of the circuit breaker
@param time the current time
@return the updated {@code CheckIntervalData} object | [
"Calculates",
"the",
"next",
"{",
"@code",
"CheckIntervalData",
"}",
"object",
"based",
"on",
"the",
"current",
"data",
"and",
"the",
"current",
"state",
".",
"The",
"next",
"data",
"object",
"takes",
"the",
"counter",
"increment",
"and",
"the",
"current",
"... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java#L382-L391 |
fuinorg/objects4j | src/main/java/org/fuin/objects4j/ui/AnnotationAnalyzer.java | AnnotationAnalyzer.createClassInfo | public final ClassTextInfo createClassInfo(@NotNull final Class<?> clasz, @NotNull final Locale locale,
@NotNull final Class<? extends Annotation> annotationClasz) {
Contract.requireArgNotNull("clasz", clasz);
Contract.requireArgNotNull("locale", locale);
Contract.requireArgNotNull("annotationClasz", annotationClasz);
final Annotation annotation = clasz.getAnnotation(annotationClasz);
if (annotation == null) {
return null;
}
try {
final ResourceBundle bundle = getResourceBundle(annotation, locale, clasz);
final String text = getText(bundle, annotation, clasz.getSimpleName() + "." + annotationClasz.getSimpleName());
return new ClassTextInfo(clasz, text);
} catch (final MissingResourceException ex) {
if (getValue(annotation).equals("")) {
return new ClassTextInfo(clasz, null);
}
return new ClassTextInfo(clasz, getValue(annotation));
}
} | java | public final ClassTextInfo createClassInfo(@NotNull final Class<?> clasz, @NotNull final Locale locale,
@NotNull final Class<? extends Annotation> annotationClasz) {
Contract.requireArgNotNull("clasz", clasz);
Contract.requireArgNotNull("locale", locale);
Contract.requireArgNotNull("annotationClasz", annotationClasz);
final Annotation annotation = clasz.getAnnotation(annotationClasz);
if (annotation == null) {
return null;
}
try {
final ResourceBundle bundle = getResourceBundle(annotation, locale, clasz);
final String text = getText(bundle, annotation, clasz.getSimpleName() + "." + annotationClasz.getSimpleName());
return new ClassTextInfo(clasz, text);
} catch (final MissingResourceException ex) {
if (getValue(annotation).equals("")) {
return new ClassTextInfo(clasz, null);
}
return new ClassTextInfo(clasz, getValue(annotation));
}
} | [
"public",
"final",
"ClassTextInfo",
"createClassInfo",
"(",
"@",
"NotNull",
"final",
"Class",
"<",
"?",
">",
"clasz",
",",
"@",
"NotNull",
"final",
"Locale",
"locale",
",",
"@",
"NotNull",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation... | Returns the text information for a given class.
@param clasz
Class.
@param locale
Locale to use.
@param annotationClasz
Type of annotation to find.
@return Label information - Never <code>null</code>. | [
"Returns",
"the",
"text",
"information",
"for",
"a",
"given",
"class",
"."
] | train | https://github.com/fuinorg/objects4j/blob/e7f278b5bae073ebb6a76053650571c718f36246/src/main/java/org/fuin/objects4j/ui/AnnotationAnalyzer.java#L69-L92 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/WarpImageTransform.java | WarpImageTransform.doTransform | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
Mat mat = converter.convert(image.getFrame());
Point2f src = new Point2f(4);
Point2f dst = new Point2f(4);
src.put(0, 0, mat.cols(), 0, mat.cols(), mat.rows(), 0, mat.rows());
for (int i = 0; i < 8; i++) {
dst.put(i, src.get(i) + deltas[i] * (random != null ? 2 * random.nextFloat() - 1 : 1));
}
Mat result = new Mat();
M = getPerspectiveTransform(src, dst);
warpPerspective(mat, result, M, mat.size(), interMode, borderMode, borderValue);
return new ImageWritable(converter.convert(result));
} | java | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
Mat mat = converter.convert(image.getFrame());
Point2f src = new Point2f(4);
Point2f dst = new Point2f(4);
src.put(0, 0, mat.cols(), 0, mat.cols(), mat.rows(), 0, mat.rows());
for (int i = 0; i < 8; i++) {
dst.put(i, src.get(i) + deltas[i] * (random != null ? 2 * random.nextFloat() - 1 : 1));
}
Mat result = new Mat();
M = getPerspectiveTransform(src, dst);
warpPerspective(mat, result, M, mat.size(), interMode, borderMode, borderValue);
return new ImageWritable(converter.convert(result));
} | [
"@",
"Override",
"protected",
"ImageWritable",
"doTransform",
"(",
"ImageWritable",
"image",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Mat",
"mat",
"=",
"converter",
".",
"convert",
"(",
"... | Takes an image and returns a transformed image.
Uses the random object in the case of random transformations.
@param image to transform, null == end of stream
@param random object to use (or null for deterministic)
@return transformed image | [
"Takes",
"an",
"image",
"and",
"returns",
"a",
"transformed",
"image",
".",
"Uses",
"the",
"random",
"object",
"in",
"the",
"case",
"of",
"random",
"transformations",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/WarpImageTransform.java#L119-L137 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/ConfigObjectRecord.java | ConfigObjectRecord.parseString | public static ConfigObjectRecord parseString( final String input )
{
final ConfigObjectRecord cor = new ConfigObjectRecord();
try
{
cor.parseObjectRecord( input );
}
catch ( Exception e )
{
throw new IllegalArgumentException( "Data value is mailformed, invalid ConfigObjectRecord '" + input + "'" );
}
return cor;
} | java | public static ConfigObjectRecord parseString( final String input )
{
final ConfigObjectRecord cor = new ConfigObjectRecord();
try
{
cor.parseObjectRecord( input );
}
catch ( Exception e )
{
throw new IllegalArgumentException( "Data value is mailformed, invalid ConfigObjectRecord '" + input + "'" );
}
return cor;
} | [
"public",
"static",
"ConfigObjectRecord",
"parseString",
"(",
"final",
"String",
"input",
")",
"{",
"final",
"ConfigObjectRecord",
"cor",
"=",
"new",
"ConfigObjectRecord",
"(",
")",
";",
"try",
"{",
"cor",
".",
"parseObjectRecord",
"(",
"input",
")",
";",
"}",... | Read a string value and convert to a {@code ConfigObjectRecord}.
@param input a complete config object record string including type, guids and payload.
@return A COR parsed from the <i>inputString</i> | [
"Read",
"a",
"string",
"value",
"and",
"convert",
"to",
"a",
"{",
"@code",
"ConfigObjectRecord",
"}",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/ConfigObjectRecord.java#L206-L218 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java | LongExtensions.operator_greaterThan | @Pure
@Inline(value="($1 > $2)", constantExpression=true)
public static boolean operator_greaterThan(long a, double b) {
return a > b;
} | java | @Pure
@Inline(value="($1 > $2)", constantExpression=true)
public static boolean operator_greaterThan(long a, double b) {
return a > b;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 > $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"boolean",
"operator_greaterThan",
"(",
"long",
"a",
",",
"double",
"b",
")",
"{",
"return",
"a",
">",
"b",
";",
"}"
] | The binary <code>greaterThan</code> operator. This is the equivalent to the Java <code>></code> operator.
@param a a long.
@param b a double.
@return <code>a>b</code>
@since 2.3 | [
"The",
"binary",
"<code",
">",
"greaterThan<",
"/",
"code",
">",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"Java",
"<code",
">",
">",
";",
"<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java#L348-L352 |
Scout24/appmon4j | spring/src/main/java/de/is24/util/monitoring/spring/MonitoringHandlerInterceptor.java | MonitoringHandlerInterceptor.afterCompletion | @Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {
long currentTime = System.currentTimeMillis();
String measurementPrefix = getPrefix(handler);
Object startTimeAttribute = getAndRemoveAttribute(request, START_TIME);
Object postHandleObject = getAndRemoveAttribute(request, POST_HANDLE_TIME);
if (startTimeAttribute == null) {
LOG.info("Could not find start_time. Something went wrong with handler: " + measurementPrefix);
monitor.incrementCounter(measurementPrefix + TIME_ERROR);
return;
}
long startTime = (Long) startTimeAttribute;
if (ex != null) {
monitor.addTimerMeasurement(measurementPrefix + ERROR, startTime, currentTime);
} else {
if (postHandleObject != null) {
long postHandleTime = (Long) postHandleObject;
monitor.addTimerMeasurement(measurementPrefix + RENDERING, postHandleTime, currentTime);
monitor.addTimerMeasurement(measurementPrefix + COMPLETE, startTime, currentTime);
}
}
} | java | @Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {
long currentTime = System.currentTimeMillis();
String measurementPrefix = getPrefix(handler);
Object startTimeAttribute = getAndRemoveAttribute(request, START_TIME);
Object postHandleObject = getAndRemoveAttribute(request, POST_HANDLE_TIME);
if (startTimeAttribute == null) {
LOG.info("Could not find start_time. Something went wrong with handler: " + measurementPrefix);
monitor.incrementCounter(measurementPrefix + TIME_ERROR);
return;
}
long startTime = (Long) startTimeAttribute;
if (ex != null) {
monitor.addTimerMeasurement(measurementPrefix + ERROR, startTime, currentTime);
} else {
if (postHandleObject != null) {
long postHandleTime = (Long) postHandleObject;
monitor.addTimerMeasurement(measurementPrefix + RENDERING, postHandleTime, currentTime);
monitor.addTimerMeasurement(measurementPrefix + COMPLETE, startTime, currentTime);
}
}
} | [
"@",
"Override",
"public",
"void",
"afterCompletion",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"Object",
"handler",
",",
"Exception",
"ex",
")",
"throws",
"Exception",
"{",
"long",
"currentTime",
"=",
"System",
".",
"curre... | check, whether {@link #POST_HANDLE_TIME} is set, and {@link de.is24.util.monitoring.InApplicationMonitor#addTimerMeasurement(String, long, long) add timer measuremets} for post phase and complete request. | [
"check",
"whether",
"{"
] | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/spring/src/main/java/de/is24/util/monitoring/spring/MonitoringHandlerInterceptor.java#L56-L82 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_lines_number_diagnostic_run_POST | public OvhDiagnostic serviceName_lines_number_diagnostic_run_POST(String serviceName, String number, OvhCustomerActionsEnum[] actionsDone, OvhAnswers answers, OvhFaultTypeEnum faultType) throws IOException {
String qPath = "/xdsl/{serviceName}/lines/{number}/diagnostic/run";
StringBuilder sb = path(qPath, serviceName, number);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "actionsDone", actionsDone);
addBody(o, "answers", answers);
addBody(o, "faultType", faultType);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhDiagnostic.class);
} | java | public OvhDiagnostic serviceName_lines_number_diagnostic_run_POST(String serviceName, String number, OvhCustomerActionsEnum[] actionsDone, OvhAnswers answers, OvhFaultTypeEnum faultType) throws IOException {
String qPath = "/xdsl/{serviceName}/lines/{number}/diagnostic/run";
StringBuilder sb = path(qPath, serviceName, number);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "actionsDone", actionsDone);
addBody(o, "answers", answers);
addBody(o, "faultType", faultType);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhDiagnostic.class);
} | [
"public",
"OvhDiagnostic",
"serviceName_lines_number_diagnostic_run_POST",
"(",
"String",
"serviceName",
",",
"String",
"number",
",",
"OvhCustomerActionsEnum",
"[",
"]",
"actionsDone",
",",
"OvhAnswers",
"answers",
",",
"OvhFaultTypeEnum",
"faultType",
")",
"throws",
"IO... | Update and get advanced diagnostic of the line
REST: POST /xdsl/{serviceName}/lines/{number}/diagnostic/run
@param actionsDone [required] Customer possible actions
@param answers [required] Customer answers for line diagnostic
@param faultType [required] [default=noSync] Line diagnostic type. Depends of problem
@param serviceName [required] The internal name of your XDSL offer
@param number [required] The number of the line | [
"Update",
"and",
"get",
"advanced",
"diagnostic",
"of",
"the",
"line"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L412-L421 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/accounts/CmsEditUserAddInfoDialog.java | CmsEditUserAddInfoDialog.setInfo | public void setInfo(SortedMap<String, Object> addInfo) {
m_addInfoEditable = new TreeMap<String, Object>(addInfo);
} | java | public void setInfo(SortedMap<String, Object> addInfo) {
m_addInfoEditable = new TreeMap<String, Object>(addInfo);
} | [
"public",
"void",
"setInfo",
"(",
"SortedMap",
"<",
"String",
",",
"Object",
">",
"addInfo",
")",
"{",
"m_addInfoEditable",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"Object",
">",
"(",
"addInfo",
")",
";",
"}"
] | Sets the modified additional information.<p>
@param addInfo the additional information to set | [
"Sets",
"the",
"modified",
"additional",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/accounts/CmsEditUserAddInfoDialog.java#L257-L260 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/command/CpCommand.java | CpCommand.asyncCopyLocalPath | private void asyncCopyLocalPath(CopyThreadPoolExecutor pool, AlluxioURI srcPath,
AlluxioURI dstPath) throws InterruptedException {
File src = new File(srcPath.getPath());
if (!src.isDirectory()) {
pool.submit(() -> {
try {
copyFromLocalFile(srcPath, dstPath);
pool.succeed(srcPath, dstPath);
} catch (Exception e) {
pool.fail(srcPath, dstPath, e);
}
return null;
});
} else {
try {
mFileSystem.createDirectory(dstPath);
} catch (Exception e) {
pool.fail(srcPath, dstPath, e);
return;
}
File[] fileList = src.listFiles();
if (fileList == null) {
pool.fail(srcPath, dstPath,
new IOException(String.format("Failed to list directory %s.", src)));
return;
}
for (File srcFile : fileList) {
AlluxioURI newURI = new AlluxioURI(dstPath, new AlluxioURI(srcFile.getName()));
asyncCopyLocalPath(pool,
new AlluxioURI(srcPath.getScheme(), srcPath.getAuthority(), srcFile.getPath()),
newURI);
}
}
} | java | private void asyncCopyLocalPath(CopyThreadPoolExecutor pool, AlluxioURI srcPath,
AlluxioURI dstPath) throws InterruptedException {
File src = new File(srcPath.getPath());
if (!src.isDirectory()) {
pool.submit(() -> {
try {
copyFromLocalFile(srcPath, dstPath);
pool.succeed(srcPath, dstPath);
} catch (Exception e) {
pool.fail(srcPath, dstPath, e);
}
return null;
});
} else {
try {
mFileSystem.createDirectory(dstPath);
} catch (Exception e) {
pool.fail(srcPath, dstPath, e);
return;
}
File[] fileList = src.listFiles();
if (fileList == null) {
pool.fail(srcPath, dstPath,
new IOException(String.format("Failed to list directory %s.", src)));
return;
}
for (File srcFile : fileList) {
AlluxioURI newURI = new AlluxioURI(dstPath, new AlluxioURI(srcFile.getName()));
asyncCopyLocalPath(pool,
new AlluxioURI(srcPath.getScheme(), srcPath.getAuthority(), srcFile.getPath()),
newURI);
}
}
} | [
"private",
"void",
"asyncCopyLocalPath",
"(",
"CopyThreadPoolExecutor",
"pool",
",",
"AlluxioURI",
"srcPath",
",",
"AlluxioURI",
"dstPath",
")",
"throws",
"InterruptedException",
"{",
"File",
"src",
"=",
"new",
"File",
"(",
"srcPath",
".",
"getPath",
"(",
")",
"... | Asynchronously copies a file or directory specified by srcPath from the local filesystem to
dstPath in the Alluxio filesystem space, assuming dstPath does not exist.
@param srcPath the {@link AlluxioURI} of the source file in the local filesystem
@param dstPath the {@link AlluxioURI} of the destination
@throws InterruptedException when failed to send messages to the pool | [
"Asynchronously",
"copies",
"a",
"file",
"or",
"directory",
"specified",
"by",
"srcPath",
"from",
"the",
"local",
"filesystem",
"to",
"dstPath",
"in",
"the",
"Alluxio",
"filesystem",
"space",
"assuming",
"dstPath",
"does",
"not",
"exist",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/CpCommand.java#L632-L665 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/json/JsonPathUtils.java | JsonPathUtils.evaluateAsString | public static String evaluateAsString(ReadContext readerContext, String jsonPathExpression) {
Object jsonPathResult = evaluate(readerContext, jsonPathExpression);
if (jsonPathResult instanceof JSONArray) {
return ((JSONArray) jsonPathResult).toJSONString();
} else if (jsonPathResult instanceof JSONObject) {
return ((JSONObject) jsonPathResult).toJSONString();
} else {
return Optional.ofNullable(jsonPathResult).map(Object::toString).orElse("null");
}
} | java | public static String evaluateAsString(ReadContext readerContext, String jsonPathExpression) {
Object jsonPathResult = evaluate(readerContext, jsonPathExpression);
if (jsonPathResult instanceof JSONArray) {
return ((JSONArray) jsonPathResult).toJSONString();
} else if (jsonPathResult instanceof JSONObject) {
return ((JSONObject) jsonPathResult).toJSONString();
} else {
return Optional.ofNullable(jsonPathResult).map(Object::toString).orElse("null");
}
} | [
"public",
"static",
"String",
"evaluateAsString",
"(",
"ReadContext",
"readerContext",
",",
"String",
"jsonPathExpression",
")",
"{",
"Object",
"jsonPathResult",
"=",
"evaluate",
"(",
"readerContext",
",",
"jsonPathExpression",
")",
";",
"if",
"(",
"jsonPathResult",
... | Evaluate JsonPath expression using given read context and return result as string.
@param readerContext
@param jsonPathExpression
@return | [
"Evaluate",
"JsonPath",
"expression",
"using",
"given",
"read",
"context",
"and",
"return",
"result",
"as",
"string",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/json/JsonPathUtils.java#L122-L132 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizeText | public void recognizeText(String url, TextRecognitionMode mode) {
recognizeTextWithServiceResponseAsync(url, mode).toBlocking().single().body();
} | java | public void recognizeText(String url, TextRecognitionMode mode) {
recognizeTextWithServiceResponseAsync(url, mode).toBlocking().single().body();
} | [
"public",
"void",
"recognizeText",
"(",
"String",
"url",
",",
"TextRecognitionMode",
"mode",
")",
"{",
"recognizeTextWithServiceResponseAsync",
"(",
"url",
",",
"mode",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
... | Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation.
@param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed'
@param url Publicly reachable URL of an image
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ComputerVisionErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Recognize",
"Text",
"operation",
".",
"When",
"you",
"use",
"the",
"Recognize",
"Text",
"interface",
"the",
"response",
"contains",
"a",
"field",
"called",
"Operation",
"-",
"Location",
".",
"The",
"Operation",
"-",
"Location",
"field",
"contains",
"the",
"UR... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1326-L1328 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateCertificateIssuerAsync | public Observable<IssuerBundle> updateCertificateIssuerAsync(String vaultBaseUrl, String issuerName) {
return updateCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).map(new Func1<ServiceResponse<IssuerBundle>, IssuerBundle>() {
@Override
public IssuerBundle call(ServiceResponse<IssuerBundle> response) {
return response.body();
}
});
} | java | public Observable<IssuerBundle> updateCertificateIssuerAsync(String vaultBaseUrl, String issuerName) {
return updateCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).map(new Func1<ServiceResponse<IssuerBundle>, IssuerBundle>() {
@Override
public IssuerBundle call(ServiceResponse<IssuerBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IssuerBundle",
">",
"updateCertificateIssuerAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
")",
"{",
"return",
"updateCertificateIssuerWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"issuerName",
")",
".",
"map",
... | Updates the specified certificate issuer.
The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IssuerBundle object | [
"Updates",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"UpdateCertificateIssuer",
"operation",
"performs",
"an",
"update",
"on",
"the",
"specified",
"certificate",
"issuer",
"entity",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"se... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6137-L6144 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java | ContainerGroupsInner.beginCreateOrUpdate | public ContainerGroupInner beginCreateOrUpdate(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).toBlocking().single().body();
} | java | public ContainerGroupInner beginCreateOrUpdate(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).toBlocking().single().body();
} | [
"public",
"ContainerGroupInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"ContainerGroupInner",
"containerGroup",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"cont... | Create or update container groups.
Create or update container groups with specified configurations.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerGroup The properties of the container group to be created or updated.
@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 ContainerGroupInner object if successful. | [
"Create",
"or",
"update",
"container",
"groups",
".",
"Create",
"or",
"update",
"container",
"groups",
"with",
"specified",
"configurations",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L522-L524 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/CreateAuthorizerRequest.java | CreateAuthorizerRequest.withTokenSigningPublicKeys | public CreateAuthorizerRequest withTokenSigningPublicKeys(java.util.Map<String, String> tokenSigningPublicKeys) {
setTokenSigningPublicKeys(tokenSigningPublicKeys);
return this;
} | java | public CreateAuthorizerRequest withTokenSigningPublicKeys(java.util.Map<String, String> tokenSigningPublicKeys) {
setTokenSigningPublicKeys(tokenSigningPublicKeys);
return this;
} | [
"public",
"CreateAuthorizerRequest",
"withTokenSigningPublicKeys",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tokenSigningPublicKeys",
")",
"{",
"setTokenSigningPublicKeys",
"(",
"tokenSigningPublicKeys",
")",
";",
"return",
"this",
";",... | <p>
The public keys used to verify the digital signature returned by your custom authentication service.
</p>
@param tokenSigningPublicKeys
The public keys used to verify the digital signature returned by your custom authentication service.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"public",
"keys",
"used",
"to",
"verify",
"the",
"digital",
"signature",
"returned",
"by",
"your",
"custom",
"authentication",
"service",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/CreateAuthorizerRequest.java#L209-L212 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/btree/NodeBuilder.java | NodeBuilder.toNode | Object[] toNode()
{
assert buildKeyPosition <= FAN_FACTOR && (buildKeyPosition > 0 || copyFrom.length > 0) : buildKeyPosition;
return buildFromRange(0, buildKeyPosition, isLeaf(copyFrom), false);
} | java | Object[] toNode()
{
assert buildKeyPosition <= FAN_FACTOR && (buildKeyPosition > 0 || copyFrom.length > 0) : buildKeyPosition;
return buildFromRange(0, buildKeyPosition, isLeaf(copyFrom), false);
} | [
"Object",
"[",
"]",
"toNode",
"(",
")",
"{",
"assert",
"buildKeyPosition",
"<=",
"FAN_FACTOR",
"&&",
"(",
"buildKeyPosition",
">",
"0",
"||",
"copyFrom",
".",
"length",
">",
"0",
")",
":",
"buildKeyPosition",
";",
"return",
"buildFromRange",
"(",
"0",
",",... | builds a new root BTree node - must be called on root of operation | [
"builds",
"a",
"new",
"root",
"BTree",
"node",
"-",
"must",
"be",
"called",
"on",
"root",
"of",
"operation"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/btree/NodeBuilder.java#L265-L269 |
fernandospr/javapns-jdk16 | src/main/java/javapns/notification/PushNotificationPayload.java | PushNotificationPayload.combined | public static PushNotificationPayload combined(String message, int badge, String sound) {
if (message == null && badge < 0 && sound == null) throw new IllegalArgumentException("Must provide at least one non-null argument");
PushNotificationPayload payload = complex();
try {
if (message != null) payload.addAlert(message);
if (badge >= 0) payload.addBadge(badge);
if (sound != null) payload.addSound(sound);
} catch (JSONException e) {
}
return payload;
} | java | public static PushNotificationPayload combined(String message, int badge, String sound) {
if (message == null && badge < 0 && sound == null) throw new IllegalArgumentException("Must provide at least one non-null argument");
PushNotificationPayload payload = complex();
try {
if (message != null) payload.addAlert(message);
if (badge >= 0) payload.addBadge(badge);
if (sound != null) payload.addSound(sound);
} catch (JSONException e) {
}
return payload;
} | [
"public",
"static",
"PushNotificationPayload",
"combined",
"(",
"String",
"message",
",",
"int",
"badge",
",",
"String",
"sound",
")",
"{",
"if",
"(",
"message",
"==",
"null",
"&&",
"badge",
"<",
"0",
"&&",
"sound",
"==",
"null",
")",
"throw",
"new",
"Il... | Create a pre-defined payload with a simple alert message, a badge and a sound.
@param message the alert message
@param badge the badge
@param sound the name of the sound
@return a ready-to-send payload | [
"Create",
"a",
"pre",
"-",
"defined",
"payload",
"with",
"a",
"simple",
"alert",
"message",
"a",
"badge",
"and",
"a",
"sound",
"."
] | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/notification/PushNotificationPayload.java#L80-L90 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java | WindowedStream.process | @PublicEvolving
public <R> SingleOutputStreamOperator<R> process(ProcessWindowFunction<T, R, K, W> function) {
TypeInformation<R> resultType = getProcessWindowFunctionReturnType(function, getInputType(), null);
return process(function, resultType);
} | java | @PublicEvolving
public <R> SingleOutputStreamOperator<R> process(ProcessWindowFunction<T, R, K, W> function) {
TypeInformation<R> resultType = getProcessWindowFunctionReturnType(function, getInputType(), null);
return process(function, resultType);
} | [
"@",
"PublicEvolving",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"process",
"(",
"ProcessWindowFunction",
"<",
"T",
",",
"R",
",",
"K",
",",
"W",
">",
"function",
")",
"{",
"TypeInformation",
"<",
"R",
">",
"resultType",
"=",
... | Applies the given window function to each window. The window function is called for each
evaluation of the window for each key individually. The output of the window function is
interpreted as a regular non-windowed stream.
<p>Note that this function requires that all data in the windows is buffered until the window
is evaluated, as the function provides no means of incremental aggregation.
@param function The window function.
@return The data stream that is the result of applying the window function to the window. | [
"Applies",
"the",
"given",
"window",
"function",
"to",
"each",
"window",
".",
"The",
"window",
"function",
"is",
"called",
"for",
"each",
"evaluation",
"of",
"the",
"window",
"for",
"each",
"key",
"individually",
".",
"The",
"output",
"of",
"the",
"window",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L1052-L1057 |
spring-projects/spring-session-data-mongodb | src/main/java/org/springframework/session/data/mongo/ReactiveMongoOperationsSessionRepository.java | ReactiveMongoOperationsSessionRepository.deleteById | @Override
public Mono<Void> deleteById(String id) {
return findSession(id)
.flatMap(document -> this.mongoOperations.remove(document, this.collectionName).then(Mono.just(document)))
.map(document -> convertToSession(this.mongoSessionConverter, document))
.doOnSuccess(mongoSession -> publishEvent(new SessionDeletedEvent(this, mongoSession))) //
.then();
} | java | @Override
public Mono<Void> deleteById(String id) {
return findSession(id)
.flatMap(document -> this.mongoOperations.remove(document, this.collectionName).then(Mono.just(document)))
.map(document -> convertToSession(this.mongoSessionConverter, document))
.doOnSuccess(mongoSession -> publishEvent(new SessionDeletedEvent(this, mongoSession))) //
.then();
} | [
"@",
"Override",
"public",
"Mono",
"<",
"Void",
">",
"deleteById",
"(",
"String",
"id",
")",
"{",
"return",
"findSession",
"(",
"id",
")",
".",
"flatMap",
"(",
"document",
"->",
"this",
".",
"mongoOperations",
".",
"remove",
"(",
"document",
",",
"this",... | Deletes the {@link MongoSession} with the given {@link MongoSession#getId()} or does nothing if the
{@link MongoSession} is not found.
@param id the {@link MongoSession#getId()} to delete | [
"Deletes",
"the",
"{",
"@link",
"MongoSession",
"}",
"with",
"the",
"given",
"{",
"@link",
"MongoSession#getId",
"()",
"}",
"or",
"does",
"nothing",
"if",
"the",
"{",
"@link",
"MongoSession",
"}",
"is",
"not",
"found",
"."
] | train | https://github.com/spring-projects/spring-session-data-mongodb/blob/c507bb2d2a9b52ea9846ffaf1ac7c71cb0e6690e/src/main/java/org/springframework/session/data/mongo/ReactiveMongoOperationsSessionRepository.java#L136-L144 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Project.java | Project.createGoal | public Goal createGoal(String name, Map<String, Object> attributes) {
return getInstance().create().goal(name, this, attributes);
} | java | public Goal createGoal(String name, Map<String, Object> attributes) {
return getInstance().create().goal(name, this, attributes);
} | [
"public",
"Goal",
"createGoal",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"return",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"goal",
"(",
"name",
",",
"this",
",",
"attributes",
")",
"... | Create a new Goal in this Project.
@param name The initial name of the Goal.
@param attributes additional attributes for the Goal.
@return A new Goal. | [
"Create",
"a",
"new",
"Goal",
"in",
"this",
"Project",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L272-L274 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/version/Application.java | Application.compileAll | public void compileAll(final String _userName,
final boolean _addRuntimeClassPath)
throws InstallationException
{
if (Application.LOG.isInfoEnabled()) {
Application.LOG.info("..Compiling");
}
reloadCache();
try {
Context.begin(_userName);
try {
new ESJPCompiler(getClassPathElements()).compile(null, _addRuntimeClassPath);
} catch (final InstallationException e) {
Application.LOG.error(" error during compilation of ESJP.", e);
}
try {
AbstractStaticSourceCompiler.compileAll(this.classpathElements);
} catch (final EFapsException e) {
Application.LOG.error(" error during compilation of static sources.");
}
Context.commit();
} catch (final EFapsException e) {
throw new InstallationException("Compile failed", e);
}
} | java | public void compileAll(final String _userName,
final boolean _addRuntimeClassPath)
throws InstallationException
{
if (Application.LOG.isInfoEnabled()) {
Application.LOG.info("..Compiling");
}
reloadCache();
try {
Context.begin(_userName);
try {
new ESJPCompiler(getClassPathElements()).compile(null, _addRuntimeClassPath);
} catch (final InstallationException e) {
Application.LOG.error(" error during compilation of ESJP.", e);
}
try {
AbstractStaticSourceCompiler.compileAll(this.classpathElements);
} catch (final EFapsException e) {
Application.LOG.error(" error during compilation of static sources.");
}
Context.commit();
} catch (final EFapsException e) {
throw new InstallationException("Compile failed", e);
}
} | [
"public",
"void",
"compileAll",
"(",
"final",
"String",
"_userName",
",",
"final",
"boolean",
"_addRuntimeClassPath",
")",
"throws",
"InstallationException",
"{",
"if",
"(",
"Application",
".",
"LOG",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"Application",
".",... | Compiles the ESJP's and all Cascade Styles Sheets within eFaps.
@param _userName name of logged in user for which the compile is done
(could be also <code>null</code>)
@param _addRuntimeClassPath must the classpath from the runtime be added
to the classpath also
@throws InstallationException if reload cache of compile failed | [
"Compiles",
"the",
"ESJP",
"s",
"and",
"all",
"Cascade",
"Styles",
"Sheets",
"within",
"eFaps",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/Application.java#L462-L488 |
Impetus/Kundera | src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/ethereum/KunderaWeb3jClient.java | KunderaWeb3jClient.persistTransactions | private void persistTransactions(Transaction tx, String blockNumber)
{
LOGGER.debug("Going to save transactions for Block - " + getBlockNumberWithRawData(blockNumber) + "!");
try
{
em.persist(tx);
LOGGER.debug("Transaction with hash " + tx.getHash() + " is stored!");
}
catch (Exception ex)
{
LOGGER.error("Transaction with hash " + tx.getHash() + " is not stored. ", ex);
throw new KunderaException("transaction with hash " + tx.getHash() + " is not stored. ", ex);
}
} | java | private void persistTransactions(Transaction tx, String blockNumber)
{
LOGGER.debug("Going to save transactions for Block - " + getBlockNumberWithRawData(blockNumber) + "!");
try
{
em.persist(tx);
LOGGER.debug("Transaction with hash " + tx.getHash() + " is stored!");
}
catch (Exception ex)
{
LOGGER.error("Transaction with hash " + tx.getHash() + " is not stored. ", ex);
throw new KunderaException("transaction with hash " + tx.getHash() + " is not stored. ", ex);
}
} | [
"private",
"void",
"persistTransactions",
"(",
"Transaction",
"tx",
",",
"String",
"blockNumber",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Going to save transactions for Block - \"",
"+",
"getBlockNumberWithRawData",
"(",
"blockNumber",
")",
"+",
"\"!\"",
")",
";",
... | Persist transactions.
@param tx
the transaction
@param blockNumber
the block number | [
"Persist",
"transactions",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/ethereum/KunderaWeb3jClient.java#L141-L156 |
BlueBrain/bluima | modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/cleanup/HyphenRemover.java | HyphenRemover.dehyphenate | public static String dehyphenate(LineNumberReader reader, String docId) {
String line;
StringBuilder sb = new StringBuilder();
try {
while ((line = reader.readLine()) != null) {
String lineOut = line;
Matcher matcher = patternHyphen.matcher(line);
// Allows to append consecutive lines with hyphens
while (matcher.find() && ((line = reader.readLine()) != null)) {
String behind[] = lineOut.split(WORD_SEPARATOR);
String forward[] = line.trim().split(WORD_SEPARATOR);
if (behind.length == 0) {
lineOut = lineOut + "\n" + line;
continue;
}
String w1 = behind[(behind.length) - 1];
String w2 = forward[0];
if (shouldDehyphenate(w1, w2)) {
// Remove hyphen from first line and concatenates second
lineOut = lineOut.substring(0, lineOut.length() - 1)
.trim() + line.trim();
} else {
// just concanates the two lines
lineOut = lineOut + line;
}
matcher = patternHyphen.matcher(lineOut);
}
sb.append(lineOut.trim());
sb.append("\n");
}
} catch (Throwable t) {
//TODO happens sometimes, e.g. docId 1279669
LOG.warn("failed to dehyphenate, docId " + docId, print(t));
}
return sb.toString();
} | java | public static String dehyphenate(LineNumberReader reader, String docId) {
String line;
StringBuilder sb = new StringBuilder();
try {
while ((line = reader.readLine()) != null) {
String lineOut = line;
Matcher matcher = patternHyphen.matcher(line);
// Allows to append consecutive lines with hyphens
while (matcher.find() && ((line = reader.readLine()) != null)) {
String behind[] = lineOut.split(WORD_SEPARATOR);
String forward[] = line.trim().split(WORD_SEPARATOR);
if (behind.length == 0) {
lineOut = lineOut + "\n" + line;
continue;
}
String w1 = behind[(behind.length) - 1];
String w2 = forward[0];
if (shouldDehyphenate(w1, w2)) {
// Remove hyphen from first line and concatenates second
lineOut = lineOut.substring(0, lineOut.length() - 1)
.trim() + line.trim();
} else {
// just concanates the two lines
lineOut = lineOut + line;
}
matcher = patternHyphen.matcher(lineOut);
}
sb.append(lineOut.trim());
sb.append("\n");
}
} catch (Throwable t) {
//TODO happens sometimes, e.g. docId 1279669
LOG.warn("failed to dehyphenate, docId " + docId, print(t));
}
return sb.toString();
} | [
"public",
"static",
"String",
"dehyphenate",
"(",
"LineNumberReader",
"reader",
",",
"String",
"docId",
")",
"{",
"String",
"line",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"while",
"(",
"(",
"line",
"=",
"reader"... | Removes ligatures, multiple spaces and hypens from a text file | [
"Removes",
"ligatures",
"multiple",
"spaces",
"and",
"hypens",
"from",
"a",
"text",
"file"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/cleanup/HyphenRemover.java#L108-L149 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/writer/FileAwareInputStreamDataWriter.java | FileAwareInputStreamDataWriter.setRecursivePermission | private void setRecursivePermission(Path path, OwnerAndPermission ownerAndPermission)
throws IOException {
List<FileStatus> files = FileListUtils.listPathsRecursively(this.fs, path, FileListUtils.NO_OP_PATH_FILTER);
// Set permissions bottom up. Permissions are set to files first and then directories
Collections.reverse(files);
for (FileStatus file : files) {
safeSetPathPermission(file.getPath(), addExecutePermissionsIfRequired(file, ownerAndPermission));
}
} | java | private void setRecursivePermission(Path path, OwnerAndPermission ownerAndPermission)
throws IOException {
List<FileStatus> files = FileListUtils.listPathsRecursively(this.fs, path, FileListUtils.NO_OP_PATH_FILTER);
// Set permissions bottom up. Permissions are set to files first and then directories
Collections.reverse(files);
for (FileStatus file : files) {
safeSetPathPermission(file.getPath(), addExecutePermissionsIfRequired(file, ownerAndPermission));
}
} | [
"private",
"void",
"setRecursivePermission",
"(",
"Path",
"path",
",",
"OwnerAndPermission",
"ownerAndPermission",
")",
"throws",
"IOException",
"{",
"List",
"<",
"FileStatus",
">",
"files",
"=",
"FileListUtils",
".",
"listPathsRecursively",
"(",
"this",
".",
"fs",
... | Sets the {@link FsPermission}, owner, group for the path passed. And recursively to all directories and files under
it. | [
"Sets",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/writer/FileAwareInputStreamDataWriter.java#L359-L369 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/Jinx.java | Jinx.setProxy | public void setProxy(final JinxProxy proxyConfig) {
if (proxyConfig == null) {
System.clearProperty("http.proxyHost");
System.clearProperty("http.proxyPort");
System.clearProperty("https.proxyHost");
System.clearProperty("https.proxyPort");
this.proxy = Proxy.NO_PROXY;
} else if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyHost())) {
System.setProperty("http.proxyHost", proxyConfig.getProxyHost());
System.setProperty("http.proxyPort", Integer.toString(proxyConfig.getProxyPort()));
System.setProperty("https.proxyHost", proxyConfig.getProxyHost());
System.setProperty("https.proxyPort", Integer.toString(proxyConfig.getProxyPort()));
this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyConfig.getProxyHost(), proxyConfig.getProxyPort()));
if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyUser())) {
Authenticator authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(proxyConfig.getProxyUser(), proxyConfig.getProxyPassword()));
}
};
Authenticator.setDefault(authenticator);
}
}
} | java | public void setProxy(final JinxProxy proxyConfig) {
if (proxyConfig == null) {
System.clearProperty("http.proxyHost");
System.clearProperty("http.proxyPort");
System.clearProperty("https.proxyHost");
System.clearProperty("https.proxyPort");
this.proxy = Proxy.NO_PROXY;
} else if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyHost())) {
System.setProperty("http.proxyHost", proxyConfig.getProxyHost());
System.setProperty("http.proxyPort", Integer.toString(proxyConfig.getProxyPort()));
System.setProperty("https.proxyHost", proxyConfig.getProxyHost());
System.setProperty("https.proxyPort", Integer.toString(proxyConfig.getProxyPort()));
this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyConfig.getProxyHost(), proxyConfig.getProxyPort()));
if (!JinxUtils.isNullOrEmpty(proxyConfig.getProxyUser())) {
Authenticator authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(proxyConfig.getProxyUser(), proxyConfig.getProxyPassword()));
}
};
Authenticator.setDefault(authenticator);
}
}
} | [
"public",
"void",
"setProxy",
"(",
"final",
"JinxProxy",
"proxyConfig",
")",
"{",
"if",
"(",
"proxyConfig",
"==",
"null",
")",
"{",
"System",
".",
"clearProperty",
"(",
"\"http.proxyHost\"",
")",
";",
"System",
".",
"clearProperty",
"(",
"\"http.proxyPort\"",
... | Set the proxy configuration for Jinx.
<br>
By default, Jinx will not use a proxy.
<br>
If there is a proxy configuration set, Jinx will use the proxy for all network operations. If the proxy
configuration is null, Jinx will not attempt to use a proxy.
@param proxyConfig network proxy configuration, or null to indicate no proxy. | [
"Set",
"the",
"proxy",
"configuration",
"for",
"Jinx",
".",
"<br",
">",
"By",
"default",
"Jinx",
"will",
"not",
"use",
"a",
"proxy",
".",
"<br",
">",
"If",
"there",
"is",
"a",
"proxy",
"configuration",
"set",
"Jinx",
"will",
"use",
"the",
"proxy",
"for... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/Jinx.java#L203-L225 |
alkacon/opencms-core | src-modules/org/opencms/workplace/help/CmsHelpSearchResultView.java | CmsHelpSearchResultView.toPostParameters | private void toPostParameters(String getRequestUri) {
StringBuffer result;
if (!m_formCache.containsKey(getRequestUri)) {
result = new StringBuffer();
int index = getRequestUri.indexOf('?');
String query = "";
String path = "";
if (index > 0) {
query = getRequestUri.substring(index + 1);
path = getRequestUri.substring(0, index);
result.append("\n<form method=\"post\" name=\"form").append(m_formCache.size()).append("\" action=\"");
result.append(path).append("\">\n");
// "key=value" pairs as tokens:
StringTokenizer entryTokens = new StringTokenizer(query, "&", false);
while (entryTokens.hasMoreTokens()) {
StringTokenizer keyValueToken = new StringTokenizer(entryTokens.nextToken(), "=", false);
if (keyValueToken.countTokens() != 2) {
continue;
}
// Undo the possible already performed url encoding for the given url
String key = CmsEncoder.decode(keyValueToken.nextToken());
String value = CmsEncoder.decode(keyValueToken.nextToken());
result.append(" <input type=\"hidden\" name=\"");
result.append(key).append("\" value=\"");
result.append(value).append("\" />\n");
}
result.append("</form>\n");
m_formCache.put(getRequestUri, result.toString());
}
}
} | java | private void toPostParameters(String getRequestUri) {
StringBuffer result;
if (!m_formCache.containsKey(getRequestUri)) {
result = new StringBuffer();
int index = getRequestUri.indexOf('?');
String query = "";
String path = "";
if (index > 0) {
query = getRequestUri.substring(index + 1);
path = getRequestUri.substring(0, index);
result.append("\n<form method=\"post\" name=\"form").append(m_formCache.size()).append("\" action=\"");
result.append(path).append("\">\n");
// "key=value" pairs as tokens:
StringTokenizer entryTokens = new StringTokenizer(query, "&", false);
while (entryTokens.hasMoreTokens()) {
StringTokenizer keyValueToken = new StringTokenizer(entryTokens.nextToken(), "=", false);
if (keyValueToken.countTokens() != 2) {
continue;
}
// Undo the possible already performed url encoding for the given url
String key = CmsEncoder.decode(keyValueToken.nextToken());
String value = CmsEncoder.decode(keyValueToken.nextToken());
result.append(" <input type=\"hidden\" name=\"");
result.append(key).append("\" value=\"");
result.append(value).append("\" />\n");
}
result.append("</form>\n");
m_formCache.put(getRequestUri, result.toString());
}
}
} | [
"private",
"void",
"toPostParameters",
"(",
"String",
"getRequestUri",
")",
"{",
"StringBuffer",
"result",
";",
"if",
"(",
"!",
"m_formCache",
".",
"containsKey",
"(",
"getRequestUri",
")",
")",
"{",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int"... | Generates a html form (named form<n>) with parameters found in
the given GET request string (appended params with "?value=param&value2=param2).
>n< is the number of forms that already have been generated.
This is a content-expensive bugfix for http://issues.apache.org/bugzilla/show_bug.cgi?id=35775
and should be replaced with the 1.1 revision as soon that bug is fixed.<p>
The forms action will point to the given uri's path info part: All links in the page
that includes this generated html and that are related to the get request should
have "src='#'" and "onclick=documents.forms['<getRequestUri>'].submit()". <p>
The generated form lands in the internal <code>Map {@link #m_formCache}</code> as mapping
from uris to Strings and has to be appended to the output at a valid position. <p>
Warning: Does not work with multiple values mapped to one parameter ("key = value1,value2..").<p>
@param getRequestUri a request uri with optional query, will be used as name of the form too. | [
"Generates",
"a",
"html",
"form",
"(",
"named",
"form<",
";",
"n>",
";",
")",
"with",
"parameters",
"found",
"in",
"the",
"given",
"GET",
"request",
"string",
"(",
"appended",
"params",
"with",
"?value",
"=",
"param&value2",
"=",
"param2",
")",
".",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/help/CmsHelpSearchResultView.java#L386-L419 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/internal/document/PathsDocument.java | PathsDocument.applyPathOperationComponent | private void applyPathOperationComponent(MarkupDocBuilder markupDocBuilder, PathOperation operation) {
if (operation != null) {
pathOperationComponent.apply(markupDocBuilder, PathOperationComponent.parameters(operation));
}
} | java | private void applyPathOperationComponent(MarkupDocBuilder markupDocBuilder, PathOperation operation) {
if (operation != null) {
pathOperationComponent.apply(markupDocBuilder, PathOperationComponent.parameters(operation));
}
} | [
"private",
"void",
"applyPathOperationComponent",
"(",
"MarkupDocBuilder",
"markupDocBuilder",
",",
"PathOperation",
"operation",
")",
"{",
"if",
"(",
"operation",
"!=",
"null",
")",
"{",
"pathOperationComponent",
".",
"apply",
"(",
"markupDocBuilder",
",",
"PathOpera... | Builds a path operation.
@param markupDocBuilder the docbuilder do use for output
@param operation the Swagger Operation | [
"Builds",
"a",
"path",
"operation",
"."
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/document/PathsDocument.java#L233-L237 |
osglworks/java-mvc | src/main/java/org/osgl/mvc/result/Unauthorized.java | Unauthorized.of | public static Unauthorized of(int errorCode, String message) {
touchPayload().errorCode(errorCode).message(message);
return _INSTANCE;
} | java | public static Unauthorized of(int errorCode, String message) {
touchPayload().errorCode(errorCode).message(message);
return _INSTANCE;
} | [
"public",
"static",
"Unauthorized",
"of",
"(",
"int",
"errorCode",
",",
"String",
"message",
")",
"{",
"touchPayload",
"(",
")",
".",
"errorCode",
"(",
"errorCode",
")",
".",
"message",
"(",
"message",
")",
";",
"return",
"_INSTANCE",
";",
"}"
] | Returns a static Unauthorized instance and set the {@link #payload} thread local with
error code and message.
@param errorCode the error code
@param message the error message
@return a static Unauthorized instance as described above | [
"Returns",
"a",
"static",
"Unauthorized",
"instance",
"and",
"set",
"the",
"{",
"@link",
"#payload",
"}",
"thread",
"local",
"with",
"error",
"code",
"and",
"message",
"."
] | train | https://github.com/osglworks/java-mvc/blob/4d2b2ec40498ac6ee7040c0424377cbeacab124b/src/main/java/org/osgl/mvc/result/Unauthorized.java#L200-L203 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java | MetricsRecordImpl.setTag | public void setTag(String tagName, int tagValue) {
tagTable.put(tagName, Integer.valueOf(tagValue));
} | java | public void setTag(String tagName, int tagValue) {
tagTable.put(tagName, Integer.valueOf(tagValue));
} | [
"public",
"void",
"setTag",
"(",
"String",
"tagName",
",",
"int",
"tagValue",
")",
"{",
"tagTable",
".",
"put",
"(",
"tagName",
",",
"Integer",
".",
"valueOf",
"(",
"tagValue",
")",
")",
";",
"}"
] | Sets the named tag to the specified value.
@param tagName name of the tag
@param tagValue new value of the tag
@throws MetricsException if the tagName conflicts with the configuration | [
"Sets",
"the",
"named",
"tag",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java#L79-L81 |
apereo/cas | webapp/cas-server-webapp-config/src/main/java/org/apereo/cas/web/security/CasWebSecurityConfigurerAdapter.java | CasWebSecurityConfigurerAdapter.configureJdbcAuthenticationProvider | protected void configureJdbcAuthenticationProvider(final AuthenticationManagerBuilder auth, final MonitorProperties.Endpoints.JdbcSecurity jdbc) throws Exception {
val cfg = auth.jdbcAuthentication();
cfg.usersByUsernameQuery(jdbc.getQuery());
cfg.rolePrefix(jdbc.getRolePrefix());
cfg.dataSource(JpaBeans.newDataSource(jdbc));
cfg.passwordEncoder(PasswordEncoderUtils.newPasswordEncoder(jdbc.getPasswordEncoder()));
} | java | protected void configureJdbcAuthenticationProvider(final AuthenticationManagerBuilder auth, final MonitorProperties.Endpoints.JdbcSecurity jdbc) throws Exception {
val cfg = auth.jdbcAuthentication();
cfg.usersByUsernameQuery(jdbc.getQuery());
cfg.rolePrefix(jdbc.getRolePrefix());
cfg.dataSource(JpaBeans.newDataSource(jdbc));
cfg.passwordEncoder(PasswordEncoderUtils.newPasswordEncoder(jdbc.getPasswordEncoder()));
} | [
"protected",
"void",
"configureJdbcAuthenticationProvider",
"(",
"final",
"AuthenticationManagerBuilder",
"auth",
",",
"final",
"MonitorProperties",
".",
"Endpoints",
".",
"JdbcSecurity",
"jdbc",
")",
"throws",
"Exception",
"{",
"val",
"cfg",
"=",
"auth",
".",
"jdbcAu... | Configure jdbc authentication provider.
@param auth the auth
@param jdbc the jdbc
@throws Exception the exception | [
"Configure",
"jdbc",
"authentication",
"provider",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/webapp/cas-server-webapp-config/src/main/java/org/apereo/cas/web/security/CasWebSecurityConfigurerAdapter.java#L128-L134 |
lessthanoptimal/BoofCV | demonstrations/src/main/java/boofcv/demonstrations/feature/detect/ImageCorruptPanel.java | ImageCorruptPanel.corruptImage | public <T extends ImageGray<T>> void corruptImage(T original , T corrupted )
{
GGrayImageOps.stretch(original, valueScale, valueOffset, 255.0, corrupted);
GImageMiscOps.addGaussian(corrupted, rand, valueNoise, 0, 255);
GPixelMath.boundImage(corrupted,0,255);
} | java | public <T extends ImageGray<T>> void corruptImage(T original , T corrupted )
{
GGrayImageOps.stretch(original, valueScale, valueOffset, 255.0, corrupted);
GImageMiscOps.addGaussian(corrupted, rand, valueNoise, 0, 255);
GPixelMath.boundImage(corrupted,0,255);
} | [
"public",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"void",
"corruptImage",
"(",
"T",
"original",
",",
"T",
"corrupted",
")",
"{",
"GGrayImageOps",
".",
"stretch",
"(",
"original",
",",
"valueScale",
",",
"valueOffset",
",",
"255.0",
",",
"co... | Applies the specified corruption to the image.
@param original Original uncorrupted image.
@param corrupted Corrupted mage. | [
"Applies",
"the",
"specified",
"corruption",
"to",
"the",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/feature/detect/ImageCorruptPanel.java#L95-L100 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendString | public static File appendString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).append(content);
} | java | public static File appendString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).append(content);
} | [
"public",
"static",
"File",
"appendString",
"(",
"String",
"content",
",",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"file",
",",
"CharsetUtil",
".",
"charset",
"(",
"charset... | 将String写入文件,追加模式
@param content 写入的内容
@param file 文件
@param charset 字符集
@return 写入的文件
@throws IORuntimeException IO异常 | [
"将String写入文件,追加模式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2826-L2828 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ServletStartedListener.java | ServletStartedListener.getConstraintFromHttpElement | private SecurityConstraint getConstraintFromHttpElement(SecurityMetadata securityMetadataFromDD, Collection<String> urlPatterns, ServletSecurityElement servletSecurity) {
List<String> omissionMethods = new ArrayList<String>();
if (!servletSecurity.getMethodNames().isEmpty()) {
omissionMethods.addAll(servletSecurity.getMethodNames()); //list of methods named by @HttpMethodConstraint
}
WebResourceCollection webResourceCollection = new WebResourceCollection((List<String>) urlPatterns, new ArrayList<String>(), omissionMethods, securityMetadataFromDD.isDenyUncoveredHttpMethods());
List<WebResourceCollection> webResourceCollections = new ArrayList<WebResourceCollection>();
webResourceCollections.add(webResourceCollection);
return createSecurityConstraint(securityMetadataFromDD, webResourceCollections, servletSecurity, true);
} | java | private SecurityConstraint getConstraintFromHttpElement(SecurityMetadata securityMetadataFromDD, Collection<String> urlPatterns, ServletSecurityElement servletSecurity) {
List<String> omissionMethods = new ArrayList<String>();
if (!servletSecurity.getMethodNames().isEmpty()) {
omissionMethods.addAll(servletSecurity.getMethodNames()); //list of methods named by @HttpMethodConstraint
}
WebResourceCollection webResourceCollection = new WebResourceCollection((List<String>) urlPatterns, new ArrayList<String>(), omissionMethods, securityMetadataFromDD.isDenyUncoveredHttpMethods());
List<WebResourceCollection> webResourceCollections = new ArrayList<WebResourceCollection>();
webResourceCollections.add(webResourceCollection);
return createSecurityConstraint(securityMetadataFromDD, webResourceCollections, servletSecurity, true);
} | [
"private",
"SecurityConstraint",
"getConstraintFromHttpElement",
"(",
"SecurityMetadata",
"securityMetadataFromDD",
",",
"Collection",
"<",
"String",
">",
"urlPatterns",
",",
"ServletSecurityElement",
"servletSecurity",
")",
"{",
"List",
"<",
"String",
">",
"omissionMethods... | Gets the security constraint from the HttpConstraint element defined in the given ServletSecurityElement
with the given list of url patterns.
This constraint applies to all methods that are not explicitly overridden by the HttpMethodConstraint element. The method
constraints are defined as omission methods in this security constraint.
@param securityMetadataFromDD the security metadata processed from the deployment descriptor, for updating the roles
@param urlPatterns the list of URL patterns defined in the @WebServlet annotation
@param servletSecurity the ServletSecurityElement that represents the information parsed from the @ServletSecurity annotation
@return the security constraint defined by the @HttpConstraint annotation | [
"Gets",
"the",
"security",
"constraint",
"from",
"the",
"HttpConstraint",
"element",
"defined",
"in",
"the",
"given",
"ServletSecurityElement",
"with",
"the",
"given",
"list",
"of",
"url",
"patterns",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ServletStartedListener.java#L322-L332 |
aboutsip/pkts | pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java | SipParser.consumeSeparator | private static int consumeSeparator(final Buffer buffer, final byte b) throws IndexOutOfBoundsException,
IOException {
buffer.markReaderIndex();
int consumed = consumeSWS(buffer);
if (isNext(buffer, b)) {
buffer.readByte();
++consumed;
} else {
buffer.resetReaderIndex();
return 0;
}
consumed += consumeSWS(buffer);
return consumed;
} | java | private static int consumeSeparator(final Buffer buffer, final byte b) throws IndexOutOfBoundsException,
IOException {
buffer.markReaderIndex();
int consumed = consumeSWS(buffer);
if (isNext(buffer, b)) {
buffer.readByte();
++consumed;
} else {
buffer.resetReaderIndex();
return 0;
}
consumed += consumeSWS(buffer);
return consumed;
} | [
"private",
"static",
"int",
"consumeSeparator",
"(",
"final",
"Buffer",
"buffer",
",",
"final",
"byte",
"b",
")",
"throws",
"IndexOutOfBoundsException",
",",
"IOException",
"{",
"buffer",
".",
"markReaderIndex",
"(",
")",
";",
"int",
"consumed",
"=",
"consumeSWS... | Helper function for checking stuff as described below. It is all the same pattern so...
(from rfc 3261 section 25.1)
When tokens are used or separators are used between elements,
whitespace is often allowed before or after these characters:
STAR = SWS "*" SWS ; asterisk
SLASH = SWS "/" SWS ; slash
EQUAL = SWS "=" SWS ; equal
LPAREN = SWS "(" SWS ; left parenthesis
RPAREN = SWS ")" SWS ; right parenthesis
RAQUOT = ">" SWS ; right angle quote
LAQUOT = SWS "<"; left angle quote
COMMA = SWS "," SWS ; comma
SEMI = SWS ";" SWS ; semicolon
COLON = SWS ":" SWS ; colon
LDQUOT = SWS DQUOTE; open double quotation mark
RDQUOT = DQUOTE SWS ; close double quotation mark
@param buffer
@param b
@return the number of bytes that was consumed.
@throws IOException
@throws IndexOutOfBoundsException | [
"Helper",
"function",
"for",
"checking",
"stuff",
"as",
"described",
"below",
".",
"It",
"is",
"all",
"the",
"same",
"pattern",
"so",
"...",
"(",
"from",
"rfc",
"3261",
"section",
"25",
".",
"1",
")"
] | train | https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java#L957-L970 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java | FSImageCompression.createCompression | static FSImageCompression createCompression(Configuration conf, boolean forceUncompressed)
throws IOException {
boolean compressImage = (!forceUncompressed) && conf.getBoolean(
HdfsConstants.DFS_IMAGE_COMPRESS_KEY,
HdfsConstants.DFS_IMAGE_COMPRESS_DEFAULT);
if (!compressImage) {
return createNoopCompression();
}
String codecClassName = conf.get(
HdfsConstants.DFS_IMAGE_COMPRESSION_CODEC_KEY,
HdfsConstants.DFS_IMAGE_COMPRESSION_CODEC_DEFAULT);
return createCompression(conf, codecClassName);
} | java | static FSImageCompression createCompression(Configuration conf, boolean forceUncompressed)
throws IOException {
boolean compressImage = (!forceUncompressed) && conf.getBoolean(
HdfsConstants.DFS_IMAGE_COMPRESS_KEY,
HdfsConstants.DFS_IMAGE_COMPRESS_DEFAULT);
if (!compressImage) {
return createNoopCompression();
}
String codecClassName = conf.get(
HdfsConstants.DFS_IMAGE_COMPRESSION_CODEC_KEY,
HdfsConstants.DFS_IMAGE_COMPRESSION_CODEC_DEFAULT);
return createCompression(conf, codecClassName);
} | [
"static",
"FSImageCompression",
"createCompression",
"(",
"Configuration",
"conf",
",",
"boolean",
"forceUncompressed",
")",
"throws",
"IOException",
"{",
"boolean",
"compressImage",
"=",
"(",
"!",
"forceUncompressed",
")",
"&&",
"conf",
".",
"getBoolean",
"(",
"Hdf... | Create a compression instance based on the user's configuration in the given
Configuration object.
@throws IOException if the specified codec is not available. | [
"Create",
"a",
"compression",
"instance",
"based",
"on",
"the",
"user",
"s",
"configuration",
"in",
"the",
"given",
"Configuration",
"object",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java#L72-L86 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java | CommonMpJwtFat.buildAppSecureUrl | public String buildAppSecureUrl(LibertyServer theServer, String root, String app) throws Exception {
return SecurityFatHttpUtils.getServerSecureUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME;
} | java | public String buildAppSecureUrl(LibertyServer theServer, String root, String app) throws Exception {
return SecurityFatHttpUtils.getServerSecureUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME;
} | [
"public",
"String",
"buildAppSecureUrl",
"(",
"LibertyServer",
"theServer",
",",
"String",
"root",
",",
"String",
"app",
")",
"throws",
"Exception",
"{",
"return",
"SecurityFatHttpUtils",
".",
"getServerSecureUrlBase",
"(",
"theServer",
")",
"+",
"root",
"+",
"\"/... | Build the https app url
@param theServer - The server where the app is running (used to get the port)
@param root - the root context of the app
@param app - the specific app to run
@return - returns the full url to invoke
@throws Exception | [
"Build",
"the",
"https",
"app",
"url"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L144-L148 |
pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java | ModelHelper.encode | public static final Transaction.Status encode(final TxnState.State state, final String logString) {
Preconditions.checkNotNull(state, "state");
Exceptions.checkNotNullOrEmpty(logString, "logString");
Transaction.Status result;
switch (state) {
case COMMITTED:
result = Transaction.Status.COMMITTED;
break;
case ABORTED:
result = Transaction.Status.ABORTED;
break;
case OPEN:
result = Transaction.Status.OPEN;
break;
case ABORTING:
result = Transaction.Status.ABORTING;
break;
case COMMITTING:
result = Transaction.Status.COMMITTING;
break;
case UNKNOWN:
throw new RuntimeException("Unknown transaction: " + logString);
case UNRECOGNIZED:
default:
throw new IllegalStateException("Unknown status: " + state);
}
return result;
} | java | public static final Transaction.Status encode(final TxnState.State state, final String logString) {
Preconditions.checkNotNull(state, "state");
Exceptions.checkNotNullOrEmpty(logString, "logString");
Transaction.Status result;
switch (state) {
case COMMITTED:
result = Transaction.Status.COMMITTED;
break;
case ABORTED:
result = Transaction.Status.ABORTED;
break;
case OPEN:
result = Transaction.Status.OPEN;
break;
case ABORTING:
result = Transaction.Status.ABORTING;
break;
case COMMITTING:
result = Transaction.Status.COMMITTING;
break;
case UNKNOWN:
throw new RuntimeException("Unknown transaction: " + logString);
case UNRECOGNIZED:
default:
throw new IllegalStateException("Unknown status: " + state);
}
return result;
} | [
"public",
"static",
"final",
"Transaction",
".",
"Status",
"encode",
"(",
"final",
"TxnState",
".",
"State",
"state",
",",
"final",
"String",
"logString",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"state",
",",
"\"state\"",
")",
";",
"Exceptions",
... | Returns actual status of given transaction status instance.
@param state TxnState object instance.
@param logString Description text to be logged when transaction status is invalid.
@return Transaction.Status | [
"Returns",
"actual",
"status",
"of",
"given",
"transaction",
"status",
"instance",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L146-L174 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java | AbstractEntityReader.findById | protected EnhanceEntity findById(Object primaryKey, EntityMetadata m, Client client)
{
try
{
Object o = client.find(m.getEntityClazz(), primaryKey);
if (o == null)
{
// No entity found
return null;
}
else
{
return o instanceof EnhanceEntity ? (EnhanceEntity) o : new EnhanceEntity(o, getId(o, m), null);
}
}
catch (Exception e)
{
throw new EntityReaderException(e);
}
} | java | protected EnhanceEntity findById(Object primaryKey, EntityMetadata m, Client client)
{
try
{
Object o = client.find(m.getEntityClazz(), primaryKey);
if (o == null)
{
// No entity found
return null;
}
else
{
return o instanceof EnhanceEntity ? (EnhanceEntity) o : new EnhanceEntity(o, getId(o, m), null);
}
}
catch (Exception e)
{
throw new EntityReaderException(e);
}
} | [
"protected",
"EnhanceEntity",
"findById",
"(",
"Object",
"primaryKey",
",",
"EntityMetadata",
"m",
",",
"Client",
"client",
")",
"{",
"try",
"{",
"Object",
"o",
"=",
"client",
".",
"find",
"(",
"m",
".",
"getEntityClazz",
"(",
")",
",",
"primaryKey",
")",
... | Retrieves an entity from ID
@param primaryKey
@param m
@param client
@return | [
"Retrieves",
"an",
"entity",
"from",
"ID"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java#L77-L97 |
threerings/narya | core/src/main/java/com/threerings/io/ObjectInputStream.java | ObjectInputStream.createClassMapping | protected ClassMapping createClassMapping (short code, String cname)
throws IOException, ClassNotFoundException
{
// resolve the class and streamer
ClassLoader loader = (_loader != null) ? _loader :
Thread.currentThread().getContextClassLoader();
Class<?> sclass = Class.forName(cname, true, loader);
Streamer streamer = Streamer.getStreamer(sclass);
if (STREAM_DEBUG) {
log.info(hashCode() + ": New class '" + cname + "'", "code", code);
}
// sanity check
if (streamer == null) {
String errmsg = "Aiya! Unable to create streamer for newly seen class " +
"[code=" + code + ", class=" + cname + "]";
throw new RuntimeException(errmsg);
}
return new ClassMapping(code, sclass, streamer);
} | java | protected ClassMapping createClassMapping (short code, String cname)
throws IOException, ClassNotFoundException
{
// resolve the class and streamer
ClassLoader loader = (_loader != null) ? _loader :
Thread.currentThread().getContextClassLoader();
Class<?> sclass = Class.forName(cname, true, loader);
Streamer streamer = Streamer.getStreamer(sclass);
if (STREAM_DEBUG) {
log.info(hashCode() + ": New class '" + cname + "'", "code", code);
}
// sanity check
if (streamer == null) {
String errmsg = "Aiya! Unable to create streamer for newly seen class " +
"[code=" + code + ", class=" + cname + "]";
throw new RuntimeException(errmsg);
}
return new ClassMapping(code, sclass, streamer);
} | [
"protected",
"ClassMapping",
"createClassMapping",
"(",
"short",
"code",
",",
"String",
"cname",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"// resolve the class and streamer",
"ClassLoader",
"loader",
"=",
"(",
"_loader",
"!=",
"null",
")",
"?"... | Creates and returns a class mapping for the specified code and class name. | [
"Creates",
"and",
"returns",
"a",
"class",
"mapping",
"for",
"the",
"specified",
"code",
"and",
"class",
"name",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/io/ObjectInputStream.java#L238-L258 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/JavaClasspathParser.java | JavaClasspathParser.readFileEntriesWithException | public static IClasspathEntry[][] readFileEntriesWithException(String projectName, URL projectRootAbsoluteFullPath)
throws CoreException, IOException, ClasspathEntry.AssertionFailedException, URISyntaxException {
return readFileEntriesWithException(projectName, projectRootAbsoluteFullPath, null);
} | java | public static IClasspathEntry[][] readFileEntriesWithException(String projectName, URL projectRootAbsoluteFullPath)
throws CoreException, IOException, ClasspathEntry.AssertionFailedException, URISyntaxException {
return readFileEntriesWithException(projectName, projectRootAbsoluteFullPath, null);
} | [
"public",
"static",
"IClasspathEntry",
"[",
"]",
"[",
"]",
"readFileEntriesWithException",
"(",
"String",
"projectName",
",",
"URL",
"projectRootAbsoluteFullPath",
")",
"throws",
"CoreException",
",",
"IOException",
",",
"ClasspathEntry",
".",
"AssertionFailedException",
... | Reads entry of a .classpath file.
@param projectName
- the name of project containing the .classpath file
@param projectRootAbsoluteFullPath
- the path to project containing the .classpath file
@return the set of CLasspath ENtries extracted from the .classpath
@throws CoreException
- exception during parsing of .classpath
@throws IOException
- exception during parsing of .classpath
@throws ClasspathEntry.AssertionFailedException
- exception during parsing of .classpath
@throws URISyntaxException
- exception during parsing of .classpath | [
"Reads",
"entry",
"of",
"a",
".",
"classpath",
"file",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/JavaClasspathParser.java#L125-L128 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java | ProtectedBranchesApi.protectBranch | public ProtectedBranch protectBranch(Integer projectIdOrPath, String branchName) throws GitLabApiException {
return protectBranch(projectIdOrPath, branchName, AccessLevel.MAINTAINER, AccessLevel.MAINTAINER);
} | java | public ProtectedBranch protectBranch(Integer projectIdOrPath, String branchName) throws GitLabApiException {
return protectBranch(projectIdOrPath, branchName, AccessLevel.MAINTAINER, AccessLevel.MAINTAINER);
} | [
"public",
"ProtectedBranch",
"protectBranch",
"(",
"Integer",
"projectIdOrPath",
",",
"String",
"branchName",
")",
"throws",
"GitLabApiException",
"{",
"return",
"protectBranch",
"(",
"projectIdOrPath",
",",
"branchName",
",",
"AccessLevel",
".",
"MAINTAINER",
",",
"A... | Protects a single repository branch or several project repository branches using a wildcard protected branch.
<pre><code>GitLab Endpoint: POST /projects/:id/protected_branches</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param branchName the name of the branch to protect
@return the branch info for the protected branch
@throws GitLabApiException if any exception occurs | [
"Protects",
"a",
"single",
"repository",
"branch",
"or",
"several",
"project",
"repository",
"branches",
"using",
"a",
"wildcard",
"protected",
"branch",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java#L82-L84 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/HexDump.java | HexDump.toHex | public static final String toHex(byte[] buf, int offset, int length)
{
return toHex(Arrays.copyOfRange(buf, offset, offset+length));
} | java | public static final String toHex(byte[] buf, int offset, int length)
{
return toHex(Arrays.copyOfRange(buf, offset, offset+length));
} | [
"public",
"static",
"final",
"String",
"toHex",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"toHex",
"(",
"Arrays",
".",
"copyOfRange",
"(",
"buf",
",",
"offset",
",",
"offset",
"+",
"length",
")",
")... | Creates readable view to byte array content.
@param buf
@param offset
@param length
@return | [
"Creates",
"readable",
"view",
"to",
"byte",
"array",
"content",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/HexDump.java#L123-L126 |
twitter/cloudhopper-commons | ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java | DataCoding.createGeneralGroup | static public DataCoding createGeneralGroup(byte characterEncoding, Byte messageClass, boolean compressed) throws IllegalArgumentException {
// only default, 8bit, or UCS2 are valid
if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT || characterEncoding == CHAR_ENC_UCS2)) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default, 8bit, or UCS2 supported for general group");
}
// validate the message class (only if non-null)
if (messageClass != null && (messageClass.byteValue() < 0 || messageClass.byteValue() > 3)) {
throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range");
}
// need to build this dcs value (top 2 bits are 0, start with 0x00)
byte dcs = 0;
if (compressed) {
dcs |= (byte)0x20; // turn bit 5 on
}
// if a message class is present turn bit 4 on
if (messageClass != null) {
dcs |= (byte)0x10; // turn bit 4 on
// bits 1 thru 0 is the message class
// merge in the message class (bottom 2 bits)
dcs |= messageClass;
}
// merge in language encodings (they nicely merge in since only default, 8-bit or UCS2)
dcs |= characterEncoding;
return new DataCoding(dcs, Group.GENERAL, characterEncoding, (messageClass == null ? MESSAGE_CLASS_0 : messageClass.byteValue()), compressed);
} | java | static public DataCoding createGeneralGroup(byte characterEncoding, Byte messageClass, boolean compressed) throws IllegalArgumentException {
// only default, 8bit, or UCS2 are valid
if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT || characterEncoding == CHAR_ENC_UCS2)) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default, 8bit, or UCS2 supported for general group");
}
// validate the message class (only if non-null)
if (messageClass != null && (messageClass.byteValue() < 0 || messageClass.byteValue() > 3)) {
throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range");
}
// need to build this dcs value (top 2 bits are 0, start with 0x00)
byte dcs = 0;
if (compressed) {
dcs |= (byte)0x20; // turn bit 5 on
}
// if a message class is present turn bit 4 on
if (messageClass != null) {
dcs |= (byte)0x10; // turn bit 4 on
// bits 1 thru 0 is the message class
// merge in the message class (bottom 2 bits)
dcs |= messageClass;
}
// merge in language encodings (they nicely merge in since only default, 8-bit or UCS2)
dcs |= characterEncoding;
return new DataCoding(dcs, Group.GENERAL, characterEncoding, (messageClass == null ? MESSAGE_CLASS_0 : messageClass.byteValue()), compressed);
} | [
"static",
"public",
"DataCoding",
"createGeneralGroup",
"(",
"byte",
"characterEncoding",
",",
"Byte",
"messageClass",
",",
"boolean",
"compressed",
")",
"throws",
"IllegalArgumentException",
"{",
"// only default, 8bit, or UCS2 are valid",
"if",
"(",
"!",
"(",
"character... | Creates a "General" group data coding scheme where 3 different
languages are supported (8BIT, UCS2, or DEFAULT). This method validates the
message class.
@param characterEncoding Either CHAR_ENC_DEFAULT, CHAR_ENC_8BIT, or CHAR_ENC_UCS2
@param messageClass The 4 different possible message classes (0-3). If null,
the "message class" not active flag will not be set.
@param compressed If true, the message is compressed. False if unpacked.
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported. | [
"Creates",
"a",
"General",
"group",
"data",
"coding",
"scheme",
"where",
"3",
"different",
"languages",
"are",
"supported",
"(",
"8BIT",
"UCS2",
"or",
"DEFAULT",
")",
".",
"This",
"method",
"validates",
"the",
"message",
"class",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L255-L285 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java | SwapAnnuity.getSwapAnnuity | public static RandomVariable getSwapAnnuity(Schedule schedule, ForwardCurveInterface forwardCurve) {
DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName());
double evaluationTime = 0.0; // Consider only payment time > 0
return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModelFromCurvesAndVols( new Curve[] {forwardCurve, discountCurve} ));
} | java | public static RandomVariable getSwapAnnuity(Schedule schedule, ForwardCurveInterface forwardCurve) {
DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName());
double evaluationTime = 0.0; // Consider only payment time > 0
return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModelFromCurvesAndVols( new Curve[] {forwardCurve, discountCurve} ));
} | [
"public",
"static",
"RandomVariable",
"getSwapAnnuity",
"(",
"Schedule",
"schedule",
",",
"ForwardCurveInterface",
"forwardCurve",
")",
"{",
"DiscountCurveInterface",
"discountCurve",
"=",
"new",
"DiscountCurveFromForwardCurve",
"(",
"forwardCurve",
".",
"getName",
"(",
"... | Function to calculate an (idealized) single curve swap annuity for a given schedule and forward curve.
The discount curve used to calculate the annuity is calculated from the forward curve using classical
single curve interpretations of forwards and a default period length. The may be a crude approximation.
Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata2.products.SwapAnnuity#getSwapAnnuity(double, Schedule, DiscountCurveInterface, AnalyticModel)}.
@param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param forwardCurve The forward curve.
@return The swap annuity. | [
"Function",
"to",
"calculate",
"an",
"(",
"idealized",
")",
"single",
"curve",
"swap",
"annuity",
"for",
"a",
"given",
"schedule",
"and",
"forward",
"curve",
".",
"The",
"discount",
"curve",
"used",
"to",
"calculate",
"the",
"annuity",
"is",
"calculated",
"f... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java#L101-L105 |
Jasig/uPortal | uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java | FileSystemGroupStore.findParentGroups | protected Iterator findParentGroups(IEntity ent) throws GroupsException {
if (log.isDebugEnabled()) log.debug(DEBUG_CLASS_NAME + ".findParentGroups(): for " + ent);
List groups = new ArrayList();
File root = getFileRoot(ent.getType());
if (root != null) {
File[] files = getAllFilesBelow(root);
try {
for (int i = 0; i < files.length; i++) {
Collection ids = getEntityIdsFromFile(files[i]);
if (ids.contains(ent.getKey())) {
groups.add(find(files[i]));
}
}
} catch (IOException ex) {
throw new GroupsException("Problem reading group files", ex);
}
}
return groups.iterator();
} | java | protected Iterator findParentGroups(IEntity ent) throws GroupsException {
if (log.isDebugEnabled()) log.debug(DEBUG_CLASS_NAME + ".findParentGroups(): for " + ent);
List groups = new ArrayList();
File root = getFileRoot(ent.getType());
if (root != null) {
File[] files = getAllFilesBelow(root);
try {
for (int i = 0; i < files.length; i++) {
Collection ids = getEntityIdsFromFile(files[i]);
if (ids.contains(ent.getKey())) {
groups.add(find(files[i]));
}
}
} catch (IOException ex) {
throw new GroupsException("Problem reading group files", ex);
}
}
return groups.iterator();
} | [
"protected",
"Iterator",
"findParentGroups",
"(",
"IEntity",
"ent",
")",
"throws",
"GroupsException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"DEBUG_CLASS_NAME",
"+",
"\".findParentGroups(): for \"",
"+",
"ent",
")"... | Returns an <code>Iterator</code> over the <code>Collection</code> of <code>IEntityGroups
</code> that the <code>IEntity</code> belongs to.
@return java.util.Iterator
@param ent org.apereo.portal.groups.IEntityGroup | [
"Returns",
"an",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"over",
"the",
"<code",
">",
"Collection<",
"/",
"code",
">",
"of",
"<code",
">",
"IEntityGroups",
"<",
"/",
"code",
">",
"that",
"the",
"<code",
">",
"IEntity<",
"/",
"code",
">",
"belongs"... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java#L279-L300 |
wuman/orientdb-android | object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java | OObjectDatabaseTx.newInstance | public <RET extends Object> RET newInstance(final String iClassName, final Object iEnclosingClass, Object... iArgs) {
checkSecurity(ODatabaseSecurityResources.CLASS, ORole.PERMISSION_CREATE, iClassName);
try {
RET enhanced = (RET) OObjectEntityEnhancer.getInstance().getProxiedInstance(entityManager.getEntityClass(iClassName),
iEnclosingClass, underlying.newInstance(iClassName), iArgs);
return (RET) enhanced;
} catch (Exception e) {
OLogManager.instance().error(this, "Error on creating object of class " + iClassName, e, ODatabaseException.class);
}
return null;
} | java | public <RET extends Object> RET newInstance(final String iClassName, final Object iEnclosingClass, Object... iArgs) {
checkSecurity(ODatabaseSecurityResources.CLASS, ORole.PERMISSION_CREATE, iClassName);
try {
RET enhanced = (RET) OObjectEntityEnhancer.getInstance().getProxiedInstance(entityManager.getEntityClass(iClassName),
iEnclosingClass, underlying.newInstance(iClassName), iArgs);
return (RET) enhanced;
} catch (Exception e) {
OLogManager.instance().error(this, "Error on creating object of class " + iClassName, e, ODatabaseException.class);
}
return null;
} | [
"public",
"<",
"RET",
"extends",
"Object",
">",
"RET",
"newInstance",
"(",
"final",
"String",
"iClassName",
",",
"final",
"Object",
"iEnclosingClass",
",",
"Object",
"...",
"iArgs",
")",
"{",
"checkSecurity",
"(",
"ODatabaseSecurityResources",
".",
"CLASS",
",",... | Create a new POJO by its class name. Assure to have called the registerEntityClasses() declaring the packages that are part of
entity classes.
@see OEntityManager.registerEntityClasses(String) | [
"Create",
"a",
"new",
"POJO",
"by",
"its",
"class",
"name",
".",
"Assure",
"to",
"have",
"called",
"the",
"registerEntityClasses",
"()",
"declaring",
"the",
"packages",
"that",
"are",
"part",
"of",
"entity",
"classes",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java#L110-L121 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeBoolean | @Pure
public static boolean getAttributeBoolean(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeBooleanWithDefault(document, true, false, path);
} | java | @Pure
public static boolean getAttributeBoolean(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeBooleanWithDefault(document, true, false, path);
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"getAttributeBoolean",
"(",
"Node",
"document",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"return",
"getAttributeB... | Replies the boolean value that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param path is the list of and ended by the attribute's name.
@return the boolean value of the specified attribute or <code>0</code>. | [
"Replies",
"the",
"boolean",
"value",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L299-L303 |
mfornos/humanize | humanize-icu/src/main/java/humanize/ICUHumanize.java | ICUHumanize.naturalTime | public static String naturalTime(final Date reference, final Date duration)
{
long diff = duration.getTime() - reference.getTime();
return context.get().getDurationFormat().formatDurationFrom(diff, reference.getTime());
} | java | public static String naturalTime(final Date reference, final Date duration)
{
long diff = duration.getTime() - reference.getTime();
return context.get().getDurationFormat().formatDurationFrom(diff, reference.getTime());
} | [
"public",
"static",
"String",
"naturalTime",
"(",
"final",
"Date",
"reference",
",",
"final",
"Date",
"duration",
")",
"{",
"long",
"diff",
"=",
"duration",
".",
"getTime",
"(",
")",
"-",
"reference",
".",
"getTime",
"(",
")",
";",
"return",
"context",
"... | <p>
Computes both past and future relative dates.
</p>
<p>
E.g. "1 day ago", "1 day from now", "10 years ago", "3 minutes from now"
and so on.
</p>
@param reference
Date to be used as reference
@param duration
Date to be used as duration from reference
@return String representing the relative date | [
"<p",
">",
"Computes",
"both",
"past",
"and",
"future",
"relative",
"dates",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L1336-L1340 |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java | CreateMASCaseManager.closeMASCaseManager | public static void closeMASCaseManager(File caseManager) {
FileWriter caseManagerWriter;
try {
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write("}\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger
.getLogger("CreateMASCaseManager.closeMASCaseManager");
logger.info("ERROR: There is a mistake closing caseManager file.\n");
}
} | java | public static void closeMASCaseManager(File caseManager) {
FileWriter caseManagerWriter;
try {
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write("}\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger
.getLogger("CreateMASCaseManager.closeMASCaseManager");
logger.info("ERROR: There is a mistake closing caseManager file.\n");
}
} | [
"public",
"static",
"void",
"closeMASCaseManager",
"(",
"File",
"caseManager",
")",
"{",
"FileWriter",
"caseManagerWriter",
";",
"try",
"{",
"caseManagerWriter",
"=",
"new",
"FileWriter",
"(",
"caseManager",
",",
"true",
")",
";",
"caseManagerWriter",
".",
"write"... | Method to close the file caseManager. It is called just one time, by the
MASReader, once every test and stroy have been added.
@param caseManager | [
"Method",
"to",
"close",
"the",
"file",
"caseManager",
".",
"It",
"is",
"called",
"just",
"one",
"time",
"by",
"the",
"MASReader",
"once",
"every",
"test",
"and",
"stroy",
"have",
"been",
"added",
"."
] | train | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java#L244-L258 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXAnnotation.java | MMAXAnnotation.setPointerList | public void setPointerList(int i, MMAXPointer v) {
if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_pointerList == null)
jcasType.jcas.throwFeatMissing("pointerList", "de.julielab.jules.types.mmax.MMAXAnnotation");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setPointerList(int i, MMAXPointer v) {
if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_pointerList == null)
jcasType.jcas.throwFeatMissing("pointerList", "de.julielab.jules.types.mmax.MMAXAnnotation");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setPointerList",
"(",
"int",
"i",
",",
"MMAXPointer",
"v",
")",
"{",
"if",
"(",
"MMAXAnnotation_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"MMAXAnnotation_Type",
")",
"jcasType",
")",
".",
"casFeat_pointerList",
"==",
"null",
")",
"jcasType",
... | indexed setter for pointerList - sets an indexed value - The list of MMAX pointers of the MMAX annotation.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"pointerList",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"The",
"list",
"of",
"MMAX",
"pointers",
"of",
"the",
"MMAX",
"annotation",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXAnnotation.java#L251-L255 |
knowm/XChange | xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java | DateUtils.fromISO8601DateString | public static Date fromISO8601DateString(String iso8601FormattedDate)
throws com.fasterxml.jackson.databind.exc.InvalidFormatException {
SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
// set UTC time zone
iso8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
return iso8601Format.parse(iso8601FormattedDate);
} catch (ParseException e) {
throw new InvalidFormatException("Error parsing as date", iso8601FormattedDate, Date.class);
}
} | java | public static Date fromISO8601DateString(String iso8601FormattedDate)
throws com.fasterxml.jackson.databind.exc.InvalidFormatException {
SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
// set UTC time zone
iso8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
return iso8601Format.parse(iso8601FormattedDate);
} catch (ParseException e) {
throw new InvalidFormatException("Error parsing as date", iso8601FormattedDate, Date.class);
}
} | [
"public",
"static",
"Date",
"fromISO8601DateString",
"(",
"String",
"iso8601FormattedDate",
")",
"throws",
"com",
".",
"fasterxml",
".",
"jackson",
".",
"databind",
".",
"exc",
".",
"InvalidFormatException",
"{",
"SimpleDateFormat",
"iso8601Format",
"=",
"new",
"Sim... | Converts an ISO 8601 formatted Date String to a Java Date ISO 8601 format:
yyyy-MM-dd'T'HH:mm:ss
@param iso8601FormattedDate
@return Date
@throws com.fasterxml.jackson.databind.exc.InvalidFormatException | [
"Converts",
"an",
"ISO",
"8601",
"formatted",
"Date",
"String",
"to",
"a",
"Java",
"Date",
"ISO",
"8601",
"format",
":",
"yyyy",
"-",
"MM",
"-",
"dd",
"T",
"HH",
":",
"mm",
":",
"ss"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java#L74-L85 |
weld/core | impl/src/main/java/org/jboss/weld/util/Types.java | Types.getCanonicalType | public static Type getCanonicalType(Class<?> clazz) {
if (clazz.isArray()) {
Class<?> componentType = clazz.getComponentType();
Type resolvedComponentType = getCanonicalType(componentType);
if (componentType != resolvedComponentType) {
// identity check intentional
// a different identity means that we actually replaced the component Class with a ParameterizedType
return new GenericArrayTypeImpl(resolvedComponentType);
}
}
if (clazz.getTypeParameters().length > 0) {
Type[] actualTypeParameters = clazz.getTypeParameters();
return new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass());
}
return clazz;
} | java | public static Type getCanonicalType(Class<?> clazz) {
if (clazz.isArray()) {
Class<?> componentType = clazz.getComponentType();
Type resolvedComponentType = getCanonicalType(componentType);
if (componentType != resolvedComponentType) {
// identity check intentional
// a different identity means that we actually replaced the component Class with a ParameterizedType
return new GenericArrayTypeImpl(resolvedComponentType);
}
}
if (clazz.getTypeParameters().length > 0) {
Type[] actualTypeParameters = clazz.getTypeParameters();
return new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass());
}
return clazz;
} | [
"public",
"static",
"Type",
"getCanonicalType",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
".",
"isArray",
"(",
")",
")",
"{",
"Class",
"<",
"?",
">",
"componentType",
"=",
"clazz",
".",
"getComponentType",
"(",
")",
";",
"Ty... | Returns a canonical type for a given class.
If the class is a raw type of a parameterized class, the matching {@link ParameterizedType} (with unresolved type
variables) is resolved.
If the class is an array then the component type of the array is canonicalized
Otherwise, the class is returned.
@return | [
"Returns",
"a",
"canonical",
"type",
"for",
"a",
"given",
"class",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Types.java#L127-L142 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.analyzePredicate | static boolean analyzePredicate(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
int argLen;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
argLen = compiler.getArgLength(opPos);
break;
default :
argLen = compiler.getArgLengthOfStep(opPos);
}
int pos = compiler.getFirstPredicateOpPos(opPos);
int nPredicates = compiler.countPredicates(pos);
return (nPredicates > 0) ? true : false;
} | java | static boolean analyzePredicate(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
int argLen;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
argLen = compiler.getArgLength(opPos);
break;
default :
argLen = compiler.getArgLengthOfStep(opPos);
}
int pos = compiler.getFirstPredicateOpPos(opPos);
int nPredicates = compiler.countPredicates(pos);
return (nPredicates > 0) ? true : false;
} | [
"static",
"boolean",
"analyzePredicate",
"(",
"Compiler",
"compiler",
",",
"int",
"opPos",
",",
"int",
"stepType",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"argLen",
";",
"switch",
"(",
"stepType",
")",
"... | Analyze a step and give information about it's predicates. Right now this
just returns true or false if the step has a predicate.
@param compiler non-null reference to compiler object that has processed
the XPath operations into an opcode map.
@param opPos The opcode position for the step.
@param stepType The type of step, one of OP_GROUP, etc.
@return true if step has a predicate.
@throws javax.xml.transform.TransformerException | [
"Analyze",
"a",
"step",
"and",
"give",
"information",
"about",
"it",
"s",
"predicates",
".",
"Right",
"now",
"this",
"just",
"returns",
"true",
"or",
"false",
"if",
"the",
"step",
"has",
"a",
"predicate",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L1127-L1149 |
shamanland/xdroid | lib-core/src/main/java/xdroid/core/ThreadUtils.java | ThreadUtils.newThread | public static Handler newThread(String name, int priority, Handler.Callback callback) {
HandlerThread thread = new HandlerThread(name != null ? name : newName(), priority);
thread.start();
return new Handler(thread.getLooper(), callback);
} | java | public static Handler newThread(String name, int priority, Handler.Callback callback) {
HandlerThread thread = new HandlerThread(name != null ? name : newName(), priority);
thread.start();
return new Handler(thread.getLooper(), callback);
} | [
"public",
"static",
"Handler",
"newThread",
"(",
"String",
"name",
",",
"int",
"priority",
",",
"Handler",
".",
"Callback",
"callback",
")",
"{",
"HandlerThread",
"thread",
"=",
"new",
"HandlerThread",
"(",
"name",
"!=",
"null",
"?",
"name",
":",
"newName",
... | Creates new {@link HandlerThread} and returns new {@link Handler} associated with this thread.
@param name name of thread, in case of null - the default name will be generated
@param priority one of constants from {@link android.os.Process}
@param callback message handling callback, may be null
@return new instance | [
"Creates",
"new",
"{",
"@link",
"HandlerThread",
"}",
"and",
"returns",
"new",
"{",
"@link",
"Handler",
"}",
"associated",
"with",
"this",
"thread",
"."
] | train | https://github.com/shamanland/xdroid/blob/5330811114afaf6a7b8f9a10f3bbe19d37995d89/lib-core/src/main/java/xdroid/core/ThreadUtils.java#L54-L58 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertVoidReturnType | public static void assertVoidReturnType(final Method method, Class<? extends Annotation> annotation)
{
if ((!method.getReturnType().equals(Void.class)) && (!method.getReturnType().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.methodHasToReturnVoid(method) : MESSAGES.methodHasToReturnVoid2(method, annotation);
}
} | java | public static void assertVoidReturnType(final Method method, Class<? extends Annotation> annotation)
{
if ((!method.getReturnType().equals(Void.class)) && (!method.getReturnType().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.methodHasToReturnVoid(method) : MESSAGES.methodHasToReturnVoid2(method, annotation);
}
} | [
"public",
"static",
"void",
"assertVoidReturnType",
"(",
"final",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"(",
"!",
"method",
".",
"getReturnType",
"(",
")",
".",
"equals",
"(",
"Void",
... | Asserts method return void.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"method",
"return",
"void",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L128-L134 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.splitEachLine | public static <T> T splitEachLine(Reader self, String regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
return splitEachLine(self, Pattern.compile(regex), closure);
} | java | public static <T> T splitEachLine(Reader self, String regex, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
return splitEachLine(self, Pattern.compile(regex), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"splitEachLine",
"(",
"Reader",
"self",
",",
"String",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"\"List<String>\"",
")",
"Closure",
"<",
"T",
">",
"clo... | Iterates through the given reader line by line, splitting each line using
the given regex separator. For each line, the given closure is called with
a single parameter being the list of strings computed by splitting the line
around matches of the given regular expression. The Reader is closed afterwards.
<p>
Here is an example:
<pre>
def s = 'The 3 quick\nbrown 4 fox'
def result = ''
new StringReader(s).splitEachLine(/\d/){ parts ->
result += "${parts[0]}_${parts[1]}|"
}
assert result == 'The _ quick|brown _ fox|'
</pre>
@param self a Reader, closed after the method returns
@param regex the delimiting regular expression
@param closure a closure
@return the last value returned by the closure
@throws IOException if an IOException occurs.
@throws java.util.regex.PatternSyntaxException
if the regular expression's syntax is invalid
@see java.lang.String#split(java.lang.String)
@since 1.5.5 | [
"Iterates",
"through",
"the",
"given",
"reader",
"line",
"by",
"line",
"splitting",
"each",
"line",
"using",
"the",
"given",
"regex",
"separator",
".",
"For",
"each",
"line",
"the",
"given",
"closure",
"is",
"called",
"with",
"a",
"single",
"parameter",
"bei... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L527-L529 |
OpenTSDB/opentsdb | src/tsd/client/RemoteOracle.java | RemoteOracle.newSuggestBox | public static SuggestBox newSuggestBox(final String suggest_type,
final TextBoxBase textbox) {
final RemoteOracle oracle = new RemoteOracle(suggest_type);
final SuggestBox box = new SuggestBox(oracle, textbox);
oracle.requester = box;
return box;
} | java | public static SuggestBox newSuggestBox(final String suggest_type,
final TextBoxBase textbox) {
final RemoteOracle oracle = new RemoteOracle(suggest_type);
final SuggestBox box = new SuggestBox(oracle, textbox);
oracle.requester = box;
return box;
} | [
"public",
"static",
"SuggestBox",
"newSuggestBox",
"(",
"final",
"String",
"suggest_type",
",",
"final",
"TextBoxBase",
"textbox",
")",
"{",
"final",
"RemoteOracle",
"oracle",
"=",
"new",
"RemoteOracle",
"(",
"suggest_type",
")",
";",
"final",
"SuggestBox",
"box",... | Factory method to use in order to get a {@link RemoteOracle} instance.
@param suggest_type The type of suggestion wanted.
@param textbox The text box to wrap to provide suggestions to. | [
"Factory",
"method",
"to",
"use",
"in",
"order",
"to",
"get",
"a",
"{"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/client/RemoteOracle.java#L83-L89 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.moveTo | public void moveTo(float x, float y) {
content.append(x).append(' ').append(y).append(" m").append_i(separator);
} | java | public void moveTo(float x, float y) {
content.append(x).append(' ').append(y).append(" m").append_i(separator);
} | [
"public",
"void",
"moveTo",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"content",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"y",
")",
".",
"append",
"(",
"\" m\"",
")",
".",
"append_i",
"(",
"sepa... | Move the current point <I>(x, y)</I>, omitting any connecting line segment.
@param x new x-coordinate
@param y new y-coordinate | [
"Move",
"the",
"current",
"point",
"<I",
">",
"(",
"x",
"y",
")",
"<",
"/",
"I",
">",
"omitting",
"any",
"connecting",
"line",
"segment",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L702-L704 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPreferences.java | CmsPreferences.buildSelectUpload | public String buildSelectUpload(String htmlAttributes) {
List<String> options = new ArrayList<String>();
List<String> values = new ArrayList<String>();
int selectedIndex = 0;
int pos = 0;
UploadVariant currentVariant = getParamTabWpUploadVariant();
for (UploadVariant variant : UploadVariant.values()) {
values.add(variant.toString());
options.add(getUploadVariantMessage(variant));
if (variant.equals(currentVariant)) {
selectedIndex = pos;
}
pos++;
}
return buildSelect(htmlAttributes, options, values, selectedIndex);
} | java | public String buildSelectUpload(String htmlAttributes) {
List<String> options = new ArrayList<String>();
List<String> values = new ArrayList<String>();
int selectedIndex = 0;
int pos = 0;
UploadVariant currentVariant = getParamTabWpUploadVariant();
for (UploadVariant variant : UploadVariant.values()) {
values.add(variant.toString());
options.add(getUploadVariantMessage(variant));
if (variant.equals(currentVariant)) {
selectedIndex = pos;
}
pos++;
}
return buildSelect(htmlAttributes, options, values, selectedIndex);
} | [
"public",
"String",
"buildSelectUpload",
"(",
"String",
"htmlAttributes",
")",
"{",
"List",
"<",
"String",
">",
"options",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"St... | Builds the html for the workplace start site select box.<p>
@param htmlAttributes optional html attributes for the &lgt;select> tag
@return the html for the workplace start site select box | [
"Builds",
"the",
"html",
"for",
"the",
"workplace",
"start",
"site",
"select",
"box",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L962-L981 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/misc/CircularIndex.java | CircularIndex.minusPOffset | public static int minusPOffset(int index, int offset, int size) {
index -= offset;
if( index < 0 ) {
return size + index;
} else {
return index;
}
} | java | public static int minusPOffset(int index, int offset, int size) {
index -= offset;
if( index < 0 ) {
return size + index;
} else {
return index;
}
} | [
"public",
"static",
"int",
"minusPOffset",
"(",
"int",
"index",
",",
"int",
"offset",
",",
"int",
"size",
")",
"{",
"index",
"-=",
"offset",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
"size",
"+",
"index",
";",
"}",
"else",
"{",
"return... | Subtracts a positive offset to index in a circular buffer.
@param index element in circular buffer
@param offset integer which is positive and less than size
@param size size of the circular buffer
@return new index | [
"Subtracts",
"a",
"positive",
"offset",
"to",
"index",
"in",
"a",
"circular",
"buffer",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/misc/CircularIndex.java#L47-L54 |
haifengl/smile | core/src/main/java/smile/neighbor/CoverTree.java | CoverTree.distSplit | private void distSplit(ArrayList<DistanceSet> pointSet, ArrayList<DistanceSet> newPointSet, E newPoint, int maxScale) {
double fmax = getCoverRadius(maxScale);
ArrayList<DistanceSet> newSet = new ArrayList<>();
for (int i = 0; i < pointSet.size(); i++) {
DistanceSet n = pointSet.get(i);
double newDist = distance.d(newPoint, n.getObject());
if (newDist <= fmax) {
pointSet.get(i).dist.add(newDist);
newPointSet.add(n);
} else {
newSet.add(n);
}
}
pointSet.clear();
pointSet.addAll(newSet);
} | java | private void distSplit(ArrayList<DistanceSet> pointSet, ArrayList<DistanceSet> newPointSet, E newPoint, int maxScale) {
double fmax = getCoverRadius(maxScale);
ArrayList<DistanceSet> newSet = new ArrayList<>();
for (int i = 0; i < pointSet.size(); i++) {
DistanceSet n = pointSet.get(i);
double newDist = distance.d(newPoint, n.getObject());
if (newDist <= fmax) {
pointSet.get(i).dist.add(newDist);
newPointSet.add(n);
} else {
newSet.add(n);
}
}
pointSet.clear();
pointSet.addAll(newSet);
} | [
"private",
"void",
"distSplit",
"(",
"ArrayList",
"<",
"DistanceSet",
">",
"pointSet",
",",
"ArrayList",
"<",
"DistanceSet",
">",
"newPointSet",
",",
"E",
"newPoint",
",",
"int",
"maxScale",
")",
"{",
"double",
"fmax",
"=",
"getCoverRadius",
"(",
"maxScale",
... | Moves all the points in pointSet covered by (the ball of) newPoint
into newPointSet, based on the given scale/level.
@param pointSet the supplied set of instances from which
all points covered by newPoint will be removed.
@param newPointSet the set in which all points covered by
newPoint will be put into.
@param newPoint the given new point.
@param maxScale the scale based on which distances are
judged (radius of cover ball is calculated). | [
"Moves",
"all",
"the",
"points",
"in",
"pointSet",
"covered",
"by",
"(",
"the",
"ball",
"of",
")",
"newPoint",
"into",
"newPointSet",
"based",
"on",
"the",
"given",
"scale",
"/",
"level",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/neighbor/CoverTree.java#L483-L499 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeLines | public static <T> File writeLines(Collection<T> list, File file, Charset charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, charset).writeLines(list, isAppend);
} | java | public static <T> File writeLines(Collection<T> list, File file, Charset charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, charset).writeLines(list, isAppend);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"writeLines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"File",
"file",
",",
"Charset",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
... | 将列表写入文件
@param <T> 集合元素类型
@param list 列表
@param file 文件
@param charset 字符集
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"将列表写入文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3071-L3073 |
baratine/baratine | web/src/main/java/com/caucho/v5/util/CharCursor.java | CharCursor.regionMatches | public boolean regionMatches(char []cb, int offset, int length)
{
int pos = getIndex();
char ch = current();
for (int i = 0; i < length; i++) {
if (cb[i + offset] != ch) {
setIndex(pos);
return false;
}
ch = next();
}
return true;
} | java | public boolean regionMatches(char []cb, int offset, int length)
{
int pos = getIndex();
char ch = current();
for (int i = 0; i < length; i++) {
if (cb[i + offset] != ch) {
setIndex(pos);
return false;
}
ch = next();
}
return true;
} | [
"public",
"boolean",
"regionMatches",
"(",
"char",
"[",
"]",
"cb",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"int",
"pos",
"=",
"getIndex",
"(",
")",
";",
"char",
"ch",
"=",
"current",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | True if the cursor matches the character buffer
If match fails, return the pointer to its original. | [
"True",
"if",
"the",
"cursor",
"matches",
"the",
"character",
"buffer"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/util/CharCursor.java#L124-L138 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java | GraphBackedTypeStore.findVertex | AtlasVertex findVertex(DataTypes.TypeCategory category, String typeName) {
LOG.debug("Finding AtlasVertex for {}.{}", category, typeName);
Iterator results = graph.query().has(Constants.TYPENAME_PROPERTY_KEY, typeName).vertices().iterator();
AtlasVertex vertex = null;
if (results != null && results.hasNext()) {
//There should be just one AtlasVertex with the given typeName
vertex = (AtlasVertex) results.next();
}
return vertex;
} | java | AtlasVertex findVertex(DataTypes.TypeCategory category, String typeName) {
LOG.debug("Finding AtlasVertex for {}.{}", category, typeName);
Iterator results = graph.query().has(Constants.TYPENAME_PROPERTY_KEY, typeName).vertices().iterator();
AtlasVertex vertex = null;
if (results != null && results.hasNext()) {
//There should be just one AtlasVertex with the given typeName
vertex = (AtlasVertex) results.next();
}
return vertex;
} | [
"AtlasVertex",
"findVertex",
"(",
"DataTypes",
".",
"TypeCategory",
"category",
",",
"String",
"typeName",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Finding AtlasVertex for {}.{}\"",
",",
"category",
",",
"typeName",
")",
";",
"Iterator",
"results",
"=",
"graph",
"... | Find vertex for the given type category and name, else create new vertex
@param category
@param typeName
@return vertex | [
"Find",
"vertex",
"for",
"the",
"given",
"type",
"category",
"and",
"name",
"else",
"create",
"new",
"vertex"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java#L333-L343 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/collection/HashedArrayTree.java | HashedArrayTree.get | @Override
public T get(int index) {
/* Check that this is a valid index. */
if (index < 0 || index >= size())
throw new IndexOutOfBoundsException("Index " + index + ", size " + size());
/* Look up the element. */
return mArrays[computeOffset(index)][computeIndex(index)];
} | java | @Override
public T get(int index) {
/* Check that this is a valid index. */
if (index < 0 || index >= size())
throw new IndexOutOfBoundsException("Index " + index + ", size " + size());
/* Look up the element. */
return mArrays[computeOffset(index)][computeIndex(index)];
} | [
"@",
"Override",
"public",
"T",
"get",
"(",
"int",
"index",
")",
"{",
"/* Check that this is a valid index. */",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"size",
"(",
")",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index \"",
"+",
"i... | Returns the value of the element at the specified position.
@param index The index at which to query.
@return The value of the element at that position.
@throws IndexOutOfBoundsException If the index is invalid. | [
"Returns",
"the",
"value",
"of",
"the",
"element",
"at",
"the",
"specified",
"position",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/collection/HashedArrayTree.java#L200-L208 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java | WSJdbcPreparedStatement.setURL | public void setURL(int i, java.net.URL url) throws SQLException {
// - don't trace user data url.
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "setURL", i);
try {
pstmtImpl.setURL(i, url);
} catch (SQLException ex) {
FFDCFilter.processException(ex,
"com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setURL", "1140", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void setURL(int i, java.net.URL url) throws SQLException {
// - don't trace user data url.
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "setURL", i);
try {
pstmtImpl.setURL(i, url);
} catch (SQLException ex) {
FFDCFilter.processException(ex,
"com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setURL", "1140", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"setURL",
"(",
"int",
"i",
",",
"java",
".",
"net",
".",
"URL",
"url",
")",
"throws",
"SQLException",
"{",
"// - don't trace user data url.",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"... | <p>Sets the designated parameter to the given java.net.URL value. The driver
converts this to an SQL DATALINK value when it sends it to the database.</p>
@param parameterIndex the first parameter is 1, the second is 2, ...
@param url the java.net.URL object to be set
@exception SQLException If a database access error occurs | [
"<p",
">",
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"java",
".",
"net",
".",
"URL",
"value",
".",
"The",
"driver",
"converts",
"this",
"to",
"an",
"SQL",
"DATALINK",
"value",
"when",
"it",
"sends",
"it",
"to",
"the",
"database",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java#L1953-L1970 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java | ModbusSerialTransport.waitBetweenFrames | void waitBetweenFrames(int transDelayMS, long lastTransactionTimestamp) {
// If a fixed delay has been set
if (transDelayMS > 0) {
ModbusUtil.sleep(transDelayMS);
}
else {
// Make use we have a gap of 3.5 characters between adjacent requests
// We have to do the calculations here because it is possible that the caller may have changed
// the connection characteristics if they provided the connection instance
int delay = getInterFrameDelay() / 1000;
// How long since the last message we received
long gapSinceLastMessage = (System.nanoTime() - lastTransactionTimestamp) / NS_IN_A_MS;
if (delay > gapSinceLastMessage) {
long sleepTime = delay - gapSinceLastMessage;
ModbusUtil.sleep(sleepTime);
if (logger.isDebugEnabled()) {
logger.debug("Waited between frames for {} ms", sleepTime);
}
}
}
} | java | void waitBetweenFrames(int transDelayMS, long lastTransactionTimestamp) {
// If a fixed delay has been set
if (transDelayMS > 0) {
ModbusUtil.sleep(transDelayMS);
}
else {
// Make use we have a gap of 3.5 characters between adjacent requests
// We have to do the calculations here because it is possible that the caller may have changed
// the connection characteristics if they provided the connection instance
int delay = getInterFrameDelay() / 1000;
// How long since the last message we received
long gapSinceLastMessage = (System.nanoTime() - lastTransactionTimestamp) / NS_IN_A_MS;
if (delay > gapSinceLastMessage) {
long sleepTime = delay - gapSinceLastMessage;
ModbusUtil.sleep(sleepTime);
if (logger.isDebugEnabled()) {
logger.debug("Waited between frames for {} ms", sleepTime);
}
}
}
} | [
"void",
"waitBetweenFrames",
"(",
"int",
"transDelayMS",
",",
"long",
"lastTransactionTimestamp",
")",
"{",
"// If a fixed delay has been set",
"if",
"(",
"transDelayMS",
">",
"0",
")",
"{",
"ModbusUtil",
".",
"sleep",
"(",
"transDelayMS",
")",
";",
"}",
"else",
... | Injects a delay dependent on the last time we received a response or
if a fixed delay has been specified
@param transDelayMS Fixed transaction delay (milliseconds)
@param lastTransactionTimestamp Timestamp of last transaction | [
"Injects",
"a",
"delay",
"dependent",
"on",
"the",
"last",
"time",
"we",
"received",
"a",
"response",
"or",
"if",
"a",
"fixed",
"delay",
"has",
"been",
"specified"
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java#L593-L617 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java | BiologicalAssemblyBuilder.addChainFlattened | private void addChainFlattened(Structure s, Chain newChain, String transformId) {
newChain.setId(newChain.getId()+SYM_CHAIN_ID_SEPARATOR+transformId);
newChain.setName(newChain.getName()+SYM_CHAIN_ID_SEPARATOR+transformId);
s.addChain(newChain);
} | java | private void addChainFlattened(Structure s, Chain newChain, String transformId) {
newChain.setId(newChain.getId()+SYM_CHAIN_ID_SEPARATOR+transformId);
newChain.setName(newChain.getName()+SYM_CHAIN_ID_SEPARATOR+transformId);
s.addChain(newChain);
} | [
"private",
"void",
"addChainFlattened",
"(",
"Structure",
"s",
",",
"Chain",
"newChain",
",",
"String",
"transformId",
")",
"{",
"newChain",
".",
"setId",
"(",
"newChain",
".",
"getId",
"(",
")",
"+",
"SYM_CHAIN_ID_SEPARATOR",
"+",
"transformId",
")",
";",
"... | Adds a chain to the given structure to form a biological assembly,
adding the symmetry-expanded chains as new chains with renamed
chain ids and names (in the form originalAsymId_transformId and originalAuthId_transformId).
@param s
@param newChain
@param transformId | [
"Adds",
"a",
"chain",
"to",
"the",
"given",
"structure",
"to",
"form",
"a",
"biological",
"assembly",
"adding",
"the",
"symmetry",
"-",
"expanded",
"chains",
"as",
"new",
"chains",
"with",
"renamed",
"chain",
"ids",
"and",
"names",
"(",
"in",
"the",
"form"... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java#L235-L239 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.writeSessionIdToZK | static long writeSessionIdToZK(Configuration conf) throws IOException {
AvatarZooKeeperClient zk = null;
long ssid = -1;
int maxTries = conf.getInt("dfs.avatarnode.zk.retries", 3);
boolean mismatch = false;
Long ssIdInZk = -1L;
for (int i = 0; i < maxTries; i++) {
try {
zk = new AvatarZooKeeperClient(conf, null, false);
ssid = writeSessionIdToZK(conf, zk);
return ssid;
} catch (Exception e) {
LOG.error("Got Exception when writing session id to zk. Will retry...",
e);
} finally {
shutdownZkClient(zk);
}
}
if (mismatch)
throw new IOException("Session Id in the NameNode : " + ssid
+ " does not match the session Id in Zookeeper : " + ssIdInZk);
throw new IOException("Cannot connect to zk");
} | java | static long writeSessionIdToZK(Configuration conf) throws IOException {
AvatarZooKeeperClient zk = null;
long ssid = -1;
int maxTries = conf.getInt("dfs.avatarnode.zk.retries", 3);
boolean mismatch = false;
Long ssIdInZk = -1L;
for (int i = 0; i < maxTries; i++) {
try {
zk = new AvatarZooKeeperClient(conf, null, false);
ssid = writeSessionIdToZK(conf, zk);
return ssid;
} catch (Exception e) {
LOG.error("Got Exception when writing session id to zk. Will retry...",
e);
} finally {
shutdownZkClient(zk);
}
}
if (mismatch)
throw new IOException("Session Id in the NameNode : " + ssid
+ " does not match the session Id in Zookeeper : " + ssIdInZk);
throw new IOException("Cannot connect to zk");
} | [
"static",
"long",
"writeSessionIdToZK",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"AvatarZooKeeperClient",
"zk",
"=",
"null",
";",
"long",
"ssid",
"=",
"-",
"1",
";",
"int",
"maxTries",
"=",
"conf",
".",
"getInt",
"(",
"\"dfs.avatarnode.... | Generates a new session id for the cluster and writes it to zookeeper. Some
other data in zookeeper (like the last transaction id) is written to
zookeeper with the sessionId so that we can easily determine in which
session was this data written. The sessionId is unique since it uses the
current time.
@return the session id that it wrote to ZooKeeper
@throws IOException | [
"Generates",
"a",
"new",
"session",
"id",
"for",
"the",
"cluster",
"and",
"writes",
"it",
"to",
"zookeeper",
".",
"Some",
"other",
"data",
"in",
"zookeeper",
"(",
"like",
"the",
"last",
"transaction",
"id",
")",
"is",
"written",
"to",
"zookeeper",
"with",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L189-L212 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java | DomHelper.setController | public void setController(Object parent, String name, GraphicsController controller, int eventMask) {
doSetController(getElement(parent, name), controller, eventMask);
} | java | public void setController(Object parent, String name, GraphicsController controller, int eventMask) {
doSetController(getElement(parent, name), controller, eventMask);
} | [
"public",
"void",
"setController",
"(",
"Object",
"parent",
",",
"String",
"name",
",",
"GraphicsController",
"controller",
",",
"int",
"eventMask",
")",
"{",
"doSetController",
"(",
"getElement",
"(",
"parent",
",",
"name",
")",
",",
"controller",
",",
"event... | Set the controller on an element of this <code>GraphicsContext</code> so it can react to events.
@param parent
the parent of the element on which the controller should be set.
@param name
the name of the child element on which the controller should be set
@param controller
The new <code>GraphicsController</code>
@param eventMask
a bitmask to specify which events to listen for {@link com.google.gwt.user.client.Event} | [
"Set",
"the",
"controller",
"on",
"an",
"element",
"of",
"this",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"so",
"it",
"can",
"react",
"to",
"events",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L599-L601 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMultiTextFieldRenderer.java | WMultiTextFieldRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMultiTextField textField = (WMultiTextField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textField.isReadOnly();
String[] values = textField.getTextInputs();
xml.appendTagOpen("ui:multitextfield");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", textField.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int cols = textField.getColumns();
int minLength = textField.getMinLength();
int maxLength = textField.getMaxLength();
int maxInputs = textField.getMaxInputs();
String pattern = textField.getPattern();
xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true");
xml.appendOptionalAttribute("required", textField.isMandatory(), "true");
xml.appendOptionalAttribute("toolTip", textField.getToolTip());
xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText());
xml.appendOptionalAttribute("size", cols > 0, cols);
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("max", maxInputs > 0, maxInputs);
xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern);
// NOTE: do not use HtmlRenderUtil.getEffectivePlaceholder for placeholder - we do not want to echo "required" in every field.
String placeholder = textField.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
xml.appendOptionalAttribute("title", I18nUtilities.format(null, InternalMessages.DEFAULT_MULTITEXTFIELD_TIP));
}
xml.appendClose();
if (values != null) {
for (String value : values) {
xml.appendTag("ui:value");
xml.appendEscaped(value);
xml.appendEndTag("ui:value");
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(textField, renderContext);
}
xml.appendEndTag("ui:multitextfield");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMultiTextField textField = (WMultiTextField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = textField.isReadOnly();
String[] values = textField.getTextInputs();
xml.appendTagOpen("ui:multitextfield");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", textField.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
int cols = textField.getColumns();
int minLength = textField.getMinLength();
int maxLength = textField.getMaxLength();
int maxInputs = textField.getMaxInputs();
String pattern = textField.getPattern();
xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true");
xml.appendOptionalAttribute("required", textField.isMandatory(), "true");
xml.appendOptionalAttribute("toolTip", textField.getToolTip());
xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText());
xml.appendOptionalAttribute("size", cols > 0, cols);
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("max", maxInputs > 0, maxInputs);
xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern);
// NOTE: do not use HtmlRenderUtil.getEffectivePlaceholder for placeholder - we do not want to echo "required" in every field.
String placeholder = textField.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
xml.appendOptionalAttribute("title", I18nUtilities.format(null, InternalMessages.DEFAULT_MULTITEXTFIELD_TIP));
}
xml.appendClose();
if (values != null) {
for (String value : values) {
xml.appendTag("ui:value");
xml.appendEscaped(value);
xml.appendEndTag("ui:value");
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(textField, renderContext);
}
xml.appendEndTag("ui:multitextfield");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WMultiTextField",
"textField",
"=",
"(",
"WMultiTextField",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"="... | Paints the given WMultiTextField.
@param component the WMultiTextField to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WMultiTextField",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMultiTextFieldRenderer.java#L27-L78 |
google/closure-compiler | src/com/google/javascript/jscomp/deps/DepsGenerator.java | DepsGenerator.parseSources | private Map<String, DependencyInfo> parseSources(
Set<String> preparsedFiles) throws IOException {
Map<String, DependencyInfo> parsedFiles = new LinkedHashMap<>();
JsFileParser jsParser = new JsFileParser(errorManager).setModuleLoader(loader);
Compiler compiler = new Compiler();
compiler.init(ImmutableList.of(), ImmutableList.of(), new CompilerOptions());
for (SourceFile file : srcs) {
String closureRelativePath =
PathUtil.makeRelative(
closurePathAbs, PathUtil.makeAbsolute(file.getName()));
if (logger.isLoggable(Level.FINE)) {
logger.fine("Closure-relative path: " + closureRelativePath);
}
if (InclusionStrategy.WHEN_IN_SRCS == mergeStrategy ||
!preparsedFiles.contains(closureRelativePath)) {
DependencyInfo depInfo =
jsParser.parseFile(
file.getName(), closureRelativePath,
file.getCode());
depInfo = new LazyParsedDependencyInfo(depInfo, new JsAst(file), compiler);
// Kick the source out of memory.
file.clearCachedSource();
parsedFiles.put(closureRelativePath, depInfo);
}
}
return parsedFiles;
} | java | private Map<String, DependencyInfo> parseSources(
Set<String> preparsedFiles) throws IOException {
Map<String, DependencyInfo> parsedFiles = new LinkedHashMap<>();
JsFileParser jsParser = new JsFileParser(errorManager).setModuleLoader(loader);
Compiler compiler = new Compiler();
compiler.init(ImmutableList.of(), ImmutableList.of(), new CompilerOptions());
for (SourceFile file : srcs) {
String closureRelativePath =
PathUtil.makeRelative(
closurePathAbs, PathUtil.makeAbsolute(file.getName()));
if (logger.isLoggable(Level.FINE)) {
logger.fine("Closure-relative path: " + closureRelativePath);
}
if (InclusionStrategy.WHEN_IN_SRCS == mergeStrategy ||
!preparsedFiles.contains(closureRelativePath)) {
DependencyInfo depInfo =
jsParser.parseFile(
file.getName(), closureRelativePath,
file.getCode());
depInfo = new LazyParsedDependencyInfo(depInfo, new JsAst(file), compiler);
// Kick the source out of memory.
file.clearCachedSource();
parsedFiles.put(closureRelativePath, depInfo);
}
}
return parsedFiles;
} | [
"private",
"Map",
"<",
"String",
",",
"DependencyInfo",
">",
"parseSources",
"(",
"Set",
"<",
"String",
">",
"preparsedFiles",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"DependencyInfo",
">",
"parsedFiles",
"=",
"new",
"LinkedHashMap",
"<>"... | Parses all source files for dependency information.
@param preparsedFiles A set of closure-relative paths.
Files in this set are not parsed if they are encountered in srcs.
@return Returns a map of closure-relative paths -> DependencyInfo for the
newly parsed files.
@throws IOException Occurs upon an IO error. | [
"Parses",
"all",
"source",
"files",
"for",
"dependency",
"information",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/DepsGenerator.java#L477-L506 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java | MappingUtils.hasFunction | public static boolean hasFunction(Object object, String functionName, Class[] parameters) {
boolean result = false;
try {
Method method = object.getClass().getMethod(functionName, parameters);
if (method != null) {
result = true;
}
} catch (NoSuchMethodException ex) {
result = false;
}
return result;
} | java | public static boolean hasFunction(Object object, String functionName, Class[] parameters) {
boolean result = false;
try {
Method method = object.getClass().getMethod(functionName, parameters);
if (method != null) {
result = true;
}
} catch (NoSuchMethodException ex) {
result = false;
}
return result;
} | [
"public",
"static",
"boolean",
"hasFunction",
"(",
"Object",
"object",
",",
"String",
"functionName",
",",
"Class",
"[",
"]",
"parameters",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"try",
"{",
"Method",
"method",
"=",
"object",
".",
"getClass",
"(... | Checks if Instance has specified function
@param object Instance which function would be checked
@param functionName function name
@param parameters function parameters (array of Class)
@return true if function is present in Instance | [
"Checks",
"if",
"Instance",
"has",
"specified",
"function"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L307-L321 |
radkovo/Pdf2Dom | src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java | CSSBoxTree.renderImage | @Override
protected void renderImage(float x, float y, float width, float height, ImageResource resource) throws IOException
{
//DOM element
Element el = createImageElement(x, y, width, height, resource);
curpage.appendChild(el);
//Image box
BlockBox block = createBlock(pagebox, el, true);
block.setStyle(createRectangleStyle(x, y, width, height, false, false));
pagebox.addSubBox(block);
} | java | @Override
protected void renderImage(float x, float y, float width, float height, ImageResource resource) throws IOException
{
//DOM element
Element el = createImageElement(x, y, width, height, resource);
curpage.appendChild(el);
//Image box
BlockBox block = createBlock(pagebox, el, true);
block.setStyle(createRectangleStyle(x, y, width, height, false, false));
pagebox.addSubBox(block);
} | [
"@",
"Override",
"protected",
"void",
"renderImage",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"width",
",",
"float",
"height",
",",
"ImageResource",
"resource",
")",
"throws",
"IOException",
"{",
"//DOM element",
"Element",
"el",
"=",
"createImageEl... | /*protected void renderRectangle(float x, float y, float width, float height, boolean stroke, boolean fill)
{
DOM element
Element el = createRectangleElement(x, y, width, height, stroke, fill);
curpage.appendChild(el);
Block box
BlockBox block = createBlock(pagebox, el, false);
block.setStyle(createRectangleStyle(x, y, width, height, stroke, fill));
pagebox.addSubBox(block);
} | [
"/",
"*",
"protected",
"void",
"renderRectangle",
"(",
"float",
"x",
"float",
"y",
"float",
"width",
"float",
"height",
"boolean",
"stroke",
"boolean",
"fill",
")",
"{",
"DOM",
"element",
"Element",
"el",
"=",
"createRectangleElement",
"(",
"x",
"y",
"width"... | train | https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L250-L260 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionOptionValueRelWrapper.java | CPDefinitionOptionValueRelWrapper.getName | @Override
public String getName(String languageId, boolean useDefault) {
return _cpDefinitionOptionValueRel.getName(languageId, useDefault);
} | java | @Override
public String getName(String languageId, boolean useDefault) {
return _cpDefinitionOptionValueRel.getName(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getName",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_cpDefinitionOptionValueRel",
".",
"getName",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized name of this cp definition option value rel in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized name of this cp definition option value rel | [
"Returns",
"the",
"localized",
"name",
"of",
"this",
"cp",
"definition",
"option",
"value",
"rel",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionOptionValueRelWrapper.java#L311-L314 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java | CmsDefaultXmlContentHandler.getSubPath | private String getSubPath(String[] pathElements, int begin) {
String result = "";
for (int i = begin; i < pathElements.length; i++) {
result += pathElements[i] + "/";
}
if (result.length() > 0) {
result = result.substring(0, result.length() - 1);
}
return result;
} | java | private String getSubPath(String[] pathElements, int begin) {
String result = "";
for (int i = begin; i < pathElements.length; i++) {
result += pathElements[i] + "/";
}
if (result.length() > 0) {
result = result.substring(0, result.length() - 1);
}
return result;
} | [
"private",
"String",
"getSubPath",
"(",
"String",
"[",
"]",
"pathElements",
",",
"int",
"begin",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"begin",
";",
"i",
"<",
"pathElements",
".",
"length",
";",
"i",
"++",
")",
... | Utility method to return a path fragment.<p>
@param pathElements the path elements
@param begin the begin index
@return the path | [
"Utility",
"method",
"to",
"return",
"a",
"path",
"fragment",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L3980-L3990 |
korpling/ANNIS | annis-visualizers/src/main/java/annis/visualizers/component/grid/GridComponent.java | GridComponent.markCoveredTokens | private Long markCoveredTokens(Map<SNode, Long> markedAndCovered, SNode tok) {
RelannisNodeFeature f = RelannisNodeFeature.extract(tok);
if (markedAndCovered.containsKey(tok) && f != null && f.getMatchedNode() == null) {
return markedAndCovered.get(tok);
}
return f != null ? f.getMatchedNode() : null;
} | java | private Long markCoveredTokens(Map<SNode, Long> markedAndCovered, SNode tok) {
RelannisNodeFeature f = RelannisNodeFeature.extract(tok);
if (markedAndCovered.containsKey(tok) && f != null && f.getMatchedNode() == null) {
return markedAndCovered.get(tok);
}
return f != null ? f.getMatchedNode() : null;
} | [
"private",
"Long",
"markCoveredTokens",
"(",
"Map",
"<",
"SNode",
",",
"Long",
">",
"markedAndCovered",
",",
"SNode",
"tok",
")",
"{",
"RelannisNodeFeature",
"f",
"=",
"RelannisNodeFeature",
".",
"extract",
"(",
"tok",
")",
";",
"if",
"(",
"markedAndCovered",
... | Checks if a token is covered by a matched node but not a match by it self.
@param markedAndCovered A mapping from node to a matched number. The node
must not matched directly, but covered by a matched
node.
@param tok the checked token.
@return Returns null, if token is not covered neither marked. | [
"Checks",
"if",
"a",
"token",
"is",
"covered",
"by",
"a",
"matched",
"node",
"but",
"not",
"a",
"match",
"by",
"it",
"self",
"."
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-visualizers/src/main/java/annis/visualizers/component/grid/GridComponent.java#L424-L430 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java | ByteArrayList.addNode | protected void addNode( Node nodeToInsert, Node insertBeforeNode )
{
// Insert node.
nodeToInsert.next = insertBeforeNode;
nodeToInsert.previous = insertBeforeNode.previous;
insertBeforeNode.previous.next = nodeToInsert;
insertBeforeNode.previous = nodeToInsert;
} | java | protected void addNode( Node nodeToInsert, Node insertBeforeNode )
{
// Insert node.
nodeToInsert.next = insertBeforeNode;
nodeToInsert.previous = insertBeforeNode.previous;
insertBeforeNode.previous.next = nodeToInsert;
insertBeforeNode.previous = nodeToInsert;
} | [
"protected",
"void",
"addNode",
"(",
"Node",
"nodeToInsert",
",",
"Node",
"insertBeforeNode",
")",
"{",
"// Insert node.",
"nodeToInsert",
".",
"next",
"=",
"insertBeforeNode",
";",
"nodeToInsert",
".",
"previous",
"=",
"insertBeforeNode",
".",
"previous",
";",
"i... | Inserts a new node into the list.
@param nodeToInsert new node to insert
@param insertBeforeNode node to insert before
@throws NullPointerException if either node is null | [
"Inserts",
"a",
"new",
"node",
"into",
"the",
"list",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java#L177-L184 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmElements.java | XsdAsmElements.generateClassMethods | private static void generateClassMethods(ClassWriter classWriter, String className, String apiName) {
generateClassMethods(classWriter, className, className, apiName, true);
} | java | private static void generateClassMethods(ClassWriter classWriter, String className, String apiName) {
generateClassMethods(classWriter, className, className, apiName, true);
} | [
"private",
"static",
"void",
"generateClassMethods",
"(",
"ClassWriter",
"classWriter",
",",
"String",
"className",
",",
"String",
"apiName",
")",
"{",
"generateClassMethods",
"(",
"classWriter",
",",
"className",
",",
"className",
",",
"apiName",
",",
"true",
")"... | Creates some class specific methods that all implementations of {@link XsdAbstractElement} should have, which are:
Constructor(ElementVisitor visitor) - Assigns the argument to the visitor field;
Constructor(Element parent) - Assigns the argument to the parent field and obtains the visitor of the parent;
Constructor(Element parent, ElementVisitor visitor, boolean performsVisit) -
An alternative constructor to avoid the visit method call;
of({@link Consumer} consumer) - Method used to avoid variable extraction in order to allow cleaner code;
dynamic({@link Consumer} consumer) - Method used to indicate that the changes on the fluent interface performed
inside the Consumer code are a dynamic aspect of the result and are bound to change;
self() - Returns this;
getName() - Returns the name of the element;
getParent() - Returns the parent field;
getVisitor() - Returns the visitor field;
__() - Returns the parent and calls the respective visitParent method.
@param classWriter The {@link ClassWriter} on which the methods should be written.
@param className The class name.
@param apiName The name of the generated fluent interface. | [
"Creates",
"some",
"class",
"specific",
"methods",
"that",
"all",
"implementations",
"of",
"{"
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmElements.java#L66-L68 |
dnsjava/dnsjava | org/xbill/DNS/SIG0.java | SIG0.verifyMessage | public static void
verifyMessage(Message message, byte [] b, KEYRecord key, SIGRecord previous)
throws DNSSEC.DNSSECException
{
SIGRecord sig = null;
Record [] additional = message.getSectionArray(Section.ADDITIONAL);
for (int i = 0; i < additional.length; i++) {
if (additional[i].getType() != Type.SIG)
continue;
if (((SIGRecord) additional[i]).getTypeCovered() != 0)
continue;
sig = (SIGRecord) additional[i];
break;
}
DNSSEC.verifyMessage(message, b, sig, previous, key);
} | java | public static void
verifyMessage(Message message, byte [] b, KEYRecord key, SIGRecord previous)
throws DNSSEC.DNSSECException
{
SIGRecord sig = null;
Record [] additional = message.getSectionArray(Section.ADDITIONAL);
for (int i = 0; i < additional.length; i++) {
if (additional[i].getType() != Type.SIG)
continue;
if (((SIGRecord) additional[i]).getTypeCovered() != 0)
continue;
sig = (SIGRecord) additional[i];
break;
}
DNSSEC.verifyMessage(message, b, sig, previous, key);
} | [
"public",
"static",
"void",
"verifyMessage",
"(",
"Message",
"message",
",",
"byte",
"[",
"]",
"b",
",",
"KEYRecord",
"key",
",",
"SIGRecord",
"previous",
")",
"throws",
"DNSSEC",
".",
"DNSSECException",
"{",
"SIGRecord",
"sig",
"=",
"null",
";",
"Record",
... | Verify a message using SIG(0).
@param message The message to be signed
@param b An array containing the message in unparsed form. This is
necessary since SIG(0) signs the message in wire format, and we can't
recreate the exact wire format (with the same name compression).
@param key The KEY record to verify the signature with.
@param previous If this message is a response, the SIG(0) from the query | [
"Verify",
"a",
"message",
"using",
"SIG",
"(",
"0",
")",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/SIG0.java#L62-L77 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.readBySax | public static void readBySax(InputStream in, int sheetIndex, RowHandler rowHandler) {
in = IoUtil.toMarkSupportStream(in);
if (ExcelFileUtil.isXlsx(in)) {
read07BySax(in, sheetIndex, rowHandler);
} else {
read03BySax(in, sheetIndex, rowHandler);
}
} | java | public static void readBySax(InputStream in, int sheetIndex, RowHandler rowHandler) {
in = IoUtil.toMarkSupportStream(in);
if (ExcelFileUtil.isXlsx(in)) {
read07BySax(in, sheetIndex, rowHandler);
} else {
read03BySax(in, sheetIndex, rowHandler);
}
} | [
"public",
"static",
"void",
"readBySax",
"(",
"InputStream",
"in",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"in",
"=",
"IoUtil",
".",
"toMarkSupportStream",
"(",
"in",
")",
";",
"if",
"(",
"ExcelFileUtil",
".",
"isXlsx",
"(",
"i... | 通过Sax方式读取Excel,同时支持03和07格式
@param in Excel流
@param sheetIndex sheet序号
@param rowHandler 行处理器
@since 3.2.0 | [
"通过Sax方式读取Excel,同时支持03和07格式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L71-L78 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.