repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/DataSourceResourceFactoryBuilder.java | DataSourceResourceFactoryBuilder.getDataSourceID | private static final String getDataSourceID(String application, String module, String component, String jndiName) {
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append(AppDefinedResource.APPLICATION).append('[').append(application).append(']').append('/');
if (module != null) {
sb.append(AppDefinedResource.MODULE).append('[').append(module).append(']').append('/');
if (component != null)
sb.append(AppDefinedResource.COMPONENT).append('[').append(component).append(']').append('/');
}
}
return sb.append(DataSourceService.DATASOURCE).append('[').append(jndiName).append(']').toString();
} | java | private static final String getDataSourceID(String application, String module, String component, String jndiName) {
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append(AppDefinedResource.APPLICATION).append('[').append(application).append(']').append('/');
if (module != null) {
sb.append(AppDefinedResource.MODULE).append('[').append(module).append(']').append('/');
if (component != null)
sb.append(AppDefinedResource.COMPONENT).append('[').append(component).append(']').append('/');
}
}
return sb.append(DataSourceService.DATASOURCE).append('[').append(jndiName).append(']').toString();
} | [
"private",
"static",
"final",
"String",
"getDataSourceID",
"(",
"String",
"application",
",",
"String",
"module",
",",
"String",
"component",
",",
"String",
"jndiName",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"jndiName",
".",
"length",... | Utility method that creates a unique identifier for an application defined data source.
For example,
application[MyApp]/module[MyModule]/dataSource[java:module/env/jdbc/ds1]
@param application application name if data source is in java:app, java:module, or java:comp. Otherwise null.
@param module module name if data source is in java:module or java:comp. Otherwise null.
@param component component name if data source is in java:comp and isn't in web container. Otherwise null.
@param jndiName configured JNDI name for the data source. For example, java:module/env/jdbc/ds1
@return the unique identifier | [
"Utility",
"method",
"that",
"creates",
"a",
"unique",
"identifier",
"for",
"an",
"application",
"defined",
"data",
"source",
".",
"For",
"example",
"application",
"[",
"MyApp",
"]",
"/",
"module",
"[",
"MyModule",
"]",
"/",
"dataSource",
"[",
"java",
":",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/DataSourceResourceFactoryBuilder.java#L331-L342 |
netty/netty | common/src/main/java/io/netty/util/internal/ResourcesUtil.java | ResourcesUtil.getFile | public static File getFile(Class resourceClass, String fileName) {
try {
return new File(URLDecoder.decode(resourceClass.getResource(fileName).getFile(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
return new File(resourceClass.getResource(fileName).getFile());
}
} | java | public static File getFile(Class resourceClass, String fileName) {
try {
return new File(URLDecoder.decode(resourceClass.getResource(fileName).getFile(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
return new File(resourceClass.getResource(fileName).getFile());
}
} | [
"public",
"static",
"File",
"getFile",
"(",
"Class",
"resourceClass",
",",
"String",
"fileName",
")",
"{",
"try",
"{",
"return",
"new",
"File",
"(",
"URLDecoder",
".",
"decode",
"(",
"resourceClass",
".",
"getResource",
"(",
"fileName",
")",
".",
"getFile",
... | Returns a {@link File} named {@code fileName} associated with {@link Class} {@code resourceClass} .
@param resourceClass The associated class
@param fileName The file name
@return The file named {@code fileName} associated with {@link Class} {@code resourceClass} . | [
"Returns",
"a",
"{",
"@link",
"File",
"}",
"named",
"{",
"@code",
"fileName",
"}",
"associated",
"with",
"{",
"@link",
"Class",
"}",
"{",
"@code",
"resourceClass",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ResourcesUtil.java#L34-L40 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java | Locale.getStringWithDefault | @Pure
public static String getStringWithDefault(ClassLoader classLoader, String key, String defaultValue, Object... params) {
return getStringWithDefault(classLoader, detectResourceClass(null), key, defaultValue, params);
} | java | @Pure
public static String getStringWithDefault(ClassLoader classLoader, String key, String defaultValue, Object... params) {
return getStringWithDefault(classLoader, detectResourceClass(null), key, defaultValue, params);
} | [
"@",
"Pure",
"public",
"static",
"String",
"getStringWithDefault",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"key",
",",
"String",
"defaultValue",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"getStringWithDefault",
"(",
"classLoader",
",",
"detectR... | Replies the text that corresponds to the specified resource.
@param classLoader is the class loader to use.
@param key is the name of the resource into the specified file
@param defaultValue is the default value to replies if the resource does not contain the specified key.
@param params is the the list of parameters which will
replaces the <code>#1</code>, <code>#2</code>... into the string.
@return the text that corresponds to the specified resource | [
"Replies",
"the",
"text",
"that",
"corresponds",
"to",
"the",
"specified",
"resource",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java#L405-L408 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java | AlignedBox3f.setZ | @Override
public void setZ(double min, double max) {
if (min <= max) {
this.minz = min;
this.maxz = max;
} else {
this.minz = max;
this.maxz = min;
}
} | java | @Override
public void setZ(double min, double max) {
if (min <= max) {
this.minz = min;
this.maxz = max;
} else {
this.minz = max;
this.maxz = min;
}
} | [
"@",
"Override",
"public",
"void",
"setZ",
"(",
"double",
"min",
",",
"double",
"max",
")",
"{",
"if",
"(",
"min",
"<=",
"max",
")",
"{",
"this",
".",
"minz",
"=",
"min",
";",
"this",
".",
"maxz",
"=",
"max",
";",
"}",
"else",
"{",
"this",
".",... | Set the z bounds of the box.
@param min the min value for the z axis.
@param max the max value for the z axis. | [
"Set",
"the",
"z",
"bounds",
"of",
"the",
"box",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L637-L646 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java | BigDecimalMath.toBigDecimal | public static BigDecimal toBigDecimal(String string, MathContext mathContext) {
int len = string.length();
if (len < 600) {
return new BigDecimal(string, mathContext);
}
int splitLength = len / (len >= 10000 ? 8 : 5);
return toBigDecimal(string, mathContext, splitLength);
} | java | public static BigDecimal toBigDecimal(String string, MathContext mathContext) {
int len = string.length();
if (len < 600) {
return new BigDecimal(string, mathContext);
}
int splitLength = len / (len >= 10000 ? 8 : 5);
return toBigDecimal(string, mathContext, splitLength);
} | [
"public",
"static",
"BigDecimal",
"toBigDecimal",
"(",
"String",
"string",
",",
"MathContext",
"mathContext",
")",
"{",
"int",
"len",
"=",
"string",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"<",
"600",
")",
"{",
"return",
"new",
"BigDecimal",
"(",... | Creates a {@link BigDecimal} from the specified <code>String</code> representation.
<p>This method is equivalent to the String constructor {@link BigDecimal#BigDecimal(String, MathContext)}
but has been optimized for large strings (several thousand digits).</p>
@param string the string representation
@param mathContext the {@link MathContext} used for the result
@return the created {@link BigDecimal}
@throws NumberFormatException if <code>string</code> is not a valid representation of a {@link BigDecimal}
@throws ArithmeticException if the result is inexact but the rounding mode is {@code UNNECESSARY}
@see BigDecimal#BigDecimal(String, MathContext)
@see #toBigDecimal(String) | [
"Creates",
"a",
"{",
"@link",
"BigDecimal",
"}",
"from",
"the",
"specified",
"<code",
">",
"String<",
"/",
"code",
">",
"representation",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L98-L106 |
jayantk/jklol | src/com/jayantkrish/jklol/models/AbstractFactorGraphBuilder.java | AbstractFactorGraphBuilder.addUnreplicatedFactor | public void addUnreplicatedFactor(String factorName, T factor, VariableNumMap vars) {
parametricFactors.add(factor);
factorPatterns.add(new WrapperVariablePattern(vars));
parametricFactorNames.add(factorName);
} | java | public void addUnreplicatedFactor(String factorName, T factor, VariableNumMap vars) {
parametricFactors.add(factor);
factorPatterns.add(new WrapperVariablePattern(vars));
parametricFactorNames.add(factorName);
} | [
"public",
"void",
"addUnreplicatedFactor",
"(",
"String",
"factorName",
",",
"T",
"factor",
",",
"VariableNumMap",
"vars",
")",
"{",
"parametricFactors",
".",
"add",
"(",
"factor",
")",
";",
"factorPatterns",
".",
"add",
"(",
"new",
"WrapperVariablePattern",
"("... | Adds a parameterized, unreplicated factor to the model being
constructed. The factor will match only the variables which it is
defined over.
@param factor | [
"Adds",
"a",
"parameterized",
"unreplicated",
"factor",
"to",
"the",
"model",
"being",
"constructed",
".",
"The",
"factor",
"will",
"match",
"only",
"the",
"variables",
"which",
"it",
"is",
"defined",
"over",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/AbstractFactorGraphBuilder.java#L119-L123 |
eserating/siren4j | src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java | BaseBuilder.addStep | protected void addStep(String methodName, Object[] args, Class<?>[] argTypes, boolean builderMethod) {
if(StringUtils.isBlank(methodName)) {
throw new IllegalArgumentException("methodName cannot be null or empty.");
}
steps.add(new Step(methodName, args, argTypes, builderMethod));
} | java | protected void addStep(String methodName, Object[] args, Class<?>[] argTypes, boolean builderMethod) {
if(StringUtils.isBlank(methodName)) {
throw new IllegalArgumentException("methodName cannot be null or empty.");
}
steps.add(new Step(methodName, args, argTypes, builderMethod));
} | [
"protected",
"void",
"addStep",
"(",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
",",
"boolean",
"builderMethod",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"methodName",
")",
... | Adds a builder step for this builder, upon build these steps will be called in the same order they came in on.
@param methodName cannot be <code>null</code> or empty.
@param args may be <code>null</code> or empty.
@param argTypes argument class types can be specified to ensure the right class types
are used when we try to find the specified method. This is needed for primitive types do to
autoboxing issues. May be <code>null</code> or empty.
@param builderMethod if <code>true</code> then call the specified method on the builder and not
the component object instance. | [
"Adds",
"a",
"builder",
"step",
"for",
"this",
"builder",
"upon",
"build",
"these",
"steps",
"will",
"be",
"called",
"in",
"the",
"same",
"order",
"they",
"came",
"in",
"on",
"."
] | train | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java#L126-L131 |
dashbuilder/dashbuilder | dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/table/TableDisplayer.java | TableDisplayer.onFilterEnabled | @Override
public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {
view.gotoFirstPage();
super.onFilterEnabled(displayer, groupOp);
} | java | @Override
public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {
view.gotoFirstPage();
super.onFilterEnabled(displayer, groupOp);
} | [
"@",
"Override",
"public",
"void",
"onFilterEnabled",
"(",
"Displayer",
"displayer",
",",
"DataSetGroup",
"groupOp",
")",
"{",
"view",
".",
"gotoFirstPage",
"(",
")",
";",
"super",
".",
"onFilterEnabled",
"(",
"displayer",
",",
"groupOp",
")",
";",
"}"
] | Reset the current navigation status on filter requests from external displayers | [
"Reset",
"the",
"current",
"navigation",
"status",
"on",
"filter",
"requests",
"from",
"external",
"displayers"
] | train | https://github.com/dashbuilder/dashbuilder/blob/50ef88210726b4f2f33f1a82eaf0f542e38dedd9/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/table/TableDisplayer.java#L376-L380 |
i-net-software/jlessc | src/com/inet/lib/less/ColorUtils.java | ColorUtils.hsla | static double hsla( HSL hsl ) {
return hsla(hsl.h, hsl.s, hsl.l, hsl.a);
} | java | static double hsla( HSL hsl ) {
return hsla(hsl.h, hsl.s, hsl.l, hsl.a);
} | [
"static",
"double",
"hsla",
"(",
"HSL",
"hsl",
")",
"{",
"return",
"hsla",
"(",
"hsl",
".",
"h",
",",
"hsl",
".",
"s",
",",
"hsl",
".",
"l",
",",
"hsl",
".",
"a",
")",
";",
"}"
] | Create a color value.
@param hsl
a HSL value
@return a color as long | [
"Create",
"a",
"color",
"value",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ColorUtils.java#L217-L219 |
GwtMaterialDesign/gwt-material-table | src/main/java/gwt/material/design/client/ui/table/cell/Column.java | Column.onBrowserEvent | public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) {
final int index = context.getIndex();
ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : (ValueUpdater<C>) value -> {
fieldUpdater.update(index, object, value);
};
cell.onBrowserEvent(context, elem, getValue(object), event, valueUpdater);
} | java | public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) {
final int index = context.getIndex();
ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : (ValueUpdater<C>) value -> {
fieldUpdater.update(index, object, value);
};
cell.onBrowserEvent(context, elem, getValue(object), event, valueUpdater);
} | [
"public",
"void",
"onBrowserEvent",
"(",
"Context",
"context",
",",
"Element",
"elem",
",",
"final",
"T",
"object",
",",
"NativeEvent",
"event",
")",
"{",
"final",
"int",
"index",
"=",
"context",
".",
"getIndex",
"(",
")",
";",
"ValueUpdater",
"<",
"C",
... | Handle a browser event that took place within the column.
@param context the cell context
@param elem the parent Element
@param object the base object to be updated
@param event the native browser event | [
"Handle",
"a",
"browser",
"event",
"that",
"took",
"place",
"within",
"the",
"column",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/Column.java#L107-L113 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java | FeaturesImpl.listPhraseListsWithServiceResponseAsync | public Observable<ServiceResponse<List<PhraseListFeatureInfo>>> listPhraseListsWithServiceResponseAsync(UUID appId, String versionId, ListPhraseListsOptionalParameter listPhraseListsOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listPhraseListsOptionalParameter != null ? listPhraseListsOptionalParameter.skip() : null;
final Integer take = listPhraseListsOptionalParameter != null ? listPhraseListsOptionalParameter.take() : null;
return listPhraseListsWithServiceResponseAsync(appId, versionId, skip, take);
} | java | public Observable<ServiceResponse<List<PhraseListFeatureInfo>>> listPhraseListsWithServiceResponseAsync(UUID appId, String versionId, ListPhraseListsOptionalParameter listPhraseListsOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listPhraseListsOptionalParameter != null ? listPhraseListsOptionalParameter.skip() : null;
final Integer take = listPhraseListsOptionalParameter != null ? listPhraseListsOptionalParameter.take() : null;
return listPhraseListsWithServiceResponseAsync(appId, versionId, skip, take);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"PhraseListFeatureInfo",
">",
">",
">",
"listPhraseListsWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListPhraseListsOptionalParameter",
"listPhraseListsOptionalParameter",
... | Gets all the phraselist features.
@param appId The application ID.
@param versionId The version ID.
@param listPhraseListsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<PhraseListFeatureInfo> object | [
"Gets",
"all",
"the",
"phraselist",
"features",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java#L246-L260 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/extension/std/XCostExtension.java | XCostExtension.assignDriver | public void assignDriver(XAttribute attribute, String driver) {
if (driver != null && driver.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_DRIVER.clone();
attr.setValue(driver);
attribute.getAttributes().put(KEY_DRIVER, attr);
}
} | java | public void assignDriver(XAttribute attribute, String driver) {
if (driver != null && driver.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_DRIVER.clone();
attr.setValue(driver);
attribute.getAttributes().put(KEY_DRIVER, attr);
}
} | [
"public",
"void",
"assignDriver",
"(",
"XAttribute",
"attribute",
",",
"String",
"driver",
")",
"{",
"if",
"(",
"driver",
"!=",
"null",
"&&",
"driver",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"XAttributeLiteral",
"attr",
"="... | Assigns any attribute its cost driver, as defined by this extension's
driver attribute.
@param attribute
Attribute to assign cost driver to.
@param driver
The cost driver to be assigned. | [
"Assigns",
"any",
"attribute",
"its",
"cost",
"driver",
"as",
"defined",
"by",
"this",
"extension",
"s",
"driver",
"attribute",
"."
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XCostExtension.java#L786-L792 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.resumeSession | public ResumeSessionResponse resumeSession(ResumeSessionRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
request.getSessionId());
internalRequest.addParameter(RESUME, null);
return invokeHttpClient(internalRequest, ResumeSessionResponse.class);
} | java | public ResumeSessionResponse resumeSession(ResumeSessionRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
request.getSessionId());
internalRequest.addParameter(RESUME, null);
return invokeHttpClient(internalRequest, ResumeSessionResponse.class);
} | [
"public",
"ResumeSessionResponse",
"resumeSession",
"(",
"ResumeSessionRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSessionId",
"(",
")",
",",... | Resume your live session by live session id.
@param request The request object containing all parameters for resuming live session.
@return the response | [
"Resume",
"your",
"live",
"session",
"by",
"live",
"session",
"id",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L948-L955 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java | CmsColor.MAX | private float MAX(float first, float second, float third) {
float max = Integer.MIN_VALUE;
if (first > max) {
max = first;
}
if (second > max) {
max = second;
}
if (third > max) {
max = third;
}
return max;
} | java | private float MAX(float first, float second, float third) {
float max = Integer.MIN_VALUE;
if (first > max) {
max = first;
}
if (second > max) {
max = second;
}
if (third > max) {
max = third;
}
return max;
} | [
"private",
"float",
"MAX",
"(",
"float",
"first",
",",
"float",
"second",
",",
"float",
"third",
")",
"{",
"float",
"max",
"=",
"Integer",
".",
"MIN_VALUE",
";",
"if",
"(",
"first",
">",
"max",
")",
"{",
"max",
"=",
"first",
";",
"}",
"if",
"(",
... | Calculates the largest value between the three inputs.<p>
@param first value
@param second value
@param third value
@return the largest value between the three inputs | [
"Calculates",
"the",
"largest",
"value",
"between",
"the",
"three",
"inputs",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java#L259-L272 |
lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isArray | public ResultMatcher isArray() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != ARRAY) {
failOnType(node, "an array");
}
}
};
} | java | public ResultMatcher isArray() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != ARRAY) {
failOnType(node, "an array");
}
}
};
} | [
"public",
"ResultMatcher",
"isArray",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isPresent",
"(",
"actual",
")",
";",
"Node",
"node",
... | Fails if the selected JSON is not an Array or is not present.
@return | [
"Fails",
"if",
"the",
"selected",
"JSON",
"is",
"not",
"an",
"Array",
"or",
"is",
"not",
"present",
"."
] | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L168-L178 |
sagiegurari/fax4j | src/main/java/org/fax4j/bridge/http/MultiPartHTTPRequestParser.java | MultiPartHTTPRequestParser.getFileInfoFromInputDataImpl | @Override
protected FileInfo getFileInfoFromInputDataImpl(HTTPRequest inputData)
{
//get content
Map<String,ContentPart<?>> contentPartsMap=this.getContentPartsAsMap(inputData);
//get file info
FileInfo fileInfo=null;
ContentPart<?> contentPart=contentPartsMap.get(this.fileContentParameter);
if(contentPart==null)
{
throw new FaxException("File info not provided.");
}
ContentPartType contentPartType=contentPart.getType();
switch(contentPartType)
{
case FILE:
File file=(File)contentPart.getContent();
fileInfo=new FileInfo(file);
break;
case BINARY:
byte[] data=(byte[])contentPart.getContent();
//get file name
String fileName=this.getContentPartAsString(contentPartsMap,this.fileNameParameter);
fileInfo=new FileInfo(fileName,data);
break;
default:
throw new FaxException("Unsupported content part type: "+contentPartType);
}
return fileInfo;
} | java | @Override
protected FileInfo getFileInfoFromInputDataImpl(HTTPRequest inputData)
{
//get content
Map<String,ContentPart<?>> contentPartsMap=this.getContentPartsAsMap(inputData);
//get file info
FileInfo fileInfo=null;
ContentPart<?> contentPart=contentPartsMap.get(this.fileContentParameter);
if(contentPart==null)
{
throw new FaxException("File info not provided.");
}
ContentPartType contentPartType=contentPart.getType();
switch(contentPartType)
{
case FILE:
File file=(File)contentPart.getContent();
fileInfo=new FileInfo(file);
break;
case BINARY:
byte[] data=(byte[])contentPart.getContent();
//get file name
String fileName=this.getContentPartAsString(contentPartsMap,this.fileNameParameter);
fileInfo=new FileInfo(fileName,data);
break;
default:
throw new FaxException("Unsupported content part type: "+contentPartType);
}
return fileInfo;
} | [
"@",
"Override",
"protected",
"FileInfo",
"getFileInfoFromInputDataImpl",
"(",
"HTTPRequest",
"inputData",
")",
"{",
"//get content",
"Map",
"<",
"String",
",",
"ContentPart",
"<",
"?",
">",
">",
"contentPartsMap",
"=",
"this",
".",
"getContentPartsAsMap",
"(",
"i... | This function returns the file info from the request data.
@param inputData
The input data
@return The file info | [
"This",
"function",
"returns",
"the",
"file",
"info",
"from",
"the",
"request",
"data",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/http/MultiPartHTTPRequestParser.java#L236-L269 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.timestampFormat | protected static void timestampFormat(String pattern, String... attributeNames) {
ModelDelegate.timestampFormat(modelClass(), pattern, attributeNames);
} | java | protected static void timestampFormat(String pattern, String... attributeNames) {
ModelDelegate.timestampFormat(modelClass(), pattern, attributeNames);
} | [
"protected",
"static",
"void",
"timestampFormat",
"(",
"String",
"pattern",
",",
"String",
"...",
"attributeNames",
")",
"{",
"ModelDelegate",
".",
"timestampFormat",
"(",
"modelClass",
"(",
")",
",",
"pattern",
",",
"attributeNames",
")",
";",
"}"
] | Registers date format for specified attributes. This format will be used to convert between
Date -> String -> java.sql.Timestamp when using the appropriate getters and setters.
<p>For example:
<blockquote><pre>
public class Person extends Model {
static {
timestampFormat("MM/dd/yyyy hh:mm a", "birth_datetime");
}
}
Person p = new Person();
// will convert String -> java.sql.Timestamp
p.setTimestamp("birth_datetime", "02/29/2000 12:07 PM");
// will convert Date -> String, if dob value in model is of type Date or java.sql.Timestamp
String str = p.getString("birth_datetime");
// will convert Date -> String
p.setString("birth_datetime", new Date());
// will convert String -> java.sql.Timestamp, if dob value in model is of type String
Timestamp ts = p.getTimestamp("birth_datetime");
</pre></blockquote>
@param pattern pattern to use for conversion
@param attributeNames attribute names | [
"Registers",
"date",
"format",
"for",
"specified",
"attributes",
".",
"This",
"format",
"will",
"be",
"used",
"to",
"convert",
"between",
"Date",
"-",
">",
"String",
"-",
">",
"java",
".",
"sql",
".",
"Timestamp",
"when",
"using",
"the",
"appropriate",
"ge... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2170-L2172 |
ironjacamar/ironjacamar | web/src/main/java/org/ironjacamar/web/console/Server.java | Server.invokeOp | public static OpResultInfo invokeOp(String name, int index, String[] args) throws JMException
{
MBeanServer server = getMBeanServer();
ObjectName objName = new ObjectName(name);
MBeanInfo info = server.getMBeanInfo(objName);
MBeanOperationInfo[] opInfo = info.getOperations();
MBeanOperationInfo op = opInfo[index];
MBeanParameterInfo[] paramInfo = op.getSignature();
String[] argTypes = new String[paramInfo.length];
for (int p = 0; p < paramInfo.length; p++)
argTypes[p] = paramInfo[p].getType();
return invokeOpByName(name, op.getName(), argTypes, args);
} | java | public static OpResultInfo invokeOp(String name, int index, String[] args) throws JMException
{
MBeanServer server = getMBeanServer();
ObjectName objName = new ObjectName(name);
MBeanInfo info = server.getMBeanInfo(objName);
MBeanOperationInfo[] opInfo = info.getOperations();
MBeanOperationInfo op = opInfo[index];
MBeanParameterInfo[] paramInfo = op.getSignature();
String[] argTypes = new String[paramInfo.length];
for (int p = 0; p < paramInfo.length; p++)
argTypes[p] = paramInfo[p].getType();
return invokeOpByName(name, op.getName(), argTypes, args);
} | [
"public",
"static",
"OpResultInfo",
"invokeOp",
"(",
"String",
"name",
",",
"int",
"index",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"JMException",
"{",
"MBeanServer",
"server",
"=",
"getMBeanServer",
"(",
")",
";",
"ObjectName",
"objName",
"=",
"new"... | Invoke an operation
@param name The bean name
@param index The method index
@param args The arguments
@return The result
@exception JMException Thrown if an error occurs | [
"Invoke",
"an",
"operation"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/console/Server.java#L318-L332 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java | ArrayFunctions.arrayAppend | public static Expression arrayAppend(Expression expression, Expression value) {
return x("ARRAY_APPEND(" + expression.toString() + ", " + value.toString() + ")");
} | java | public static Expression arrayAppend(Expression expression, Expression value) {
return x("ARRAY_APPEND(" + expression.toString() + ", " + value.toString() + ")");
} | [
"public",
"static",
"Expression",
"arrayAppend",
"(",
"Expression",
"expression",
",",
"Expression",
"value",
")",
"{",
"return",
"x",
"(",
"\"ARRAY_APPEND(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"value",
".",
"toString",
"(",
... | Returned expression results in new array with value appended. | [
"Returned",
"expression",
"results",
"in",
"new",
"array",
"with",
"value",
"appended",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L45-L47 |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.createRule | public static AT_Row createRule(TableRowType type, TableRowStyle style){
Validate.notNull(type);
Validate.validState(type!=TableRowType.UNKNOWN);
Validate.validState(type!=TableRowType.CONTENT);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
return new AT_Row(){
@Override
public TableRowType getType(){
return type;
}
@Override
public TableRowStyle getStyle(){
return style;
}
};
} | java | public static AT_Row createRule(TableRowType type, TableRowStyle style){
Validate.notNull(type);
Validate.validState(type!=TableRowType.UNKNOWN);
Validate.validState(type!=TableRowType.CONTENT);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
return new AT_Row(){
@Override
public TableRowType getType(){
return type;
}
@Override
public TableRowStyle getStyle(){
return style;
}
};
} | [
"public",
"static",
"AT_Row",
"createRule",
"(",
"TableRowType",
"type",
",",
"TableRowStyle",
"style",
")",
"{",
"Validate",
".",
"notNull",
"(",
"type",
")",
";",
"Validate",
".",
"validState",
"(",
"type",
"!=",
"TableRowType",
".",
"UNKNOWN",
")",
";",
... | Creates a new row representing a rule.
@param type the type for the rule row, must not be null nor {@link TableRowType#CONTENT} nor {@link TableRowType#UNKNOWN}
@param style the style for the rule row, must not be null nor {@link TableRowStyle#UNKNOWN}
@return a new row representing a rule
@throws {@link NullPointerException} if type or style where null
@throws {@link IllegalStateException} if type or style where unknown or if type was {@link TableRowType#CONTENT} | [
"Creates",
"a",
"new",
"row",
"representing",
"a",
"rule",
"."
] | train | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L60-L78 |
OSSIndex/heuristic-version | src/main/java/net/ossindex/version/impl/SemanticVersion.java | SemanticVersion.getNextParentVersion | public SemanticVersion getNextParentVersion() {
int major = head.getMajorVersion();
int minor = head.getMinorVersion();
int patch = head.getPatchVersion();
switch (significantDigits) {
case 1:
throw new UnsupportedOperationException();
case 2:
major++;
minor = 0;
patch = 0;
return new SemanticVersion(major, minor, patch);
case 3:
minor++;
patch = 0;
return new SemanticVersion(major, minor, patch);
default:
throw new UnsupportedOperationException();
}
} | java | public SemanticVersion getNextParentVersion() {
int major = head.getMajorVersion();
int minor = head.getMinorVersion();
int patch = head.getPatchVersion();
switch (significantDigits) {
case 1:
throw new UnsupportedOperationException();
case 2:
major++;
minor = 0;
patch = 0;
return new SemanticVersion(major, minor, patch);
case 3:
minor++;
patch = 0;
return new SemanticVersion(major, minor, patch);
default:
throw new UnsupportedOperationException();
}
} | [
"public",
"SemanticVersion",
"getNextParentVersion",
"(",
")",
"{",
"int",
"major",
"=",
"head",
".",
"getMajorVersion",
"(",
")",
";",
"int",
"minor",
"=",
"head",
".",
"getMinorVersion",
"(",
")",
";",
"int",
"patch",
"=",
"head",
".",
"getPatchVersion",
... | Strip the lowest number and increment the next one up. For example:
1.2.3 becomes 1.3.0 | [
"Strip",
"the",
"lowest",
"number",
"and",
"increment",
"the",
"next",
"one",
"up",
".",
"For",
"example",
":"
] | train | https://github.com/OSSIndex/heuristic-version/blob/9fe33a49d74acec54ddb91de9a3c3cd2f98fba40/src/main/java/net/ossindex/version/impl/SemanticVersion.java#L314-L334 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/rules/ExpandColumnFunctionsRule.java | ExpandColumnFunctionsRule.indexOfName | private static int indexOfName(List<UnresolvedReferenceExpression> inputFieldReferences, String targetName) {
int i;
for (i = 0; i < inputFieldReferences.size(); ++i) {
if (inputFieldReferences.get(i).getName().equals(targetName)) {
break;
}
}
return i == inputFieldReferences.size() ? -1 : i;
} | java | private static int indexOfName(List<UnresolvedReferenceExpression> inputFieldReferences, String targetName) {
int i;
for (i = 0; i < inputFieldReferences.size(); ++i) {
if (inputFieldReferences.get(i).getName().equals(targetName)) {
break;
}
}
return i == inputFieldReferences.size() ? -1 : i;
} | [
"private",
"static",
"int",
"indexOfName",
"(",
"List",
"<",
"UnresolvedReferenceExpression",
">",
"inputFieldReferences",
",",
"String",
"targetName",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"inputFieldReferences",
".",
"size",
... | Find the index of targetName in the list. Return -1 if not found. | [
"Find",
"the",
"index",
"of",
"targetName",
"in",
"the",
"list",
".",
"Return",
"-",
"1",
"if",
"not",
"found",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/rules/ExpandColumnFunctionsRule.java#L226-L234 |
jbossws/jbossws-cxf | modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java | CXFMAPBuilder.outboundMap | public MAP outboundMap(Map<String, Object> ctx)
{
AddressingProperties implementation = (AddressingProperties)ctx.get(CXFMAPConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
if (implementation == null)
{
implementation = new AddressingProperties();
ctx.put(CXFMAPConstants.CLIENT_ADDRESSING_PROPERTIES, implementation);
ctx.put(CXFMAPConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, implementation);
}
return newMap(implementation);
} | java | public MAP outboundMap(Map<String, Object> ctx)
{
AddressingProperties implementation = (AddressingProperties)ctx.get(CXFMAPConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
if (implementation == null)
{
implementation = new AddressingProperties();
ctx.put(CXFMAPConstants.CLIENT_ADDRESSING_PROPERTIES, implementation);
ctx.put(CXFMAPConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, implementation);
}
return newMap(implementation);
} | [
"public",
"MAP",
"outboundMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"ctx",
")",
"{",
"AddressingProperties",
"implementation",
"=",
"(",
"AddressingProperties",
")",
"ctx",
".",
"get",
"(",
"CXFMAPConstants",
".",
"CLIENT_ADDRESSING_PROPERTIES_OUTBOUND",
... | retrieve the outbound client message address properties attached to a message request map
@param ctx the client request properties map
@return | [
"retrieve",
"the",
"outbound",
"client",
"message",
"address",
"properties",
"attached",
"to",
"a",
"message",
"request",
"map"
] | train | https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java#L82-L92 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/conf/ServerConfiguration.java | ServerConfiguration.getEnum | public static <T extends Enum<T>> T getEnum(PropertyKey key, Class<T> enumType) {
return sConf.getEnum(key, enumType);
} | java | public static <T extends Enum<T>> T getEnum(PropertyKey key, Class<T> enumType) {
return sConf.getEnum(key, enumType);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getEnum",
"(",
"PropertyKey",
"key",
",",
"Class",
"<",
"T",
">",
"enumType",
")",
"{",
"return",
"sConf",
".",
"getEnum",
"(",
"key",
",",
"enumType",
")",
";",
"}"
] | Gets the value for the given key as an enum value.
@param key the key to get the value for
@param enumType the type of the enum
@param <T> the type of the enum
@return the value for the given key as an enum value | [
"Gets",
"the",
"value",
"for",
"the",
"given",
"key",
"as",
"an",
"enum",
"value",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/conf/ServerConfiguration.java#L253-L255 |
kwon37xi/hibernate4-memcached | hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java | NonstrictReadWriteEntityRegionAccessStrategy.afterUpdate | @Override
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
log.debug("region access strategy nonstrict-read-write entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key);
getInternalRegion().evict(key);
return false;
} | java | @Override
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
log.debug("region access strategy nonstrict-read-write entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key);
getInternalRegion().evict(key);
return false;
} | [
"@",
"Override",
"public",
"boolean",
"afterUpdate",
"(",
"Object",
"key",
",",
"Object",
"value",
",",
"Object",
"currentVersion",
",",
"Object",
"previousVersion",
",",
"SoftLock",
"lock",
")",
"throws",
"CacheException",
"{",
"log",
".",
"debug",
"(",
"\"re... | need evict the key, after update.
@see org.hibernate.cache.spi.access.EntityRegionAccessStrategy | [
"need",
"evict",
"the",
"key",
"after",
"update",
"."
] | train | https://github.com/kwon37xi/hibernate4-memcached/blob/e0b2839ab257b2602344f54ca53c564044f3585d/hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java#L49-L54 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java | ChangesListener.addPathsWithAsyncUpdate | private void addPathsWithAsyncUpdate(ChangesItem changesItem, String quotableParent)
{
boolean isAsyncUpdate;
try
{
isAsyncUpdate = quotaPersister.isNodeQuotaOrGroupOfNodesQuotaAsync(rName, wsName, quotableParent);
}
catch (UnknownQuotaLimitException e)
{
isAsyncUpdate = true;
}
if (isAsyncUpdate)
{
changesItem.addPathWithAsyncUpdate(quotableParent);
}
} | java | private void addPathsWithAsyncUpdate(ChangesItem changesItem, String quotableParent)
{
boolean isAsyncUpdate;
try
{
isAsyncUpdate = quotaPersister.isNodeQuotaOrGroupOfNodesQuotaAsync(rName, wsName, quotableParent);
}
catch (UnknownQuotaLimitException e)
{
isAsyncUpdate = true;
}
if (isAsyncUpdate)
{
changesItem.addPathWithAsyncUpdate(quotableParent);
}
} | [
"private",
"void",
"addPathsWithAsyncUpdate",
"(",
"ChangesItem",
"changesItem",
",",
"String",
"quotableParent",
")",
"{",
"boolean",
"isAsyncUpdate",
";",
"try",
"{",
"isAsyncUpdate",
"=",
"quotaPersister",
".",
"isNodeQuotaOrGroupOfNodesQuotaAsync",
"(",
"rName",
","... | Checks if data size for node is represented by <code>quotableParent</code> path
should be updated asynchronously. If so that path is putting into respective collection.
@param quotableParent
absolute path to node for which quota is set | [
"Checks",
"if",
"data",
"size",
"for",
"node",
"is",
"represented",
"by",
"<code",
">",
"quotableParent<",
"/",
"code",
">",
"path",
"should",
"be",
"updated",
"asynchronously",
".",
"If",
"so",
"that",
"path",
"is",
"putting",
"into",
"respective",
"collect... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/ChangesListener.java#L211-L227 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImpl_CustomFieldSerializer.java | OWLLiteralImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLLiteralImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImpl_CustomFieldSerializer.java#L67-L70 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java | VariantMetadataManager.removeFile | public void removeFile(String fileId, String studyId) {
// Sanity check
if (StringUtils.isEmpty(fileId)) {
logger.error("Variant file metadata ID {} is null or empty.", fileId);
return;
}
VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId);
if (variantStudyMetadata == null) {
logger.error("Study not found. Check your study ID: '{}'", studyId);
return;
}
if (variantStudyMetadata.getFiles() != null) {
for (int i = 0; i < variantStudyMetadata.getFiles().size(); i++) {
if (fileId.equals(variantStudyMetadata.getFiles().get(i).getId())) {
variantStudyMetadata.getFiles().remove(i);
return;
}
}
}
} | java | public void removeFile(String fileId, String studyId) {
// Sanity check
if (StringUtils.isEmpty(fileId)) {
logger.error("Variant file metadata ID {} is null or empty.", fileId);
return;
}
VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId);
if (variantStudyMetadata == null) {
logger.error("Study not found. Check your study ID: '{}'", studyId);
return;
}
if (variantStudyMetadata.getFiles() != null) {
for (int i = 0; i < variantStudyMetadata.getFiles().size(); i++) {
if (fileId.equals(variantStudyMetadata.getFiles().get(i).getId())) {
variantStudyMetadata.getFiles().remove(i);
return;
}
}
}
} | [
"public",
"void",
"removeFile",
"(",
"String",
"fileId",
",",
"String",
"studyId",
")",
"{",
"// Sanity check",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"fileId",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"Variant file metadata ID {} is null or empty.\""... | Remove a variant file metadata (from file ID) of a given variant study metadata (from study ID).
@param fileId File ID
@param studyId Study ID | [
"Remove",
"a",
"variant",
"file",
"metadata",
"(",
"from",
"file",
"ID",
")",
"of",
"a",
"given",
"variant",
"study",
"metadata",
"(",
"from",
"study",
"ID",
")",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L298-L318 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java | ExpressRouteCircuitsInner.getStatsAsync | public Observable<ExpressRouteCircuitStatsInner> getStatsAsync(String resourceGroupName, String circuitName) {
return getStatsWithServiceResponseAsync(resourceGroupName, circuitName).map(new Func1<ServiceResponse<ExpressRouteCircuitStatsInner>, ExpressRouteCircuitStatsInner>() {
@Override
public ExpressRouteCircuitStatsInner call(ServiceResponse<ExpressRouteCircuitStatsInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitStatsInner> getStatsAsync(String resourceGroupName, String circuitName) {
return getStatsWithServiceResponseAsync(resourceGroupName, circuitName).map(new Func1<ServiceResponse<ExpressRouteCircuitStatsInner>, ExpressRouteCircuitStatsInner>() {
@Override
public ExpressRouteCircuitStatsInner call(ServiceResponse<ExpressRouteCircuitStatsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitStatsInner",
">",
"getStatsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
")",
"{",
"return",
"getStatsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"circuitName",
")",
".",
"map",
"... | Gets all the stats from an express route circuit in a resource group.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCircuitStatsInner object | [
"Gets",
"all",
"the",
"stats",
"from",
"an",
"express",
"route",
"circuit",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L1441-L1448 |
grails/grails-core | grails-core/src/main/groovy/grails/util/GrailsClassUtils.java | GrailsClassUtils.getPropertyDescriptorForValue | public static PropertyDescriptor getPropertyDescriptorForValue(Object instance, Object propertyValue) {
if (instance == null || propertyValue == null) {
return null;
}
PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(instance.getClass());
for (PropertyDescriptor pd : descriptors) {
if (isAssignableOrConvertibleFrom(pd.getPropertyType(), propertyValue.getClass())) {
Object value;
try {
ReflectionUtils.makeAccessible(pd.getReadMethod());
value = pd.getReadMethod().invoke(instance);
}
catch (Exception e) {
throw new FatalBeanException("Problem calling readMethod of " + pd, e);
}
if (propertyValue.equals(value)) {
return pd;
}
}
}
return null;
} | java | public static PropertyDescriptor getPropertyDescriptorForValue(Object instance, Object propertyValue) {
if (instance == null || propertyValue == null) {
return null;
}
PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(instance.getClass());
for (PropertyDescriptor pd : descriptors) {
if (isAssignableOrConvertibleFrom(pd.getPropertyType(), propertyValue.getClass())) {
Object value;
try {
ReflectionUtils.makeAccessible(pd.getReadMethod());
value = pd.getReadMethod().invoke(instance);
}
catch (Exception e) {
throw new FatalBeanException("Problem calling readMethod of " + pd, e);
}
if (propertyValue.equals(value)) {
return pd;
}
}
}
return null;
} | [
"public",
"static",
"PropertyDescriptor",
"getPropertyDescriptorForValue",
"(",
"Object",
"instance",
",",
"Object",
"propertyValue",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
"||",
"propertyValue",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Prope... | Retrieves a PropertyDescriptor for the specified instance and property value
@param instance The instance
@param propertyValue The value of the property
@return The PropertyDescriptor | [
"Retrieves",
"a",
"PropertyDescriptor",
"for",
"the",
"specified",
"instance",
"and",
"property",
"value"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L264-L286 |
crawljax/crawljax | core/src/main/java/com/crawljax/forms/FormInputValueHelper.java | FormInputValueHelper.serializeFormInputs | public static void serializeFormInputs(File dir) {
if (instance == null) {
LOGGER.error("No instance of FormInputValueHelper exists.");
return;
}
final File out = new File(dir, FORMS_JSON_FILE);
Gson json = new GsonBuilder().setPrettyPrinting().create();
String serialized = json.toJson(instance.formInputs.values());
try {
LOGGER.info("Writing training form inputs to " + out.toString());
FileUtils.writeStringToFile(out, serialized, Charset.defaultCharset());
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
}
} | java | public static void serializeFormInputs(File dir) {
if (instance == null) {
LOGGER.error("No instance of FormInputValueHelper exists.");
return;
}
final File out = new File(dir, FORMS_JSON_FILE);
Gson json = new GsonBuilder().setPrettyPrinting().create();
String serialized = json.toJson(instance.formInputs.values());
try {
LOGGER.info("Writing training form inputs to " + out.toString());
FileUtils.writeStringToFile(out, serialized, Charset.defaultCharset());
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
}
} | [
"public",
"static",
"void",
"serializeFormInputs",
"(",
"File",
"dir",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"No instance of FormInputValueHelper exists.\"",
")",
";",
"return",
";",
"}",
"final",
"File",
"out"... | Serializes form inputs and writes the data to the output directory to be used by future
non-training crawls.
@param dir The output directory for the form input data. | [
"Serializes",
"form",
"inputs",
"and",
"writes",
"the",
"data",
"to",
"the",
"output",
"directory",
"to",
"be",
"used",
"by",
"future",
"non",
"-",
"training",
"crawls",
"."
] | train | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/forms/FormInputValueHelper.java#L357-L375 |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copiedBuffer | public static ByteBuf copiedBuffer(CharSequence string, Charset charset) {
if (string == null) {
throw new NullPointerException("string");
}
if (string instanceof CharBuffer) {
return copiedBuffer((CharBuffer) string, charset);
}
return copiedBuffer(CharBuffer.wrap(string), charset);
} | java | public static ByteBuf copiedBuffer(CharSequence string, Charset charset) {
if (string == null) {
throw new NullPointerException("string");
}
if (string instanceof CharBuffer) {
return copiedBuffer((CharBuffer) string, charset);
}
return copiedBuffer(CharBuffer.wrap(string), charset);
} | [
"public",
"static",
"ByteBuf",
"copiedBuffer",
"(",
"CharSequence",
"string",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"string\"",
")",
";",
"}",
"if",
"(",
"string",
"... | Creates a new big-endian buffer whose content is the specified
{@code string} encoded in the specified {@code charset}.
The new buffer's {@code readerIndex} and {@code writerIndex} are
{@code 0} and the length of the encoded string respectively. | [
"Creates",
"a",
"new",
"big",
"-",
"endian",
"buffer",
"whose",
"content",
"is",
"the",
"specified",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L577-L587 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java | GitFlowGraphMonitor.getNodeConfigWithOverrides | private Config getNodeConfigWithOverrides(Config nodeConfig, Path nodeFilePath) {
String nodeId = nodeFilePath.getParent().getName();
return nodeConfig.withValue(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY, ConfigValueFactory.fromAnyRef(nodeId));
} | java | private Config getNodeConfigWithOverrides(Config nodeConfig, Path nodeFilePath) {
String nodeId = nodeFilePath.getParent().getName();
return nodeConfig.withValue(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY, ConfigValueFactory.fromAnyRef(nodeId));
} | [
"private",
"Config",
"getNodeConfigWithOverrides",
"(",
"Config",
"nodeConfig",
",",
"Path",
"nodeFilePath",
")",
"{",
"String",
"nodeId",
"=",
"nodeFilePath",
".",
"getParent",
"(",
")",
".",
"getName",
"(",
")",
";",
"return",
"nodeConfig",
".",
"withValue",
... | Helper that overrides the data.node.id property with name derived from the node file path
@param nodeConfig node config
@param nodeFilePath path of the node file
@return config with overridden data.node.id | [
"Helper",
"that",
"overrides",
"the",
"data",
".",
"node",
".",
"id",
"property",
"with",
"name",
"derived",
"from",
"the",
"node",
"file",
"path"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L313-L316 |
DDTH/ddth-kafka | src/main/java/com/github/ddth/kafka/KafkaClient.java | KafkaClient.consumeMessage | public KafkaMessage consumeMessage(String consumerGroupId, String topic) {
return consumeMessage(consumerGroupId, true, topic);
} | java | public KafkaMessage consumeMessage(String consumerGroupId, String topic) {
return consumeMessage(consumerGroupId, true, topic);
} | [
"public",
"KafkaMessage",
"consumeMessage",
"(",
"String",
"consumerGroupId",
",",
"String",
"topic",
")",
"{",
"return",
"consumeMessage",
"(",
"consumerGroupId",
",",
"true",
",",
"topic",
")",
";",
"}"
] | Consumes one message from a topic.
@param consumerGroupId
@param topic
@return
@since 1.2.0 | [
"Consumes",
"one",
"message",
"from",
"a",
"topic",
"."
] | train | https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L461-L463 |
Omertron/api-themoviedb | JacksonReplacement/ObjectMapper.java | ObjectMapper.readValue | public <T> T readValue(String jsonString, Class<T> objClass) throws IOException {
try {
return readValue(new JSONObject(jsonString), objClass);
} catch (IOException ioe) {
throw ioe;
} catch (Exception e) {
e.printStackTrace();
throw new IOException(e);
}
} | java | public <T> T readValue(String jsonString, Class<T> objClass) throws IOException {
try {
return readValue(new JSONObject(jsonString), objClass);
} catch (IOException ioe) {
throw ioe;
} catch (Exception e) {
e.printStackTrace();
throw new IOException(e);
}
} | [
"public",
"<",
"T",
">",
"T",
"readValue",
"(",
"String",
"jsonString",
",",
"Class",
"<",
"T",
">",
"objClass",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"readValue",
"(",
"new",
"JSONObject",
"(",
"jsonString",
")",
",",
"objClass",
")",... | This takes a JSON string and creates (and populates) an object of the
given class with the data from that JSON string. It mimics the method
signature of the jackson JSON API, so that we don't have to import the
jackson library into this application.
@param jsonString The JSON string to parse.
@param objClass The class of object we want to create.
@return The instantiation of that class, populated with data from the
JSON object.
@throws IOException If there was any kind of issue. | [
"This",
"takes",
"a",
"JSON",
"string",
"and",
"creates",
"(",
"and",
"populates",
")",
"an",
"object",
"of",
"the",
"given",
"class",
"with",
"the",
"data",
"from",
"that",
"JSON",
"string",
".",
"It",
"mimics",
"the",
"method",
"signature",
"of",
"the"... | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/JacksonReplacement/ObjectMapper.java#L26-L35 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Transformation2D.java | Transformation2D.setShift | public void setShift(double x, double y) {
xx = 1;
xy = 0;
xd = x;
yx = 0;
yy = 1;
yd = y;
} | java | public void setShift(double x, double y) {
xx = 1;
xy = 0;
xd = x;
yx = 0;
yy = 1;
yd = y;
} | [
"public",
"void",
"setShift",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"xx",
"=",
"1",
";",
"xy",
"=",
"0",
";",
"xd",
"=",
"x",
";",
"yx",
"=",
"0",
";",
"yy",
"=",
"1",
";",
"yd",
"=",
"y",
";",
"}"
] | Set this transformation to be a shift.
@param x
The X coordinate to shift to.
@param y
The Y coordinate to shift to. | [
"Set",
"this",
"transformation",
"to",
"be",
"a",
"shift",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L578-L585 |
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.beginResumeAsync | public Observable<Page<SiteInner>> beginResumeAsync(final String resourceGroupName, final String name) {
return beginResumeWithServiceResponseAsync(resourceGroupName, name)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SiteInner>> beginResumeAsync(final String resourceGroupName, final String name) {
return beginResumeWithServiceResponseAsync(resourceGroupName, name)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SiteInner",
">",
">",
"beginResumeAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
")",
"{",
"return",
"beginResumeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
... | Resume an App Service Environment.
Resume an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SiteInner> object | [
"Resume",
"an",
"App",
"Service",
"Environment",
".",
"Resume",
"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#L3979-L3987 |
threerings/nenya | core/src/main/java/com/threerings/geom/GeomUtil.java | GeomUtil.grow | public static Rectangle grow (Rectangle source, Rectangle target)
{
if (target == null) {
log.warning("Can't grow with null rectangle [src=" + source + ", tgt=" + target + "].",
new Exception());
} else if (source == null) {
source = new Rectangle(target);
} else {
source.add(target);
}
return source;
} | java | public static Rectangle grow (Rectangle source, Rectangle target)
{
if (target == null) {
log.warning("Can't grow with null rectangle [src=" + source + ", tgt=" + target + "].",
new Exception());
} else if (source == null) {
source = new Rectangle(target);
} else {
source.add(target);
}
return source;
} | [
"public",
"static",
"Rectangle",
"grow",
"(",
"Rectangle",
"source",
",",
"Rectangle",
"target",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"log",
".",
"warning",
"(",
"\"Can't grow with null rectangle [src=\"",
"+",
"source",
"+",
"\", tgt=\"",
"+... | Adds the target rectangle to the bounds of the source rectangle. If the source rectangle is
null, a new rectangle is created that is the size of the target rectangle.
@return the source rectangle. | [
"Adds",
"the",
"target",
"rectangle",
"to",
"the",
"bounds",
"of",
"the",
"source",
"rectangle",
".",
"If",
"the",
"source",
"rectangle",
"is",
"null",
"a",
"new",
"rectangle",
"is",
"created",
"that",
"is",
"the",
"size",
"of",
"the",
"target",
"rectangle... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/geom/GeomUtil.java#L200-L211 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java | PropertyBuilder.buildPropertyDoc | public void buildPropertyDoc(XMLNode node, Content memberDetailsTree) {
if (writer == null) {
return;
}
int size = properties.size();
if (size > 0) {
Content propertyDetailsTree = writer.getPropertyDetailsTreeHeader(
classDoc, memberDetailsTree);
for (currentPropertyIndex = 0; currentPropertyIndex < size;
currentPropertyIndex++) {
Content propertyDocTree = writer.getPropertyDocTreeHeader(
(MethodDoc) properties.get(currentPropertyIndex),
propertyDetailsTree);
buildChildren(node, propertyDocTree);
propertyDetailsTree.addContent(writer.getPropertyDoc(
propertyDocTree, (currentPropertyIndex == size - 1)));
}
memberDetailsTree.addContent(
writer.getPropertyDetails(propertyDetailsTree));
}
} | java | public void buildPropertyDoc(XMLNode node, Content memberDetailsTree) {
if (writer == null) {
return;
}
int size = properties.size();
if (size > 0) {
Content propertyDetailsTree = writer.getPropertyDetailsTreeHeader(
classDoc, memberDetailsTree);
for (currentPropertyIndex = 0; currentPropertyIndex < size;
currentPropertyIndex++) {
Content propertyDocTree = writer.getPropertyDocTreeHeader(
(MethodDoc) properties.get(currentPropertyIndex),
propertyDetailsTree);
buildChildren(node, propertyDocTree);
propertyDetailsTree.addContent(writer.getPropertyDoc(
propertyDocTree, (currentPropertyIndex == size - 1)));
}
memberDetailsTree.addContent(
writer.getPropertyDetails(propertyDetailsTree));
}
} | [
"public",
"void",
"buildPropertyDoc",
"(",
"XMLNode",
"node",
",",
"Content",
"memberDetailsTree",
")",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"int",
"size",
"=",
"properties",
".",
"size",
"(",
")",
";",
"if",
"(",
"size... | Build the property documentation.
@param node the XML element that specifies which components to document
@param memberDetailsTree the content tree to which the documentation will be added | [
"Build",
"the",
"property",
"documentation",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java#L154-L174 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java | AbstractPipeline.opEvaluateParallelLazy | @SuppressWarnings("unchecked")
public <P_IN> Spliterator<E_OUT> opEvaluateParallelLazy(PipelineHelper<E_OUT> helper,
Spliterator<P_IN> spliterator) {
return opEvaluateParallel(helper, spliterator, i -> (E_OUT[]) new Object[i]).spliterator();
} | java | @SuppressWarnings("unchecked")
public <P_IN> Spliterator<E_OUT> opEvaluateParallelLazy(PipelineHelper<E_OUT> helper,
Spliterator<P_IN> spliterator) {
return opEvaluateParallel(helper, spliterator, i -> (E_OUT[]) new Object[i]).spliterator();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"P_IN",
">",
"Spliterator",
"<",
"E_OUT",
">",
"opEvaluateParallelLazy",
"(",
"PipelineHelper",
"<",
"E_OUT",
">",
"helper",
",",
"Spliterator",
"<",
"P_IN",
">",
"spliterator",
")",
"{",
"retu... | Returns a {@code Spliterator} describing a parallel evaluation of the
operation, using the specified {@code PipelineHelper} which describes the
upstream intermediate operations. Only called on stateful operations.
It is not necessary (though acceptable) to do a full computation of the
result here; it is preferable, if possible, to describe the result via a
lazily evaluated spliterator.
@implSpec The default implementation behaves as if:
<pre>{@code
return evaluateParallel(helper, i -> (E_OUT[]) new
Object[i]).spliterator();
}</pre>
and is suitable for implementations that cannot do better than a full
synchronous evaluation.
@param helper the pipeline helper
@param spliterator the source {@code Spliterator}
@return a {@code Spliterator} describing the result of the evaluation | [
"Returns",
"a",
"{",
"@code",
"Spliterator",
"}",
"describing",
"a",
"parallel",
"evaluation",
"of",
"the",
"operation",
"using",
"the",
"specified",
"{",
"@code",
"PipelineHelper",
"}",
"which",
"describes",
"the",
"upstream",
"intermediate",
"operations",
".",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L705-L709 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderManager.java | GVRShaderManager.makeLayout | static String makeLayout(String descriptor, String blockName, boolean useUBO)
{
return NativeShaderManager.makeLayout(descriptor, blockName, useUBO);
} | java | static String makeLayout(String descriptor, String blockName, boolean useUBO)
{
return NativeShaderManager.makeLayout(descriptor, blockName, useUBO);
} | [
"static",
"String",
"makeLayout",
"(",
"String",
"descriptor",
",",
"String",
"blockName",
",",
"boolean",
"useUBO",
")",
"{",
"return",
"NativeShaderManager",
".",
"makeLayout",
"(",
"descriptor",
",",
"blockName",
",",
"useUBO",
")",
";",
"}"
] | Make a string with the shader layout for a uniform block
with a given descriptor. The format of the descriptor is
the same as for a @{link GVRShaderData} - a string of
types and names of each field.
<p>
This function will return a Vulkan shader layout if the
Vulkan renderer is being used. Otherwise, it returns
an OpenGL layout.
@param descriptor string with types and names of each field
@param blockName name of uniform block
@param useUBO true to output uniform buffer layout, false for push constants
@return string with shader declaration | [
"Make",
"a",
"string",
"with",
"the",
"shader",
"layout",
"for",
"a",
"uniform",
"block",
"with",
"a",
"given",
"descriptor",
".",
"The",
"format",
"of",
"the",
"descriptor",
"is",
"the",
"same",
"as",
"for",
"a"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderManager.java#L113-L116 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYAreaChartBuilder.java | DJXYAreaChartBuilder.addSerie | public DJXYAreaChartBuilder addSerie(AbstractColumn column, String label) {
getDataset().addSerie(column, label);
return this;
} | java | public DJXYAreaChartBuilder addSerie(AbstractColumn column, String label) {
getDataset().addSerie(column, label);
return this;
} | [
"public",
"DJXYAreaChartBuilder",
"addSerie",
"(",
"AbstractColumn",
"column",
",",
"String",
"label",
")",
"{",
"getDataset",
"(",
")",
".",
"addSerie",
"(",
"column",
",",
"label",
")",
";",
"return",
"this",
";",
"}"
] | Adds the specified serie column to the dataset with custom label.
@param column the serie column
@param label column the custom label | [
"Adds",
"the",
"specified",
"serie",
"column",
"to",
"the",
"dataset",
"with",
"custom",
"label",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYAreaChartBuilder.java#L374-L377 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java | PacketCapturesInner.getStatus | public PacketCaptureQueryStatusResultInner getStatus(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return getStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).toBlocking().last().body();
} | java | public PacketCaptureQueryStatusResultInner getStatus(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return getStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).toBlocking().last().body();
} | [
"public",
"PacketCaptureQueryStatusResultInner",
"getStatus",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"packetCaptureName",
")",
"{",
"return",
"getStatusWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkWatcherName... | Query the status of a running packet capture session.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the Network Watcher resource.
@param packetCaptureName The name given to the packet capture session.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PacketCaptureQueryStatusResultInner object if successful. | [
"Query",
"the",
"status",
"of",
"a",
"running",
"packet",
"capture",
"session",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java#L717-L719 |
Jasig/uPortal | uPortal-webapp/src/main/java/org/apereo/portal/context/persondir/PersonDirectoryConfiguration.java | PersonDirectoryConfiguration.getUPortalJdbcUserSource | @Bean(name = "uPortalJdbcUserSource")
@Qualifier("uPortalInternal")
public IPersonAttributeDao getUPortalJdbcUserSource() {
final String sql = "SELECT USER_NAME FROM UP_USER WHERE {0}";
final SingleRowJdbcPersonAttributeDao rslt =
new SingleRowJdbcPersonAttributeDao(personDb, sql);
rslt.setUsernameAttributeProvider(getUsernameAttributeProvider());
rslt.setQueryAttributeMapping(
Collections.singletonMap(USERNAME_ATTRIBUTE, USERNAME_COLUMN_NAME));
final Map<String, Set<String>> resultAttributeMapping = new HashMap<>();
resultAttributeMapping.put(
USERNAME_COLUMN_NAME,
Stream.of(USERNAME_ATTRIBUTE, UID_ATTRIBUTE, USER_LOGIN_ID_ATTRIBUTE)
.collect(Collectors.toSet()));
rslt.setResultAttributeMapping(resultAttributeMapping);
return rslt;
} | java | @Bean(name = "uPortalJdbcUserSource")
@Qualifier("uPortalInternal")
public IPersonAttributeDao getUPortalJdbcUserSource() {
final String sql = "SELECT USER_NAME FROM UP_USER WHERE {0}";
final SingleRowJdbcPersonAttributeDao rslt =
new SingleRowJdbcPersonAttributeDao(personDb, sql);
rslt.setUsernameAttributeProvider(getUsernameAttributeProvider());
rslt.setQueryAttributeMapping(
Collections.singletonMap(USERNAME_ATTRIBUTE, USERNAME_COLUMN_NAME));
final Map<String, Set<String>> resultAttributeMapping = new HashMap<>();
resultAttributeMapping.put(
USERNAME_COLUMN_NAME,
Stream.of(USERNAME_ATTRIBUTE, UID_ATTRIBUTE, USER_LOGIN_ID_ATTRIBUTE)
.collect(Collectors.toSet()));
rslt.setResultAttributeMapping(resultAttributeMapping);
return rslt;
} | [
"@",
"Bean",
"(",
"name",
"=",
"\"uPortalJdbcUserSource\"",
")",
"@",
"Qualifier",
"(",
"\"uPortalInternal\"",
")",
"public",
"IPersonAttributeDao",
"getUPortalJdbcUserSource",
"(",
")",
"{",
"final",
"String",
"sql",
"=",
"\"SELECT USER_NAME FROM UP_USER WHERE {0}\"",
... | Looks in the base UP_USER table, doesn't find attributes but will ensure a result if it the
user exists in the portal database and is searched for by username, results are cached by the
outer caching DAO. | [
"Looks",
"in",
"the",
"base",
"UP_USER",
"table",
"doesn",
"t",
"find",
"attributes",
"but",
"will",
"ensure",
"a",
"result",
"if",
"it",
"the",
"user",
"exists",
"in",
"the",
"portal",
"database",
"and",
"is",
"searched",
"for",
"by",
"username",
"results... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-webapp/src/main/java/org/apereo/portal/context/persondir/PersonDirectoryConfiguration.java#L322-L338 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownNtoN_F32.java | AddBrownNtoN_F32.setDistortion | public AddBrownNtoN_F32 setDistortion( /**/double[] radial, /**/double t1, /**/double t2) {
params = new RadialTangential_F32(radial,t1,t2);
return this;
} | java | public AddBrownNtoN_F32 setDistortion( /**/double[] radial, /**/double t1, /**/double t2) {
params = new RadialTangential_F32(radial,t1,t2);
return this;
} | [
"public",
"AddBrownNtoN_F32",
"setDistortion",
"(",
"/**/",
"double",
"[",
"]",
"radial",
",",
"/**/",
"double",
"t1",
",",
"/**/",
"double",
"t2",
")",
"{",
"params",
"=",
"new",
"RadialTangential_F32",
"(",
"radial",
",",
"t1",
",",
"t2",
")",
";",
"re... | Specify intrinsic camera parameters
@param radial Radial distortion parameters | [
"Specify",
"intrinsic",
"camera",
"parameters"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownNtoN_F32.java#L41-L44 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/util/XsDateTimeConversionJava7.java | XsDateTimeConversionJava7.getDateFormat | private static DateFormat getDateFormat() {
if (IS_JAVA7) {
SoftReference<DateFormat> softReference = THREAD_LOCAL_DF.get();
if (softReference != null) {
DateFormat dateFormat = softReference.get();
if (dateFormat != null) {
return dateFormat;
}
}
DateFormat result = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.US);
softReference = new SoftReference<DateFormat>(result);
THREAD_LOCAL_DF.set(softReference);
return result;
} else {
throw new RuntimeException("Error parsing XES log. This method should not be called unless running on Java 7!");
}
} | java | private static DateFormat getDateFormat() {
if (IS_JAVA7) {
SoftReference<DateFormat> softReference = THREAD_LOCAL_DF.get();
if (softReference != null) {
DateFormat dateFormat = softReference.get();
if (dateFormat != null) {
return dateFormat;
}
}
DateFormat result = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.US);
softReference = new SoftReference<DateFormat>(result);
THREAD_LOCAL_DF.set(softReference);
return result;
} else {
throw new RuntimeException("Error parsing XES log. This method should not be called unless running on Java 7!");
}
} | [
"private",
"static",
"DateFormat",
"getDateFormat",
"(",
")",
"{",
"if",
"(",
"IS_JAVA7",
")",
"{",
"SoftReference",
"<",
"DateFormat",
">",
"softReference",
"=",
"THREAD_LOCAL_DF",
".",
"get",
"(",
")",
";",
"if",
"(",
"softReference",
"!=",
"null",
")",
... | Returns a DateFormat for each calling thread, using {@link ThreadLocal}.
@return a DateFormat that is safe to use in multi-threaded environments | [
"Returns",
"a",
"DateFormat",
"for",
"each",
"calling",
"thread",
"using",
"{",
"@link",
"ThreadLocal",
"}",
"."
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XsDateTimeConversionJava7.java#L47-L63 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/autoupdate/ExtensionAutoUpdate.java | ExtensionAutoUpdate.processAddOnChanges | void processAddOnChanges(Window caller, AddOnDependencyChecker.AddOnChangesResult changes) {
if (addonsDialog != null) {
addonsDialog.setDownloadingUpdates();
}
if (getView() != null) {
Set<AddOn> addOns = new HashSet<>(changes.getUninstalls());
addOns.addAll(changes.getOldVersions());
Set<Extension> extensions = new HashSet<>();
extensions.addAll(changes.getUnloadExtensions());
extensions.addAll(changes.getSoftUnloadExtensions());
if (!warnUnsavedResourcesOrActiveActions(caller, addOns, extensions, true)) {
return;
}
}
uninstallAddOns(caller, changes.getUninstalls(), false);
Set<AddOn> allAddons = new HashSet<>(changes.getNewVersions());
allAddons.addAll(changes.getInstalls());
for (AddOn addOn : allAddons) {
if (addonsDialog != null) {
addonsDialog.notifyAddOnDownloading(addOn);
}
downloadAddOn(addOn);
}
} | java | void processAddOnChanges(Window caller, AddOnDependencyChecker.AddOnChangesResult changes) {
if (addonsDialog != null) {
addonsDialog.setDownloadingUpdates();
}
if (getView() != null) {
Set<AddOn> addOns = new HashSet<>(changes.getUninstalls());
addOns.addAll(changes.getOldVersions());
Set<Extension> extensions = new HashSet<>();
extensions.addAll(changes.getUnloadExtensions());
extensions.addAll(changes.getSoftUnloadExtensions());
if (!warnUnsavedResourcesOrActiveActions(caller, addOns, extensions, true)) {
return;
}
}
uninstallAddOns(caller, changes.getUninstalls(), false);
Set<AddOn> allAddons = new HashSet<>(changes.getNewVersions());
allAddons.addAll(changes.getInstalls());
for (AddOn addOn : allAddons) {
if (addonsDialog != null) {
addonsDialog.notifyAddOnDownloading(addOn);
}
downloadAddOn(addOn);
}
} | [
"void",
"processAddOnChanges",
"(",
"Window",
"caller",
",",
"AddOnDependencyChecker",
".",
"AddOnChangesResult",
"changes",
")",
"{",
"if",
"(",
"addonsDialog",
"!=",
"null",
")",
"{",
"addonsDialog",
".",
"setDownloadingUpdates",
"(",
")",
";",
"}",
"if",
"(",... | Processes the given add-on changes.
@param caller the caller to set as parent of shown dialogues
@param changes the changes that will be processed | [
"Processes",
"the",
"given",
"add",
"-",
"on",
"changes",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/autoupdate/ExtensionAutoUpdate.java#L1336-L1365 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/resilience/RobustResilienceStrategy.java | RobustResilienceStrategy.putAllFailure | @Override
public void putAllFailure(Map<? extends K, ? extends V> entries, StoreAccessException e) {
cleanup(entries.keySet(), e);
} | java | @Override
public void putAllFailure(Map<? extends K, ? extends V> entries, StoreAccessException e) {
cleanup(entries.keySet(), e);
} | [
"@",
"Override",
"public",
"void",
"putAllFailure",
"(",
"Map",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"entries",
",",
"StoreAccessException",
"e",
")",
"{",
"cleanup",
"(",
"entries",
".",
"keySet",
"(",
")",
",",
"e",
")",
";",
"}... | Do nothing.
@param entries the entries being put
@param e the triggered failure | [
"Do",
"nothing",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustResilienceStrategy.java#L187-L190 |
microfocus-idol/java-idol-indexing-api | src/main/java/com/autonomy/nonaci/indexing/impl/IndexingServiceImpl.java | IndexingServiceImpl.createPostMethod | private HttpUriRequest createPostMethod(final ServerDetails serverDetails, final IndexCommand command) throws URISyntaxException {
LOGGER.trace("createPostMethod() called...");
final HttpPost httpPost = new HttpPost(createIndexCommandURI(serverDetails, command));
httpPost.setEntity(new PostDataHttpEntity(command.getPostData()));
return httpPost;
} | java | private HttpUriRequest createPostMethod(final ServerDetails serverDetails, final IndexCommand command) throws URISyntaxException {
LOGGER.trace("createPostMethod() called...");
final HttpPost httpPost = new HttpPost(createIndexCommandURI(serverDetails, command));
httpPost.setEntity(new PostDataHttpEntity(command.getPostData()));
return httpPost;
} | [
"private",
"HttpUriRequest",
"createPostMethod",
"(",
"final",
"ServerDetails",
"serverDetails",
",",
"final",
"IndexCommand",
"command",
")",
"throws",
"URISyntaxException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"createPostMethod() called...\"",
")",
";",
"final",
"HttpP... | Create a <tt>HttpClient</tt> <tt>PostMethod</tt> instance that contains the POST content.
@param serverDetails The connection details of the server to use...
@param command The command to get the POST content from
@return a <tt>HttpUriRequest</tt> containing the contents of the <tt>Command</tt>
@throws java.net.URISyntaxException If there was a problem converting the IndexCommand into a URI | [
"Create",
"a",
"<tt",
">",
"HttpClient<",
"/",
"tt",
">",
"<tt",
">",
"PostMethod<",
"/",
"tt",
">",
"instance",
"that",
"contains",
"the",
"POST",
"content",
"."
] | train | https://github.com/microfocus-idol/java-idol-indexing-api/blob/178ea844da501318d8d797a35b2f72ff40786b8c/src/main/java/com/autonomy/nonaci/indexing/impl/IndexingServiceImpl.java#L108-L114 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/ExtensionsDao.java | ExtensionsDao.deleteByExtension | public int deleteByExtension(String extensionName, String tableName)
throws SQLException {
DeleteBuilder<Extensions, Void> db = deleteBuilder();
setUniqueWhere(db.where(), extensionName, true, tableName, false, null);
int deleted = db.delete();
return deleted;
} | java | public int deleteByExtension(String extensionName, String tableName)
throws SQLException {
DeleteBuilder<Extensions, Void> db = deleteBuilder();
setUniqueWhere(db.where(), extensionName, true, tableName, false, null);
int deleted = db.delete();
return deleted;
} | [
"public",
"int",
"deleteByExtension",
"(",
"String",
"extensionName",
",",
"String",
"tableName",
")",
"throws",
"SQLException",
"{",
"DeleteBuilder",
"<",
"Extensions",
",",
"Void",
">",
"db",
"=",
"deleteBuilder",
"(",
")",
";",
"setUniqueWhere",
"(",
"db",
... | Delete by extension name and table name
@param extensionName
extension name
@param tableName
table name
@return deleted count
@throws SQLException
upon failure | [
"Delete",
"by",
"extension",
"name",
"and",
"table",
"name"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/ExtensionsDao.java#L109-L119 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/DatabaseInput.java | DatabaseInput.withParameters | public DatabaseInput withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | java | public DatabaseInput withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"DatabaseInput",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Thes key-value pairs define parameters and properties of the database.
</p>
@param parameters
Thes key-value pairs define parameters and properties of the database.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Thes",
"key",
"-",
"value",
"pairs",
"define",
"parameters",
"and",
"properties",
"of",
"the",
"database",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/DatabaseInput.java#L211-L214 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/JavaDocText.java | JavaDocText.extractJavaDoc | private StringBuilder extractJavaDoc(final String source) {
int docStart = source.indexOf("/**");
int docEnd = source.indexOf("*/", docStart);
int classStart = source.indexOf("public class");
int author = source.indexOf("@author");
int since = source.indexOf("@since");
if (classStart == -1) {
classStart = docEnd;
}
if (docEnd == -1 || classStart < docStart) {
return new StringBuilder("No JavaDoc provided");
}
if (author != -1 && author < docEnd) {
docEnd = author;
}
if (since != -1 && since < docEnd) {
docEnd = since;
}
return new StringBuilder(source.substring(docStart + 3, docEnd).trim());
} | java | private StringBuilder extractJavaDoc(final String source) {
int docStart = source.indexOf("/**");
int docEnd = source.indexOf("*/", docStart);
int classStart = source.indexOf("public class");
int author = source.indexOf("@author");
int since = source.indexOf("@since");
if (classStart == -1) {
classStart = docEnd;
}
if (docEnd == -1 || classStart < docStart) {
return new StringBuilder("No JavaDoc provided");
}
if (author != -1 && author < docEnd) {
docEnd = author;
}
if (since != -1 && since < docEnd) {
docEnd = since;
}
return new StringBuilder(source.substring(docStart + 3, docEnd).trim());
} | [
"private",
"StringBuilder",
"extractJavaDoc",
"(",
"final",
"String",
"source",
")",
"{",
"int",
"docStart",
"=",
"source",
".",
"indexOf",
"(",
"\"/**\"",
")",
";",
"int",
"docEnd",
"=",
"source",
".",
"indexOf",
"(",
"\"*/\"",
",",
"docStart",
")",
";",
... | extracts the javadoc. It assumes that the java doc for the class is the first javadoc in the file.
@param source string representing the java class.
@return a String builder containing the javadoc. | [
"extracts",
"the",
"javadoc",
".",
"It",
"assumes",
"that",
"the",
"java",
"doc",
"for",
"the",
"class",
"is",
"the",
"first",
"javadoc",
"in",
"the",
"file",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/JavaDocText.java#L49-L71 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java | MerkleTreeUtil.writeLeaves | public static void writeLeaves(DataOutput out, MerkleTreeView merkleTreeView) throws IOException {
int leafLevel = merkleTreeView.depth() - 1;
int numberOfLeaves = getNodesOnLevel(leafLevel);
int leftMostLeaf = getLeftMostNodeOrderOnLevel(leafLevel);
out.writeInt(numberOfLeaves);
for (int leafOrder = leftMostLeaf; leafOrder < leftMostLeaf + numberOfLeaves; leafOrder++) {
out.writeInt(merkleTreeView.getNodeHash(leafOrder));
}
} | java | public static void writeLeaves(DataOutput out, MerkleTreeView merkleTreeView) throws IOException {
int leafLevel = merkleTreeView.depth() - 1;
int numberOfLeaves = getNodesOnLevel(leafLevel);
int leftMostLeaf = getLeftMostNodeOrderOnLevel(leafLevel);
out.writeInt(numberOfLeaves);
for (int leafOrder = leftMostLeaf; leafOrder < leftMostLeaf + numberOfLeaves; leafOrder++) {
out.writeInt(merkleTreeView.getNodeHash(leafOrder));
}
} | [
"public",
"static",
"void",
"writeLeaves",
"(",
"DataOutput",
"out",
",",
"MerkleTreeView",
"merkleTreeView",
")",
"throws",
"IOException",
"{",
"int",
"leafLevel",
"=",
"merkleTreeView",
".",
"depth",
"(",
")",
"-",
"1",
";",
"int",
"numberOfLeaves",
"=",
"ge... | Writes the hashes of the leaves of a Merkle tree into the
provided {@link DataOutput}
@param out The data output to write the leaves into
@param merkleTreeView The Merkle tree which leaves to be written
into the data output
@throws IOException if an I/O error occurs | [
"Writes",
"the",
"hashes",
"of",
"the",
"leaves",
"of",
"a",
"Merkle",
"tree",
"into",
"the",
"provided",
"{",
"@link",
"DataOutput",
"}"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java#L348-L358 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java | CrossAppClient.deleteCrossBlacklist | public ResponseWrapper deleteCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
CrossBlacklistPayload payload = new CrossBlacklistPayload.Builder()
.setCrossBlacklists(blacklists)
.build();
return _httpClient.sendDelete(_baseUrl + crossUserPath + "/" + username + "/blacklist", payload.toString());
} | java | public ResponseWrapper deleteCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
CrossBlacklistPayload payload = new CrossBlacklistPayload.Builder()
.setCrossBlacklists(blacklists)
.build();
return _httpClient.sendDelete(_baseUrl + crossUserPath + "/" + username + "/blacklist", payload.toString());
} | [
"public",
"ResponseWrapper",
"deleteCrossBlacklist",
"(",
"String",
"username",
",",
"CrossBlacklist",
"[",
"]",
"blacklists",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"Cr... | Delete blacklist whose users belong to another app from a given user.
@param username The owner of the blacklist
@param blacklists CrossBlacklist array
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Delete",
"blacklist",
"whose",
"users",
"belong",
"to",
"another",
"app",
"from",
"a",
"given",
"user",
"."
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/crossapp/CrossAppClient.java#L100-L107 |
languagetool-org/languagetool | languagetool-commandline/src/main/java/org/languagetool/commandline/Main.java | Main.getFilteredText | private String getFilteredText(String filename, String encoding, boolean xmlFiltering) throws IOException {
if (options.isVerbose()) {
lt.setOutput(System.err);
}
// don't use StringTools.readStream() as that might add newlines which aren't there:
try (InputStreamReader reader = getInputStreamReader(filename, encoding)) {
String fileContents = readerToString(reader);
if (xmlFiltering) {
return filterXML(fileContents);
} else {
return fileContents;
}
}
} | java | private String getFilteredText(String filename, String encoding, boolean xmlFiltering) throws IOException {
if (options.isVerbose()) {
lt.setOutput(System.err);
}
// don't use StringTools.readStream() as that might add newlines which aren't there:
try (InputStreamReader reader = getInputStreamReader(filename, encoding)) {
String fileContents = readerToString(reader);
if (xmlFiltering) {
return filterXML(fileContents);
} else {
return fileContents;
}
}
} | [
"private",
"String",
"getFilteredText",
"(",
"String",
"filename",
",",
"String",
"encoding",
",",
"boolean",
"xmlFiltering",
")",
"throws",
"IOException",
"{",
"if",
"(",
"options",
".",
"isVerbose",
"(",
")",
")",
"{",
"lt",
".",
"setOutput",
"(",
"System"... | Loads filename and filters out XML. Note that the XML
filtering can lead to incorrect positions in the list of matching rules. | [
"Loads",
"filename",
"and",
"filters",
"out",
"XML",
".",
"Note",
"that",
"the",
"XML",
"filtering",
"can",
"lead",
"to",
"incorrect",
"positions",
"in",
"the",
"list",
"of",
"matching",
"rules",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-commandline/src/main/java/org/languagetool/commandline/Main.java#L342-L355 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/GroupApi.java | GroupApi.deleteLdapGroupLink | public void deleteLdapGroupLink(Object groupIdOrPath, String cn, String provider) throws GitLabApiException {
if (cn == null || cn.trim().isEmpty()) {
throw new RuntimeException("cn cannot be null or empty");
}
if (provider == null || provider.trim().isEmpty()) {
throw new RuntimeException("LDAP provider cannot be null or empty");
}
delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links", provider, cn);
} | java | public void deleteLdapGroupLink(Object groupIdOrPath, String cn, String provider) throws GitLabApiException {
if (cn == null || cn.trim().isEmpty()) {
throw new RuntimeException("cn cannot be null or empty");
}
if (provider == null || provider.trim().isEmpty()) {
throw new RuntimeException("LDAP provider cannot be null or empty");
}
delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links", provider, cn);
} | [
"public",
"void",
"deleteLdapGroupLink",
"(",
"Object",
"groupIdOrPath",
",",
"String",
"cn",
",",
"String",
"provider",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"cn",
"==",
"null",
"||",
"cn",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
... | Deletes an LDAP group link for a specific LDAP provider.
<pre><code>GitLab Endpoint: DELETE /groups/:id/ldap_group_links/:provider/:cn</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param cn the CN of the LDAP group link to delete
@param provider the name of the LDAP provider
@throws GitLabApiException if any exception occurs | [
"Deletes",
"an",
"LDAP",
"group",
"link",
"for",
"a",
"specific",
"LDAP",
"provider",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L980-L991 |
geomajas/geomajas-project-server | common-servlet/src/main/java/org/geomajas/servlet/mvc/legend/LegendGraphicController.java | LegendGraphicController.getRuleGraphic | @RequestMapping(value = "/legendgraphic/{layerId}/{styleName}/{ruleIndex}.{format}", method = RequestMethod.GET)
public ModelAndView getRuleGraphic(@PathVariable("layerId") String layerId,
@PathVariable("styleName") String styleName, @PathVariable("ruleIndex") Integer ruleIndex,
@PathVariable("format") String format, @RequestParam(value = "width", required = false) Integer width,
@RequestParam(value = "height", required = false) Integer height,
@RequestParam(value = "scale", required = false) Double scale, HttpServletRequest request)
throws GeomajasException {
return getGraphic(layerId, styleName, ruleIndex, format, width, height, scale, false, request);
} | java | @RequestMapping(value = "/legendgraphic/{layerId}/{styleName}/{ruleIndex}.{format}", method = RequestMethod.GET)
public ModelAndView getRuleGraphic(@PathVariable("layerId") String layerId,
@PathVariable("styleName") String styleName, @PathVariable("ruleIndex") Integer ruleIndex,
@PathVariable("format") String format, @RequestParam(value = "width", required = false) Integer width,
@RequestParam(value = "height", required = false) Integer height,
@RequestParam(value = "scale", required = false) Double scale, HttpServletRequest request)
throws GeomajasException {
return getGraphic(layerId, styleName, ruleIndex, format, width, height, scale, false, request);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/legendgraphic/{layerId}/{styleName}/{ruleIndex}.{format}\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"ModelAndView",
"getRuleGraphic",
"(",
"@",
"PathVariable",
"(",
"\"layerId\"",
")",
"String",
"lay... | Gets a legend graphic with the specified metadata parameters. Assumes REST URL style:
/legendgraphic/{layerId}/{styleName}/{ruleIndex}.{format}
@param layerId
the layer id
@param styleName
the style name
@param ruleIndex
the rule index, all for a combined image
@param format
the image format ('png','jpg','gif')
@param width
the graphic's width
@param height
the graphic's height
@param scale
the scale denominator (not supported yet)
@param request
the servlet request object
@return the model and view
@throws GeomajasException
when a style or rule does not exist or is not renderable | [
"Gets",
"a",
"legend",
"graphic",
"with",
"the",
"specified",
"metadata",
"parameters",
".",
"Assumes",
"REST",
"URL",
"style",
":",
"/",
"legendgraphic",
"/",
"{",
"layerId",
"}",
"/",
"{",
"styleName",
"}",
"/",
"{",
"ruleIndex",
"}",
".",
"{",
"format... | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/common-servlet/src/main/java/org/geomajas/servlet/mvc/legend/LegendGraphicController.java#L231-L239 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getClosedListEntityRoleAsync | public Observable<EntityRole> getClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
return getClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() {
@Override
public EntityRole call(ServiceResponse<EntityRole> response) {
return response.body();
}
});
} | java | public Observable<EntityRole> getClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
return getClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() {
@Override
public EntityRole call(ServiceResponse<EntityRole> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EntityRole",
">",
"getClosedListEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"getClosedListEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
... | Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EntityRole object | [
"Get",
"one",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11577-L11584 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaStreamWaitEvent | public static int cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, int flags)
{
return checkResult(cudaStreamWaitEventNative(stream, event, flags));
} | java | public static int cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, int flags)
{
return checkResult(cudaStreamWaitEventNative(stream, event, flags));
} | [
"public",
"static",
"int",
"cudaStreamWaitEvent",
"(",
"cudaStream_t",
"stream",
",",
"cudaEvent_t",
"event",
",",
"int",
"flags",
")",
"{",
"return",
"checkResult",
"(",
"cudaStreamWaitEventNative",
"(",
"stream",
",",
"event",
",",
"flags",
")",
")",
";",
"}... | Make a compute stream wait on an event.
<pre>
cudaError_t cudaStreamWaitEvent (
cudaStream_t stream,
cudaEvent_t event,
unsigned int flags )
</pre>
<div>
<p>Make a compute stream wait on an event.
Makes all future work submitted to <tt>stream</tt> wait until <tt>event</tt> reports completion before beginning execution. This
synchronization will be performed efficiently on the device. The event
<tt>event</tt> may be from a different
context than <tt>stream</tt>, in which case this function will perform
cross-device synchronization.
</p>
<p>The stream <tt>stream</tt> will wait
only for the completion of the most recent host call to cudaEventRecord()
on <tt>event</tt>. Once this call has returned, any functions
(including cudaEventRecord() and cudaEventDestroy()) may be called on
<tt>event</tt> again, and the subsequent calls will not have any
effect on <tt>stream</tt>.
</p>
<p>If <tt>stream</tt> is NULL, any future
work submitted in any stream will wait for <tt>event</tt> to complete
before beginning execution. This effectively creates a barrier for all
future work submitted to the device on
this thread.
</p>
<p>If cudaEventRecord() has not been called
on <tt>event</tt>, this call acts as if the record has already
completed, and so is a functional no-op.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param stream Stream to wait
@param event Event to wait on
@param flags Parameters for the operation (must be 0)
@return cudaSuccess, cudaErrorInvalidResourceHandle
@see JCuda#cudaStreamCreate
@see JCuda#cudaStreamCreateWithFlags
@see JCuda#cudaStreamQuery
@see JCuda#cudaStreamSynchronize
@see JCuda#cudaStreamAddCallback
@see JCuda#cudaStreamDestroy | [
"Make",
"a",
"compute",
"stream",
"wait",
"on",
"an",
"event",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L6738-L6741 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java | FileUtils.fileCopy | public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
if (!dest.exists() || (dest.exists() && overwrite)) {
// Create parent directory structure if necessary
FileUtils.mkParentDirs(dest);
if (overwrite) {
Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
} else {
Files.copy(src.toPath(), dest.toPath());
}
}
} | java | public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
if (!dest.exists() || (dest.exists() && overwrite)) {
// Create parent directory structure if necessary
FileUtils.mkParentDirs(dest);
if (overwrite) {
Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
} else {
Files.copy(src.toPath(), dest.toPath());
}
}
} | [
"public",
"static",
"void",
"fileCopy",
"(",
"final",
"File",
"src",
",",
"final",
"File",
"dest",
",",
"final",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"dest",
".",
"exists",
"(",
")",
"||",
"(",
"dest",
".",
"exists... | Copies file src to dest using nio.
@param src source file
@param dest destination file
@param overwrite true to overwrite if it already exists
@throws IOException on io error | [
"Copies",
"file",
"src",
"to",
"dest",
"using",
"nio",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/FileUtils.java#L43-L54 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildsInner.java | BuildsInner.getLogLinkAsync | public Observable<BuildGetLogResultInner> getLogLinkAsync(String resourceGroupName, String registryName, String buildId) {
return getLogLinkWithServiceResponseAsync(resourceGroupName, registryName, buildId).map(new Func1<ServiceResponse<BuildGetLogResultInner>, BuildGetLogResultInner>() {
@Override
public BuildGetLogResultInner call(ServiceResponse<BuildGetLogResultInner> response) {
return response.body();
}
});
} | java | public Observable<BuildGetLogResultInner> getLogLinkAsync(String resourceGroupName, String registryName, String buildId) {
return getLogLinkWithServiceResponseAsync(resourceGroupName, registryName, buildId).map(new Func1<ServiceResponse<BuildGetLogResultInner>, BuildGetLogResultInner>() {
@Override
public BuildGetLogResultInner call(ServiceResponse<BuildGetLogResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BuildGetLogResultInner",
">",
"getLogLinkAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"buildId",
")",
"{",
"return",
"getLogLinkWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryNa... | Gets a link to download the build logs.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildId The build ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BuildGetLogResultInner object | [
"Gets",
"a",
"link",
"to",
"download",
"the",
"build",
"logs",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildsInner.java#L821-L828 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectBitwiseable | void expectBitwiseable(Node n, JSType type, String msg) {
if (!type.matchesNumberContext() && !type.isSubtypeOf(allBitwisableValueTypes)) {
mismatch(n, msg, type, allBitwisableValueTypes);
} else {
expectNumberStrict(n, type, msg);
}
} | java | void expectBitwiseable(Node n, JSType type, String msg) {
if (!type.matchesNumberContext() && !type.isSubtypeOf(allBitwisableValueTypes)) {
mismatch(n, msg, type, allBitwisableValueTypes);
} else {
expectNumberStrict(n, type, msg);
}
} | [
"void",
"expectBitwiseable",
"(",
"Node",
"n",
",",
"JSType",
"type",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"!",
"type",
".",
"matchesNumberContext",
"(",
")",
"&&",
"!",
"type",
".",
"isSubtypeOf",
"(",
"allBitwisableValueTypes",
")",
")",
"{",
"mi... | Expect the type to be a valid operand to a bitwise operator. This includes numbers, any type
convertible to a number, or any other primitive type (undefined|null|boolean|string). | [
"Expect",
"the",
"type",
"to",
"be",
"a",
"valid",
"operand",
"to",
"a",
"bitwise",
"operator",
".",
"This",
"includes",
"numbers",
"any",
"type",
"convertible",
"to",
"a",
"number",
"or",
"any",
"other",
"primitive",
"type",
"(",
"undefined|null|boolean|strin... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L401-L407 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java | TmdbPeople.getPersonMovieCredits | public PersonCreditList<CreditMovieBasic> getPersonMovieCredits(int personId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.MOVIE_CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
TypeReference tr = new TypeReference<PersonCreditList<CreditMovieBasic>>() {
};
return MAPPER.readValue(webpage, tr);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person movie credits", url, ex);
}
} | java | public PersonCreditList<CreditMovieBasic> getPersonMovieCredits(int personId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.MOVIE_CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
TypeReference tr = new TypeReference<PersonCreditList<CreditMovieBasic>>() {
};
return MAPPER.readValue(webpage, tr);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person movie credits", url, ex);
}
} | [
"public",
"PersonCreditList",
"<",
"CreditMovieBasic",
">",
"getPersonMovieCredits",
"(",
"int",
"personId",
",",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
... | Get the movie credits for a specific person id.
@param personId
@param language
@return
@throws MovieDbException | [
"Get",
"the",
"movie",
"credits",
"for",
"a",
"specific",
"person",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L107-L122 |
Waikato/jclasslocator | src/main/java/nz/ac/waikato/cms/locator/ClassLister.java | ClassLister.updateClasses | protected void updateClasses(HashMap<String,List<Class>> list, String superclass, List<Class> classes) {
if (!list.containsKey(superclass)) {
list.put(superclass, classes);
}
else {
for (Class cls : classes) {
if (!list.get(superclass).contains(cls))
list.get(superclass).add(cls);
}
}
} | java | protected void updateClasses(HashMap<String,List<Class>> list, String superclass, List<Class> classes) {
if (!list.containsKey(superclass)) {
list.put(superclass, classes);
}
else {
for (Class cls : classes) {
if (!list.get(superclass).contains(cls))
list.get(superclass).add(cls);
}
}
} | [
"protected",
"void",
"updateClasses",
"(",
"HashMap",
"<",
"String",
",",
"List",
"<",
"Class",
">",
">",
"list",
",",
"String",
"superclass",
",",
"List",
"<",
"Class",
">",
"classes",
")",
"{",
"if",
"(",
"!",
"list",
".",
"containsKey",
"(",
"superc... | Updates list for the superclass.
@param list the list to update
@param superclass the superclass
@param classes the names to add | [
"Updates",
"list",
"for",
"the",
"superclass",
"."
] | train | https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLister.java#L266-L276 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java | ChannelUpgradeHandler.addProtocol | public synchronized void addProtocol(String productString, HttpUpgradeListener openListener, final HttpUpgradeHandshake handshake) {
addProtocol(productString, openListener, null, handshake);
} | java | public synchronized void addProtocol(String productString, HttpUpgradeListener openListener, final HttpUpgradeHandshake handshake) {
addProtocol(productString, openListener, null, handshake);
} | [
"public",
"synchronized",
"void",
"addProtocol",
"(",
"String",
"productString",
",",
"HttpUpgradeListener",
"openListener",
",",
"final",
"HttpUpgradeHandshake",
"handshake",
")",
"{",
"addProtocol",
"(",
"productString",
",",
"openListener",
",",
"null",
",",
"hands... | Add a protocol to this handler.
@param productString the product string to match
@param openListener the open listener to call
@param handshake a handshake implementation that can be used to verify the client request and modify the response | [
"Add",
"a",
"protocol",
"to",
"this",
"handler",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java#L64-L66 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/component/rabbitmq/AmqpTemplateFactory.java | AmqpTemplateFactory.getRabbitTemplate | private RabbitTemplate getRabbitTemplate(String queueName, ConnectionFactory connectionFactory)
throws RabbitmqCommunicateException
{
// AmqpTemplateは使いまわされるため、ディープコピーをする。
RabbitTemplate template = null;
try
{
template = (RabbitTemplate) BeanUtils.cloneBean(getContextBuilder().getAmqpTemplate(
queueName));
}
catch (Exception ex)
{
throw new RabbitmqCommunicateException(ex);
}
template.setConnectionFactory(connectionFactory);
template.setExchange(queueName);
template.setQueue(queueName);
return template;
} | java | private RabbitTemplate getRabbitTemplate(String queueName, ConnectionFactory connectionFactory)
throws RabbitmqCommunicateException
{
// AmqpTemplateは使いまわされるため、ディープコピーをする。
RabbitTemplate template = null;
try
{
template = (RabbitTemplate) BeanUtils.cloneBean(getContextBuilder().getAmqpTemplate(
queueName));
}
catch (Exception ex)
{
throw new RabbitmqCommunicateException(ex);
}
template.setConnectionFactory(connectionFactory);
template.setExchange(queueName);
template.setQueue(queueName);
return template;
} | [
"private",
"RabbitTemplate",
"getRabbitTemplate",
"(",
"String",
"queueName",
",",
"ConnectionFactory",
"connectionFactory",
")",
"throws",
"RabbitmqCommunicateException",
"{",
"// AmqpTemplateは使いまわされるため、ディープコピーをする。",
"RabbitTemplate",
"template",
"=",
"null",
";",
"try",
"{"... | RabbitTemplateを取得する。
@param queueName キュー名
@param connectionFactory ConnectionFactory
@return RabbitTemplate
@throws RabbitmqCommunicateException amqpTemplateを取得できなかった場合 | [
"RabbitTemplateを取得する。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/component/rabbitmq/AmqpTemplateFactory.java#L156-L174 |
zeroturnaround/zt-exec | src/main/java/org/zeroturnaround/exec/stream/slf4j/Slf4jStream.java | Slf4jStream.of | public static Slf4jStream of(Class<?> klass, String name) {
if (name == null) {
return of(klass);
} else {
return of(LoggerFactory.getLogger(klass.getName() + "." + name));
}
} | java | public static Slf4jStream of(Class<?> klass, String name) {
if (name == null) {
return of(klass);
} else {
return of(LoggerFactory.getLogger(klass.getName() + "." + name));
}
} | [
"public",
"static",
"Slf4jStream",
"of",
"(",
"Class",
"<",
"?",
">",
"klass",
",",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"of",
"(",
"klass",
")",
";",
"}",
"else",
"{",
"return",
"of",
"(",
"LoggerFactory... | Constructs a logger from a class name and an additional name,
appended to the end. So the final logger name will be:
<blockquote><code>klass.getName() + "." + name</code></blockquote>
@param klass class which is used to get the logger's name.
@param name logger's name, appended to the class name.
@return Slf4jStream with a logger named after the given class.
@since 1.8 | [
"Constructs",
"a",
"logger",
"from",
"a",
"class",
"name",
"and",
"an",
"additional",
"name",
"appended",
"to",
"the",
"end",
".",
"So",
"the",
"final",
"logger",
"name",
"will",
"be",
":",
"<blockquote",
">",
"<code",
">",
"klass",
".",
"getName",
"()",... | train | https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/stream/slf4j/Slf4jStream.java#L64-L70 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java | SecondaryIndexManager.updaterFor | public Updater updaterFor(DecoratedKey key, ColumnFamily cf, OpOrder.Group opGroup)
{
return (indexesByColumn.isEmpty() && rowLevelIndexMap.isEmpty())
? nullUpdater
: new StandardUpdater(key, cf, opGroup);
} | java | public Updater updaterFor(DecoratedKey key, ColumnFamily cf, OpOrder.Group opGroup)
{
return (indexesByColumn.isEmpty() && rowLevelIndexMap.isEmpty())
? nullUpdater
: new StandardUpdater(key, cf, opGroup);
} | [
"public",
"Updater",
"updaterFor",
"(",
"DecoratedKey",
"key",
",",
"ColumnFamily",
"cf",
",",
"OpOrder",
".",
"Group",
"opGroup",
")",
"{",
"return",
"(",
"indexesByColumn",
".",
"isEmpty",
"(",
")",
"&&",
"rowLevelIndexMap",
".",
"isEmpty",
"(",
")",
")",
... | This helper acts as a closure around the indexManager
and updated cf data to ensure that down in
Memtable's ColumnFamily implementation, the index
can get updated. Note: only a CF backed by AtomicSortedColumns implements
this behaviour fully, other types simply ignore the index updater. | [
"This",
"helper",
"acts",
"as",
"a",
"closure",
"around",
"the",
"indexManager",
"and",
"updated",
"cf",
"data",
"to",
"ensure",
"that",
"down",
"in",
"Memtable",
"s",
"ColumnFamily",
"implementation",
"the",
"index",
"can",
"get",
"updated",
".",
"Note",
":... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java#L504-L509 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java | FixDependencyChecker.isUninstallable | public static boolean isUninstallable(Set<IFixInfo> installedFixes, IFixInfo fixToBeUninstalled) {
if (Boolean.valueOf(System.getenv(S_DISABLE)).booleanValue()) {
return true;
}
if (fixToBeUninstalled != null) {
for (IFixInfo fix : installedFixes) {
if (!(fixToBeUninstalled.getId().equals(fix.getId())) && !confirmNoFileConflicts(fixToBeUninstalled.getUpdates().getFiles(), fix.getUpdates().getFiles())) {
if (!isSupersededBy(fix.getResolves().getProblems(), fixToBeUninstalled.getResolves().getProblems())) {
return false;
}
}
}
return true;
}
return false;
} | java | public static boolean isUninstallable(Set<IFixInfo> installedFixes, IFixInfo fixToBeUninstalled) {
if (Boolean.valueOf(System.getenv(S_DISABLE)).booleanValue()) {
return true;
}
if (fixToBeUninstalled != null) {
for (IFixInfo fix : installedFixes) {
if (!(fixToBeUninstalled.getId().equals(fix.getId())) && !confirmNoFileConflicts(fixToBeUninstalled.getUpdates().getFiles(), fix.getUpdates().getFiles())) {
if (!isSupersededBy(fix.getResolves().getProblems(), fixToBeUninstalled.getResolves().getProblems())) {
return false;
}
}
}
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isUninstallable",
"(",
"Set",
"<",
"IFixInfo",
">",
"installedFixes",
",",
"IFixInfo",
"fixToBeUninstalled",
")",
"{",
"if",
"(",
"Boolean",
".",
"valueOf",
"(",
"System",
".",
"getenv",
"(",
"S_DISABLE",
")",
")",
".",
"boole... | Return true if fixToBeUninstalled can be uninstalled. fixToBeUninstalled can only be uninstalled if there are no file conflicts with other fixes in the installedFixes Set
that supersedes fixToBeUninstalled
@param installedFixes The set of fixes that is already installed, the set does not include the fixToBeUninstalled
@param fixToBeUninstalled The fix to be uninstalled
@return Return true if the fixToBeUninstalled can be uninstalled. False otherwise. | [
"Return",
"true",
"if",
"fixToBeUninstalled",
"can",
"be",
"uninstalled",
".",
"fixToBeUninstalled",
"can",
"only",
"be",
"uninstalled",
"if",
"there",
"are",
"no",
"file",
"conflicts",
"with",
"other",
"fixes",
"in",
"the",
"installedFixes",
"Set",
"that",
"sup... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java#L46-L63 |
stratosphere/stratosphere | stratosphere-java/src/main/java/eu/stratosphere/api/java/ExecutionEnvironment.java | ExecutionEnvironment.createInput | public <X> DataSource<X> createInput(InputFormat<X, ?> inputFormat) {
if (inputFormat == null) {
throw new IllegalArgumentException("InputFormat must not be null.");
}
try {
return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat));
}
catch (Exception e) {
throw new InvalidProgramException("The type returned by the input format could not be automatically determined. " +
"Please specify the TypeInformation of the produced type explicitly.");
}
} | java | public <X> DataSource<X> createInput(InputFormat<X, ?> inputFormat) {
if (inputFormat == null) {
throw new IllegalArgumentException("InputFormat must not be null.");
}
try {
return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat));
}
catch (Exception e) {
throw new InvalidProgramException("The type returned by the input format could not be automatically determined. " +
"Please specify the TypeInformation of the produced type explicitly.");
}
} | [
"public",
"<",
"X",
">",
"DataSource",
"<",
"X",
">",
"createInput",
"(",
"InputFormat",
"<",
"X",
",",
"?",
">",
"inputFormat",
")",
"{",
"if",
"(",
"inputFormat",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"InputFormat mus... | Generic method to create an input DataSet with in {@link InputFormat}. The DataSet will not be
immediately created - instead, this method returns a DataSet that will be lazily created from
the input format once the program is executed.
<p>
Since all data sets need specific information about their types, this method needs to determine
the type of the data produced by the input format. It will attempt to determine the data type
by reflection, unless the the input format implements the {@link ResultTypeQueryable} interface.
In the latter case, this method will invoke the {@link ResultTypeQueryable#getProducedType()}
method to determine data type produced by the input format.
@param inputFormat The input format used to create the data set.
@return A DataSet that represents the data created by the input format.
@see #createInput(InputFormat, TypeInformation) | [
"Generic",
"method",
"to",
"create",
"an",
"input",
"DataSet",
"with",
"in",
"{",
"@link",
"InputFormat",
"}",
".",
"The",
"DataSet",
"will",
"not",
"be",
"immediately",
"created",
"-",
"instead",
"this",
"method",
"returns",
"a",
"DataSet",
"that",
"will",
... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-java/src/main/java/eu/stratosphere/api/java/ExecutionEnvironment.java#L271-L283 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/model/NumericRefinement.java | NumericRefinement.checkOperatorIsValid | public static void checkOperatorIsValid(int operatorCode) {
switch (operatorCode) {
case OPERATOR_LT:
case OPERATOR_LE:
case OPERATOR_EQ:
case OPERATOR_NE:
case OPERATOR_GE:
case OPERATOR_GT:
case OPERATOR_UNKNOWN:
return;
default:
throw new IllegalStateException(String.format(Locale.US, ERROR_INVALID_CODE, operatorCode));
}
} | java | public static void checkOperatorIsValid(int operatorCode) {
switch (operatorCode) {
case OPERATOR_LT:
case OPERATOR_LE:
case OPERATOR_EQ:
case OPERATOR_NE:
case OPERATOR_GE:
case OPERATOR_GT:
case OPERATOR_UNKNOWN:
return;
default:
throw new IllegalStateException(String.format(Locale.US, ERROR_INVALID_CODE, operatorCode));
}
} | [
"public",
"static",
"void",
"checkOperatorIsValid",
"(",
"int",
"operatorCode",
")",
"{",
"switch",
"(",
"operatorCode",
")",
"{",
"case",
"OPERATOR_LT",
":",
"case",
"OPERATOR_LE",
":",
"case",
"OPERATOR_EQ",
":",
"case",
"OPERATOR_NE",
":",
"case",
"OPERATOR_G... | Checks if the given operator code is a valid one.
@param operatorCode an operator code to evaluate
@throws IllegalStateException if operatorCode is not a known operator code. | [
"Checks",
"if",
"the",
"given",
"operator",
"code",
"is",
"a",
"valid",
"one",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/model/NumericRefinement.java#L81-L94 |
geomajas/geomajas-project-graphics | graphics/src/main/java/org/geomajas/graphics/client/util/CopyUtil.java | CopyUtil.copyFillableProperties | public static void copyFillableProperties(HasFill fillableOriginal, HasFill fillableCopy) {
fillableCopy.setFillOpacity(fillableOriginal.getFillOpacity());
fillableCopy.setFillColor(fillableOriginal.getFillColor());
} | java | public static void copyFillableProperties(HasFill fillableOriginal, HasFill fillableCopy) {
fillableCopy.setFillOpacity(fillableOriginal.getFillOpacity());
fillableCopy.setFillColor(fillableOriginal.getFillColor());
} | [
"public",
"static",
"void",
"copyFillableProperties",
"(",
"HasFill",
"fillableOriginal",
",",
"HasFill",
"fillableCopy",
")",
"{",
"fillableCopy",
".",
"setFillOpacity",
"(",
"fillableOriginal",
".",
"getFillOpacity",
"(",
")",
")",
";",
"fillableCopy",
".",
"setFi... | Copy all {@link HasFill} properties from original to copy.
@param fillableOriginal
@param fillableCopy | [
"Copy",
"all",
"{",
"@link",
"HasFill",
"}",
"properties",
"from",
"original",
"to",
"copy",
"."
] | train | https://github.com/geomajas/geomajas-project-graphics/blob/1104196640e0ba455b8a619e774352a8e1e319ba/graphics/src/main/java/org/geomajas/graphics/client/util/CopyUtil.java#L44-L47 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java | DefaultShardManagerBuilder.setShards | public DefaultShardManagerBuilder setShards(final int minShardId, final int maxShardId)
{
Checks.notNegative(minShardId, "minShardId");
Checks.check(maxShardId < this.shardsTotal, "maxShardId must be lower than shardsTotal");
Checks.check(minShardId <= maxShardId, "minShardId must be lower than or equal to maxShardId");
List<Integer> shards = new ArrayList<>(maxShardId - minShardId + 1);
for (int i = minShardId; i <= maxShardId; i++)
shards.add(i);
this.shards = shards;
return this;
} | java | public DefaultShardManagerBuilder setShards(final int minShardId, final int maxShardId)
{
Checks.notNegative(minShardId, "minShardId");
Checks.check(maxShardId < this.shardsTotal, "maxShardId must be lower than shardsTotal");
Checks.check(minShardId <= maxShardId, "minShardId must be lower than or equal to maxShardId");
List<Integer> shards = new ArrayList<>(maxShardId - minShardId + 1);
for (int i = minShardId; i <= maxShardId; i++)
shards.add(i);
this.shards = shards;
return this;
} | [
"public",
"DefaultShardManagerBuilder",
"setShards",
"(",
"final",
"int",
"minShardId",
",",
"final",
"int",
"maxShardId",
")",
"{",
"Checks",
".",
"notNegative",
"(",
"minShardId",
",",
"\"minShardId\"",
")",
";",
"Checks",
".",
"check",
"(",
"maxShardId",
"<",... | Sets the range of shards the {@link DefaultShardManager DefaultShardManager} should contain.
This is useful if you want to split your shards between multiple JVMs or servers.
<p><b>This does not have any effect if the total shard count is set to {@code -1} (get recommended shards from discord).</b>
@param minShardId
The lowest shard id the DefaultShardManager should contain
@param maxShardId
The highest shard id the DefaultShardManager should contain
@throws IllegalArgumentException
If either minShardId is negative, maxShardId is lower than shardsTotal or
minShardId is lower than or equal to maxShardId
@return The DefaultShardManagerBuilder instance. Useful for chaining. | [
"Sets",
"the",
"range",
"of",
"shards",
"the",
"{",
"@link",
"DefaultShardManager",
"DefaultShardManager",
"}",
"should",
"contain",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"split",
"your",
"shards",
"between",
"multiple",
"JVMs",
"or",
"server... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java#L939-L952 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/TagsApi.java | TagsApi.getTagSuggestions | public TagsEnvelope getTagSuggestions(String entityType, String tags, String name, Integer count) throws ApiException {
ApiResponse<TagsEnvelope> resp = getTagSuggestionsWithHttpInfo(entityType, tags, name, count);
return resp.getData();
} | java | public TagsEnvelope getTagSuggestions(String entityType, String tags, String name, Integer count) throws ApiException {
ApiResponse<TagsEnvelope> resp = getTagSuggestionsWithHttpInfo(entityType, tags, name, count);
return resp.getData();
} | [
"public",
"TagsEnvelope",
"getTagSuggestions",
"(",
"String",
"entityType",
",",
"String",
"tags",
",",
"String",
"name",
",",
"Integer",
"count",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"TagsEnvelope",
">",
"resp",
"=",
"getTagSuggestionsWithHttpInf... | Get tag suggestions
Get tag suggestions for applications, device types that have been most used with a group of tags.
@param entityType Entity type name. (optional)
@param tags Comma separated list of tags. (optional)
@param name Name of tags used for type ahead. (optional)
@param count Number of results to return. Max 10. (optional)
@return TagsEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"tag",
"suggestions",
"Get",
"tag",
"suggestions",
"for",
"applications",
"device",
"types",
"that",
"have",
"been",
"most",
"used",
"with",
"a",
"group",
"of",
"tags",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/TagsApi.java#L239-L242 |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/Regex.java | Regex.getMatch | public String getMatch(PushbackReader in, int size) throws IOException, SyntaxErrorException
{
InputReader reader = Input.getInstance(in, size);
String s = getMatch(reader);
reader.release();
return s;
} | java | public String getMatch(PushbackReader in, int size) throws IOException, SyntaxErrorException
{
InputReader reader = Input.getInstance(in, size);
String s = getMatch(reader);
reader.release();
return s;
} | [
"public",
"String",
"getMatch",
"(",
"PushbackReader",
"in",
",",
"int",
"size",
")",
"throws",
"IOException",
",",
"SyntaxErrorException",
"{",
"InputReader",
"reader",
"=",
"Input",
".",
"getInstance",
"(",
"in",
",",
"size",
")",
";",
"String",
"s",
"=",
... | Matches the whole input and returns the matched string
@param in
@param size
@return
@throws IOException
@throws SyntaxErrorException | [
"Matches",
"the",
"whole",
"input",
"and",
"returns",
"the",
"matched",
"string"
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/Regex.java#L391-L397 |
jfinal/jfinal | src/main/java/com/jfinal/core/Controller.java | Controller.getParaToInt | public Integer getParaToInt(String name, Integer defaultValue) {
return toInt(request.getParameter(name), defaultValue);
} | java | public Integer getParaToInt(String name, Integer defaultValue) {
return toInt(request.getParameter(name), defaultValue);
} | [
"public",
"Integer",
"getParaToInt",
"(",
"String",
"name",
",",
"Integer",
"defaultValue",
")",
"{",
"return",
"toInt",
"(",
"request",
".",
"getParameter",
"(",
"name",
")",
",",
"defaultValue",
")",
";",
"}"
] | Returns the value of a request parameter and convert to Integer with a default value if it is null.
@param name a String specifying the name of the parameter
@return a Integer representing the single value of the parameter | [
"Returns",
"the",
"value",
"of",
"a",
"request",
"parameter",
"and",
"convert",
"to",
"Integer",
"with",
"a",
"default",
"value",
"if",
"it",
"is",
"null",
"."
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/core/Controller.java#L319-L321 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java | ClassicLayoutManager.layoutGroupFooterLabels | protected void layoutGroupFooterLabels(DJGroup djgroup, JRDesignGroup jgroup, int x, int y, int width, int height) {
//List footerVariables = djgroup.getFooterVariables();
DJGroupLabel label = djgroup.getFooterLabel();
//if (label == null || footerVariables.isEmpty())
//return;
//PropertyColumn col = djgroup.getColumnToGroupBy();
JRDesignBand band = LayoutUtils.getBandFromSection((JRDesignSection) jgroup.getGroupFooterSection());
// log.debug("Adding footer group label for group " + djgroup);
/*DJGroupVariable lmvar = findLeftMostColumn(footerVariables);
AbstractColumn lmColumn = lmvar.getColumnToApplyOperation();
int width = lmColumn.getPosX().intValue() - col.getPosX().intValue();
int yOffset = findYOffsetForGroupLabel(band);*/
JRDesignExpression labelExp;
if (label.isJasperExpression()) //a text with things like "$F{myField}"
labelExp = ExpressionUtils.createStringExpression(label.getText());
else if (label.getLabelExpression() != null){
labelExp = ExpressionUtils.createExpression(jgroup.getName() + "_labelExpression", label.getLabelExpression(), true);
} else //a simple text
//labelExp = ExpressionUtils.createStringExpression("\""+ Utils.escapeTextForExpression(label.getText())+ "\"");
labelExp = ExpressionUtils.createStringExpression("\""+ label.getText() + "\"");
JRDesignTextField labelTf = new JRDesignTextField();
labelTf.setExpression(labelExp);
labelTf.setWidth(width);
labelTf.setHeight(height);
labelTf.setX(x);
labelTf.setY(y);
//int yOffsetGlabel = labelTf.getHeight();
labelTf.setPositionType( PositionTypeEnum.FIX_RELATIVE_TO_TOP );
applyStyleToElement(label.getStyle(), labelTf);
band.addElement(labelTf);
} | java | protected void layoutGroupFooterLabels(DJGroup djgroup, JRDesignGroup jgroup, int x, int y, int width, int height) {
//List footerVariables = djgroup.getFooterVariables();
DJGroupLabel label = djgroup.getFooterLabel();
//if (label == null || footerVariables.isEmpty())
//return;
//PropertyColumn col = djgroup.getColumnToGroupBy();
JRDesignBand band = LayoutUtils.getBandFromSection((JRDesignSection) jgroup.getGroupFooterSection());
// log.debug("Adding footer group label for group " + djgroup);
/*DJGroupVariable lmvar = findLeftMostColumn(footerVariables);
AbstractColumn lmColumn = lmvar.getColumnToApplyOperation();
int width = lmColumn.getPosX().intValue() - col.getPosX().intValue();
int yOffset = findYOffsetForGroupLabel(band);*/
JRDesignExpression labelExp;
if (label.isJasperExpression()) //a text with things like "$F{myField}"
labelExp = ExpressionUtils.createStringExpression(label.getText());
else if (label.getLabelExpression() != null){
labelExp = ExpressionUtils.createExpression(jgroup.getName() + "_labelExpression", label.getLabelExpression(), true);
} else //a simple text
//labelExp = ExpressionUtils.createStringExpression("\""+ Utils.escapeTextForExpression(label.getText())+ "\"");
labelExp = ExpressionUtils.createStringExpression("\""+ label.getText() + "\"");
JRDesignTextField labelTf = new JRDesignTextField();
labelTf.setExpression(labelExp);
labelTf.setWidth(width);
labelTf.setHeight(height);
labelTf.setX(x);
labelTf.setY(y);
//int yOffsetGlabel = labelTf.getHeight();
labelTf.setPositionType( PositionTypeEnum.FIX_RELATIVE_TO_TOP );
applyStyleToElement(label.getStyle(), labelTf);
band.addElement(labelTf);
} | [
"protected",
"void",
"layoutGroupFooterLabels",
"(",
"DJGroup",
"djgroup",
",",
"JRDesignGroup",
"jgroup",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"//List footerVariables = djgroup.getFooterVariables();",
"DJGroupLabel",
... | Creates needed textfields for general label in footer groups.
@param djgroup
@param jgroup | [
"Creates",
"needed",
"textfields",
"for",
"general",
"label",
"in",
"footer",
"groups",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L554-L590 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/storage/EdgeAccess.java | EdgeAccess.internalEdgeDisconnect | final long internalEdgeDisconnect(int edgeToRemove, long edgeToUpdatePointer, int baseNode) {
long edgeToRemovePointer = toPointer(edgeToRemove);
// an edge is shared across the two nodes even if the edge is not in both directions
// so we need to know two edge-pointers pointing to the edge before edgeToRemovePointer
int nextEdgeId = getNodeA(edgeToRemovePointer) == baseNode ? getLinkA(edgeToRemovePointer) : getLinkB(edgeToRemovePointer);
if (edgeToUpdatePointer < 0) {
setEdgeRef(baseNode, nextEdgeId);
} else {
// adjNode is different for the edge we want to update with the new link
long link = getNodeA(edgeToUpdatePointer) == baseNode ? edgeToUpdatePointer + E_LINKA : edgeToUpdatePointer + E_LINKB;
edges.setInt(link, nextEdgeId);
}
return edgeToRemovePointer;
} | java | final long internalEdgeDisconnect(int edgeToRemove, long edgeToUpdatePointer, int baseNode) {
long edgeToRemovePointer = toPointer(edgeToRemove);
// an edge is shared across the two nodes even if the edge is not in both directions
// so we need to know two edge-pointers pointing to the edge before edgeToRemovePointer
int nextEdgeId = getNodeA(edgeToRemovePointer) == baseNode ? getLinkA(edgeToRemovePointer) : getLinkB(edgeToRemovePointer);
if (edgeToUpdatePointer < 0) {
setEdgeRef(baseNode, nextEdgeId);
} else {
// adjNode is different for the edge we want to update with the new link
long link = getNodeA(edgeToUpdatePointer) == baseNode ? edgeToUpdatePointer + E_LINKA : edgeToUpdatePointer + E_LINKB;
edges.setInt(link, nextEdgeId);
}
return edgeToRemovePointer;
} | [
"final",
"long",
"internalEdgeDisconnect",
"(",
"int",
"edgeToRemove",
",",
"long",
"edgeToUpdatePointer",
",",
"int",
"baseNode",
")",
"{",
"long",
"edgeToRemovePointer",
"=",
"toPointer",
"(",
"edgeToRemove",
")",
";",
"// an edge is shared across the two nodes even if ... | This method disconnects the specified edge from the list of edges of the specified node. It
does not release the freed space to be reused.
@param edgeToUpdatePointer if it is negative then the nextEdgeId will be saved to refToEdges of nodes | [
"This",
"method",
"disconnects",
"the",
"specified",
"edge",
"from",
"the",
"list",
"of",
"edges",
"of",
"the",
"specified",
"node",
".",
"It",
"does",
"not",
"release",
"the",
"freed",
"space",
"to",
"be",
"reused",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/EdgeAccess.java#L172-L185 |
LearnLib/learnlib | algorithms/active/ttt-vpda/src/main/java/de/learnlib/algorithms/ttt/vpda/TTTLearnerVPDA.java | TTTLearnerVPDA.markAndPropagate | private static <I> void markAndPropagate(DTNode<I> node, Boolean label) {
DTNode<I> curr = node;
while (curr != null && curr.getSplitData() != null) {
if (!curr.getSplitData().mark(label)) {
return;
}
curr = curr.getParent();
}
} | java | private static <I> void markAndPropagate(DTNode<I> node, Boolean label) {
DTNode<I> curr = node;
while (curr != null && curr.getSplitData() != null) {
if (!curr.getSplitData().mark(label)) {
return;
}
curr = curr.getParent();
}
} | [
"private",
"static",
"<",
"I",
">",
"void",
"markAndPropagate",
"(",
"DTNode",
"<",
"I",
">",
"node",
",",
"Boolean",
"label",
")",
"{",
"DTNode",
"<",
"I",
">",
"curr",
"=",
"node",
";",
"while",
"(",
"curr",
"!=",
"null",
"&&",
"curr",
".",
"getS... | Marks a node, and propagates the label up to all nodes on the path from the block root to this node.
@param node
the node to mark
@param label
the label to mark the node with | [
"Marks",
"a",
"node",
"and",
"propagates",
"the",
"label",
"up",
"to",
"all",
"nodes",
"on",
"the",
"path",
"from",
"the",
"block",
"root",
"to",
"this",
"node",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt-vpda/src/main/java/de/learnlib/algorithms/ttt/vpda/TTTLearnerVPDA.java#L576-L585 |
xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressString | public static String uncompressString(byte[] input, int offset, int length, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = new byte[uncompressedLength(input, offset, length)];
uncompress(input, offset, length, uncompressed, 0);
return new String(uncompressed, encoding);
} | java | public static String uncompressString(byte[] input, int offset, int length, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = new byte[uncompressedLength(input, offset, length)];
uncompress(input, offset, length, uncompressed, 0);
return new String(uncompressed, encoding);
} | [
"public",
"static",
"String",
"uncompressString",
"(",
"byte",
"[",
"]",
"input",
",",
"int",
"offset",
",",
"int",
"length",
",",
"String",
"encoding",
")",
"throws",
"IOException",
",",
"UnsupportedEncodingException",
"{",
"byte",
"[",
"]",
"uncompressed",
"... | Uncompress the input[offset, offset+length) as a String of the given
encoding
@param input
@param offset
@param length
@param encoding
@return the uncompressed data
@throws IOException | [
"Uncompress",
"the",
"input",
"[",
"offset",
"offset",
"+",
"length",
")",
"as",
"a",
"String",
"of",
"the",
"given",
"encoding"
] | train | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L845-L852 |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/alias/AliasElasticsearchUpdater.java | AliasElasticsearchUpdater.createAlias | public static void createAlias(RestClient client, String alias, String index) throws Exception {
logger.trace("createAlias({},{})", alias, index);
assert client != null;
assert alias != null;
assert index != null;
Request request = new Request("POST", "/_aliases/");
request.setJsonEntity("{\"actions\":[{\"add\":{\"index\":\"" + index +"\",\"alias\":\"" + alias +"\"}}]}");
Response response = client.performRequest(request);
if (response.getStatusLine().getStatusCode() != 200) {
logger.warn("Could not create alias [{}] on index [{}]", alias, index);
throw new Exception("Could not create alias ["+alias+"] on index ["+index+"].");
}
logger.trace("/createAlias({},{})", alias, index);
} | java | public static void createAlias(RestClient client, String alias, String index) throws Exception {
logger.trace("createAlias({},{})", alias, index);
assert client != null;
assert alias != null;
assert index != null;
Request request = new Request("POST", "/_aliases/");
request.setJsonEntity("{\"actions\":[{\"add\":{\"index\":\"" + index +"\",\"alias\":\"" + alias +"\"}}]}");
Response response = client.performRequest(request);
if (response.getStatusLine().getStatusCode() != 200) {
logger.warn("Could not create alias [{}] on index [{}]", alias, index);
throw new Exception("Could not create alias ["+alias+"] on index ["+index+"].");
}
logger.trace("/createAlias({},{})", alias, index);
} | [
"public",
"static",
"void",
"createAlias",
"(",
"RestClient",
"client",
",",
"String",
"alias",
",",
"String",
"index",
")",
"throws",
"Exception",
"{",
"logger",
".",
"trace",
"(",
"\"createAlias({},{})\"",
",",
"alias",
",",
"index",
")",
";",
"assert",
"c... | Create an alias if needed
@param client Client to use
@param alias Alias name
@param index Index name
@throws Exception When alias can not be set | [
"Create",
"an",
"alias",
"if",
"needed"
] | train | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/alias/AliasElasticsearchUpdater.java#L56-L72 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java | DoubleIntIndex.lessThan | private boolean lessThan(int i, int j) {
if (sortOnValues) {
if (values[i] < values[j]) {
return true;
}
} else {
if (keys[i] < keys[j]) {
return true;
}
}
return false;
} | java | private boolean lessThan(int i, int j) {
if (sortOnValues) {
if (values[i] < values[j]) {
return true;
}
} else {
if (keys[i] < keys[j]) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"lessThan",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"sortOnValues",
")",
"{",
"if",
"(",
"values",
"[",
"i",
"]",
"<",
"values",
"[",
"j",
"]",
")",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"if",
... | Check if row indexed i is less than row indexed j
@param i the first index
@param j the second index
@return true or false | [
"Check",
"if",
"row",
"indexed",
"i",
"is",
"less",
"than",
"row",
"indexed",
"j"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java#L671-L684 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java | SphereUtil.latlngMinDistDeg | @Reference(authors = "Erich Schubert, Arthur Zimek, Hans-Peter Kriegel", //
title = "Geodetic Distance Queries on R-Trees for Indexing Geographic Data", //
booktitle = "Int. Symp. Advances in Spatial and Temporal Databases (SSTD'2013)", //
url = "https://doi.org/10.1007/978-3-642-40235-7_9", //
bibkey = "DBLP:conf/ssd/SchubertZK13")
public static double latlngMinDistDeg(double plat, double plng, double rminlat, double rminlng, double rmaxlat, double rmaxlng) {
return latlngMinDistRad(deg2rad(plat), deg2rad(plng), deg2rad(rminlat), deg2rad(rminlng), deg2rad(rmaxlat), deg2rad(rmaxlng));
} | java | @Reference(authors = "Erich Schubert, Arthur Zimek, Hans-Peter Kriegel", //
title = "Geodetic Distance Queries on R-Trees for Indexing Geographic Data", //
booktitle = "Int. Symp. Advances in Spatial and Temporal Databases (SSTD'2013)", //
url = "https://doi.org/10.1007/978-3-642-40235-7_9", //
bibkey = "DBLP:conf/ssd/SchubertZK13")
public static double latlngMinDistDeg(double plat, double plng, double rminlat, double rminlng, double rmaxlat, double rmaxlng) {
return latlngMinDistRad(deg2rad(plat), deg2rad(plng), deg2rad(rminlat), deg2rad(rminlng), deg2rad(rmaxlat), deg2rad(rmaxlng));
} | [
"@",
"Reference",
"(",
"authors",
"=",
"\"Erich Schubert, Arthur Zimek, Hans-Peter Kriegel\"",
",",
"//",
"title",
"=",
"\"Geodetic Distance Queries on R-Trees for Indexing Geographic Data\"",
",",
"//",
"booktitle",
"=",
"\"Int. Symp. Advances in Spatial and Temporal Databases (SSTD'2... | Point to rectangle minimum distance.
<p>
Complexity:
<ul>
<li>Trivial cases (on longitude slice): no trigonometric functions.</li>
<li>Cross-track case: 10+2 trig</li>
<li>Corner case: 10+3 trig, 1 sqrt</li>
</ul>
<p>
Reference:
<p>
Erich Schubert, Arthur Zimek, Hans-Peter Kriegel<br>
Geodetic Distance Queries on R-Trees for Indexing Geographic Data<br>
Int. Symp. Advances in Spatial and Temporal Databases (SSTD'2013)
@param plat Latitude of query point.
@param plng Longitude of query point.
@param rminlat Min latitude of rectangle.
@param rminlng Min longitude of rectangle.
@param rmaxlat Max latitude of rectangle.
@param rmaxlng Max longitude of rectangle.
@return Distance in radians. | [
"Point",
"to",
"rectangle",
"minimum",
"distance",
".",
"<p",
">",
"Complexity",
":",
"<ul",
">",
"<li",
">",
"Trivial",
"cases",
"(",
"on",
"longitude",
"slice",
")",
":",
"no",
"trigonometric",
"functions",
".",
"<",
"/",
"li",
">",
"<li",
">",
"Cros... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L648-L655 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/WebSocket.java | WebSocket.sendClose | public WebSocket sendClose(int closeCode, String reason)
{
return sendFrame(WebSocketFrame.createCloseFrame(closeCode, reason));
} | java | public WebSocket sendClose(int closeCode, String reason)
{
return sendFrame(WebSocketFrame.createCloseFrame(closeCode, reason));
} | [
"public",
"WebSocket",
"sendClose",
"(",
"int",
"closeCode",
",",
"String",
"reason",
")",
"{",
"return",
"sendFrame",
"(",
"WebSocketFrame",
".",
"createCloseFrame",
"(",
"closeCode",
",",
"reason",
")",
")",
";",
"}"
] | Send a close frame to the server.
<p>
This method is an alias of {@link #sendFrame(WebSocketFrame)
sendFrame}{@code (WebSocketFrame.}{@link
WebSocketFrame#createCloseFrame(int, String)
createCloseFrame}{@code (closeCode, reason))}.
</p>
@param closeCode
The close code.
@param reason
The close reason.
Note that a control frame's payload length must be 125 bytes or less
(RFC 6455, <a href="https://tools.ietf.org/html/rfc6455#section-5.5"
>5.5. Control Frames</a>).
@return
{@code this} object.
@see WebSocketCloseCode | [
"Send",
"a",
"close",
"frame",
"to",
"the",
"server",
"."
] | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/WebSocket.java#L3094-L3097 |
leadware/jpersistence-tools | jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java | JPAGenericDAORulesBasedImpl.generateEntityValues | protected void generateEntityValues(Object entity, DAOMode mode, DAOValidatorEvaluationTime validationTime) {
// Obtention de la classe de l'entite
Class<?> entityClass = entity.getClass();
// Obtention de la liste des champs de l'entite
List<Field> fields = DAOValidatorHelper.getAllFields(entityClass, true);
// Si la liste des champs est vide
if(fields == null || fields.isEmpty()) return;
// Parcours de la liste des champs
for (Field field : fields) {
// Chargement des annotaions de generation
List<Annotation> daoAnnotations = DAOValidatorHelper.loadDAOGeneratorAnnotations(field);
// Si la liste est vide
if(daoAnnotations == null || daoAnnotations.size() == 0) continue;
// Parcours de la liste des annotations
for (Annotation daoAnnotation : daoAnnotations) {
// Obtention de la classe de gestion du generateur
Class<?> generatorClass = DAOValidatorHelper.getGenerationLogicClass(daoAnnotation);
// Le generateur
IDAOGeneratorManager<Annotation> generator = null;
try {
// On instancie le generateur
generator = (IDAOGeneratorManager<Annotation>) generatorClass.newInstance();
// Initialisation du generateur
generator.initialize(daoAnnotation, getGeneratorEntityManager(), getEntityManager(), mode, validationTime);
} catch (Throwable e) {
// On relance l'exception
throw new JPersistenceToolsException("GeneratorInstanciationException.message", e);
}
// Validation des contraintes d'integrites
generator.processGeneration(entity, field);
}
}
} | java | protected void generateEntityValues(Object entity, DAOMode mode, DAOValidatorEvaluationTime validationTime) {
// Obtention de la classe de l'entite
Class<?> entityClass = entity.getClass();
// Obtention de la liste des champs de l'entite
List<Field> fields = DAOValidatorHelper.getAllFields(entityClass, true);
// Si la liste des champs est vide
if(fields == null || fields.isEmpty()) return;
// Parcours de la liste des champs
for (Field field : fields) {
// Chargement des annotaions de generation
List<Annotation> daoAnnotations = DAOValidatorHelper.loadDAOGeneratorAnnotations(field);
// Si la liste est vide
if(daoAnnotations == null || daoAnnotations.size() == 0) continue;
// Parcours de la liste des annotations
for (Annotation daoAnnotation : daoAnnotations) {
// Obtention de la classe de gestion du generateur
Class<?> generatorClass = DAOValidatorHelper.getGenerationLogicClass(daoAnnotation);
// Le generateur
IDAOGeneratorManager<Annotation> generator = null;
try {
// On instancie le generateur
generator = (IDAOGeneratorManager<Annotation>) generatorClass.newInstance();
// Initialisation du generateur
generator.initialize(daoAnnotation, getGeneratorEntityManager(), getEntityManager(), mode, validationTime);
} catch (Throwable e) {
// On relance l'exception
throw new JPersistenceToolsException("GeneratorInstanciationException.message", e);
}
// Validation des contraintes d'integrites
generator.processGeneration(entity, field);
}
}
} | [
"protected",
"void",
"generateEntityValues",
"(",
"Object",
"entity",
",",
"DAOMode",
"mode",
",",
"DAOValidatorEvaluationTime",
"validationTime",
")",
"{",
"// Obtention de la classe de l'entite\r",
"Class",
"<",
"?",
">",
"entityClass",
"=",
"entity",
".",
"getClass",... | Méthode de generation des valeurs automatiques
@param entity Entité cible de la generation
@param mode Mode DAO
@param validationTime Moment d'évaluation | [
"Méthode",
"de",
"generation",
"des",
"valeurs",
"automatiques"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java#L891-L938 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/PixelConvertingSpliterator.java | PixelConvertingSpliterator.getDoubletArrayElementSpliterator | public static PixelConvertingSpliterator<PixelBase, double[]> getDoubletArrayElementSpliterator(
Spliterator<? extends PixelBase> pixelSpliterator){
PixelConvertingSpliterator<PixelBase, double[]> arraySpliterator = new PixelConvertingSpliterator<>(
pixelSpliterator, getDoubleArrayConverter());
return arraySpliterator;
} | java | public static PixelConvertingSpliterator<PixelBase, double[]> getDoubletArrayElementSpliterator(
Spliterator<? extends PixelBase> pixelSpliterator){
PixelConvertingSpliterator<PixelBase, double[]> arraySpliterator = new PixelConvertingSpliterator<>(
pixelSpliterator, getDoubleArrayConverter());
return arraySpliterator;
} | [
"public",
"static",
"PixelConvertingSpliterator",
"<",
"PixelBase",
",",
"double",
"[",
"]",
">",
"getDoubletArrayElementSpliterator",
"(",
"Spliterator",
"<",
"?",
"extends",
"PixelBase",
">",
"pixelSpliterator",
")",
"{",
"PixelConvertingSpliterator",
"<",
"PixelBase"... | Example implementation of a {@code PixelConvertingSpliterator<double[]>}.
<p>
The elements of the returned spliterator will be {@code double[]} of length 3
with normalized red, green and blue channels on index 0, 1 and 2.
<p>
<b>Code:</b>
<pre>
{@code
Supplier<double[]> arrayAllocator = () -> {
return new double[3];
};
BiConsumer<Pixel, double[]> convertToArray = (px, array) -> {
array[0]=px.r_normalized();
array[1]=px.g_normalized();
array[2]=px.b_normalized();
};
BiConsumer<double[], Pixel> convertToPixel = (array, px) -> {
px.setRGB_fromNormalized_preserveAlpha(
// clamp values between zero and one
Math.min(1, Math.max(0, array[0])),
Math.min(1, Math.max(0, array[1])),
Math.min(1, Math.max(0, array[2])));
};
PixelConvertingSpliterator<double[]> arraySpliterator = new PixelConvertingSpliterator<>(
pixelSpliterator,
arrayAllocator,
convertToArray,
convertToPixel);
}
</pre>
@param pixelSpliterator the {@code Spliterator<Pixel>} to which the
returned spliterator delegates to.
@return a spliterator with float[] elements consisting of normalized RGB channels.
@since 1.4 | [
"Example",
"implementation",
"of",
"a",
"{",
"@code",
"PixelConvertingSpliterator<double",
"[]",
">",
"}",
".",
"<p",
">",
"The",
"elements",
"of",
"the",
"returned",
"spliterator",
"will",
"be",
"{",
"@code",
"double",
"[]",
"}",
"of",
"length",
"3",
"with"... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/PixelConvertingSpliterator.java#L200-L205 |
alkacon/opencms-core | src/org/opencms/db/CmsSelectQuery.java | CmsSelectQuery.addCondition | public void addCondition(String fragment, Object... params) {
m_conditions.add(new CmsSimpleQueryFragment(fragment, params));
} | java | public void addCondition(String fragment, Object... params) {
m_conditions.add(new CmsSimpleQueryFragment(fragment, params));
} | [
"public",
"void",
"addCondition",
"(",
"String",
"fragment",
",",
"Object",
"...",
"params",
")",
"{",
"m_conditions",
".",
"add",
"(",
"new",
"CmsSimpleQueryFragment",
"(",
"fragment",
",",
"params",
")",
")",
";",
"}"
] | Adds a new condition to the query.<p>
@param fragment the condition SQL
@param params the condition parameters | [
"Adds",
"a",
"new",
"condition",
"to",
"the",
"query",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSelectQuery.java#L162-L165 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java | CmsCloneModuleThread.transformResource | private void transformResource(CmsResource resource, Function<String, String> transformation)
throws CmsException, UnsupportedEncodingException {
CmsFile file = getCms().readFile(resource);
if (CmsResourceTypeXmlContent.isXmlContent(file)) {
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
xmlContent.setAutoCorrectionEnabled(true);
file = xmlContent.correctXmlStructure(getCms());
}
String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
String content = new String(file.getContents(), encoding);
content = transformation.apply(content);
file.setContents(content.getBytes(encoding));
lockResource(getCms(), file);
getCms().writeFile(file);
} | java | private void transformResource(CmsResource resource, Function<String, String> transformation)
throws CmsException, UnsupportedEncodingException {
CmsFile file = getCms().readFile(resource);
if (CmsResourceTypeXmlContent.isXmlContent(file)) {
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
xmlContent.setAutoCorrectionEnabled(true);
file = xmlContent.correctXmlStructure(getCms());
}
String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
String content = new String(file.getContents(), encoding);
content = transformation.apply(content);
file.setContents(content.getBytes(encoding));
lockResource(getCms(), file);
getCms().writeFile(file);
} | [
"private",
"void",
"transformResource",
"(",
"CmsResource",
"resource",
",",
"Function",
"<",
"String",
",",
"String",
">",
"transformation",
")",
"throws",
"CmsException",
",",
"UnsupportedEncodingException",
"{",
"CmsFile",
"file",
"=",
"getCms",
"(",
")",
".",
... | Reads a file into a string, applies a transformation to the string, and writes the string back to the file.<p>
@param resource the resource to transform
@param transformation the transformation to apply
@throws CmsException if something goes wrong
@throws UnsupportedEncodingException in case the encoding is not supported | [
"Reads",
"a",
"file",
"into",
"a",
"string",
"applies",
"a",
"transformation",
"to",
"the",
"string",
"and",
"writes",
"the",
"string",
"back",
"to",
"the",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L1049-L1065 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/UNode.java | UNode.addMapNode | public UNode addMapNode(String name, String tagName) {
return addChildNode(UNode.createMapNode(name, tagName));
} | java | public UNode addMapNode(String name, String tagName) {
return addChildNode(UNode.createMapNode(name, tagName));
} | [
"public",
"UNode",
"addMapNode",
"(",
"String",
"name",
",",
"String",
"tagName",
")",
"{",
"return",
"addChildNode",
"(",
"UNode",
".",
"createMapNode",
"(",
"name",
",",
"tagName",
")",
")",
";",
"}"
] | Create a new MAP node with the given name and tag name add it as a child of this
node. This node must be a MAP or ARRAY. This is a convenience method that calls
{@link UNode#createMapNode(String, String)} and then {@link #addChildNode(UNode)}.
@param name Name of new MAP node.
@param tagName Tag name of new MAP node (for XML).
@return New MAP node, added as a child of this node. | [
"Create",
"a",
"new",
"MAP",
"node",
"with",
"the",
"given",
"name",
"and",
"tag",
"name",
"add",
"it",
"as",
"a",
"child",
"of",
"this",
"node",
".",
"This",
"node",
"must",
"be",
"a",
"MAP",
"or",
"ARRAY",
".",
"This",
"is",
"a",
"convenience",
"... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/UNode.java#L846-L848 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getCreateUploadSessionRequest | public BoxRequestsFile.CreateUploadSession getCreateUploadSessionRequest(File file, String folderId)
throws FileNotFoundException {
return new BoxRequestsFile.CreateUploadSession(file, folderId, getUploadSessionForNewFileUrl(), mSession);
} | java | public BoxRequestsFile.CreateUploadSession getCreateUploadSessionRequest(File file, String folderId)
throws FileNotFoundException {
return new BoxRequestsFile.CreateUploadSession(file, folderId, getUploadSessionForNewFileUrl(), mSession);
} | [
"public",
"BoxRequestsFile",
".",
"CreateUploadSession",
"getCreateUploadSessionRequest",
"(",
"File",
"file",
",",
"String",
"folderId",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"new",
"BoxRequestsFile",
".",
"CreateUploadSession",
"(",
"file",
",",
"fold... | Gets a request that creates an upload session for uploading a new file
@param file The file to be uploaded
@param folderId Folder Id
@return request to create an upload session for uploading a new file | [
"Gets",
"a",
"request",
"that",
"creates",
"an",
"upload",
"session",
"for",
"uploading",
"a",
"new",
"file"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L579-L582 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/conversion/support/ConvertingPropertyEditorAdapter.java | ConvertingPropertyEditorAdapter.setAsText | @Override
public void setAsText(String text) throws IllegalArgumentException {
try {
setValue(getConverter().convert(text));
}
catch (ConversionException cause) {
throw newIllegalArgumentException(cause, "Could not set text [%s] as value", text);
}
} | java | @Override
public void setAsText(String text) throws IllegalArgumentException {
try {
setValue(getConverter().convert(text));
}
catch (ConversionException cause) {
throw newIllegalArgumentException(cause, "Could not set text [%s] as value", text);
}
} | [
"@",
"Override",
"public",
"void",
"setAsText",
"(",
"String",
"text",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"setValue",
"(",
"getConverter",
"(",
")",
".",
"convert",
"(",
"text",
")",
")",
";",
"}",
"catch",
"(",
"ConversionException"... | Converts the given {@link String text} into an {@link Object}.
@param text {@link String} to convert.
@throws IllegalArgumentException if the given {@link String text}
cannot be {@link Converter#convert(Object) converted} into an {@link Object}.
@see org.cp.elements.data.conversion.Converter#convert(Object)
@see #getConverter() | [
"Converts",
"the",
"given",
"{",
"@link",
"String",
"text",
"}",
"into",
"an",
"{",
"@link",
"Object",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/support/ConvertingPropertyEditorAdapter.java#L91-L100 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.deleteByQuery | @Deprecated
public void deleteByQuery(Query query, RequestOptions requestOptions) throws AlgoliaException {
this.deleteByQuery(query, 100000, requestOptions);
} | java | @Deprecated
public void deleteByQuery(Query query, RequestOptions requestOptions) throws AlgoliaException {
this.deleteByQuery(query, 100000, requestOptions);
} | [
"@",
"Deprecated",
"public",
"void",
"deleteByQuery",
"(",
"Query",
"query",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"this",
".",
"deleteByQuery",
"(",
"query",
",",
"100000",
",",
"requestOptions",
")",
";",
"}"
] | Delete all objects matching a query
@param query the query string
@param requestOptions Options to pass to this request
@deprecated use deleteBy | [
"Delete",
"all",
"objects",
"matching",
"a",
"query"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L628-L631 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.rotateZYX | public Matrix4x3f rotateZYX(Vector3f angles) {
return rotateZYX(angles.z, angles.y, angles.x);
} | java | public Matrix4x3f rotateZYX(Vector3f angles) {
return rotateZYX(angles.z, angles.y, angles.x);
} | [
"public",
"Matrix4x3f",
"rotateZYX",
"(",
"Vector3f",
"angles",
")",
"{",
"return",
"rotateZYX",
"(",
"angles",
".",
"z",
",",
"angles",
".",
"y",
",",
"angles",
".",
"x",
")",
";",
"}"
] | Apply rotation of <code>angles.z</code> radians about the Z axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and
followed by a rotation of <code>angles.x</code> radians about the X axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateZ(angles.z).rotateY(angles.y).rotateX(angles.x)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"z<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axi... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L3617-L3619 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java | MpJwtAppSetupUtils.genericCreateArchiveWithJsps | public WebArchive genericCreateArchiveWithJsps(String baseWarName, List<String> classList) throws Exception {
try {
String warName = getWarName(baseWarName);
WebArchive newWar = genericCreateArchiveWithoutJsps(warName, classList);
addDefaultJspsForAppsToWar(warName, newWar);
return newWar;
} catch (Exception e) {
Log.error(thisClass, "genericCreateArchive", e);
throw e;
}
} | java | public WebArchive genericCreateArchiveWithJsps(String baseWarName, List<String> classList) throws Exception {
try {
String warName = getWarName(baseWarName);
WebArchive newWar = genericCreateArchiveWithoutJsps(warName, classList);
addDefaultJspsForAppsToWar(warName, newWar);
return newWar;
} catch (Exception e) {
Log.error(thisClass, "genericCreateArchive", e);
throw e;
}
} | [
"public",
"WebArchive",
"genericCreateArchiveWithJsps",
"(",
"String",
"baseWarName",
",",
"List",
"<",
"String",
">",
"classList",
")",
"throws",
"Exception",
"{",
"try",
"{",
"String",
"warName",
"=",
"getWarName",
"(",
"baseWarName",
")",
";",
"WebArchive",
"... | Create a new war with "standard" content for tests using these utils. Add the extra jsps that some apps need.
Finally add the classes that are specific to this war (they come from the classList passed in)
@param baseWarName - the base name of the war
@param classList - the list of classes specific to this war
@return - the generated war
@throws Exception | [
"Create",
"a",
"new",
"war",
"with",
"standard",
"content",
"for",
"tests",
"using",
"these",
"utils",
".",
"Add",
"the",
"extra",
"jsps",
"that",
"some",
"apps",
"need",
".",
"Finally",
"add",
"the",
"classes",
"that",
"are",
"specific",
"to",
"this",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java#L233-L243 |
roboconf/roboconf-platform | miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java | ApplicationWsDelegate.undeployAll | public void undeployAll( String applicationName, String instancePath )
throws ApplicationWsException {
this.logger.finer( "Undeploying instances in " + applicationName + " from instance = " + instancePath );
WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "undeploy-all" );
if( instancePath != null )
path = path.queryParam( "instance-path", instancePath );
ClientResponse response = this.wsClient.createBuilder( path )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
handleResponse( response );
this.logger.finer( String.valueOf( response.getStatusInfo()));
} | java | public void undeployAll( String applicationName, String instancePath )
throws ApplicationWsException {
this.logger.finer( "Undeploying instances in " + applicationName + " from instance = " + instancePath );
WebResource path = this.resource.path( UrlConstants.APP ).path( applicationName ).path( "undeploy-all" );
if( instancePath != null )
path = path.queryParam( "instance-path", instancePath );
ClientResponse response = this.wsClient.createBuilder( path )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
handleResponse( response );
this.logger.finer( String.valueOf( response.getStatusInfo()));
} | [
"public",
"void",
"undeployAll",
"(",
"String",
"applicationName",
",",
"String",
"instancePath",
")",
"throws",
"ApplicationWsException",
"{",
"this",
".",
"logger",
".",
"finer",
"(",
"\"Undeploying instances in \"",
"+",
"applicationName",
"+",
"\" from instance = \"... | Undeploys several instances at once.
@param applicationName the application name
@param instancePath the path of the instance to undeploy (null for all the application instances)
@throws ApplicationWsException if something went wrong | [
"Undeploys",
"several",
"instances",
"at",
"once",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java#L177-L192 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java | XMLSerializer.startDocument | public void startDocument(String encoding, Boolean standalone) throws IOException {
@SuppressWarnings("unused")
char apos = attributeUseApostrophe ? '\'' : '"';
if (attributeUseApostrophe) {
out.write("<?xml version='1.0'");
} else {
out.write("<?xml version=\"1.0\"");
}
if (encoding != null) {
out.write(" encoding=");
out.write(attributeUseApostrophe ? '\'' : '"');
out.write(encoding);
out.write(attributeUseApostrophe ? '\'' : '"');
// out.write('\'');
}
if (standalone != null) {
out.write(" standalone=");
out.write(attributeUseApostrophe ? '\'' : '"');
if (standalone.booleanValue()) {
out.write("yes");
} else {
out.write("no");
}
out.write(attributeUseApostrophe ? '\'' : '"');
// if(standalone.booleanValue()) {
// out.write(" standalone='yes'");
// } else {
// out.write(" standalone='no'");
// }
}
out.write("?>");
} | java | public void startDocument(String encoding, Boolean standalone) throws IOException {
@SuppressWarnings("unused")
char apos = attributeUseApostrophe ? '\'' : '"';
if (attributeUseApostrophe) {
out.write("<?xml version='1.0'");
} else {
out.write("<?xml version=\"1.0\"");
}
if (encoding != null) {
out.write(" encoding=");
out.write(attributeUseApostrophe ? '\'' : '"');
out.write(encoding);
out.write(attributeUseApostrophe ? '\'' : '"');
// out.write('\'');
}
if (standalone != null) {
out.write(" standalone=");
out.write(attributeUseApostrophe ? '\'' : '"');
if (standalone.booleanValue()) {
out.write("yes");
} else {
out.write("no");
}
out.write(attributeUseApostrophe ? '\'' : '"');
// if(standalone.booleanValue()) {
// out.write(" standalone='yes'");
// } else {
// out.write(" standalone='no'");
// }
}
out.write("?>");
} | [
"public",
"void",
"startDocument",
"(",
"String",
"encoding",
",",
"Boolean",
"standalone",
")",
"throws",
"IOException",
"{",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"char",
"apos",
"=",
"attributeUseApostrophe",
"?",
"'",
"'",
":",
"'",
"'",
";",
... | Start document.
@param encoding the encoding
@param standalone the standalone
@throws IOException Signals that an I/O exception has occurred. | [
"Start",
"document",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java#L539-L570 |
elki-project/elki | elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/DatabaseEventManager.java | DatabaseEventManager.fireResultRemoved | public void fireResultRemoved(Result r, Result parent) {
for(int i = resultListenerList.size(); --i >= 0;) {
resultListenerList.get(i).resultRemoved(r, parent);
}
} | java | public void fireResultRemoved(Result r, Result parent) {
for(int i = resultListenerList.size(); --i >= 0;) {
resultListenerList.get(i).resultRemoved(r, parent);
}
} | [
"public",
"void",
"fireResultRemoved",
"(",
"Result",
"r",
",",
"Result",
"parent",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"resultListenerList",
".",
"size",
"(",
")",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"resultListenerList",
".",
"get",
"(",
"... | Informs all registered <code>ResultListener</code> that a new result has
been removed.
@param r result that has been removed
@param parent Parent result that has been removed | [
"Informs",
"all",
"registered",
"<code",
">",
"ResultListener<",
"/",
"code",
">",
"that",
"a",
"new",
"result",
"has",
"been",
"removed",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/DatabaseEventManager.java#L325-L329 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.createDummyPolygon | public static Polygon createDummyPolygon() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0),
new Coordinate(0.0, 0.0)};
LinearRing linearRing = gf().createLinearRing(c);
return gf().createPolygon(linearRing, null);
} | java | public static Polygon createDummyPolygon() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0),
new Coordinate(0.0, 0.0)};
LinearRing linearRing = gf().createLinearRing(c);
return gf().createPolygon(linearRing, null);
} | [
"public",
"static",
"Polygon",
"createDummyPolygon",
"(",
")",
"{",
"Coordinate",
"[",
"]",
"c",
"=",
"new",
"Coordinate",
"[",
"]",
"{",
"new",
"Coordinate",
"(",
"0.0",
",",
"0.0",
")",
",",
"new",
"Coordinate",
"(",
"1.0",
",",
"1.0",
")",
",",
"n... | Creates a polygon that may help out as placeholder.
@return a dummy {@link Polygon}. | [
"Creates",
"a",
"polygon",
"that",
"may",
"help",
"out",
"as",
"placeholder",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L124-L129 |
paypal/SeLion | server/src/main/java/com/paypal/selion/node/servlets/LogServlet.java | LogServlet.process | protected void process(HttpServletRequest request, HttpServletResponse response, String fileName)
throws IOException {
// TODO put this html code in a template
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
response.setStatus(200);
FileBackedStringBuffer buffer = new FileBackedStringBuffer();
buffer.append("<html><head><title>");
buffer.append(request.getRemoteHost());
buffer.append("</title><script type=text/javascript>");
buffer.append("function submitform() { document.myform.submit(); } </script>");
buffer.append("</head><body><H1>View Logs on - ");
buffer.append(request.getRemoteHost()).append("</H1>");
if (isLogsDirectoryEmpty()) {
buffer.append("<br>No Logs available.</br></body></html>");
dumpStringToStream(buffer, response.getOutputStream());
return;
}
buffer.append(appendMoreLogsLink(fileName, request.getRequestURL().toString()));
buffer.append(renderLogFileContents(fileName));
buffer.append("</body></html>");
dumpStringToStream(buffer, response.getOutputStream());
} | java | protected void process(HttpServletRequest request, HttpServletResponse response, String fileName)
throws IOException {
// TODO put this html code in a template
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
response.setStatus(200);
FileBackedStringBuffer buffer = new FileBackedStringBuffer();
buffer.append("<html><head><title>");
buffer.append(request.getRemoteHost());
buffer.append("</title><script type=text/javascript>");
buffer.append("function submitform() { document.myform.submit(); } </script>");
buffer.append("</head><body><H1>View Logs on - ");
buffer.append(request.getRemoteHost()).append("</H1>");
if (isLogsDirectoryEmpty()) {
buffer.append("<br>No Logs available.</br></body></html>");
dumpStringToStream(buffer, response.getOutputStream());
return;
}
buffer.append(appendMoreLogsLink(fileName, request.getRequestURL().toString()));
buffer.append(renderLogFileContents(fileName));
buffer.append("</body></html>");
dumpStringToStream(buffer, response.getOutputStream());
} | [
"protected",
"void",
"process",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"// TODO put this html code in a template",
"response",
".",
"setContentType",
"(",
"\"text/html\"",
... | This method display the log file content
@param request
HttpServletRequest
@param response
HttpServletResponse
@param fileName
To display the log file content in the web page.
@throws IOException | [
"This",
"method",
"display",
"the",
"log",
"file",
"content"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/node/servlets/LogServlet.java#L149-L173 |
aws/aws-sdk-java | aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/App.java | App.withTags | public App withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public App withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"App",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Tag for Amplify App.
</p>
@param tags
Tag for Amplify App.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Tag",
"for",
"Amplify",
"App",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/App.java#L294-L297 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.