repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java | PublicIPAddressesInner.getByResourceGroupAsync | public Observable<PublicIPAddressInner> getByResourceGroupAsync(String resourceGroupName, String publicIpAddressName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpAddressName, expand).map(new Func1<ServiceResponse<PublicIPAddressInner>, PublicIPAddressInner>() {
@Override
public PublicIPAddressInner call(ServiceResponse<PublicIPAddressInner> response) {
return response.body();
}
});
} | java | public Observable<PublicIPAddressInner> getByResourceGroupAsync(String resourceGroupName, String publicIpAddressName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpAddressName, expand).map(new Func1<ServiceResponse<PublicIPAddressInner>, PublicIPAddressInner>() {
@Override
public PublicIPAddressInner call(ServiceResponse<PublicIPAddressInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PublicIPAddressInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"publicIpAddressName",
",",
"String",
"expand",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Gets the specified public IP address in a specified resource group.
@param resourceGroupName The name of the resource group.
@param publicIpAddressName The name of the subnet.
@param expand Expands referenced resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PublicIPAddressInner object | [
"Gets",
"the",
"specified",
"public",
"IP",
"address",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L403-L410 |
3redronin/mu-server | src/main/java/io/muserver/rest/SafeHtml.java | SafeHtml.followingCharsAre | private static boolean followingCharsAre(String str, int startIndex, String nextChars) {
return (str.indexOf(nextChars, startIndex + 1) == (startIndex + 1));
} | java | private static boolean followingCharsAre(String str, int startIndex, String nextChars) {
return (str.indexOf(nextChars, startIndex + 1) == (startIndex + 1));
} | [
"private",
"static",
"boolean",
"followingCharsAre",
"(",
"String",
"str",
",",
"int",
"startIndex",
",",
"String",
"nextChars",
")",
"{",
"return",
"(",
"str",
".",
"indexOf",
"(",
"nextChars",
",",
"startIndex",
"+",
"1",
")",
"==",
"(",
"startIndex",
"+... | Tests if the chars following position {@code startIndex} in string
{@code str} are that of {@code nextChars}.
@param str
@param startIndex
@param nextChars
@return | [
"Tests",
"if",
"the",
"chars",
"following",
"position",
"{",
"@code",
"startIndex",
"}",
"in",
"string",
"{",
"@code",
"str",
"}",
"are",
"that",
"of",
"{",
"@code",
"nextChars",
"}",
"."
] | train | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/rest/SafeHtml.java#L191-L193 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java | SparkDl4jMultiLayer.fitContinuousLabeledPoint | public MultiLayerNetwork fitContinuousLabeledPoint(JavaRDD<LabeledPoint> rdd) {
return fit(MLLibUtil.fromContinuousLabeledPoint(sc, rdd));
} | java | public MultiLayerNetwork fitContinuousLabeledPoint(JavaRDD<LabeledPoint> rdd) {
return fit(MLLibUtil.fromContinuousLabeledPoint(sc, rdd));
} | [
"public",
"MultiLayerNetwork",
"fitContinuousLabeledPoint",
"(",
"JavaRDD",
"<",
"LabeledPoint",
">",
"rdd",
")",
"{",
"return",
"fit",
"(",
"MLLibUtil",
".",
"fromContinuousLabeledPoint",
"(",
"sc",
",",
"rdd",
")",
")",
";",
"}"
] | Fits a MultiLayerNetwork using Spark MLLib LabeledPoint instances
This will convert labeled points that have continuous labels used for regression to the internal
DL4J data format and train the model on that
@param rdd the javaRDD containing the labeled points
@return a MultiLayerNetwork | [
"Fits",
"a",
"MultiLayerNetwork",
"using",
"Spark",
"MLLib",
"LabeledPoint",
"instances",
"This",
"will",
"convert",
"labeled",
"points",
"that",
"have",
"continuous",
"labels",
"used",
"for",
"regression",
"to",
"the",
"internal",
"DL4J",
"data",
"format",
"and",... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L333-L335 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/ServerUserEventHandler.java | ServerUserEventHandler.checkUserAgent | protected Object checkUserAgent(ServerUserHandlerClass handler, ApiUser userAgent) {
if(handler.getUserClass().isAssignableFrom(userAgent.getClass()))
return userAgent;
return UserAgentUtil.getGameUser(userAgent, handler.getUserClass());
} | java | protected Object checkUserAgent(ServerUserHandlerClass handler, ApiUser userAgent) {
if(handler.getUserClass().isAssignableFrom(userAgent.getClass()))
return userAgent;
return UserAgentUtil.getGameUser(userAgent, handler.getUserClass());
} | [
"protected",
"Object",
"checkUserAgent",
"(",
"ServerUserHandlerClass",
"handler",
",",
"ApiUser",
"userAgent",
")",
"{",
"if",
"(",
"handler",
".",
"getUserClass",
"(",
")",
".",
"isAssignableFrom",
"(",
"userAgent",
".",
"getClass",
"(",
")",
")",
")",
"retu... | Check whether context of user agent is application or game
@param handler structure of handler
@param userAgent user agent object
@return user agent or game user agent object | [
"Check",
"whether",
"context",
"of",
"user",
"agent",
"is",
"application",
"or",
"game"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/ServerUserEventHandler.java#L48-L52 |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/caching/CacheHeader.java | CacheHeader.setExpiresSeconds | public static void setExpiresSeconds(@NotNull HttpServletResponse response, int seconds) {
Date expiresDate = DateUtils.addSeconds(new Date(), seconds);
setExpires(response, expiresDate);
} | java | public static void setExpiresSeconds(@NotNull HttpServletResponse response, int seconds) {
Date expiresDate = DateUtils.addSeconds(new Date(), seconds);
setExpires(response, expiresDate);
} | [
"public",
"static",
"void",
"setExpiresSeconds",
"(",
"@",
"NotNull",
"HttpServletResponse",
"response",
",",
"int",
"seconds",
")",
"{",
"Date",
"expiresDate",
"=",
"DateUtils",
".",
"addSeconds",
"(",
"new",
"Date",
"(",
")",
",",
"seconds",
")",
";",
"set... | Set expires header to given amount of seconds in the future.
@param response Response
@param seconds Seconds to expire | [
"Set",
"expires",
"header",
"to",
"given",
"amount",
"of",
"seconds",
"in",
"the",
"future",
"."
] | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/caching/CacheHeader.java#L232-L235 |
jbossas/remoting-jmx | src/main/java/org/jboss/remotingjmx/protocol/v1/Common.java | Common.prepareForMarshalling | protected org.jboss.marshalling.Marshaller prepareForMarshalling(final DataOutput dataOutput) throws IOException {
final org.jboss.marshalling.Marshaller marshaller = this.getMarshaller(marshallerFactory);
final OutputStream outputStream = new OutputStream() {
@Override
public void write(int b) throws IOException {
final int byteToWrite = b & 0xff;
dataOutput.write(byteToWrite);
}
@Override
public void write(final byte[] b) throws IOException {
dataOutput.write(b);
}
@Override
public void write(final byte[] b, final int off, final int len) throws IOException {
dataOutput.write(b, off, len);
}
};
final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream);
// start the marshaller
marshaller.start(byteOutput);
return marshaller;
} | java | protected org.jboss.marshalling.Marshaller prepareForMarshalling(final DataOutput dataOutput) throws IOException {
final org.jboss.marshalling.Marshaller marshaller = this.getMarshaller(marshallerFactory);
final OutputStream outputStream = new OutputStream() {
@Override
public void write(int b) throws IOException {
final int byteToWrite = b & 0xff;
dataOutput.write(byteToWrite);
}
@Override
public void write(final byte[] b) throws IOException {
dataOutput.write(b);
}
@Override
public void write(final byte[] b, final int off, final int len) throws IOException {
dataOutput.write(b, off, len);
}
};
final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream);
// start the marshaller
marshaller.start(byteOutput);
return marshaller;
} | [
"protected",
"org",
".",
"jboss",
".",
"marshalling",
".",
"Marshaller",
"prepareForMarshalling",
"(",
"final",
"DataOutput",
"dataOutput",
")",
"throws",
"IOException",
"{",
"final",
"org",
".",
"jboss",
".",
"marshalling",
".",
"Marshaller",
"marshaller",
"=",
... | Creates and returns a {@link org.jboss.marshalling.Marshaller} which is ready to be used for marshalling. The
{@link org.jboss.marshalling.Marshaller#start(org.jboss.marshalling.ByteOutput)} will be invoked by this method, to use
the passed {@link java.io.DataOutput dataOutput}, before returning the marshaller.
@param dataOutput The {@link java.io.DataOutput} to which the data will be marshalled
@return
@throws IOException | [
"Creates",
"and",
"returns",
"a",
"{",
"@link",
"org",
".",
"jboss",
".",
"marshalling",
".",
"Marshaller",
"}",
"which",
"is",
"ready",
"to",
"be",
"used",
"for",
"marshalling",
".",
"The",
"{",
"@link",
"org",
".",
"jboss",
".",
"marshalling",
".",
"... | train | https://github.com/jbossas/remoting-jmx/blob/dbc87bfed47e5bb9e37c355a77ca0ae9a6ea1363/src/main/java/org/jboss/remotingjmx/protocol/v1/Common.java#L79-L103 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherBase.java | DispatcherBase.obtainLongConfigParameter | protected static long obtainLongConfigParameter(MessageStoreImpl msi, String parameterName, String defaultValue, long minValue, long maxValue)
{
long value = Long.parseLong(defaultValue);
if (msi != null)
{
String strValue = msi.getProperty(parameterName, defaultValue);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, parameterName + "=" + strValue);
}; // end if
try
{
value = Long.parseLong(strValue);
if ((value < minValue) || (value > maxValue))
{
value = Long.parseLong(defaultValue);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "OVERRIDE: " + parameterName + "=" + strValue);
}; // end if
}; // end if
}
catch (NumberFormatException nfexc)
{
//No FFDC Code Needed.
}
}; // end if
return value;
} | java | protected static long obtainLongConfigParameter(MessageStoreImpl msi, String parameterName, String defaultValue, long minValue, long maxValue)
{
long value = Long.parseLong(defaultValue);
if (msi != null)
{
String strValue = msi.getProperty(parameterName, defaultValue);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, parameterName + "=" + strValue);
}; // end if
try
{
value = Long.parseLong(strValue);
if ((value < minValue) || (value > maxValue))
{
value = Long.parseLong(defaultValue);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "OVERRIDE: " + parameterName + "=" + strValue);
}; // end if
}; // end if
}
catch (NumberFormatException nfexc)
{
//No FFDC Code Needed.
}
}; // end if
return value;
} | [
"protected",
"static",
"long",
"obtainLongConfigParameter",
"(",
"MessageStoreImpl",
"msi",
",",
"String",
"parameterName",
",",
"String",
"defaultValue",
",",
"long",
"minValue",
",",
"long",
"maxValue",
")",
"{",
"long",
"value",
"=",
"Long",
".",
"parseLong",
... | Obtains the value of a long integer configuration parameter given its name, the default value
and 'reasonable' minimum and maximum values.
@param msi The Message Store instance to obtain the parameters (may be null)
@param parameterName The parameter's name
@param defaultValue The default value
@param minValue A reasonable minimum value
@param maxValue A reasonable maximum value | [
"Obtains",
"the",
"value",
"of",
"a",
"long",
"integer",
"configuration",
"parameter",
"given",
"its",
"name",
"the",
"default",
"value",
"and",
"reasonable",
"minimum",
"and",
"maximum",
"values",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/dispatcher/DispatcherBase.java#L82-L114 |
couchbase/CouchbaseMock | src/main/java/com/couchbase/mock/CouchbaseMock.java | CouchbaseMock.startHarakiriMonitor | public void startHarakiriMonitor(InetSocketAddress address, boolean terminate) throws IOException {
if (terminate) {
harakiriMonitor.setTemrinateAction(new Callable() {
@Override
public Object call() throws Exception {
System.exit(1);
return null;
}
});
}
harakiriMonitor.connect(address.getHostName(), address.getPort());
harakiriMonitor.start();
} | java | public void startHarakiriMonitor(InetSocketAddress address, boolean terminate) throws IOException {
if (terminate) {
harakiriMonitor.setTemrinateAction(new Callable() {
@Override
public Object call() throws Exception {
System.exit(1);
return null;
}
});
}
harakiriMonitor.connect(address.getHostName(), address.getPort());
harakiriMonitor.start();
} | [
"public",
"void",
"startHarakiriMonitor",
"(",
"InetSocketAddress",
"address",
",",
"boolean",
"terminate",
")",
"throws",
"IOException",
"{",
"if",
"(",
"terminate",
")",
"{",
"harakiriMonitor",
".",
"setTemrinateAction",
"(",
"new",
"Callable",
"(",
")",
"{",
... | Tell the harakiri monitor to connect to the given address.
@param address The address the monitor should connect to
@param terminate Whether the application should exit when a disconnect is detected on the socket
@throws IOException If the monitor could not listen on the given port, or if the monitor is already listening | [
"Tell",
"the",
"harakiri",
"monitor",
"to",
"connect",
"to",
"the",
"given",
"address",
"."
] | train | https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/CouchbaseMock.java#L90-L103 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.findByG_C_U | @Override
public List<CPFriendlyURLEntry> findByG_C_U(long groupId, long classNameId,
String urlTitle, int start, int end) {
return findByG_C_U(groupId, classNameId, urlTitle, start, end, null);
} | java | @Override
public List<CPFriendlyURLEntry> findByG_C_U(long groupId, long classNameId,
String urlTitle, int start, int end) {
return findByG_C_U(groupId, classNameId, urlTitle, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPFriendlyURLEntry",
">",
"findByG_C_U",
"(",
"long",
"groupId",
",",
"long",
"classNameId",
",",
"String",
"urlTitle",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByG_C_U",
"(",
"groupId",
",",
... | Returns a range of all the cp friendly url entries where groupId = ? and classNameId = ? and urlTitle = ?.
<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 CPFriendlyURLEntryModelImpl}. 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 classNameId the class name ID
@param urlTitle the url title
@param start the lower bound of the range of cp friendly url entries
@param end the upper bound of the range of cp friendly url entries (not inclusive)
@return the range of matching cp friendly url entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"friendly",
"url",
"entries",
"where",
"groupId",
"=",
"?",
";",
"and",
"classNameId",
"=",
"?",
";",
"and",
"urlTitle",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L2687-L2691 |
jenkinsci/jenkins | core/src/main/java/hudson/scm/RepositoryBrowsers.java | RepositoryBrowsers.createInstance | @Deprecated
public static <T extends RepositoryBrowser>
T createInstance(Class<T> type, StaplerRequest req, String fieldName) throws FormException {
List<Descriptor<RepositoryBrowser<?>>> list = filter(type);
String value = req.getParameter(fieldName);
if(value==null || value.equals("auto"))
return null;
// TODO: There was a TODO in the original code, which presumes passing something meaningful to the newInstance() JSON param
// Now we just pass empty JSON in order to make the code compliant with the defined interface
final JSONObject emptyJSON = new JSONObject();
return type.cast(list.get(Integer.parseInt(value)).newInstance(req, emptyJSON));
} | java | @Deprecated
public static <T extends RepositoryBrowser>
T createInstance(Class<T> type, StaplerRequest req, String fieldName) throws FormException {
List<Descriptor<RepositoryBrowser<?>>> list = filter(type);
String value = req.getParameter(fieldName);
if(value==null || value.equals("auto"))
return null;
// TODO: There was a TODO in the original code, which presumes passing something meaningful to the newInstance() JSON param
// Now we just pass empty JSON in order to make the code compliant with the defined interface
final JSONObject emptyJSON = new JSONObject();
return type.cast(list.get(Integer.parseInt(value)).newInstance(req, emptyJSON));
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
"extends",
"RepositoryBrowser",
">",
"T",
"createInstance",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"StaplerRequest",
"req",
",",
"String",
"fieldName",
")",
"throws",
"FormException",
"{",
"List",
"<",
"Des... | Creates an instance of {@link RepositoryBrowser} from a form submission.
@deprecated since 2008-06-19.
Use {@link #createInstance(Class, StaplerRequest, JSONObject, String)}. | [
"Creates",
"an",
"instance",
"of",
"{",
"@link",
"RepositoryBrowser",
"}",
"from",
"a",
"form",
"submission",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scm/RepositoryBrowsers.java#L69-L81 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_feature_GET | public ArrayList<String> dedicated_server_serviceName_feature_GET(String serviceName, OvhOrderableSysFeatureEnum feature) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/feature";
StringBuilder sb = path(qPath, serviceName);
query(sb, "feature", feature);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> dedicated_server_serviceName_feature_GET(String serviceName, OvhOrderableSysFeatureEnum feature) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/feature";
StringBuilder sb = path(qPath, serviceName);
query(sb, "feature", feature);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"dedicated_server_serviceName_feature_GET",
"(",
"String",
"serviceName",
",",
"OvhOrderableSysFeatureEnum",
"feature",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/feature\"",
"... | Get allowed durations for 'feature' option
REST: GET /order/dedicated/server/{serviceName}/feature
@param feature [required] the feature
@param serviceName [required] The internal name of your dedicated server | [
"Get",
"allowed",
"durations",
"for",
"feature",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2193-L2199 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/ClassCacheUtils.java | ClassCacheUtils.getClassFieldWriteMethod | public static Method getClassFieldWriteMethod(Class<?> clazz, String fieldName) {
return getClassWriteMethods(clazz).get(fieldName);
} | java | public static Method getClassFieldWriteMethod(Class<?> clazz, String fieldName) {
return getClassWriteMethods(clazz).get(fieldName);
} | [
"public",
"static",
"Method",
"getClassFieldWriteMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"return",
"getClassWriteMethods",
"(",
"clazz",
")",
".",
"get",
"(",
"fieldName",
")",
";",
"}"
] | Return cached class field write method to avoid each time use reflect | [
"Return",
"cached",
"class",
"field",
"write",
"method",
"to",
"avoid",
"each",
"time",
"use",
"reflect"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/ClassCacheUtils.java#L177-L179 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ConfigManager.java | ConfigManager.getPoolMinimum | public synchronized int getPoolMinimum(PoolInfo poolInfo, ResourceType type) {
Integer min = (typePoolInfoToMin == null) ? null :
typePoolInfoToMin.get(type, poolInfo);
return min == null ? 0 : min;
} | java | public synchronized int getPoolMinimum(PoolInfo poolInfo, ResourceType type) {
Integer min = (typePoolInfoToMin == null) ? null :
typePoolInfoToMin.get(type, poolInfo);
return min == null ? 0 : min;
} | [
"public",
"synchronized",
"int",
"getPoolMinimum",
"(",
"PoolInfo",
"poolInfo",
",",
"ResourceType",
"type",
")",
"{",
"Integer",
"min",
"=",
"(",
"typePoolInfoToMin",
"==",
"null",
")",
"?",
"null",
":",
"typePoolInfoToMin",
".",
"get",
"(",
"type",
",",
"p... | Get the configured minimum allocation for a given {@link ResourceType}
in a given pool
@param poolInfo Pool info to check
@param type the type of the resource
@return the minimum allocation for the resource in a pool | [
"Get",
"the",
"configured",
"minimum",
"allocation",
"for",
"a",
"given",
"{"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ConfigManager.java#L519-L523 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2.java | Trie2.rangeEnd | int rangeEnd(int start, int limitp, int val) {
int c;
int limit = Math.min(highStart, limitp);
for (c = start+1; c < limit; c++) {
if (get(c) != val) {
break;
}
}
if (c >= highStart) {
c = limitp;
}
return c - 1;
} | java | int rangeEnd(int start, int limitp, int val) {
int c;
int limit = Math.min(highStart, limitp);
for (c = start+1; c < limit; c++) {
if (get(c) != val) {
break;
}
}
if (c >= highStart) {
c = limitp;
}
return c - 1;
} | [
"int",
"rangeEnd",
"(",
"int",
"start",
",",
"int",
"limitp",
",",
"int",
"val",
")",
"{",
"int",
"c",
";",
"int",
"limit",
"=",
"Math",
".",
"min",
"(",
"highStart",
",",
"limitp",
")",
";",
"for",
"(",
"c",
"=",
"start",
"+",
"1",
";",
"c",
... | Find the last character in a contiguous range of characters with the
same Trie2 value as the input character.
@param c The character to begin with.
@return The last contiguous character with the same value. | [
"Find",
"the",
"last",
"character",
"in",
"a",
"contiguous",
"range",
"of",
"characters",
"with",
"the",
"same",
"Trie2",
"value",
"as",
"the",
"input",
"character",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2.java#L1011-L1024 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java | AbstractBigtableAdmin.deleteTableSnapshots | @Override
public void deleteTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern) throws IOException {
for (SnapshotDescription snapshotDescription : listTableSnapshots(tableNamePattern, snapshotNamePattern)) {
deleteSnapshot(snapshotDescription.getName());
}
} | java | @Override
public void deleteTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern) throws IOException {
for (SnapshotDescription snapshotDescription : listTableSnapshots(tableNamePattern, snapshotNamePattern)) {
deleteSnapshot(snapshotDescription.getName());
}
} | [
"@",
"Override",
"public",
"void",
"deleteTableSnapshots",
"(",
"Pattern",
"tableNamePattern",
",",
"Pattern",
"snapshotNamePattern",
")",
"throws",
"IOException",
"{",
"for",
"(",
"SnapshotDescription",
"snapshotDescription",
":",
"listTableSnapshots",
"(",
"tableNamePat... | {@inheritDoc}
The snapshots will be deleted serially and the first failure will prevent the deletion of the
remaining snapshots. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java#L996-L1001 |
cdk/cdk | tool/tautomer/src/main/java/org/openscience/cdk/tautomers/InChITautomerGenerator.java | InChITautomerGenerator.getTautomers | public List<IAtomContainer> getTautomers(IAtomContainer mol) throws CDKException, CloneNotSupportedException {
String opt = "";
if ((flags & KETO_ENOL) != 0)
opt += " -KET";
if ((flags & ONE_FIVE_SHIFT) != 0)
opt += " -15T";
InChIGenerator gen = InChIGeneratorFactory.getInstance().getInChIGenerator(mol, opt);
String inchi = gen.getInchi();
String aux = gen.getAuxInfo();
long[] amap = new long[mol.getAtomCount()];
InChINumbersTools.parseAuxInfo(aux, amap);
if (inchi == null)
throw new CDKException(InChIGenerator.class
+ " failed to create an InChI for the provided molecule, InChI -> null.");
return getTautomers(mol, inchi, amap);
} | java | public List<IAtomContainer> getTautomers(IAtomContainer mol) throws CDKException, CloneNotSupportedException {
String opt = "";
if ((flags & KETO_ENOL) != 0)
opt += " -KET";
if ((flags & ONE_FIVE_SHIFT) != 0)
opt += " -15T";
InChIGenerator gen = InChIGeneratorFactory.getInstance().getInChIGenerator(mol, opt);
String inchi = gen.getInchi();
String aux = gen.getAuxInfo();
long[] amap = new long[mol.getAtomCount()];
InChINumbersTools.parseAuxInfo(aux, amap);
if (inchi == null)
throw new CDKException(InChIGenerator.class
+ " failed to create an InChI for the provided molecule, InChI -> null.");
return getTautomers(mol, inchi, amap);
} | [
"public",
"List",
"<",
"IAtomContainer",
">",
"getTautomers",
"(",
"IAtomContainer",
"mol",
")",
"throws",
"CDKException",
",",
"CloneNotSupportedException",
"{",
"String",
"opt",
"=",
"\"\"",
";",
"if",
"(",
"(",
"flags",
"&",
"KETO_ENOL",
")",
"!=",
"0",
"... | Public method to get tautomers for an input molecule, based on the InChI which will be calculated by JNI-InChI.
@param mol molecule for which to generate tautomers
@return a list of tautomers, if any
@throws CDKException
@throws CloneNotSupportedException | [
"Public",
"method",
"to",
"get",
"tautomers",
"for",
"an",
"input",
"molecule",
"based",
"on",
"the",
"InChI",
"which",
"will",
"be",
"calculated",
"by",
"JNI",
"-",
"InChI",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/tautomer/src/main/java/org/openscience/cdk/tautomers/InChITautomerGenerator.java#L102-L121 |
liferay/com-liferay-commerce | commerce-shipping-engine-fixed-service/src/main/java/com/liferay/commerce/shipping/engine/fixed/service/persistence/impl/CommerceShippingFixedOptionPersistenceImpl.java | CommerceShippingFixedOptionPersistenceImpl.findAll | @Override
public List<CommerceShippingFixedOption> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceShippingFixedOption> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceShippingFixedOption",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce shipping fixed options.
<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 CommerceShippingFixedOptionModelImpl}. 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 start the lower bound of the range of commerce shipping fixed options
@param end the upper bound of the range of commerce shipping fixed options (not inclusive)
@return the range of commerce shipping fixed options | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"shipping",
"fixed",
"options",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-shipping-engine-fixed-service/src/main/java/com/liferay/commerce/shipping/engine/fixed/service/persistence/impl/CommerceShippingFixedOptionPersistenceImpl.java#L1162-L1165 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/event/task/EventNotificationManager.java | EventNotificationManager.subscribeToEvent | public void subscribeToEvent(final EventListener eventListener, final Class<? extends AbstractTaskEvent> eventType) {
synchronized (this.subscriptions) {
List<EventListener> subscribers = this.subscriptions.get(eventType);
if (subscribers == null) {
subscribers = new ArrayList<EventListener>();
this.subscriptions.put(eventType, subscribers);
}
subscribers.add(eventListener);
}
} | java | public void subscribeToEvent(final EventListener eventListener, final Class<? extends AbstractTaskEvent> eventType) {
synchronized (this.subscriptions) {
List<EventListener> subscribers = this.subscriptions.get(eventType);
if (subscribers == null) {
subscribers = new ArrayList<EventListener>();
this.subscriptions.put(eventType, subscribers);
}
subscribers.add(eventListener);
}
} | [
"public",
"void",
"subscribeToEvent",
"(",
"final",
"EventListener",
"eventListener",
",",
"final",
"Class",
"<",
"?",
"extends",
"AbstractTaskEvent",
">",
"eventType",
")",
"{",
"synchronized",
"(",
"this",
".",
"subscriptions",
")",
"{",
"List",
"<",
"EventLis... | Subscribes the given event listener object to the specified event type.
@param eventListener
the {@link EventListener} object to create the subscription for
@param eventType
the event type the given listener object wants to be notified about | [
"Subscribes",
"the",
"given",
"event",
"listener",
"object",
"to",
"the",
"specified",
"event",
"type",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/event/task/EventNotificationManager.java#L43-L55 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/uri/ContentUriChecker.java | ContentUriChecker.extractPlaceHoldersFromURI | private <L extends Collection<ContentUriPlaceHolder>> L extractPlaceHoldersFromURI(String uri, final L result) {
final One<Boolean> valid = new One<>();
valid.value0 = false;
analyzeInternal(uri, new UriBaseListener() {
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
result.add(new ContentUriPlaceHolder(pathSegmentIndex, ctx.bind_parameter_name().getText()));
}
@Override
public void enterPath_segment(Path_segmentContext ctx) {
pathSegmentIndex++;
}
});
return result;
} | java | private <L extends Collection<ContentUriPlaceHolder>> L extractPlaceHoldersFromURI(String uri, final L result) {
final One<Boolean> valid = new One<>();
valid.value0 = false;
analyzeInternal(uri, new UriBaseListener() {
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
result.add(new ContentUriPlaceHolder(pathSegmentIndex, ctx.bind_parameter_name().getText()));
}
@Override
public void enterPath_segment(Path_segmentContext ctx) {
pathSegmentIndex++;
}
});
return result;
} | [
"private",
"<",
"L",
"extends",
"Collection",
"<",
"ContentUriPlaceHolder",
">",
">",
"L",
"extractPlaceHoldersFromURI",
"(",
"String",
"uri",
",",
"final",
"L",
"result",
")",
"{",
"final",
"One",
"<",
"Boolean",
">",
"valid",
"=",
"new",
"One",
"<>",
"("... | Extract place holders from URI.
@param <L> the generic type
@param uri the uri
@param result the result
@return the l | [
"Extract",
"place",
"holders",
"from",
"URI",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/uri/ContentUriChecker.java#L189-L207 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.batchWriteItem | public BatchWriteItemResult batchWriteItem(BatchWriteItemRequest batchWriteItemRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(batchWriteItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<BatchWriteItemRequest> request = marshall(
batchWriteItemRequest, new BatchWriteItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<BatchWriteItemResult, JsonUnmarshallerContext> unmarshaller = new BatchWriteItemResultJsonUnmarshaller();
JsonResponseHandler<BatchWriteItemResult> responseHandler = new JsonResponseHandler<BatchWriteItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | java | public BatchWriteItemResult batchWriteItem(BatchWriteItemRequest batchWriteItemRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(batchWriteItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<BatchWriteItemRequest> request = marshall(
batchWriteItemRequest, new BatchWriteItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<BatchWriteItemResult, JsonUnmarshallerContext> unmarshaller = new BatchWriteItemResultJsonUnmarshaller();
JsonResponseHandler<BatchWriteItemResult> responseHandler = new JsonResponseHandler<BatchWriteItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | [
"public",
"BatchWriteItemResult",
"batchWriteItem",
"(",
"BatchWriteItemRequest",
"batchWriteItemRequest",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"ExecutionContext",
"executionContext",
"=",
"createExecutionContext",
"(",
"batchWriteItemRequest"... | <p>
Allows to execute a batch of Put and/or Delete Requests for many
tables in a single call. A total of 25 requests are allowed.
</p>
<p>
There are no transaction guarantees provided by this API. It does not
allow conditional puts nor does it support return values.
</p>
@param batchWriteItemRequest Container for the necessary parameters to
execute the BatchWriteItem service method on AmazonDynamoDB.
@return The response from the BatchWriteItem service method, as
returned by AmazonDynamoDB.
@throws LimitExceededException
@throws ProvisionedThroughputExceededException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue. | [
"<p",
">",
"Allows",
"to",
"execute",
"a",
"batch",
"of",
"Put",
"and",
"/",
"or",
"Delete",
"Requests",
"for",
"many",
"tables",
"in",
"a",
"single",
"call",
".",
"A",
"total",
"of",
"25",
"requests",
"are",
"allowed",
".",
"<",
"/",
"p",
">",
"<p... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L457-L469 |
jenkinsci/github-plugin | src/main/java/com/cloudbees/jenkins/GitHubRepositoryNameContributor.java | GitHubRepositoryNameContributor.parseAssociatedNames | @SuppressWarnings("deprecation")
public /*abstract*/ void parseAssociatedNames(Item item, Collection<GitHubRepositoryName> result) {
if (Util.isOverridden(
GitHubRepositoryNameContributor.class,
getClass(),
"parseAssociatedNames",
Job.class,
Collection.class
)) {
// if this impl is legacy, it cannot contribute to non-jobs, so not an error
if (item instanceof Job) {
parseAssociatedNames((Job<?, ?>) item, result);
}
} else if (Util.isOverridden(
GitHubRepositoryNameContributor.class,
getClass(),
"parseAssociatedNames",
AbstractProject.class,
Collection.class
)) {
// if this impl is legacy, it cannot contribute to non-projects, so not an error
if (item instanceof AbstractProject) {
parseAssociatedNames((AbstractProject<?, ?>) item, result);
}
} else {
throw new AbstractMethodError("you must override the new overload of parseAssociatedNames");
}
} | java | @SuppressWarnings("deprecation")
public /*abstract*/ void parseAssociatedNames(Item item, Collection<GitHubRepositoryName> result) {
if (Util.isOverridden(
GitHubRepositoryNameContributor.class,
getClass(),
"parseAssociatedNames",
Job.class,
Collection.class
)) {
// if this impl is legacy, it cannot contribute to non-jobs, so not an error
if (item instanceof Job) {
parseAssociatedNames((Job<?, ?>) item, result);
}
} else if (Util.isOverridden(
GitHubRepositoryNameContributor.class,
getClass(),
"parseAssociatedNames",
AbstractProject.class,
Collection.class
)) {
// if this impl is legacy, it cannot contribute to non-projects, so not an error
if (item instanceof AbstractProject) {
parseAssociatedNames((AbstractProject<?, ?>) item, result);
}
} else {
throw new AbstractMethodError("you must override the new overload of parseAssociatedNames");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"/*abstract*/",
"void",
"parseAssociatedNames",
"(",
"Item",
"item",
",",
"Collection",
"<",
"GitHubRepositoryName",
">",
"result",
")",
"{",
"if",
"(",
"Util",
".",
"isOverridden",
"(",
"GitHubReposi... | Looks at the definition of {@link Item} and list up the related github repositories,
then puts them into the collection.
@param item the item.
@param result the collection to add repository names to
@since 1.25.0 | [
"Looks",
"at",
"the",
"definition",
"of",
"{"
] | train | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/com/cloudbees/jenkins/GitHubRepositoryNameContributor.java#L64-L91 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java | SecurityCenterClient.groupFindings | public final GroupFindingsPagedResponse groupFindings(String parent, String groupBy) {
GroupFindingsRequest request =
GroupFindingsRequest.newBuilder().setParent(parent).setGroupBy(groupBy).build();
return groupFindings(request);
} | java | public final GroupFindingsPagedResponse groupFindings(String parent, String groupBy) {
GroupFindingsRequest request =
GroupFindingsRequest.newBuilder().setParent(parent).setGroupBy(groupBy).build();
return groupFindings(request);
} | [
"public",
"final",
"GroupFindingsPagedResponse",
"groupFindings",
"(",
"String",
"parent",
",",
"String",
"groupBy",
")",
"{",
"GroupFindingsRequest",
"request",
"=",
"GroupFindingsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"... | Filters an organization or source's findings and groups them by their specified properties.
<p>To group across all sources provide a `-` as the source id. Example:
/v1/organizations/123/sources/-/findings
<p>Sample code:
<pre><code>
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String groupBy = "";
for (GroupResult element : securityCenterClient.groupFindings(parent.toString(), groupBy).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Name of the source to groupBy. Its format is
"organizations/[organization_id]/sources/[source_id]". To groupBy across all sources
provide a source_id of `-`. For example: organizations/123/sources/-
@param groupBy Expression that defines what assets fields to use for grouping (including
`state_change`). The string value should follow SQL syntax: comma separated list of fields.
For example: "parent,resource_name".
<p>The following fields are supported:
<p>* resource_name * category * state * parent
<p>The following fields are supported when compare_duration is set:
<p>* state_change
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Filters",
"an",
"organization",
"or",
"source",
"s",
"findings",
"and",
"groups",
"them",
"by",
"their",
"specified",
"properties",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L853-L857 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/FilterQuery.java | FilterQuery.addFilter | public void addFilter(String field, String valueToFilter){
if(StringUtils.isEmpty(field) || StringUtils.isEmpty(valueToFilter)){
throw new IllegalArgumentException("Expected all attributes to be non empty");
}
Set<String> valuesToFilter = new HashSet<String>();
valuesToFilter.add(valueToFilter);
filterQueries.put(field, new FilterFieldValue(field, valuesToFilter));
} | java | public void addFilter(String field, String valueToFilter){
if(StringUtils.isEmpty(field) || StringUtils.isEmpty(valueToFilter)){
throw new IllegalArgumentException("Expected all attributes to be non empty");
}
Set<String> valuesToFilter = new HashSet<String>();
valuesToFilter.add(valueToFilter);
filterQueries.put(field, new FilterFieldValue(field, valuesToFilter));
} | [
"public",
"void",
"addFilter",
"(",
"String",
"field",
",",
"String",
"valueToFilter",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"field",
")",
"||",
"StringUtils",
".",
"isEmpty",
"(",
"valueToFilter",
")",
")",
"{",
"throw",
"new",
"Illegal... | add a filter to the to build FilterQuery instance
@param field
@param valueToFilter | [
"add",
"a",
"filter",
"to",
"the",
"to",
"build",
"FilterQuery",
"instance"
] | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/FilterQuery.java#L91-L98 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.usedToProduce | public static Pattern usedToProduce(Blacklist blacklist)
{
Pattern p = new Pattern(SmallMoleculeReference.class, "SMR1");
p.add(erToPE(), "SMR1", "SPE1");
p.add(notGeneric(), "SPE1");
p.add(linkToComplex(blacklist), "SPE1", "PE1");
p.add(new ParticipatesInConv(RelType.INPUT, blacklist), "PE1", "Conv");
p.add(type(BiochemicalReaction.class), "Conv");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR1");
p.add(new ConversionSide(ConversionSide.Type.OTHER_SIDE, blacklist, RelType.OUTPUT), "PE1", "Conv", "PE2");
p.add(type(SmallMolecule.class), "PE2");
p.add(linkToSimple(blacklist), "PE2", "SPE2");
p.add(notGeneric(), "SPE2");
p.add(equal(false), "SPE1", "SPE2");
p.add(peToER(), "SPE2", "SMR2");
p.add(equal(false), "SMR1", "SMR2");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR2");
return p;
} | java | public static Pattern usedToProduce(Blacklist blacklist)
{
Pattern p = new Pattern(SmallMoleculeReference.class, "SMR1");
p.add(erToPE(), "SMR1", "SPE1");
p.add(notGeneric(), "SPE1");
p.add(linkToComplex(blacklist), "SPE1", "PE1");
p.add(new ParticipatesInConv(RelType.INPUT, blacklist), "PE1", "Conv");
p.add(type(BiochemicalReaction.class), "Conv");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR1");
p.add(new ConversionSide(ConversionSide.Type.OTHER_SIDE, blacklist, RelType.OUTPUT), "PE1", "Conv", "PE2");
p.add(type(SmallMolecule.class), "PE2");
p.add(linkToSimple(blacklist), "PE2", "SPE2");
p.add(notGeneric(), "SPE2");
p.add(equal(false), "SPE1", "SPE2");
p.add(peToER(), "SPE2", "SMR2");
p.add(equal(false), "SMR1", "SMR2");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR2");
return p;
} | [
"public",
"static",
"Pattern",
"usedToProduce",
"(",
"Blacklist",
"blacklist",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"SmallMoleculeReference",
".",
"class",
",",
"\"SMR1\"",
")",
";",
"p",
".",
"add",
"(",
"erToPE",
"(",
")",
",",
"\"SMR1\"... | Constructs a pattern where first small molecule is an input a biochemical reaction that
produces the second small molecule.
biochemical reaction.
@param blacklist a skip-list of ubiquitous molecules
@return the pattern | [
"Constructs",
"a",
"pattern",
"where",
"first",
"small",
"molecule",
"is",
"an",
"input",
"a",
"biochemical",
"reaction",
"that",
"produces",
"the",
"second",
"small",
"molecule",
".",
"biochemical",
"reaction",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L622-L640 |
pkiraly/metadata-qa-api | src/main/java/de/gwdg/metadataqa/api/model/JsonPathCache.java | JsonPathCache.getFragment | public Object getFragment(String address, String jsonPath, Object jsonFragment) {
Object jsonFragment2 = null;
if (!fragmentCache.containsKey(address)) {
jsonFragment2 = read(jsonPath, jsonFragment);
fragmentCache.put(address, jsonFragment2);
} else {
jsonFragment2 = fragmentCache.get(address);
}
return jsonFragment2;
} | java | public Object getFragment(String address, String jsonPath, Object jsonFragment) {
Object jsonFragment2 = null;
if (!fragmentCache.containsKey(address)) {
jsonFragment2 = read(jsonPath, jsonFragment);
fragmentCache.put(address, jsonFragment2);
} else {
jsonFragment2 = fragmentCache.get(address);
}
return jsonFragment2;
} | [
"public",
"Object",
"getFragment",
"(",
"String",
"address",
",",
"String",
"jsonPath",
",",
"Object",
"jsonFragment",
")",
"{",
"Object",
"jsonFragment2",
"=",
"null",
";",
"if",
"(",
"!",
"fragmentCache",
".",
"containsKey",
"(",
"address",
")",
")",
"{",
... | Get a JSON fragment from cache.
@param address - a unique address for cahce
@param jsonPath - a JSON path expression
@param jsonFragment - a JSON fragment in which the path should be searched for
@return
The JSON fragment | [
"Get",
"a",
"JSON",
"fragment",
"from",
"cache",
"."
] | train | https://github.com/pkiraly/metadata-qa-api/blob/622a69e7c1628ccf64047070817ecfaa68f15b1d/src/main/java/de/gwdg/metadataqa/api/model/JsonPathCache.java#L124-L133 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java | ModelHandler.formCopyToModelIF | public void formCopyToModelIF(ModelForm form, Object model) throws Exception {
if (model == null || form == null)
return;
if (model instanceof Model) { // for below 1.4 version
formCopyToModel(form, (Model) model);
return;
}
try {
PropertyUtils.copyProperties(model, form);
} catch (InvocationTargetException ie) {
String error = "error happened in getXXX method of ModelForm:" + form.getClass().getName() + " error:" + ie;
Debug.logError(error, module);
throw new Exception(error);
} catch (Exception e) {
String error = " ModelForm:" + form.getClass().getName() + " copy To Model:" + model.getClass().getName() + " error:" + e;
Debug.logError(error, module);
throw new Exception(error);
}
} | java | public void formCopyToModelIF(ModelForm form, Object model) throws Exception {
if (model == null || form == null)
return;
if (model instanceof Model) { // for below 1.4 version
formCopyToModel(form, (Model) model);
return;
}
try {
PropertyUtils.copyProperties(model, form);
} catch (InvocationTargetException ie) {
String error = "error happened in getXXX method of ModelForm:" + form.getClass().getName() + " error:" + ie;
Debug.logError(error, module);
throw new Exception(error);
} catch (Exception e) {
String error = " ModelForm:" + form.getClass().getName() + " copy To Model:" + model.getClass().getName() + " error:" + e;
Debug.logError(error, module);
throw new Exception(error);
}
} | [
"public",
"void",
"formCopyToModelIF",
"(",
"ModelForm",
"form",
",",
"Object",
"model",
")",
"throws",
"Exception",
"{",
"if",
"(",
"model",
"==",
"null",
"||",
"form",
"==",
"null",
")",
"return",
";",
"if",
"(",
"model",
"instanceof",
"Model",
")",
"{... | ModelForm object's data transfer to Model object
default implemention is copy mapping between with them;
another implemention: String propertyName =
StringUtil.getLastString(model.getClass().getName()); Model hasDataModel
= PropertyUtils.getProperty(form, propertyName); model = hasDataModel;
extends this class , and override this method
@param model
@param form
@throws java.lang.Exception | [
"ModelForm",
"object",
"s",
"data",
"transfer",
"to",
"Model",
"object"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/ModelHandler.java#L214-L233 |
dbracewell/hermes | hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/io/WordNetPropertyLoader.java | WordNetPropertyLoader.setProperty | protected final void setProperty(Synset synset, PropertyName name, Property property) {
Cast.as(synset, SynsetImpl.class).setProperty(name, property);
} | java | protected final void setProperty(Synset synset, PropertyName name, Property property) {
Cast.as(synset, SynsetImpl.class).setProperty(name, property);
} | [
"protected",
"final",
"void",
"setProperty",
"(",
"Synset",
"synset",
",",
"PropertyName",
"name",
",",
"Property",
"property",
")",
"{",
"Cast",
".",
"as",
"(",
"synset",
",",
"SynsetImpl",
".",
"class",
")",
".",
"setProperty",
"(",
"name",
",",
"propert... | Set property.
@param synset the synset
@param name the name
@param property the property | [
"Set",
"property",
"."
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/io/WordNetPropertyLoader.java#L52-L54 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/RoundedBitmapDrawable.java | RoundedBitmapDrawable.fromBitmapDrawable | public static RoundedBitmapDrawable fromBitmapDrawable(
Resources res,
BitmapDrawable bitmapDrawable) {
return new RoundedBitmapDrawable(res, bitmapDrawable.getBitmap(), bitmapDrawable.getPaint());
} | java | public static RoundedBitmapDrawable fromBitmapDrawable(
Resources res,
BitmapDrawable bitmapDrawable) {
return new RoundedBitmapDrawable(res, bitmapDrawable.getBitmap(), bitmapDrawable.getPaint());
} | [
"public",
"static",
"RoundedBitmapDrawable",
"fromBitmapDrawable",
"(",
"Resources",
"res",
",",
"BitmapDrawable",
"bitmapDrawable",
")",
"{",
"return",
"new",
"RoundedBitmapDrawable",
"(",
"res",
",",
"bitmapDrawable",
".",
"getBitmap",
"(",
")",
",",
"bitmapDrawable... | Creates a new RoundedBitmapDrawable from the given BitmapDrawable.
@param res resources to use for this drawable
@param bitmapDrawable bitmap drawable containing the bitmap to be used for this drawable
@return the RoundedBitmapDrawable that is created | [
"Creates",
"a",
"new",
"RoundedBitmapDrawable",
"from",
"the",
"given",
"BitmapDrawable",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedBitmapDrawable.java#L93-L97 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocation.java | KvStateLocation.registerKvState | public void registerKvState(KeyGroupRange keyGroupRange, KvStateID kvStateId, InetSocketAddress kvStateAddress) {
if (keyGroupRange.getStartKeyGroup() < 0 || keyGroupRange.getEndKeyGroup() >= numKeyGroups) {
throw new IndexOutOfBoundsException("Key group index");
}
for (int kgIdx = keyGroupRange.getStartKeyGroup(); kgIdx <= keyGroupRange.getEndKeyGroup(); ++kgIdx) {
if (kvStateIds[kgIdx] == null && kvStateAddresses[kgIdx] == null) {
numRegisteredKeyGroups++;
}
kvStateIds[kgIdx] = kvStateId;
kvStateAddresses[kgIdx] = kvStateAddress;
}
} | java | public void registerKvState(KeyGroupRange keyGroupRange, KvStateID kvStateId, InetSocketAddress kvStateAddress) {
if (keyGroupRange.getStartKeyGroup() < 0 || keyGroupRange.getEndKeyGroup() >= numKeyGroups) {
throw new IndexOutOfBoundsException("Key group index");
}
for (int kgIdx = keyGroupRange.getStartKeyGroup(); kgIdx <= keyGroupRange.getEndKeyGroup(); ++kgIdx) {
if (kvStateIds[kgIdx] == null && kvStateAddresses[kgIdx] == null) {
numRegisteredKeyGroups++;
}
kvStateIds[kgIdx] = kvStateId;
kvStateAddresses[kgIdx] = kvStateAddress;
}
} | [
"public",
"void",
"registerKvState",
"(",
"KeyGroupRange",
"keyGroupRange",
",",
"KvStateID",
"kvStateId",
",",
"InetSocketAddress",
"kvStateAddress",
")",
"{",
"if",
"(",
"keyGroupRange",
".",
"getStartKeyGroup",
"(",
")",
"<",
"0",
"||",
"keyGroupRange",
".",
"g... | Registers a KvState instance for the given key group index.
@param keyGroupRange Key group range to register
@param kvStateId ID of the KvState instance at the key group index.
@param kvStateAddress Server address of the KvState instance at the key group index.
@throws IndexOutOfBoundsException If key group range start < 0 or key group range end >= Number of key groups | [
"Registers",
"a",
"KvState",
"instance",
"for",
"the",
"given",
"key",
"group",
"index",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocation.java#L171-L186 |
UrielCh/ovh-java-sdk | ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java | ApiOvhHorizonView.serviceName_accessPoint_accessPointId_changeSessionTimeout_POST | public OvhTask serviceName_accessPoint_accessPointId_changeSessionTimeout_POST(String serviceName, Long accessPointId, Long expiration, OvhAccessPointTypeEnum onSingleAP) throws IOException {
String qPath = "/horizonView/{serviceName}/accessPoint/{accessPointId}/changeSessionTimeout";
StringBuilder sb = path(qPath, serviceName, accessPointId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "expiration", expiration);
addBody(o, "onSingleAP", onSingleAP);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_accessPoint_accessPointId_changeSessionTimeout_POST(String serviceName, Long accessPointId, Long expiration, OvhAccessPointTypeEnum onSingleAP) throws IOException {
String qPath = "/horizonView/{serviceName}/accessPoint/{accessPointId}/changeSessionTimeout";
StringBuilder sb = path(qPath, serviceName, accessPointId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "expiration", expiration);
addBody(o, "onSingleAP", onSingleAP);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_accessPoint_accessPointId_changeSessionTimeout_POST",
"(",
"String",
"serviceName",
",",
"Long",
"accessPointId",
",",
"Long",
"expiration",
",",
"OvhAccessPointTypeEnum",
"onSingleAP",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
... | Manage your session Timeout on Unified Access Gateway
REST: POST /horizonView/{serviceName}/accessPoint/{accessPointId}/changeSessionTimeout
@param onSingleAP [required] Update timeout session on a single Unified Access Gateway (only for hybrid Pool)
@param expiration [required] Timeout (in hour)
@param serviceName [required] Domain of the service
@param accessPointId [required] Pool id | [
"Manage",
"your",
"session",
"Timeout",
"on",
"Unified",
"Access",
"Gateway"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L57-L65 |
rubenlagus/TelegramBots | telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/InputFile.java | InputFile.setMedia | public InputFile setMedia(InputStream mediaStream, String fileName) {
this.newMediaStream = mediaStream;
this.mediaName = fileName;
this.attachName = "attach://" + fileName;
this.isNew = true;
return this;
} | java | public InputFile setMedia(InputStream mediaStream, String fileName) {
this.newMediaStream = mediaStream;
this.mediaName = fileName;
this.attachName = "attach://" + fileName;
this.isNew = true;
return this;
} | [
"public",
"InputFile",
"setMedia",
"(",
"InputStream",
"mediaStream",
",",
"String",
"fileName",
")",
"{",
"this",
".",
"newMediaStream",
"=",
"mediaStream",
";",
"this",
".",
"mediaName",
"=",
"fileName",
";",
"this",
".",
"attachName",
"=",
"\"attach://\"",
... | Use this setter to send new file as stream.
@param mediaStream File to send
@param fileName Name of the file
@return This object | [
"Use",
"this",
"setter",
"to",
"send",
"new",
"file",
"as",
"stream",
"."
] | train | https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/InputFile.java#L84-L90 |
apache/incubator-gobblin | gobblin-modules/gobblin-crypto-provider/src/main/java/org/apache/gobblin/crypto/GobblinEncryptionProvider.java | GobblinEncryptionProvider.buildStreamEncryptor | public StreamCodec buildStreamEncryptor(Map<String, Object> parameters) {
String encryptionType = EncryptionConfigParser.getEncryptionType(parameters);
if (encryptionType == null) {
throw new IllegalArgumentException("Encryption type not present in parameters!");
}
return buildStreamCryptoProvider(encryptionType, parameters);
} | java | public StreamCodec buildStreamEncryptor(Map<String, Object> parameters) {
String encryptionType = EncryptionConfigParser.getEncryptionType(parameters);
if (encryptionType == null) {
throw new IllegalArgumentException("Encryption type not present in parameters!");
}
return buildStreamCryptoProvider(encryptionType, parameters);
} | [
"public",
"StreamCodec",
"buildStreamEncryptor",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"String",
"encryptionType",
"=",
"EncryptionConfigParser",
".",
"getEncryptionType",
"(",
"parameters",
")",
";",
"if",
"(",
"encryptionType",
"... | Return a StreamEncryptor for the given parameters. The algorithm type to use will be extracted
from the parameters object.
@param parameters Configured parameters for algorithm.
@return A StreamCodec for the requested algorithm
@throws IllegalArgumentException If the given algorithm/parameter pair cannot be built | [
"Return",
"a",
"StreamEncryptor",
"for",
"the",
"given",
"parameters",
".",
"The",
"algorithm",
"type",
"to",
"use",
"will",
"be",
"extracted",
"from",
"the",
"parameters",
"object",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-crypto-provider/src/main/java/org/apache/gobblin/crypto/GobblinEncryptionProvider.java#L60-L67 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableNavigatorContext.java | PortableNavigatorContext.populateAnyNavigationFrames | void populateAnyNavigationFrames(int pathTokenIndex, int len) {
// populate "recursive" multi-positions
if (multiPositions == null) {
// lazy-init only if necessary
multiPositions = new ArrayDeque<NavigationFrame>();
}
for (int cellIndex = len - 1; cellIndex > 0; cellIndex--) {
multiPositions.addFirst(new NavigationFrame(cd, pathTokenIndex, cellIndex, in.position(), offset));
}
} | java | void populateAnyNavigationFrames(int pathTokenIndex, int len) {
// populate "recursive" multi-positions
if (multiPositions == null) {
// lazy-init only if necessary
multiPositions = new ArrayDeque<NavigationFrame>();
}
for (int cellIndex = len - 1; cellIndex > 0; cellIndex--) {
multiPositions.addFirst(new NavigationFrame(cd, pathTokenIndex, cellIndex, in.position(), offset));
}
} | [
"void",
"populateAnyNavigationFrames",
"(",
"int",
"pathTokenIndex",
",",
"int",
"len",
")",
"{",
"// populate \"recursive\" multi-positions",
"if",
"(",
"multiPositions",
"==",
"null",
")",
"{",
"// lazy-init only if necessary",
"multiPositions",
"=",
"new",
"ArrayDeque"... | Populates the context with multi-positions that have to be processed later on in the navigation process.
The contract is that the cell[0] path is read in the non-multi-position navigation.
Cells[1, len-1] are stored in the multi-positions and will be followed up on later on. | [
"Populates",
"the",
"context",
"with",
"multi",
"-",
"positions",
"that",
"have",
"to",
"be",
"processed",
"later",
"on",
"in",
"the",
"navigation",
"process",
".",
"The",
"contract",
"is",
"that",
"the",
"cell",
"[",
"0",
"]",
"path",
"is",
"read",
"in"... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableNavigatorContext.java#L179-L188 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/SingleInputSemanticProperties.java | SingleInputSemanticProperties.addForwardedField | public void addForwardedField(int sourceField, int targetField) {
if(isTargetFieldPresent(targetField)) {
throw new InvalidSemanticAnnotationException("Target field "+targetField+" was added twice.");
}
FieldSet targetFields = fieldMapping.get(sourceField);
if (targetFields != null) {
fieldMapping.put(sourceField, targetFields.addField(targetField));
} else {
fieldMapping.put(sourceField, new FieldSet(targetField));
}
} | java | public void addForwardedField(int sourceField, int targetField) {
if(isTargetFieldPresent(targetField)) {
throw new InvalidSemanticAnnotationException("Target field "+targetField+" was added twice.");
}
FieldSet targetFields = fieldMapping.get(sourceField);
if (targetFields != null) {
fieldMapping.put(sourceField, targetFields.addField(targetField));
} else {
fieldMapping.put(sourceField, new FieldSet(targetField));
}
} | [
"public",
"void",
"addForwardedField",
"(",
"int",
"sourceField",
",",
"int",
"targetField",
")",
"{",
"if",
"(",
"isTargetFieldPresent",
"(",
"targetField",
")",
")",
"{",
"throw",
"new",
"InvalidSemanticAnnotationException",
"(",
"\"Target field \"",
"+",
"targetF... | Adds, to the existing information, a field that is forwarded directly
from the source record(s) to the destination record(s).
@param sourceField the position in the source record(s)
@param targetField the position in the destination record(s) | [
"Adds",
"to",
"the",
"existing",
"information",
"a",
"field",
"that",
"is",
"forwarded",
"directly",
"from",
"the",
"source",
"record",
"(",
"s",
")",
"to",
"the",
"destination",
"record",
"(",
"s",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/SingleInputSemanticProperties.java#L89-L100 |
Stratio/deep-spark | deep-cassandra/src/main/java/com/stratio/deep/cassandra/cql/RangeUtils.java | RangeUtils.getSplitsBySize | public static List<DeepTokenRange> getSplitsBySize(
CassandraDeepJobConfig config) {
IPartitioner p = getPartitioner(config);
AbstractType tokenValidator = p.getTokenValidator();
Pair<Session, String> sessionWithHost = CassandraClientProvider
.getSession(config.getHost(), config, false);
String query = new StringBuilder("CALCULATE SPLITS FROM ")
.append(config.getKeyspace()).append(".")
.append(config.getTable()).append(" ESTIMATING ")
.append(config.getSplitSize()).toString();
ResultSet rSet = sessionWithHost.left.execute(query);
List<DeepTokenRange> tokens = new ArrayList<>();
for (Row row : rSet.all()) {
Comparable startToken = (Comparable) tokenValidator.compose(row
.getBytesUnsafe("start_token"));
Comparable endToken = (Comparable) tokenValidator.compose(row
.getBytesUnsafe("end_token"));
List<String> replicas = new ArrayList<>();
for (InetAddress addres : row.getList("preferred_locations",
InetAddress.class)) {
replicas.add(addres.getHostName());
}
tokens.add(new DeepTokenRange(startToken, endToken, replicas));
}
return tokens;
} | java | public static List<DeepTokenRange> getSplitsBySize(
CassandraDeepJobConfig config) {
IPartitioner p = getPartitioner(config);
AbstractType tokenValidator = p.getTokenValidator();
Pair<Session, String> sessionWithHost = CassandraClientProvider
.getSession(config.getHost(), config, false);
String query = new StringBuilder("CALCULATE SPLITS FROM ")
.append(config.getKeyspace()).append(".")
.append(config.getTable()).append(" ESTIMATING ")
.append(config.getSplitSize()).toString();
ResultSet rSet = sessionWithHost.left.execute(query);
List<DeepTokenRange> tokens = new ArrayList<>();
for (Row row : rSet.all()) {
Comparable startToken = (Comparable) tokenValidator.compose(row
.getBytesUnsafe("start_token"));
Comparable endToken = (Comparable) tokenValidator.compose(row
.getBytesUnsafe("end_token"));
List<String> replicas = new ArrayList<>();
for (InetAddress addres : row.getList("preferred_locations",
InetAddress.class)) {
replicas.add(addres.getHostName());
}
tokens.add(new DeepTokenRange(startToken, endToken, replicas));
}
return tokens;
} | [
"public",
"static",
"List",
"<",
"DeepTokenRange",
">",
"getSplitsBySize",
"(",
"CassandraDeepJobConfig",
"config",
")",
"{",
"IPartitioner",
"p",
"=",
"getPartitioner",
"(",
"config",
")",
";",
"AbstractType",
"tokenValidator",
"=",
"p",
".",
"getTokenValidator",
... | Returns the token ranges that will be mapped to Spark partitions.
@param config the Deep configuration object.
@return the list of computed token ranges. | [
"Returns",
"the",
"token",
"ranges",
"that",
"will",
"be",
"mapped",
"to",
"Spark",
"partitions",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/cql/RangeUtils.java#L357-L387 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java | Levenshtein.NGram | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T NGram(String baseTarget, String compareTarget, Integer n) {
return (T) new NGram(baseTarget, n).update(compareTarget);
} | java | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T NGram(String baseTarget, String compareTarget, Integer n) {
return (T) new NGram(baseTarget, n).update(compareTarget);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Levenshtein",
">",
"T",
"NGram",
"(",
"String",
"baseTarget",
",",
"String",
"compareTarget",
",",
"Integer",
"n",
")",
"{",
"return",
"(",
"T",
")",
"new",
"NGra... | Returns an new n-Gram distance (Kondrak) instance with compare target string and n
@see NGram
@param baseTarget
@param compareTarget
@param n
@return | [
"Returns",
"an",
"new",
"n",
"-",
"Gram",
"distance",
"(",
"Kondrak",
")",
"instance",
"with",
"compare",
"target",
"string",
"and",
"n"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L234-L237 |
OpenTSDB/opentsdb | src/core/TSQuery.java | TSQuery.buildQueries | public Query[] buildQueries(final TSDB tsdb) {
try {
return buildQueriesAsync(tsdb).joinUninterruptibly();
} catch (final Exception e) {
throw new RuntimeException("Unexpected exception", e);
}
} | java | public Query[] buildQueries(final TSDB tsdb) {
try {
return buildQueriesAsync(tsdb).joinUninterruptibly();
} catch (final Exception e) {
throw new RuntimeException("Unexpected exception", e);
}
} | [
"public",
"Query",
"[",
"]",
"buildQueries",
"(",
"final",
"TSDB",
"tsdb",
")",
"{",
"try",
"{",
"return",
"buildQueriesAsync",
"(",
"tsdb",
")",
".",
"joinUninterruptibly",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"throw",
... | Compiles the TSQuery into an array of Query objects for execution.
If the user has not set a down sampler explicitly, and they don't want
millisecond resolution, then we set the down sampler to 1 second to handle
situations where storage may have multiple data points per second.
@param tsdb The tsdb to use for {@link TSDB#newQuery}
@return An array of queries | [
"Compiles",
"the",
"TSQuery",
"into",
"an",
"array",
"of",
"Query",
"objects",
"for",
"execution",
".",
"If",
"the",
"user",
"has",
"not",
"set",
"a",
"down",
"sampler",
"explicitly",
"and",
"they",
"don",
"t",
"want",
"millisecond",
"resolution",
"then",
... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TSQuery.java#L220-L226 |
mgormley/prim | src/main/java/edu/jhu/prim/arrays/Multinomials.java | Multinomials.assertLogNormalized | public static void assertLogNormalized(double[] logProps, double delta) {
double logPropSum = DoubleArrays.logSum(logProps);
assert(Primitives.equals(0.0, logPropSum, delta));
} | java | public static void assertLogNormalized(double[] logProps, double delta) {
double logPropSum = DoubleArrays.logSum(logProps);
assert(Primitives.equals(0.0, logPropSum, delta));
} | [
"public",
"static",
"void",
"assertLogNormalized",
"(",
"double",
"[",
"]",
"logProps",
",",
"double",
"delta",
")",
"{",
"double",
"logPropSum",
"=",
"DoubleArrays",
".",
"logSum",
"(",
"logProps",
")",
";",
"assert",
"(",
"Primitives",
".",
"equals",
"(",
... | Asserts that the parameters are log-normalized within some delta. | [
"Asserts",
"that",
"the",
"parameters",
"are",
"log",
"-",
"normalized",
"within",
"some",
"delta",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/Multinomials.java#L91-L94 |
google/error-prone | check_api/src/main/java/com/google/errorprone/apply/SourceFile.java | SourceFile.replaceLines | public void replaceLines(int startLine, int endLine, List<String> replacementLines) {
Preconditions.checkArgument(startLine <= endLine);
List<String> originalLines = getLines();
List<String> newLines = new ArrayList<>();
for (int i = 0; i < originalLines.size(); i++) {
int lineNum = i + 1;
if (lineNum == startLine) {
newLines.addAll(replacementLines);
} else if (lineNum > startLine && lineNum <= endLine) {
// Skip
} else {
newLines.add(originalLines.get(i));
}
}
replaceLines(newLines);
} | java | public void replaceLines(int startLine, int endLine, List<String> replacementLines) {
Preconditions.checkArgument(startLine <= endLine);
List<String> originalLines = getLines();
List<String> newLines = new ArrayList<>();
for (int i = 0; i < originalLines.size(); i++) {
int lineNum = i + 1;
if (lineNum == startLine) {
newLines.addAll(replacementLines);
} else if (lineNum > startLine && lineNum <= endLine) {
// Skip
} else {
newLines.add(originalLines.get(i));
}
}
replaceLines(newLines);
} | [
"public",
"void",
"replaceLines",
"(",
"int",
"startLine",
",",
"int",
"endLine",
",",
"List",
"<",
"String",
">",
"replacementLines",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"startLine",
"<=",
"endLine",
")",
";",
"List",
"<",
"String",
">",
... | Replace the source code between the start and end lines with some new lines of code. | [
"Replace",
"the",
"source",
"code",
"between",
"the",
"start",
"and",
"end",
"lines",
"with",
"some",
"new",
"lines",
"of",
"code",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/apply/SourceFile.java#L127-L142 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java | WCheckBoxSelectExample.addExampleUsingLookupTable | private void addExampleUsingLookupTable() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using a lookup table"));
final WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected states are: "
+ select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
add(new WLabel("Select a state or territory", select));
add(select);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | java | private void addExampleUsingLookupTable() {
add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect created using a lookup table"));
final WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select.getSelected().isEmpty() ? NO_SELECTION : "The selected states are: "
+ select.getSelected();
text.setText(output);
}
});
select.setDefaultSubmitButton(update);
add(new WLabel("Select a state or territory", select));
add(select);
add(update);
add(text);
add(new WAjaxControl(update, text));
} | [
"private",
"void",
"addExampleUsingLookupTable",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WCheckBoxSelect created using a lookup table\"",
")",
")",
";",
"final",
"WCheckBoxSelect",
"select",
"=",
"new",
"WCheckBoxSelect",
... | This example creates the WCheckBoxSelect using an a look up table. All other optional properties are in their default state.
<p>Note for Framework devs: the unit tests for this Example are used to test the Selenium WebElement extension and this example is expected
to be: the first WCheckBoxSelect in the example; and to be interactive; and to have the 9 options of the "australian_state" lookup table. | [
"This",
"example",
"creates",
"the",
"WCheckBoxSelect",
"using",
"an",
"a",
"look",
"up",
"table",
".",
"All",
"other",
"optional",
"properties",
"are",
"in",
"their",
"default",
"state",
".",
"<p",
">",
"Note",
"for",
"Framework",
"devs",
":",
"the",
"uni... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L83-L105 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/http/matcher/MatchInfo.java | MatchInfo.fromUri | public static MatchInfo fromUri(final URI uri, final HttpMethod method) {
int newPort = uri.getPort();
if (newPort < 0) {
try {
newPort = uri.toURL().getDefaultPort();
} catch (MalformedURLException | IllegalArgumentException e) {
newPort = ANY_PORT;
}
}
return new MatchInfo(uri.getScheme(), uri.getHost(), newPort, uri.getPath(), uri.getQuery(),
uri.getFragment(), ANY_REALM, method);
} | java | public static MatchInfo fromUri(final URI uri, final HttpMethod method) {
int newPort = uri.getPort();
if (newPort < 0) {
try {
newPort = uri.toURL().getDefaultPort();
} catch (MalformedURLException | IllegalArgumentException e) {
newPort = ANY_PORT;
}
}
return new MatchInfo(uri.getScheme(), uri.getHost(), newPort, uri.getPath(), uri.getQuery(),
uri.getFragment(), ANY_REALM, method);
} | [
"public",
"static",
"MatchInfo",
"fromUri",
"(",
"final",
"URI",
"uri",
",",
"final",
"HttpMethod",
"method",
")",
"{",
"int",
"newPort",
"=",
"uri",
".",
"getPort",
"(",
")",
";",
"if",
"(",
"newPort",
"<",
"0",
")",
"{",
"try",
"{",
"newPort",
"=",... | Create an info object from a uri and the http method object.
@param uri the uri
@param method the method | [
"Create",
"an",
"info",
"object",
"from",
"a",
"uri",
"and",
"the",
"http",
"method",
"object",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/http/matcher/MatchInfo.java#L95-L107 |
arakelian/more-commons | src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java | XmlStreamReaderUtils.optionalIntAttribute | public static int optionalIntAttribute(
final XMLStreamReader reader,
final String localName,
final int defaultValue) {
return optionalIntAttribute(reader, null, localName, defaultValue);
} | java | public static int optionalIntAttribute(
final XMLStreamReader reader,
final String localName,
final int defaultValue) {
return optionalIntAttribute(reader, null, localName, defaultValue);
} | [
"public",
"static",
"int",
"optionalIntAttribute",
"(",
"final",
"XMLStreamReader",
"reader",
",",
"final",
"String",
"localName",
",",
"final",
"int",
"defaultValue",
")",
"{",
"return",
"optionalIntAttribute",
"(",
"reader",
",",
"null",
",",
"localName",
",",
... | Returns the value of an attribute as a int. If the attribute is empty, this method returns
the default value provided.
@param reader
<code>XMLStreamReader</code> that contains attribute values.
@param localName
local name of attribute (the namespace is ignored).
@param defaultValue
default value
@return value of attribute, or the default value if the attribute is empty. | [
"Returns",
"the",
"value",
"of",
"an",
"attribute",
"as",
"a",
"int",
".",
"If",
"the",
"attribute",
"is",
"empty",
"this",
"method",
"returns",
"the",
"default",
"value",
"provided",
"."
] | train | https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L797-L802 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java | CmsForm.updateFieldValidationStatus | protected void updateFieldValidationStatus(I_CmsFormField field, CmsValidationResult result) {
if (result.hasNewValue()) {
if (field.getModel() != null) {
field.getModel().setValue(result.getNewValue(), true);
}
field.getWidget().setFormValueAsString(result.getNewValue());
}
String errorMessage = result.getErrorMessage();
field.getWidget().setErrorMessage(result.getErrorMessage());
field.setValidationStatus(
errorMessage == null ? I_CmsFormField.ValidationStatus.valid : I_CmsFormField.ValidationStatus.invalid);
} | java | protected void updateFieldValidationStatus(I_CmsFormField field, CmsValidationResult result) {
if (result.hasNewValue()) {
if (field.getModel() != null) {
field.getModel().setValue(result.getNewValue(), true);
}
field.getWidget().setFormValueAsString(result.getNewValue());
}
String errorMessage = result.getErrorMessage();
field.getWidget().setErrorMessage(result.getErrorMessage());
field.setValidationStatus(
errorMessage == null ? I_CmsFormField.ValidationStatus.valid : I_CmsFormField.ValidationStatus.invalid);
} | [
"protected",
"void",
"updateFieldValidationStatus",
"(",
"I_CmsFormField",
"field",
",",
"CmsValidationResult",
"result",
")",
"{",
"if",
"(",
"result",
".",
"hasNewValue",
"(",
")",
")",
"{",
"if",
"(",
"field",
".",
"getModel",
"(",
")",
"!=",
"null",
")",... | Updates the field validation status.<p>
@param field the form field
@param result the validation result | [
"Updates",
"the",
"field",
"validation",
"status",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L500-L512 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.toTitleCase | public static String toTitleCase(ULocale locale, String str,
BreakIterator titleIter) {
return toTitleCase(locale, str, titleIter, 0);
} | java | public static String toTitleCase(ULocale locale, String str,
BreakIterator titleIter) {
return toTitleCase(locale, str, titleIter, 0);
} | [
"public",
"static",
"String",
"toTitleCase",
"(",
"ULocale",
"locale",
",",
"String",
"str",
",",
"BreakIterator",
"titleIter",
")",
"{",
"return",
"toTitleCase",
"(",
"locale",
",",
"str",
",",
"titleIter",
",",
"0",
")",
";",
"}"
] | <p>Returns the titlecase version of the argument string.
<p>Position for titlecasing is determined by the argument break
iterator, hence the user can customize his break iterator for
a specialized titlecasing. In this case only the forward iteration
needs to be implemented.
If the break iterator passed in is null, the default Unicode algorithm
will be used to determine the titlecase positions.
<p>Only positions returned by the break iterator will be title cased,
character in between the positions will all be in lower case.
<p>Casing is dependent on the argument locale and context-sensitive
@param locale which string is to be converted in
@param str source string to be performed on
@param titleIter break iterator to determine the positions in which
the character should be title cased.
@return lowercase version of the argument string | [
"<p",
">",
"Returns",
"the",
"titlecase",
"version",
"of",
"the",
"argument",
"string",
".",
"<p",
">",
"Position",
"for",
"titlecasing",
"is",
"determined",
"by",
"the",
"argument",
"break",
"iterator",
"hence",
"the",
"user",
"can",
"customize",
"his",
"br... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4490-L4493 |
lastaflute/lastaflute | src/main/java/org/lastaflute/core/mail/LaTypicalPostcard.java | LaTypicalPostcard.pushUlterior | public void pushUlterior(String key, Object value) {
assertArgumentNotNull("key", key);
assertArgumentNotNull("value", value);
postcard.pushUlterior(key, value);
} | java | public void pushUlterior(String key, Object value) {
assertArgumentNotNull("key", key);
assertArgumentNotNull("value", value);
postcard.pushUlterior(key, value);
} | [
"public",
"void",
"pushUlterior",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"assertArgumentNotNull",
"(",
"\"key\"",
",",
"key",
")",
";",
"assertArgumentNotNull",
"(",
"\"value\"",
",",
"value",
")",
";",
"postcard",
".",
"pushUlterior",
"(",
... | Push element of ulterior parameter. <br>
Basically unused in mailflute, this is for extension by application.
@param key The key of the element. (NotNull)
@param value The value of the element. (NotNull) | [
"Push",
"element",
"of",
"ulterior",
"parameter",
".",
"<br",
">",
"Basically",
"unused",
"in",
"mailflute",
"this",
"is",
"for",
"extension",
"by",
"application",
"."
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/core/mail/LaTypicalPostcard.java#L287-L291 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java | PubSubOutputHandler.createControlNotFlushed | private ControlNotFlushed createControlNotFlushed(SIBUuid8 target, SIBUuid12 stream, long reqID)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createControlNotFlushed", new Object[] {target, stream, new Long(reqID)});
ControlNotFlushed notFlushedMsg;
// Create new message
try
{
notFlushedMsg = _cmf.createNewControlNotFlushed();
}
catch (MessageCreateFailedException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler.createControlNotFlushed",
"1:1498:1.164.1.5",
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "createControlNotFlushed", e);
}
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1510:1.164.1.5",
e });
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1518:1.164.1.5",
e },
null),
e);
}
// As we are using the Guaranteed Header - set all the attributes as
// well as the ones we want.
SIMPUtils.setGuaranteedDeliveryProperties(notFlushedMsg,
_messageProcessor.getMessagingEngineUuid(),
null,
stream,
null,
_destinationHandler.getUuid(),
ProtocolType.PUBSUBINPUT,
GDConfig.PROTOCOL_VERSION);
notFlushedMsg.setPriority(SIMPConstants.CTRL_MSG_PRIORITY);
notFlushedMsg.setReliability(Reliability.ASSURED_PERSISTENT);
notFlushedMsg.setRequestID(reqID);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createControlNotFlushed");
return notFlushedMsg;
} | java | private ControlNotFlushed createControlNotFlushed(SIBUuid8 target, SIBUuid12 stream, long reqID)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createControlNotFlushed", new Object[] {target, stream, new Long(reqID)});
ControlNotFlushed notFlushedMsg;
// Create new message
try
{
notFlushedMsg = _cmf.createNewControlNotFlushed();
}
catch (MessageCreateFailedException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler.createControlNotFlushed",
"1:1498:1.164.1.5",
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "createControlNotFlushed", e);
}
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1510:1.164.1.5",
e });
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1518:1.164.1.5",
e },
null),
e);
}
// As we are using the Guaranteed Header - set all the attributes as
// well as the ones we want.
SIMPUtils.setGuaranteedDeliveryProperties(notFlushedMsg,
_messageProcessor.getMessagingEngineUuid(),
null,
stream,
null,
_destinationHandler.getUuid(),
ProtocolType.PUBSUBINPUT,
GDConfig.PROTOCOL_VERSION);
notFlushedMsg.setPriority(SIMPConstants.CTRL_MSG_PRIORITY);
notFlushedMsg.setReliability(Reliability.ASSURED_PERSISTENT);
notFlushedMsg.setRequestID(reqID);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createControlNotFlushed");
return notFlushedMsg;
} | [
"private",
"ControlNotFlushed",
"createControlNotFlushed",
"(",
"SIBUuid8",
"target",
",",
"SIBUuid12",
"stream",
",",
"long",
"reqID",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"... | Creates a NOTFLUSHED message for sending
@param target The target cellule (er ME) for the message.
@param stream The UUID of the stream the message should be sent on.
@param reqID The request ID that the message answers.
@return the new NOTFLUSHED message.
@throws SIResourceException if the message can't be created. | [
"Creates",
"a",
"NOTFLUSHED",
"message",
"for",
"sending"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java#L1439-L1504 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/MavenUtils.java | MavenUtils.findMavenUrlForRoboconf | public static String findMavenUrlForRoboconf( String artifactId, String version )
throws IOException {
return findMavenUrl( "net.roboconf", artifactId, version, "jar" );
} | java | public static String findMavenUrlForRoboconf( String artifactId, String version )
throws IOException {
return findMavenUrl( "net.roboconf", artifactId, version, "jar" );
} | [
"public",
"static",
"String",
"findMavenUrlForRoboconf",
"(",
"String",
"artifactId",
",",
"String",
"version",
")",
"throws",
"IOException",
"{",
"return",
"findMavenUrl",
"(",
"\"net.roboconf\"",
",",
"artifactId",
",",
"version",
",",
"\"jar\"",
")",
";",
"}"
] | Finds the URL of a Roboconf (JAR) Maven artifact.
@param artifactId an artifact ID (not null)
@param version a version (not null)
@return an URL if the resolution worked, null if it was not found
@throws IOException | [
"Finds",
"the",
"URL",
"of",
"a",
"Roboconf",
"(",
"JAR",
")",
"Maven",
"artifact",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/MavenUtils.java#L56-L59 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java | GlobalLibraryV2_0Generator.getStateCodeDataType | public StateCodeDataType.Enum getStateCodeDataType(String countryAlternateCode, String stateName) {
StateCodeDataType.Enum stateCodeDataType = null;
StateContract state = s2SLocationService.getStateFromName(countryAlternateCode, stateName);
if (state != null) {
StringBuilder stateDetail = new StringBuilder();
stateDetail.append(state.getCode());
stateDetail.append(": ");
String stateNameCapital = WordUtils.capitalizeFully(state.getName());
stateNameCapital = stateNameCapital.replace(" Of ", " of ");
stateNameCapital = stateNameCapital.replace(" The ", " the ");
stateNameCapital = stateNameCapital.replace(" And ", " and ");
stateDetail.append(stateNameCapital);
stateCodeDataType = StateCodeDataType.Enum.forString(stateDetail
.toString());
}
return stateCodeDataType;
} | java | public StateCodeDataType.Enum getStateCodeDataType(String countryAlternateCode, String stateName) {
StateCodeDataType.Enum stateCodeDataType = null;
StateContract state = s2SLocationService.getStateFromName(countryAlternateCode, stateName);
if (state != null) {
StringBuilder stateDetail = new StringBuilder();
stateDetail.append(state.getCode());
stateDetail.append(": ");
String stateNameCapital = WordUtils.capitalizeFully(state.getName());
stateNameCapital = stateNameCapital.replace(" Of ", " of ");
stateNameCapital = stateNameCapital.replace(" The ", " the ");
stateNameCapital = stateNameCapital.replace(" And ", " and ");
stateDetail.append(stateNameCapital);
stateCodeDataType = StateCodeDataType.Enum.forString(stateDetail
.toString());
}
return stateCodeDataType;
} | [
"public",
"StateCodeDataType",
".",
"Enum",
"getStateCodeDataType",
"(",
"String",
"countryAlternateCode",
",",
"String",
"stateName",
")",
"{",
"StateCodeDataType",
".",
"Enum",
"stateCodeDataType",
"=",
"null",
";",
"StateContract",
"state",
"=",
"s2SLocationService",... | Create a StateCodeDataType.Enum as defined in UniversalCodes 2.0 from the
given name of the state.
@param stateName
The state name
@return The StateCodeDataType type corresponding to the given State code. | [
"Create",
"a",
"StateCodeDataType",
".",
"Enum",
"as",
"defined",
"in",
"UniversalCodes",
"2",
".",
"0",
"from",
"the",
"given",
"name",
"of",
"the",
"state",
"."
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/GlobalLibraryV2_0Generator.java#L83-L99 |
stripe/stripe-java | src/main/java/com/stripe/net/MultipartProcessor.java | MultipartProcessor.addFileField | public void addFileField(String name, String fileName, InputStream inputStream)
throws IOException {
writer.append("--").append(boundary).append(LINE_BREAK);
writer.append("Content-Disposition: form-data; name=\"").append(name)
.append("\"; filename=\"").append(fileName).append("\"").append(LINE_BREAK);
String probableContentType = URLConnection.guessContentTypeFromName(fileName);
writer.append("Content-Type: ").append(probableContentType).append(LINE_BREAK);
writer.append("Content-Transfer-Encoding: binary").append(LINE_BREAK);
writer.append(LINE_BREAK);
writer.flush();
streamToOutput(inputStream);
writer.append(LINE_BREAK);
writer.flush();
} | java | public void addFileField(String name, String fileName, InputStream inputStream)
throws IOException {
writer.append("--").append(boundary).append(LINE_BREAK);
writer.append("Content-Disposition: form-data; name=\"").append(name)
.append("\"; filename=\"").append(fileName).append("\"").append(LINE_BREAK);
String probableContentType = URLConnection.guessContentTypeFromName(fileName);
writer.append("Content-Type: ").append(probableContentType).append(LINE_BREAK);
writer.append("Content-Transfer-Encoding: binary").append(LINE_BREAK);
writer.append(LINE_BREAK);
writer.flush();
streamToOutput(inputStream);
writer.append(LINE_BREAK);
writer.flush();
} | [
"public",
"void",
"addFileField",
"(",
"String",
"name",
",",
"String",
"fileName",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"writer",
".",
"append",
"(",
"\"--\"",
")",
".",
"append",
"(",
"boundary",
")",
".",
"append",
"(",
... | Adds a file field to the multipart message, but takes in an InputStream instead of
just a file to read bytes from.
@param name Field name
@param fileName Name of the "file" being uploaded.
@param inputStream Stream of bytes to use in place of a file.
@throws IOException Thrown when writing / reading from streams fails. | [
"Adds",
"a",
"file",
"field",
"to",
"the",
"multipart",
"message",
"but",
"takes",
"in",
"an",
"InputStream",
"instead",
"of",
"just",
"a",
"file",
"to",
"read",
"bytes",
"from",
"."
] | train | https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/net/MultipartProcessor.java#L64-L80 |
alexruiz/fest-reflect | src/main/java/org/fest/reflect/constructor/ConstructorInvoker.java | ConstructorInvoker.newInstance | public T newInstance(@NotNull Object... args) {
Constructor<T> c = constructor;
boolean accessible = constructor.isAccessible();
try {
makeAccessible(c);
return c.newInstance(args);
} catch (Throwable t) {
Throwable cause = targetOf(t);
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
throw new ReflectionError("Unable to create a new object from the enclosed constructor", cause);
} finally {
setAccessibleIgnoringExceptions(c, accessible);
}
} | java | public T newInstance(@NotNull Object... args) {
Constructor<T> c = constructor;
boolean accessible = constructor.isAccessible();
try {
makeAccessible(c);
return c.newInstance(args);
} catch (Throwable t) {
Throwable cause = targetOf(t);
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
throw new ReflectionError("Unable to create a new object from the enclosed constructor", cause);
} finally {
setAccessibleIgnoringExceptions(c, accessible);
}
} | [
"public",
"T",
"newInstance",
"(",
"@",
"NotNull",
"Object",
"...",
"args",
")",
"{",
"Constructor",
"<",
"T",
">",
"c",
"=",
"constructor",
";",
"boolean",
"accessible",
"=",
"constructor",
".",
"isAccessible",
"(",
")",
";",
"try",
"{",
"makeAccessible",... | Invokes the constructor of the specified type with the given arguments.
<p/>
Examples:
<pre>
// import static {@link org.fest.reflect.core.Reflection#constructor() org.fest.reflect.core.Reflection.constructor};
// Equivalent to 'Person p = new Person()'
Person p = {@link org.fest.reflect.core.Reflection#constructor() constructor}().{@link org.fest.reflect.constructor.TargetType#in in}(Person.class).{@link org.fest.reflect.constructor.ConstructorInvoker#newInstance newInstance}();
// Equivalent to 'Person p = new Person("Yoda")'
Person p = {@link org.fest.reflect.core.Reflection#constructor() constructor}().{@link org.fest.reflect.constructor.TargetType#withParameterTypes(Class...) withParameterTypes}(String.class).{@link org.fest.reflect.constructor.ParameterTypes#in(Class) in}(Person.class).{@link org.fest.reflect.constructor.ConstructorInvoker#newInstance newInstance}("Yoda");
</pre>
@param args the arguments to pass to the constructor (can be zero or more).
@return the created instance of {@code T}.
@throws ReflectionError if a new instance cannot be created. | [
"Invokes",
"the",
"constructor",
"of",
"the",
"specified",
"type",
"with",
"the",
"given",
"arguments",
".",
"<p",
"/",
">",
"Examples",
":",
"<pre",
">",
"//",
"import",
"static",
"{",
"@link",
"org",
".",
"fest",
".",
"reflect",
".",
"core",
".",
"Re... | train | https://github.com/alexruiz/fest-reflect/blob/6db30716808633ef880e439b3dc6602ecb3f1b08/src/main/java/org/fest/reflect/constructor/ConstructorInvoker.java#L69-L84 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.VarArray | public JBBPDslBuilder VarArray(final String name, final String sizeExpression, final String param) {
return this.CustomArray("var", name, sizeExpression, param);
} | java | public JBBPDslBuilder VarArray(final String name, final String sizeExpression, final String param) {
return this.CustomArray("var", name, sizeExpression, param);
} | [
"public",
"JBBPDslBuilder",
"VarArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
",",
"final",
"String",
"param",
")",
"{",
"return",
"this",
".",
"CustomArray",
"(",
"\"var\"",
",",
"name",
",",
"sizeExpression",
",",
"param",... | Create named var array with fixed size.
@param name name of the array, can be null for anonymous one
@param sizeExpression expression to calculate size of the array, must not be null.
@param param optional parameter for the field, can be null
@return the builder instance, must not be null | [
"Create",
"named",
"var",
"array",
"with",
"fixed",
"size",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L474-L476 |
mangstadt/biweekly | src/main/java/biweekly/io/chain/ChainingTextWriter.java | ChainingTextWriter.go | public void go(File file, boolean append) throws IOException {
ICalWriter writer = new ICalWriter(file, append, getICalWriterConstructorVersion());
try {
go(writer);
} finally {
writer.close();
}
} | java | public void go(File file, boolean append) throws IOException {
ICalWriter writer = new ICalWriter(file, append, getICalWriterConstructorVersion());
try {
go(writer);
} finally {
writer.close();
}
} | [
"public",
"void",
"go",
"(",
"File",
"file",
",",
"boolean",
"append",
")",
"throws",
"IOException",
"{",
"ICalWriter",
"writer",
"=",
"new",
"ICalWriter",
"(",
"file",
",",
"append",
",",
"getICalWriterConstructorVersion",
"(",
")",
")",
";",
"try",
"{",
... | Writes the iCalendar objects to a file.
@param file the file to write to
@param append true to append onto the end of the file, false to overwrite
it
@throws IOException if there's a problem writing to the file | [
"Writes",
"the",
"iCalendar",
"objects",
"to",
"a",
"file",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/chain/ChainingTextWriter.java#L172-L179 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.rebootComputeNode | public void rebootComputeNode(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeRebootOptions options = new ComputeNodeRebootOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().computeNodes().reboot(poolId, nodeId, nodeRebootOption, options);
} | java | public void rebootComputeNode(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ComputeNodeRebootOptions options = new ComputeNodeRebootOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().computeNodes().reboot(poolId, nodeId, nodeRebootOption, options);
} | [
"public",
"void",
"rebootComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"ComputeNodeRebootOption",
"nodeRebootOption",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
... | Reboots the specified compute node.
<p>You can reboot a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p>
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node to reboot.
@param nodeRebootOption Specifies when to reboot the node and what to do with currently running tasks.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Reboots",
"the",
"specified",
"compute",
"node",
".",
"<p",
">",
"You",
"can",
"reboot",
"a",
"compute",
"node",
"only",
"when",
"it",
"is",
"in",
"the",
"{",
"@link",
"com",
".",
"microsoft",
".",
"azure",
".",
"batch",
".",
"protocol",
".",
"models"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L306-L312 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java | GVRPointLight.setAmbientIntensity | public void setAmbientIntensity(float r, float g, float b, float a) {
setVec4("ambient_intensity", r, g, b, a);
} | java | public void setAmbientIntensity(float r, float g, float b, float a) {
setVec4("ambient_intensity", r, g, b, a);
} | [
"public",
"void",
"setAmbientIntensity",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setVec4",
"(",
"\"ambient_intensity\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | Set the ambient light intensity.
This designates the color of the ambient reflection.
It is multiplied by the material ambient color to derive
the hue of the ambient reflection for that material.
The built-in phong shader {@link GVRPhongShader} uses a {@code vec4} uniform named
{@code ambient_intensity} to control the intensity of ambient light reflected.
@param r red component (0 to 1)
@param g green component (0 to 1)
@param b blue component (0 to 1)
@param a alpha component (0 to 1) | [
"Set",
"the",
"ambient",
"light",
"intensity",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java#L116-L118 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipPhone.java | SipPhone.processAuthChallenge | public Request processAuthChallenge(Response response, Request req_msg) {
return processAuthChallenge(response, req_msg, null, null);
} | java | public Request processAuthChallenge(Response response, Request req_msg) {
return processAuthChallenge(response, req_msg, null, null);
} | [
"public",
"Request",
"processAuthChallenge",
"(",
"Response",
"response",
",",
"Request",
"req_msg",
")",
"{",
"return",
"processAuthChallenge",
"(",
"response",
",",
"req_msg",
",",
"null",
",",
"null",
")",
";",
"}"
] | This method is the same as the other processAuthChallenge() without the user/password option. | [
"This",
"method",
"is",
"the",
"same",
"as",
"the",
"other",
"processAuthChallenge",
"()",
"without",
"the",
"user",
"/",
"password",
"option",
"."
] | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipPhone.java#L707-L709 |
mahjong4j/mahjong4j | src/main/java/org/mahjong4j/hands/Hands.java | Hands.init | private void init(List<Mentsu> winCandidate, Toitsu toitsu) {
// 操作変数を初期化
initStock();
winCandidate.clear();
//ストックから雀頭を減らす
handStocks[toitsu.getTile().getCode()] -= 2;
winCandidate.add(toitsu);
} | java | private void init(List<Mentsu> winCandidate, Toitsu toitsu) {
// 操作変数を初期化
initStock();
winCandidate.clear();
//ストックから雀頭を減らす
handStocks[toitsu.getTile().getCode()] -= 2;
winCandidate.add(toitsu);
} | [
"private",
"void",
"init",
"(",
"List",
"<",
"Mentsu",
">",
"winCandidate",
",",
"Toitsu",
"toitsu",
")",
"{",
"// 操作変数を初期化",
"initStock",
"(",
")",
";",
"winCandidate",
".",
"clear",
"(",
")",
";",
"//ストックから雀頭を減らす",
"handStocks",
"[",
"toitsu",
".",
"getT... | 操作変数・面子の候補を初期化し
雀頭の分をストックから減らします
@param winCandidate 面子の候補
@param toitsu この検索サイクルの雀頭候補 | [
"操作変数・面子の候補を初期化し",
"雀頭の分をストックから減らします"
] | train | https://github.com/mahjong4j/mahjong4j/blob/caa75963286b631ad51953d0d8c71cf6bf79b8f4/src/main/java/org/mahjong4j/hands/Hands.java#L241-L248 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.registerPropertyOnType | public void registerPropertyOnType(String propertyName, JSType type) {
if (isObjectLiteralThatCanBeSkipped(type)) {
type = getSentinelObjectLiteral();
}
if (type.isUnionType()) {
typesIndexedByProperty.putAll(propertyName, type.toMaybeUnionType().getAlternates());
} else {
typesIndexedByProperty.put(propertyName, type);
}
addReferenceTypeIndexedByProperty(propertyName, type);
// Clear cached values that depend on typesIndexedByProperty.
greatestSubtypeByProperty.remove(propertyName);
} | java | public void registerPropertyOnType(String propertyName, JSType type) {
if (isObjectLiteralThatCanBeSkipped(type)) {
type = getSentinelObjectLiteral();
}
if (type.isUnionType()) {
typesIndexedByProperty.putAll(propertyName, type.toMaybeUnionType().getAlternates());
} else {
typesIndexedByProperty.put(propertyName, type);
}
addReferenceTypeIndexedByProperty(propertyName, type);
// Clear cached values that depend on typesIndexedByProperty.
greatestSubtypeByProperty.remove(propertyName);
} | [
"public",
"void",
"registerPropertyOnType",
"(",
"String",
"propertyName",
",",
"JSType",
"type",
")",
"{",
"if",
"(",
"isObjectLiteralThatCanBeSkipped",
"(",
"type",
")",
")",
"{",
"type",
"=",
"getSentinelObjectLiteral",
"(",
")",
";",
"}",
"if",
"(",
"type"... | Tells the type system that {@code owner} may have a property named
{@code propertyName}. This allows the registry to keep track of what
types a property is defined upon.
This is NOT the same as saying that {@code owner} must have a property
named type. ObjectType#hasProperty attempts to minimize false positives
("if we're not sure, then don't type check this property"). The type
registry, on the other hand, should attempt to minimize false negatives
("if this property is assigned anywhere in the program, it must
show up in the type registry"). | [
"Tells",
"the",
"type",
"system",
"that",
"{",
"@code",
"owner",
"}",
"may",
"have",
"a",
"property",
"named",
"{",
"@code",
"propertyName",
"}",
".",
"This",
"allows",
"the",
"registry",
"to",
"keep",
"track",
"of",
"what",
"types",
"a",
"property",
"is... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L911-L926 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java | InvocationContextImpl.doAroundInvoke | public Object doAroundInvoke(InterceptorProxy[] proxies, Method businessMethod, Object[] parameters, EJSDeployedSupport s) //LIDB3294-41
throws Exception {
ivMethod = businessMethod;
ivParameters = parameters;
ivEJSDeployedSupport = s; //LIDB3294-41
ivInterceptorProxies = proxies;
ivIsAroundConstruct = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d367572.7
{
Tr.entry(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
try {
return doAroundInterceptor();
} finally // d367572.8
{
// Let the mapping strategy handle checked and unchecked exceptions
// that occurs since it knows whether to treat unchecked exceptions
// as an application exception or as a system exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d415968
{
Tr.exit(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
ivMethod = null;
ivParameters = null;
}
} | java | public Object doAroundInvoke(InterceptorProxy[] proxies, Method businessMethod, Object[] parameters, EJSDeployedSupport s) //LIDB3294-41
throws Exception {
ivMethod = businessMethod;
ivParameters = parameters;
ivEJSDeployedSupport = s; //LIDB3294-41
ivInterceptorProxies = proxies;
ivIsAroundConstruct = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d367572.7
{
Tr.entry(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
try {
return doAroundInterceptor();
} finally // d367572.8
{
// Let the mapping strategy handle checked and unchecked exceptions
// that occurs since it knows whether to treat unchecked exceptions
// as an application exception or as a system exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) // d415968
{
Tr.exit(tc, "doAroundInvoke for business method: " + ivMethod.getName());
}
ivMethod = null;
ivParameters = null;
}
} | [
"public",
"Object",
"doAroundInvoke",
"(",
"InterceptorProxy",
"[",
"]",
"proxies",
",",
"Method",
"businessMethod",
",",
"Object",
"[",
"]",
"parameters",
",",
"EJSDeployedSupport",
"s",
")",
"//LIDB3294-41",
"throws",
"Exception",
"{",
"ivMethod",
"=",
"business... | Invoke each AroundInvoke interceptor methods for a specified
business method of an EJB being invoked.
@param proxies is an array of InterceptorProxy objects that
represent the list of AroundInvoke interceptor
methods to be invoked.
@param businessMethod is the Method object for invoking the business method.
@param parameters is the array of arguments to be passed to business method.
@return the Object that is returned by business method.
@throws Exception from around invoke or business method. | [
"Invoke",
"each",
"AroundInvoke",
"interceptor",
"methods",
"for",
"a",
"specified",
"business",
"method",
"of",
"an",
"EJB",
"being",
"invoked",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InvocationContextImpl.java#L254-L280 |
craftercms/profile | security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java | RequestSecurityFilter.getLastProcessorInChain | protected RequestSecurityProcessor getLastProcessorInChain(final FilterChain chain) {
return new RequestSecurityProcessor() {
public void processRequest(RequestContext context, RequestSecurityProcessorChain processorChain) throws
Exception {
chain.doFilter(context.getRequest(), context.getResponse());
}
};
} | java | protected RequestSecurityProcessor getLastProcessorInChain(final FilterChain chain) {
return new RequestSecurityProcessor() {
public void processRequest(RequestContext context, RequestSecurityProcessorChain processorChain) throws
Exception {
chain.doFilter(context.getRequest(), context.getResponse());
}
};
} | [
"protected",
"RequestSecurityProcessor",
"getLastProcessorInChain",
"(",
"final",
"FilterChain",
"chain",
")",
"{",
"return",
"new",
"RequestSecurityProcessor",
"(",
")",
"{",
"public",
"void",
"processRequest",
"(",
"RequestContext",
"context",
",",
"RequestSecurityProce... | Returns the last processor of the chain, which should actually call the {@link FilterChain}. | [
"Returns",
"the",
"last",
"processor",
"of",
"the",
"chain",
"which",
"should",
"actually",
"call",
"the",
"{"
] | train | https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java#L188-L197 |
RestComm/mss-arquillian | mss-arquillian-container-extension/src/main/java/org/jboss/arquillian/container/mss/extension/ContainerProducer.java | ContainerProducer.executeBeforeClass | public void executeBeforeClass(@Observes BeforeClass event, TestClass testClass){
testClass = event.getTestClass();
Field[] fields = testClass.getJavaClass().getDeclaredFields();
for (Field field : fields) {
if (field.isAnnotationPresent(GetDeployableContainer.class)){
if (field.getType().isAssignableFrom(ContainerManagerTool.class)){
isGetDeployableContainerAnnoPresent = true;
deployableContainerFields.add(field);
}
}
}
} | java | public void executeBeforeClass(@Observes BeforeClass event, TestClass testClass){
testClass = event.getTestClass();
Field[] fields = testClass.getJavaClass().getDeclaredFields();
for (Field field : fields) {
if (field.isAnnotationPresent(GetDeployableContainer.class)){
if (field.getType().isAssignableFrom(ContainerManagerTool.class)){
isGetDeployableContainerAnnoPresent = true;
deployableContainerFields.add(field);
}
}
}
} | [
"public",
"void",
"executeBeforeClass",
"(",
"@",
"Observes",
"BeforeClass",
"event",
",",
"TestClass",
"testClass",
")",
"{",
"testClass",
"=",
"event",
".",
"getTestClass",
"(",
")",
";",
"Field",
"[",
"]",
"fields",
"=",
"testClass",
".",
"getJavaClass",
... | /*
Use @BeforeClass event in order to scan the test class for annotation we might be interesting.
Event fired Before the Class execution. | [
"/",
"*",
"Use"
] | train | https://github.com/RestComm/mss-arquillian/blob/d217b4e53701282c6e7176365a03be6f898342be/mss-arquillian-container-extension/src/main/java/org/jboss/arquillian/container/mss/extension/ContainerProducer.java#L37-L48 |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/BindingFactory.java | BindingFactory.bindAnnotatedWithNameToInstance | protected Binding bindAnnotatedWithNameToInstance(TypeReference bind, String name, String to,
String functionName) {
String tmpName = Strings.emptyIfNull(name);
if (tmpName.startsWith(REFERENCE_PREFIX)) {
tmpName = tmpName.substring(REFERENCE_PREFIX.length()).trim();
} else {
tmpName = "\"" + tmpName + "\""; //$NON-NLS-1$//$NON-NLS-2$
}
final String unferencedName = tmpName;
final StringConcatenationClient client = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation builder) {
builder.append("binder.bind("); //$NON-NLS-1$
builder.append(bind);
builder.append(".class).annotatedWith(Names.named("); //$NON-NLS-1$
builder.append(unferencedName);
builder.append(")).toInstance("); //$NON-NLS-1$
builder.append(to);
builder.append(".class);"); //$NON-NLS-1$
}
};
String fctname = functionName;
if (Strings.isEmpty(fctname)) {
fctname = name;
}
final BindKey key = new GuiceModuleAccess.BindKey(formatFunctionName(fctname), null, false, false);
final BindValue statements = new BindValue(null, null, false, Collections.singletonList(client));
return new Binding(key, statements, true, this.name);
} | java | protected Binding bindAnnotatedWithNameToInstance(TypeReference bind, String name, String to,
String functionName) {
String tmpName = Strings.emptyIfNull(name);
if (tmpName.startsWith(REFERENCE_PREFIX)) {
tmpName = tmpName.substring(REFERENCE_PREFIX.length()).trim();
} else {
tmpName = "\"" + tmpName + "\""; //$NON-NLS-1$//$NON-NLS-2$
}
final String unferencedName = tmpName;
final StringConcatenationClient client = new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation builder) {
builder.append("binder.bind("); //$NON-NLS-1$
builder.append(bind);
builder.append(".class).annotatedWith(Names.named("); //$NON-NLS-1$
builder.append(unferencedName);
builder.append(")).toInstance("); //$NON-NLS-1$
builder.append(to);
builder.append(".class);"); //$NON-NLS-1$
}
};
String fctname = functionName;
if (Strings.isEmpty(fctname)) {
fctname = name;
}
final BindKey key = new GuiceModuleAccess.BindKey(formatFunctionName(fctname), null, false, false);
final BindValue statements = new BindValue(null, null, false, Collections.singletonList(client));
return new Binding(key, statements, true, this.name);
} | [
"protected",
"Binding",
"bindAnnotatedWithNameToInstance",
"(",
"TypeReference",
"bind",
",",
"String",
"name",
",",
"String",
"to",
",",
"String",
"functionName",
")",
"{",
"String",
"tmpName",
"=",
"Strings",
".",
"emptyIfNull",
"(",
"name",
")",
";",
"if",
... | Bind a type annotated with a name of the given value.
@param bind the type to bind.
@param name the name to consider.
@param to the instance.
@param functionName the optional function name.
@return the binding element. | [
"Bind",
"a",
"type",
"annotated",
"with",
"a",
"name",
"of",
"the",
"given",
"value",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/BindingFactory.java#L191-L219 |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/api/LanguageHelper.java | LanguageHelper.getAnnotationValue | private static <T> T getAnnotationValue(Annotation annotation, String value, Class<T> expectedType) {
Class<? extends Annotation> annotationType = annotation.annotationType();
Method valueMethod;
try {
valueMethod = annotationType.getDeclaredMethod(value);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Cannot resolve required method '" + value + "()' for '" + annotationType + "'.");
}
Object elementValue;
try {
elementValue = valueMethod.invoke(annotation);
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("Cannot invoke method value() for " + annotationType);
}
return elementValue != null ? expectedType.cast(elementValue) : null;
} | java | private static <T> T getAnnotationValue(Annotation annotation, String value, Class<T> expectedType) {
Class<? extends Annotation> annotationType = annotation.annotationType();
Method valueMethod;
try {
valueMethod = annotationType.getDeclaredMethod(value);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Cannot resolve required method '" + value + "()' for '" + annotationType + "'.");
}
Object elementValue;
try {
elementValue = valueMethod.invoke(annotation);
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("Cannot invoke method value() for " + annotationType);
}
return elementValue != null ? expectedType.cast(elementValue) : null;
} | [
"private",
"static",
"<",
"T",
">",
"T",
"getAnnotationValue",
"(",
"Annotation",
"annotation",
",",
"String",
"value",
",",
"Class",
"<",
"T",
">",
"expectedType",
")",
"{",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
"=",
"annotation... | Return a value from an annotation.
@param annotation
The annotation.
@param value
The value.
@param expectedType
The expected type.
@param <T>
The expected type.
@return The value. | [
"Return",
"a",
"value",
"from",
"an",
"annotation",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/api/LanguageHelper.java#L56-L71 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java | Expressions.toQueryGranularity | @Nullable
public static Granularity toQueryGranularity(final DruidExpression expression, final ExprMacroTable macroTable)
{
final TimestampFloorExprMacro.TimestampFloorExpr expr = asTimestampFloorExpr(expression, macroTable);
if (expr == null) {
return null;
}
final Expr arg = expr.getArg();
final Granularity granularity = expr.getGranularity();
if (ColumnHolder.TIME_COLUMN_NAME.equals(Parser.getIdentifierIfIdentifier(arg))) {
return granularity;
} else {
return null;
}
} | java | @Nullable
public static Granularity toQueryGranularity(final DruidExpression expression, final ExprMacroTable macroTable)
{
final TimestampFloorExprMacro.TimestampFloorExpr expr = asTimestampFloorExpr(expression, macroTable);
if (expr == null) {
return null;
}
final Expr arg = expr.getArg();
final Granularity granularity = expr.getGranularity();
if (ColumnHolder.TIME_COLUMN_NAME.equals(Parser.getIdentifierIfIdentifier(arg))) {
return granularity;
} else {
return null;
}
} | [
"@",
"Nullable",
"public",
"static",
"Granularity",
"toQueryGranularity",
"(",
"final",
"DruidExpression",
"expression",
",",
"final",
"ExprMacroTable",
"macroTable",
")",
"{",
"final",
"TimestampFloorExprMacro",
".",
"TimestampFloorExpr",
"expr",
"=",
"asTimestampFloorEx... | Converts an expression to a Granularity, if possible. This is possible if, and only if, the expression
is a timestamp_floor function on the __time column with literal parameters for period, origin, and timeZone.
@return granularity or null if not possible | [
"Converts",
"an",
"expression",
"to",
"a",
"Granularity",
"if",
"possible",
".",
"This",
"is",
"possible",
"if",
"and",
"only",
"if",
"the",
"expression",
"is",
"a",
"timestamp_floor",
"function",
"on",
"the",
"__time",
"column",
"with",
"literal",
"parameters... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/expression/Expressions.java#L573-L590 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Response.java | Response.removeCookie | public Response removeCookie(String name) {
Cookie cookie = new Cookie(name, "");
cookie.setSecure(true);
cookie.setMaxAge(0);
addCookie(cookie);
return this;
} | java | public Response removeCookie(String name) {
Cookie cookie = new Cookie(name, "");
cookie.setSecure(true);
cookie.setMaxAge(0);
addCookie(cookie);
return this;
} | [
"public",
"Response",
"removeCookie",
"(",
"String",
"name",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"\"\"",
")",
";",
"cookie",
".",
"setSecure",
"(",
"true",
")",
";",
"cookie",
".",
"setMaxAge",
"(",
"0",
")",
";",
"a... | Removes the specified cookie by name.
@param name
@return the response | [
"Removes",
"the",
"specified",
"cookie",
"by",
"name",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Response.java#L247-L254 |
super-csv/super-csv | super-csv-java8/src/main/java/org/supercsv/cellprocessor/time/AbstractTemporalAccessorFormattingProcessor.java | AbstractTemporalAccessorFormattingProcessor.execute | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final Class<T> ourType = getType();
if( !(value.getClass().equals(ourType)) ) {
throw new SuperCsvCellProcessorException(ourType, value, context, this);
}
final TemporalAccessor timeType = ourType.cast(value);
try {
if( formatter != null ) {
return formatter.format(timeType);
} else {
return timeType.toString();
}
}
catch(DateTimeException | IllegalArgumentException e) {
throw new SuperCsvCellProcessorException(
String.format("Failed to format value as a %s", ourType.getSimpleName()), context, this, e);
}
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final Class<T> ourType = getType();
if( !(value.getClass().equals(ourType)) ) {
throw new SuperCsvCellProcessorException(ourType, value, context, this);
}
final TemporalAccessor timeType = ourType.cast(value);
try {
if( formatter != null ) {
return formatter.format(timeType);
} else {
return timeType.toString();
}
}
catch(DateTimeException | IllegalArgumentException e) {
throw new SuperCsvCellProcessorException(
String.format("Failed to format value as a %s", ourType.getSimpleName()), context, this, e);
}
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"final",
"Class",
"<",
"T",
">",
"ourType",
"=",
"getType",
"(",
")",
";",
"i... | {@inheritDoc}
@throws SuperCsvCellProcessorException if value is null, not the correct type, or can't be formatted | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv-java8/src/main/java/org/supercsv/cellprocessor/time/AbstractTemporalAccessorFormattingProcessor.java#L105-L123 |
dvasilen/Hive-XML-SerDe | src/main/java/com/ibm/spss/hive/serde2/xml/processor/AbstractXmlProcessor.java | AbstractXmlProcessor.getObjectValue | private Object getObjectValue(XmlNode node, String fieldName) {
// we have to take into account the fact that fieldName will be in the lower case
if (node != null) {
String name = node.getName();
switch (node.getType()) {
case XmlNode.ATTRIBUTE_NODE:
return name.equalsIgnoreCase(fieldName) ? node : null;
case XmlNode.ELEMENT_NODE: {
if (name.equalsIgnoreCase(fieldName)) {
return new XmlNodeArray(node.getChildren());
} else {
Map<String, XmlNode> attributes = node.getAttributes();
for (Map.Entry<String, XmlNode> entry : attributes.entrySet()) {
String attributeName = entry.getKey();
if (attributeName.equalsIgnoreCase(fieldName)) {
return entry.getValue();
}
}
return null;
}
}
default:
return null;
}
}
return null;
} | java | private Object getObjectValue(XmlNode node, String fieldName) {
// we have to take into account the fact that fieldName will be in the lower case
if (node != null) {
String name = node.getName();
switch (node.getType()) {
case XmlNode.ATTRIBUTE_NODE:
return name.equalsIgnoreCase(fieldName) ? node : null;
case XmlNode.ELEMENT_NODE: {
if (name.equalsIgnoreCase(fieldName)) {
return new XmlNodeArray(node.getChildren());
} else {
Map<String, XmlNode> attributes = node.getAttributes();
for (Map.Entry<String, XmlNode> entry : attributes.entrySet()) {
String attributeName = entry.getKey();
if (attributeName.equalsIgnoreCase(fieldName)) {
return entry.getValue();
}
}
return null;
}
}
default:
return null;
}
}
return null;
} | [
"private",
"Object",
"getObjectValue",
"(",
"XmlNode",
"node",
",",
"String",
"fieldName",
")",
"{",
"// we have to take into account the fact that fieldName will be in the lower case",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"String",
"name",
"=",
"node",
".",
"ge... | Returns the object value for the given VTD XML node and field name
@param node
the node
@param fieldName
the field name
@return the object value for the given VTD XML node and field name | [
"Returns",
"the",
"object",
"value",
"for",
"the",
"given",
"VTD",
"XML",
"node",
"and",
"field",
"name"
] | train | https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/processor/AbstractXmlProcessor.java#L79-L105 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readDefaultFile | public CmsResource readDefaultFile(String resourceNameOrID, CmsResourceFilter filter)
throws CmsException, CmsSecurityException {
CmsResource resource;
if (CmsUUID.isValidUUID(resourceNameOrID)) {
resource = readResource(new CmsUUID(resourceNameOrID), filter);
} else {
resource = readResource(resourceNameOrID, filter);
}
return m_securityManager.readDefaultFile(m_context, resource, filter);
} | java | public CmsResource readDefaultFile(String resourceNameOrID, CmsResourceFilter filter)
throws CmsException, CmsSecurityException {
CmsResource resource;
if (CmsUUID.isValidUUID(resourceNameOrID)) {
resource = readResource(new CmsUUID(resourceNameOrID), filter);
} else {
resource = readResource(resourceNameOrID, filter);
}
return m_securityManager.readDefaultFile(m_context, resource, filter);
} | [
"public",
"CmsResource",
"readDefaultFile",
"(",
"String",
"resourceNameOrID",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
",",
"CmsSecurityException",
"{",
"CmsResource",
"resource",
";",
"if",
"(",
"CmsUUID",
".",
"isValidUUID",
"(",
"resource... | Returns the default resource for the given folder.<p>
If the given resource name or id identifies a file, then this file is returned.<p>
Otherwise, in case of a folder:<br>
<ol>
<li>the {@link CmsPropertyDefinition#PROPERTY_DEFAULT_FILE} is checked, and
<li>if still no file could be found, the configured default files in the
<code>opencms-vfs.xml</code> configuration are iterated until a match is
found, and
<li>if still no file could be found, <code>null</code> is returned
</ol>
@param resourceNameOrID the name or id of the folder to read the default file for#
@param filter the resource filter to use for reading the resources
@return the default file for the given folder
@throws CmsException if something goes wrong
@throws CmsSecurityException if the user has no permissions to read the resulting file | [
"Returns",
"the",
"default",
"resource",
"for",
"the",
"given",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2436-L2446 |
aws/aws-sdk-java | aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/DescribeExclusionsResult.java | DescribeExclusionsResult.withExclusions | public DescribeExclusionsResult withExclusions(java.util.Map<String, Exclusion> exclusions) {
setExclusions(exclusions);
return this;
} | java | public DescribeExclusionsResult withExclusions(java.util.Map<String, Exclusion> exclusions) {
setExclusions(exclusions);
return this;
} | [
"public",
"DescribeExclusionsResult",
"withExclusions",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Exclusion",
">",
"exclusions",
")",
"{",
"setExclusions",
"(",
"exclusions",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Information about the exclusions.
</p>
@param exclusions
Information about the exclusions.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Information",
"about",
"the",
"exclusions",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/DescribeExclusionsResult.java#L74-L77 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java | Arc42DocumentationTemplate.addQualityRequirementsSection | public Section addQualityRequirementsSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Quality Requirements", files);
} | java | public Section addQualityRequirementsSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Quality Requirements", files);
} | [
"public",
"Section",
"addQualityRequirementsSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"addSection",
"(",
"softwareSystem",
",",
"\"Quality Requirements\"",
",",
"files",
")",
";",
"}"
] | Adds a "Quality Requirements" section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"a",
"Quality",
"Requirements",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"from",
"one",
"or",
"more",
"files",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java#L265-L267 |
j256/ormlite-core | src/main/java/com/j256/ormlite/misc/TransactionManager.java | TransactionManager.callInTransaction | public <T> T callInTransaction(final Callable<T> callable) throws SQLException {
return callInTransaction(connectionSource, callable);
} | java | public <T> T callInTransaction(final Callable<T> callable) throws SQLException {
return callInTransaction(connectionSource, callable);
} | [
"public",
"<",
"T",
">",
"T",
"callInTransaction",
"(",
"final",
"Callable",
"<",
"T",
">",
"callable",
")",
"throws",
"SQLException",
"{",
"return",
"callInTransaction",
"(",
"connectionSource",
",",
"callable",
")",
";",
"}"
] | Execute the {@link Callable} class inside of a transaction. If the callable returns then the transaction is
committed. If the callable throws an exception then the transaction is rolled back and a {@link SQLException} is
thrown by this method.
<p>
<b> NOTE: </b> If your callable block really doesn't have a return object then use the Void class and return null
from the call method.
</p>
<p>
WARNING: it is up to you to properly synchronize around this method if multiple threads are using a
connection-source which works gives out a single-connection. The reason why this is necessary is that multiple
operations are performed on the connection and race-conditions will exist with multiple threads working on the
same connection.
</p>
@param callable
Callable to execute inside of the transaction.
@return The object returned by the callable.
@throws SQLException
If the callable threw an exception then the transaction is rolled back and a SQLException wraps the
callable exception and is thrown by this method. | [
"Execute",
"the",
"{",
"@link",
"Callable",
"}",
"class",
"inside",
"of",
"a",
"transaction",
".",
"If",
"the",
"callable",
"returns",
"then",
"the",
"transaction",
"is",
"committed",
".",
"If",
"the",
"callable",
"throws",
"an",
"exception",
"then",
"the",
... | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/misc/TransactionManager.java#L128-L130 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.preCompileJava | protected boolean preCompileJava(File sourceDirectory, File classDirectory, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_51);
return runJavaCompiler(classDirectory, getSourcePaths(),
Iterables.concat(Collections.singleton(sourceDirectory), getClassPath()),
false, true, progress);
} | java | protected boolean preCompileJava(File sourceDirectory, File classDirectory, IProgressMonitor progress) {
assert progress != null;
progress.subTask(Messages.SarlBatchCompiler_51);
return runJavaCompiler(classDirectory, getSourcePaths(),
Iterables.concat(Collections.singleton(sourceDirectory), getClassPath()),
false, true, progress);
} | [
"protected",
"boolean",
"preCompileJava",
"(",
"File",
"sourceDirectory",
",",
"File",
"classDirectory",
",",
"IProgressMonitor",
"progress",
")",
"{",
"assert",
"progress",
"!=",
"null",
";",
"progress",
".",
"subTask",
"(",
"Messages",
".",
"SarlBatchCompiler_51",... | Compile the java files before the compilation of the project's files.
@param sourceDirectory the source directory where java files are stored.
@param classDirectory the output directory, where binary files should be generated.
@param progress monitor of the progress of the compilation.
@return the success status. Replies <code>false</code> if the activity is canceled. | [
"Compile",
"the",
"java",
"files",
"before",
"the",
"compilation",
"of",
"the",
"project",
"s",
"files",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1692-L1698 |
janus-project/guava.janusproject.io | guava/src/com/google/common/collect/Maps.java | Maps.filterEntries | public static <K, V> Map<K, V> filterEntries(
Map<K, V> unfiltered, Predicate<? super Entry<K, V>> entryPredicate) {
if (unfiltered instanceof SortedMap) {
return filterEntries((SortedMap<K, V>) unfiltered, entryPredicate);
} else if (unfiltered instanceof BiMap) {
return filterEntries((BiMap<K, V>) unfiltered, entryPredicate);
}
checkNotNull(entryPredicate);
return (unfiltered instanceof AbstractFilteredMap)
? filterFiltered((AbstractFilteredMap<K, V>) unfiltered, entryPredicate)
: new FilteredEntryMap<K, V>(checkNotNull(unfiltered), entryPredicate);
} | java | public static <K, V> Map<K, V> filterEntries(
Map<K, V> unfiltered, Predicate<? super Entry<K, V>> entryPredicate) {
if (unfiltered instanceof SortedMap) {
return filterEntries((SortedMap<K, V>) unfiltered, entryPredicate);
} else if (unfiltered instanceof BiMap) {
return filterEntries((BiMap<K, V>) unfiltered, entryPredicate);
}
checkNotNull(entryPredicate);
return (unfiltered instanceof AbstractFilteredMap)
? filterFiltered((AbstractFilteredMap<K, V>) unfiltered, entryPredicate)
: new FilteredEntryMap<K, V>(checkNotNull(unfiltered), entryPredicate);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"filterEntries",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"unfiltered",
",",
"Predicate",
"<",
"?",
"super",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entryPredicate",
")",
... | Returns a map containing the mappings in {@code unfiltered} that satisfy a
predicate. The returned map is a live view of {@code unfiltered}; changes
to one affect the other.
<p>The resulting map's {@code keySet()}, {@code entrySet()}, and {@code
values()} views have iterators that don't support {@code remove()}, but all
other methods are supported by the map and its views. When given a
key/value pair that doesn't satisfy the predicate, the map's {@code put()}
and {@code putAll()} methods throw an {@link IllegalArgumentException}.
Similarly, the map's entries have a {@link Entry#setValue} method that
throws an {@link IllegalArgumentException} when the existing key and the
provided value don't satisfy the predicate.
<p>When methods such as {@code removeAll()} and {@code clear()} are called
on the filtered map or its views, only mappings that satisfy the filter
will be removed from the underlying map.
<p>The returned map isn't threadsafe or serializable, even if {@code
unfiltered} is.
<p>Many of the filtered map's methods, such as {@code size()},
iterate across every key/value mapping in the underlying map and determine
which satisfy the filter. When a live view is <i>not</i> needed, it may be
faster to copy the filtered map and use the copy.
<p><b>Warning:</b> {@code entryPredicate} must be <i>consistent with
equals</i>, as documented at {@link Predicate#apply}. | [
"Returns",
"a",
"map",
"containing",
"the",
"mappings",
"in",
"{",
"@code",
"unfiltered",
"}",
"that",
"satisfy",
"a",
"predicate",
".",
"The",
"returned",
"map",
"is",
"a",
"live",
"view",
"of",
"{",
"@code",
"unfiltered",
"}",
";",
"changes",
"to",
"on... | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/Maps.java#L2408-L2419 |
samskivert/samskivert | src/main/java/com/samskivert/util/SortableArrayList.java | SortableArrayList.insertSorted | @SuppressWarnings("unchecked")
public int insertSorted (T value, Comparator<? super T> comp)
{
int ipos = binarySearch(value, comp);
if (ipos < 0) {
ipos = -(ipos+1);
}
_elements = (T[])ListUtil.insert(_elements, ipos, value);
_size++;
return ipos;
} | java | @SuppressWarnings("unchecked")
public int insertSorted (T value, Comparator<? super T> comp)
{
int ipos = binarySearch(value, comp);
if (ipos < 0) {
ipos = -(ipos+1);
}
_elements = (T[])ListUtil.insert(_elements, ipos, value);
_size++;
return ipos;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"int",
"insertSorted",
"(",
"T",
"value",
",",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comp",
")",
"{",
"int",
"ipos",
"=",
"binarySearch",
"(",
"value",
",",
"comp",
")",
";",
"if",
"("... | Inserts the specified item into the list into a position that
preserves the sorting of the list according to the supplied {@link
Comparator}. The list must be sorted (via the supplied comparator)
prior to the call to this method (an empty list built up entirely
via calls to {@link #insertSorted} will be properly sorted).
@return the index at which the element was inserted. | [
"Inserts",
"the",
"specified",
"item",
"into",
"the",
"list",
"into",
"a",
"position",
"that",
"preserves",
"the",
"sorting",
"of",
"the",
"list",
"according",
"to",
"the",
"supplied",
"{",
"@link",
"Comparator",
"}",
".",
"The",
"list",
"must",
"be",
"sor... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/SortableArrayList.java#L46-L56 |
Omertron/api-tvrage | src/main/java/com/omertron/tvrageapi/model/ShowInfo.java | ShowInfo.addAka | public void addAka(String country, String aka) {
if (!isValidString(country) || !isValidString(aka)) {
return;
}
this.akas.add(new CountryDetail(country, aka));
} | java | public void addAka(String country, String aka) {
if (!isValidString(country) || !isValidString(aka)) {
return;
}
this.akas.add(new CountryDetail(country, aka));
} | [
"public",
"void",
"addAka",
"(",
"String",
"country",
",",
"String",
"aka",
")",
"{",
"if",
"(",
"!",
"isValidString",
"(",
"country",
")",
"||",
"!",
"isValidString",
"(",
"aka",
")",
")",
"{",
"return",
";",
"}",
"this",
".",
"akas",
".",
"add",
... | Add single AKA from a country/aka pairing
@param country
@param aka | [
"Add",
"single",
"AKA",
"from",
"a",
"country",
"/",
"aka",
"pairing"
] | train | https://github.com/Omertron/api-tvrage/blob/4e805a99de812fabea69d97098f2376be14d51bc/src/main/java/com/omertron/tvrageapi/model/ShowInfo.java#L94-L100 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/images/LineChartGenerator.java | LineChartGenerator.dumpChart | @SuppressWarnings("nls")
public void dumpChart( File chartFile, boolean autoRange, boolean withLegend, int imageWidth, int imageHeight )
throws IOException {
JFreeChart chart = ChartFactory.createXYLineChart(title, xLabel, yLabel, collection, PlotOrientation.VERTICAL, withLegend,
false, false);
XYPlot plot = (XYPlot) chart.getPlot();
// plot.setDomainPannable(true);
// plot.setRangePannable(true);
// plot.setForegroundAlpha(0.85f);
NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());
if (autoRange) {
double delta = (max - min) * 0.1;
yAxis.setRange(min - delta, max + delta);
// TODO reactivate if newer jfree is used
// yAxis.setMinorTickCount(4);
// yAxis.setMinorTickMarksVisible(true);
}
// ValueAxis xAxis = plot.getDomainAxis();
// xAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US));
// XYItemRenderer renderer = plot.getRenderer();
// renderer.setDrawBarOutline(false);
// // flat bars look best...
// renderer.setBarPainter(new StandardXYBarPainter());
// renderer.setShadowVisible(false);
if (!chartFile.getName().endsWith(".png")) {
chartFile = FileUtilities.substituteExtention(chartFile, "png");
}
if (imageWidth == -1) {
imageWidth = IMAGEWIDTH;
}
if (imageHeight == -1) {
imageHeight = IMAGEHEIGHT;
}
BufferedImage bufferedImage = chart.createBufferedImage(imageWidth, imageHeight);
ImageIO.write(bufferedImage, "png", chartFile);
} | java | @SuppressWarnings("nls")
public void dumpChart( File chartFile, boolean autoRange, boolean withLegend, int imageWidth, int imageHeight )
throws IOException {
JFreeChart chart = ChartFactory.createXYLineChart(title, xLabel, yLabel, collection, PlotOrientation.VERTICAL, withLegend,
false, false);
XYPlot plot = (XYPlot) chart.getPlot();
// plot.setDomainPannable(true);
// plot.setRangePannable(true);
// plot.setForegroundAlpha(0.85f);
NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());
if (autoRange) {
double delta = (max - min) * 0.1;
yAxis.setRange(min - delta, max + delta);
// TODO reactivate if newer jfree is used
// yAxis.setMinorTickCount(4);
// yAxis.setMinorTickMarksVisible(true);
}
// ValueAxis xAxis = plot.getDomainAxis();
// xAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US));
// XYItemRenderer renderer = plot.getRenderer();
// renderer.setDrawBarOutline(false);
// // flat bars look best...
// renderer.setBarPainter(new StandardXYBarPainter());
// renderer.setShadowVisible(false);
if (!chartFile.getName().endsWith(".png")) {
chartFile = FileUtilities.substituteExtention(chartFile, "png");
}
if (imageWidth == -1) {
imageWidth = IMAGEWIDTH;
}
if (imageHeight == -1) {
imageHeight = IMAGEHEIGHT;
}
BufferedImage bufferedImage = chart.createBufferedImage(imageWidth, imageHeight);
ImageIO.write(bufferedImage, "png", chartFile);
} | [
"@",
"SuppressWarnings",
"(",
"\"nls\"",
")",
"public",
"void",
"dumpChart",
"(",
"File",
"chartFile",
",",
"boolean",
"autoRange",
",",
"boolean",
"withLegend",
",",
"int",
"imageWidth",
",",
"int",
"imageHeight",
")",
"throws",
"IOException",
"{",
"JFreeChart"... | Creates the chart image and dumps it to file.
@param chartFile the file to which to write to.
@param autoRange flag to define if to auto define the range from the bounds.
@param withLegend flag to define the legend presence.
@param imageWidth the output image width (if -1 default is used).
@param imageHeight the output image height (if -1 default is used).
@throws IOException | [
"Creates",
"the",
"chart",
"image",
"and",
"dumps",
"it",
"to",
"file",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/images/LineChartGenerator.java#L85-L125 |
bazaarvoice/emodb | databus-api/src/main/java/com/bazaarvoice/emodb/databus/api/Event.java | Event.getJsonSerializingContent | @JsonView(EventViews.ContentOnly.class)
@JsonProperty("content")
private Map<String, Object> getJsonSerializingContent() {
//noinspection unchecked
return (Map<String, Object>) _content;
} | java | @JsonView(EventViews.ContentOnly.class)
@JsonProperty("content")
private Map<String, Object> getJsonSerializingContent() {
//noinspection unchecked
return (Map<String, Object>) _content;
} | [
"@",
"JsonView",
"(",
"EventViews",
".",
"ContentOnly",
".",
"class",
")",
"@",
"JsonProperty",
"(",
"\"content\"",
")",
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"getJsonSerializingContent",
"(",
")",
"{",
"//noinspection unchecked",
"return",
"(",
... | For purposes of JSON serialization wrapping the content in an unmodifiable view may cause the serializer
to choose a less-optimal implementation. Since JSON serialization cannot modify the underlying content
it is safe to return the original content object to the serializer. | [
"For",
"purposes",
"of",
"JSON",
"serialization",
"wrapping",
"the",
"content",
"in",
"an",
"unmodifiable",
"view",
"may",
"cause",
"the",
"serializer",
"to",
"choose",
"a",
"less",
"-",
"optimal",
"implementation",
".",
"Since",
"JSON",
"serialization",
"cannot... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/databus-api/src/main/java/com/bazaarvoice/emodb/databus/api/Event.java#L45-L50 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java | ColorImg.setValue | public void setValue(final int channel, final int x, final int y, final double value){
this.data[channel][y*this.width + x] = value;
} | java | public void setValue(final int channel, final int x, final int y, final double value){
this.data[channel][y*this.width + x] = value;
} | [
"public",
"void",
"setValue",
"(",
"final",
"int",
"channel",
",",
"final",
"int",
"x",
",",
"final",
"int",
"y",
",",
"final",
"double",
"value",
")",
"{",
"this",
".",
"data",
"[",
"channel",
"]",
"[",
"y",
"*",
"this",
".",
"width",
"+",
"x",
... | Sets value at the specified position for the specified channel.
No bounds checks will be performed, positions outside of this
images dimension can either result in a value for a different position
or an ArrayIndexOutOfBoundsException.
@param channel the set value corresponds to
@param x coordinate
@param y coordinate
@param value to be set at specified position. e.g. 0xff0000ff for blue color
@throws ArrayIndexOutOfBoundsException if resulting index from x and y
is not within the data arrays bounds
or if the specified channel is not in [0,3]
or is 3 but the image has no alpha (check using {@link #hasAlpha()}).
@see #getValue(int channel, int x, int y) | [
"Sets",
"value",
"at",
"the",
"specified",
"position",
"for",
"the",
"specified",
"channel",
".",
"No",
"bounds",
"checks",
"will",
"be",
"performed",
"positions",
"outside",
"of",
"this",
"images",
"dimension",
"can",
"either",
"result",
"in",
"a",
"value",
... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java#L946-L948 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/network/inatsession_stats.java | inatsession_stats.get | public static inatsession_stats get(nitro_service service, String name) throws Exception{
inatsession_stats obj = new inatsession_stats();
obj.set_name(name);
inatsession_stats response = (inatsession_stats) obj.stat_resource(service);
return response;
} | java | public static inatsession_stats get(nitro_service service, String name) throws Exception{
inatsession_stats obj = new inatsession_stats();
obj.set_name(name);
inatsession_stats response = (inatsession_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"inatsession_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"inatsession_stats",
"obj",
"=",
"new",
"inatsession_stats",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
... | Use this API to fetch statistics of inatsession_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"inatsession_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/network/inatsession_stats.java#L231-L236 |
liferay/com-liferay-commerce | commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java | CommerceWishListPersistenceImpl.removeByG_U_D | @Override
public void removeByG_U_D(long groupId, long userId, boolean defaultWishList) {
for (CommerceWishList commerceWishList : findByG_U_D(groupId, userId,
defaultWishList, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceWishList);
}
} | java | @Override
public void removeByG_U_D(long groupId, long userId, boolean defaultWishList) {
for (CommerceWishList commerceWishList : findByG_U_D(groupId, userId,
defaultWishList, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceWishList);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_U_D",
"(",
"long",
"groupId",
",",
"long",
"userId",
",",
"boolean",
"defaultWishList",
")",
"{",
"for",
"(",
"CommerceWishList",
"commerceWishList",
":",
"findByG_U_D",
"(",
"groupId",
",",
"userId",
",",
"defaultWi... | Removes all the commerce wish lists where groupId = ? and userId = ? and defaultWishList = ? from the database.
@param groupId the group ID
@param userId the user ID
@param defaultWishList the default wish list | [
"Removes",
"all",
"the",
"commerce",
"wish",
"lists",
"where",
"groupId",
"=",
"?",
";",
"and",
"userId",
"=",
"?",
";",
"and",
"defaultWishList",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L4133-L4139 |
hibernate/hibernate-metamodelgen | src/main/java/org/hibernate/jpamodelgen/ClassWriter.java | ClassWriter.extendsSuperMetaModel | private static boolean extendsSuperMetaModel(Element superClassElement, boolean entityMetaComplete, Context context) {
// if we processed the superclass in the same run we definitely need to extend
String superClassName = ( (TypeElement) superClassElement ).getQualifiedName().toString();
if ( context.containsMetaEntity( superClassName )
|| context.containsMetaEmbeddable( superClassName ) ) {
return true;
}
// to allow for the case that the metamodel class for the super entity is for example contained in another
// jar file we use reflection. However, we need to consider the fact that there is xml configuration
// and annotations should be ignored
if ( !entityMetaComplete && ( TypeUtils.containsAnnotation( superClassElement, Constants.ENTITY )
|| TypeUtils.containsAnnotation( superClassElement, Constants.MAPPED_SUPERCLASS ) ) ) {
return true;
}
return false;
} | java | private static boolean extendsSuperMetaModel(Element superClassElement, boolean entityMetaComplete, Context context) {
// if we processed the superclass in the same run we definitely need to extend
String superClassName = ( (TypeElement) superClassElement ).getQualifiedName().toString();
if ( context.containsMetaEntity( superClassName )
|| context.containsMetaEmbeddable( superClassName ) ) {
return true;
}
// to allow for the case that the metamodel class for the super entity is for example contained in another
// jar file we use reflection. However, we need to consider the fact that there is xml configuration
// and annotations should be ignored
if ( !entityMetaComplete && ( TypeUtils.containsAnnotation( superClassElement, Constants.ENTITY )
|| TypeUtils.containsAnnotation( superClassElement, Constants.MAPPED_SUPERCLASS ) ) ) {
return true;
}
return false;
} | [
"private",
"static",
"boolean",
"extendsSuperMetaModel",
"(",
"Element",
"superClassElement",
",",
"boolean",
"entityMetaComplete",
",",
"Context",
"context",
")",
"{",
"// if we processed the superclass in the same run we definitely need to extend",
"String",
"superClassName",
"... | Checks whether this metamodel class needs to extend another metamodel class.
This methods checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation (eg it could be
part of a separate jar. See also METAGEN-35).
@param superClassElement the super class element
@param entityMetaComplete flag indicating if the entity for which the metamodel should be generarted is metamodel
complete. If so we cannot use reflection to decide whether we have to add the extend clause
@param context the execution context
@return {@code true} in case there is super class meta model to extend from {@code false} otherwise. | [
"Checks",
"whether",
"this",
"metamodel",
"class",
"needs",
"to",
"extend",
"another",
"metamodel",
"class",
".",
"This",
"methods",
"checks",
"whether",
"the",
"processor",
"has",
"generated",
"a",
"metamodel",
"class",
"for",
"the",
"super",
"class",
"but",
... | train | https://github.com/hibernate/hibernate-metamodelgen/blob/2c87b262bc03b1a5a541789fc00c54e0531a36b2/src/main/java/org/hibernate/jpamodelgen/ClassWriter.java#L177-L194 |
hypercube1024/firefly | firefly-wechat/src/main/java/com/firefly/wechat/utils/SHA1.java | SHA1.getSHA1 | public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException {
try {
String[] array = new String[]{token, timestamp, nonce, encrypt};
StringBuilder sb = new StringBuilder();
// 字符串排序
Arrays.sort(array);
for (int i = 0; i < 4; i++) {
sb.append(array[i]);
}
String str = sb.toString();
// SHA1签名生成
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(str.getBytes());
byte[] digest = md.digest();
StringBuilder hex = new StringBuilder();
String shaHex;
for (byte aDigest : digest) {
shaHex = Integer.toHexString(aDigest & 0xFF);
if (shaHex.length() < 2) {
hex.append(0);
}
hex.append(shaHex);
}
return hex.toString();
} catch (Exception e) {
throw new AesException(AesException.ComputeSignatureError);
}
} | java | public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException {
try {
String[] array = new String[]{token, timestamp, nonce, encrypt};
StringBuilder sb = new StringBuilder();
// 字符串排序
Arrays.sort(array);
for (int i = 0; i < 4; i++) {
sb.append(array[i]);
}
String str = sb.toString();
// SHA1签名生成
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(str.getBytes());
byte[] digest = md.digest();
StringBuilder hex = new StringBuilder();
String shaHex;
for (byte aDigest : digest) {
shaHex = Integer.toHexString(aDigest & 0xFF);
if (shaHex.length() < 2) {
hex.append(0);
}
hex.append(shaHex);
}
return hex.toString();
} catch (Exception e) {
throw new AesException(AesException.ComputeSignatureError);
}
} | [
"public",
"static",
"String",
"getSHA1",
"(",
"String",
"token",
",",
"String",
"timestamp",
",",
"String",
"nonce",
",",
"String",
"encrypt",
")",
"throws",
"AesException",
"{",
"try",
"{",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"]",
"{... | 用SHA1算法生成安全签名
@param token 票据
@param timestamp 时间戳
@param nonce 随机字符串
@param encrypt 密文
@return 安全签名
@throws AesException | [
"用SHA1算法生成安全签名"
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-wechat/src/main/java/com/firefly/wechat/utils/SHA1.java#L25-L53 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java | PropertyService.parsePasswordProperties | public static final void parsePasswordProperties(Map<String, Object> vendorProps) {
for (String propName : PASSWORD_PROPS) {
String propValue = (String) vendorProps.remove(propName);
if (propValue != null)
vendorProps.put(propName, new SerializableProtectedString(propValue.toCharArray()));
}
} | java | public static final void parsePasswordProperties(Map<String, Object> vendorProps) {
for (String propName : PASSWORD_PROPS) {
String propValue = (String) vendorProps.remove(propName);
if (propValue != null)
vendorProps.put(propName, new SerializableProtectedString(propValue.toCharArray()));
}
} | [
"public",
"static",
"final",
"void",
"parsePasswordProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"vendorProps",
")",
"{",
"for",
"(",
"String",
"propName",
":",
"PASSWORD_PROPS",
")",
"{",
"String",
"propValue",
"=",
"(",
"String",
")",
"vendor... | Parse and convert password properties to SerializableProtectedString.
@param vendorProps | [
"Parse",
"and",
"convert",
"password",
"properties",
"to",
"SerializableProtectedString",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/PropertyService.java#L281-L288 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java | MSPDIReader.readAvailabilityTable | private void readAvailabilityTable(Resource resource, AvailabilityPeriods periods)
{
if (periods != null)
{
AvailabilityTable table = resource.getAvailability();
List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
for (AvailabilityPeriod period : list)
{
Date start = period.getAvailableFrom();
Date end = period.getAvailableTo();
Number units = DatatypeConverter.parseUnits(period.getAvailableUnits());
Availability availability = new Availability(start, end, units);
table.add(availability);
}
Collections.sort(table);
}
} | java | private void readAvailabilityTable(Resource resource, AvailabilityPeriods periods)
{
if (periods != null)
{
AvailabilityTable table = resource.getAvailability();
List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
for (AvailabilityPeriod period : list)
{
Date start = period.getAvailableFrom();
Date end = period.getAvailableTo();
Number units = DatatypeConverter.parseUnits(period.getAvailableUnits());
Availability availability = new Availability(start, end, units);
table.add(availability);
}
Collections.sort(table);
}
} | [
"private",
"void",
"readAvailabilityTable",
"(",
"Resource",
"resource",
",",
"AvailabilityPeriods",
"periods",
")",
"{",
"if",
"(",
"periods",
"!=",
"null",
")",
"{",
"AvailabilityTable",
"table",
"=",
"resource",
".",
"getAvailability",
"(",
")",
";",
"List",
... | Reads the availability table from the file.
@param resource MPXJ resource instance
@param periods MSPDI availability periods | [
"Reads",
"the",
"availability",
"table",
"from",
"the",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1086-L1102 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java | SeleniumHelper.html5DragAndDrop | public void html5DragAndDrop(WebElement source, WebElement target) throws IOException {
URL url = Resources.getResource(DRAG_AND_DROP_SIM_JS_RESOURCE);
String js = Resources.toString(url, Charsets.UTF_8);
executeJavascript(js + " DndSimulator.simulate(arguments[0], arguments[1]);" , source, target);
} | java | public void html5DragAndDrop(WebElement source, WebElement target) throws IOException {
URL url = Resources.getResource(DRAG_AND_DROP_SIM_JS_RESOURCE);
String js = Resources.toString(url, Charsets.UTF_8);
executeJavascript(js + " DndSimulator.simulate(arguments[0], arguments[1]);" , source, target);
} | [
"public",
"void",
"html5DragAndDrop",
"(",
"WebElement",
"source",
",",
"WebElement",
"target",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"Resources",
".",
"getResource",
"(",
"DRAG_AND_DROP_SIM_JS_RESOURCE",
")",
";",
"String",
"js",
"=",
"Resources",... | Simulates a drag from source element and drop to target element. HTML5 draggable-compatible
Workaround for https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3604
Uses https://github.com/Photonios/JS-DragAndDrop-Simulator for maximum compatibility
@param source element to start the drag
@param target element to end the drag
@throws IOException when the simulator javascript is not found on the classpath | [
"Simulates",
"a",
"drag",
"from",
"source",
"element",
"and",
"drop",
"to",
"target",
"element",
".",
"HTML5",
"draggable",
"-",
"compatible",
"Workaround",
"for",
"https",
":",
"//",
"github",
".",
"com",
"/",
"seleniumhq",
"/",
"selenium",
"-",
"google",
... | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L594-L598 |
intuit/QuickBooks-V3-Java-SDK | oauth2-platform-api/src/main/java/com/intuit/oauth2/client/OAuth2PlatformClient.java | OAuth2PlatformClient.getUserInfo | public UserInfoResponse getUserInfo(String accessToken) throws OpenIdException {
logger.debug("Enter OAuth2PlatformClient::getUserInfo");
try {
HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig());
Request request = new Request.RequestBuilder(MethodType.GET, oauth2Config.getUserProfileEndpoint())
.requiresAuthentication(true)
.authString("Bearer " + accessToken)
.build();
Response response = client.makeRequest(request);
logger.debug("Response Code : "+ response.getStatusCode());
if (response.getStatusCode() == 200) {
ObjectReader reader = mapper.readerFor(UserInfoResponse.class);
UserInfoResponse userInfoResponse = reader.readValue(response.getContent());
return userInfoResponse;
} else {
logger.debug("failed getting user info");
throw new OpenIdException("failed getting user info", response.getStatusCode() + "");
}
}
catch (Exception ex) {
logger.error("Exception while retrieving user info ", ex);
throw new OpenIdException(ex.getMessage(), ex);
}
} | java | public UserInfoResponse getUserInfo(String accessToken) throws OpenIdException {
logger.debug("Enter OAuth2PlatformClient::getUserInfo");
try {
HttpRequestClient client = new HttpRequestClient(oauth2Config.getProxyConfig());
Request request = new Request.RequestBuilder(MethodType.GET, oauth2Config.getUserProfileEndpoint())
.requiresAuthentication(true)
.authString("Bearer " + accessToken)
.build();
Response response = client.makeRequest(request);
logger.debug("Response Code : "+ response.getStatusCode());
if (response.getStatusCode() == 200) {
ObjectReader reader = mapper.readerFor(UserInfoResponse.class);
UserInfoResponse userInfoResponse = reader.readValue(response.getContent());
return userInfoResponse;
} else {
logger.debug("failed getting user info");
throw new OpenIdException("failed getting user info", response.getStatusCode() + "");
}
}
catch (Exception ex) {
logger.error("Exception while retrieving user info ", ex);
throw new OpenIdException(ex.getMessage(), ex);
}
} | [
"public",
"UserInfoResponse",
"getUserInfo",
"(",
"String",
"accessToken",
")",
"throws",
"OpenIdException",
"{",
"logger",
".",
"debug",
"(",
"\"Enter OAuth2PlatformClient::getUserInfo\"",
")",
";",
"try",
"{",
"HttpRequestClient",
"client",
"=",
"new",
"HttpRequestCli... | Method to retrieve UserInfo data associated with the accessToken generated
The response depends on the Scope supplied during openId
@param accessToken
@return
@throws OpenIdException | [
"Method",
"to",
"retrieve",
"UserInfo",
"data",
"associated",
"with",
"the",
"accessToken",
"generated",
"The",
"response",
"depends",
"on",
"the",
"Scope",
"supplied",
"during",
"openId"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/oauth2-platform-api/src/main/java/com/intuit/oauth2/client/OAuth2PlatformClient.java#L237-L265 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/core/attribute/Geoshape.java | Geoshape.getPoint | public Point getPoint(int position) {
if (position<0 || position>=size()) throw new ArrayIndexOutOfBoundsException("Invalid position: " + position);
return new Point(coordinates[0][position],coordinates[1][position]);
} | java | public Point getPoint(int position) {
if (position<0 || position>=size()) throw new ArrayIndexOutOfBoundsException("Invalid position: " + position);
return new Point(coordinates[0][position],coordinates[1][position]);
} | [
"public",
"Point",
"getPoint",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"position",
">=",
"size",
"(",
")",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"Invalid position: \"",
"+",
"position",
")",
";",
"retu... | Returns the point at the given position. The position must be smaller than {@link #size()}.
@param position
@return | [
"Returns",
"the",
"point",
"at",
"the",
"given",
"position",
".",
"The",
"position",
"must",
"be",
"smaller",
"than",
"{",
"@link",
"#size",
"()",
"}",
"."
] | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/core/attribute/Geoshape.java#L181-L184 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/scp/ScpClient.java | ScpClient.get | public void get(String localDir, String[] remoteFiles, boolean recursive)
throws SshException, ChannelOpenException {
get(localDir, remoteFiles, recursive, null);
} | java | public void get(String localDir, String[] remoteFiles, boolean recursive)
throws SshException, ChannelOpenException {
get(localDir, remoteFiles, recursive, null);
} | [
"public",
"void",
"get",
"(",
"String",
"localDir",
",",
"String",
"[",
"]",
"remoteFiles",
",",
"boolean",
"recursive",
")",
"throws",
"SshException",
",",
"ChannelOpenException",
"{",
"get",
"(",
"localDir",
",",
"remoteFiles",
",",
"recursive",
",",
"null",... | <p>
Downloads an array of remote files to the local computer.
</p>
@param localDir
The local path to place the files
@param remoteFiles
The path of the remote files
@param recursive
recursively copy the contents of a directory
@throws IOException
if an IO error occurs during the operation | [
"<p",
">",
"Downloads",
"an",
"array",
"of",
"remote",
"files",
"to",
"the",
"local",
"computer",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/scp/ScpClient.java#L324-L327 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/proposalservice/GetProposalsPendingApproval.java | GetProposalsPendingApproval.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
ProposalServiceInterface proposalService =
adManagerServices.get(session, ProposalServiceInterface.class);
// Create a statement to select proposals.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", ProposalStatus.PENDING_APPROVAL.toString());
// Retrieve a small amount of proposals at a time, paging through
// until all proposals have been retrieved.
int totalResultSetSize = 0;
do {
ProposalPage page =
proposalService.getProposalsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each proposal.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Proposal proposal : page.getResults()) {
System.out.printf(
"%d) Proposal with ID %d and name '%s' was found.%n",
i++,
proposal.getId(),
proposal.getName()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
ProposalServiceInterface proposalService =
adManagerServices.get(session, ProposalServiceInterface.class);
// Create a statement to select proposals.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", ProposalStatus.PENDING_APPROVAL.toString());
// Retrieve a small amount of proposals at a time, paging through
// until all proposals have been retrieved.
int totalResultSetSize = 0;
do {
ProposalPage page =
proposalService.getProposalsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each proposal.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Proposal proposal : page.getResults()) {
System.out.printf(
"%d) Proposal with ID %d and name '%s' was found.%n",
i++,
proposal.getId(),
proposal.getName()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"ProposalServiceInterface",
"proposalService",
"=",
"adManagerServices",
".",
"get",
"(",
"session",
",",
... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/proposalservice/GetProposalsPendingApproval.java#L52-L89 |
google/closure-templates | java/src/com/google/template/soy/basicfunctions/BasicFunctionsRuntime.java | BasicFunctionsRuntime.augmentMap | public static SoyDict augmentMap(SoyValue sv1, SoyValue sv2) {
SoyDict first = (SoyDict) sv1;
SoyDict second = (SoyDict) sv2;
Map<String, SoyValueProvider> map =
Maps.newHashMapWithExpectedSize(first.getItemCnt() + second.getItemCnt());
map.putAll(first.asJavaStringMap());
map.putAll(second.asJavaStringMap());
return DictImpl.forProviderMap(map, RuntimeMapTypeTracker.Type.LEGACY_OBJECT_MAP_OR_RECORD);
} | java | public static SoyDict augmentMap(SoyValue sv1, SoyValue sv2) {
SoyDict first = (SoyDict) sv1;
SoyDict second = (SoyDict) sv2;
Map<String, SoyValueProvider> map =
Maps.newHashMapWithExpectedSize(first.getItemCnt() + second.getItemCnt());
map.putAll(first.asJavaStringMap());
map.putAll(second.asJavaStringMap());
return DictImpl.forProviderMap(map, RuntimeMapTypeTracker.Type.LEGACY_OBJECT_MAP_OR_RECORD);
} | [
"public",
"static",
"SoyDict",
"augmentMap",
"(",
"SoyValue",
"sv1",
",",
"SoyValue",
"sv2",
")",
"{",
"SoyDict",
"first",
"=",
"(",
"SoyDict",
")",
"sv1",
";",
"SoyDict",
"second",
"=",
"(",
"SoyDict",
")",
"sv2",
";",
"Map",
"<",
"String",
",",
"SoyV... | Combine the two maps -- for the JavaSource variant while the function signature is still ?
instead of map. | [
"Combine",
"the",
"two",
"maps",
"--",
"for",
"the",
"JavaSource",
"variant",
"while",
"the",
"function",
"signature",
"is",
"still",
"?",
"instead",
"of",
"map",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basicfunctions/BasicFunctionsRuntime.java#L48-L56 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolOperationHandler.java | TransactionalProtocolOperationHandler.sendResponse | static void sendResponse(final ManagementRequestContext<ExecuteRequestContext> context, final byte responseType, final ModelNode response) throws IOException {
// WFLY-3090 Protect the communication channel from getting closed due to administrative
// cancellation of the management op by using a separate thread to send
final CountDownLatch latch = new CountDownLatch(1);
final IOExceptionHolder exceptionHolder = new IOExceptionHolder();
boolean accepted = context.executeAsync(new AsyncTask<TransactionalProtocolOperationHandler.ExecuteRequestContext>() {
@Override
public void execute(final ManagementRequestContext<ExecuteRequestContext> context) throws Exception {
FlushableDataOutput output = null;
try {
MGMT_OP_LOGGER.tracef("Transmitting response for %d", context.getOperationId());
final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader());
output = context.writeMessage(header);
// response type
output.writeByte(responseType);
// operation result
response.writeExternal(output);
// response end
output.writeByte(ManagementProtocol.RESPONSE_END);
output.close();
} catch (IOException toCache) {
exceptionHolder.exception = toCache;
} finally {
StreamUtils.safeClose(output);
latch.countDown();
}
}
}, false);
if (accepted) {
try {
latch.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
if (exceptionHolder.exception != null) {
throw exceptionHolder.exception;
}
}
} | java | static void sendResponse(final ManagementRequestContext<ExecuteRequestContext> context, final byte responseType, final ModelNode response) throws IOException {
// WFLY-3090 Protect the communication channel from getting closed due to administrative
// cancellation of the management op by using a separate thread to send
final CountDownLatch latch = new CountDownLatch(1);
final IOExceptionHolder exceptionHolder = new IOExceptionHolder();
boolean accepted = context.executeAsync(new AsyncTask<TransactionalProtocolOperationHandler.ExecuteRequestContext>() {
@Override
public void execute(final ManagementRequestContext<ExecuteRequestContext> context) throws Exception {
FlushableDataOutput output = null;
try {
MGMT_OP_LOGGER.tracef("Transmitting response for %d", context.getOperationId());
final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader());
output = context.writeMessage(header);
// response type
output.writeByte(responseType);
// operation result
response.writeExternal(output);
// response end
output.writeByte(ManagementProtocol.RESPONSE_END);
output.close();
} catch (IOException toCache) {
exceptionHolder.exception = toCache;
} finally {
StreamUtils.safeClose(output);
latch.countDown();
}
}
}, false);
if (accepted) {
try {
latch.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
if (exceptionHolder.exception != null) {
throw exceptionHolder.exception;
}
}
} | [
"static",
"void",
"sendResponse",
"(",
"final",
"ManagementRequestContext",
"<",
"ExecuteRequestContext",
">",
"context",
",",
"final",
"byte",
"responseType",
",",
"final",
"ModelNode",
"response",
")",
"throws",
"IOException",
"{",
"// WFLY-3090 Protect the communicatio... | Send an operation response.
@param context the request context
@param responseType the response type
@param response the operation response
@throws java.io.IOException for any error | [
"Send",
"an",
"operation",
"response",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolOperationHandler.java#L618-L658 |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.formatLocal | public synchronized static String formatLocal(long gmtTime, String format)
{
_localDate.setGMTTime(gmtTime);
return _localDate.format(new CharBuffer(), format).toString();
} | java | public synchronized static String formatLocal(long gmtTime, String format)
{
_localDate.setGMTTime(gmtTime);
return _localDate.format(new CharBuffer(), format).toString();
} | [
"public",
"synchronized",
"static",
"String",
"formatLocal",
"(",
"long",
"gmtTime",
",",
"String",
"format",
")",
"{",
"_localDate",
".",
"setGMTTime",
"(",
"gmtTime",
")",
";",
"return",
"_localDate",
".",
"format",
"(",
"new",
"CharBuffer",
"(",
")",
",",... | Formats a time in the local time zone.
@param time in milliseconds, GMT, from the epoch.
@param format formatting string. | [
"Formats",
"a",
"time",
"in",
"the",
"local",
"time",
"zone",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L945-L950 |
JodaOrg/joda-time | src/main/java/org/joda/time/chrono/BasicMonthOfYearDateTimeField.java | BasicMonthOfYearDateTimeField.addWrapField | public long addWrapField(long instant, int months) {
return set(instant, FieldUtils.getWrappedValue(get(instant), months, MIN, iMax));
} | java | public long addWrapField(long instant, int months) {
return set(instant, FieldUtils.getWrappedValue(get(instant), months, MIN, iMax));
} | [
"public",
"long",
"addWrapField",
"(",
"long",
"instant",
",",
"int",
"months",
")",
"{",
"return",
"set",
"(",
"instant",
",",
"FieldUtils",
".",
"getWrappedValue",
"(",
"get",
"(",
"instant",
")",
",",
"months",
",",
"MIN",
",",
"iMax",
")",
")",
";"... | Add to the Month component of the specified time instant
wrapping around within that component if necessary.
@see org.joda.time.DateTimeField#addWrapField
@param instant the time instant in millis to update.
@param months the months to add (can be negative).
@return the updated time instant. | [
"Add",
"to",
"the",
"Month",
"component",
"of",
"the",
"specified",
"time",
"instant",
"wrapping",
"around",
"within",
"that",
"component",
"if",
"necessary",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/BasicMonthOfYearDateTimeField.java#L248-L250 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/XMLSerializer.java | XMLSerializer.writeCharacters | public void writeCharacters(final char[] ch, final int start, final int length) throws SAXException {
if (elementStack.isEmpty()) {
throw new IllegalStateException("Current state does not allow Character writing");
}
processStartElement();
transformer.characters(ch, start, length);
} | java | public void writeCharacters(final char[] ch, final int start, final int length) throws SAXException {
if (elementStack.isEmpty()) {
throw new IllegalStateException("Current state does not allow Character writing");
}
processStartElement();
transformer.characters(ch, start, length);
} | [
"public",
"void",
"writeCharacters",
"(",
"final",
"char",
"[",
"]",
"ch",
",",
"final",
"int",
"start",
",",
"final",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"elementStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"... | Write characters.
@param ch character data array
@param start start index
@param length length data to write
@throws SAXException if processing the event failed
@throws IllegalStateException if start element is not open | [
"Write",
"characters",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLSerializer.java#L271-L277 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/vectorcollection/KDTree.java | KDTree.getMedianIndex | public int getMedianIndex(final List<Integer> data, int pivot)
{
int medianIndex = data.size()/2;
//What if more than one point have the samve value? Keep incrementing until that dosn't happen
while(medianIndex < data.size()-1 && allVecs.get(data.get(medianIndex)).get(pivot) == allVecs.get(data.get(medianIndex+1)).get(pivot))
medianIndex++;
return medianIndex;
} | java | public int getMedianIndex(final List<Integer> data, int pivot)
{
int medianIndex = data.size()/2;
//What if more than one point have the samve value? Keep incrementing until that dosn't happen
while(medianIndex < data.size()-1 && allVecs.get(data.get(medianIndex)).get(pivot) == allVecs.get(data.get(medianIndex+1)).get(pivot))
medianIndex++;
return medianIndex;
} | [
"public",
"int",
"getMedianIndex",
"(",
"final",
"List",
"<",
"Integer",
">",
"data",
",",
"int",
"pivot",
")",
"{",
"int",
"medianIndex",
"=",
"data",
".",
"size",
"(",
")",
"/",
"2",
";",
"//What if more than one point have the samve value? Keep incrementing unt... | Returns the index for the median, adjusted incase multiple features have the same value.
@param data the dataset to get the median index of
@param pivot the dimension to pivot on, and ensure the median index has a different value on the left side
@return | [
"Returns",
"the",
"index",
"for",
"the",
"median",
"adjusted",
"incase",
"multiple",
"features",
"have",
"the",
"same",
"value",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/vectorcollection/KDTree.java#L615-L622 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java | XMLConfigWebFactory.createFileFromResourceCheckSizeDiff | static void createFileFromResourceCheckSizeDiff(String resource, Resource file) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtil.copy(InfoImpl.class.getResourceAsStream(resource), baos, true, false);
byte[] barr = baos.toByteArray();
if (file.exists()) {
long trgSize = file.length();
long srcSize = barr.length;
if (srcSize == trgSize) return;
SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), "update file:" + file);
SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), " - source:" + srcSize);
SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), " - target:" + trgSize);
}
else file.createNewFile();
// SystemOut.printDate("write file:"+file);
IOUtil.copy(new ByteArrayInputStream(barr), file, true);
} | java | static void createFileFromResourceCheckSizeDiff(String resource, Resource file) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtil.copy(InfoImpl.class.getResourceAsStream(resource), baos, true, false);
byte[] barr = baos.toByteArray();
if (file.exists()) {
long trgSize = file.length();
long srcSize = barr.length;
if (srcSize == trgSize) return;
SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), "update file:" + file);
SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), " - source:" + srcSize);
SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), " - target:" + trgSize);
}
else file.createNewFile();
// SystemOut.printDate("write file:"+file);
IOUtil.copy(new ByteArrayInputStream(barr), file, true);
} | [
"static",
"void",
"createFileFromResourceCheckSizeDiff",
"(",
"String",
"resource",
",",
"Resource",
"file",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"IOUtil",
".",
"copy",
"(",
"InfoImpl... | creates a File and his content froma a resurce
@param resource
@param file
@throws IOException | [
"creates",
"a",
"File",
"and",
"his",
"content",
"froma",
"a",
"resurce"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L1060-L1079 |
BigBadaboom/androidsvg | androidsvg/src/main/java/com/caverock/androidsvg/SVG.java | SVG.setDocumentViewBox | @SuppressWarnings({"WeakerAccess", "unused"})
public void setDocumentViewBox(float minX, float minY, float width, float height)
{
if (this.rootElement == null)
throw new IllegalArgumentException("SVG document is empty");
this.rootElement.viewBox = new Box(minX, minY, width, height);
} | java | @SuppressWarnings({"WeakerAccess", "unused"})
public void setDocumentViewBox(float minX, float minY, float width, float height)
{
if (this.rootElement == null)
throw new IllegalArgumentException("SVG document is empty");
this.rootElement.viewBox = new Box(minX, minY, width, height);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"public",
"void",
"setDocumentViewBox",
"(",
"float",
"minX",
",",
"float",
"minY",
",",
"float",
"width",
",",
"float",
"height",
")",
"{",
"if",
"(",
"this",
".",
"rootEl... | Change the document view box by altering the "viewBox" attribute
of the root {@code <svg>} element.
<p>
The viewBox generally describes the bounding box dimensions of the
document contents. A valid viewBox is necessary if you want the
document scaled to fit the canvas or viewport the document is to be
rendered into.
<p>
By setting a viewBox that describes only a portion of the document,
you can reproduce the effect of image sprites.
@param minX the left coordinate of the viewBox in pixels
@param minY the top coordinate of the viewBox in pixels.
@param width the width of the viewBox in pixels
@param height the height of the viewBox in pixels
@throws IllegalArgumentException if there is no current SVG document loaded. | [
"Change",
"the",
"document",
"view",
"box",
"by",
"altering",
"the",
"viewBox",
"attribute",
"of",
"the",
"root",
"{",
"@code",
"<svg",
">",
"}",
"element",
".",
"<p",
">",
"The",
"viewBox",
"generally",
"describes",
"the",
"bounding",
"box",
"dimensions",
... | train | https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVG.java#L816-L823 |
interedition/collatex | collatex-core/src/main/java/eu/interedition/collatex/suffixarray/QSufSort.java | QSufSort.update_group | private void update_group(int pl, int pm) {
int g;
g = pm; /* group number. */
V[start + I[pl]] = g; /* update group number of first position. */
if (pl == pm) I[pl] = -1; /* one element, sorted group. */
else do
/* more than one element, unsorted group. */
V[start + I[++pl]] = g; /* update group numbers. */
while (pl < pm);
} | java | private void update_group(int pl, int pm) {
int g;
g = pm; /* group number. */
V[start + I[pl]] = g; /* update group number of first position. */
if (pl == pm) I[pl] = -1; /* one element, sorted group. */
else do
/* more than one element, unsorted group. */
V[start + I[++pl]] = g; /* update group numbers. */
while (pl < pm);
} | [
"private",
"void",
"update_group",
"(",
"int",
"pl",
",",
"int",
"pm",
")",
"{",
"int",
"g",
";",
"g",
"=",
"pm",
";",
"/* group number. */",
"V",
"[",
"start",
"+",
"I",
"[",
"pl",
"]",
"]",
"=",
"g",
";",
"/* update group number of first position. */",... | Subroutine for {@link #select_sort_split(int, int)} and
{@link #sort_split(int, int)}. Sets group numbers for a group whose lowest position
in {@link #I} is <code>pl</code> and highest position is <code>pm</code>. | [
"Subroutine",
"for",
"{"
] | train | https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/QSufSort.java#L215-L226 |
mrniko/netty-socketio | src/main/java/com/corundumstudio/socketio/SocketIOServer.java | SocketIOServer.getRoomOperations | public BroadcastOperations getRoomOperations(String room) {
Iterable<SocketIOClient> clients = namespacesHub.getRoomClients(room);
return new BroadcastOperations(clients, configCopy.getStoreFactory());
} | java | public BroadcastOperations getRoomOperations(String room) {
Iterable<SocketIOClient> clients = namespacesHub.getRoomClients(room);
return new BroadcastOperations(clients, configCopy.getStoreFactory());
} | [
"public",
"BroadcastOperations",
"getRoomOperations",
"(",
"String",
"room",
")",
"{",
"Iterable",
"<",
"SocketIOClient",
">",
"clients",
"=",
"namespacesHub",
".",
"getRoomClients",
"(",
"room",
")",
";",
"return",
"new",
"BroadcastOperations",
"(",
"clients",
",... | Get broadcast operations for clients within
room by <code>room</code> name
@param room - name of room
@return broadcast operations | [
"Get",
"broadcast",
"operations",
"for",
"clients",
"within",
"room",
"by",
"<code",
">",
"room<",
"/",
"code",
">",
"name"
] | train | https://github.com/mrniko/netty-socketio/blob/ea1787f3369f94f527002bd9737fb278750933e2/src/main/java/com/corundumstudio/socketio/SocketIOServer.java#L110-L113 |
gitblit/fathom | fathom-mailer/src/main/java/fathom/mailer/Mailer.java | Mailer.newTextTemplateMailRequest | public MailRequest newTextTemplateMailRequest(String subjectTemplate, String textTemplateName, Map<String, Object> parameters) {
return createTemplateMailRequest(generateRequestId(), subjectTemplate, textTemplateName, false, parameters);
} | java | public MailRequest newTextTemplateMailRequest(String subjectTemplate, String textTemplateName, Map<String, Object> parameters) {
return createTemplateMailRequest(generateRequestId(), subjectTemplate, textTemplateName, false, parameters);
} | [
"public",
"MailRequest",
"newTextTemplateMailRequest",
"(",
"String",
"subjectTemplate",
",",
"String",
"textTemplateName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"return",
"createTemplateMailRequest",
"(",
"generateRequestId",
"(",
")"... | Creates a MailRequest from the specified template.
The request id is automatically generated.
@param subjectTemplate a string that uses the parameters & TemplateEngine to interpolate values
@param textTemplateName the name of the classpath template resource
@param parameters
@return a text mail request | [
"Creates",
"a",
"MailRequest",
"from",
"the",
"specified",
"template",
".",
"The",
"request",
"id",
"is",
"automatically",
"generated",
"."
] | train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-mailer/src/main/java/fathom/mailer/Mailer.java#L155-L157 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java | BlobServicesInner.getServicePropertiesAsync | public Observable<BlobServicePropertiesInner> getServicePropertiesAsync(String resourceGroupName, String accountName) {
return getServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<BlobServicePropertiesInner>, BlobServicePropertiesInner>() {
@Override
public BlobServicePropertiesInner call(ServiceResponse<BlobServicePropertiesInner> response) {
return response.body();
}
});
} | java | public Observable<BlobServicePropertiesInner> getServicePropertiesAsync(String resourceGroupName, String accountName) {
return getServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<BlobServicePropertiesInner>, BlobServicePropertiesInner>() {
@Override
public BlobServicePropertiesInner call(ServiceResponse<BlobServicePropertiesInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BlobServicePropertiesInner",
">",
"getServicePropertiesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"getServicePropertiesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")"... | Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BlobServicePropertiesInner object | [
"Gets",
"the",
"properties",
"of",
"a",
"storage",
"account’s",
"Blob",
"service",
"including",
"properties",
"for",
"Storage",
"Analytics",
"and",
"CORS",
"(",
"Cross",
"-",
"Origin",
"Resource",
"Sharing",
")",
"rules",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java#L197-L204 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.