repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/receivers/PushBroadcastReceiver.java | PushBroadcastReceiver.dispatchMessage | private void dispatchMessage(PushMessageListener listener, RemoteMessage message) {
if (listener != null) {
mainThreadHandler.post(() -> listener.onMessageReceived(message));
}
} | java | private void dispatchMessage(PushMessageListener listener, RemoteMessage message) {
if (listener != null) {
mainThreadHandler.post(() -> listener.onMessageReceived(message));
}
} | [
"private",
"void",
"dispatchMessage",
"(",
"PushMessageListener",
"listener",
",",
"RemoteMessage",
"message",
")",
"{",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"mainThreadHandler",
".",
"post",
"(",
"(",
")",
"->",
"listener",
".",
"onMessageReceived",
... | Dispatch received push message to external listener.
@param listener Push message listener.
@param message Received push message to be dispatched. | [
"Dispatch",
"received",
"push",
"message",
"to",
"external",
"listener",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/receivers/PushBroadcastReceiver.java#L71-L75 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/QueryBitmapConverter.java | QueryBitmapConverter.setupDefaultView | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
properties = new HashMap<String,Object>();
properties.put(ScreenModel.COMMAND, MenuConstants.FORMLINK);
properties.put(ScreenModel.IMAGE, MenuConstants.FORM);
return BaseField.createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties);
} | java | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
properties = new HashMap<String,Object>();
properties.put(ScreenModel.COMMAND, MenuConstants.FORMLINK);
properties.put(ScreenModel.IMAGE, MenuConstants.FORM);
return BaseField.createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties);
} | [
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"properties... | Set up the default control for this field.
A SCannedBox for a query bitmap converter.
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param iDisplayFieldDesc Display the label? (optional).
@return Return the component or ScreenField that is created for this field. | [
"Set",
"up",
"the",
"default",
"control",
"for",
"this",
"field",
".",
"A",
"SCannedBox",
"for",
"a",
"query",
"bitmap",
"converter",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/QueryBitmapConverter.java#L115-L121 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java | LongestAliphaticChainDescriptor.getMaxDepth | private static int getMaxDepth(int[][] adjlist, int v, int prev) {
int longest = 0;
for (int w : adjlist[v]) {
if (w == prev) continue;
// no cycles so don't need to check previous
int length = getMaxDepth(adjlist, w, v);
if (length > longest)
longest = length;
}
return 1 + longest;
} | java | private static int getMaxDepth(int[][] adjlist, int v, int prev) {
int longest = 0;
for (int w : adjlist[v]) {
if (w == prev) continue;
// no cycles so don't need to check previous
int length = getMaxDepth(adjlist, w, v);
if (length > longest)
longest = length;
}
return 1 + longest;
} | [
"private",
"static",
"int",
"getMaxDepth",
"(",
"int",
"[",
"]",
"[",
"]",
"adjlist",
",",
"int",
"v",
",",
"int",
"prev",
")",
"{",
"int",
"longest",
"=",
"0",
";",
"for",
"(",
"int",
"w",
":",
"adjlist",
"[",
"v",
"]",
")",
"{",
"if",
"(",
... | Depth-First-Search on an acyclic graph. Since we have no cycles we
don't need the visit flags and only need to know which atom we came from.
@param adjlist adjacency list representation of grah
@param v the current atom index
@param prev the previous atom index
@return the max length traversed | [
"Depth",
"-",
"First",
"-",
"Search",
"on",
"an",
"acyclic",
"graph",
".",
"Since",
"we",
"have",
"no",
"cycles",
"we",
"don",
"t",
"need",
"the",
"visit",
"flags",
"and",
"only",
"need",
"to",
"know",
"which",
"atom",
"we",
"came",
"from",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java#L154-L164 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleApiKeys.java | ModuleApiKeys.fetchAll | public CMAArray<CMAApiKey> fetchAll(Map<String, String> query) {
throwIfEnvironmentIdIsSet();
return fetchAll(spaceId, query);
} | java | public CMAArray<CMAApiKey> fetchAll(Map<String, String> query) {
throwIfEnvironmentIdIsSet();
return fetchAll(spaceId, query);
} | [
"public",
"CMAArray",
"<",
"CMAApiKey",
">",
"fetchAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"query",
")",
"{",
"throwIfEnvironmentIdIsSet",
"(",
")",
";",
"return",
"fetchAll",
"(",
"spaceId",
",",
"query",
")",
";",
"}"
] | Query for specific api keys from the configured space.
@param query the terms to query for specific keys.
@return a list of delivery api keys.
@throws IllegalArgumentException if configured space Id is null.
@throws CMANotWithEnvironmentsException if environmentId was set using
{@link CMAClient.Builder#setEnvironmentId(String)}.
@see CMAClient.Builder#setSpaceId(String) | [
"Query",
"for",
"specific",
"api",
"keys",
"from",
"the",
"configured",
"space",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleApiKeys.java#L100-L103 |
strator-dev/greenpepper | greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java | AbstractGreenPepperMacro.getBulkUID | protected String getBulkUID(Map<String,String> parameters)
{
String group = (String)parameters.get("group");
return StringUtil.isEmpty(group) ? "PAGE" : group;
} | java | protected String getBulkUID(Map<String,String> parameters)
{
String group = (String)parameters.get("group");
return StringUtil.isEmpty(group) ? "PAGE" : group;
} | [
"protected",
"String",
"getBulkUID",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"String",
"group",
"=",
"(",
"String",
")",
"parameters",
".",
"get",
"(",
"\"group\"",
")",
";",
"return",
"StringUtil",
".",
"isEmpty",
"(",
"gr... | <p>getBulkUID.</p>
@param parameters a {@link java.util.Map} object.
@return a {@link java.lang.String} object. | [
"<p",
">",
"getBulkUID",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java#L239-L243 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java | Workgroup.getChatSettings | private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ChatSettings request = new ChatSettings();
if (key != null) {
request.setKey(key);
}
if (type != -1) {
request.setType(type);
}
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
ChatSettings response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
} | java | private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
ChatSettings request = new ChatSettings();
if (key != null) {
request.setKey(key);
}
if (type != -1) {
request.setType(type);
}
request.setType(IQ.Type.get);
request.setTo(workgroupJID);
ChatSettings response = connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
} | [
"private",
"ChatSettings",
"getChatSettings",
"(",
"String",
"key",
",",
"int",
"type",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"ChatSettings",
"request",
"=",
"new",
"ChatSettings"... | Asks the workgroup for it's Chat Settings.
@return key specify a key to retrieve only that settings. Otherwise for all settings, key should be null.
@throws NoResponseException
@throws XMPPErrorException if an error occurs while getting information from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Asks",
"the",
"workgroup",
"for",
"it",
"s",
"Chat",
"Settings",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java#L649-L663 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java | CPDefinitionSpecificationOptionValuePersistenceImpl.countByUuid_C | @Override
public int countByUuid_C(String uuid, long companyId) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_C;
Object[] finderArgs = new Object[] { uuid, companyId };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_CPDEFINITIONSPECIFICATIONOPTIONVALUE_WHERE);
boolean bindUuid = false;
if (uuid == null) {
query.append(_FINDER_COLUMN_UUID_C_UUID_1);
}
else if (uuid.equals("")) {
query.append(_FINDER_COLUMN_UUID_C_UUID_3);
}
else {
bindUuid = true;
query.append(_FINDER_COLUMN_UUID_C_UUID_2);
}
query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindUuid) {
qPos.add(uuid);
}
qPos.add(companyId);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByUuid_C(String uuid, long companyId) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_C;
Object[] finderArgs = new Object[] { uuid, companyId };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_CPDEFINITIONSPECIFICATIONOPTIONVALUE_WHERE);
boolean bindUuid = false;
if (uuid == null) {
query.append(_FINDER_COLUMN_UUID_C_UUID_1);
}
else if (uuid.equals("")) {
query.append(_FINDER_COLUMN_UUID_C_UUID_3);
}
else {
bindUuid = true;
query.append(_FINDER_COLUMN_UUID_C_UUID_2);
}
query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindUuid) {
qPos.add(uuid);
}
qPos.add(companyId);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_UUID_C",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
"{",
"uuid",
... | Returns the number of cp definition specification option values where uuid = ? and companyId = ?.
@param uuid the uuid
@param companyId the company ID
@return the number of matching cp definition specification option values | [
"Returns",
"the",
"number",
"of",
"cp",
"definition",
"specification",
"option",
"values",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java#L1455-L1516 |
amilcar-sr/JustifiedTextView | library/src/main/java/com/codesgood/views/JustifiedTextView.java | JustifiedTextView.fillSentenceWithSpaces | private String fillSentenceWithSpaces(List<String> sentence) {
sentenceWithSpaces.clear();
//We don't need to do this process if the sentence received is a single word.
if (sentence.size() > 1) {
//We fill with normal spaces first, we can do this with confidence because "fitsInSentence"
//already takes these spaces into account.
for (String word : sentence) {
sentenceWithSpaces.add(word);
sentenceWithSpaces.add(NORMAL_SPACE);
}
//Filling sentence with thin spaces.
while (fitsInSentence(HAIR_SPACE, sentenceWithSpaces, false)) {
//We remove 2 from the sentence size because we need to make sure we are not adding
//spaces to the end of the line.
sentenceWithSpaces.add(getRandomNumber(sentenceWithSpaces.size() - 2), HAIR_SPACE);
}
}
return getSentenceFromList(sentenceWithSpaces, false);
} | java | private String fillSentenceWithSpaces(List<String> sentence) {
sentenceWithSpaces.clear();
//We don't need to do this process if the sentence received is a single word.
if (sentence.size() > 1) {
//We fill with normal spaces first, we can do this with confidence because "fitsInSentence"
//already takes these spaces into account.
for (String word : sentence) {
sentenceWithSpaces.add(word);
sentenceWithSpaces.add(NORMAL_SPACE);
}
//Filling sentence with thin spaces.
while (fitsInSentence(HAIR_SPACE, sentenceWithSpaces, false)) {
//We remove 2 from the sentence size because we need to make sure we are not adding
//spaces to the end of the line.
sentenceWithSpaces.add(getRandomNumber(sentenceWithSpaces.size() - 2), HAIR_SPACE);
}
}
return getSentenceFromList(sentenceWithSpaces, false);
} | [
"private",
"String",
"fillSentenceWithSpaces",
"(",
"List",
"<",
"String",
">",
"sentence",
")",
"{",
"sentenceWithSpaces",
".",
"clear",
"(",
")",
";",
"//We don't need to do this process if the sentence received is a single word.",
"if",
"(",
"sentence",
".",
"size",
... | Fills sentence with appropriate amount of spaces.
@param sentence Sentence we'll use to build the sentence with additional spaces
@return String with spaces. | [
"Fills",
"sentence",
"with",
"appropriate",
"amount",
"of",
"spaces",
"."
] | train | https://github.com/amilcar-sr/JustifiedTextView/blob/8fd91b4cfb225f973096519eae8295c3d7e8d49f/library/src/main/java/com/codesgood/views/JustifiedTextView.java#L193-L214 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.onesLike | public SDVariable onesLike(String name, @NonNull SDVariable input, @NonNull DataType dataType) {
SDVariable ret = f().onesLike(name, input, dataType);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable onesLike(String name, @NonNull SDVariable input, @NonNull DataType dataType) {
SDVariable ret = f().onesLike(name, input, dataType);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"onesLike",
"(",
"String",
"name",
",",
"@",
"NonNull",
"SDVariable",
"input",
",",
"@",
"NonNull",
"DataType",
"dataType",
")",
"{",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"onesLike",
"(",
"name",
",",
"input",
",",
"dataT... | As per {@link #onesLike(String, SDVariable)} but the output datatype may be specified | [
"As",
"per",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1535-L1538 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.photos_addTag | public boolean photos_addTag(Long photoId, Integer taggedUserId, Double xPct, Double yPct)
throws FacebookException, IOException {
return photos_addTag(photoId, xPct, yPct, taggedUserId, null);
} | java | public boolean photos_addTag(Long photoId, Integer taggedUserId, Double xPct, Double yPct)
throws FacebookException, IOException {
return photos_addTag(photoId, xPct, yPct, taggedUserId, null);
} | [
"public",
"boolean",
"photos_addTag",
"(",
"Long",
"photoId",
",",
"Integer",
"taggedUserId",
",",
"Double",
"xPct",
",",
"Double",
"yPct",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"photos_addTag",
"(",
"photoId",
",",
"xPct",
",",
... | Adds a tag to a photo.
@param photoId The photo id of the photo to be tagged.
@param xPct The horizontal position of the tag, as a percentage from 0 to 100, from the left of the photo.
@param yPct The vertical position of the tag, as a percentage from 0 to 100, from the top of the photo.
@param taggedUserId The list of photos from which to extract photo tags.
@return whether the tag was successfully added. | [
"Adds",
"a",
"tag",
"to",
"a",
"photo",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1353-L1356 |
mozilla/rhino | toolsrc/org/mozilla/javascript/tools/debugger/Dim.java | Dim.getObjectIds | public Object[] getObjectIds(Object object) {
DimIProxy action = new DimIProxy(this, IPROXY_OBJECT_IDS);
action.object = object;
action.withContext();
return action.objectArrayResult;
} | java | public Object[] getObjectIds(Object object) {
DimIProxy action = new DimIProxy(this, IPROXY_OBJECT_IDS);
action.object = object;
action.withContext();
return action.objectArrayResult;
} | [
"public",
"Object",
"[",
"]",
"getObjectIds",
"(",
"Object",
"object",
")",
"{",
"DimIProxy",
"action",
"=",
"new",
"DimIProxy",
"(",
"this",
",",
"IPROXY_OBJECT_IDS",
")",
";",
"action",
".",
"object",
"=",
"object",
";",
"action",
".",
"withContext",
"("... | Returns an array of the property names on the given script object. | [
"Returns",
"an",
"array",
"of",
"the",
"property",
"names",
"on",
"the",
"given",
"script",
"object",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/debugger/Dim.java#L645-L650 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addIdNotInCommaSeparatedListCondition | protected void addIdNotInCommaSeparatedListCondition(final String propertyName, final String value) throws NumberFormatException {
addIdNotInArrayCondition(propertyName, value.split(","));
} | java | protected void addIdNotInCommaSeparatedListCondition(final String propertyName, final String value) throws NumberFormatException {
addIdNotInArrayCondition(propertyName, value.split(","));
} | [
"protected",
"void",
"addIdNotInCommaSeparatedListCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"value",
")",
"throws",
"NumberFormatException",
"{",
"addIdNotInArrayCondition",
"(",
"propertyName",
",",
"value",
".",
"split",
"(",
"\",\"",... | Add a Field Search Condition that will check if the id field does not exist in a comma separated list of ids. eg.
{@code field NOT IN (value)}
@param propertyName The name of the field id as defined in the Entity mapping class.
@param value The comma separated list of ids.
@throws NumberFormatException Thrown if one of the Strings cannot be converted to an Integer. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"id",
"field",
"does",
"not",
"exist",
"in",
"a",
"comma",
"separated",
"list",
"of",
"ids",
".",
"eg",
".",
"{",
"@code",
"field",
"NOT",
"IN",
"(",
"value",
")",
"}"
... | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L412-L414 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java | ConfigFileApplicationListener.addPropertySources | protected void addPropertySources(ConfigurableEnvironment environment,
ResourceLoader resourceLoader) {
RandomValuePropertySource.addToEnvironment(environment);
new Loader(environment, resourceLoader).load();
} | java | protected void addPropertySources(ConfigurableEnvironment environment,
ResourceLoader resourceLoader) {
RandomValuePropertySource.addToEnvironment(environment);
new Loader(environment, resourceLoader).load();
} | [
"protected",
"void",
"addPropertySources",
"(",
"ConfigurableEnvironment",
"environment",
",",
"ResourceLoader",
"resourceLoader",
")",
"{",
"RandomValuePropertySource",
".",
"addToEnvironment",
"(",
"environment",
")",
";",
"new",
"Loader",
"(",
"environment",
",",
"re... | Add config file property sources to the specified environment.
@param environment the environment to add source to
@param resourceLoader the resource loader
@see #addPostProcessors(ConfigurableApplicationContext) | [
"Add",
"config",
"file",
"property",
"sources",
"to",
"the",
"specified",
"environment",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java#L210-L214 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.listUpgradeNotificationsAsync | public Observable<NotificationListResponseInner> listUpgradeNotificationsAsync(String resourceGroupName, String name, double history) {
return listUpgradeNotificationsWithServiceResponseAsync(resourceGroupName, name, history).map(new Func1<ServiceResponse<NotificationListResponseInner>, NotificationListResponseInner>() {
@Override
public NotificationListResponseInner call(ServiceResponse<NotificationListResponseInner> response) {
return response.body();
}
});
} | java | public Observable<NotificationListResponseInner> listUpgradeNotificationsAsync(String resourceGroupName, String name, double history) {
return listUpgradeNotificationsWithServiceResponseAsync(resourceGroupName, name, history).map(new Func1<ServiceResponse<NotificationListResponseInner>, NotificationListResponseInner>() {
@Override
public NotificationListResponseInner call(ServiceResponse<NotificationListResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NotificationListResponseInner",
">",
"listUpgradeNotificationsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"double",
"history",
")",
"{",
"return",
"listUpgradeNotificationsWithServiceResponseAsync",
"(",
"resourceGroup... | Gets any upgrade notifications for a Redis cache.
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param history how many minutes in past to look for upgrade notifications
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NotificationListResponseInner object | [
"Gets",
"any",
"upgrade",
"notifications",
"for",
"a",
"Redis",
"cache",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L272-L279 |
primefaces/primefaces | src/main/java/org/primefaces/model/timeline/TimelineModel.java | TimelineModel.updateAll | public void updateAll(Collection<TimelineEvent> events, TimelineUpdater timelineUpdater) {
if (events != null && !events.isEmpty()) {
for (TimelineEvent event : events) {
update(event, timelineUpdater);
}
}
} | java | public void updateAll(Collection<TimelineEvent> events, TimelineUpdater timelineUpdater) {
if (events != null && !events.isEmpty()) {
for (TimelineEvent event : events) {
update(event, timelineUpdater);
}
}
} | [
"public",
"void",
"updateAll",
"(",
"Collection",
"<",
"TimelineEvent",
">",
"events",
",",
"TimelineUpdater",
"timelineUpdater",
")",
"{",
"if",
"(",
"events",
"!=",
"null",
"&&",
"!",
"events",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"TimelineEve... | Updates all given events in the model with UI update.
@param events collection of events to be updated
@param timelineUpdater TimelineUpdater instance to update the events in UI | [
"Updates",
"all",
"given",
"events",
"in",
"the",
"model",
"with",
"UI",
"update",
"."
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/model/timeline/TimelineModel.java#L183-L189 |
CloudSlang/score | engine/score-facade/src/main/java/io/cloudslang/score/facade/entities/ExecutionPlanCompressUtil.java | ExecutionPlanCompressUtil.getExecutionPlanFromBytes | public static ExecutionPlan getExecutionPlanFromBytes(byte[] bytes) {
try (ByteArrayInputStream is = new ByteArrayInputStream(bytes);
BufferedInputStream bis = new BufferedInputStream(is);
GZIPInputStream gis = new GZIPInputStream(bis);
BufferedInputStream bis_2 = new BufferedInputStream(gis);
ObjectInputStream ois = new ObjectInputStream(bis_2);
) {
return (ExecutionPlan) ois.readObject();
} catch (IOException | ClassNotFoundException ex) {
logger.error("Failed to read execution plan from byte[]. Error: ", ex);
throw new RuntimeException("Failed to read execution plan from byte[]. Error: ", ex);
}
} | java | public static ExecutionPlan getExecutionPlanFromBytes(byte[] bytes) {
try (ByteArrayInputStream is = new ByteArrayInputStream(bytes);
BufferedInputStream bis = new BufferedInputStream(is);
GZIPInputStream gis = new GZIPInputStream(bis);
BufferedInputStream bis_2 = new BufferedInputStream(gis);
ObjectInputStream ois = new ObjectInputStream(bis_2);
) {
return (ExecutionPlan) ois.readObject();
} catch (IOException | ClassNotFoundException ex) {
logger.error("Failed to read execution plan from byte[]. Error: ", ex);
throw new RuntimeException("Failed to read execution plan from byte[]. Error: ", ex);
}
} | [
"public",
"static",
"ExecutionPlan",
"getExecutionPlanFromBytes",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"try",
"(",
"ByteArrayInputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
";",
"BufferedInputStream",
"bis",
"=",
"new",
"BufferedInp... | Gets byte[] that contains serialized object ExecutionPlan + zipped
and creates ExecutionPlan from it
@param bytes - compressed serialized object of ExecutionPlan
@return ExecutionPlan | [
"Gets",
"byte",
"[]",
"that",
"contains",
"serialized",
"object",
"ExecutionPlan",
"+",
"zipped",
"and",
"creates",
"ExecutionPlan",
"from",
"it"
] | train | https://github.com/CloudSlang/score/blob/796134e917843f4d95a90f7740d69dc5257a1a0e/engine/score-facade/src/main/java/io/cloudslang/score/facade/entities/ExecutionPlanCompressUtil.java#L48-L63 |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/date/DatePickerDialog.java | DatePickerDialog.adjustDayInMonthIfNeeded | private void adjustDayInMonthIfNeeded(int month, int year) {
int day = mCalendar.get(Calendar.DAY_OF_MONTH);
int daysInMonth = DateTimePickerUtils.getDaysInMonth(month, year);
if (day > daysInMonth) {
mCalendar.set(Calendar.DAY_OF_MONTH, daysInMonth);
}
} | java | private void adjustDayInMonthIfNeeded(int month, int year) {
int day = mCalendar.get(Calendar.DAY_OF_MONTH);
int daysInMonth = DateTimePickerUtils.getDaysInMonth(month, year);
if (day > daysInMonth) {
mCalendar.set(Calendar.DAY_OF_MONTH, daysInMonth);
}
} | [
"private",
"void",
"adjustDayInMonthIfNeeded",
"(",
"int",
"month",
",",
"int",
"year",
")",
"{",
"int",
"day",
"=",
"mCalendar",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
")",
";",
"int",
"daysInMonth",
"=",
"DateTimePickerUtils",
".",
"getDaysInMonth... | e.g. Switching from 2012 to 2013 when Feb 29, 2012 is selected -> Feb 28, 2013 | [
"e",
".",
"g",
".",
"Switching",
"from",
"2012",
"to",
"2013",
"when",
"Feb",
"29",
"2012",
"is",
"selected",
"-",
">",
"Feb",
"28",
"2013"
] | train | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/date/DatePickerDialog.java#L355-L361 |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.writeUtf8 | public static ByteBuf writeUtf8(ByteBufAllocator alloc, CharSequence seq) {
// UTF-8 uses max. 3 bytes per char, so calculate the worst case.
ByteBuf buf = alloc.buffer(utf8MaxBytes(seq));
writeUtf8(buf, seq);
return buf;
} | java | public static ByteBuf writeUtf8(ByteBufAllocator alloc, CharSequence seq) {
// UTF-8 uses max. 3 bytes per char, so calculate the worst case.
ByteBuf buf = alloc.buffer(utf8MaxBytes(seq));
writeUtf8(buf, seq);
return buf;
} | [
"public",
"static",
"ByteBuf",
"writeUtf8",
"(",
"ByteBufAllocator",
"alloc",
",",
"CharSequence",
"seq",
")",
"{",
"// UTF-8 uses max. 3 bytes per char, so calculate the worst case.",
"ByteBuf",
"buf",
"=",
"alloc",
".",
"buffer",
"(",
"utf8MaxBytes",
"(",
"seq",
")",
... | Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> and write
it to a {@link ByteBuf} allocated with {@code alloc}.
@param alloc The allocator used to allocate a new {@link ByteBuf}.
@param seq The characters to write into a buffer.
@return The {@link ByteBuf} which contains the <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoded
result. | [
"Encode",
"a",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L483-L488 |
gresrun/jesque | src/main/java/net/greghaines/jesque/admin/AbstractAdminClient.java | AbstractAdminClient.doPublish | public static void doPublish(final Jedis jedis, final String namespace, final String channel, final String jobJson) {
jedis.publish(JesqueUtils.createKey(namespace, CHANNEL, channel), jobJson);
} | java | public static void doPublish(final Jedis jedis, final String namespace, final String channel, final String jobJson) {
jedis.publish(JesqueUtils.createKey(namespace, CHANNEL, channel), jobJson);
} | [
"public",
"static",
"void",
"doPublish",
"(",
"final",
"Jedis",
"jedis",
",",
"final",
"String",
"namespace",
",",
"final",
"String",
"channel",
",",
"final",
"String",
"jobJson",
")",
"{",
"jedis",
".",
"publish",
"(",
"JesqueUtils",
".",
"createKey",
"(",
... | Helper method that encapsulates the minimum logic for publishing a job to
a channel.
@param jedis
the connection to Redis
@param namespace
the Resque namespace
@param channel
the channel name
@param jobJson
the job serialized as JSON | [
"Helper",
"method",
"that",
"encapsulates",
"the",
"minimum",
"logic",
"for",
"publishing",
"a",
"job",
"to",
"a",
"channel",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/admin/AbstractAdminClient.java#L133-L135 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.safelyRemoveHandlers | public static void safelyRemoveHandlers(ChannelPipeline pipeline, String... handlerNames) {
for (String name : handlerNames) {
if (pipeline.get(name) != null) {
pipeline.remove(name);
} else {
LOG.debug("Trying to remove not engaged {} handler from the pipeline", name);
}
}
} | java | public static void safelyRemoveHandlers(ChannelPipeline pipeline, String... handlerNames) {
for (String name : handlerNames) {
if (pipeline.get(name) != null) {
pipeline.remove(name);
} else {
LOG.debug("Trying to remove not engaged {} handler from the pipeline", name);
}
}
} | [
"public",
"static",
"void",
"safelyRemoveHandlers",
"(",
"ChannelPipeline",
"pipeline",
",",
"String",
"...",
"handlerNames",
")",
"{",
"for",
"(",
"String",
"name",
":",
"handlerNames",
")",
"{",
"if",
"(",
"pipeline",
".",
"get",
"(",
"name",
")",
"!=",
... | Removes handlers from the pipeline if they are present.
@param pipeline the channel pipeline
@param handlerNames names of the handlers to be removed | [
"Removes",
"handlers",
"from",
"the",
"pipeline",
"if",
"they",
"are",
"present",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L683-L691 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/CloudStorageApi.java | CloudStorageApi.listProviders | public CloudStorageProviders listProviders(String accountId, String userId) throws ApiException {
return listProviders(accountId, userId, null);
} | java | public CloudStorageProviders listProviders(String accountId, String userId) throws ApiException {
return listProviders(accountId, userId, null);
} | [
"public",
"CloudStorageProviders",
"listProviders",
"(",
"String",
"accountId",
",",
"String",
"userId",
")",
"throws",
"ApiException",
"{",
"return",
"listProviders",
"(",
"accountId",
",",
"userId",
",",
"null",
")",
";",
"}"
] | Get the Cloud Storage Provider configuration for the specified user.
Retrieves the list of cloud storage providers enabled for the account and the configuration information for the user. The {serviceId} parameter can be either the service name or serviceId.
@param accountId The external account number (int) or account ID Guid. (required)
@param userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. (required)
@return CloudStorageProviders | [
"Get",
"the",
"Cloud",
"Storage",
"Provider",
"configuration",
"for",
"the",
"specified",
"user",
".",
"Retrieves",
"the",
"list",
"of",
"cloud",
"storage",
"providers",
"enabled",
"for",
"the",
"account",
"and",
"the",
"configuration",
"information",
"for",
"th... | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/CloudStorageApi.java#L615-L617 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/StreamUtil.java | StreamUtil.copy | public static void copy(InputStream in, Writer writer) throws IOException {
copy(getInputStreamReader(in), writer);
writer.flush();
} | java | public static void copy(InputStream in, Writer writer) throws IOException {
copy(getInputStreamReader(in), writer);
writer.flush();
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"in",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"getInputStreamReader",
"(",
"in",
")",
",",
"writer",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] | Copies the content of an input stream to a writer.
@param in the input stream to read
@param writer the writer to write
@throws java.io.IOException if an I/O error occurs | [
"Copies",
"the",
"content",
"of",
"an",
"input",
"stream",
"to",
"a",
"writer",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/StreamUtil.java#L209-L212 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/blogs/BlogsInterface.java | BlogsInterface.postPhoto | public void postPhoto(Photo photo, String blogId) throws FlickrException {
postPhoto(photo, blogId, null);
} | java | public void postPhoto(Photo photo, String blogId) throws FlickrException {
postPhoto(photo, blogId, null);
} | [
"public",
"void",
"postPhoto",
"(",
"Photo",
"photo",
",",
"String",
"blogId",
")",
"throws",
"FlickrException",
"{",
"postPhoto",
"(",
"photo",
",",
"blogId",
",",
"null",
")",
";",
"}"
] | Post the specified photo to a blog.
@param photo
The photo metadata
@param blogId
The blog ID
@throws FlickrException | [
"Post",
"the",
"specified",
"photo",
"to",
"a",
"blog",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/blogs/BlogsInterface.java#L112-L114 |
alkacon/opencms-core | src/org/opencms/lock/CmsLock.java | CmsLock.isDirectlyOwnedInProjectBy | public boolean isDirectlyOwnedInProjectBy(CmsUser user, CmsProject project) {
return (isExclusive() || isDirectlyInherited()) && isOwnedInProjectBy(user, project);
} | java | public boolean isDirectlyOwnedInProjectBy(CmsUser user, CmsProject project) {
return (isExclusive() || isDirectlyInherited()) && isOwnedInProjectBy(user, project);
} | [
"public",
"boolean",
"isDirectlyOwnedInProjectBy",
"(",
"CmsUser",
"user",
",",
"CmsProject",
"project",
")",
"{",
"return",
"(",
"isExclusive",
"(",
")",
"||",
"isDirectlyInherited",
"(",
")",
")",
"&&",
"isOwnedInProjectBy",
"(",
"user",
",",
"project",
")",
... | Returns <code>true</code> if this is an exclusive, temporary exclusive, or
directly inherited lock, and the given user is the owner of this lock,
checking also the project of the lock.<p>
@param user the user to compare to the owner of this lock
@param project the project to compare to the project of this lock
@return <code>true</code> if this is an exclusive, temporary exclusive, or
directly inherited lock, and the given user is the owner of this lock | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"this",
"is",
"an",
"exclusive",
"temporary",
"exclusive",
"or",
"directly",
"inherited",
"lock",
"and",
"the",
"given",
"user",
"is",
"the",
"owner",
"of",
"this",
"lock",
"checking",
"also",
"the"... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/lock/CmsLock.java#L264-L267 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.booleanTemplate | @Deprecated
public static BooleanTemplate booleanTemplate(String template, ImmutableList<?> args) {
return booleanTemplate(createTemplate(template), args);
} | java | @Deprecated
public static BooleanTemplate booleanTemplate(String template, ImmutableList<?> args) {
return booleanTemplate(createTemplate(template), args);
} | [
"@",
"Deprecated",
"public",
"static",
"BooleanTemplate",
"booleanTemplate",
"(",
"String",
"template",
",",
"ImmutableList",
"<",
"?",
">",
"args",
")",
"{",
"return",
"booleanTemplate",
"(",
"createTemplate",
"(",
"template",
")",
",",
"args",
")",
";",
"}"
... | Create a new Template expression
@deprecated Use {@link #booleanTemplate(String, List)} instead.
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L973-L976 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/emf-gen/org/eclipse/xtext/xbase/annotations/xAnnotations/impl/XAnnotationsPackageImpl.java | XAnnotationsPackageImpl.initializePackageContents | public void initializePackageContents()
{
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
XbasePackage theXbasePackage = (XbasePackage)EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI);
TypesPackage theTypesPackage = (TypesPackage)EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
xAnnotationEClass.getESuperTypes().add(theXbasePackage.getXExpression());
// Initialize classes and features; add operations and parameters
initEClass(xAnnotationEClass, XAnnotation.class, "XAnnotation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getXAnnotation_ElementValuePairs(), this.getXAnnotationElementValuePair(), null, "elementValuePairs", null, 0, -1, XAnnotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXAnnotation_AnnotationType(), theTypesPackage.getJvmType(), null, "annotationType", null, 0, 1, XAnnotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXAnnotation_Value(), theXbasePackage.getXExpression(), null, "value", null, 0, 1, XAnnotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(xAnnotationElementValuePairEClass, XAnnotationElementValuePair.class, "XAnnotationElementValuePair", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getXAnnotationElementValuePair_Value(), theXbasePackage.getXExpression(), null, "value", null, 0, 1, XAnnotationElementValuePair.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXAnnotationElementValuePair_Element(), theTypesPackage.getJvmOperation(), null, "element", null, 0, 1, XAnnotationElementValuePair.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
} | java | public void initializePackageContents()
{
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
XbasePackage theXbasePackage = (XbasePackage)EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI);
TypesPackage theTypesPackage = (TypesPackage)EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
xAnnotationEClass.getESuperTypes().add(theXbasePackage.getXExpression());
// Initialize classes and features; add operations and parameters
initEClass(xAnnotationEClass, XAnnotation.class, "XAnnotation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getXAnnotation_ElementValuePairs(), this.getXAnnotationElementValuePair(), null, "elementValuePairs", null, 0, -1, XAnnotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXAnnotation_AnnotationType(), theTypesPackage.getJvmType(), null, "annotationType", null, 0, 1, XAnnotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXAnnotation_Value(), theXbasePackage.getXExpression(), null, "value", null, 0, 1, XAnnotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(xAnnotationElementValuePairEClass, XAnnotationElementValuePair.class, "XAnnotationElementValuePair", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getXAnnotationElementValuePair_Value(), theXbasePackage.getXExpression(), null, "value", null, 0, 1, XAnnotationElementValuePair.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getXAnnotationElementValuePair_Element(), theTypesPackage.getJvmOperation(), null, "element", null, 0, 1, XAnnotationElementValuePair.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
} | [
"public",
"void",
"initializePackageContents",
"(",
")",
"{",
"if",
"(",
"isInitialized",
")",
"return",
";",
"isInitialized",
"=",
"true",
";",
"// Initialize package",
"setName",
"(",
"eNAME",
")",
";",
"setNsPrefix",
"(",
"eNS_PREFIX",
")",
";",
"setNsURI",
... | Complete the initialization of the package and its meta-model. This
method is guarded to have no affect on any invocation but its first.
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"Complete",
"the",
"initialization",
"of",
"the",
"package",
"and",
"its",
"meta",
"-",
"model",
".",
"This",
"method",
"is",
"guarded",
"to",
"have",
"no",
"affect",
"on",
"any",
"invocation",
"but",
"its",
"first",
".",
"<!",
"--",
"begin",
"-",
"user"... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/emf-gen/org/eclipse/xtext/xbase/annotations/xAnnotations/impl/XAnnotationsPackageImpl.java#L251-L284 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/IssuesApi.java | IssuesApi.estimateTime | public TimeStats estimateTime(Object projectIdOrPath, Integer issueIid, int duration) throws GitLabApiException {
return (estimateTime(projectIdOrPath, issueIid, new Duration(duration)));
} | java | public TimeStats estimateTime(Object projectIdOrPath, Integer issueIid, int duration) throws GitLabApiException {
return (estimateTime(projectIdOrPath, issueIid, new Duration(duration)));
} | [
"public",
"TimeStats",
"estimateTime",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"issueIid",
",",
"int",
"duration",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"estimateTime",
"(",
"projectIdOrPath",
",",
"issueIid",
",",
"new",
"Duration",
"... | Sets an estimated time of work in this issue
<pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/time_estimate</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param issueIid the internal ID of a project's issue
@param duration estimated time in seconds
@return a TimeSTats instance
@throws GitLabApiException if any exception occurs | [
"Sets",
"an",
"estimated",
"time",
"of",
"work",
"in",
"this",
"issue"
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/IssuesApi.java#L461-L463 |
protostuff/protostuff | protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java | MsgpackIOUtil.toByteArray | public static <T> byte[] toByteArray(T message, Schema<T> schema, boolean numeric)
{
ArrayBufferOutput out = new ArrayBufferOutput();
try
{
writeTo(out, message, schema, numeric);
}
catch (IOException e)
{
throw new RuntimeException("Serializing to a byte array threw an IOException", e);
}
return out.toByteArray();
} | java | public static <T> byte[] toByteArray(T message, Schema<T> schema, boolean numeric)
{
ArrayBufferOutput out = new ArrayBufferOutput();
try
{
writeTo(out, message, schema, numeric);
}
catch (IOException e)
{
throw new RuntimeException("Serializing to a byte array threw an IOException", e);
}
return out.toByteArray();
} | [
"public",
"static",
"<",
"T",
">",
"byte",
"[",
"]",
"toByteArray",
"(",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"boolean",
"numeric",
")",
"{",
"ArrayBufferOutput",
"out",
"=",
"new",
"ArrayBufferOutput",
"(",
")",
";",
"try",
"{"... | Serializes the {@code message} using the given {@code schema}. | [
"Serializes",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java#L191-L203 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getCertificateOperation | public CertificateOperation getCertificateOperation(String vaultBaseUrl, String certificateName) {
return getCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body();
} | java | public CertificateOperation getCertificateOperation(String vaultBaseUrl, String certificateName) {
return getCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName).toBlocking().single().body();
} | [
"public",
"CertificateOperation",
"getCertificateOperation",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
")",
"{",
"return",
"getCertificateOperationWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
")",
".",
"toBlocking",
"(",
")"... | Gets the creation operation of a certificate.
Gets the creation operation associated with a specified certificate. This operation requires the certificates/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateOperation object if successful. | [
"Gets",
"the",
"creation",
"operation",
"of",
"a",
"certificate",
".",
"Gets",
"the",
"creation",
"operation",
"associated",
"with",
"a",
"specified",
"certificate",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"get",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7734-L7736 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java | MamManager.getInstanceFor | public static MamManager getInstanceFor(MultiUserChat multiUserChat) {
XMPPConnection connection = multiUserChat.getXmppConnection();
Jid archiveAddress = multiUserChat.getRoom();
return getInstanceFor(connection, archiveAddress);
} | java | public static MamManager getInstanceFor(MultiUserChat multiUserChat) {
XMPPConnection connection = multiUserChat.getXmppConnection();
Jid archiveAddress = multiUserChat.getRoom();
return getInstanceFor(connection, archiveAddress);
} | [
"public",
"static",
"MamManager",
"getInstanceFor",
"(",
"MultiUserChat",
"multiUserChat",
")",
"{",
"XMPPConnection",
"connection",
"=",
"multiUserChat",
".",
"getXmppConnection",
"(",
")",
";",
"Jid",
"archiveAddress",
"=",
"multiUserChat",
".",
"getRoom",
"(",
")... | Get a MamManager for the MAM archive of the given {@code MultiUserChat}. Note that not all MUCs support MAM,
hence it is recommended to use {@link #isSupported()} to check if MAM is supported by the MUC.
@param multiUserChat the MultiUserChat to retrieve the MamManager for.
@return the MamManager for the given MultiUserChat.
@since 4.3.0 | [
"Get",
"a",
"MamManager",
"for",
"the",
"MAM",
"archive",
"of",
"the",
"given",
"{",
"@code",
"MultiUserChat",
"}",
".",
"Note",
"that",
"not",
"all",
"MUCs",
"support",
"MAM",
"hence",
"it",
"is",
"recommended",
"to",
"use",
"{",
"@link",
"#isSupported",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java#L195-L199 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.scalarMax | public SDVariable scalarMax(SDVariable in, Number value) {
return scalarMax(null, in, value);
} | java | public SDVariable scalarMax(SDVariable in, Number value) {
return scalarMax(null, in, value);
} | [
"public",
"SDVariable",
"scalarMax",
"(",
"SDVariable",
"in",
",",
"Number",
"value",
")",
"{",
"return",
"scalarMax",
"(",
"null",
",",
"in",
",",
"value",
")",
";",
"}"
] | Element-wise scalar maximum operation: out = max(in, value)
@param in Input variable
@param value Scalar value to compare
@return Output variable | [
"Element",
"-",
"wise",
"scalar",
"maximum",
"operation",
":",
"out",
"=",
"max",
"(",
"in",
"value",
")"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1943-L1945 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.suppressMethod | @Deprecated
public static synchronized void suppressMethod(Class<?> cls, Class<?>... additionalClasses) {
SuppressCode.suppressMethod(cls, additionalClasses);
} | java | @Deprecated
public static synchronized void suppressMethod(Class<?> cls, Class<?>... additionalClasses) {
SuppressCode.suppressMethod(cls, additionalClasses);
} | [
"@",
"Deprecated",
"public",
"static",
"synchronized",
"void",
"suppressMethod",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Class",
"<",
"?",
">",
"...",
"additionalClasses",
")",
"{",
"SuppressCode",
".",
"suppressMethod",
"(",
"cls",
",",
"additionalClasses",... | Suppress all methods for these classes.
@param cls The first class whose methods will be suppressed.
@param additionalClasses Additional classes whose methods will be suppressed.
@deprecated Use {@link #suppress(Method[])} instead. | [
"Suppress",
"all",
"methods",
"for",
"these",
"classes",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1854-L1857 |
arquillian/arquillian-extension-warp | impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java | WarpFilter.doFilterWarp | private void doFilterWarp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
String requestId = UUID.randomUUID().toString();
request.setAttribute(WarpCommons.WARP_REQUEST_ID, requestId);
manager.fire(new ActivateManager(manager));
manager.fire(new ProcessHttpRequest(request, response, filterChain));
manager.fire(new PassivateManager(manager));
} | java | private void doFilterWarp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
String requestId = UUID.randomUUID().toString();
request.setAttribute(WarpCommons.WARP_REQUEST_ID, requestId);
manager.fire(new ActivateManager(manager));
manager.fire(new ProcessHttpRequest(request, response, filterChain));
manager.fire(new PassivateManager(manager));
} | [
"private",
"void",
"doFilterWarp",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"FilterChain",
"filterChain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"String",
"requestId",
"=",
"UUID",
".",
"randomUUID",
"(",
... | <p>
Starts the Arquillian Manager, starts contexts and registers contextual instances.
</p>
<p>
<p>
Throws {@link ProcessHttpRequest} event which is used for further request processing.
</p>
<p>
<p>
Usually, the request is processed further by {@link HttpRequestProcessor} event observer.
</p>
<p>
<p>
The {@link ProcessHttpRequest} event is also intercepted by {@link RequestContextHandler} that activates {@link RequestContent}.
</p>
@see HttpRequestProcessor
@see RequestContextHandler | [
"<p",
">",
"Starts",
"the",
"Arquillian",
"Manager",
"starts",
"contexts",
"and",
"registers",
"contextual",
"instances",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<p",
">",
"Throws",
"{",
"@link",
"ProcessHttpRequest",
"}",
"event",
"which",
"is",
"used",
"for... | train | https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java#L145-L154 |
syphr42/libmythtv-java | control/src/main/java/org/syphr/mythtv/control/impl/Control0_24Utils.java | Control0_24Utils.getResponseMaybe | public static String getResponseMaybe(SocketManager socketManager, String message) throws IOException
{
try
{
return socketManager.sendAndWait(message);
}
catch (ResponseTimeoutException e)
{
/*
* If the timeout was hit in the previous send-and-wait, then the
* socket manager will be expecting the next message that arrives to
* be an orphan connected to this command that didn't come back in
* time. To get things back in sync, a throwaway command (help) will
* be sent.
*/
socketManager.send("help");
return "";
}
} | java | public static String getResponseMaybe(SocketManager socketManager, String message) throws IOException
{
try
{
return socketManager.sendAndWait(message);
}
catch (ResponseTimeoutException e)
{
/*
* If the timeout was hit in the previous send-and-wait, then the
* socket manager will be expecting the next message that arrives to
* be an orphan connected to this command that didn't come back in
* time. To get things back in sync, a throwaway command (help) will
* be sent.
*/
socketManager.send("help");
return "";
}
} | [
"public",
"static",
"String",
"getResponseMaybe",
"(",
"SocketManager",
"socketManager",
",",
"String",
"message",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"socketManager",
".",
"sendAndWait",
"(",
"message",
")",
";",
"}",
"catch",
"(",
"Respons... | Send a message and wait for a short period for a response. If no response
comes in that time, it is assumed that there will be no response from the
frontend. This is useful for commands that get a response when there is
data available and silence otherwise.
@param socketManager
the socket manager to use for communicating with the frontend
@param message
the message to send
@return the response if there was one; otherwise an empty string
@throws IOException
if there is a communication or protocol error | [
"Send",
"a",
"message",
"and",
"wait",
"for",
"a",
"short",
"period",
"for",
"a",
"response",
".",
"If",
"no",
"response",
"comes",
"in",
"that",
"time",
"it",
"is",
"assumed",
"that",
"there",
"will",
"be",
"no",
"response",
"from",
"the",
"frontend",
... | train | https://github.com/syphr42/libmythtv-java/blob/cc7a2012fbd4a4ba2562dda6b2614fb0548526ea/control/src/main/java/org/syphr/mythtv/control/impl/Control0_24Utils.java#L204-L222 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/dto/EventBuilder.java | EventBuilder.addField | public EventBuilder addField(String name, Object value){
event.addField(name, value);
return this;
} | java | public EventBuilder addField(String name, Object value){
event.addField(name, value);
return this;
} | [
"public",
"EventBuilder",
"addField",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"event",
".",
"addField",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds the field.
@param name the name
@param value the value
@return the event builder | [
"Adds",
"the",
"field",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/dto/EventBuilder.java#L93-L96 |
jenkinsci/jenkins | core/src/main/java/hudson/Launcher.java | Launcher.maskedPrintCommandLine | protected final void maskedPrintCommandLine(@Nonnull List<String> cmd, @CheckForNull boolean[] mask, @CheckForNull FilePath workDir) {
if(mask==null) {
printCommandLine(cmd.toArray(new String[0]),workDir);
return;
}
assert mask.length == cmd.size();
final String[] masked = new String[cmd.size()];
for (int i = 0; i < cmd.size(); i++) {
if (mask[i]) {
masked[i] = "********";
} else {
masked[i] = cmd.get(i);
}
}
printCommandLine(masked, workDir);
} | java | protected final void maskedPrintCommandLine(@Nonnull List<String> cmd, @CheckForNull boolean[] mask, @CheckForNull FilePath workDir) {
if(mask==null) {
printCommandLine(cmd.toArray(new String[0]),workDir);
return;
}
assert mask.length == cmd.size();
final String[] masked = new String[cmd.size()];
for (int i = 0; i < cmd.size(); i++) {
if (mask[i]) {
masked[i] = "********";
} else {
masked[i] = cmd.get(i);
}
}
printCommandLine(masked, workDir);
} | [
"protected",
"final",
"void",
"maskedPrintCommandLine",
"(",
"@",
"Nonnull",
"List",
"<",
"String",
">",
"cmd",
",",
"@",
"CheckForNull",
"boolean",
"[",
"]",
"mask",
",",
"@",
"CheckForNull",
"FilePath",
"workDir",
")",
"{",
"if",
"(",
"mask",
"==",
"null... | Prints out the command line to the listener with some portions masked to prevent sensitive information from being
recorded on the listener.
@param cmd The commands
@param mask An array of booleans which control whether a cmd element should be masked (<code>true</code>) or
remain unmasked (<code>false</code>).
@param workDir The work dir. | [
"Prints",
"out",
"the",
"command",
"line",
"to",
"the",
"listener",
"with",
"some",
"portions",
"masked",
"to",
"prevent",
"sensitive",
"information",
"from",
"being",
"recorded",
"on",
"the",
"listener",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Launcher.java#L776-L792 |
tweea/matrixjavalib-main-common | src/main/java/net/matrix/lang/Reflections.java | Reflections.getAccessibleField | public static Field getAccessibleField(final Object target, final String name) {
for (Class<?> superClass = target.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
try {
Field field = superClass.getDeclaredField(name);
makeAccessible(field);
return field;
} catch (NoSuchFieldException e) {
// Field 不在当前类定义,继续向上转型
LOG.trace("", e);
}
}
return null;
} | java | public static Field getAccessibleField(final Object target, final String name) {
for (Class<?> superClass = target.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
try {
Field field = superClass.getDeclaredField(name);
makeAccessible(field);
return field;
} catch (NoSuchFieldException e) {
// Field 不在当前类定义,继续向上转型
LOG.trace("", e);
}
}
return null;
} | [
"public",
"static",
"Field",
"getAccessibleField",
"(",
"final",
"Object",
"target",
",",
"final",
"String",
"name",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"superClass",
"=",
"target",
".",
"getClass",
"(",
")",
";",
"superClass",
"!=",
"Object",
... | 循环向上转型,获取对象的 DeclaredField,并强制设置为可访问。
如向上转型到 Object 仍无法找到,返回 null。
@param target
目标对象
@param name
成员名
@return 成员 | [
"循环向上转型,获取对象的",
"DeclaredField,并强制设置为可访问。",
"如向上转型到",
"Object",
"仍无法找到,返回",
"null。"
] | train | https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/lang/Reflections.java#L196-L208 |
roboconf/roboconf-platform | core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java | OpenstackIaasHandler.findStorageProperty | static String findStorageProperty( Map<String,String> targetProperties, String storageId, String propertyPrefix ) {
String property = propertyPrefix + storageId;
String value = targetProperties.get( property );
return Utils.isEmptyOrWhitespaces( value ) ? DEFAULTS.get( propertyPrefix ) : value.trim();
} | java | static String findStorageProperty( Map<String,String> targetProperties, String storageId, String propertyPrefix ) {
String property = propertyPrefix + storageId;
String value = targetProperties.get( property );
return Utils.isEmptyOrWhitespaces( value ) ? DEFAULTS.get( propertyPrefix ) : value.trim();
} | [
"static",
"String",
"findStorageProperty",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"targetProperties",
",",
"String",
"storageId",
",",
"String",
"propertyPrefix",
")",
"{",
"String",
"property",
"=",
"propertyPrefix",
"+",
"storageId",
";",
"String",
"va... | Finds a storage property for a given storage ID.
@param targetProperties
@param storageId
@param propertyPrefix one of the constants defined in this class
@return the property's value, or the default value otherwise, if one exists | [
"Finds",
"a",
"storage",
"property",
"for",
"a",
"given",
"storage",
"ID",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L517-L522 |
aws/aws-sdk-java | aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/TypedLinkAttributeDefinition.java | TypedLinkAttributeDefinition.withRules | public TypedLinkAttributeDefinition withRules(java.util.Map<String, Rule> rules) {
setRules(rules);
return this;
} | java | public TypedLinkAttributeDefinition withRules(java.util.Map<String, Rule> rules) {
setRules(rules);
return this;
} | [
"public",
"TypedLinkAttributeDefinition",
"withRules",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Rule",
">",
"rules",
")",
"{",
"setRules",
"(",
"rules",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Validation rules that are attached to the attribute definition.
</p>
@param rules
Validation rules that are attached to the attribute definition.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Validation",
"rules",
"that",
"are",
"attached",
"to",
"the",
"attribute",
"definition",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/TypedLinkAttributeDefinition.java#L308-L311 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/RunIdMigrator.java | RunIdMigrator.main | public static void main(String... args) throws Exception {
if (args.length != 1) {
throw new Exception("pass one parameter, $JENKINS_HOME");
}
File root = new File(args[0]);
File jobs = new File(root, "jobs");
if (!jobs.isDirectory()) {
throw new FileNotFoundException("no such $JENKINS_HOME " + root);
}
new RunIdMigrator().unmigrateJobsDir(jobs);
} | java | public static void main(String... args) throws Exception {
if (args.length != 1) {
throw new Exception("pass one parameter, $JENKINS_HOME");
}
File root = new File(args[0]);
File jobs = new File(root, "jobs");
if (!jobs.isDirectory()) {
throw new FileNotFoundException("no such $JENKINS_HOME " + root);
}
new RunIdMigrator().unmigrateJobsDir(jobs);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"...",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"1",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"pass one parameter, $JENKINS_HOME\"",
")",
";",
"}",
"File",
"roo... | Reverses the migration, in case you want to revert to the older format.
@param args one parameter, {@code $JENKINS_HOME} | [
"Reverses",
"the",
"migration",
"in",
"case",
"you",
"want",
"to",
"revert",
"to",
"the",
"older",
"format",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/RunIdMigrator.java#L313-L323 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java | BucketFlusher.initiateFlush | private static Observable<Boolean> initiateFlush(final ClusterFacade core, final String bucket, final String username, final String password) {
return deferAndWatch(new Func1<Subscriber, Observable<FlushResponse>>() {
@Override
public Observable<FlushResponse> call(Subscriber subscriber) {
FlushRequest request = new FlushRequest(bucket, username, password);
request.subscriber(subscriber);
return core.send(request);
}
})
.retryWhen(any().delay(Delay.fixed(100, TimeUnit.MILLISECONDS)).max(Integer.MAX_VALUE).build())
.map(new Func1<FlushResponse, Boolean>() {
@Override
public Boolean call(FlushResponse flushResponse) {
if (!flushResponse.status().isSuccess()) {
if (flushResponse.content().contains("disabled")) {
throw new FlushDisabledException("Flush is disabled for this bucket.");
} else {
throw new CouchbaseException("Flush failed because of: " + flushResponse.content());
}
}
return flushResponse.isDone();
}
});
} | java | private static Observable<Boolean> initiateFlush(final ClusterFacade core, final String bucket, final String username, final String password) {
return deferAndWatch(new Func1<Subscriber, Observable<FlushResponse>>() {
@Override
public Observable<FlushResponse> call(Subscriber subscriber) {
FlushRequest request = new FlushRequest(bucket, username, password);
request.subscriber(subscriber);
return core.send(request);
}
})
.retryWhen(any().delay(Delay.fixed(100, TimeUnit.MILLISECONDS)).max(Integer.MAX_VALUE).build())
.map(new Func1<FlushResponse, Boolean>() {
@Override
public Boolean call(FlushResponse flushResponse) {
if (!flushResponse.status().isSuccess()) {
if (flushResponse.content().contains("disabled")) {
throw new FlushDisabledException("Flush is disabled for this bucket.");
} else {
throw new CouchbaseException("Flush failed because of: " + flushResponse.content());
}
}
return flushResponse.isDone();
}
});
} | [
"private",
"static",
"Observable",
"<",
"Boolean",
">",
"initiateFlush",
"(",
"final",
"ClusterFacade",
"core",
",",
"final",
"String",
"bucket",
",",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
"{",
"return",
"deferAndWatch",
"(",
... | Initiates a flush request against the server.
The result indicates if polling needs to be done or the flush is already complete. It can also fail in case
flush is disabled or something else went wrong in the server response.
@param core the core reference.
@param bucket the bucket to flush.
@param username the user authorized for bucket access
@param password the password of the user.
@return an observable indicating if done (true) or polling needs to happen (false). | [
"Initiates",
"a",
"flush",
"request",
"against",
"the",
"server",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/BucketFlusher.java#L163-L186 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java | ST_RemoveRepeatedPoints.removeDuplicateCoordinates | public static LineString removeDuplicateCoordinates(LineString linestring, double tolerance) throws SQLException {
Coordinate[] coords = CoordinateUtils.removeRepeatedCoordinates(linestring.getCoordinates(), tolerance, false);
if(coords.length<2){
throw new SQLException("Not enough coordinates to build a new LineString.\n Please adjust the tolerance");
}
return FACTORY.createLineString(coords);
} | java | public static LineString removeDuplicateCoordinates(LineString linestring, double tolerance) throws SQLException {
Coordinate[] coords = CoordinateUtils.removeRepeatedCoordinates(linestring.getCoordinates(), tolerance, false);
if(coords.length<2){
throw new SQLException("Not enough coordinates to build a new LineString.\n Please adjust the tolerance");
}
return FACTORY.createLineString(coords);
} | [
"public",
"static",
"LineString",
"removeDuplicateCoordinates",
"(",
"LineString",
"linestring",
",",
"double",
"tolerance",
")",
"throws",
"SQLException",
"{",
"Coordinate",
"[",
"]",
"coords",
"=",
"CoordinateUtils",
".",
"removeRepeatedCoordinates",
"(",
"linestring"... | Removes duplicated coordinates within a LineString.
@param linestring
@param tolerance to delete the coordinates
@return
@throws java.sql.SQLException | [
"Removes",
"duplicated",
"coordinates",
"within",
"a",
"LineString",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java#L113-L119 |
syphr42/libmythtv-java | api/src/main/java/org/syphr/mythtv/api/commons/AbstractCachedConnection.java | AbstractCachedConnection.setTimeout | public void setTimeout(long timeout, TimeUnit unit)
{
this.timeout = TimeUnit.MILLISECONDS.convert(timeout, unit);
} | java | public void setTimeout(long timeout, TimeUnit unit)
{
this.timeout = TimeUnit.MILLISECONDS.convert(timeout, unit);
} | [
"public",
"void",
"setTimeout",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"timeout",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"timeout",
",",
"unit",
")",
";",
"}"
] | Change the idle timeout.
@param timeout
the timeout value
@param unit
the timeout units | [
"Change",
"the",
"idle",
"timeout",
"."
] | train | https://github.com/syphr42/libmythtv-java/blob/cc7a2012fbd4a4ba2562dda6b2614fb0548526ea/api/src/main/java/org/syphr/mythtv/api/commons/AbstractCachedConnection.java#L122-L125 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleDetectDescribe.java | ExampleDetectDescribe.createFromComponents | public static <T extends ImageGray<T>, TD extends TupleDesc>
DetectDescribePoint<T, TD> createFromComponents( Class<T> imageType ) {
// create a corner detector
Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
GeneralFeatureDetector corner = FactoryDetectPoint.createShiTomasi(new ConfigGeneralDetector(1000,5,1), null, derivType);
InterestPointDetector detector = FactoryInterestPoint.wrapPoint(corner, 1, imageType, derivType);
// describe points using BRIEF
DescribeRegionPoint describe = FactoryDescribeRegionPoint.brief(new ConfigBrief(true), imageType);
// Combine together.
// NOTE: orientation will not be estimated
return FactoryDetectDescribe.fuseTogether(detector, null, describe);
} | java | public static <T extends ImageGray<T>, TD extends TupleDesc>
DetectDescribePoint<T, TD> createFromComponents( Class<T> imageType ) {
// create a corner detector
Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
GeneralFeatureDetector corner = FactoryDetectPoint.createShiTomasi(new ConfigGeneralDetector(1000,5,1), null, derivType);
InterestPointDetector detector = FactoryInterestPoint.wrapPoint(corner, 1, imageType, derivType);
// describe points using BRIEF
DescribeRegionPoint describe = FactoryDescribeRegionPoint.brief(new ConfigBrief(true), imageType);
// Combine together.
// NOTE: orientation will not be estimated
return FactoryDetectDescribe.fuseTogether(detector, null, describe);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"TD",
"extends",
"TupleDesc",
">",
"DetectDescribePoint",
"<",
"T",
",",
"TD",
">",
"createFromComponents",
"(",
"Class",
"<",
"T",
">",
"imageType",
")",
"{",
"// create a corner dete... | Any arbitrary implementation of InterestPointDetector, OrientationImage, DescribeRegionPoint
can be combined into DetectDescribePoint. The syntax is more complex, but the end result is more flexible.
This should only be done if there isn't a pre-made DetectDescribePoint. | [
"Any",
"arbitrary",
"implementation",
"of",
"InterestPointDetector",
"OrientationImage",
"DescribeRegionPoint",
"can",
"be",
"combined",
"into",
"DetectDescribePoint",
".",
"The",
"syntax",
"is",
"more",
"complex",
"but",
"the",
"end",
"result",
"is",
"more",
"flexibl... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleDetectDescribe.java#L73-L86 |
RomanKisilenko/osxappbundle | src/main/java/org/codehaus/mojo/osxappbundle/CreateApplicationBundleMojo.java | CreateApplicationBundleMojo.copyDependencies | private List copyDependencies( File javaDirectory )
throws MojoExecutionException
{
ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
List list = new ArrayList();
File repoDirectory = new File(javaDirectory, "repo");
repoDirectory.mkdirs();
// First, copy the project's own artifact
File artifactFile = project.getArtifact().getFile();
list.add( repoDirectory.getName() +"/" +layout.pathOf(project.getArtifact()));
try
{
FileUtils.copyFile( artifactFile, new File(repoDirectory, layout.pathOf(project.getArtifact())) );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Could not copy artifact file " + artifactFile + " to " + javaDirectory );
}
Set artifacts = project.getArtifacts();
Iterator i = artifacts.iterator();
while ( i.hasNext() )
{
Artifact artifact = (Artifact) i.next();
File file = artifact.getFile();
File dest = new File(repoDirectory, layout.pathOf(artifact));
getLog().debug( "Adding " + file );
try
{
FileUtils.copyFile( file, dest);
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error copying file " + file + " into " + javaDirectory, e );
}
list.add( repoDirectory.getName() +"/" + layout.pathOf(artifact) );
}
return list;
} | java | private List copyDependencies( File javaDirectory )
throws MojoExecutionException
{
ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
List list = new ArrayList();
File repoDirectory = new File(javaDirectory, "repo");
repoDirectory.mkdirs();
// First, copy the project's own artifact
File artifactFile = project.getArtifact().getFile();
list.add( repoDirectory.getName() +"/" +layout.pathOf(project.getArtifact()));
try
{
FileUtils.copyFile( artifactFile, new File(repoDirectory, layout.pathOf(project.getArtifact())) );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Could not copy artifact file " + artifactFile + " to " + javaDirectory );
}
Set artifacts = project.getArtifacts();
Iterator i = artifacts.iterator();
while ( i.hasNext() )
{
Artifact artifact = (Artifact) i.next();
File file = artifact.getFile();
File dest = new File(repoDirectory, layout.pathOf(artifact));
getLog().debug( "Adding " + file );
try
{
FileUtils.copyFile( file, dest);
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error copying file " + file + " into " + javaDirectory, e );
}
list.add( repoDirectory.getName() +"/" + layout.pathOf(artifact) );
}
return list;
} | [
"private",
"List",
"copyDependencies",
"(",
"File",
"javaDirectory",
")",
"throws",
"MojoExecutionException",
"{",
"ArtifactRepositoryLayout",
"layout",
"=",
"new",
"DefaultRepositoryLayout",
"(",
")",
";",
"List",
"list",
"=",
"new",
"ArrayList",
"(",
")",
";",
"... | Copy all dependencies into the $JAVAROOT directory
@param javaDirectory where to put jar files
@return A list of file names added
@throws MojoExecutionException | [
"Copy",
"all",
"dependencies",
"into",
"the",
"$JAVAROOT",
"directory"
] | train | https://github.com/RomanKisilenko/osxappbundle/blob/2a092803b434ffb608ece2aeafd26850f105ec98/src/main/java/org/codehaus/mojo/osxappbundle/CreateApplicationBundleMojo.java#L442-L493 |
mangstadt/biweekly | src/main/java/biweekly/component/VEvent.java | VEvent.setDateEnd | public DateEnd setDateEnd(Date dateEnd, boolean hasTime) {
DateEnd prop = (dateEnd == null) ? null : new DateEnd(dateEnd, hasTime);
setDateEnd(prop);
return prop;
} | java | public DateEnd setDateEnd(Date dateEnd, boolean hasTime) {
DateEnd prop = (dateEnd == null) ? null : new DateEnd(dateEnd, hasTime);
setDateEnd(prop);
return prop;
} | [
"public",
"DateEnd",
"setDateEnd",
"(",
"Date",
"dateEnd",
",",
"boolean",
"hasTime",
")",
"{",
"DateEnd",
"prop",
"=",
"(",
"dateEnd",
"==",
"null",
")",
"?",
"null",
":",
"new",
"DateEnd",
"(",
"dateEnd",
",",
"hasTime",
")",
";",
"setDateEnd",
"(",
... | Sets the date that the event ends. This must NOT be set if a
{@link DurationProperty} is defined.
@param dateEnd the end date or null to remove
@param hasTime true if the date has a time component, false if it is
strictly a date (if false, the given Date object should be created by a
{@link java.util.Calendar Calendar} object that uses the JVM's default
timezone)
@return the property that was created
@see <a href="http://tools.ietf.org/html/rfc5545#page-95">RFC 5545
p.95-6</a>
@see <a href="http://tools.ietf.org/html/rfc2445#page-91">RFC 2445
p.91-2</a>
@see <a href="http://www.imc.org/pdi/vcal-10.doc">vCal 1.0 p.31</a> | [
"Sets",
"the",
"date",
"that",
"the",
"event",
"ends",
".",
"This",
"must",
"NOT",
"be",
"set",
"if",
"a",
"{"
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/VEvent.java#L850-L854 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/cache/Cache.java | Cache.copyAs | public Cache copyAs(String source, String destination) throws CacheException {
if(!Strings.areValid(source, destination)) {
logger.error("invalid input parameters for copy from '{}' to '{}'", source, destination);
throw new CacheException("invalid input parameters (source: '" + source + "', destination: '" + destination + "')");
}
try (InputStream input = storage.retrieve(source); OutputStream output = storage.store(destination)) {
long copied = Streams.copy(input, output);
logger.trace("copied {} bytes from '{}' to '{}'", copied, source, destination);
} catch (IOException e) {
logger.error("error copying from '" + source + "' to '" + destination + "'", e);
throw new CacheException("error copying from '" + source + "' to '" + destination + "'", e);
}
return this;
} | java | public Cache copyAs(String source, String destination) throws CacheException {
if(!Strings.areValid(source, destination)) {
logger.error("invalid input parameters for copy from '{}' to '{}'", source, destination);
throw new CacheException("invalid input parameters (source: '" + source + "', destination: '" + destination + "')");
}
try (InputStream input = storage.retrieve(source); OutputStream output = storage.store(destination)) {
long copied = Streams.copy(input, output);
logger.trace("copied {} bytes from '{}' to '{}'", copied, source, destination);
} catch (IOException e) {
logger.error("error copying from '" + source + "' to '" + destination + "'", e);
throw new CacheException("error copying from '" + source + "' to '" + destination + "'", e);
}
return this;
} | [
"public",
"Cache",
"copyAs",
"(",
"String",
"source",
",",
"String",
"destination",
")",
"throws",
"CacheException",
"{",
"if",
"(",
"!",
"Strings",
".",
"areValid",
"(",
"source",
",",
"destination",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"invalid ... | Copies data from one resource to another, possibly replacing the destination
resource if one exists.
@param source
the name of the source resource.
@param destination
the name of the destination resource
@return
the cache itself, for method chaining. | [
"Copies",
"data",
"from",
"one",
"resource",
"to",
"another",
"possibly",
"replacing",
"the",
"destination",
"resource",
"if",
"one",
"exists",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/Cache.java#L132-L145 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java | JobSchedulesImpl.deleteAsync | public Observable<Void> deleteAsync(String jobScheduleId) {
return deleteWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteAsync(String jobScheduleId) {
return deleteWithServiceResponseAsync(jobScheduleId).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobScheduleDeleteHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteAsync",
"(",
"String",
"jobScheduleId",
")",
"{",
"return",
"deleteWithServiceResponseAsync",
"(",
"jobScheduleId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"Void",
",",
"JobSche... | Deletes a job schedule from the specified account.
When you delete a job schedule, this also deletes all jobs and tasks under that schedule. When tasks are deleted, all the files in their working directories on the compute nodes are also deleted (the retention period is ignored). The job schedule statistics are no longer accessible once the job schedule is deleted, though they are still counted towards account lifetime statistics.
@param jobScheduleId The ID of the job schedule to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Deletes",
"a",
"job",
"schedule",
"from",
"the",
"specified",
"account",
".",
"When",
"you",
"delete",
"a",
"job",
"schedule",
"this",
"also",
"deletes",
"all",
"jobs",
"and",
"tasks",
"under",
"that",
"schedule",
".",
"When",
"tasks",
"are",
"deleted",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L398-L405 |
betfair/cougar | cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinAnnotationsStore.java | ZipkinAnnotationsStore.addAnnotation | @Nonnull
public ZipkinAnnotationsStore addAnnotation(long timestamp, @Nonnull String s) {
return addAnnotation(timestamp, s, defaultEndpoint);
} | java | @Nonnull
public ZipkinAnnotationsStore addAnnotation(long timestamp, @Nonnull String s) {
return addAnnotation(timestamp, s, defaultEndpoint);
} | [
"@",
"Nonnull",
"public",
"ZipkinAnnotationsStore",
"addAnnotation",
"(",
"long",
"timestamp",
",",
"@",
"Nonnull",
"String",
"s",
")",
"{",
"return",
"addAnnotation",
"(",
"timestamp",
",",
"s",
",",
"defaultEndpoint",
")",
";",
"}"
] | Adds an annotation for an event that happened on a specific timestamp.
@param timestamp The timestamp of the annotation, in microseconds
@param s The annotation value to emit
@return this object | [
"Adds",
"an",
"annotation",
"for",
"an",
"event",
"that",
"happened",
"on",
"a",
"specific",
"timestamp",
"."
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinAnnotationsStore.java#L70-L73 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.updateAsync | public Observable<AppServiceEnvironmentResourceInner> updateAsync(String resourceGroupName, String name, AppServiceEnvironmentPatchResource hostingEnvironmentEnvelope) {
return updateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | java | public Observable<AppServiceEnvironmentResourceInner> updateAsync(String resourceGroupName, String name, AppServiceEnvironmentPatchResource hostingEnvironmentEnvelope) {
return updateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AppServiceEnvironmentResourceInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"AppServiceEnvironmentPatchResource",
"hostingEnvironmentEnvelope",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
... | Create or update an App Service Environment.
Create or update an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param hostingEnvironmentEnvelope Configuration details of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AppServiceEnvironmentResourceInner object | [
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
".",
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1226-L1233 |
jenkinsci/jenkins | core/src/main/java/hudson/model/Executor.java | Executor.newImpersonatingProxy | public <T> T newImpersonatingProxy(Class<T> type, T core) {
return new InterceptingProxy() {
protected Object call(Object o, Method m, Object[] args) throws Throwable {
final Executor old = IMPERSONATION.get();
IMPERSONATION.set(Executor.this);
try {
return m.invoke(o,args);
} finally {
IMPERSONATION.set(old);
}
}
}.wrap(type,core);
} | java | public <T> T newImpersonatingProxy(Class<T> type, T core) {
return new InterceptingProxy() {
protected Object call(Object o, Method m, Object[] args) throws Throwable {
final Executor old = IMPERSONATION.get();
IMPERSONATION.set(Executor.this);
try {
return m.invoke(o,args);
} finally {
IMPERSONATION.set(old);
}
}
}.wrap(type,core);
} | [
"public",
"<",
"T",
">",
"T",
"newImpersonatingProxy",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"core",
")",
"{",
"return",
"new",
"InterceptingProxy",
"(",
")",
"{",
"protected",
"Object",
"call",
"(",
"Object",
"o",
",",
"Method",
"m",
",",
"... | Creates a proxy object that executes the callee in the context that impersonates
this executor. Useful to export an object to a remote channel. | [
"Creates",
"a",
"proxy",
"object",
"that",
"executes",
"the",
"callee",
"in",
"the",
"context",
"that",
"impersonates",
"this",
"executor",
".",
"Useful",
"to",
"export",
"an",
"object",
"to",
"a",
"remote",
"channel",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Executor.java#L906-L918 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/support/SwidUtils.java | SwidUtils.revertDomainName | public static String revertDomainName(final String domainName) {
if (StringUtils.isBlank(domainName)) {
throw new SwidException("domainName isn't defined");
}
try {
URI uri = new URI(StringUtils.prependIfMissing(domainName, "http://", "https://"));
String hostName = StringUtils.removeStart(uri.getHost(), "www.");
String[] domainNameSplit = StringUtils.split(hostName, ".");
CollectionUtils.reverseArray(domainNameSplit);
return StringUtils.join(domainNameSplit, ".");
} catch (URISyntaxException e) {
throw new SwidException("Cannot revert domain name");
}
} | java | public static String revertDomainName(final String domainName) {
if (StringUtils.isBlank(domainName)) {
throw new SwidException("domainName isn't defined");
}
try {
URI uri = new URI(StringUtils.prependIfMissing(domainName, "http://", "https://"));
String hostName = StringUtils.removeStart(uri.getHost(), "www.");
String[] domainNameSplit = StringUtils.split(hostName, ".");
CollectionUtils.reverseArray(domainNameSplit);
return StringUtils.join(domainNameSplit, ".");
} catch (URISyntaxException e) {
throw new SwidException("Cannot revert domain name");
}
} | [
"public",
"static",
"String",
"revertDomainName",
"(",
"final",
"String",
"domainName",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"domainName",
")",
")",
"{",
"throw",
"new",
"SwidException",
"(",
"\"domainName isn't defined\"",
")",
";",
"}",
"... | <p>
Revert given URL according to the <a href="http://en.wikipedia.org/wiki/Reverse_domain_name_notation">Reverse
domain name notation</a>
</p>
<p>
@see <a
href="http://en.wikipedia.org/wiki/Reverse_domain_name_notation">http://en.wikipedia.org/wiki/Reverse_domain_name_notation</a>
</p>
@param domainName
the domain name to be reverted
@return reverted domain name | [
"<p",
">",
"Revert",
"given",
"URL",
"according",
"to",
"the",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Reverse_domain_name_notation",
">",
"Reverse",
"domain",
"name",
"notation<",
"/",
"a",
">",
"<",
... | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/SwidUtils.java#L168-L183 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussTopicsApi.java | GroupsDiscussTopicsApi.getInfo | public TopicInfo getInfo(String topicId, boolean sign) throws JinxException {
JinxUtils.validateParams(topicId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.discuss.topics.getInfo");
params.put("topic_id", topicId);
return jinx.flickrGet(params, TopicInfo.class, sign);
} | java | public TopicInfo getInfo(String topicId, boolean sign) throws JinxException {
JinxUtils.validateParams(topicId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.discuss.topics.getInfo");
params.put("topic_id", topicId);
return jinx.flickrGet(params, TopicInfo.class, sign);
} | [
"public",
"TopicInfo",
"getInfo",
"(",
"String",
"topicId",
",",
"boolean",
"sign",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"topicId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
... | Get information about a group discussion topic.
<br>
This method does not require authentication. Unsigned requests can only see public topics.
@param topicId (Required) The ID for the topic to get info for.
@param sign if true, the request will be signed.
@return information about the topic.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.groups.discuss.topics.getInfo.html">flickr.groups.discuss.topics.getInfo</a> | [
"Get",
"information",
"about",
"a",
"group",
"discussion",
"topic",
".",
"<br",
">",
"This",
"method",
"does",
"not",
"require",
"authentication",
".",
"Unsigned",
"requests",
"can",
"only",
"see",
"public",
"topics",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussTopicsApi.java#L77-L83 |
bingoohuang/westcache | src/main/java/com/github/bingoohuang/westcache/utils/WestCacheConnector.java | WestCacheConnector.connectCache | @SuppressWarnings("unchecked")
public static <T> T connectCache(Runnable runnable, Object cachedValue) {
THREAD_LOCAL.set(Optional.fromNullable(cachedValue));
@Cleanup QuietCloseable i = () -> THREAD_LOCAL.remove();
runnable.run();
return (T) THREAD_LOCAL.get().orNull();
} | java | @SuppressWarnings("unchecked")
public static <T> T connectCache(Runnable runnable, Object cachedValue) {
THREAD_LOCAL.set(Optional.fromNullable(cachedValue));
@Cleanup QuietCloseable i = () -> THREAD_LOCAL.remove();
runnable.run();
return (T) THREAD_LOCAL.get().orNull();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"connectCache",
"(",
"Runnable",
"runnable",
",",
"Object",
"cachedValue",
")",
"{",
"THREAD_LOCAL",
".",
"set",
"(",
"Optional",
".",
"fromNullable",
"(",
"cachedValue... | Connect the cache with the new cached value.
@param runnable Runnable to call cached method.
@param cachedValue new cached value
@param <T> cached value type
@return cached value. | [
"Connect",
"the",
"cache",
"with",
"the",
"new",
"cached",
"value",
"."
] | train | https://github.com/bingoohuang/westcache/blob/09842bf0b9299abe75551c4b51d326fcc96da42d/src/main/java/com/github/bingoohuang/westcache/utils/WestCacheConnector.java#L78-L85 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java | HintRule.addAddProduct | public void addAddProduct(String source, String name, String value, Confidence confidence) {
addProduct.add(new Evidence(source, name, value, confidence));
} | java | public void addAddProduct(String source, String name, String value, Confidence confidence) {
addProduct.add(new Evidence(source, name, value, confidence));
} | [
"public",
"void",
"addAddProduct",
"(",
"String",
"source",
",",
"String",
"name",
",",
"String",
"value",
",",
"Confidence",
"confidence",
")",
"{",
"addProduct",
".",
"add",
"(",
"new",
"Evidence",
"(",
"source",
",",
"name",
",",
"value",
",",
"confiden... | Adds a given product to the list of evidence to add when matched.
@param source the source of the evidence
@param name the name of the evidence
@param value the value of the evidence
@param confidence the confidence of the evidence | [
"Adds",
"a",
"given",
"product",
"to",
"the",
"list",
"of",
"evidence",
"to",
"add",
"when",
"matched",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java#L149-L151 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerScriptRequestHandler.java | ClientSideHandlerScriptRequestHandler.useNotModifiedHeader | private boolean useNotModifiedHeader(HttpServletRequest request, String scriptEtag) {
long modifiedHeader = -1;
try {
modifiedHeader = request.getDateHeader(HEADER_IF_MODIFIED);
if (modifiedHeader != -1)
modifiedHeader -= modifiedHeader % 1000;
} catch (RuntimeException ex) {
}
String eTag = request.getHeader(HEADER_IF_NONE);
if (modifiedHeader == -1) {
return scriptEtag.equals(eTag);
} else if (null == eTag) {
return modifiedHeader <= START_TIME;
} else {
return scriptEtag.equals(eTag) && modifiedHeader <= START_TIME;
}
} | java | private boolean useNotModifiedHeader(HttpServletRequest request, String scriptEtag) {
long modifiedHeader = -1;
try {
modifiedHeader = request.getDateHeader(HEADER_IF_MODIFIED);
if (modifiedHeader != -1)
modifiedHeader -= modifiedHeader % 1000;
} catch (RuntimeException ex) {
}
String eTag = request.getHeader(HEADER_IF_NONE);
if (modifiedHeader == -1) {
return scriptEtag.equals(eTag);
} else if (null == eTag) {
return modifiedHeader <= START_TIME;
} else {
return scriptEtag.equals(eTag) && modifiedHeader <= START_TIME;
}
} | [
"private",
"boolean",
"useNotModifiedHeader",
"(",
"HttpServletRequest",
"request",
",",
"String",
"scriptEtag",
")",
"{",
"long",
"modifiedHeader",
"=",
"-",
"1",
";",
"try",
"{",
"modifiedHeader",
"=",
"request",
".",
"getDateHeader",
"(",
"HEADER_IF_MODIFIED",
... | Determines whether a response should get a 304 response and empty body,
according to etags and if-modified-since headers.
@param request
@param scriptEtag
@return | [
"Determines",
"whether",
"a",
"response",
"should",
"get",
"a",
"304",
"response",
"and",
"empty",
"body",
"according",
"to",
"etags",
"and",
"if",
"-",
"modified",
"-",
"since",
"headers",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerScriptRequestHandler.java#L183-L199 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/lineitemcreativeassociationservice/GetAllLicas.java | GetAllLicas.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the LineItemCreativeAssociationService.
LineItemCreativeAssociationServiceInterface licaService =
adManagerServices.get(session, LineItemCreativeAssociationServiceInterface.class);
// Create a statement to get all LICAs.
StatementBuilder statementBuilder = new StatementBuilder()
.orderBy("lineItemId ASC, creativeId ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get LICAs by statement.
LineItemCreativeAssociationPage page =
licaService.getLineItemCreativeAssociationsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (LineItemCreativeAssociation lica : page.getResults()) {
if (lica.getCreativeSetId() != null) {
System.out.printf(
"%d) LICA with line item ID %d and creative set ID %d was found.%n", i++,
lica.getLineItemId(), lica.getCreativeSetId());
} else {
System.out.printf(
"%d) LICA with line item ID %d and creative ID %d was found.%n", i++,
lica.getLineItemId(), lica.getCreativeId());
}
}
}
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 {
// Get the LineItemCreativeAssociationService.
LineItemCreativeAssociationServiceInterface licaService =
adManagerServices.get(session, LineItemCreativeAssociationServiceInterface.class);
// Create a statement to get all LICAs.
StatementBuilder statementBuilder = new StatementBuilder()
.orderBy("lineItemId ASC, creativeId ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get LICAs by statement.
LineItemCreativeAssociationPage page =
licaService.getLineItemCreativeAssociationsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (LineItemCreativeAssociation lica : page.getResults()) {
if (lica.getCreativeSetId() != null) {
System.out.printf(
"%d) LICA with line item ID %d and creative set ID %d was found.%n", i++,
lica.getLineItemId(), lica.getCreativeSetId());
} else {
System.out.printf(
"%d) LICA with line item ID %d and creative ID %d was found.%n", i++,
lica.getLineItemId(), lica.getCreativeId());
}
}
}
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",
"{",
"// Get the LineItemCreativeAssociationService.",
"LineItemCreativeAssociationServiceInterface",
"licaService",
"=",
... | 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/lineitemcreativeassociationservice/GetAllLicas.java#L51-L90 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/MetadataAwareClassVisitor.java | MetadataAwareClassVisitor.onVisitField | protected FieldVisitor onVisitField(int modifiers, String internalName, String descriptor, String signature, Object defaultValue) {
return super.visitField(modifiers, internalName, descriptor, signature, defaultValue);
} | java | protected FieldVisitor onVisitField(int modifiers, String internalName, String descriptor, String signature, Object defaultValue) {
return super.visitField(modifiers, internalName, descriptor, signature, defaultValue);
} | [
"protected",
"FieldVisitor",
"onVisitField",
"(",
"int",
"modifiers",
",",
"String",
"internalName",
",",
"String",
"descriptor",
",",
"String",
"signature",
",",
"Object",
"defaultValue",
")",
"{",
"return",
"super",
".",
"visitField",
"(",
"modifiers",
",",
"i... | An order-sensitive invocation of {@link ClassVisitor#visitField(int, String, String, String, Object)}.
@param modifiers The field's modifiers.
@param internalName The field's internal name.
@param descriptor The field type's descriptor.
@param signature The field's generic signature or {@code null} if the field is not generic.
@param defaultValue The field's default value or {@code null} if no such value exists.
@return A field visitor to visit the field or {@code null} to ignore it. | [
"An",
"order",
"-",
"sensitive",
"invocation",
"of",
"{",
"@link",
"ClassVisitor#visitField",
"(",
"int",
"String",
"String",
"String",
"Object",
")",
"}",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/MetadataAwareClassVisitor.java#L240-L242 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/background/FactoryBackgroundModel.java | FactoryBackgroundModel.stationaryBasic | public static <T extends ImageBase<T>>
BackgroundStationaryBasic<T> stationaryBasic(@Nonnull ConfigBackgroundBasic config , ImageType<T> imageType ) {
config.checkValidity();
switch( imageType.getFamily() ) {
case GRAY:
return new BackgroundStationaryBasic_SB(config.learnRate,config.threshold,imageType.getImageClass());
case PLANAR:
return new BackgroundStationaryBasic_PL(config.learnRate,config.threshold,imageType);
case INTERLEAVED:
return new BackgroundStationaryBasic_IL(config.learnRate,config.threshold,imageType);
}
throw new IllegalArgumentException("Unknown image type");
} | java | public static <T extends ImageBase<T>>
BackgroundStationaryBasic<T> stationaryBasic(@Nonnull ConfigBackgroundBasic config , ImageType<T> imageType ) {
config.checkValidity();
switch( imageType.getFamily() ) {
case GRAY:
return new BackgroundStationaryBasic_SB(config.learnRate,config.threshold,imageType.getImageClass());
case PLANAR:
return new BackgroundStationaryBasic_PL(config.learnRate,config.threshold,imageType);
case INTERLEAVED:
return new BackgroundStationaryBasic_IL(config.learnRate,config.threshold,imageType);
}
throw new IllegalArgumentException("Unknown image type");
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageBase",
"<",
"T",
">",
">",
"BackgroundStationaryBasic",
"<",
"T",
">",
"stationaryBasic",
"(",
"@",
"Nonnull",
"ConfigBackgroundBasic",
"config",
",",
"ImageType",
"<",
"T",
">",
"imageType",
")",
"{",
"config",
... | Creates an instance of {@link BackgroundMovingBasic}.
@param config Configures the background model
@param imageType Type of input image
@return new instance of the background model | [
"Creates",
"an",
"instance",
"of",
"{",
"@link",
"BackgroundMovingBasic",
"}",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/background/FactoryBackgroundModel.java#L47-L64 |
Atmosphere/wasync | wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java | TypeResolver.resolveArguments | public static <T, I extends T> Class<?>[] resolveArguments(Class<I> initialType,
Class<T> targetType) {
return resolveArguments(resolveGenericType(initialType, targetType), initialType);
} | java | public static <T, I extends T> Class<?>[] resolveArguments(Class<I> initialType,
Class<T> targetType) {
return resolveArguments(resolveGenericType(initialType, targetType), initialType);
} | [
"public",
"static",
"<",
"T",
",",
"I",
"extends",
"T",
">",
"Class",
"<",
"?",
">",
"[",
"]",
"resolveArguments",
"(",
"Class",
"<",
"I",
">",
"initialType",
",",
"Class",
"<",
"T",
">",
"targetType",
")",
"{",
"return",
"resolveArguments",
"(",
"re... | Returns an array of raw classes representing type arguments for the {@code targetType} resolved
upwards from the {@code initialType}. Arguments for {@code targetType} that cannot be resolved
to a Class are returned as {@code Unknown.class}. If no arguments can be resolved then
{@code null} is returned.
@param initialType to resolve upwards from
@param targetType to resolve arguments for
@return array of raw classes representing type arguments for {@code initialType} else
{@code null} if no type arguments are declared | [
"Returns",
"an",
"array",
"of",
"raw",
"classes",
"representing",
"type",
"arguments",
"for",
"the",
"{",
"@code",
"targetType",
"}",
"resolved",
"upwards",
"from",
"the",
"{",
"@code",
"initialType",
"}",
".",
"Arguments",
"for",
"{",
"@code",
"targetType",
... | train | https://github.com/Atmosphere/wasync/blob/0146828b2f5138d4cbb4872fcbfe7d6e1887ac14/wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java#L133-L136 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TrAXFilter.java | TrAXFilter.setupParse | private void setupParse ()
{
XMLReader p = getParent();
if (p == null) {
throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_PARENT_FOR_FILTER, null)); //"No parent for filter");
}
ContentHandler ch = m_transformer.getInputContentHandler();
// if(ch instanceof SourceTreeHandler)
// ((SourceTreeHandler)ch).setUseMultiThreading(true);
p.setContentHandler(ch);
p.setEntityResolver(this);
p.setDTDHandler(this);
p.setErrorHandler(this);
} | java | private void setupParse ()
{
XMLReader p = getParent();
if (p == null) {
throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_PARENT_FOR_FILTER, null)); //"No parent for filter");
}
ContentHandler ch = m_transformer.getInputContentHandler();
// if(ch instanceof SourceTreeHandler)
// ((SourceTreeHandler)ch).setUseMultiThreading(true);
p.setContentHandler(ch);
p.setEntityResolver(this);
p.setDTDHandler(this);
p.setErrorHandler(this);
} | [
"private",
"void",
"setupParse",
"(",
")",
"{",
"XMLReader",
"p",
"=",
"getParent",
"(",
")",
";",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"XSLMessages",
".",
"createMessage",
"(",
"XSLTErrorResources",
".",
"ER... | Set up before a parse.
<p>Before every parse, check whether the parent is
non-null, and re-register the filter for all of the
events.</p> | [
"Set",
"up",
"before",
"a",
"parse",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TrAXFilter.java#L200-L214 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/OrthogonalPolyLine.java | OrthogonalPolyLine.getTailDirection | private static Direction getTailDirection(final Point2DArray points, final NFastDoubleArrayJSO buffer, final Direction lastDirection, Direction tailDirection, final double correction, final OrthogonalPolyLine pline, final double p0x, final double p0y, final double p1x, final double p1y)
{
final double offset = pline.getHeadOffset() + correction;
switch (tailDirection)
{
case NONE:
{
final double dx = (p1x - p0x);
final double dy = (p1y - p0y);
int bestPoints = 0;
if (dx > offset)
{
tailDirection = WEST;
bestPoints = drawTail(points, buffer, lastDirection, WEST, correction, pline, p0x, p0y, p1x, p1y, false);
}
else
{
tailDirection = EAST;
bestPoints = drawTail(points, buffer, lastDirection, EAST, correction, pline, p0x, p0y, p1x, p1y, false);
}
if (dy > 0)
{
final int points3 = drawTail(points, buffer, lastDirection, NORTH, correction, pline, p0x, p0y, p1x, p1y, false);
if (points3 < bestPoints)
{
tailDirection = NORTH;
bestPoints = points3;
}
}
else
{
final int points4 = drawTail(points, buffer, lastDirection, SOUTH, correction, pline, p0x, p0y, p1x, p1y, false);
if (points4 < bestPoints)
{
tailDirection = SOUTH;
bestPoints = points4;
}
}
break;
}
default:
break;
}
return tailDirection;
} | java | private static Direction getTailDirection(final Point2DArray points, final NFastDoubleArrayJSO buffer, final Direction lastDirection, Direction tailDirection, final double correction, final OrthogonalPolyLine pline, final double p0x, final double p0y, final double p1x, final double p1y)
{
final double offset = pline.getHeadOffset() + correction;
switch (tailDirection)
{
case NONE:
{
final double dx = (p1x - p0x);
final double dy = (p1y - p0y);
int bestPoints = 0;
if (dx > offset)
{
tailDirection = WEST;
bestPoints = drawTail(points, buffer, lastDirection, WEST, correction, pline, p0x, p0y, p1x, p1y, false);
}
else
{
tailDirection = EAST;
bestPoints = drawTail(points, buffer, lastDirection, EAST, correction, pline, p0x, p0y, p1x, p1y, false);
}
if (dy > 0)
{
final int points3 = drawTail(points, buffer, lastDirection, NORTH, correction, pline, p0x, p0y, p1x, p1y, false);
if (points3 < bestPoints)
{
tailDirection = NORTH;
bestPoints = points3;
}
}
else
{
final int points4 = drawTail(points, buffer, lastDirection, SOUTH, correction, pline, p0x, p0y, p1x, p1y, false);
if (points4 < bestPoints)
{
tailDirection = SOUTH;
bestPoints = points4;
}
}
break;
}
default:
break;
}
return tailDirection;
} | [
"private",
"static",
"Direction",
"getTailDirection",
"(",
"final",
"Point2DArray",
"points",
",",
"final",
"NFastDoubleArrayJSO",
"buffer",
",",
"final",
"Direction",
"lastDirection",
",",
"Direction",
"tailDirection",
",",
"final",
"double",
"correction",
",",
"fina... | When tail is NONE it needs to try multiple directions to determine which gives the least number of corners, and then selects that as the final direction.
@param points
@param buffer
@param lastDirection
@param tailDirection
@param correction
@param pline
@param p0x
@param p0y
@param p1x
@param p1y
@return | [
"When",
"tail",
"is",
"NONE",
"it",
"needs",
"to",
"try",
"multiple",
"directions",
"to",
"determine",
"which",
"gives",
"the",
"least",
"number",
"of",
"corners",
"and",
"then",
"selects",
"that",
"as",
"the",
"final",
"direction",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/OrthogonalPolyLine.java#L474-L528 |
Azure/azure-sdk-for-java | applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java | EventsImpl.getAsync | public Observable<EventsResults> getAsync(String appId, EventType eventType, String eventId, String timespan) {
return getWithServiceResponseAsync(appId, eventType, eventId, timespan).map(new Func1<ServiceResponse<EventsResults>, EventsResults>() {
@Override
public EventsResults call(ServiceResponse<EventsResults> response) {
return response.body();
}
});
} | java | public Observable<EventsResults> getAsync(String appId, EventType eventType, String eventId, String timespan) {
return getWithServiceResponseAsync(appId, eventType, eventId, timespan).map(new Func1<ServiceResponse<EventsResults>, EventsResults>() {
@Override
public EventsResults call(ServiceResponse<EventsResults> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EventsResults",
">",
"getAsync",
"(",
"String",
"appId",
",",
"EventType",
"eventType",
",",
"String",
"eventId",
",",
"String",
"timespan",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"appId",
",",
"eventType",
",",
"ev... | Get an event.
Gets the data for a single event.
@param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal.
@param eventType The type of events to query; either a standard event type (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or `$all` to query across all event types. Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', 'customMetrics'
@param eventId ID of event.
@param timespan Optional. The timespan over which to retrieve events. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the Odata expression.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EventsResults object | [
"Get",
"an",
"event",
".",
"Gets",
"the",
"data",
"for",
"a",
"single",
"event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java#L407-L414 |
threerings/nenya | core/src/main/java/com/threerings/util/KeyboardManager.java | KeyboardManager.keyPressed | protected boolean keyPressed (KeyEvent e)
{
logKey("keyPressed", e);
// get the action command associated with this key
int keyCode = e.getKeyCode();
boolean hasCommand = _xlate.hasCommand(keyCode);
if (hasCommand) {
// get the info object for this key, creating one if necessary
KeyInfo info = _keys.get(keyCode);
if (info == null) {
info = new KeyInfo(keyCode);
_keys.put(keyCode, info);
}
// remember the last time this key was pressed
info.setPressTime(RunAnywhere.getWhen(e));
}
// notify any key observers of the key press
notifyObservers(KeyEvent.KEY_PRESSED, e.getKeyCode(), RunAnywhere.getWhen(e));
return hasCommand;
} | java | protected boolean keyPressed (KeyEvent e)
{
logKey("keyPressed", e);
// get the action command associated with this key
int keyCode = e.getKeyCode();
boolean hasCommand = _xlate.hasCommand(keyCode);
if (hasCommand) {
// get the info object for this key, creating one if necessary
KeyInfo info = _keys.get(keyCode);
if (info == null) {
info = new KeyInfo(keyCode);
_keys.put(keyCode, info);
}
// remember the last time this key was pressed
info.setPressTime(RunAnywhere.getWhen(e));
}
// notify any key observers of the key press
notifyObservers(KeyEvent.KEY_PRESSED, e.getKeyCode(), RunAnywhere.getWhen(e));
return hasCommand;
} | [
"protected",
"boolean",
"keyPressed",
"(",
"KeyEvent",
"e",
")",
"{",
"logKey",
"(",
"\"keyPressed\"",
",",
"e",
")",
";",
"// get the action command associated with this key",
"int",
"keyCode",
"=",
"e",
".",
"getKeyCode",
"(",
")",
";",
"boolean",
"hasCommand",
... | Called when Swing notifies us that a key has been pressed while the
keyboard manager is active.
@return true to swallow the key event | [
"Called",
"when",
"Swing",
"notifies",
"us",
"that",
"a",
"key",
"has",
"been",
"pressed",
"while",
"the",
"keyboard",
"manager",
"is",
"active",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L290-L313 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/record/FileHeaderPage.java | FileHeaderPage.getLastDeletedSlot | public RecordId getLastDeletedSlot() {
Constant blkNum = getVal(OFFSET_LDS_BLOCKID, BIGINT);
Constant rid = getVal(OFFSET_LDS_RID, INTEGER);
BlockId bid = new BlockId(fileName, (Long) blkNum.asJavaVal());
return new RecordId(bid, (Integer) rid.asJavaVal());
} | java | public RecordId getLastDeletedSlot() {
Constant blkNum = getVal(OFFSET_LDS_BLOCKID, BIGINT);
Constant rid = getVal(OFFSET_LDS_RID, INTEGER);
BlockId bid = new BlockId(fileName, (Long) blkNum.asJavaVal());
return new RecordId(bid, (Integer) rid.asJavaVal());
} | [
"public",
"RecordId",
"getLastDeletedSlot",
"(",
")",
"{",
"Constant",
"blkNum",
"=",
"getVal",
"(",
"OFFSET_LDS_BLOCKID",
",",
"BIGINT",
")",
";",
"Constant",
"rid",
"=",
"getVal",
"(",
"OFFSET_LDS_RID",
",",
"INTEGER",
")",
";",
"BlockId",
"bid",
"=",
"new... | Returns the id of last deleted record.
@return the id of last deleted record | [
"Returns",
"the",
"id",
"of",
"last",
"deleted",
"record",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/FileHeaderPage.java#L106-L111 |
kejunxia/AndroidMvc | library/poke/src/main/java/com/shipdream/lib/poke/Component.java | Component.addNewKeyToComponent | private void addNewKeyToComponent(String key, Component component) throws ProviderConflictException {
Component root = getRootComponent();
if (componentLocator.keySet().contains(key)) {
String msg = String.format("Type %s has already been registered " +
"in this component(%s).", key, getComponentId());
throw new ProviderConflictException(msg);
}
if (root != this && root.componentLocator.keySet().contains(key)) {
String msg = String.format("\nClass type %s cannot be registered to component(%s)\nsince it's " +
"already been registered in its root component(%s).\n\nYou can prepare a child " +
"component and register providers to it first. Then attach the child component\nto the " +
"component tree with allowOverridden flag set true", key, getComponentId(),
getRootComponent().getComponentId());
throw new ProviderConflictException(msg);
}
//Only put it to root component's locator
root.componentLocator.put(key, component);
} | java | private void addNewKeyToComponent(String key, Component component) throws ProviderConflictException {
Component root = getRootComponent();
if (componentLocator.keySet().contains(key)) {
String msg = String.format("Type %s has already been registered " +
"in this component(%s).", key, getComponentId());
throw new ProviderConflictException(msg);
}
if (root != this && root.componentLocator.keySet().contains(key)) {
String msg = String.format("\nClass type %s cannot be registered to component(%s)\nsince it's " +
"already been registered in its root component(%s).\n\nYou can prepare a child " +
"component and register providers to it first. Then attach the child component\nto the " +
"component tree with allowOverridden flag set true", key, getComponentId(),
getRootComponent().getComponentId());
throw new ProviderConflictException(msg);
}
//Only put it to root component's locator
root.componentLocator.put(key, component);
} | [
"private",
"void",
"addNewKeyToComponent",
"(",
"String",
"key",
",",
"Component",
"component",
")",
"throws",
"ProviderConflictException",
"{",
"Component",
"root",
"=",
"getRootComponent",
"(",
")",
";",
"if",
"(",
"componentLocator",
".",
"keySet",
"(",
")",
... | Add key to the component locator of the component. This component and the the component tree
root's component locator will both be updated.
@param key The key to add
@param component The component whose providers directly contain the key
@throws ProviderConflictException The key has been added to the component or the component tree | [
"Add",
"key",
"to",
"the",
"component",
"locator",
"of",
"the",
"component",
".",
"This",
"component",
"and",
"the",
"the",
"component",
"tree",
"root",
"s",
"component",
"locator",
"will",
"both",
"be",
"updated",
"."
] | train | https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/poke/src/main/java/com/shipdream/lib/poke/Component.java#L535-L555 |
OpenTSDB/opentsdb | src/tree/Tree.java | Tree.addCollision | public void addCollision(final String tsuid, final String existing_tsuid) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Empty or null collisions not allowed");
}
if (collisions == null) {
collisions = new HashMap<String, String>();
}
if (!collisions.containsKey(tsuid)) {
collisions.put(tsuid, existing_tsuid);
changed.put("collisions", true);
}
} | java | public void addCollision(final String tsuid, final String existing_tsuid) {
if (tsuid == null || tsuid.isEmpty()) {
throw new IllegalArgumentException("Empty or null collisions not allowed");
}
if (collisions == null) {
collisions = new HashMap<String, String>();
}
if (!collisions.containsKey(tsuid)) {
collisions.put(tsuid, existing_tsuid);
changed.put("collisions", true);
}
} | [
"public",
"void",
"addCollision",
"(",
"final",
"String",
"tsuid",
",",
"final",
"String",
"existing_tsuid",
")",
"{",
"if",
"(",
"tsuid",
"==",
"null",
"||",
"tsuid",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"... | Adds a TSUID to the collision local list, must then be synced with storage
@param tsuid TSUID to add to the set
@throws IllegalArgumentException if the tsuid was invalid | [
"Adds",
"a",
"TSUID",
"to",
"the",
"collision",
"local",
"list",
"must",
"then",
"be",
"synced",
"with",
"storage"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L272-L283 |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.readMdLinkId | public final static int readMdLinkId(final StringBuilder out, final String in, final int start)
{
int pos = start;
int counter = 1;
while (pos < in.length())
{
final char ch = in.charAt(pos);
boolean endReached = false;
switch (ch)
{
case '\n':
out.append(' ');
break;
case '[':
counter++;
out.append(ch);
break;
case ']':
counter--;
if (counter == 0)
{
endReached = true;
}
else
{
out.append(ch);
}
break;
default:
out.append(ch);
break;
}
if (endReached)
{
break;
}
pos++;
}
return (pos == in.length()) ? -1 : pos;
} | java | public final static int readMdLinkId(final StringBuilder out, final String in, final int start)
{
int pos = start;
int counter = 1;
while (pos < in.length())
{
final char ch = in.charAt(pos);
boolean endReached = false;
switch (ch)
{
case '\n':
out.append(' ');
break;
case '[':
counter++;
out.append(ch);
break;
case ']':
counter--;
if (counter == 0)
{
endReached = true;
}
else
{
out.append(ch);
}
break;
default:
out.append(ch);
break;
}
if (endReached)
{
break;
}
pos++;
}
return (pos == in.length()) ? -1 : pos;
} | [
"public",
"final",
"static",
"int",
"readMdLinkId",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"int",
"counter",
"=",
"1",
";",
"while",
"(",
"pos",
"<",
... | Reads a markdown link ID.
@param out
The StringBuilder to write to.
@param in
Input String.
@param start
Starting position.
@return The new position or -1 if this is no valid markdown link ID. | [
"Reads",
"a",
"markdown",
"link",
"ID",
"."
] | train | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L250-L290 |
pkiraly/metadata-qa-api | src/main/java/de/gwdg/metadataqa/api/util/Converter.java | Converter.compressNumber | public static String compressNumber(String value, CompressionLevel compressionLevel) {
value = value.replaceAll("([0-9])0+$", "$1");
if (compressionLevel.equals(CompressionLevel.NORMAL)) {
value = value.replaceAll("\\.0+$", ".0");
} else if (compressionLevel.equals(CompressionLevel.WITHOUT_TRAILING_ZEROS)) {
value = value.replaceAll("\\.0+$", "");
}
return value;
} | java | public static String compressNumber(String value, CompressionLevel compressionLevel) {
value = value.replaceAll("([0-9])0+$", "$1");
if (compressionLevel.equals(CompressionLevel.NORMAL)) {
value = value.replaceAll("\\.0+$", ".0");
} else if (compressionLevel.equals(CompressionLevel.WITHOUT_TRAILING_ZEROS)) {
value = value.replaceAll("\\.0+$", "");
}
return value;
} | [
"public",
"static",
"String",
"compressNumber",
"(",
"String",
"value",
",",
"CompressionLevel",
"compressionLevel",
")",
"{",
"value",
"=",
"value",
".",
"replaceAll",
"(",
"\"([0-9])0+$\"",
",",
"\"$1\"",
")",
";",
"if",
"(",
"compressionLevel",
".",
"equals",... | Removes the unnecessary 0-s from the end of a number.
For example 0.7000 becomes 0.7, 0.00000 becomes 0.0.
@param value A string representation of a number
@param compressionLevel The level of compression
@return The "compressed" representation without zeros at the end | [
"Removes",
"the",
"unnecessary",
"0",
"-",
"s",
"from",
"the",
"end",
"of",
"a",
"number",
".",
"For",
"example",
"0",
".",
"7000",
"becomes",
"0",
".",
"7",
"0",
".",
"00000",
"becomes",
"0",
".",
"0",
"."
] | train | https://github.com/pkiraly/metadata-qa-api/blob/622a69e7c1628ccf64047070817ecfaa68f15b1d/src/main/java/de/gwdg/metadataqa/api/util/Converter.java#L99-L107 |
JOML-CI/JOML | src/org/joml/Vector3f.java | Vector3f.rotateAxis | public Vector3f rotateAxis(float angle, float x, float y, float z) {
return rotateAxis(angle, x, y, z, thisOrNew());
} | java | public Vector3f rotateAxis(float angle, float x, float y, float z) {
return rotateAxis(angle, x, y, z, thisOrNew());
} | [
"public",
"Vector3f",
"rotateAxis",
"(",
"float",
"angle",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"return",
"rotateAxis",
"(",
"angle",
",",
"x",
",",
"y",
",",
"z",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Rotate this vector the specified radians around the given rotation axis.
@param angle
the angle in radians
@param x
the x component of the rotation axis
@param y
the y component of the rotation axis
@param z
the z component of the rotation axis
@return a vector holding the result | [
"Rotate",
"this",
"vector",
"the",
"specified",
"radians",
"around",
"the",
"given",
"rotation",
"axis",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3f.java#L1143-L1145 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java | HeaderActionRule.newInstance | public static HeaderActionRule newInstance(String id, Boolean hidden) {
HeaderActionRule headerActionRule = new HeaderActionRule();
headerActionRule.setActionId(id);
headerActionRule.setHidden(hidden);
return headerActionRule;
} | java | public static HeaderActionRule newInstance(String id, Boolean hidden) {
HeaderActionRule headerActionRule = new HeaderActionRule();
headerActionRule.setActionId(id);
headerActionRule.setHidden(hidden);
return headerActionRule;
} | [
"public",
"static",
"HeaderActionRule",
"newInstance",
"(",
"String",
"id",
",",
"Boolean",
"hidden",
")",
"{",
"HeaderActionRule",
"headerActionRule",
"=",
"new",
"HeaderActionRule",
"(",
")",
";",
"headerActionRule",
".",
"setActionId",
"(",
"id",
")",
";",
"h... | Returns a new derived instance of HeaderActionRule.
@param id the action id
@param hidden whether to hide result of the action
@return the header action rule | [
"Returns",
"a",
"new",
"derived",
"instance",
"of",
"HeaderActionRule",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/HeaderActionRule.java#L142-L147 |
dropwizard/dropwizard | dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java | ServletEnvironment.addFilter | public FilterRegistration.Dynamic addFilter(String name, Filter filter) {
return addFilter(name, new FilterHolder(requireNonNull(filter)));
} | java | public FilterRegistration.Dynamic addFilter(String name, Filter filter) {
return addFilter(name, new FilterHolder(requireNonNull(filter)));
} | [
"public",
"FilterRegistration",
".",
"Dynamic",
"addFilter",
"(",
"String",
"name",
",",
"Filter",
"filter",
")",
"{",
"return",
"addFilter",
"(",
"name",
",",
"new",
"FilterHolder",
"(",
"requireNonNull",
"(",
"filter",
")",
")",
")",
";",
"}"
] | Add a filter instance.
@param name the filter's name
@param filter the filter instance
@return a {@link javax.servlet.FilterRegistration.Dynamic} instance allowing for further
configuration | [
"Add",
"a",
"filter",
"instance",
"."
] | train | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L82-L84 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.getAndCheckStructuredType | public static StructuredType getAndCheckStructuredType(EntityDataModel entityDataModel, Class<?> javaType) {
return checkIsStructuredType(getAndCheckType(entityDataModel, javaType));
} | java | public static StructuredType getAndCheckStructuredType(EntityDataModel entityDataModel, Class<?> javaType) {
return checkIsStructuredType(getAndCheckType(entityDataModel, javaType));
} | [
"public",
"static",
"StructuredType",
"getAndCheckStructuredType",
"(",
"EntityDataModel",
"entityDataModel",
",",
"Class",
"<",
"?",
">",
"javaType",
")",
"{",
"return",
"checkIsStructuredType",
"(",
"getAndCheckType",
"(",
"entityDataModel",
",",
"javaType",
")",
")... | Gets the OData type for a Java type and checks if the OData type is a structured type; throws an exception if the
OData type is not a structured type.
@param entityDataModel The entity data model.
@param javaType The Java type.
@return The OData structured type for the Java type.
@throws ODataSystemException If there is no OData type for the specified Java type or if the OData type is not
a structured type. | [
"Gets",
"the",
"OData",
"type",
"for",
"a",
"Java",
"type",
"and",
"checks",
"if",
"the",
"OData",
"type",
"is",
"a",
"structured",
"type",
";",
"throws",
"an",
"exception",
"if",
"the",
"OData",
"type",
"is",
"not",
"a",
"structured",
"type",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L183-L185 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java | ResponseHandler.handleRenderedResponse | protected void handleRenderedResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(response.getStatusCode());
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders().add(entry.getKey().toHttpString(), entry.getValue()));
exchange.getResponseHeaders().put(Header.CONTENT_TYPE.toHttpString(), response.getContentType() + "; charset=" + response.getCharset());
response.getHeaders().forEach((key, value) -> exchange.getResponseHeaders().add(key, value));
exchange.getResponseSender().send(response.getBody());
} | java | protected void handleRenderedResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(response.getStatusCode());
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders().add(entry.getKey().toHttpString(), entry.getValue()));
exchange.getResponseHeaders().put(Header.CONTENT_TYPE.toHttpString(), response.getContentType() + "; charset=" + response.getCharset());
response.getHeaders().forEach((key, value) -> exchange.getResponseHeaders().add(key, value));
exchange.getResponseSender().send(response.getBody());
} | [
"protected",
"void",
"handleRenderedResponse",
"(",
"HttpServerExchange",
"exchange",
",",
"Response",
"response",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"response",
".",
"getStatusCode",
"(",
")",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"... | Handles a rendered response to the client by sending the rendered body from the response object
@param exchange The Undertow HttpServerExchange
@param response The response object | [
"Handles",
"a",
"rendered",
"response",
"to",
"the",
"client",
"by",
"sending",
"the",
"rendered",
"body",
"from",
"the",
"response",
"object"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java#L83-L95 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/ImportApi.java | ImportApi.importFile | public ApiSuccessResponse importFile(File csvfile, Boolean validateBeforeImport) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = importFileWithHttpInfo(csvfile, validateBeforeImport);
return resp.getData();
} | java | public ApiSuccessResponse importFile(File csvfile, Boolean validateBeforeImport) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = importFileWithHttpInfo(csvfile, validateBeforeImport);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"importFile",
"(",
"File",
"csvfile",
",",
"Boolean",
"validateBeforeImport",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"importFileWithHttpInfo",
"(",
"csvfile",
",",
"validateBeforeIm... | Import users.
Import users in the specified CSV/XLS file.
@param csvfile The CSV/XLS file to import. (optional)
@param validateBeforeImport Specifies whether the Provisioning API should validate the file before the actual import takes place. (optional, default to false)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Import",
"users",
".",
"Import",
"users",
"in",
"the",
"specified",
"CSV",
"/",
"XLS",
"file",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/ImportApi.java#L266-L269 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubOutputHandler.java | PubSubOutputHandler.createControlFlushed | private ControlFlushed createControlFlushed(SIBUuid8 target, SIBUuid12 stream)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createControlFlushed", stream);
ControlFlushed flushedMsg;
// Create new message
try
{
flushedMsg = _cmf.createNewControlFlushed();
}
catch (MessageCreateFailedException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler.createControlFlushed",
"1:1424:1.164.1.5",
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "createControlFlushed", e);
}
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1436:1.164.1.5",
e });
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1444: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(flushedMsg,
_messageProcessor.getMessagingEngineUuid(),
null,
stream,
null,
_destinationHandler.getUuid(),
ProtocolType.PUBSUBINPUT,
GDConfig.PROTOCOL_VERSION);
flushedMsg.setPriority(SIMPConstants.CTRL_MSG_PRIORITY);
flushedMsg.setReliability(Reliability.ASSURED_PERSISTENT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createControlFlushed");
return flushedMsg;
} | java | private ControlFlushed createControlFlushed(SIBUuid8 target, SIBUuid12 stream)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createControlFlushed", stream);
ControlFlushed flushedMsg;
// Create new message
try
{
flushedMsg = _cmf.createNewControlFlushed();
}
catch (MessageCreateFailedException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler.createControlFlushed",
"1:1424:1.164.1.5",
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "createControlFlushed", e);
}
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1436:1.164.1.5",
e });
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
"1:1444: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(flushedMsg,
_messageProcessor.getMessagingEngineUuid(),
null,
stream,
null,
_destinationHandler.getUuid(),
ProtocolType.PUBSUBINPUT,
GDConfig.PROTOCOL_VERSION);
flushedMsg.setPriority(SIMPConstants.CTRL_MSG_PRIORITY);
flushedMsg.setReliability(Reliability.ASSURED_PERSISTENT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createControlFlushed");
return flushedMsg;
} | [
"private",
"ControlFlushed",
"createControlFlushed",
"(",
"SIBUuid8",
"target",
",",
"SIBUuid12",
"stream",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
"... | Creates a FLUSHED 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
@return the new FLUSHED message
@throws SIResourceException if the message can't be created. | [
"Creates",
"a",
"FLUSHED",
"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#L1365-L1428 |
grails/grails-core | grails-bootstrap/src/main/groovy/org/grails/io/support/GrailsResourceUtils.java | GrailsResourceUtils.getStaticResourcePathForResource | public static String getStaticResourcePathForResource(Resource resource, String contextPath) {
if (contextPath == null) contextPath = "";
if (resource == null) return contextPath;
String url;
try {
url = resource.getURL().toString();
}
catch (IOException e) {
return contextPath;
}
Matcher m = PLUGIN_RESOURCE_PATTERN.matcher(url);
if (m.find()) {
return (contextPath.length() > 0 ? contextPath + "/" : "") + m.group(1);
}
return contextPath;
} | java | public static String getStaticResourcePathForResource(Resource resource, String contextPath) {
if (contextPath == null) contextPath = "";
if (resource == null) return contextPath;
String url;
try {
url = resource.getURL().toString();
}
catch (IOException e) {
return contextPath;
}
Matcher m = PLUGIN_RESOURCE_PATTERN.matcher(url);
if (m.find()) {
return (contextPath.length() > 0 ? contextPath + "/" : "") + m.group(1);
}
return contextPath;
} | [
"public",
"static",
"String",
"getStaticResourcePathForResource",
"(",
"Resource",
"resource",
",",
"String",
"contextPath",
")",
"{",
"if",
"(",
"contextPath",
"==",
"null",
")",
"contextPath",
"=",
"\"\"",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"retu... | Retrieves the static resource path for the given Grails resource artifact (controller/taglib etc.)
@param resource The Resource
@param contextPath The additonal context path to prefix
@return The resource path | [
"Retrieves",
"the",
"static",
"resource",
"path",
"for",
"the",
"given",
"Grails",
"resource",
"artifact",
"(",
"controller",
"/",
"taglib",
"etc",
".",
")"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-bootstrap/src/main/groovy/org/grails/io/support/GrailsResourceUtils.java#L809-L828 |
strator-dev/greenpepper | greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/compiler/CompilerWrapper.java | CompilerWrapper.addMethod | public void addMethod(String methodName, Class<?> returnType, Class<?> [] params, boolean isStatic, String ... lines) throws CannotCompileException, NotFoundException {
CtMethod m = new CtMethod(resolve(returnType), methodName, getList(params), clazz);
int modifiers = Modifier.PUBLIC;
if (isStatic) {
modifiers += Modifier.STATIC;
}
m.setModifiers(modifiers);
m.setBody(formatCode(lines));
clazz.addMethod(m);
} | java | public void addMethod(String methodName, Class<?> returnType, Class<?> [] params, boolean isStatic, String ... lines) throws CannotCompileException, NotFoundException {
CtMethod m = new CtMethod(resolve(returnType), methodName, getList(params), clazz);
int modifiers = Modifier.PUBLIC;
if (isStatic) {
modifiers += Modifier.STATIC;
}
m.setModifiers(modifiers);
m.setBody(formatCode(lines));
clazz.addMethod(m);
} | [
"public",
"void",
"addMethod",
"(",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"returnType",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"params",
",",
"boolean",
"isStatic",
",",
"String",
"...",
"lines",
")",
"throws",
"CannotCompileException",
",",... | <p>addMethod.</p>
@param methodName a {@link java.lang.String} object.
@param returnType a {@link java.lang.Class} object.
@param params an array of {@link java.lang.Class} objects.
@param isStatic a boolean.
@param lines a {@link java.lang.String} object.
@throws javassist.CannotCompileException if any.
@throws javassist.NotFoundException if any. | [
"<p",
">",
"addMethod",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/compiler/CompilerWrapper.java#L106-L115 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.getJobDetails | public Job getJobDetails(String teamName, String jobId) {
return getJobDetailsWithServiceResponseAsync(teamName, jobId).toBlocking().single().body();
} | java | public Job getJobDetails(String teamName, String jobId) {
return getJobDetailsWithServiceResponseAsync(teamName, jobId).toBlocking().single().body();
} | [
"public",
"Job",
"getJobDetails",
"(",
"String",
"teamName",
",",
"String",
"jobId",
")",
"{",
"return",
"getJobDetailsWithServiceResponseAsync",
"(",
"teamName",
",",
"jobId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",... | Get the Job Details for a Job Id.
@param teamName Your Team Name.
@param jobId Id of the job.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Job object if successful. | [
"Get",
"the",
"Job",
"Details",
"for",
"a",
"Job",
"Id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L225-L227 |
lucee/Lucee | core/src/main/java/lucee/transformer/cfml/expression/AbstrCFMLExprTransformer.java | AbstrCFMLExprTransformer.transformAsString | protected Expression transformAsString(Data data, String[] breakConditions) throws TemplateException {
Expression el = null;
// parse the houle Page String
comments(data);
// String
if ((el = string(data)) != null) {
data.mode = STATIC;
return el;
}
// Sharp
if ((el = sharp(data)) != null) {
data.mode = DYNAMIC;
return el;
}
// Simple
return simple(data, breakConditions);
} | java | protected Expression transformAsString(Data data, String[] breakConditions) throws TemplateException {
Expression el = null;
// parse the houle Page String
comments(data);
// String
if ((el = string(data)) != null) {
data.mode = STATIC;
return el;
}
// Sharp
if ((el = sharp(data)) != null) {
data.mode = DYNAMIC;
return el;
}
// Simple
return simple(data, breakConditions);
} | [
"protected",
"Expression",
"transformAsString",
"(",
"Data",
"data",
",",
"String",
"[",
"]",
"breakConditions",
")",
"throws",
"TemplateException",
"{",
"Expression",
"el",
"=",
"null",
";",
"// parse the houle Page String",
"comments",
"(",
"data",
")",
";",
"//... | /*
public class Data extends Data {
public short mode=0; public boolean insideFunction; public String tagName; public boolean isCFC;
public boolean isInterface; public short context=CTX_NONE; public DocComment docComment;
public Data(Data data,boolean allowLowerThan) {
super(data.factory,data.root,data.srcCode,data.ep,data.settings,data.tlibs,data.flibs,data.
scriptTags,allowLowerThan); } } | [
"/",
"*",
"public",
"class",
"Data",
"extends",
"Data",
"{"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/expression/AbstrCFMLExprTransformer.java#L218-L236 |
tractionsoftware/gwt-traction | src/main/java/com/tractionsoftware/gwt/user/client/ui/UTCDateTimeRangeController.java | UTCDateTimeRangeController.getCombinedValue | private long getCombinedValue(UTCDateBox date, UTCTimeBox time) {
Long dateValue = date.getValue();
Long timeValue = time.getValue();
if (dateValue != null) {
if (timeValue != null) {
return dateValue + timeValue;
}
else {
return dateValue;
}
}
else {
if (timeValue != null) {
return timeValue;
}
else {
return 0;
}
}
} | java | private long getCombinedValue(UTCDateBox date, UTCTimeBox time) {
Long dateValue = date.getValue();
Long timeValue = time.getValue();
if (dateValue != null) {
if (timeValue != null) {
return dateValue + timeValue;
}
else {
return dateValue;
}
}
else {
if (timeValue != null) {
return timeValue;
}
else {
return 0;
}
}
} | [
"private",
"long",
"getCombinedValue",
"(",
"UTCDateBox",
"date",
",",
"UTCTimeBox",
"time",
")",
"{",
"Long",
"dateValue",
"=",
"date",
".",
"getValue",
"(",
")",
";",
"Long",
"timeValue",
"=",
"time",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"dateVal... | This allows us to treat a datetime as a single value, making it
easy for comparison and adjustment. We don't actually expose
this because the timezone issues make it too confusing to
clients. | [
"This",
"allows",
"us",
"to",
"treat",
"a",
"datetime",
"as",
"a",
"single",
"value",
"making",
"it",
"easy",
"for",
"comparison",
"and",
"adjustment",
".",
"We",
"don",
"t",
"actually",
"expose",
"this",
"because",
"the",
"timezone",
"issues",
"make",
"it... | train | https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/UTCDateTimeRangeController.java#L201-L221 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.startGetThumbnail | public /*@Nullable*/Downloader startGetThumbnail(
DbxThumbnailSize sizeBound, DbxThumbnailFormat format, String path, /*@Nullable*/String rev)
throws DbxException
{
DbxPathV1.checkArgNonRoot("path", path);
if (sizeBound == null) throw new IllegalArgumentException("'size' can't be null");
if (format == null) throw new IllegalArgumentException("'format' can't be null");
String apiPath = "1/thumbnails/auto" + path;
/*@Nullable*/String[] params = {
"size", sizeBound.ident,
"format", format.ident,
"rev", rev,
};
return startGetSomething(apiPath, params);
} | java | public /*@Nullable*/Downloader startGetThumbnail(
DbxThumbnailSize sizeBound, DbxThumbnailFormat format, String path, /*@Nullable*/String rev)
throws DbxException
{
DbxPathV1.checkArgNonRoot("path", path);
if (sizeBound == null) throw new IllegalArgumentException("'size' can't be null");
if (format == null) throw new IllegalArgumentException("'format' can't be null");
String apiPath = "1/thumbnails/auto" + path;
/*@Nullable*/String[] params = {
"size", sizeBound.ident,
"format", format.ident,
"rev", rev,
};
return startGetSomething(apiPath, params);
} | [
"public",
"/*@Nullable*/",
"Downloader",
"startGetThumbnail",
"(",
"DbxThumbnailSize",
"sizeBound",
",",
"DbxThumbnailFormat",
"format",
",",
"String",
"path",
",",
"/*@Nullable*/",
"String",
"rev",
")",
"throws",
"DbxException",
"{",
"DbxPathV1",
".",
"checkArgNonRoot"... | Similar to {@link #getThumbnail}, except the thumbnail contents are returned via
a {@link Downloader}. | [
"Similar",
"to",
"{"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1784-L1800 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/service/api/ResourceReaderExtension.java | ResourceReaderExtension.applyImplicitParameters | @Override
public void applyImplicitParameters(ReaderContext context, Operation operation, Method method) {
// copied from io.swagger.servlet.extensions.ServletReaderExtension
final ApiImplicitParams implicitParams = method.getAnnotation(ApiImplicitParams.class);
if (implicitParams != null && implicitParams.value().length > 0) {
for (ApiImplicitParam param : implicitParams.value()) {
final Parameter p = readImplicitParam(context.getSwagger(), param);
if (p != null) {
if (p instanceof BodyParameter && param.format() != null)
p.getVendorExtensions().put("format", param.format());
operation.parameter(p);
}
}
}
} | java | @Override
public void applyImplicitParameters(ReaderContext context, Operation operation, Method method) {
// copied from io.swagger.servlet.extensions.ServletReaderExtension
final ApiImplicitParams implicitParams = method.getAnnotation(ApiImplicitParams.class);
if (implicitParams != null && implicitParams.value().length > 0) {
for (ApiImplicitParam param : implicitParams.value()) {
final Parameter p = readImplicitParam(context.getSwagger(), param);
if (p != null) {
if (p instanceof BodyParameter && param.format() != null)
p.getVendorExtensions().put("format", param.format());
operation.parameter(p);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"applyImplicitParameters",
"(",
"ReaderContext",
"context",
",",
"Operation",
"operation",
",",
"Method",
"method",
")",
"{",
"// copied from io.swagger.servlet.extensions.ServletReaderExtension",
"final",
"ApiImplicitParams",
"implicitParams"... | Implemented to allow loading of custom types using CloudClassLoader. | [
"Implemented",
"to",
"allow",
"loading",
"of",
"custom",
"types",
"using",
"CloudClassLoader",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/api/ResourceReaderExtension.java#L171-L185 |
pagehelper/Mybatis-PageHelper | src/main/java/com/github/pagehelper/parser/SqlServerParser.java | SqlServerParser.addRowNumber | protected SelectItem addRowNumber(PlainSelect plainSelect, List<SelectItem> autoItems) {
//增加ROW_NUMBER()
StringBuilder orderByBuilder = new StringBuilder();
orderByBuilder.append("ROW_NUMBER() OVER (");
if (isNotEmptyList(plainSelect.getOrderByElements())) {
orderByBuilder.append(PlainSelect.orderByToString(
getOrderByElements(plainSelect, autoItems)).substring(1));
//清空排序列表
plainSelect.setOrderByElements(null);
} else {
orderByBuilder.append("ORDER BY RAND()");
}
orderByBuilder.append(") ");
orderByBuilder.append(PAGE_ROW_NUMBER);
return new SelectExpressionItem(new Column(orderByBuilder.toString()));
} | java | protected SelectItem addRowNumber(PlainSelect plainSelect, List<SelectItem> autoItems) {
//增加ROW_NUMBER()
StringBuilder orderByBuilder = new StringBuilder();
orderByBuilder.append("ROW_NUMBER() OVER (");
if (isNotEmptyList(plainSelect.getOrderByElements())) {
orderByBuilder.append(PlainSelect.orderByToString(
getOrderByElements(plainSelect, autoItems)).substring(1));
//清空排序列表
plainSelect.setOrderByElements(null);
} else {
orderByBuilder.append("ORDER BY RAND()");
}
orderByBuilder.append(") ");
orderByBuilder.append(PAGE_ROW_NUMBER);
return new SelectExpressionItem(new Column(orderByBuilder.toString()));
} | [
"protected",
"SelectItem",
"addRowNumber",
"(",
"PlainSelect",
"plainSelect",
",",
"List",
"<",
"SelectItem",
">",
"autoItems",
")",
"{",
"//增加ROW_NUMBER()",
"StringBuilder",
"orderByBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"orderByBuilder",
".",
"appen... | 获取 ROW_NUMBER() 列
@param plainSelect 原查询
@param autoItems 自动生成的查询列
@return ROW_NUMBER() 列 | [
"获取",
"ROW_NUMBER",
"()",
"列"
] | train | https://github.com/pagehelper/Mybatis-PageHelper/blob/319750fd47cf75328ff321f38125fa15e954e60f/src/main/java/com/github/pagehelper/parser/SqlServerParser.java#L279-L294 |
bThink-BGU/BPjs | src/main/java/il/ac/bgu/cs/bp/bpjs/execution/tasks/BPEngineTask.java | BPEngineTask.handleContinuationPending | private BThreadSyncSnapshot handleContinuationPending(ContinuationPending cbs, Context jsContext) throws IllegalStateException {
final Object capturedStatement = cbs.getApplicationState();
if ( capturedStatement instanceof SyncStatement ) {
final SyncStatement syncStatement = (SyncStatement) cbs.getApplicationState();
return bss.copyWith(cbs.getContinuation(), syncStatement);
} else if ( capturedStatement instanceof ForkStatement ) {
ForkStatement forkStmt = (ForkStatement) capturedStatement;
forkStmt.setForkingBThread(bss);
final ScriptableObject globalScope = jsContext.initStandardObjects();
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream();
BThreadSyncSnapshotOutputStream btos = new BThreadSyncSnapshotOutputStream(baos, globalScope) ) {
btos.writeObject(cbs.getContinuation());
btos.flush();
baos.flush();
forkStmt.setSerializedContinuation(baos.toByteArray());
} catch (IOException ex) {
Logger.getLogger(BPEngineTask.class.getName()).log(Level.SEVERE, "Error while serializing continuation during fork:" + ex.getMessage(), ex);
throw new RuntimeException("Error while serializing continuation during fork:" + ex.getMessage(), ex);
}
listener.addFork(forkStmt);
return continueParentOfFork(cbs, jsContext);
} else {
throw new IllegalStateException("Captured a statement of an unknown type: " + capturedStatement);
}
} | java | private BThreadSyncSnapshot handleContinuationPending(ContinuationPending cbs, Context jsContext) throws IllegalStateException {
final Object capturedStatement = cbs.getApplicationState();
if ( capturedStatement instanceof SyncStatement ) {
final SyncStatement syncStatement = (SyncStatement) cbs.getApplicationState();
return bss.copyWith(cbs.getContinuation(), syncStatement);
} else if ( capturedStatement instanceof ForkStatement ) {
ForkStatement forkStmt = (ForkStatement) capturedStatement;
forkStmt.setForkingBThread(bss);
final ScriptableObject globalScope = jsContext.initStandardObjects();
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream();
BThreadSyncSnapshotOutputStream btos = new BThreadSyncSnapshotOutputStream(baos, globalScope) ) {
btos.writeObject(cbs.getContinuation());
btos.flush();
baos.flush();
forkStmt.setSerializedContinuation(baos.toByteArray());
} catch (IOException ex) {
Logger.getLogger(BPEngineTask.class.getName()).log(Level.SEVERE, "Error while serializing continuation during fork:" + ex.getMessage(), ex);
throw new RuntimeException("Error while serializing continuation during fork:" + ex.getMessage(), ex);
}
listener.addFork(forkStmt);
return continueParentOfFork(cbs, jsContext);
} else {
throw new IllegalStateException("Captured a statement of an unknown type: " + capturedStatement);
}
} | [
"private",
"BThreadSyncSnapshot",
"handleContinuationPending",
"(",
"ContinuationPending",
"cbs",
",",
"Context",
"jsContext",
")",
"throws",
"IllegalStateException",
"{",
"final",
"Object",
"capturedStatement",
"=",
"cbs",
".",
"getApplicationState",
"(",
")",
";",
"if... | Handle a captures continuation. This can be because of a sync statement,
or because of a fork.
@param cbs
@param jsContext
@return Snapshot for the continued execution of the parent.
@throws IllegalStateException | [
"Handle",
"a",
"captures",
"continuation",
".",
"This",
"can",
"be",
"because",
"of",
"a",
"sync",
"statement",
"or",
"because",
"of",
"a",
"fork",
"."
] | train | https://github.com/bThink-BGU/BPjs/blob/2d388365a27ad79ded108eaf98a35a7ef292ae1f/src/main/java/il/ac/bgu/cs/bp/bpjs/execution/tasks/BPEngineTask.java#L92-L122 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java | EJBJavaColonNamingHelper.processJavaColonModule | private Object processJavaColonModule(String lookupName) throws NamingException {
ComponentMetaData cmd = getComponentMetaData(JavaColonNamespace.MODULE, lookupName);
ModuleMetaData mmd = cmd.getModuleMetaData();
JavaColonNamespaceBindings<EJBBinding> modMap = getModuleBindingMap(mmd);
EJBBinding binding = modMap.lookup(lookupName);
return processJavaColon(binding, JavaColonNamespace.MODULE, lookupName);
} | java | private Object processJavaColonModule(String lookupName) throws NamingException {
ComponentMetaData cmd = getComponentMetaData(JavaColonNamespace.MODULE, lookupName);
ModuleMetaData mmd = cmd.getModuleMetaData();
JavaColonNamespaceBindings<EJBBinding> modMap = getModuleBindingMap(mmd);
EJBBinding binding = modMap.lookup(lookupName);
return processJavaColon(binding, JavaColonNamespace.MODULE, lookupName);
} | [
"private",
"Object",
"processJavaColonModule",
"(",
"String",
"lookupName",
")",
"throws",
"NamingException",
"{",
"ComponentMetaData",
"cmd",
"=",
"getComponentMetaData",
"(",
"JavaColonNamespace",
".",
"MODULE",
",",
"lookupName",
")",
";",
"ModuleMetaData",
"mmd",
... | This method process lookup requests for java:module.
@param lookupName JNDI lookup name
@param cmd The component metadata
@return the EJB object instance.
@throws NamingException | [
"This",
"method",
"process",
"lookup",
"requests",
"for",
"java",
":",
"module",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L228-L235 |
cettia/cettia-java-server | server/src/main/java/io/cettia/ClusteredServer.java | ClusteredServer.onpublish | public Server onpublish(Action<Map<String, Object>> action) {
publishActions.add(action);
return this;
} | java | public Server onpublish(Action<Map<String, Object>> action) {
publishActions.add(action);
return this;
} | [
"public",
"Server",
"onpublish",
"(",
"Action",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"action",
")",
"{",
"publishActions",
".",
"add",
"(",
"action",
")",
";",
"return",
"this",
";",
"}"
] | Adds an action to be called with a message to be published to every node in the cluster. | [
"Adds",
"an",
"action",
"to",
"be",
"called",
"with",
"a",
"message",
"to",
"be",
"published",
"to",
"every",
"node",
"in",
"the",
"cluster",
"."
] | train | https://github.com/cettia/cettia-java-server/blob/040d29ea4b44c0157fe678b5064b40d0855315fa/server/src/main/java/io/cettia/ClusteredServer.java#L55-L58 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java | RandomProjectedNeighborsAndDensities.computeAverageDistInSet | public DoubleDataStore computeAverageDistInSet() {
WritableDoubleDataStore davg = DataStoreUtil.makeDoubleStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT);
WritableIntegerDataStore nDists = DataStoreUtil.makeIntegerStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
FiniteProgress splitp = LOG.isVerbose() ? new FiniteProgress("Processing splits for density estimation", splitsets.size(), LOG) : null;
DBIDVar v = DBIDUtil.newVar();
for(Iterator<ArrayDBIDs> it1 = splitsets.iterator(); it1.hasNext();) {
ArrayDBIDs pinSet = it1.next();
final int len = pinSet.size();
final int indoff = len >> 1;
pinSet.assignVar(indoff, v);
V midpoint = points.get(v);
for(DBIDArrayIter it = pinSet.iter(); it.getOffset() < len; it.advance()) {
if(DBIDUtil.equal(it, v)) {
continue;
}
double dist = EuclideanDistanceFunction.STATIC.distance(points.get(it), midpoint);
++distanceComputations;
davg.increment(v, dist);
nDists.increment(v, 1);
davg.increment(it, dist);
nDists.increment(it, 1);
}
LOG.incrementProcessed(splitp);
}
LOG.ensureCompleted(splitp);
for(DBIDIter it = points.getDBIDs().iter(); it.valid(); it.advance()) {
// it might be that a point does not occur for a certain size of a
// projection (likely if do few projections, in this case there is no avg
// distance)
int count = nDists.intValue(it);
double val = (count == 0) ? FastOPTICS.UNDEFINED_DISTANCE : (davg.doubleValue(it) / count);
davg.put(it, val);
}
nDists.destroy(); // No longer needed after normalization
return davg;
} | java | public DoubleDataStore computeAverageDistInSet() {
WritableDoubleDataStore davg = DataStoreUtil.makeDoubleStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT);
WritableIntegerDataStore nDists = DataStoreUtil.makeIntegerStorage(points.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
FiniteProgress splitp = LOG.isVerbose() ? new FiniteProgress("Processing splits for density estimation", splitsets.size(), LOG) : null;
DBIDVar v = DBIDUtil.newVar();
for(Iterator<ArrayDBIDs> it1 = splitsets.iterator(); it1.hasNext();) {
ArrayDBIDs pinSet = it1.next();
final int len = pinSet.size();
final int indoff = len >> 1;
pinSet.assignVar(indoff, v);
V midpoint = points.get(v);
for(DBIDArrayIter it = pinSet.iter(); it.getOffset() < len; it.advance()) {
if(DBIDUtil.equal(it, v)) {
continue;
}
double dist = EuclideanDistanceFunction.STATIC.distance(points.get(it), midpoint);
++distanceComputations;
davg.increment(v, dist);
nDists.increment(v, 1);
davg.increment(it, dist);
nDists.increment(it, 1);
}
LOG.incrementProcessed(splitp);
}
LOG.ensureCompleted(splitp);
for(DBIDIter it = points.getDBIDs().iter(); it.valid(); it.advance()) {
// it might be that a point does not occur for a certain size of a
// projection (likely if do few projections, in this case there is no avg
// distance)
int count = nDists.intValue(it);
double val = (count == 0) ? FastOPTICS.UNDEFINED_DISTANCE : (davg.doubleValue(it) / count);
davg.put(it, val);
}
nDists.destroy(); // No longer needed after normalization
return davg;
} | [
"public",
"DoubleDataStore",
"computeAverageDistInSet",
"(",
")",
"{",
"WritableDoubleDataStore",
"davg",
"=",
"DataStoreUtil",
".",
"makeDoubleStorage",
"(",
"points",
".",
"getDBIDs",
"(",
")",
",",
"DataStoreFactory",
".",
"HINT_HOT",
")",
";",
"WritableIntegerData... | Compute for each point a density estimate as inverse of average distance to
a point in a projected set
@return for each point average distance to point in a set | [
"Compute",
"for",
"each",
"point",
"a",
"density",
"estimate",
"as",
"inverse",
"of",
"average",
"distance",
"to",
"a",
"point",
"in",
"a",
"projected",
"set"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/fastoptics/RandomProjectedNeighborsAndDensities.java#L407-L442 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDateTime.java | LocalDateTime.withFieldAdded | public LocalDateTime withFieldAdded(DurationFieldType fieldType, int amount) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (amount == 0) {
return this;
}
long instant = fieldType.getField(getChronology()).add(getLocalMillis(), amount);
return withLocalMillis(instant);
} | java | public LocalDateTime withFieldAdded(DurationFieldType fieldType, int amount) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (amount == 0) {
return this;
}
long instant = fieldType.getField(getChronology()).add(getLocalMillis(), amount);
return withLocalMillis(instant);
} | [
"public",
"LocalDateTime",
"withFieldAdded",
"(",
"DurationFieldType",
"fieldType",
",",
"int",
"amount",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field must not be null\"",
")",
";",
"}",
"if",
... | Returns a copy of this datetime with the value of the specified
field increased.
<p>
If the addition is zero or the field is null, then <code>this</code> is returned.
<p>
These three lines are equivalent:
<pre>
LocalDateTime added = dt.withFieldAdded(DurationFieldType.years(), 6);
LocalDateTime added = dt.plusYears(6);
LocalDateTime added = dt.plus(Period.years(6));
</pre>
@param fieldType the field type to add to, not null
@param amount the amount to add
@return a copy of this datetime with the field updated
@throws IllegalArgumentException if the value is null or invalid
@throws ArithmeticException if the result exceeds the internal capacity | [
"Returns",
"a",
"copy",
"of",
"this",
"datetime",
"with",
"the",
"value",
"of",
"the",
"specified",
"field",
"increased",
".",
"<p",
">",
"If",
"the",
"addition",
"is",
"zero",
"or",
"the",
"field",
"is",
"null",
"then",
"<code",
">",
"this<",
"/",
"co... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDateTime.java#L1013-L1022 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexController.java | CmsFlexController.setDateLastModifiedHeader | public static void setDateLastModifiedHeader(HttpServletResponse res, long dateLastModified) {
if (dateLastModified > -1) {
// set date last modified header (precision is only second, not millisecond
res.setDateHeader(CmsRequestUtil.HEADER_LAST_MODIFIED, (dateLastModified / 1000) * 1000);
} else {
// this resource can not be optimized for "last modified", use current time as header
res.setDateHeader(CmsRequestUtil.HEADER_LAST_MODIFIED, System.currentTimeMillis());
// avoiding issues with IE8+
res.addHeader(CmsRequestUtil.HEADER_CACHE_CONTROL, "public, max-age=0");
}
} | java | public static void setDateLastModifiedHeader(HttpServletResponse res, long dateLastModified) {
if (dateLastModified > -1) {
// set date last modified header (precision is only second, not millisecond
res.setDateHeader(CmsRequestUtil.HEADER_LAST_MODIFIED, (dateLastModified / 1000) * 1000);
} else {
// this resource can not be optimized for "last modified", use current time as header
res.setDateHeader(CmsRequestUtil.HEADER_LAST_MODIFIED, System.currentTimeMillis());
// avoiding issues with IE8+
res.addHeader(CmsRequestUtil.HEADER_CACHE_CONTROL, "public, max-age=0");
}
} | [
"public",
"static",
"void",
"setDateLastModifiedHeader",
"(",
"HttpServletResponse",
"res",
",",
"long",
"dateLastModified",
")",
"{",
"if",
"(",
"dateLastModified",
">",
"-",
"1",
")",
"{",
"// set date last modified header (precision is only second, not millisecond",
"res... | Sets the "last modified" date header for a given http request.<p>
@param res the response to set the "last modified" date header for
@param dateLastModified the date to set (if this is lower then 0, the current time is set) | [
"Sets",
"the",
"last",
"modified",
"date",
"header",
"for",
"a",
"given",
"http",
"request",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexController.java#L369-L380 |
apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.addDeclaredMethodsFromAllInterfaces | public static void addDeclaredMethodsFromAllInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
List cnInterfaces = Arrays.asList(cNode.getInterfaces());
ClassNode parent = cNode.getSuperClass();
while (parent != null && !parent.equals(ClassHelper.OBJECT_TYPE)) {
ClassNode[] interfaces = parent.getInterfaces();
for (ClassNode iface : interfaces) {
if (!cnInterfaces.contains(iface)) {
methodsMap.putAll(iface.getDeclaredMethodsMap());
}
}
parent = parent.getSuperClass();
}
} | java | public static void addDeclaredMethodsFromAllInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
List cnInterfaces = Arrays.asList(cNode.getInterfaces());
ClassNode parent = cNode.getSuperClass();
while (parent != null && !parent.equals(ClassHelper.OBJECT_TYPE)) {
ClassNode[] interfaces = parent.getInterfaces();
for (ClassNode iface : interfaces) {
if (!cnInterfaces.contains(iface)) {
methodsMap.putAll(iface.getDeclaredMethodsMap());
}
}
parent = parent.getSuperClass();
}
} | [
"public",
"static",
"void",
"addDeclaredMethodsFromAllInterfaces",
"(",
"ClassNode",
"cNode",
",",
"Map",
"<",
"String",
",",
"MethodNode",
">",
"methodsMap",
")",
"{",
"List",
"cnInterfaces",
"=",
"Arrays",
".",
"asList",
"(",
"cNode",
".",
"getInterfaces",
"("... | Adds methods from interfaces and parent interfaces. Existing entries in the methods map take precedence.
Methods from interfaces visited early take precedence over later ones.
@param cNode The ClassNode
@param methodsMap A map of existing methods to alter | [
"Adds",
"methods",
"from",
"interfaces",
"and",
"parent",
"interfaces",
".",
"Existing",
"entries",
"in",
"the",
"methods",
"map",
"take",
"precedence",
".",
"Methods",
"from",
"interfaces",
"visited",
"early",
"take",
"precedence",
"over",
"later",
"ones",
"."
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L194-L206 |
aerogear/aerogear-unifiedpush-server | common/src/main/java/org/jboss/aerogear/unifiedpush/system/ConfigurationUtils.java | ConfigurationUtils.tryGetGlobalProperty | public static String tryGetGlobalProperty(String key, String defaultValue) {
try {
String value = System.getenv(formatEnvironmentVariable(key));
if (value == null) {
value = tryGetProperty(key, defaultValue);
}
return value;
} catch (SecurityException e) {
logger.error("Could not get value of global property {} due to SecurityManager. Using default value.", key, e);
return defaultValue;
}
} | java | public static String tryGetGlobalProperty(String key, String defaultValue) {
try {
String value = System.getenv(formatEnvironmentVariable(key));
if (value == null) {
value = tryGetProperty(key, defaultValue);
}
return value;
} catch (SecurityException e) {
logger.error("Could not get value of global property {} due to SecurityManager. Using default value.", key, e);
return defaultValue;
}
} | [
"public",
"static",
"String",
"tryGetGlobalProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"try",
"{",
"String",
"value",
"=",
"System",
".",
"getenv",
"(",
"formatEnvironmentVariable",
"(",
"key",
")",
")",
";",
"if",
"(",
"value",... | Get a global string property. This method will first try to get the value from an
environment variable and if that does not exist it will look up a system property.
@param key Name of the variable
@param defaultValue Returned if neither env var nor system property are defined
@return String the value of the Environment or System Property if defined, the given
default value otherwise | [
"Get",
"a",
"global",
"string",
"property",
".",
"This",
"method",
"will",
"first",
"try",
"to",
"get",
"the",
"value",
"from",
"an",
"environment",
"variable",
"and",
"if",
"that",
"does",
"not",
"exist",
"it",
"will",
"look",
"up",
"a",
"system",
"prop... | train | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/common/src/main/java/org/jboss/aerogear/unifiedpush/system/ConfigurationUtils.java#L81-L92 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java | AgentPoolsInner.createOrUpdate | public AgentPoolInner createOrUpdate(String resourceGroupName, String managedClusterName, String agentPoolName, AgentPoolInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedClusterName, agentPoolName, parameters).toBlocking().last().body();
} | java | public AgentPoolInner createOrUpdate(String resourceGroupName, String managedClusterName, String agentPoolName, AgentPoolInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedClusterName, agentPoolName, parameters).toBlocking().last().body();
} | [
"public",
"AgentPoolInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedClusterName",
",",
"String",
"agentPoolName",
",",
"AgentPoolInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Creates or updates an agent pool.
Creates or updates an agent pool in the specified managed cluster.
@param resourceGroupName The name of the resource group.
@param managedClusterName The name of the managed cluster resource.
@param agentPoolName The name of the agent pool.
@param parameters Parameters supplied to the Create or Update an agent pool operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AgentPoolInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"agent",
"pool",
".",
"Creates",
"or",
"updates",
"an",
"agent",
"pool",
"in",
"the",
"specified",
"managed",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java#L328-L330 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbPoolDataSource.java | MariaDbPoolDataSource.getConnection | public Connection getConnection(final String username, final String password)
throws SQLException {
try {
if (pool == null) {
this.user = username;
this.password = password;
initialize();
return pool.getConnection();
}
if ((urlParser.getUsername() != null ? urlParser.getUsername().equals(username)
: username == null)
&& (urlParser.getPassword() != null ? urlParser.getPassword().equals(password)
: (password == null || password.isEmpty()))) {
return pool.getConnection();
}
//username / password are different from the one already used to initialize pool
//-> return a real new connection.
UrlParser urlParser = (UrlParser) this.urlParser.clone();
urlParser.setUsername(username);
urlParser.setPassword(password);
return MariaDbConnection.newConnection(urlParser, pool.getGlobalInfo());
} catch (SQLException e) {
throw ExceptionMapper.getException(e, null, null, false);
} catch (CloneNotSupportedException cloneException) {
throw new SQLException("Error in configuration");
}
} | java | public Connection getConnection(final String username, final String password)
throws SQLException {
try {
if (pool == null) {
this.user = username;
this.password = password;
initialize();
return pool.getConnection();
}
if ((urlParser.getUsername() != null ? urlParser.getUsername().equals(username)
: username == null)
&& (urlParser.getPassword() != null ? urlParser.getPassword().equals(password)
: (password == null || password.isEmpty()))) {
return pool.getConnection();
}
//username / password are different from the one already used to initialize pool
//-> return a real new connection.
UrlParser urlParser = (UrlParser) this.urlParser.clone();
urlParser.setUsername(username);
urlParser.setPassword(password);
return MariaDbConnection.newConnection(urlParser, pool.getGlobalInfo());
} catch (SQLException e) {
throw ExceptionMapper.getException(e, null, null, false);
} catch (CloneNotSupportedException cloneException) {
throw new SQLException("Error in configuration");
}
} | [
"public",
"Connection",
"getConnection",
"(",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"if",
"(",
"pool",
"==",
"null",
")",
"{",
"this",
".",
"user",
"=",
"username",
";",
"this",
... | Attempts to establish a connection with the data source that this <code>DataSource</code>
object represents.
@param username the database user on whose behalf the connection is being made
@param password the user's password
@return a connection to the data source
@throws SQLException if a database access error occurs | [
"Attempts",
"to",
"establish",
"a",
"connection",
"with",
"the",
"data",
"source",
"that",
"this",
"<code",
">",
"DataSource<",
"/",
"code",
">",
"object",
"represents",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPoolDataSource.java#L260-L291 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FastHessianFeatureDetector.java | FastHessianFeatureDetector.polyPeak | public static float polyPeak( float lower , float middle , float upper )
{
// if( lower >= middle || upper >= middle )
// throw new IllegalArgumentException("Crap");
// only need two coefficients to compute the peak's location
float a = 0.5f*lower - middle + 0.5f*upper;
float b = 0.5f*upper - 0.5f*lower;
return -b/(2.0f*a);
} | java | public static float polyPeak( float lower , float middle , float upper )
{
// if( lower >= middle || upper >= middle )
// throw new IllegalArgumentException("Crap");
// only need two coefficients to compute the peak's location
float a = 0.5f*lower - middle + 0.5f*upper;
float b = 0.5f*upper - 0.5f*lower;
return -b/(2.0f*a);
} | [
"public",
"static",
"float",
"polyPeak",
"(",
"float",
"lower",
",",
"float",
"middle",
",",
"float",
"upper",
")",
"{",
"//\t\tif( lower >= middle || upper >= middle )",
"//\t\t\tthrow new IllegalArgumentException(\"Crap\");",
"// only need two coefficients to compute the peak's l... | <p>
Fits a second order polynomial to the data and determines the location of the peak.
<br>
y = a*x<sup>2</sup>+b*x + c<br>
x = {-1,0,1}<br>
y = Feature value
</p>
<p>
Note: The original paper fit a 3D Quadratic to the data instead. This required the first
and second derivative of the Laplacian to be estimated. Such estimates are error prone
and using the technique found in OpenSURF produced erratic results and required some hackery
to get to work. This should always produce stable results and is much faster.
</p>
@param lower Value at x=-1
@param middle Value at x=0
@param upper Value at x=1
@return x-coordinate of the peak | [
"<p",
">",
"Fits",
"a",
"second",
"order",
"polynomial",
"to",
"the",
"data",
"and",
"determines",
"the",
"location",
"of",
"the",
"peak",
".",
"<br",
">",
"y",
"=",
"a",
"*",
"x<sup",
">",
"2<",
"/",
"sup",
">",
"+",
"b",
"*",
"x",
"+",
"c<br",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FastHessianFeatureDetector.java#L336-L346 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java | DBInitializerHelper.getRootNodeInitializeScript | public static String getRootNodeInitializeScript(JDBCDataContainerConfig containerConfig)
{
boolean multiDb = containerConfig.dbStructureType.isMultiDatabase();
String itemTableName = getItemTableName(containerConfig);
return getRootNodeInitializeScript(itemTableName, multiDb);
} | java | public static String getRootNodeInitializeScript(JDBCDataContainerConfig containerConfig)
{
boolean multiDb = containerConfig.dbStructureType.isMultiDatabase();
String itemTableName = getItemTableName(containerConfig);
return getRootNodeInitializeScript(itemTableName, multiDb);
} | [
"public",
"static",
"String",
"getRootNodeInitializeScript",
"(",
"JDBCDataContainerConfig",
"containerConfig",
")",
"{",
"boolean",
"multiDb",
"=",
"containerConfig",
".",
"dbStructureType",
".",
"isMultiDatabase",
"(",
")",
";",
"String",
"itemTableName",
"=",
"getIte... | Initialization script for root node based on {@link JDBCDataContainerConfig}. | [
"Initialization",
"script",
"for",
"root",
"node",
"based",
"on",
"{"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L195-L201 |
BlueBrain/bluima | modules/bluima_lexica/src/main/java/ch/epfl/bbp/uima/obo/OBOOntology.java | OBOOntology.isA | public boolean isA(String hypoID, String hyperID) {
if (hypoID.equals(hyperID))
return false;
return getIdsForIdWithAncestors(hypoID).contains(hyperID);
} | java | public boolean isA(String hypoID, String hyperID) {
if (hypoID.equals(hyperID))
return false;
return getIdsForIdWithAncestors(hypoID).contains(hyperID);
} | [
"public",
"boolean",
"isA",
"(",
"String",
"hypoID",
",",
"String",
"hyperID",
")",
"{",
"if",
"(",
"hypoID",
".",
"equals",
"(",
"hyperID",
")",
")",
"return",
"false",
";",
"return",
"getIdsForIdWithAncestors",
"(",
"hypoID",
")",
".",
"contains",
"(",
... | Tests whether there is a direct or indirect is_a (or has_role)
relationship between two IDs.
@param hypoID
The potential hyponym (descendant term).
@param hyperID
The potential hypernym (ancestor term).
@return Whether that direct relationship exists. | [
"Tests",
"whether",
"there",
"is",
"a",
"direct",
"or",
"indirect",
"is_a",
"(",
"or",
"has_role",
")",
"relationship",
"between",
"two",
"IDs",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_lexica/src/main/java/ch/epfl/bbp/uima/obo/OBOOntology.java#L341-L345 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java | BermudanSwaptionFromSwapSchedules.getValueUnderlyingNumeraireRelative | private RandomVariable getValueUnderlyingNumeraireRelative(LIBORModelMonteCarloSimulationModel model, Schedule legSchedule, boolean paysFloat, double swaprate, double notional) throws CalculationException {
RandomVariable value = model.getRandomVariableForConstant(0.0);
for(int periodIndex = legSchedule.getNumberOfPeriods() - 1; periodIndex >= 0; periodIndex--) {
double fixingTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getFixing());
double paymentTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getPayment());
double periodLength = legSchedule.getPeriodLength(periodIndex);
RandomVariable numeraireAtPayment = model.getNumeraire(paymentTime);
RandomVariable monteCarloProbabilitiesAtPayment = model.getMonteCarloWeights(paymentTime);
if(swaprate != 0.0) {
RandomVariable periodCashFlowFix = model.getRandomVariableForConstant(swaprate * periodLength * notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment);
value = value.add(periodCashFlowFix);
}
if(paysFloat) {
RandomVariable libor = model.getLIBOR(fixingTime, fixingTime, paymentTime);
RandomVariable periodCashFlowFloat = libor.mult(periodLength).mult(notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment);
value = value.add(periodCashFlowFloat);
}
}
return value;
} | java | private RandomVariable getValueUnderlyingNumeraireRelative(LIBORModelMonteCarloSimulationModel model, Schedule legSchedule, boolean paysFloat, double swaprate, double notional) throws CalculationException {
RandomVariable value = model.getRandomVariableForConstant(0.0);
for(int periodIndex = legSchedule.getNumberOfPeriods() - 1; periodIndex >= 0; periodIndex--) {
double fixingTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getFixing());
double paymentTime = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate().toLocalDate(), legSchedule.getPeriod(periodIndex).getPayment());
double periodLength = legSchedule.getPeriodLength(periodIndex);
RandomVariable numeraireAtPayment = model.getNumeraire(paymentTime);
RandomVariable monteCarloProbabilitiesAtPayment = model.getMonteCarloWeights(paymentTime);
if(swaprate != 0.0) {
RandomVariable periodCashFlowFix = model.getRandomVariableForConstant(swaprate * periodLength * notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment);
value = value.add(periodCashFlowFix);
}
if(paysFloat) {
RandomVariable libor = model.getLIBOR(fixingTime, fixingTime, paymentTime);
RandomVariable periodCashFlowFloat = libor.mult(periodLength).mult(notional).div(numeraireAtPayment).mult(monteCarloProbabilitiesAtPayment);
value = value.add(periodCashFlowFloat);
}
}
return value;
} | [
"private",
"RandomVariable",
"getValueUnderlyingNumeraireRelative",
"(",
"LIBORModelMonteCarloSimulationModel",
"model",
",",
"Schedule",
"legSchedule",
",",
"boolean",
"paysFloat",
",",
"double",
"swaprate",
",",
"double",
"notional",
")",
"throws",
"CalculationException",
... | Calculated the numeraire relative value of an underlying swap leg.
@param model The Monte Carlo model.
@param legSchedule The schedule of the leg.
@param paysFloat If true a floating rate is payed.
@param swaprate The swaprate. May be 0.0 for pure floating leg.
@param notional The notional.
@return The sum of the numeraire relative cash flows.
@throws CalculationException Thrown if underlying model failed to calculate stochastic process. | [
"Calculated",
"the",
"numeraire",
"relative",
"value",
"of",
"an",
"underlying",
"swap",
"leg",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java#L292-L314 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java | XPathHelper.createXPathFactorySaxonFirst | @Nonnull
public static XPathFactory createXPathFactorySaxonFirst ()
{
// The XPath object used to compile the expressions
XPathFactory aXPathFactory;
try
{
// First try to use Saxon, using the context class loader
aXPathFactory = XPathFactory.newInstance (XPathFactory.DEFAULT_OBJECT_MODEL_URI,
"net.sf.saxon.xpath.XPathFactoryImpl",
ClassLoaderHelper.getContextClassLoader ());
}
catch (final Exception ex)
{
// Must be Throwable because of e.g. IllegalAccessError (see issue #19)
// Seems like Saxon is not in the class path - fall back to default JAXP
try
{
aXPathFactory = XPathFactory.newInstance (XPathFactory.DEFAULT_OBJECT_MODEL_URI);
}
catch (final Exception ex2)
{
throw new IllegalStateException ("Failed to create JAXP XPathFactory", ex2);
}
}
// Secure processing by default
EXMLParserFeature.SECURE_PROCESSING.applyTo (aXPathFactory, true);
return aXPathFactory;
} | java | @Nonnull
public static XPathFactory createXPathFactorySaxonFirst ()
{
// The XPath object used to compile the expressions
XPathFactory aXPathFactory;
try
{
// First try to use Saxon, using the context class loader
aXPathFactory = XPathFactory.newInstance (XPathFactory.DEFAULT_OBJECT_MODEL_URI,
"net.sf.saxon.xpath.XPathFactoryImpl",
ClassLoaderHelper.getContextClassLoader ());
}
catch (final Exception ex)
{
// Must be Throwable because of e.g. IllegalAccessError (see issue #19)
// Seems like Saxon is not in the class path - fall back to default JAXP
try
{
aXPathFactory = XPathFactory.newInstance (XPathFactory.DEFAULT_OBJECT_MODEL_URI);
}
catch (final Exception ex2)
{
throw new IllegalStateException ("Failed to create JAXP XPathFactory", ex2);
}
}
// Secure processing by default
EXMLParserFeature.SECURE_PROCESSING.applyTo (aXPathFactory, true);
return aXPathFactory;
} | [
"@",
"Nonnull",
"public",
"static",
"XPathFactory",
"createXPathFactorySaxonFirst",
"(",
")",
"{",
"// The XPath object used to compile the expressions",
"XPathFactory",
"aXPathFactory",
";",
"try",
"{",
"// First try to use Saxon, using the context class loader",
"aXPathFactory",
... | Create a new {@link XPathFactory} trying to instantiate Saxon class
<code>net.sf.saxon.xpath.XPathFactoryImpl</code> first. If that fails, the
default XPathFactory is created.
@return A new {@link XPathFactory} and never <code>null</code>.
@throws IllegalStateException
In case neither Saxon nor default factory could be instantiated! | [
"Create",
"a",
"new",
"{",
"@link",
"XPathFactory",
"}",
"trying",
"to",
"instantiate",
"Saxon",
"class",
"<code",
">",
"net",
".",
"sf",
".",
"saxon",
".",
"xpath",
".",
"XPathFactoryImpl<",
"/",
"code",
">",
"first",
".",
"If",
"that",
"fails",
"the",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java#L78-L107 |
craftercms/deployer | src/main/java/org/craftercms/deployer/utils/ConfigUtils.java | ConfigUtils.getBooleanProperty | public static Boolean getBooleanProperty(Configuration config, String key,
Boolean defaultValue) throws DeployerConfigurationException {
try {
return config.getBoolean(key, defaultValue);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | java | public static Boolean getBooleanProperty(Configuration config, String key,
Boolean defaultValue) throws DeployerConfigurationException {
try {
return config.getBoolean(key, defaultValue);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | [
"public",
"static",
"Boolean",
"getBooleanProperty",
"(",
"Configuration",
"config",
",",
"String",
"key",
",",
"Boolean",
"defaultValue",
")",
"throws",
"DeployerConfigurationException",
"{",
"try",
"{",
"return",
"config",
".",
"getBoolean",
"(",
"key",
",",
"de... | Returns the specified Boolean property from the configuration
@param config the configuration
@param key the key of the property
@param defaultValue the default value if the property is not found
@return the Boolean value of the property, or the default value if not found
@throws DeployerConfigurationException if an error occurred | [
"Returns",
"the",
"specified",
"Boolean",
"property",
"from",
"the",
"configuration"
] | train | https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L153-L160 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.