repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitSync | public synchronized EventBus emitSync(SysEventId eventId) {
if (isDestroyed()) {
return this;
}
if (null != onceBus) {
onceBus.emit(eventId);
}
return _emit(false, false, eventId);
} | java | public synchronized EventBus emitSync(SysEventId eventId) {
if (isDestroyed()) {
return this;
}
if (null != onceBus) {
onceBus.emit(eventId);
}
return _emit(false, false, eventId);
} | [
"public",
"synchronized",
"EventBus",
"emitSync",
"(",
"SysEventId",
"eventId",
")",
"{",
"if",
"(",
"isDestroyed",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"null",
"!=",
"onceBus",
")",
"{",
"onceBus",
".",
"emit",
"(",
"eventId",
")... | Emit a system event by {@link SysEventId event ID} and force event listeners
be invoked synchronously without regarding to how listeners are bound.
**Note** this method shall not be used by application developer.
@param eventId
the {@link SysEventId system event ID}
@return
this event bus instance
@see #emit(SysEventId) | [
"Emit",
"a",
"system",
"event",
"by",
"{",
"@link",
"SysEventId",
"event",
"ID",
"}",
"and",
"force",
"event",
"listeners",
"be",
"invoked",
"synchronously",
"without",
"regarding",
"to",
"how",
"listeners",
"are",
"bound",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1060-L1068 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/context/PartialResponseWriter.java | PartialResponseWriter.updateAttributes | public void updateAttributes(String targetId, Map<String, String> attributes)
throws IOException {
startChangesIfNecessary();
ResponseWriter writer = getWrapped();
writer.startElement("attributes", null);
writer.writeAttribute("id", targetId, null);
for (Map.Entry<String, String> entry : attributes.entrySet()) {
writer.startElement("attribute", null);
writer.writeAttribute("name", entry.getKey(), null);
writer.writeAttribute("value", entry.getValue(), null);
writer.endElement("attribute");
}
writer.endElement("attributes");
} | java | public void updateAttributes(String targetId, Map<String, String> attributes)
throws IOException {
startChangesIfNecessary();
ResponseWriter writer = getWrapped();
writer.startElement("attributes", null);
writer.writeAttribute("id", targetId, null);
for (Map.Entry<String, String> entry : attributes.entrySet()) {
writer.startElement("attribute", null);
writer.writeAttribute("name", entry.getKey(), null);
writer.writeAttribute("value", entry.getValue(), null);
writer.endElement("attribute");
}
writer.endElement("attributes");
} | [
"public",
"void",
"updateAttributes",
"(",
"String",
"targetId",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"throws",
"IOException",
"{",
"startChangesIfNecessary",
"(",
")",
";",
"ResponseWriter",
"writer",
"=",
"getWrapped",
"(",
")",
... | <p class="changed_added_2_0">Write an attribute update operation.</p>
@param targetId ID of the node to be updated
@param attributes Map of attribute name/value pairs to be updated
@throws IOException if an input/output error occurs
@since 2.0 | [
"<p",
"class",
"=",
"changed_added_2_0",
">",
"Write",
"an",
"attribute",
"update",
"operation",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/context/PartialResponseWriter.java#L249-L262 |
weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.isAlternative | public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) {
return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative();
} | java | public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) {
return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative();
} | [
"public",
"static",
"boolean",
"isAlternative",
"(",
"EnhancedAnnotated",
"<",
"?",
",",
"?",
">",
"annotated",
",",
"MergedStereotypes",
"<",
"?",
",",
"?",
">",
"mergedStereotypes",
")",
"{",
"return",
"annotated",
".",
"isAnnotationPresent",
"(",
"Alternative... | Is alternative.
@param annotated the annotated
@param mergedStereotypes merged stereotypes
@return true if alternative, false otherwise | [
"Is",
"alternative",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L255-L257 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java | MethodContentAnalyzer.addProjectMethods | private void addProjectMethods(final List<Instruction> instructions, final Set<ProjectMethod> projectMethods) {
Set<MethodIdentifier> projectMethodIdentifiers = findUnhandledProjectMethodIdentifiers(instructions, projectMethods);
for (MethodIdentifier identifier : projectMethodIdentifiers) {
// TODO cache results -> singleton pool?
final MethodResult methodResult = visitProjectMethod(identifier);
if (methodResult == null) {
continue;
}
final List<Instruction> nestedMethodInstructions = interpretRelevantInstructions(methodResult.getInstructions());
projectMethods.add(new ProjectMethod(identifier, nestedMethodInstructions));
addProjectMethods(nestedMethodInstructions, projectMethods);
}
} | java | private void addProjectMethods(final List<Instruction> instructions, final Set<ProjectMethod> projectMethods) {
Set<MethodIdentifier> projectMethodIdentifiers = findUnhandledProjectMethodIdentifiers(instructions, projectMethods);
for (MethodIdentifier identifier : projectMethodIdentifiers) {
// TODO cache results -> singleton pool?
final MethodResult methodResult = visitProjectMethod(identifier);
if (methodResult == null) {
continue;
}
final List<Instruction> nestedMethodInstructions = interpretRelevantInstructions(methodResult.getInstructions());
projectMethods.add(new ProjectMethod(identifier, nestedMethodInstructions));
addProjectMethods(nestedMethodInstructions, projectMethods);
}
} | [
"private",
"void",
"addProjectMethods",
"(",
"final",
"List",
"<",
"Instruction",
">",
"instructions",
",",
"final",
"Set",
"<",
"ProjectMethod",
">",
"projectMethods",
")",
"{",
"Set",
"<",
"MethodIdentifier",
">",
"projectMethodIdentifiers",
"=",
"findUnhandledPro... | Adds all project methods called in the given {@code instructions} to the {@code projectMethods} recursively.
@param instructions The instructions of the current method
@param projectMethods All found project methods | [
"Adds",
"all",
"project",
"methods",
"called",
"in",
"the",
"given",
"{",
"@code",
"instructions",
"}",
"to",
"the",
"{",
"@code",
"projectMethods",
"}",
"recursively",
"."
] | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/MethodContentAnalyzer.java#L99-L114 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/RPC.java | RPC.getProtocolProxy | public static <T extends VersionedProtocol> ProtocolProxy<T> getProtocolProxy(
Class<T> protocol,
long clientVersion, InetSocketAddress addr, Configuration conf,
SocketFactory factory) throws IOException {
UserGroupInformation ugi = null;
try {
ugi = UserGroupInformation.login(conf);
} catch (LoginException le) {
throw new RuntimeException("Couldn't login!");
}
return getProtocolProxy(protocol, clientVersion, addr, ugi, conf, factory);
} | java | public static <T extends VersionedProtocol> ProtocolProxy<T> getProtocolProxy(
Class<T> protocol,
long clientVersion, InetSocketAddress addr, Configuration conf,
SocketFactory factory) throws IOException {
UserGroupInformation ugi = null;
try {
ugi = UserGroupInformation.login(conf);
} catch (LoginException le) {
throw new RuntimeException("Couldn't login!");
}
return getProtocolProxy(protocol, clientVersion, addr, ugi, conf, factory);
} | [
"public",
"static",
"<",
"T",
"extends",
"VersionedProtocol",
">",
"ProtocolProxy",
"<",
"T",
">",
"getProtocolProxy",
"(",
"Class",
"<",
"T",
">",
"protocol",
",",
"long",
"clientVersion",
",",
"InetSocketAddress",
"addr",
",",
"Configuration",
"conf",
",",
"... | Construct a client-side protocol proxy that contains a set of server
methods and a proxy object implementing the named protocol,
talking to a server at the named address. | [
"Construct",
"a",
"client",
"-",
"side",
"protocol",
"proxy",
"that",
"contains",
"a",
"set",
"of",
"server",
"methods",
"and",
"a",
"proxy",
"object",
"implementing",
"the",
"named",
"protocol",
"talking",
"to",
"a",
"server",
"at",
"the",
"named",
"address... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/RPC.java#L514-L525 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraBusinessException.java | MithraBusinessException.ifRetriableWaitElseThrow | public int ifRetriableWaitElseThrow(String msg, int retriesLeft, Logger logger)
{
if (this.isRetriable() && --retriesLeft > 0)
{
logger.warn(msg+ " " + this.getMessage());
if (logger.isDebugEnabled())
{
logger.debug("find failed with retriable error. retrying.", this);
}
cleanupAndRecreateTempContexts();
this.waitBeforeRetrying();
}
else throw this;
return retriesLeft;
} | java | public int ifRetriableWaitElseThrow(String msg, int retriesLeft, Logger logger)
{
if (this.isRetriable() && --retriesLeft > 0)
{
logger.warn(msg+ " " + this.getMessage());
if (logger.isDebugEnabled())
{
logger.debug("find failed with retriable error. retrying.", this);
}
cleanupAndRecreateTempContexts();
this.waitBeforeRetrying();
}
else throw this;
return retriesLeft;
} | [
"public",
"int",
"ifRetriableWaitElseThrow",
"(",
"String",
"msg",
",",
"int",
"retriesLeft",
",",
"Logger",
"logger",
")",
"{",
"if",
"(",
"this",
".",
"isRetriable",
"(",
")",
"&&",
"--",
"retriesLeft",
">",
"0",
")",
"{",
"logger",
".",
"warn",
"(",
... | must not be called from within a transaction, unless the work is being done async in a non-tx thread. | [
"must",
"not",
"be",
"called",
"from",
"within",
"a",
"transaction",
"unless",
"the",
"work",
"is",
"being",
"done",
"async",
"in",
"a",
"non",
"-",
"tx",
"thread",
"."
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraBusinessException.java#L53-L67 |
Azure/azure-sdk-for-java | common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java | HttpResponseBodyDecoder.isErrorStatus | static boolean isErrorStatus(HttpResponse httpResponse, HttpResponseDecodeData decodeData) {
final int[] expectedStatuses = decodeData.expectedStatusCodes();
if (expectedStatuses != null) {
return !contains(expectedStatuses, httpResponse.statusCode());
} else {
return httpResponse.statusCode() / 100 != 2;
}
} | java | static boolean isErrorStatus(HttpResponse httpResponse, HttpResponseDecodeData decodeData) {
final int[] expectedStatuses = decodeData.expectedStatusCodes();
if (expectedStatuses != null) {
return !contains(expectedStatuses, httpResponse.statusCode());
} else {
return httpResponse.statusCode() / 100 != 2;
}
} | [
"static",
"boolean",
"isErrorStatus",
"(",
"HttpResponse",
"httpResponse",
",",
"HttpResponseDecodeData",
"decodeData",
")",
"{",
"final",
"int",
"[",
"]",
"expectedStatuses",
"=",
"decodeData",
".",
"expectedStatusCodes",
"(",
")",
";",
"if",
"(",
"expectedStatuses... | Checks the response status code is considered as error.
@param httpResponse the response to check
@param decodeData the response metadata
@return true if the response status code is considered as error, false otherwise. | [
"Checks",
"the",
"response",
"status",
"code",
"is",
"considered",
"as",
"error",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java#L138-L145 |
Stratio/cassandra-lucene-index | plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilders.java | SearchBuilders.geoShape | public static GeoShapeConditionBuilder geoShape(String field, String shape) {
return new GeoShapeConditionBuilder(field, new GeoShape.WKT(shape));
} | java | public static GeoShapeConditionBuilder geoShape(String field, String shape) {
return new GeoShapeConditionBuilder(field, new GeoShape.WKT(shape));
} | [
"public",
"static",
"GeoShapeConditionBuilder",
"geoShape",
"(",
"String",
"field",
",",
"String",
"shape",
")",
"{",
"return",
"new",
"GeoShapeConditionBuilder",
"(",
"field",
",",
"new",
"GeoShape",
".",
"WKT",
"(",
"shape",
")",
")",
";",
"}"
] | Returns a new {@link GeoShapeConditionBuilder} with the specified field reference point.
/** Constructor receiving the name of the field and the shape.
@param field the name of the field
@param shape the shape in <a href="http://en.wikipedia.org/wiki/Well-known_text"> WKT</a> format
@return a new geo shape condition builder | [
"Returns",
"a",
"new",
"{",
"@link",
"GeoShapeConditionBuilder",
"}",
"with",
"the",
"specified",
"field",
"reference",
"point",
"."
] | train | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilders.java#L265-L267 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java | ImageBandMath.stdDev | public static void stdDev(Planar<GrayS16> input, GrayS16 output, @Nullable GrayS16 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | java | public static void stdDev(Planar<GrayS16> input, GrayS16 output, @Nullable GrayS16 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | [
"public",
"static",
"void",
"stdDev",
"(",
"Planar",
"<",
"GrayS16",
">",
"input",
",",
"GrayS16",
"output",
",",
"@",
"Nullable",
"GrayS16",
"avg",
")",
"{",
"stdDev",
"(",
"input",
",",
"output",
",",
"avg",
",",
"0",
",",
"input",
".",
"getNumBands"... | Computes the standard deviation for each pixel across all bands in the {@link Planar}
image.
@param input Planar image - not modified
@param output Gray scale image containing average pixel values - modified
@param avg Input Gray scale image containing average image. Can be null | [
"Computes",
"the",
"standard",
"deviation",
"for",
"each",
"pixel",
"across",
"all",
"bands",
"in",
"the",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java#L361-L363 |
liferay/com-liferay-commerce | commerce-wish-list-api/src/main/java/com/liferay/commerce/wish/list/service/persistence/CommerceWishListUtil.java | CommerceWishListUtil.findByUUID_G | public static CommerceWishList findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.wish.list.exception.NoSuchWishListException {
return getPersistence().findByUUID_G(uuid, groupId);
} | java | public static CommerceWishList findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.wish.list.exception.NoSuchWishListException {
return getPersistence().findByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CommerceWishList",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"wish",
".",
"list",
".",
"exception",
".",
"NoSuchWishListException",
"{",
"return",
"getPersisten... | Returns the commerce wish list where uuid = ? and groupId = ? or throws a {@link NoSuchWishListException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce wish list
@throws NoSuchWishListException if a matching commerce wish list could not be found | [
"Returns",
"the",
"commerce",
"wish",
"list",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchWishListException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-api/src/main/java/com/liferay/commerce/wish/list/service/persistence/CommerceWishListUtil.java#L280-L283 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallApiDefinition | public static ApiDefinitionBean unmarshallApiDefinition(Map<String, Object> source) {
if (source == null) {
return null;
}
ApiDefinitionBean bean = new ApiDefinitionBean();
bean.setData(asString(source.get("data")));
postMarshall(bean);
return bean;
} | java | public static ApiDefinitionBean unmarshallApiDefinition(Map<String, Object> source) {
if (source == null) {
return null;
}
ApiDefinitionBean bean = new ApiDefinitionBean();
bean.setData(asString(source.get("data")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"ApiDefinitionBean",
"unmarshallApiDefinition",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ApiDefinitionBean",
"bean",
"=",
"new",
"ApiDefin... | Unmarshals the given map source into a bean.
@param source the source
@return the API definition | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L742-L750 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java | SerializationUtils.fromJsonString | public static Object fromJsonString(String jsonString, ClassLoader classLoader) {
return fromJsonString(jsonString, Object.class, classLoader);
} | java | public static Object fromJsonString(String jsonString, ClassLoader classLoader) {
return fromJsonString(jsonString, Object.class, classLoader);
} | [
"public",
"static",
"Object",
"fromJsonString",
"(",
"String",
"jsonString",
",",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"fromJsonString",
"(",
"jsonString",
",",
"Object",
".",
"class",
",",
"classLoader",
")",
";",
"}"
] | Deserialize a JSON string, with custom class loader.
@param jsonString
@param classLoader
@return | [
"Deserialize",
"a",
"JSON",
"string",
"with",
"custom",
"class",
"loader",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L635-L637 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java | BpmnParse.parseExecutionListenersOnScope | public void parseExecutionListenersOnScope(Element scopeElement, ScopeImpl scope) {
Element extentionsElement = scopeElement.element("extensionElements");
if (extentionsElement != null) {
List<Element> listenerElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "executionListener");
for (Element listenerElement : listenerElements) {
String eventName = listenerElement.attribute("event");
if (isValidEventNameForScope(eventName, listenerElement)) {
ExecutionListener listener = parseExecutionListener(listenerElement);
if (listener != null) {
scope.addExecutionListener(eventName, listener);
}
}
}
}
} | java | public void parseExecutionListenersOnScope(Element scopeElement, ScopeImpl scope) {
Element extentionsElement = scopeElement.element("extensionElements");
if (extentionsElement != null) {
List<Element> listenerElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "executionListener");
for (Element listenerElement : listenerElements) {
String eventName = listenerElement.attribute("event");
if (isValidEventNameForScope(eventName, listenerElement)) {
ExecutionListener listener = parseExecutionListener(listenerElement);
if (listener != null) {
scope.addExecutionListener(eventName, listener);
}
}
}
}
} | [
"public",
"void",
"parseExecutionListenersOnScope",
"(",
"Element",
"scopeElement",
",",
"ScopeImpl",
"scope",
")",
"{",
"Element",
"extentionsElement",
"=",
"scopeElement",
".",
"element",
"(",
"\"extensionElements\"",
")",
";",
"if",
"(",
"extentionsElement",
"!=",
... | Parses all execution-listeners on a scope.
@param scopeElement
the XML element containing the scope definition.
@param scope
the scope to add the executionListeners to. | [
"Parses",
"all",
"execution",
"-",
"listeners",
"on",
"a",
"scope",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L4112-L4126 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPasswordFieldRenderer.java | WPasswordFieldRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WPasswordField field = (WPasswordField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = field.isReadOnly();
xml.appendTagOpen(TAG_NAME);
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
xml.appendEnd();
return;
}
int cols = field.getColumns();
int minLength = field.getMinLength();
int maxLength = field.getMaxLength();
WComponent submitControl = field.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("disabled", field.isDisabled(), "true");
xml.appendOptionalAttribute("required", field.isMandatory(), "true");
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("toolTip", field.getToolTip());
xml.appendOptionalAttribute("accessibleText", field.getAccessibleText());
xml.appendOptionalAttribute("size", cols > 0, cols);
xml.appendOptionalAttribute("buttonId", submitControlId);
String placeholder = field.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
String autocomplete = field.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
List<Diagnostic> diags = field.getDiagnostics(Diagnostic.ERROR);
if (diags == null || diags.isEmpty()) {
xml.appendEnd();
return;
}
xml.appendClose();
DiagnosticRenderUtil.renderDiagnostics(field, renderContext);
xml.appendEndTag(TAG_NAME);
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WPasswordField field = (WPasswordField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = field.isReadOnly();
xml.appendTagOpen(TAG_NAME);
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
xml.appendEnd();
return;
}
int cols = field.getColumns();
int minLength = field.getMinLength();
int maxLength = field.getMaxLength();
WComponent submitControl = field.getDefaultSubmitButton();
String submitControlId = submitControl == null ? null : submitControl.getId();
xml.appendOptionalAttribute("disabled", field.isDisabled(), "true");
xml.appendOptionalAttribute("required", field.isMandatory(), "true");
xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
xml.appendOptionalAttribute("toolTip", field.getToolTip());
xml.appendOptionalAttribute("accessibleText", field.getAccessibleText());
xml.appendOptionalAttribute("size", cols > 0, cols);
xml.appendOptionalAttribute("buttonId", submitControlId);
String placeholder = field.getPlaceholder();
xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
String autocomplete = field.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
List<Diagnostic> diags = field.getDiagnostics(Diagnostic.ERROR);
if (diags == null || diags.isEmpty()) {
xml.appendEnd();
return;
}
xml.appendClose();
DiagnosticRenderUtil.renderDiagnostics(field, renderContext);
xml.appendEndTag(TAG_NAME);
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WPasswordField",
"field",
"=",
"(",
"WPasswordField",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"r... | Paints the given WPasswordField.
@param component the WPasswordField to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WPasswordField",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPasswordFieldRenderer.java#L30-L75 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java | PageFlowPageFilter.continueChainNoWrapper | private static void continueChainNoWrapper( ServletRequest request, ServletResponse response, FilterChain chain )
throws IOException, ServletException
{
//
// Remove our request wrapper -- the page doesn't need to see this.
//
if ( request instanceof PageFlowRequestWrapper )
request = ((PageFlowRequestWrapper)request).getHttpRequest();
chain.doFilter( request, response );
} | java | private static void continueChainNoWrapper( ServletRequest request, ServletResponse response, FilterChain chain )
throws IOException, ServletException
{
//
// Remove our request wrapper -- the page doesn't need to see this.
//
if ( request instanceof PageFlowRequestWrapper )
request = ((PageFlowRequestWrapper)request).getHttpRequest();
chain.doFilter( request, response );
} | [
"private",
"static",
"void",
"continueChainNoWrapper",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"//",
"// Remove our request wrapper -- the page doesn't need ... | Internal method used to handle cases where the filter should continue without processing the
request by rendering a page associated with a page flow.
@param request the request
@param response the response
@param chain the filter chain
@throws IOException
@throws ServletException | [
"Internal",
"method",
"used",
"to",
"handle",
"cases",
"where",
"the",
"filter",
"should",
"continue",
"without",
"processing",
"the",
"request",
"by",
"rendering",
"a",
"page",
"associated",
"with",
"a",
"page",
"flow",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java#L459-L469 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java | PipelineBuilder.addQuantifierExpr | public void addQuantifierExpr(final INodeReadTrx mTransaction, final boolean mIsSome, final int mVarNum) {
assert getPipeStack().size() >= (mVarNum + 1);
final AbsAxis satisfy = getPipeStack().pop().getExpr();
final List<AbsAxis> vars = new ArrayList<AbsAxis>();
int num = mVarNum;
while (num-- > 0) {
// invert current order of variables to get original variable order
vars.add(num, getPipeStack().pop().getExpr());
}
final AbsAxis mAxis =
mIsSome ? new SomeExpr(mTransaction, vars, satisfy) : new EveryExpr(mTransaction, vars, satisfy);
if (getPipeStack().empty() || getExpression().getSize() != 0) {
addExpressionSingle();
}
getExpression().add(mAxis);
} | java | public void addQuantifierExpr(final INodeReadTrx mTransaction, final boolean mIsSome, final int mVarNum) {
assert getPipeStack().size() >= (mVarNum + 1);
final AbsAxis satisfy = getPipeStack().pop().getExpr();
final List<AbsAxis> vars = new ArrayList<AbsAxis>();
int num = mVarNum;
while (num-- > 0) {
// invert current order of variables to get original variable order
vars.add(num, getPipeStack().pop().getExpr());
}
final AbsAxis mAxis =
mIsSome ? new SomeExpr(mTransaction, vars, satisfy) : new EveryExpr(mTransaction, vars, satisfy);
if (getPipeStack().empty() || getExpression().getSize() != 0) {
addExpressionSingle();
}
getExpression().add(mAxis);
} | [
"public",
"void",
"addQuantifierExpr",
"(",
"final",
"INodeReadTrx",
"mTransaction",
",",
"final",
"boolean",
"mIsSome",
",",
"final",
"int",
"mVarNum",
")",
"{",
"assert",
"getPipeStack",
"(",
")",
".",
"size",
"(",
")",
">=",
"(",
"mVarNum",
"+",
"1",
")... | Adds a SomeExpression or an EveryExpression to the pipeline, depending on
the parameter isSome.
@param mTransaction
Transaction to operate with.
@param mIsSome
defines whether a some- or an EveryExpression is used.
@param mVarNum
number of binding variables | [
"Adds",
"a",
"SomeExpression",
"or",
"an",
"EveryExpression",
"to",
"the",
"pipeline",
"depending",
"on",
"the",
"parameter",
"isSome",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L595-L615 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.methodInvocation | public static Matcher<ExpressionTree> methodInvocation(
Matcher<ExpressionTree> methodSelectMatcher,
MatchType matchType,
Matcher<ExpressionTree> methodArgumentMatcher) {
return new MethodInvocation(methodSelectMatcher, matchType, methodArgumentMatcher);
} | java | public static Matcher<ExpressionTree> methodInvocation(
Matcher<ExpressionTree> methodSelectMatcher,
MatchType matchType,
Matcher<ExpressionTree> methodArgumentMatcher) {
return new MethodInvocation(methodSelectMatcher, matchType, methodArgumentMatcher);
} | [
"public",
"static",
"Matcher",
"<",
"ExpressionTree",
">",
"methodInvocation",
"(",
"Matcher",
"<",
"ExpressionTree",
">",
"methodSelectMatcher",
",",
"MatchType",
"matchType",
",",
"Matcher",
"<",
"ExpressionTree",
">",
"methodArgumentMatcher",
")",
"{",
"return",
... | Matches an AST node if it is a method invocation and the given matchers match.
@param methodSelectMatcher matcher identifying the method being called
@param matchType how to match method arguments with {@code methodArgumentMatcher}
@param methodArgumentMatcher matcher applied to each method argument | [
"Matches",
"an",
"AST",
"node",
"if",
"it",
"is",
"a",
"method",
"invocation",
"and",
"the",
"given",
"matchers",
"match",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L363-L368 |
ironjacamar/ironjacamar | deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java | AbstractResourceAdapterDeployer.createAdminObject | protected void createAdminObject(DeploymentBuilder builder, Connector connector, AdminObject ao)
throws DeployException
{
try
{
String aoClass = findAdminObject(ao.getClassName(), connector);
Class<?> clz = Class.forName(aoClass, true, builder.getClassLoader());
Object adminObject = clz.newInstance();
Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties = findConfigProperties(
aoClass, connector);
Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps = injectConfigProperties(
adminObject, configProperties, ao.getConfigProperties(), builder.getClassLoader());
validationObj.add(new ValidateClass(Key.ADMIN_OBJECT, clz, configProperties));
org.ironjacamar.core.spi.statistics.StatisticsPlugin statisticsPlugin = null;
if (adminObject instanceof org.ironjacamar.core.spi.statistics.Statistics)
statisticsPlugin = ((org.ironjacamar.core.spi.statistics.Statistics)adminObject).getStatistics();
if (builder.getResourceAdapter() != null)
associateResourceAdapter(builder.getResourceAdapter().getResourceAdapter(), adminObject);
builder.adminObject(new AdminObjectImpl(ao.getJndiName(), adminObject, dcps, ao,
statisticsPlugin, jndiStrategy));
}
catch (Throwable t)
{
throw new DeployException(bundle.unableToCreateAdminObject(ao.getId(), ao.getJndiName()), t);
}
} | java | protected void createAdminObject(DeploymentBuilder builder, Connector connector, AdminObject ao)
throws DeployException
{
try
{
String aoClass = findAdminObject(ao.getClassName(), connector);
Class<?> clz = Class.forName(aoClass, true, builder.getClassLoader());
Object adminObject = clz.newInstance();
Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties = findConfigProperties(
aoClass, connector);
Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps = injectConfigProperties(
adminObject, configProperties, ao.getConfigProperties(), builder.getClassLoader());
validationObj.add(new ValidateClass(Key.ADMIN_OBJECT, clz, configProperties));
org.ironjacamar.core.spi.statistics.StatisticsPlugin statisticsPlugin = null;
if (adminObject instanceof org.ironjacamar.core.spi.statistics.Statistics)
statisticsPlugin = ((org.ironjacamar.core.spi.statistics.Statistics)adminObject).getStatistics();
if (builder.getResourceAdapter() != null)
associateResourceAdapter(builder.getResourceAdapter().getResourceAdapter(), adminObject);
builder.adminObject(new AdminObjectImpl(ao.getJndiName(), adminObject, dcps, ao,
statisticsPlugin, jndiStrategy));
}
catch (Throwable t)
{
throw new DeployException(bundle.unableToCreateAdminObject(ao.getId(), ao.getJndiName()), t);
}
} | [
"protected",
"void",
"createAdminObject",
"(",
"DeploymentBuilder",
"builder",
",",
"Connector",
"connector",
",",
"AdminObject",
"ao",
")",
"throws",
"DeployException",
"{",
"try",
"{",
"String",
"aoClass",
"=",
"findAdminObject",
"(",
"ao",
".",
"getClassName",
... | Create admin object instance
@param builder The deployment builder
@param connector The metadata
@param ao The admin object
@throws DeployException Thrown if the admin object cant be created | [
"Create",
"admin",
"object",
"instance"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java#L615-L646 |
opoo/opoopress | wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java | GitHub.getRepository | private RepositoryId getRepository(final String owner, final String name) throws GitHubException {
RepositoryId repository = null;
if(StringUtils.isNotBlank(name) && StringUtils.isNotBlank(owner)){
repository = RepositoryId.create(owner, name);
}else{
throw new GitHubException("No GitHub repository (owner and name) configured");
}
if (log.isDebugEnabled()){
log.debug(MessageFormat.format("Using GitHub repository {0}", repository.generateId()));
}
return repository;
} | java | private RepositoryId getRepository(final String owner, final String name) throws GitHubException {
RepositoryId repository = null;
if(StringUtils.isNotBlank(name) && StringUtils.isNotBlank(owner)){
repository = RepositoryId.create(owner, name);
}else{
throw new GitHubException("No GitHub repository (owner and name) configured");
}
if (log.isDebugEnabled()){
log.debug(MessageFormat.format("Using GitHub repository {0}", repository.generateId()));
}
return repository;
} | [
"private",
"RepositoryId",
"getRepository",
"(",
"final",
"String",
"owner",
",",
"final",
"String",
"name",
")",
"throws",
"GitHubException",
"{",
"RepositoryId",
"repository",
"=",
"null",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"name",
")",
"... | Get repository and throw a {@link MojoExecutionException} on failures
@param project
@param owner
@param name
@return non-null repository id
@throws MojoExecutionException | [
"Get",
"repository",
"and",
"throw",
"a",
"{",
"@link",
"MojoExecutionException",
"}",
"on",
"failures"
] | train | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java#L515-L526 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java | PrivateDataManager.getPrivateDataProvider | public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace) {
String key = XmppStringUtils.generateKey(elementName, namespace);
return privateDataProviders.get(key);
} | java | public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace) {
String key = XmppStringUtils.generateKey(elementName, namespace);
return privateDataProviders.get(key);
} | [
"public",
"static",
"PrivateDataProvider",
"getPrivateDataProvider",
"(",
"String",
"elementName",
",",
"String",
"namespace",
")",
"{",
"String",
"key",
"=",
"XmppStringUtils",
".",
"generateKey",
"(",
"elementName",
",",
"namespace",
")",
";",
"return",
"privateDa... | Returns the private data provider registered to the specified XML element name and namespace.
For example, if a provider was registered to the element name "prefs" and the
namespace "http://www.xmppclient.com/prefs", then the following stanza would trigger
the provider:
<pre>
<iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'>
<query xmlns='jabber:iq:private'>
<prefs xmlns='http://www.xmppclient.com/prefs'>
<value1>ABC</value1>
<value2>XYZ</value2>
</prefs>
</query>
</iq></pre>
<p>Note: this method is generally only called by the internal Smack classes.
@param elementName the XML element name.
@param namespace the XML namespace.
@return the PrivateData provider. | [
"Returns",
"the",
"private",
"data",
"provider",
"registered",
"to",
"the",
"specified",
"XML",
"element",
"name",
"and",
"namespace",
".",
"For",
"example",
"if",
"a",
"provider",
"was",
"registered",
"to",
"the",
"element",
"name",
"prefs",
"and",
"the",
"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java#L104-L107 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java | GenericEncodingStrategy.pushRawSupport | protected void pushRawSupport(CodeAssembler a, LocalVariable instanceVar)
throws SupportException
{
boolean isObjectArrayInstanceVar = instanceVar != null
&& instanceVar.getType() == TypeDesc.forClass(Object[].class);
if (isObjectArrayInstanceVar) {
throw new SupportException("Lob properties not supported");
}
if (instanceVar == null) {
a.loadThis();
} else {
a.loadLocal(instanceVar);
}
a.loadField(SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class));
a.checkCast(TypeDesc.forClass(RawSupport.class));
} | java | protected void pushRawSupport(CodeAssembler a, LocalVariable instanceVar)
throws SupportException
{
boolean isObjectArrayInstanceVar = instanceVar != null
&& instanceVar.getType() == TypeDesc.forClass(Object[].class);
if (isObjectArrayInstanceVar) {
throw new SupportException("Lob properties not supported");
}
if (instanceVar == null) {
a.loadThis();
} else {
a.loadLocal(instanceVar);
}
a.loadField(SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class));
a.checkCast(TypeDesc.forClass(RawSupport.class));
} | [
"protected",
"void",
"pushRawSupport",
"(",
"CodeAssembler",
"a",
",",
"LocalVariable",
"instanceVar",
")",
"throws",
"SupportException",
"{",
"boolean",
"isObjectArrayInstanceVar",
"=",
"instanceVar",
"!=",
"null",
"&&",
"instanceVar",
".",
"getType",
"(",
")",
"==... | Generates code to push RawSupport instance to the stack. RawSupport is
available only in Storable instances. If instanceVar is an Object[], a
SupportException is thrown.
@param instanceVar Storable instance or array of property values. Null
is storable instance of "this". | [
"Generates",
"code",
"to",
"push",
"RawSupport",
"instance",
"to",
"the",
"stack",
".",
"RawSupport",
"is",
"available",
"only",
"in",
"Storable",
"instances",
".",
"If",
"instanceVar",
"is",
"an",
"Object",
"[]",
"a",
"SupportException",
"is",
"thrown",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java#L1770-L1788 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/selector/Hud.java | Hud.checkActionsInCommon | private static void checkActionsInCommon(Actioner actioner, Collection<ActionRef> actions)
{
if (actions.isEmpty())
{
actions.addAll(actioner.getActions());
}
else
{
actions.retainAll(actioner.getActions());
}
} | java | private static void checkActionsInCommon(Actioner actioner, Collection<ActionRef> actions)
{
if (actions.isEmpty())
{
actions.addAll(actioner.getActions());
}
else
{
actions.retainAll(actioner.getActions());
}
} | [
"private",
"static",
"void",
"checkActionsInCommon",
"(",
"Actioner",
"actioner",
",",
"Collection",
"<",
"ActionRef",
">",
"actions",
")",
"{",
"if",
"(",
"actions",
".",
"isEmpty",
"(",
")",
")",
"{",
"actions",
".",
"addAll",
"(",
"actioner",
".",
"getA... | Get all actions in common.
@param actioner The current selectable.
@param actions The collected actions in common. | [
"Get",
"all",
"actions",
"in",
"common",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/selector/Hud.java#L87-L97 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.evaluateROC | public <T extends ROC> T evaluateROC(DataSetIterator iterator, int rocThresholdSteps) {
Layer outputLayer = getOutputLayer(0);
if(getConfiguration().isValidateOutputLayerConfig()){
OutputLayerUtil.validateOutputLayerForClassifierEvaluation(outputLayer.conf().getLayer(), ROC.class);
}
return (T)doEvaluation(iterator, new org.deeplearning4j.eval.ROC(rocThresholdSteps))[0];
} | java | public <T extends ROC> T evaluateROC(DataSetIterator iterator, int rocThresholdSteps) {
Layer outputLayer = getOutputLayer(0);
if(getConfiguration().isValidateOutputLayerConfig()){
OutputLayerUtil.validateOutputLayerForClassifierEvaluation(outputLayer.conf().getLayer(), ROC.class);
}
return (T)doEvaluation(iterator, new org.deeplearning4j.eval.ROC(rocThresholdSteps))[0];
} | [
"public",
"<",
"T",
"extends",
"ROC",
">",
"T",
"evaluateROC",
"(",
"DataSetIterator",
"iterator",
",",
"int",
"rocThresholdSteps",
")",
"{",
"Layer",
"outputLayer",
"=",
"getOutputLayer",
"(",
"0",
")",
";",
"if",
"(",
"getConfiguration",
"(",
")",
".",
"... | Evaluate the network (must be a binary classifier) on the specified data, using the {@link ROC} class
@param iterator Data to evaluate on
@param rocThresholdSteps Number of threshold steps to use with {@link ROC}
@return ROC evaluation on the given dataset | [
"Evaluate",
"the",
"network",
"(",
"must",
"be",
"a",
"binary",
"classifier",
")",
"on",
"the",
"specified",
"data",
"using",
"the",
"{",
"@link",
"ROC",
"}",
"class"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3933-L3939 |
javagl/ND | nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/MathUtils.java | MathUtils.wrappedDistance | static int wrappedDistance(int i0, int i1, int size)
{
int w0 = wrap(i0, size);
int w1 = wrap(i1, size);
int d = Math.abs(w1-w0);
return Math.min(d, size-d);
} | java | static int wrappedDistance(int i0, int i1, int size)
{
int w0 = wrap(i0, size);
int w1 = wrap(i1, size);
int d = Math.abs(w1-w0);
return Math.min(d, size-d);
} | [
"static",
"int",
"wrappedDistance",
"(",
"int",
"i0",
",",
"int",
"i1",
",",
"int",
"size",
")",
"{",
"int",
"w0",
"=",
"wrap",
"(",
"i0",
",",
"size",
")",
";",
"int",
"w1",
"=",
"wrap",
"(",
"i1",
",",
"size",
")",
";",
"int",
"d",
"=",
"Ma... | Computes the distance (absolute difference) between the given values
when they are interpreted as points on a circle with the given
size (that is, circumference). <br>
<br>
E.g. <br>
<pre><code>
wrappedDistance(0, 9, 10) = 1
wrappedDistance(0, 10, 10) = 0
wrappedDistance(0, 11, 10) = 1
wrappedDistance(1, -4, 10) = 5
</code></pre>
@param i0 The first value
@param i1 The second value
@param size The wrapping size
@return The wrapped distance | [
"Computes",
"the",
"distance",
"(",
"absolute",
"difference",
")",
"between",
"the",
"given",
"values",
"when",
"they",
"are",
"interpreted",
"as",
"points",
"on",
"a",
"circle",
"with",
"the",
"given",
"size",
"(",
"that",
"is",
"circumference",
")",
".",
... | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/MathUtils.java#L71-L77 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlLinkedList.java | HsqlLinkedList.set | public Object set(int index, Object element) {
Node setMe = getInternal(index);
Object oldData = setMe.data;
setMe.data = element;
return oldData;
} | java | public Object set(int index, Object element) {
Node setMe = getInternal(index);
Object oldData = setMe.data;
setMe.data = element;
return oldData;
} | [
"public",
"Object",
"set",
"(",
"int",
"index",
",",
"Object",
"element",
")",
"{",
"Node",
"setMe",
"=",
"getInternal",
"(",
"index",
")",
";",
"Object",
"oldData",
"=",
"setMe",
".",
"data",
";",
"setMe",
".",
"data",
"=",
"element",
";",
"return",
... | Replaces the current element at <code>index/code> with
<code>element</code>.
@return The current element at <code>index</code>. | [
"Replaces",
"the",
"current",
"element",
"at",
"<code",
">",
"index",
"/",
"code",
">",
"with",
"<code",
">",
"element<",
"/",
"code",
">",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlLinkedList.java#L199-L207 |
weld/core | impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java | BeanDeployer.addClass | public BeanDeployer addClass(String className, AnnotatedTypeLoader loader) {
addIfNotNull(loader.loadAnnotatedType(className, getManager().getId()));
return this;
} | java | public BeanDeployer addClass(String className, AnnotatedTypeLoader loader) {
addIfNotNull(loader.loadAnnotatedType(className, getManager().getId()));
return this;
} | [
"public",
"BeanDeployer",
"addClass",
"(",
"String",
"className",
",",
"AnnotatedTypeLoader",
"loader",
")",
"{",
"addIfNotNull",
"(",
"loader",
".",
"loadAnnotatedType",
"(",
"className",
",",
"getManager",
"(",
")",
".",
"getId",
"(",
")",
")",
")",
";",
"... | Loads a given class, creates a {@link SlimAnnotatedTypeContext} for it and stores it in {@link BeanDeployerEnvironment}. | [
"Loads",
"a",
"given",
"class",
"creates",
"a",
"{"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java#L86-L89 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java | CmsDefaultLinkSubstitutionHandler.getTargetSiteRoot | private String getTargetSiteRoot(CmsObject cms, String path, String basePath) {
if (OpenCms.getSiteManager().startsWithShared(path) || path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) {
return null;
}
String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(path);
if ((targetSiteRoot == null) && (basePath != null)) {
targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(basePath);
}
if (targetSiteRoot == null) {
targetSiteRoot = cms.getRequestContext().getSiteRoot();
}
return targetSiteRoot;
} | java | private String getTargetSiteRoot(CmsObject cms, String path, String basePath) {
if (OpenCms.getSiteManager().startsWithShared(path) || path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) {
return null;
}
String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(path);
if ((targetSiteRoot == null) && (basePath != null)) {
targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(basePath);
}
if (targetSiteRoot == null) {
targetSiteRoot = cms.getRequestContext().getSiteRoot();
}
return targetSiteRoot;
} | [
"private",
"String",
"getTargetSiteRoot",
"(",
"CmsObject",
"cms",
",",
"String",
"path",
",",
"String",
"basePath",
")",
"{",
"if",
"(",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"startsWithShared",
"(",
"path",
")",
"||",
"path",
".",
"startsWith",
... | Returns the target site for the given path.<p>
@param cms the cms context
@param path the path
@param basePath the base path
@return the target site | [
"Returns",
"the",
"target",
"site",
"for",
"the",
"given",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java#L790-L803 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java | ImageLoader.displayImage | public void displayImage(String uri, ImageView imageView, DisplayImageOptions options) {
displayImage(uri, new ImageViewAware(imageView), options, null, null);
} | java | public void displayImage(String uri, ImageView imageView, DisplayImageOptions options) {
displayImage(uri, new ImageViewAware(imageView), options, null, null);
} | [
"public",
"void",
"displayImage",
"(",
"String",
"uri",
",",
"ImageView",
"imageView",
",",
"DisplayImageOptions",
"options",
")",
"{",
"displayImage",
"(",
"uri",
",",
"new",
"ImageViewAware",
"(",
"imageView",
")",
",",
"options",
",",
"null",
",",
"null",
... | Adds display image task to execution pool. Image will be set to ImageView when it's turn.<br />
<b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
@param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
@param imageView {@link ImageView} which should display image
@param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image
decoding and displaying. If <b>null</b> - default display image options
{@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions)
from configuration} will be used.
@throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
@throws IllegalArgumentException if passed <b>imageView</b> is null | [
"Adds",
"display",
"image",
"task",
"to",
"execution",
"pool",
".",
"Image",
"will",
"be",
"set",
"to",
"ImageView",
"when",
"it",
"s",
"turn",
".",
"<br",
"/",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"{",
"@link",
"#init",
"(",
"ImageLoad... | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L347-L349 |
MGunlogson/CuckooFilter4J | src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java | Utils.getBitsPerItemForFpRate | static int getBitsPerItemForFpRate(double fpProb,double loadFactor) {
/*
* equation from Cuckoo Filter: Practically Better Than Bloom Bin Fan,
* David G. Andersen, Michael Kaminsky , Michael D. Mitzenmacher
*/
return DoubleMath.roundToInt(DoubleMath.log2((1 / fpProb) + 3) / loadFactor, RoundingMode.UP);
} | java | static int getBitsPerItemForFpRate(double fpProb,double loadFactor) {
/*
* equation from Cuckoo Filter: Practically Better Than Bloom Bin Fan,
* David G. Andersen, Michael Kaminsky , Michael D. Mitzenmacher
*/
return DoubleMath.roundToInt(DoubleMath.log2((1 / fpProb) + 3) / loadFactor, RoundingMode.UP);
} | [
"static",
"int",
"getBitsPerItemForFpRate",
"(",
"double",
"fpProb",
",",
"double",
"loadFactor",
")",
"{",
"/*\r\n\t\t * equation from Cuckoo Filter: Practically Better Than Bloom Bin Fan,\r\n\t\t * David G. Andersen, Michael Kaminsky , Michael D. Mitzenmacher\r\n\t\t */",
"return",
"Doub... | Calculates how many bits are needed to reach a given false positive rate.
@param fpProb
the false positive probability.
@return the length of the tag needed (in bits) to reach the false
positive rate. | [
"Calculates",
"how",
"many",
"bits",
"are",
"needed",
"to",
"reach",
"a",
"given",
"false",
"positive",
"rate",
"."
] | train | https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java#L148-L154 |
ironjacamar/ironjacamar | web/src/main/java/org/ironjacamar/web/console/HtmlAdaptorServlet.java | HtmlAdaptorServlet.displayMBeans | private void displayMBeans(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
Iterator mbeans;
try
{
mbeans = getDomainData();
}
catch (Exception e)
{
throw new ServletException("Failed to get MBeans", e);
}
request.setAttribute("mbeans", mbeans);
RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/displaymbeans.jsp");
rd.forward(request, response);
} | java | private void displayMBeans(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
Iterator mbeans;
try
{
mbeans = getDomainData();
}
catch (Exception e)
{
throw new ServletException("Failed to get MBeans", e);
}
request.setAttribute("mbeans", mbeans);
RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/displaymbeans.jsp");
rd.forward(request, response);
} | [
"private",
"void",
"displayMBeans",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"Iterator",
"mbeans",
";",
"try",
"{",
"mbeans",
"=",
"getDomainData",
"(",
")",
";",
"}",... | Display all MBeans
@param request The HTTP request
@param response The HTTP response
@exception ServletException Thrown if an error occurs
@exception IOException Thrown if an I/O error occurs | [
"Display",
"all",
"MBeans"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/console/HtmlAdaptorServlet.java#L148-L165 |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/graph/MoreGraphs.java | MoreGraphs.orderedTopologicalSort | public static <T> @NonNull List<T> orderedTopologicalSort(final @NonNull Graph<T> graph, final @NonNull Comparator<T> comparator) {
return topologicalSort(graph, new ComparatorSortType<>(comparator));
} | java | public static <T> @NonNull List<T> orderedTopologicalSort(final @NonNull Graph<T> graph, final @NonNull Comparator<T> comparator) {
return topologicalSort(graph, new ComparatorSortType<>(comparator));
} | [
"public",
"static",
"<",
"T",
">",
"@",
"NonNull",
"List",
"<",
"T",
">",
"orderedTopologicalSort",
"(",
"final",
"@",
"NonNull",
"Graph",
"<",
"T",
">",
"graph",
",",
"final",
"@",
"NonNull",
"Comparator",
"<",
"T",
">",
"comparator",
")",
"{",
"retur... | Sorts a directed acyclic graph into a list.
<p>The particular order of elements without prerequisites is determined by the comparator.</p>
@param graph the graph to be sorted
@param comparator the comparator
@param <T> the node type
@return the sorted list
@throws CyclePresentException if the graph has cycles
@throws IllegalArgumentException if the graph is not directed or allows self loops | [
"Sorts",
"a",
"directed",
"acyclic",
"graph",
"into",
"a",
"list",
"."
] | train | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/graph/MoreGraphs.java#L72-L74 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.getAndDecryptDouble | public Double getAndDecryptDouble(String name, String providerName) throws Exception {
//let it fail in the more general case where it isn't actually a number
Number number = (Number) getAndDecrypt(name, providerName);
if (number == null) {
return null;
} else if (number instanceof Double) {
return (Double) number;
} else {
return number.doubleValue(); //autoboxing to Double
}
} | java | public Double getAndDecryptDouble(String name, String providerName) throws Exception {
//let it fail in the more general case where it isn't actually a number
Number number = (Number) getAndDecrypt(name, providerName);
if (number == null) {
return null;
} else if (number instanceof Double) {
return (Double) number;
} else {
return number.doubleValue(); //autoboxing to Double
}
} | [
"public",
"Double",
"getAndDecryptDouble",
"(",
"String",
"name",
",",
"String",
"providerName",
")",
"throws",
"Exception",
"{",
"//let it fail in the more general case where it isn't actually a number",
"Number",
"number",
"=",
"(",
"Number",
")",
"getAndDecrypt",
"(",
... | Retrieves the value from the field name and casts it to {@link Double}.
Note that if value was stored as another numerical type, some truncation or rounding may occur.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name the name of the field.
@param providerName the crypto provider name for decryption
@return the result or null if it does not exist. | [
"Retrieves",
"the",
"value",
"from",
"the",
"field",
"name",
"and",
"casts",
"it",
"to",
"{",
"@link",
"Double",
"}",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L599-L609 |
alkacon/opencms-core | src/org/opencms/file/CmsLinkRewriter.java | CmsLinkRewriter.getConfiguredEncoding | protected String getConfiguredEncoding(CmsObject cms, CmsResource resource) throws CmsException {
String encoding = null;
try {
encoding = cms.readPropertyObject(
resource.getRootPath(),
CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
true).getValue();
} catch (CmsException e) {
// encoding will be null
}
if (encoding == null) {
encoding = OpenCms.getSystemInfo().getDefaultEncoding();
} else {
encoding = CmsEncoder.lookupEncoding(encoding, null);
if (encoding == null) {
throw new CmsXmlException(
Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ENC_1, resource.getRootPath()));
}
}
return encoding;
} | java | protected String getConfiguredEncoding(CmsObject cms, CmsResource resource) throws CmsException {
String encoding = null;
try {
encoding = cms.readPropertyObject(
resource.getRootPath(),
CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
true).getValue();
} catch (CmsException e) {
// encoding will be null
}
if (encoding == null) {
encoding = OpenCms.getSystemInfo().getDefaultEncoding();
} else {
encoding = CmsEncoder.lookupEncoding(encoding, null);
if (encoding == null) {
throw new CmsXmlException(
Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ENC_1, resource.getRootPath()));
}
}
return encoding;
} | [
"protected",
"String",
"getConfiguredEncoding",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"String",
"encoding",
"=",
"null",
";",
"try",
"{",
"encoding",
"=",
"cms",
".",
"readPropertyObject",
"(",
"resource",
"... | Gets the encoding which is configured at the location of a given resource.<p>
@param cms the current CMS context
@param resource the resource for which the configured encoding should be retrieved
@return the configured encoding for the resource
@throws CmsException if something goes wrong | [
"Gets",
"the",
"encoding",
"which",
"is",
"configured",
"at",
"the",
"location",
"of",
"a",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsLinkRewriter.java#L402-L423 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/OptionGroup.java | OptionGroup.setSelected | public void setSelected(Option option) throws AlreadySelectedException
{
if (option == null)
{
// reset the option previously selected
selected = null;
return;
}
// if no option has already been selected or the
// same option is being reselected then set the
// selected member variable
if (selected == null || selected.equals(option.getKey()))
{
selected = option.getKey();
}
else
{
throw new AlreadySelectedException(this, option);
}
} | java | public void setSelected(Option option) throws AlreadySelectedException
{
if (option == null)
{
// reset the option previously selected
selected = null;
return;
}
// if no option has already been selected or the
// same option is being reselected then set the
// selected member variable
if (selected == null || selected.equals(option.getKey()))
{
selected = option.getKey();
}
else
{
throw new AlreadySelectedException(this, option);
}
} | [
"public",
"void",
"setSelected",
"(",
"Option",
"option",
")",
"throws",
"AlreadySelectedException",
"{",
"if",
"(",
"option",
"==",
"null",
")",
"{",
"// reset the option previously selected",
"selected",
"=",
"null",
";",
"return",
";",
"}",
"// if no option has a... | Set the selected option of this group to <code>name</code>.
@param option the option that is selected
@throws AlreadySelectedException if an option from this group has
already been selected. | [
"Set",
"the",
"selected",
"option",
"of",
"this",
"group",
"to",
"<code",
">",
"name<",
"/",
"code",
">",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/OptionGroup.java#L86-L106 |
alkacon/opencms-core | src/org/opencms/main/CmsEventManager.java | CmsEventManager.fireEvent | public void fireEvent(int type, Map<String, Object> data) {
fireEvent(new CmsEvent(type, data));
} | java | public void fireEvent(int type, Map<String, Object> data) {
fireEvent(new CmsEvent(type, data));
} | [
"public",
"void",
"fireEvent",
"(",
"int",
"type",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"{",
"fireEvent",
"(",
"new",
"CmsEvent",
"(",
"type",
",",
"data",
")",
")",
";",
"}"
] | Notify all event listeners that a particular event has occurred.<p>
@param type event type
@param data event data | [
"Notify",
"all",
"event",
"listeners",
"that",
"a",
"particular",
"event",
"has",
"occurred",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsEventManager.java#L137-L140 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java | Functions.randomString | public static String randomString(Long numberOfLetters, String notationMethod, boolean useNumbers, TestContext context) {
return new RandomStringFunction().execute(Arrays.asList(String.valueOf(numberOfLetters), notationMethod, String.valueOf(useNumbers)), context);
} | java | public static String randomString(Long numberOfLetters, String notationMethod, boolean useNumbers, TestContext context) {
return new RandomStringFunction().execute(Arrays.asList(String.valueOf(numberOfLetters), notationMethod, String.valueOf(useNumbers)), context);
} | [
"public",
"static",
"String",
"randomString",
"(",
"Long",
"numberOfLetters",
",",
"String",
"notationMethod",
",",
"boolean",
"useNumbers",
",",
"TestContext",
"context",
")",
"{",
"return",
"new",
"RandomStringFunction",
"(",
")",
".",
"execute",
"(",
"Arrays",
... | Runs random string function with arguments.
@param numberOfLetters
@param notationMethod
@param useNumbers
@return | [
"Runs",
"random",
"string",
"function",
"with",
"arguments",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L208-L210 |
lessthanoptimal/ddogleg | src/org/ddogleg/solver/PolynomialOps.java | PolynomialOps.createRootFinder | public static PolynomialRoots createRootFinder( int maxCoefficients , RootFinderType which ) {
switch( which ) {
case STURM:
FindRealRootsSturm sturm = new FindRealRootsSturm(maxCoefficients,-1,1e-10,200,200);
return new WrapRealRootsSturm(sturm);
case EVD:
return new RootFinderCompanion();
default:
throw new IllegalArgumentException("Unknown algorithm: "+which);
}
} | java | public static PolynomialRoots createRootFinder( int maxCoefficients , RootFinderType which ) {
switch( which ) {
case STURM:
FindRealRootsSturm sturm = new FindRealRootsSturm(maxCoefficients,-1,1e-10,200,200);
return new WrapRealRootsSturm(sturm);
case EVD:
return new RootFinderCompanion();
default:
throw new IllegalArgumentException("Unknown algorithm: "+which);
}
} | [
"public",
"static",
"PolynomialRoots",
"createRootFinder",
"(",
"int",
"maxCoefficients",
",",
"RootFinderType",
"which",
")",
"{",
"switch",
"(",
"which",
")",
"{",
"case",
"STURM",
":",
"FindRealRootsSturm",
"sturm",
"=",
"new",
"FindRealRootsSturm",
"(",
"maxCo... | Creates different polynomial root finders.
@param maxCoefficients The maximum number of coefficients that will be processed. This is the order + 1
@param which 0 = Sturm and 1 = companion matrix.
@return PolynomialRoots | [
"Creates",
"different",
"polynomial",
"root",
"finders",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/PolynomialOps.java#L229-L241 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java | MediaservicesInner.getByResourceGroupAsync | public Observable<MediaServiceInner> getByResourceGroupAsync(String resourceGroupName, String accountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() {
@Override
public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) {
return response.body();
}
});
} | java | public Observable<MediaServiceInner> getByResourceGroupAsync(String resourceGroupName, String accountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() {
@Override
public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"MediaServiceInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"m... | Get a Media Services account.
Get the details of a Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the MediaServiceInner object | [
"Get",
"a",
"Media",
"Services",
"account",
".",
"Get",
"the",
"details",
"of",
"a",
"Media",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java#L269-L276 |
amzn/ion-java | src/com/amazon/ion/util/IonStreamUtils.java | IonStreamUtils.writeIntList | public static void writeIntList(IonWriter writer, byte[] values)
throws IOException
{
if (writer instanceof _Private_ListWriter) {
((_Private_ListWriter)writer).writeIntList(values);
return;
}
writer.stepIn(IonType.LIST);
for (int ii=0; ii<values.length; ii++) {
writer.writeInt(values[ii]);
}
writer.stepOut();
} | java | public static void writeIntList(IonWriter writer, byte[] values)
throws IOException
{
if (writer instanceof _Private_ListWriter) {
((_Private_ListWriter)writer).writeIntList(values);
return;
}
writer.stepIn(IonType.LIST);
for (int ii=0; ii<values.length; ii++) {
writer.writeInt(values[ii]);
}
writer.stepOut();
} | [
"public",
"static",
"void",
"writeIntList",
"(",
"IonWriter",
"writer",
",",
"byte",
"[",
"]",
"values",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"instanceof",
"_Private_ListWriter",
")",
"{",
"(",
"(",
"_Private_ListWriter",
")",
"writer",
")",... | writes an IonList with a series of IonInt values. This
starts a List, writes the values (without any annoations)
and closes the list. For text and tree writers this is
just a convienience, but for the binary writer it can be
optimized internally.
@param values signed byte values to populate the lists int's with | [
"writes",
"an",
"IonList",
"with",
"a",
"series",
"of",
"IonInt",
"values",
".",
"This",
"starts",
"a",
"List",
"writes",
"the",
"values",
"(",
"without",
"any",
"annoations",
")",
"and",
"closes",
"the",
"list",
".",
"For",
"text",
"and",
"tree",
"write... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonStreamUtils.java#L210-L223 |
hawtio/hawtio | hawtio-system/src/main/java/io/hawt/jmx/RBACRegistry.java | RBACRegistry.tryAddRBACInfo | @SuppressWarnings("unchecked")
private void tryAddRBACInfo(Map<String, Object> result) throws MBeanException, InstanceNotFoundException, ReflectionException {
if (mBeanServer != null && mBeanServer.isRegistered(rbacDecorator)) {
mBeanServer.invoke(rbacDecorator, "decorate", new Object[] { result }, new String[] { Map.class.getName() });
}
} | java | @SuppressWarnings("unchecked")
private void tryAddRBACInfo(Map<String, Object> result) throws MBeanException, InstanceNotFoundException, ReflectionException {
if (mBeanServer != null && mBeanServer.isRegistered(rbacDecorator)) {
mBeanServer.invoke(rbacDecorator, "decorate", new Object[] { result }, new String[] { Map.class.getName() });
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"tryAddRBACInfo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"throws",
"MBeanException",
",",
"InstanceNotFoundException",
",",
"ReflectionException",
"{",
"if",
"(",
"mBeanS... | If we have access to <code>hawtio:type=security,area=jolokia,name=RBACDecorator</code>,
we can add RBAC information
@param result | [
"If",
"we",
"have",
"access",
"to",
"<code",
">",
"hawtio",
":",
"type",
"=",
"security",
"area",
"=",
"jolokia",
"name",
"=",
"RBACDecorator<",
"/",
"code",
">",
"we",
"can",
"add",
"RBAC",
"information"
] | train | https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-system/src/main/java/io/hawt/jmx/RBACRegistry.java#L311-L316 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.infov | public void infov(String format, Object... params) {
doLog(Level.INFO, FQCN, format, params, null);
} | java | public void infov(String format, Object... params) {
doLog(Level.INFO, FQCN, format, params, null);
} | [
"public",
"void",
"infov",
"(",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLog",
"(",
"Level",
".",
"INFO",
",",
"FQCN",
",",
"format",
",",
"params",
",",
"null",
")",
";",
"}"
] | Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param params the parameters | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"INFO",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1022-L1024 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java | StringUtils.requireNotNullOrEmpty | @Deprecated
public static <CS extends CharSequence> CS requireNotNullOrEmpty(CS cs, String message) {
return requireNotNullNorEmpty(cs, message);
} | java | @Deprecated
public static <CS extends CharSequence> CS requireNotNullOrEmpty(CS cs, String message) {
return requireNotNullNorEmpty(cs, message);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"CS",
"extends",
"CharSequence",
">",
"CS",
"requireNotNullOrEmpty",
"(",
"CS",
"cs",
",",
"String",
"message",
")",
"{",
"return",
"requireNotNullNorEmpty",
"(",
"cs",
",",
"message",
")",
";",
"}"
] | Require a {@link CharSequence} to be neither null, nor empty.
@deprecated use {@link #requireNotNullNorEmpty(CharSequence, String)} instead.
@param cs CharSequence
@param message error message
@param <CS> CharSequence type
@return cs | [
"Require",
"a",
"{",
"@link",
"CharSequence",
"}",
"to",
"be",
"neither",
"null",
"nor",
"empty",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L436-L439 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java | WidgetFactory.createWidget | @SuppressWarnings("unchecked")
static Widget createWidget(final GVRSceneObject sceneObject)
throws InstantiationException {
Class<? extends Widget> widgetClass = GroupWidget.class;
NodeEntry attributes = new NodeEntry(sceneObject);
String className = attributes.getClassName();
if (className != null) {
try {
widgetClass = (Class<? extends Widget>) Class
.forName(className);
} catch (ClassNotFoundException e) {
e.printStackTrace();
Log.e(TAG, e, "createWidget()");
throw new InstantiationException(e.getLocalizedMessage());
}
}
Log.d(TAG, "createWidget(): widgetClass: %s",
widgetClass.getSimpleName());
return createWidget(sceneObject, attributes, widgetClass);
} | java | @SuppressWarnings("unchecked")
static Widget createWidget(final GVRSceneObject sceneObject)
throws InstantiationException {
Class<? extends Widget> widgetClass = GroupWidget.class;
NodeEntry attributes = new NodeEntry(sceneObject);
String className = attributes.getClassName();
if (className != null) {
try {
widgetClass = (Class<? extends Widget>) Class
.forName(className);
} catch (ClassNotFoundException e) {
e.printStackTrace();
Log.e(TAG, e, "createWidget()");
throw new InstantiationException(e.getLocalizedMessage());
}
}
Log.d(TAG, "createWidget(): widgetClass: %s",
widgetClass.getSimpleName());
return createWidget(sceneObject, attributes, widgetClass);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"Widget",
"createWidget",
"(",
"final",
"GVRSceneObject",
"sceneObject",
")",
"throws",
"InstantiationException",
"{",
"Class",
"<",
"?",
"extends",
"Widget",
">",
"widgetClass",
"=",
"GroupWidget",
".",
... | Create a {@link Widget} to wrap the specified {@link GVRSceneObject}. By
default, {@code sceneObject} is wrapped in an {@link GroupWidget}. If
another {@code Widget} class is specified in {@code sceneObject}'s
metadata (as "{@code class_WidgetClassName}"), it will be wrapped in an
instance of the specified class instead.
@see NameDemangler#demangleString(String)
@param sceneObject
The {@code GVRSceneObject} to wrap.
@return A new {@code Widget} instance.
@throws InstantiationException
If the {@code Widget} can't be instantiated for any reason. | [
"Create",
"a",
"{",
"@link",
"Widget",
"}",
"to",
"wrap",
"the",
"specified",
"{",
"@link",
"GVRSceneObject",
"}",
".",
"By",
"default",
"{",
"@code",
"sceneObject",
"}",
"is",
"wrapped",
"in",
"an",
"{",
"@link",
"GroupWidget",
"}",
".",
"If",
"another"... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java#L33-L54 |
haifengl/smile | math/src/main/java/smile/math/matrix/BiconjugateGradient.java | BiconjugateGradient.diagonalPreconditioner | private static Preconditioner diagonalPreconditioner(Matrix A) {
return new Preconditioner() {
public void asolve(double[] b, double[] x) {
double[] diag = A.diag();
int n = diag.length;
for (int i = 0; i < n; i++) {
x[i] = diag[i] != 0.0 ? b[i] / diag[i] : b[i];
}
}
};
} | java | private static Preconditioner diagonalPreconditioner(Matrix A) {
return new Preconditioner() {
public void asolve(double[] b, double[] x) {
double[] diag = A.diag();
int n = diag.length;
for (int i = 0; i < n; i++) {
x[i] = diag[i] != 0.0 ? b[i] / diag[i] : b[i];
}
}
};
} | [
"private",
"static",
"Preconditioner",
"diagonalPreconditioner",
"(",
"Matrix",
"A",
")",
"{",
"return",
"new",
"Preconditioner",
"(",
")",
"{",
"public",
"void",
"asolve",
"(",
"double",
"[",
"]",
"b",
",",
"double",
"[",
"]",
"x",
")",
"{",
"double",
"... | Returns a simple preconditioner matrix that is the
trivial diagonal part of A in some cases. | [
"Returns",
"a",
"simple",
"preconditioner",
"matrix",
"that",
"is",
"the",
"trivial",
"diagonal",
"part",
"of",
"A",
"in",
"some",
"cases",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/BiconjugateGradient.java#L35-L46 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/borland/BorlandProcessor.java | BorlandProcessor.prepareResponseFile | public static String[] prepareResponseFile(final File outputFile, final String[] args, final String continuation)
throws IOException {
final String baseName = outputFile.getName();
final File commandFile = new File(outputFile.getParent(), baseName + ".rsp");
final FileWriter writer = new FileWriter(commandFile);
for (int i = 1; i < args.length - 1; i++) {
writer.write(args[i]);
//
// if either the current argument ends with
// or next argument starts with a comma then
// don't split the line
if (args[i].endsWith(",") || args[i + 1].startsWith(",")) {
writer.write(' ');
} else {
//
// split the line to make it more readable
//
writer.write(continuation);
}
}
//
// write the last argument
//
if (args.length > 1) {
writer.write(args[args.length - 1]);
}
writer.close();
final String[] execArgs = new String[2];
execArgs[0] = args[0];
//
// left for the caller to decorate
execArgs[1] = commandFile.toString();
return execArgs;
} | java | public static String[] prepareResponseFile(final File outputFile, final String[] args, final String continuation)
throws IOException {
final String baseName = outputFile.getName();
final File commandFile = new File(outputFile.getParent(), baseName + ".rsp");
final FileWriter writer = new FileWriter(commandFile);
for (int i = 1; i < args.length - 1; i++) {
writer.write(args[i]);
//
// if either the current argument ends with
// or next argument starts with a comma then
// don't split the line
if (args[i].endsWith(",") || args[i + 1].startsWith(",")) {
writer.write(' ');
} else {
//
// split the line to make it more readable
//
writer.write(continuation);
}
}
//
// write the last argument
//
if (args.length > 1) {
writer.write(args[args.length - 1]);
}
writer.close();
final String[] execArgs = new String[2];
execArgs[0] = args[0];
//
// left for the caller to decorate
execArgs[1] = commandFile.toString();
return execArgs;
} | [
"public",
"static",
"String",
"[",
"]",
"prepareResponseFile",
"(",
"final",
"File",
"outputFile",
",",
"final",
"String",
"[",
"]",
"args",
",",
"final",
"String",
"continuation",
")",
"throws",
"IOException",
"{",
"final",
"String",
"baseName",
"=",
"outputF... | Prepares argument list to execute the linker using a response file.
@param outputFile
linker output file
@param args
output of prepareArguments
@return arguments for runTask | [
"Prepares",
"argument",
"list",
"to",
"execute",
"the",
"linker",
"using",
"a",
"response",
"file",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/borland/BorlandProcessor.java#L177-L210 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.overTheBox_new_GET | public ArrayList<String> overTheBox_new_GET(String deviceId, String offer, String voucher) throws IOException {
String qPath = "/order/overTheBox/new";
StringBuilder sb = path(qPath);
query(sb, "deviceId", deviceId);
query(sb, "offer", offer);
query(sb, "voucher", voucher);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> overTheBox_new_GET(String deviceId, String offer, String voucher) throws IOException {
String qPath = "/order/overTheBox/new";
StringBuilder sb = path(qPath);
query(sb, "deviceId", deviceId);
query(sb, "offer", offer);
query(sb, "voucher", voucher);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"overTheBox_new_GET",
"(",
"String",
"deviceId",
",",
"String",
"offer",
",",
"String",
"voucher",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/overTheBox/new\"",
";",
"StringBuilder",
"sb",
"=",
... | Get allowed durations for 'new' option
REST: GET /order/overTheBox/new
@param offer [required] Offer name
@param deviceId [required] The id of the device
@param voucher [required] An optional voucher | [
"Get",
"allowed",
"durations",
"for",
"new",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3065-L3073 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java | CacheUnitImpl.addExternalCacheAdapter | public void addExternalCacheAdapter(String groupId, String address, String beanName) throws DynamicCacheServiceNotStarted {
if (servletCacheUnit == null) {
throw new DynamicCacheServiceNotStarted("Servlet cache service has not been started.");
}
servletCacheUnit.addExternalCacheAdapter(groupId, address, beanName);
} | java | public void addExternalCacheAdapter(String groupId, String address, String beanName) throws DynamicCacheServiceNotStarted {
if (servletCacheUnit == null) {
throw new DynamicCacheServiceNotStarted("Servlet cache service has not been started.");
}
servletCacheUnit.addExternalCacheAdapter(groupId, address, beanName);
} | [
"public",
"void",
"addExternalCacheAdapter",
"(",
"String",
"groupId",
",",
"String",
"address",
",",
"String",
"beanName",
")",
"throws",
"DynamicCacheServiceNotStarted",
"{",
"if",
"(",
"servletCacheUnit",
"==",
"null",
")",
"{",
"throw",
"new",
"DynamicCacheServi... | This implements the method in the CacheUnit interface.
This is delegated to the ExternalCacheServices.
It calls ServletCacheUnit to perform this operation.
@param groupId The external cache group id.
@param address The IP address of the target external cache.
@param beanName The bean name (bean instance or class) of
the ExternalCacheAdaptor that can deal with the protocol of the
target external cache. | [
"This",
"implements",
"the",
"method",
"in",
"the",
"CacheUnit",
"interface",
".",
"This",
"is",
"delegated",
"to",
"the",
"ExternalCacheServices",
".",
"It",
"calls",
"ServletCacheUnit",
"to",
"perform",
"this",
"operation",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java#L216-L221 |
albfernandez/itext2 | src/main/java/com/lowagie/text/html/HtmlPeer.java | HtmlPeer.addAlias | public void addAlias(String name, String alias) {
attributeAliases.put(alias.toLowerCase(), name);
} | java | public void addAlias(String name, String alias) {
attributeAliases.put(alias.toLowerCase(), name);
} | [
"public",
"void",
"addAlias",
"(",
"String",
"name",
",",
"String",
"alias",
")",
"{",
"attributeAliases",
".",
"put",
"(",
"alias",
".",
"toLowerCase",
"(",
")",
",",
"name",
")",
";",
"}"
] | Sets an alias for an attribute.
@param name
the iText tagname
@param alias
the custom tagname | [
"Sets",
"an",
"alias",
"for",
"an",
"attribute",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/html/HtmlPeer.java#L87-L89 |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addContextToVerb | public boolean addContextToVerb(String objectType, String id, String description)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
if (id != null)
{
container.put("id", id);
}
if (description != null)
{
container.put("description", description);
}
String[] pathKeys = {"verb"};
return addChild("context", container, pathKeys);
} | java | public boolean addContextToVerb(String objectType, String id, String description)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
if (id != null)
{
container.put("id", id);
}
if (description != null)
{
container.put("description", description);
}
String[] pathKeys = {"verb"};
return addChild("context", container, pathKeys);
} | [
"public",
"boolean",
"addContextToVerb",
"(",
"String",
"objectType",
",",
"String",
"id",
",",
"String",
"description",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
... | Add a context object to the verb within this activity
@param objectType The type of context
@param id The id of the context
@param description Description of the context
@return True if added, false if not (due to lack of "verb") | [
"Add",
"a",
"context",
"object",
"to",
"the",
"verb",
"within",
"this",
"activity"
] | train | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L238-L257 |
iipc/openwayback-access-control | oracle/src/main/java/org/archive/accesscontrol/oracle/RulesController.java | RulesController.getRules | public ModelAndView getRules(HttpServletRequest request, HttpServletResponse response, boolean isHead) throws UnsupportedEncodingException, ParseException {
String prefix = request.getParameter("prefix");
if (prefix != null) {
return new ModelAndView(view, "object", ruleDao.getRulesWithSurtPrefix(prefix));
}
String surt = request.getParameter("surt");
if (surt != null) {
return new ModelAndView(view, "object", ruleDao.getRulesWithExactSurt(surt));
}
List<Rule> rules = null;
String modifiedAfter = request.getParameter("modifiedAfter");
String who = request.getParameter("who");
if (modifiedAfter != null || who != null) {
rules = ruleDao.getRulesModifiedAfter(modifiedAfter, who, view.getCustomRestrict());
}
if (rules == null) {
rules = ruleDao.getAllRules();
}
response.addIntHeader(HttpRuleDao.ORACLE_NUM_RULES, rules.size());
return new ModelAndView(view, "object", rules);
} | java | public ModelAndView getRules(HttpServletRequest request, HttpServletResponse response, boolean isHead) throws UnsupportedEncodingException, ParseException {
String prefix = request.getParameter("prefix");
if (prefix != null) {
return new ModelAndView(view, "object", ruleDao.getRulesWithSurtPrefix(prefix));
}
String surt = request.getParameter("surt");
if (surt != null) {
return new ModelAndView(view, "object", ruleDao.getRulesWithExactSurt(surt));
}
List<Rule> rules = null;
String modifiedAfter = request.getParameter("modifiedAfter");
String who = request.getParameter("who");
if (modifiedAfter != null || who != null) {
rules = ruleDao.getRulesModifiedAfter(modifiedAfter, who, view.getCustomRestrict());
}
if (rules == null) {
rules = ruleDao.getAllRules();
}
response.addIntHeader(HttpRuleDao.ORACLE_NUM_RULES, rules.size());
return new ModelAndView(view, "object", rules);
} | [
"public",
"ModelAndView",
"getRules",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"boolean",
"isHead",
")",
"throws",
"UnsupportedEncodingException",
",",
"ParseException",
"{",
"String",
"prefix",
"=",
"request",
".",
"getParamete... | protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | [
"protected",
"SimpleDateFormat",
"dateFormat",
"=",
"new",
"SimpleDateFormat",
"(",
"yyyy",
"-",
"MM",
"-",
"dd",
"HH",
":",
"mm",
":",
"ss",
")",
";"
] | train | https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/oracle/src/main/java/org/archive/accesscontrol/oracle/RulesController.java#L216-L243 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java | JUnit3FloatingPointComparisonWithoutDelta.canBeConvertedToJUnit4 | private boolean canBeConvertedToJUnit4(VisitorState state, List<Type> argumentTypes) {
// Delta argument is used.
if (argumentTypes.size() > 2) {
return true;
}
Type firstType = argumentTypes.get(0);
Type secondType = argumentTypes.get(1);
// Neither argument is floating-point.
if (!isFloatingPoint(state, firstType) && !isFloatingPoint(state, secondType)) {
return true;
}
// One argument is not numeric.
if (!isNumeric(state, firstType) || !isNumeric(state, secondType)) {
return true;
}
// Neither argument is primitive.
if (!firstType.isPrimitive() && !secondType.isPrimitive()) {
return true;
}
return false;
} | java | private boolean canBeConvertedToJUnit4(VisitorState state, List<Type> argumentTypes) {
// Delta argument is used.
if (argumentTypes.size() > 2) {
return true;
}
Type firstType = argumentTypes.get(0);
Type secondType = argumentTypes.get(1);
// Neither argument is floating-point.
if (!isFloatingPoint(state, firstType) && !isFloatingPoint(state, secondType)) {
return true;
}
// One argument is not numeric.
if (!isNumeric(state, firstType) || !isNumeric(state, secondType)) {
return true;
}
// Neither argument is primitive.
if (!firstType.isPrimitive() && !secondType.isPrimitive()) {
return true;
}
return false;
} | [
"private",
"boolean",
"canBeConvertedToJUnit4",
"(",
"VisitorState",
"state",
",",
"List",
"<",
"Type",
">",
"argumentTypes",
")",
"{",
"// Delta argument is used.",
"if",
"(",
"argumentTypes",
".",
"size",
"(",
")",
">",
"2",
")",
"{",
"return",
"true",
";",
... | Determines if the invocation can be safely converted to JUnit 4 based on its argument types. | [
"Determines",
"if",
"the",
"invocation",
"can",
"be",
"safely",
"converted",
"to",
"JUnit",
"4",
"based",
"on",
"its",
"argument",
"types",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java#L102-L122 |
UrielCh/ovh-java-sdk | ovh-java-sdk-distributionimage/src/main/java/net/minidev/ovh/api/ApiOvhDistributionimage.java | ApiOvhDistributionimage.serviceType_GET | public ArrayList<String> serviceType_GET(net.minidev.ovh.api.distribution.image.OvhService serviceType) throws IOException {
String qPath = "/distribution/image/{serviceType}";
StringBuilder sb = path(qPath, serviceType);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> serviceType_GET(net.minidev.ovh.api.distribution.image.OvhService serviceType) throws IOException {
String qPath = "/distribution/image/{serviceType}";
StringBuilder sb = path(qPath, serviceType);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"serviceType_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"distribution",
".",
"image",
".",
"OvhService",
"serviceType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/distribution/i... | List images for a service
REST: GET /distribution/image/{serviceType}
@param serviceType [required] service type name
API beta | [
"List",
"images",
"for",
"a",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-distributionimage/src/main/java/net/minidev/ovh/api/ApiOvhDistributionimage.java#L44-L49 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java | XML.addClass | public XML addClass(Class<?> aClass, Global global, Attribute[] attributes){
XmlClass xmlClass = new XmlClass();
xmlClass.name = aClass.getName();
xmlJmapper.classes.add(xmlClass);
if(!isEmpty(attributes)){
xmlClass.attributes = new ArrayList<XmlAttribute>();
addAttributes(aClass, attributes);
}
if(global != null)
addGlobal(aClass, global);
return this;
} | java | public XML addClass(Class<?> aClass, Global global, Attribute[] attributes){
XmlClass xmlClass = new XmlClass();
xmlClass.name = aClass.getName();
xmlJmapper.classes.add(xmlClass);
if(!isEmpty(attributes)){
xmlClass.attributes = new ArrayList<XmlAttribute>();
addAttributes(aClass, attributes);
}
if(global != null)
addGlobal(aClass, global);
return this;
} | [
"public",
"XML",
"addClass",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"Global",
"global",
",",
"Attribute",
"[",
"]",
"attributes",
")",
"{",
"XmlClass",
"xmlClass",
"=",
"new",
"XmlClass",
"(",
")",
";",
"xmlClass",
".",
"name",
"=",
"aClass",
".",... | This method adds aClass with this global mapping and attributes to XML configuration file.<br>
It's mandatory define at least one attribute, global is optional instead.
@param aClass Class to adds
@param global global mapping
@param attributes attributes of Class
@return this instance | [
"This",
"method",
"adds",
"aClass",
"with",
"this",
"global",
"mapping",
"and",
"attributes",
"to",
"XML",
"configuration",
"file",
".",
"<br",
">",
"It",
"s",
"mandatory",
"define",
"at",
"least",
"one",
"attribute",
"global",
"is",
"optional",
"instead",
"... | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L276-L289 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservice_binding.java | sslservice_binding.get | public static sslservice_binding get(nitro_service service, String servicename) throws Exception{
sslservice_binding obj = new sslservice_binding();
obj.set_servicename(servicename);
sslservice_binding response = (sslservice_binding) obj.get_resource(service);
return response;
} | java | public static sslservice_binding get(nitro_service service, String servicename) throws Exception{
sslservice_binding obj = new sslservice_binding();
obj.set_servicename(servicename);
sslservice_binding response = (sslservice_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"sslservice_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"servicename",
")",
"throws",
"Exception",
"{",
"sslservice_binding",
"obj",
"=",
"new",
"sslservice_binding",
"(",
")",
";",
"obj",
".",
"set_servicename",
"(",
"serv... | Use this API to fetch sslservice_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslservice_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservice_binding.java#L136-L141 |
buschmais/jqa-java-plugin | src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java | VisitorHelper.addInvokes | void addInvokes(MethodDescriptor methodDescriptor, final Integer lineNumber, MethodDescriptor invokedMethodDescriptor) {
InvokesDescriptor invokesDescriptor = scannerContext.getStore().create(methodDescriptor, InvokesDescriptor.class, invokedMethodDescriptor);
invokesDescriptor.setLineNumber(lineNumber);
} | java | void addInvokes(MethodDescriptor methodDescriptor, final Integer lineNumber, MethodDescriptor invokedMethodDescriptor) {
InvokesDescriptor invokesDescriptor = scannerContext.getStore().create(methodDescriptor, InvokesDescriptor.class, invokedMethodDescriptor);
invokesDescriptor.setLineNumber(lineNumber);
} | [
"void",
"addInvokes",
"(",
"MethodDescriptor",
"methodDescriptor",
",",
"final",
"Integer",
"lineNumber",
",",
"MethodDescriptor",
"invokedMethodDescriptor",
")",
"{",
"InvokesDescriptor",
"invokesDescriptor",
"=",
"scannerContext",
".",
"getStore",
"(",
")",
".",
"crea... | Add a invokes relation between two methods.
@param methodDescriptor
The invoking method.
@param lineNumber
The line number.
@param invokedMethodDescriptor
The invoked method. | [
"Add",
"a",
"invokes",
"relation",
"between",
"two",
"methods",
"."
] | train | https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L136-L139 |
aoindustries/semanticcms-dia-model | src/main/java/com/semanticcms/dia/model/Dia.java | Dia.getLabel | @Override
public String getLabel() {
String l = label;
if(l != null) return l;
String p = path;
if(p != null) {
String filename = p.substring(p.lastIndexOf('/') + 1);
if(filename.endsWith(DOT_EXTENSION)) filename = filename.substring(0, filename.length() - DOT_EXTENSION.length());
if(filename.isEmpty()) throw new IllegalArgumentException("Invalid filename for diagram: " + p);
return filename;
}
throw new IllegalStateException("Cannot get label, neither label nor path set");
} | java | @Override
public String getLabel() {
String l = label;
if(l != null) return l;
String p = path;
if(p != null) {
String filename = p.substring(p.lastIndexOf('/') + 1);
if(filename.endsWith(DOT_EXTENSION)) filename = filename.substring(0, filename.length() - DOT_EXTENSION.length());
if(filename.isEmpty()) throw new IllegalArgumentException("Invalid filename for diagram: " + p);
return filename;
}
throw new IllegalStateException("Cannot get label, neither label nor path set");
} | [
"@",
"Override",
"public",
"String",
"getLabel",
"(",
")",
"{",
"String",
"l",
"=",
"label",
";",
"if",
"(",
"l",
"!=",
"null",
")",
"return",
"l",
";",
"String",
"p",
"=",
"path",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"{",
"String",
"filename"... | If not set, defaults to the last path segment of path, with any ".dia" extension stripped. | [
"If",
"not",
"set",
"defaults",
"to",
"the",
"last",
"path",
"segment",
"of",
"path",
"with",
"any",
".",
"dia",
"extension",
"stripped",
"."
] | train | https://github.com/aoindustries/semanticcms-dia-model/blob/3855b92a491ccf9c61511604d40b68ed72e5a0a8/src/main/java/com/semanticcms/dia/model/Dia.java#L45-L57 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.addVideoTranscriptModerationResult | public void addVideoTranscriptModerationResult(String teamName, String reviewId, String contentType, List<TranscriptModerationBodyItem> transcriptModerationBody) {
addVideoTranscriptModerationResultWithServiceResponseAsync(teamName, reviewId, contentType, transcriptModerationBody).toBlocking().single().body();
} | java | public void addVideoTranscriptModerationResult(String teamName, String reviewId, String contentType, List<TranscriptModerationBodyItem> transcriptModerationBody) {
addVideoTranscriptModerationResultWithServiceResponseAsync(teamName, reviewId, contentType, transcriptModerationBody).toBlocking().single().body();
} | [
"public",
"void",
"addVideoTranscriptModerationResult",
"(",
"String",
"teamName",
",",
"String",
"reviewId",
",",
"String",
"contentType",
",",
"List",
"<",
"TranscriptModerationBodyItem",
">",
"transcriptModerationBody",
")",
"{",
"addVideoTranscriptModerationResultWithServ... | This API adds a transcript screen text result file for a video review. Transcript screen text result file is a result of Screen Text API . In order to generate transcript screen text result file , a transcript file has to be screened for profanity using Screen Text API.
@param teamName Your team name.
@param reviewId Id of the review.
@param contentType The content type.
@param transcriptModerationBody Body for add video transcript moderation result API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"This",
"API",
"adds",
"a",
"transcript",
"screen",
"text",
"result",
"file",
"for",
"a",
"video",
"review",
".",
"Transcript",
"screen",
"text",
"result",
"file",
"is",
"a",
"result",
"of",
"Screen",
"Text",
"API",
".",
"In",
"order",
"to",
"generate",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1695-L1697 |
twilio/twilio-java | src/main/java/com/twilio/rest/voice/v1/dialingpermissions/CountryReader.java | CountryReader.nextPage | @Override
public Page<Country> nextPage(final Page<Country> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.VOICE.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<Country> nextPage(final Page<Country> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.VOICE.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"Country",
">",
"nextPage",
"(",
"final",
"Page",
"<",
"Country",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
... | Retrieve the next page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Next Page | [
"Retrieve",
"the",
"next",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/voice/v1/dialingpermissions/CountryReader.java#L170-L181 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/StatsApi.java | StatsApi.getCollectionDomains | public Domains getCollectionDomains(Date date, String collectionId, Integer perPage, Integer page) throws JinxException {
JinxUtils.validateParams(date);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.stats.getCollectionDomains");
params.put("date", JinxUtils.formatDateAsYMD(date));
if (!JinxUtils.isNullOrEmpty(collectionId)) {
params.put("collection_id", collectionId);
}
if (perPage != null) {
params.put("per_page", perPage.toString());
}
if (page != null) {
params.put("page", page.toString());
}
return jinx.flickrGet(params, Domains.class);
} | java | public Domains getCollectionDomains(Date date, String collectionId, Integer perPage, Integer page) throws JinxException {
JinxUtils.validateParams(date);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.stats.getCollectionDomains");
params.put("date", JinxUtils.formatDateAsYMD(date));
if (!JinxUtils.isNullOrEmpty(collectionId)) {
params.put("collection_id", collectionId);
}
if (perPage != null) {
params.put("per_page", perPage.toString());
}
if (page != null) {
params.put("page", page.toString());
}
return jinx.flickrGet(params, Domains.class);
} | [
"public",
"Domains",
"getCollectionDomains",
"(",
"Date",
"date",
",",
"String",
"collectionId",
",",
"Integer",
"perPage",
",",
"Integer",
"page",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"date",
")",
";",
"Map",
"<",
"Str... | Get a list of referring domains for a collection
Authentication
This method requires authentication with 'read' permission.
@param date stats will be returned for this date. Required.
@param collectionId id of the collection to get stats for. If not provided,
stats for all collections will be returned. Optional.
@param perPage number of domains to return per page.
If this argument is omitted, it defaults to 25.
The maximum allowed value is 100. Optional.
@param page the page of results to return. If this argument is omitted, it defaults to 1. Optional.
@return referring domains for a collection.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.stats.getCollectionDomains.html">flickr.stats.getCollectionDomains</a> | [
"Get",
"a",
"list",
"of",
"referring",
"domains",
"for",
"a",
"collection"
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/StatsApi.java#L68-L83 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.typeCast | public static Matcher<TypeCastTree> typeCast(
final Matcher<Tree> typeMatcher, final Matcher<ExpressionTree> expressionMatcher) {
return new Matcher<TypeCastTree>() {
@Override
public boolean matches(TypeCastTree t, VisitorState state) {
return typeMatcher.matches(t.getType(), state)
&& expressionMatcher.matches(t.getExpression(), state);
}
};
} | java | public static Matcher<TypeCastTree> typeCast(
final Matcher<Tree> typeMatcher, final Matcher<ExpressionTree> expressionMatcher) {
return new Matcher<TypeCastTree>() {
@Override
public boolean matches(TypeCastTree t, VisitorState state) {
return typeMatcher.matches(t.getType(), state)
&& expressionMatcher.matches(t.getExpression(), state);
}
};
} | [
"public",
"static",
"Matcher",
"<",
"TypeCastTree",
">",
"typeCast",
"(",
"final",
"Matcher",
"<",
"Tree",
">",
"typeMatcher",
",",
"final",
"Matcher",
"<",
"ExpressionTree",
">",
"expressionMatcher",
")",
"{",
"return",
"new",
"Matcher",
"<",
"TypeCastTree",
... | Matches a type cast AST node if both of the given matchers match.
@param typeMatcher The matcher to apply to the type.
@param expressionMatcher The matcher to apply to the expression. | [
"Matches",
"a",
"type",
"cast",
"AST",
"node",
"if",
"both",
"of",
"the",
"given",
"matchers",
"match",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1367-L1376 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java | CollationElementIterator.setText | public void setText(UCharacterIterator source) {
string_ = source.getText(); // TODO: do we need to remember the source string in a field?
// Note: In C++, we just setText(source.getText()).
// In Java, we actually operate on a character iterator.
// (The old code apparently did so only for a CharacterIterator;
// for a UCharacterIterator it also just used source.getText()).
// TODO: do we need to remember the cloned iterator in a field?
UCharacterIterator src;
try {
src = (UCharacterIterator) source.clone();
} catch (CloneNotSupportedException e) {
// Fall back to ICU 52 behavior of iterating over the text contents
// of the UCharacterIterator.
setText(source.getText());
return;
}
src.setToStart();
CollationIterator newIter;
boolean numeric = rbc_.settings.readOnly().isNumeric();
if (rbc_.settings.readOnly().dontCheckFCD()) {
newIter = new IterCollationIterator(rbc_.data, numeric, src);
} else {
newIter = new FCDIterCollationIterator(rbc_.data, numeric, src, 0);
}
iter_ = newIter;
otherHalf_ = 0;
dir_ = 0;
} | java | public void setText(UCharacterIterator source) {
string_ = source.getText(); // TODO: do we need to remember the source string in a field?
// Note: In C++, we just setText(source.getText()).
// In Java, we actually operate on a character iterator.
// (The old code apparently did so only for a CharacterIterator;
// for a UCharacterIterator it also just used source.getText()).
// TODO: do we need to remember the cloned iterator in a field?
UCharacterIterator src;
try {
src = (UCharacterIterator) source.clone();
} catch (CloneNotSupportedException e) {
// Fall back to ICU 52 behavior of iterating over the text contents
// of the UCharacterIterator.
setText(source.getText());
return;
}
src.setToStart();
CollationIterator newIter;
boolean numeric = rbc_.settings.readOnly().isNumeric();
if (rbc_.settings.readOnly().dontCheckFCD()) {
newIter = new IterCollationIterator(rbc_.data, numeric, src);
} else {
newIter = new FCDIterCollationIterator(rbc_.data, numeric, src, 0);
}
iter_ = newIter;
otherHalf_ = 0;
dir_ = 0;
} | [
"public",
"void",
"setText",
"(",
"UCharacterIterator",
"source",
")",
"{",
"string_",
"=",
"source",
".",
"getText",
"(",
")",
";",
"// TODO: do we need to remember the source string in a field?",
"// Note: In C++, we just setText(source.getText()).",
"// In Java, we actually op... | Set a new source string iterator for iteration, and reset the
offset to the beginning of the text.
<p>The source iterator's integrity will be preserved since a new copy
will be created for use.
@param source the new source string iterator for iteration. | [
"Set",
"a",
"new",
"source",
"string",
"iterator",
"for",
"iteration",
"and",
"reset",
"the",
"offset",
"to",
"the",
"beginning",
"of",
"the",
"text",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L514-L541 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/frontier/Workbench.java | Workbench.getWorkbenchEntry | public WorkbenchEntry getWorkbenchEntry(final byte[] address) {
WorkbenchEntry workbenchEntry;
synchronized (address2WorkbenchEntry) {
workbenchEntry = address2WorkbenchEntry.get(address);
if (workbenchEntry == null) address2WorkbenchEntry.add(workbenchEntry = new WorkbenchEntry(address, broken));
}
return workbenchEntry;
} | java | public WorkbenchEntry getWorkbenchEntry(final byte[] address) {
WorkbenchEntry workbenchEntry;
synchronized (address2WorkbenchEntry) {
workbenchEntry = address2WorkbenchEntry.get(address);
if (workbenchEntry == null) address2WorkbenchEntry.add(workbenchEntry = new WorkbenchEntry(address, broken));
}
return workbenchEntry;
} | [
"public",
"WorkbenchEntry",
"getWorkbenchEntry",
"(",
"final",
"byte",
"[",
"]",
"address",
")",
"{",
"WorkbenchEntry",
"workbenchEntry",
";",
"synchronized",
"(",
"address2WorkbenchEntry",
")",
"{",
"workbenchEntry",
"=",
"address2WorkbenchEntry",
".",
"get",
"(",
... | Returns a workbench entry for the given address, possibly creating one. The entry may or may not be on the {@link Workbench}
currently.
@param address an IP address in byte-array form.
@return a workbench entry for {@code address} (possibly a new one). | [
"Returns",
"a",
"workbench",
"entry",
"for",
"the",
"given",
"address",
"possibly",
"creating",
"one",
".",
"The",
"entry",
"may",
"or",
"may",
"not",
"be",
"on",
"the",
"{",
"@link",
"Workbench",
"}",
"currently",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/Workbench.java#L117-L124 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Streams.java | Streams.copyStreamWithFilterSet | public static void copyStreamWithFilterSet(final InputStream in, final OutputStream out, final FilterSet set)
throws IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
String lSep = System.getProperty("line.separator");
String line = reader.readLine();
while (null != line) {
writer.write(set.replaceTokens(line));
writer.write(lSep);
line = reader.readLine();
}
writer.flush();
} | java | public static void copyStreamWithFilterSet(final InputStream in, final OutputStream out, final FilterSet set)
throws IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
String lSep = System.getProperty("line.separator");
String line = reader.readLine();
while (null != line) {
writer.write(set.replaceTokens(line));
writer.write(lSep);
line = reader.readLine();
}
writer.flush();
} | [
"public",
"static",
"void",
"copyStreamWithFilterSet",
"(",
"final",
"InputStream",
"in",
",",
"final",
"OutputStream",
"out",
",",
"final",
"FilterSet",
"set",
")",
"throws",
"IOException",
"{",
"final",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"... | Read the data from the input stream and write to the outputstream, filtering with an Ant FilterSet.
@param in inputstream
@param out outputstream
@param set FilterSet to use
@throws java.io.IOException if thrown by underlying io operations | [
"Read",
"the",
"data",
"from",
"the",
"input",
"stream",
"and",
"write",
"to",
"the",
"outputstream",
"filtering",
"with",
"an",
"Ant",
"FilterSet",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Streams.java#L148-L160 |
icode/ameba | src/main/java/ameba/db/ebean/support/ModelResourceStructure.java | ModelResourceStructure.applyUriQuery | protected FutureRowCount applyUriQuery(final Query<MODEL> query, boolean needPageList) {
return ModelInterceptor.applyUriQuery(uriInfo.getQueryParameters(), (SpiQuery) query, manager, needPageList);
} | java | protected FutureRowCount applyUriQuery(final Query<MODEL> query, boolean needPageList) {
return ModelInterceptor.applyUriQuery(uriInfo.getQueryParameters(), (SpiQuery) query, manager, needPageList);
} | [
"protected",
"FutureRowCount",
"applyUriQuery",
"(",
"final",
"Query",
"<",
"MODEL",
">",
"query",
",",
"boolean",
"needPageList",
")",
"{",
"return",
"ModelInterceptor",
".",
"applyUriQuery",
"(",
"uriInfo",
".",
"getQueryParameters",
"(",
")",
",",
"(",
"SpiQu... | apply uri query parameter on query
@param query Query
@param needPageList need page list
@return page list count or null
@see ModelInterceptor#applyUriQuery(MultivaluedMap, SpiQuery, InjectionManager, boolean) | [
"apply",
"uri",
"query",
"parameter",
"on",
"query"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L1002-L1004 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writePredecessors | private void writePredecessors(Project.Tasks.Task xml, Task mpx)
{
List<Project.Tasks.Task.PredecessorLink> list = xml.getPredecessorLink();
List<Relation> predecessors = mpx.getPredecessors();
for (Relation rel : predecessors)
{
Integer taskUniqueID = rel.getTargetTask().getUniqueID();
list.add(writePredecessor(taskUniqueID, rel.getType(), rel.getLag()));
m_eventManager.fireRelationWrittenEvent(rel);
}
} | java | private void writePredecessors(Project.Tasks.Task xml, Task mpx)
{
List<Project.Tasks.Task.PredecessorLink> list = xml.getPredecessorLink();
List<Relation> predecessors = mpx.getPredecessors();
for (Relation rel : predecessors)
{
Integer taskUniqueID = rel.getTargetTask().getUniqueID();
list.add(writePredecessor(taskUniqueID, rel.getType(), rel.getLag()));
m_eventManager.fireRelationWrittenEvent(rel);
}
} | [
"private",
"void",
"writePredecessors",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"xml",
",",
"Task",
"mpx",
")",
"{",
"List",
"<",
"Project",
".",
"Tasks",
".",
"Task",
".",
"PredecessorLink",
">",
"list",
"=",
"xml",
".",
"getPredecessorLink",
"(",
")... | This method writes predecessor data to an MSPDI file.
We have to deal with a slight anomaly in this method that is introduced
by the MPX file format. It would be possible for someone to create an
MPX file with both the predecessor list and the unique ID predecessor
list populated... which means that we must process both and avoid adding
duplicate predecessors. Also interesting to note is that MSP98 populates
the predecessor list, not the unique ID predecessor list, as you might
expect.
@param xml MSPDI task data
@param mpx MPX task data | [
"This",
"method",
"writes",
"predecessor",
"data",
"to",
"an",
"MSPDI",
"file",
".",
"We",
"have",
"to",
"deal",
"with",
"a",
"slight",
"anomaly",
"in",
"this",
"method",
"that",
"is",
"introduced",
"by",
"the",
"MPX",
"file",
"format",
".",
"It",
"would... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1387-L1398 |
mgormley/agiga | src/main/java/edu/jhu/agiga/AgigaSentenceReader.java | AgigaSentenceReader.parseParse | private String parseParse(VTDNav vn) throws NavException,
PilotException {
require (vn.matchElement(AgigaConstants.SENTENCE));
// Move to the <parse> tag
require (vn.toElement(VTDNav.FC, AgigaConstants.PARSE));
String parseText = vn.toString(vn.getText());
return parseText;
} | java | private String parseParse(VTDNav vn) throws NavException,
PilotException {
require (vn.matchElement(AgigaConstants.SENTENCE));
// Move to the <parse> tag
require (vn.toElement(VTDNav.FC, AgigaConstants.PARSE));
String parseText = vn.toString(vn.getText());
return parseText;
} | [
"private",
"String",
"parseParse",
"(",
"VTDNav",
"vn",
")",
"throws",
"NavException",
",",
"PilotException",
"{",
"require",
"(",
"vn",
".",
"matchElement",
"(",
"AgigaConstants",
".",
"SENTENCE",
")",
")",
";",
"// Move to the <parse> tag",
"require",
"(",
"vn... | Assumes the position of vn is at a AgigaConstants.SENTENCE tag
@return | [
"Assumes",
"the",
"position",
"of",
"vn",
"is",
"at",
"a",
"AgigaConstants",
".",
"SENTENCE",
"tag"
] | train | https://github.com/mgormley/agiga/blob/d61db78e3fa9d2470122d869a9ab798cb07eea3b/src/main/java/edu/jhu/agiga/AgigaSentenceReader.java#L299-L308 |
stackify/stackify-api-java | src/main/java/com/stackify/api/common/EnvironmentDetails.java | EnvironmentDetails.getEnvironmentDetail | public static EnvironmentDetail getEnvironmentDetail(final String application, final String environment) {
// lookup the host name
String hostName = getHostName();
// lookup the current path
String currentPath = System.getProperty("user.dir");
// build the environment details
EnvironmentDetail.Builder environmentBuilder = EnvironmentDetail.newBuilder();
environmentBuilder.deviceName(hostName);
environmentBuilder.appLocation(currentPath);
environmentBuilder.configuredAppName(application);
environmentBuilder.configuredEnvironmentName(environment);
return environmentBuilder.build();
} | java | public static EnvironmentDetail getEnvironmentDetail(final String application, final String environment) {
// lookup the host name
String hostName = getHostName();
// lookup the current path
String currentPath = System.getProperty("user.dir");
// build the environment details
EnvironmentDetail.Builder environmentBuilder = EnvironmentDetail.newBuilder();
environmentBuilder.deviceName(hostName);
environmentBuilder.appLocation(currentPath);
environmentBuilder.configuredAppName(application);
environmentBuilder.configuredEnvironmentName(environment);
return environmentBuilder.build();
} | [
"public",
"static",
"EnvironmentDetail",
"getEnvironmentDetail",
"(",
"final",
"String",
"application",
",",
"final",
"String",
"environment",
")",
"{",
"// lookup the host name",
"String",
"hostName",
"=",
"getHostName",
"(",
")",
";",
"// lookup the current path",
"St... | Creates an environment details object with system information
@param application The configured application name
@param environment The configured application environment
@return The EnvironmentDetail object | [
"Creates",
"an",
"environment",
"details",
"object",
"with",
"system",
"information"
] | train | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/EnvironmentDetails.java#L35-L54 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.changeNotificationsEnabled | @ObjectiveCName("changeNotificationsEnabledWithPeer:withValue:")
public void changeNotificationsEnabled(Peer peer, boolean val) {
modules.getSettingsModule().changeNotificationsEnabled(peer, val);
} | java | @ObjectiveCName("changeNotificationsEnabledWithPeer:withValue:")
public void changeNotificationsEnabled(Peer peer, boolean val) {
modules.getSettingsModule().changeNotificationsEnabled(peer, val);
} | [
"@",
"ObjectiveCName",
"(",
"\"changeNotificationsEnabledWithPeer:withValue:\"",
")",
"public",
"void",
"changeNotificationsEnabled",
"(",
"Peer",
"peer",
",",
"boolean",
"val",
")",
"{",
"modules",
".",
"getSettingsModule",
"(",
")",
".",
"changeNotificationsEnabled",
... | Change if notifications enabled for peer
@param peer destination peer
@param val is notifications enabled | [
"Change",
"if",
"notifications",
"enabled",
"for",
"peer"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2264-L2267 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/internal/Utils.java | Utils.checkState | public static void checkState(boolean isValid, @javax.annotation.Nullable Object errorMessage) {
if (!isValid) {
throw new IllegalStateException(String.valueOf(errorMessage));
}
} | java | public static void checkState(boolean isValid, @javax.annotation.Nullable Object errorMessage) {
if (!isValid) {
throw new IllegalStateException(String.valueOf(errorMessage));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"isValid",
",",
"@",
"javax",
".",
"annotation",
".",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"!",
"isValid",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
... | Throws an {@link IllegalStateException} if the argument is false. This method is similar to
{@code Preconditions.checkState(boolean, Object)} from Guava.
@param isValid whether the state check passed.
@param errorMessage the message to use for the exception. Will be converted to a string using
{@link String#valueOf(Object)}. | [
"Throws",
"an",
"{",
"@link",
"IllegalStateException",
"}",
"if",
"the",
"argument",
"is",
"false",
".",
"This",
"method",
"is",
"similar",
"to",
"{",
"@code",
"Preconditions",
".",
"checkState",
"(",
"boolean",
"Object",
")",
"}",
"from",
"Guava",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/internal/Utils.java#L79-L83 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/carouselItem/CarouselItemRenderer.java | CarouselItemRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
CarouselItem carouselItem = (CarouselItem) component;
ResponseWriter rw = context.getResponseWriter();
if (carouselItem.getCaption()!=null) {
new CarouselCaptionRenderer().encodeDefaultCaption(context, component, carouselItem.getCaption());
}
rw.endElement("div");
Tooltip.activateTooltips(context, carouselItem);
} | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
CarouselItem carouselItem = (CarouselItem) component;
ResponseWriter rw = context.getResponseWriter();
if (carouselItem.getCaption()!=null) {
new CarouselCaptionRenderer().encodeDefaultCaption(context, component, carouselItem.getCaption());
}
rw.endElement("div");
Tooltip.activateTooltips(context, carouselItem);
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"CarouselItem",
"carou... | This methods generates the HTML code of the current b:carouselItem.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:carouselItem.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"carouselItem",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framewo... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/carouselItem/CarouselItemRenderer.java#L102-L117 |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/trait/TraitComposer.java | TraitComposer.doExtendTraits | public static void doExtendTraits(final ClassNode cNode, final SourceUnit unit, final CompilationUnit cu) {
if (cNode.isInterface()) return;
boolean isItselfTrait = Traits.isTrait(cNode);
SuperCallTraitTransformer superCallTransformer = new SuperCallTraitTransformer(unit);
if (isItselfTrait) {
checkTraitAllowed(cNode, unit);
return;
}
if (!cNode.getNameWithoutPackage().endsWith(Traits.TRAIT_HELPER)) {
List<ClassNode> traits = findTraits(cNode);
for (ClassNode trait : traits) {
TraitHelpersTuple helpers = Traits.findHelpers(trait);
applyTrait(trait, cNode, helpers);
superCallTransformer.visitClass(cNode);
if (unit!=null) {
ASTTransformationCollectorCodeVisitor collector = new ASTTransformationCollectorCodeVisitor(unit, cu.getTransformLoader());
collector.visitClass(cNode);
}
}
}
} | java | public static void doExtendTraits(final ClassNode cNode, final SourceUnit unit, final CompilationUnit cu) {
if (cNode.isInterface()) return;
boolean isItselfTrait = Traits.isTrait(cNode);
SuperCallTraitTransformer superCallTransformer = new SuperCallTraitTransformer(unit);
if (isItselfTrait) {
checkTraitAllowed(cNode, unit);
return;
}
if (!cNode.getNameWithoutPackage().endsWith(Traits.TRAIT_HELPER)) {
List<ClassNode> traits = findTraits(cNode);
for (ClassNode trait : traits) {
TraitHelpersTuple helpers = Traits.findHelpers(trait);
applyTrait(trait, cNode, helpers);
superCallTransformer.visitClass(cNode);
if (unit!=null) {
ASTTransformationCollectorCodeVisitor collector = new ASTTransformationCollectorCodeVisitor(unit, cu.getTransformLoader());
collector.visitClass(cNode);
}
}
}
} | [
"public",
"static",
"void",
"doExtendTraits",
"(",
"final",
"ClassNode",
"cNode",
",",
"final",
"SourceUnit",
"unit",
",",
"final",
"CompilationUnit",
"cu",
")",
"{",
"if",
"(",
"cNode",
".",
"isInterface",
"(",
")",
")",
"return",
";",
"boolean",
"isItselfT... | Given a class node, if this class node implements a trait, then generate all the appropriate
code which delegates calls to the trait. It is safe to call this method on a class node which
does not implement a trait.
@param cNode a class node
@param unit the source unit | [
"Given",
"a",
"class",
"node",
"if",
"this",
"class",
"node",
"implements",
"a",
"trait",
"then",
"generate",
"all",
"the",
"appropriate",
"code",
"which",
"delegates",
"calls",
"to",
"the",
"trait",
".",
"It",
"is",
"safe",
"to",
"call",
"this",
"method",... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java#L102-L122 |
code4everything/util | src/main/java/com/zhazhapan/util/FileExecutor.java | FileExecutor.copyDirectories | public static void copyDirectories(File[] directories, File[] destinationDirectories) throws IOException {
int length = Integer.min(directories.length, destinationDirectories.length);
for (int i = 0; i < length; i++) {
copyDirectory(directories[i], destinationDirectories[i]);
}
} | java | public static void copyDirectories(File[] directories, File[] destinationDirectories) throws IOException {
int length = Integer.min(directories.length, destinationDirectories.length);
for (int i = 0; i < length; i++) {
copyDirectory(directories[i], destinationDirectories[i]);
}
} | [
"public",
"static",
"void",
"copyDirectories",
"(",
"File",
"[",
"]",
"directories",
",",
"File",
"[",
"]",
"destinationDirectories",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"Integer",
".",
"min",
"(",
"directories",
".",
"length",
",",
"des... | 批量复制文件夹
@param directories 文件夹数组
@param destinationDirectories 目标文件夹数组,与文件夹一一对应
@throws IOException 异常 | [
"批量复制文件夹"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L421-L426 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/PipelineApi.java | PipelineApi.deletePipeline | public void deletePipeline(Object projectIdOrPath, int pipelineId) throws GitLabApiException {
delete(Response.Status.ACCEPTED, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId);
} | java | public void deletePipeline(Object projectIdOrPath, int pipelineId) throws GitLabApiException {
delete(Response.Status.ACCEPTED, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId);
} | [
"public",
"void",
"deletePipeline",
"(",
"Object",
"projectIdOrPath",
",",
"int",
"pipelineId",
")",
"throws",
"GitLabApiException",
"{",
"delete",
"(",
"Response",
".",
"Status",
".",
"ACCEPTED",
",",
"null",
",",
"\"projects\"",
",",
"getProjectIdOrPath",
"(",
... | Delete a pipeline from a project.
<pre><code>GitLab Endpoint: DELETE /projects/:id/pipelines/:pipeline_id</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param pipelineId the pipeline ID to delete
@throws GitLabApiException if any exception occurs during execution | [
"Delete",
"a",
"pipeline",
"from",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L261-L263 |
alkacon/opencms-core | src/org/opencms/db/CmsSubscriptionManager.java | CmsSubscriptionManager.unsubscribeResourceFor | public void unsubscribeResourceFor(CmsObject cms, CmsPrincipal principal, String resourcePath) throws CmsException {
CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
unsubscribeResourceFor(cms, principal, resource);
} | java | public void unsubscribeResourceFor(CmsObject cms, CmsPrincipal principal, String resourcePath) throws CmsException {
CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
unsubscribeResourceFor(cms, principal, resource);
} | [
"public",
"void",
"unsubscribeResourceFor",
"(",
"CmsObject",
"cms",
",",
"CmsPrincipal",
"principal",
",",
"String",
"resourcePath",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"cms",
".",
"readResource",
"(",
"resourcePath",
",",
"CmsResour... | Unsubscribes the principal from the resource.<p>
@param cms the current users context
@param principal the principal that unsubscribes from the resource
@param resourcePath the name of the resource to unsubscribe from
@throws CmsException if something goes wrong | [
"Unsubscribes",
"the",
"principal",
"from",
"the",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L461-L465 |
RestComm/media-core | stun/src/main/java/org/restcomm/media/core/stun/messages/attributes/general/MessageIntegrityAttribute.java | MessageIntegrityAttribute.calculateHmacSha1 | public static byte[] calculateHmacSha1(byte[] message, int offset, int length, byte[] key) throws IllegalArgumentException {
try {
// get an HMAC-SHA1 key from the raw key bytes
SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
// get an HMAC-SHA1 Mac instance and initialize it with the key
Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
mac.init(signingKey);
// compute the hmac on input data bytes
byte[] macInput = new byte[length];
System.arraycopy(message, offset, macInput, 0, length);
return mac.doFinal(macInput);
} catch (Exception exc) {
throw new IllegalArgumentException("Could not create HMAC-SHA1 request encoding", exc);
}
} | java | public static byte[] calculateHmacSha1(byte[] message, int offset, int length, byte[] key) throws IllegalArgumentException {
try {
// get an HMAC-SHA1 key from the raw key bytes
SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
// get an HMAC-SHA1 Mac instance and initialize it with the key
Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
mac.init(signingKey);
// compute the hmac on input data bytes
byte[] macInput = new byte[length];
System.arraycopy(message, offset, macInput, 0, length);
return mac.doFinal(macInput);
} catch (Exception exc) {
throw new IllegalArgumentException("Could not create HMAC-SHA1 request encoding", exc);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"calculateHmacSha1",
"(",
"byte",
"[",
"]",
"message",
",",
"int",
"offset",
",",
"int",
"length",
",",
"byte",
"[",
"]",
"key",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"// get an HMAC-SHA1 key from the... | Encodes <tt>message</tt> using <tt>key</tt> and the HMAC-SHA1 algorithm
as per RFC 2104 and returns the resulting byte array. This is a utility
method that generates content for the {@link MessageIntegrityAttribute}
regardless of the credentials being used (short or long term).
@param message
the STUN message that the resulting content will need to
travel in.
@param offset
the index where data starts in <tt>message</tt>.
@param length
the length of the data in <tt>message</tt> that the method
should consider.
@param key
the key that we should be using for the encoding (which
depends on whether we are using short or long term
credentials).
@return the HMAC that should be used in a
<tt>MessageIntegrityAttribute</tt> transported by
<tt>message</tt>.
@throws IllegalArgumentException
if the encoding fails for some reason. | [
"Encodes",
"<tt",
">",
"message<",
"/",
"tt",
">",
"using",
"<tt",
">",
"key<",
"/",
"tt",
">",
"and",
"the",
"HMAC",
"-",
"SHA1",
"algorithm",
"as",
"per",
"RFC",
"2104",
"and",
"returns",
"the",
"resulting",
"byte",
"array",
".",
"This",
"is",
"a",... | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/stun/src/main/java/org/restcomm/media/core/stun/messages/attributes/general/MessageIntegrityAttribute.java#L171-L187 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java | Bbox.getCoordinates | public Coordinate[] getCoordinates() {
Coordinate[] result = new Coordinate[5];
result[0] = new Coordinate(x, y);
result[1] = new Coordinate(x + width, y);
result[2] = new Coordinate(x + width, y + height);
result[3] = new Coordinate(x, y + height);
result[4] = new Coordinate(x, y);
return result;
} | java | public Coordinate[] getCoordinates() {
Coordinate[] result = new Coordinate[5];
result[0] = new Coordinate(x, y);
result[1] = new Coordinate(x + width, y);
result[2] = new Coordinate(x + width, y + height);
result[3] = new Coordinate(x, y + height);
result[4] = new Coordinate(x, y);
return result;
} | [
"public",
"Coordinate",
"[",
"]",
"getCoordinates",
"(",
")",
"{",
"Coordinate",
"[",
"]",
"result",
"=",
"new",
"Coordinate",
"[",
"5",
"]",
";",
"result",
"[",
"0",
"]",
"=",
"new",
"Coordinate",
"(",
"x",
",",
"y",
")",
";",
"result",
"[",
"1",
... | Get the coordinates of the bounding box as an array.
@return Returns 5 coordinates so that the array is closed. This can be useful when using this array to creating a
<code>LinearRing</code>. | [
"Get",
"the",
"coordinates",
"of",
"the",
"bounding",
"box",
"as",
"an",
"array",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L162-L171 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java | FunctionLibFactory.loadFromFile | public static FunctionLib loadFromFile(Resource res, Identification id) throws FunctionLibException {
// Read in XML
FunctionLib lib = FunctionLibFactory.hashLib.get(id(res));// getHashLib(file.getAbsolutePath());
if (lib == null) {
lib = new FunctionLibFactory(null, res, id, false).getLib();
FunctionLibFactory.hashLib.put(id(res), lib);
}
lib.setSource(res.toString());
return lib;
} | java | public static FunctionLib loadFromFile(Resource res, Identification id) throws FunctionLibException {
// Read in XML
FunctionLib lib = FunctionLibFactory.hashLib.get(id(res));// getHashLib(file.getAbsolutePath());
if (lib == null) {
lib = new FunctionLibFactory(null, res, id, false).getLib();
FunctionLibFactory.hashLib.put(id(res), lib);
}
lib.setSource(res.toString());
return lib;
} | [
"public",
"static",
"FunctionLib",
"loadFromFile",
"(",
"Resource",
"res",
",",
"Identification",
"id",
")",
"throws",
"FunctionLibException",
"{",
"// Read in XML",
"FunctionLib",
"lib",
"=",
"FunctionLibFactory",
".",
"hashLib",
".",
"get",
"(",
"id",
"(",
"res"... | Laedt eine einzelne FunctionLib.
@param res FLD die geladen werden soll.
@param saxParser Definition des Sax Parser mit dem die FunctionLib eingelsesen werden soll.
@return FunctionLib
@throws FunctionLibException | [
"Laedt",
"eine",
"einzelne",
"FunctionLib",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java#L373-L383 |
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/views/filters/TwoValuesToggle.java | TwoValuesToggle.setValueOff | public void setValueOff(String newValue, @Nullable String newName) {
if (!isChecked()) { // refining on valueOff: facetRefinement needs an update
searcher.updateFacetRefinement(attribute, valueOff, false)
.updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
.search();
}
this.valueOff = newValue;
applyEventualNewAttribute(newName);
} | java | public void setValueOff(String newValue, @Nullable String newName) {
if (!isChecked()) { // refining on valueOff: facetRefinement needs an update
searcher.updateFacetRefinement(attribute, valueOff, false)
.updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
.search();
}
this.valueOff = newValue;
applyEventualNewAttribute(newName);
} | [
"public",
"void",
"setValueOff",
"(",
"String",
"newValue",
",",
"@",
"Nullable",
"String",
"newName",
")",
"{",
"if",
"(",
"!",
"isChecked",
"(",
")",
")",
"{",
"// refining on valueOff: facetRefinement needs an update",
"searcher",
".",
"updateFacetRefinement",
"(... | Changes the Toggle's valueOff, updating facet refinements accordingly.
@param newValue valueOff's new value.
@param newName an eventual new attribute name. | [
"Changes",
"the",
"Toggle",
"s",
"valueOff",
"updating",
"facet",
"refinements",
"accordingly",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/views/filters/TwoValuesToggle.java#L76-L84 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/RelationTypeUtility.java | RelationTypeUtility.getInstance | public static RelationType getInstance(Locale locale, String type)
{
int index = -1;
String[] relationTypes = LocaleData.getStringArray(locale, LocaleData.RELATION_TYPES);
for (int loop = 0; loop < relationTypes.length; loop++)
{
if (relationTypes[loop].equalsIgnoreCase(type) == true)
{
index = loop;
break;
}
}
RelationType result = null;
if (index != -1)
{
result = RelationType.getInstance(index);
}
return (result);
} | java | public static RelationType getInstance(Locale locale, String type)
{
int index = -1;
String[] relationTypes = LocaleData.getStringArray(locale, LocaleData.RELATION_TYPES);
for (int loop = 0; loop < relationTypes.length; loop++)
{
if (relationTypes[loop].equalsIgnoreCase(type) == true)
{
index = loop;
break;
}
}
RelationType result = null;
if (index != -1)
{
result = RelationType.getInstance(index);
}
return (result);
} | [
"public",
"static",
"RelationType",
"getInstance",
"(",
"Locale",
"locale",
",",
"String",
"type",
")",
"{",
"int",
"index",
"=",
"-",
"1",
";",
"String",
"[",
"]",
"relationTypes",
"=",
"LocaleData",
".",
"getStringArray",
"(",
"locale",
",",
"LocaleData",
... | This method takes the textual version of a relation type
and returns an appropriate class instance. Note that unrecognised
values will cause this method to return null.
@param locale target locale
@param type text version of the relation type
@return RelationType instance | [
"This",
"method",
"takes",
"the",
"textual",
"version",
"of",
"a",
"relation",
"type",
"and",
"returns",
"an",
"appropriate",
"class",
"instance",
".",
"Note",
"that",
"unrecognised",
"values",
"will",
"cause",
"this",
"method",
"to",
"return",
"null",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RelationTypeUtility.java#L53-L74 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Collectors.java | Collectors.filtering | @NotNull
public static <T, A, R> Collector<T, ?, R> filtering(
@NotNull final Predicate<? super T> predicate,
@NotNull final Collector<? super T, A, R> downstream) {
final BiConsumer<A, ? super T> accumulator = downstream.accumulator();
return new CollectorsImpl<T, A, R>(
downstream.supplier(),
new BiConsumer<A, T>() {
@Override
public void accept(A a, T t) {
if (predicate.test(t))
accumulator.accept(a, t);
}
},
downstream.finisher()
);
} | java | @NotNull
public static <T, A, R> Collector<T, ?, R> filtering(
@NotNull final Predicate<? super T> predicate,
@NotNull final Collector<? super T, A, R> downstream) {
final BiConsumer<A, ? super T> accumulator = downstream.accumulator();
return new CollectorsImpl<T, A, R>(
downstream.supplier(),
new BiConsumer<A, T>() {
@Override
public void accept(A a, T t) {
if (predicate.test(t))
accumulator.accept(a, t);
}
},
downstream.finisher()
);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
",",
"A",
",",
"R",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"R",
">",
"filtering",
"(",
"@",
"NotNull",
"final",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
",",
"@",
"NotNull",
"final",
... | Returns a {@code Collector} that filters input elements.
@param <T> the type of the input elements
@param <A> the accumulation type
@param <R> the type of the output elements
@param predicate a predicate used to filter elements
@param downstream the collector of filtered elements
@return a {@code Collector}
@since 1.1.3 | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"that",
"filters",
"input",
"elements",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L773-L792 |
Sciss/abc4j | abc/src/main/java/abc/parser/AbcGrammar.java | AbcGrammar.Tex | Rule Tex() {
return Sequence('\\', ZeroOrMore(FirstOf(VCHAR(), WSP())), Eol())
.label(Tex);
} | java | Rule Tex() {
return Sequence('\\', ZeroOrMore(FirstOf(VCHAR(), WSP())), Eol())
.label(Tex);
} | [
"Rule",
"Tex",
"(",
")",
"{",
"return",
"Sequence",
"(",
"'",
"'",
",",
"ZeroOrMore",
"(",
"FirstOf",
"(",
"VCHAR",
"(",
")",
",",
"WSP",
"(",
")",
")",
")",
",",
"Eol",
"(",
")",
")",
".",
"label",
"(",
"Tex",
")",
";",
"}"
] | tex ::= "\" *(VCHAR / WSP) eol
<p>deprecated - kept only for backward compatibility with abc2mtex | [
"tex",
"::",
"=",
"\\",
"*",
"(",
"VCHAR",
"/",
"WSP",
")",
"eol",
"<p",
">",
"deprecated",
"-",
"kept",
"only",
"for",
"backward",
"compatibility",
"with",
"abc2mtex"
] | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L2510-L2513 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.deleteFromTask | public void deleteFromTask(String jobId, String taskId, String filePath) {
deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath).toBlocking().single().body();
} | java | public void deleteFromTask(String jobId, String taskId, String filePath) {
deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath).toBlocking().single().body();
} | [
"public",
"void",
"deleteFromTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
",",
"String",
"filePath",
")",
"{",
"deleteFromTaskWithServiceResponseAsync",
"(",
"jobId",
",",
"taskId",
",",
"filePath",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"... | Deletes the specified task file from the compute node where the task ran.
@param jobId The ID of the job that contains the task.
@param taskId The ID of the task whose file you want to delete.
@param filePath The path to the task file or directory that you want to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"task",
"file",
"from",
"the",
"compute",
"node",
"where",
"the",
"task",
"ran",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L145-L147 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java | KeysAndAttributes.withKeys | public KeysAndAttributes withKeys(java.util.Map<String, AttributeValue>... keys) {
if (this.keys == null) {
setKeys(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys.length));
}
for (java.util.Map<String, AttributeValue> ele : keys) {
this.keys.add(ele);
}
return this;
} | java | public KeysAndAttributes withKeys(java.util.Map<String, AttributeValue>... keys) {
if (this.keys == null) {
setKeys(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys.length));
}
for (java.util.Map<String, AttributeValue> ele : keys) {
this.keys.add(ele);
}
return this;
} | [
"public",
"KeysAndAttributes",
"withKeys",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"...",
"keys",
")",
"{",
"if",
"(",
"this",
".",
"keys",
"==",
"null",
")",
"{",
"setKeys",
"(",
"new",
"java",
".",
"util",
"... | <p>
The primary key attribute values that define the items and the attributes associated with the items.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setKeys(java.util.Collection)} or {@link #withKeys(java.util.Collection)} if you want to override the
existing values.
</p>
@param keys
The primary key attribute values that define the items and the attributes associated with the items.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"primary",
"key",
"attribute",
"values",
"that",
"define",
"the",
"items",
"and",
"the",
"attributes",
"associated",
"with",
"the",
"items",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"This",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java#L190-L198 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java | ExtendedSwidProcessor.setSupportedLanguages | public ExtendedSwidProcessor setSupportedLanguages(final String... supportedLanguagesList) {
SupportedLanguagesComplexType slct = new SupportedLanguagesComplexType();
if (supportedLanguagesList.length > 0) {
for (String supportedLanguage : supportedLanguagesList) {
slct.getLanguage().add(new Token(supportedLanguage, idGenerator.nextId()));
}
}
swidTag.setSupportedLanguages(slct);
return this;
} | java | public ExtendedSwidProcessor setSupportedLanguages(final String... supportedLanguagesList) {
SupportedLanguagesComplexType slct = new SupportedLanguagesComplexType();
if (supportedLanguagesList.length > 0) {
for (String supportedLanguage : supportedLanguagesList) {
slct.getLanguage().add(new Token(supportedLanguage, idGenerator.nextId()));
}
}
swidTag.setSupportedLanguages(slct);
return this;
} | [
"public",
"ExtendedSwidProcessor",
"setSupportedLanguages",
"(",
"final",
"String",
"...",
"supportedLanguagesList",
")",
"{",
"SupportedLanguagesComplexType",
"slct",
"=",
"new",
"SupportedLanguagesComplexType",
"(",
")",
";",
"if",
"(",
"supportedLanguagesList",
".",
"l... | Defines product supported languages (tag: supported_languages).
@param supportedLanguagesList
product supported languages
@return a reference to this object. | [
"Defines",
"product",
"supported",
"languages",
"(",
"tag",
":",
"supported_languages",
")",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L212-L221 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java | TitlePaneMaximizeButtonPainter.paintMaximizePressed | private void paintMaximizePressed(Graphics2D g, JComponent c, int width, int height) {
maximizePainter.paintPressed(g, c, width, height);
} | java | private void paintMaximizePressed(Graphics2D g, JComponent c, int width, int height) {
maximizePainter.paintPressed(g, c, width, height);
} | [
"private",
"void",
"paintMaximizePressed",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"maximizePainter",
".",
"paintPressed",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
")",
";",
"}"
] | Paint the foreground maximize button pressed state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component. | [
"Paint",
"the",
"foreground",
"maximize",
"button",
"pressed",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java#L197-L199 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | ServerBuilder.childChannelOption | public <T> ServerBuilder childChannelOption(ChannelOption<T> option, T value) {
requireNonNull(option, "option");
checkArgument(!PROHIBITED_SOCKET_OPTIONS.contains(option),
"prohibited socket option: %s", option);
option.validate(value);
childChannelOptions.put(option, value);
return this;
} | java | public <T> ServerBuilder childChannelOption(ChannelOption<T> option, T value) {
requireNonNull(option, "option");
checkArgument(!PROHIBITED_SOCKET_OPTIONS.contains(option),
"prohibited socket option: %s", option);
option.validate(value);
childChannelOptions.put(option, value);
return this;
} | [
"public",
"<",
"T",
">",
"ServerBuilder",
"childChannelOption",
"(",
"ChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"requireNonNull",
"(",
"option",
",",
"\"option\"",
")",
";",
"checkArgument",
"(",
"!",
"PROHIBITED_SOCKET_OPTIONS",
".... | Sets the {@link ChannelOption} of sockets accepted by {@link Server}.
Note that the previously added option will be overridden if the same option is set again.
<pre>{@code
ServerBuilder sb = new ServerBuilder();
sb.childChannelOption(ChannelOption.SO_REUSEADDR, true)
.childChannelOption(ChannelOption.SO_KEEPALIVE, true);
}</pre> | [
"Sets",
"the",
"{",
"@link",
"ChannelOption",
"}",
"of",
"sockets",
"accepted",
"by",
"{",
"@link",
"Server",
"}",
".",
"Note",
"that",
"the",
"previously",
"added",
"option",
"will",
"be",
"overridden",
"if",
"the",
"same",
"option",
"is",
"set",
"again",... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L392-L400 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.isBetween | public static boolean isBetween(final Date start, final Date end, final Date between)
{
final long min = start.getTime();
final long max = end.getTime();
final long index = between.getTime();
return min <= index && index <= max;
} | java | public static boolean isBetween(final Date start, final Date end, final Date between)
{
final long min = start.getTime();
final long max = end.getTime();
final long index = between.getTime();
return min <= index && index <= max;
} | [
"public",
"static",
"boolean",
"isBetween",
"(",
"final",
"Date",
"start",
",",
"final",
"Date",
"end",
",",
"final",
"Date",
"between",
")",
"{",
"final",
"long",
"min",
"=",
"start",
".",
"getTime",
"(",
")",
";",
"final",
"long",
"max",
"=",
"end",
... | Checks if the Date object "between" is between from the given to Date objects.
@param start
the start time.
@param end
the end time.
@param between
the date to compare if it is between.
@return true, if is between otherwise false. | [
"Checks",
"if",
"the",
"Date",
"object",
"between",
"is",
"between",
"from",
"the",
"given",
"to",
"Date",
"objects",
"."
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L296-L302 |
calrissian/mango | mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java | JsonMetadata.hasArrayIndex | static boolean hasArrayIndex(Map<String,String> meta, int level) {
return meta.containsKey(level + ARRAY_IDX_SUFFIX);
} | java | static boolean hasArrayIndex(Map<String,String> meta, int level) {
return meta.containsKey(level + ARRAY_IDX_SUFFIX);
} | [
"static",
"boolean",
"hasArrayIndex",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"meta",
",",
"int",
"level",
")",
"{",
"return",
"meta",
".",
"containsKey",
"(",
"level",
"+",
"ARRAY_IDX_SUFFIX",
")",
";",
"}"
] | Determines whether or not a map of metadata contains array index information at the
given level in a flattened json tree.
@param meta
@param level
@return | [
"Determines",
"whether",
"or",
"not",
"a",
"map",
"of",
"metadata",
"contains",
"array",
"index",
"information",
"at",
"the",
"given",
"level",
"in",
"a",
"flattened",
"json",
"tree",
"."
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java#L65-L67 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.generateOmemoSignedPreKey | public T_SigPreKey generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair, int signedPreKeyId)
throws CorruptedOmemoKeyException {
return keyUtil().generateOmemoSignedPreKey(identityKeyPair, signedPreKeyId);
} | java | public T_SigPreKey generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair, int signedPreKeyId)
throws CorruptedOmemoKeyException {
return keyUtil().generateOmemoSignedPreKey(identityKeyPair, signedPreKeyId);
} | [
"public",
"T_SigPreKey",
"generateOmemoSignedPreKey",
"(",
"T_IdKeyPair",
"identityKeyPair",
",",
"int",
"signedPreKeyId",
")",
"throws",
"CorruptedOmemoKeyException",
"{",
"return",
"keyUtil",
"(",
")",
".",
"generateOmemoSignedPreKey",
"(",
"identityKeyPair",
",",
"sign... | Generate a new signed preKey.
@param identityKeyPair identityKeyPair used to sign the preKey
@param signedPreKeyId id that the preKey will have
@return signedPreKey
@throws CorruptedOmemoKeyException when something goes wrong | [
"Generate",
"a",
"new",
"signed",
"preKey",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L456-L459 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_serviceMonitoring_monitoringId_alert_email_POST | public OvhEmailAlert serviceName_serviceMonitoring_monitoringId_alert_email_POST(String serviceName, Long monitoringId, String email, OvhAlertLanguageEnum language) throws IOException {
String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email";
StringBuilder sb = path(qPath, serviceName, monitoringId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "language", language);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEmailAlert.class);
} | java | public OvhEmailAlert serviceName_serviceMonitoring_monitoringId_alert_email_POST(String serviceName, Long monitoringId, String email, OvhAlertLanguageEnum language) throws IOException {
String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email";
StringBuilder sb = path(qPath, serviceName, monitoringId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "language", language);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEmailAlert.class);
} | [
"public",
"OvhEmailAlert",
"serviceName_serviceMonitoring_monitoringId_alert_email_POST",
"(",
"String",
"serviceName",
",",
"Long",
"monitoringId",
",",
"String",
"email",
",",
"OvhAlertLanguageEnum",
"language",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
... | Add a new email alert
REST: POST /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email
@param language [required] Alert language
@param email [required] Alert destination
@param serviceName [required] The internal name of your dedicated server
@param monitoringId [required] This monitoring id | [
"Add",
"a",
"new",
"email",
"alert"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2251-L2259 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.getWriteConnection | protected Connection getWriteConnection() throws CpoException {
Connection connection;
try {
connection = getWriteDataSource().getConnection();
connection.setAutoCommit(false);
} catch (SQLException e) {
String msg = "getWriteConnection(): failed";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return connection;
} | java | protected Connection getWriteConnection() throws CpoException {
Connection connection;
try {
connection = getWriteDataSource().getConnection();
connection.setAutoCommit(false);
} catch (SQLException e) {
String msg = "getWriteConnection(): failed";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return connection;
} | [
"protected",
"Connection",
"getWriteConnection",
"(",
")",
"throws",
"CpoException",
"{",
"Connection",
"connection",
";",
"try",
"{",
"connection",
"=",
"getWriteDataSource",
"(",
")",
".",
"getConnection",
"(",
")",
";",
"connection",
".",
"setAutoCommit",
"(",
... | DOCUMENT ME!
@return DOCUMENT ME!
@throws CpoException DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2079-L2092 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java | AccessPoint.timestampMatch | private static boolean timestampMatch(CaptureSearchResult closest, WaybackRequest wbRequest) {
String replayTimestamp = wbRequest.getReplayTimestamp();
String captureTimestamp = closest.getCaptureTimestamp();
if (replayTimestamp.length() < captureTimestamp.length())
return false;
if (replayTimestamp.startsWith(captureTimestamp))
return true;
// if looking for latest date, consider it a tentative match, until
// checking if it's replay-able.
if (wbRequest.isBestLatestReplayRequest())
return true;
return false;
} | java | private static boolean timestampMatch(CaptureSearchResult closest, WaybackRequest wbRequest) {
String replayTimestamp = wbRequest.getReplayTimestamp();
String captureTimestamp = closest.getCaptureTimestamp();
if (replayTimestamp.length() < captureTimestamp.length())
return false;
if (replayTimestamp.startsWith(captureTimestamp))
return true;
// if looking for latest date, consider it a tentative match, until
// checking if it's replay-able.
if (wbRequest.isBestLatestReplayRequest())
return true;
return false;
} | [
"private",
"static",
"boolean",
"timestampMatch",
"(",
"CaptureSearchResult",
"closest",
",",
"WaybackRequest",
"wbRequest",
")",
"{",
"String",
"replayTimestamp",
"=",
"wbRequest",
".",
"getReplayTimestamp",
"(",
")",
";",
"String",
"captureTimestamp",
"=",
"closest"... | return {@code true} if capture's timestamp matches exactly what's requested.
If requested timestamp is less specific (i.e. less digits) than capture's
timestamp, it is considered non-matching. On the other hand, capture's
timestamp being prefix of requested timestamp is considered a match (this is
to support captures with timestamp shorter than 14-digits. this may change).
@param closest capture to check
@param wbRequest request object
@return {@code true} if match | [
"return",
"{"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java#L730-L743 |
real-logic/agrona | agrona/src/main/java/org/agrona/generation/CompilerUtil.java | CompilerUtil.compileOnDisk | public static Class<?> compileOnDisk(final String className, final Map<String, CharSequence> sources)
throws ClassNotFoundException, IOException
{
final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (null == compiler)
{
throw new IllegalStateException("JDK required to run tests. JRE is not sufficient.");
}
final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null))
{
final ArrayList<String> options = new ArrayList<>(Arrays.asList(
"-classpath", System.getProperty("java.class.path") + File.pathSeparator + TEMP_DIR_NAME));
final Collection<File> files = persist(sources);
final Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files);
final JavaCompiler.CompilationTask task = compiler.getTask(
null, fileManager, diagnostics, options, null, compilationUnits);
return compileAndLoad(className, diagnostics, fileManager, task);
}
} | java | public static Class<?> compileOnDisk(final String className, final Map<String, CharSequence> sources)
throws ClassNotFoundException, IOException
{
final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (null == compiler)
{
throw new IllegalStateException("JDK required to run tests. JRE is not sufficient.");
}
final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null))
{
final ArrayList<String> options = new ArrayList<>(Arrays.asList(
"-classpath", System.getProperty("java.class.path") + File.pathSeparator + TEMP_DIR_NAME));
final Collection<File> files = persist(sources);
final Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files);
final JavaCompiler.CompilationTask task = compiler.getTask(
null, fileManager, diagnostics, options, null, compilationUnits);
return compileAndLoad(className, diagnostics, fileManager, task);
}
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"compileOnDisk",
"(",
"final",
"String",
"className",
",",
"final",
"Map",
"<",
"String",
",",
"CharSequence",
">",
"sources",
")",
"throws",
"ClassNotFoundException",
",",
"IOException",
"{",
"final",
"JavaCompiler",
... | Compile a {@link Map} of source files on disk resulting in a {@link Class} which is named.
@param className to return after compilation.
@param sources to be compiled.
@return the named class that is the result of the compilation.
@throws ClassNotFoundException of the named class cannot be found.
@throws IOException if an error occurs when writing to disk. | [
"Compile",
"a",
"{",
"@link",
"Map",
"}",
"of",
"source",
"files",
"on",
"disk",
"resulting",
"in",
"a",
"{",
"@link",
"Class",
"}",
"which",
"is",
"named",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/generation/CompilerUtil.java#L77-L99 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Strings.java | Strings.mergeSeq | public static String mergeSeq(final String first, final String second, final String delimiter) {
if (isNotEmpty(second) && isNotEmpty(first)) {
List<String> firstSeq = Arrays.asList(split(first, delimiter));
List<String> secondSeq = Arrays.asList(split(second, delimiter));
Collection<String> rs = CollectUtils.union(firstSeq, secondSeq);
StringBuilder buf = new StringBuilder();
for (final String ele : rs)
buf.append(delimiter).append(ele);
if (buf.length() > 0) buf.append(delimiter);
return buf.toString();
} else {
return ((first == null) ? "" : first) + ((second == null) ? "" : second);
}
} | java | public static String mergeSeq(final String first, final String second, final String delimiter) {
if (isNotEmpty(second) && isNotEmpty(first)) {
List<String> firstSeq = Arrays.asList(split(first, delimiter));
List<String> secondSeq = Arrays.asList(split(second, delimiter));
Collection<String> rs = CollectUtils.union(firstSeq, secondSeq);
StringBuilder buf = new StringBuilder();
for (final String ele : rs)
buf.append(delimiter).append(ele);
if (buf.length() > 0) buf.append(delimiter);
return buf.toString();
} else {
return ((first == null) ? "" : first) + ((second == null) ? "" : second);
}
} | [
"public",
"static",
"String",
"mergeSeq",
"(",
"final",
"String",
"first",
",",
"final",
"String",
"second",
",",
"final",
"String",
"delimiter",
")",
"{",
"if",
"(",
"isNotEmpty",
"(",
"second",
")",
"&&",
"isNotEmpty",
"(",
"first",
")",
")",
"{",
"Lis... | 将两个用delimiter串起来的字符串,合并成新的串,重复的"单词"只出现一次.
如果第一个字符串以delimiter开头,第二个字符串以delimiter结尾,<br>
合并后的字符串仍以delimiter开头和结尾.<br>
<p>
<blockquote>
<pre>
mergeSeq(",1,2,", "") = ",1,2,";
mergeSeq(",1,2,", null) = ",1,2,";
mergeSeq("1,2", "3") = "1,2,3";
mergeSeq("1,2", "3,") = "1,2,3,";
mergeSeq(",1,2", "3,") = ",1,2,3,";
mergeSeq(",1,2,", ",3,") = ",1,2,3,";
</pre>
</blockquote>
<p>
@param first
a {@link java.lang.String} object.
@param second
a {@link java.lang.String} object.
@param delimiter
a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"将两个用delimiter串起来的字符串,合并成新的串,重复的",
"单词",
"只出现一次",
".",
"如果第一个字符串以delimiter开头,第二个字符串以delimiter结尾,<br",
">",
"合并后的字符串仍以delimiter开头和结尾",
".",
"<br",
">",
"<p",
">",
"<blockquote",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L604-L617 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/EncodingUtils.java | EncodingUtils.encodeHtml | @Deprecated
public static void encodeHtml(Object value, Appendable out) throws IOException {
encodeHtml(value, true, true, out);
} | java | @Deprecated
public static void encodeHtml(Object value, Appendable out) throws IOException {
encodeHtml(value, true, true, out);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"encodeHtml",
"(",
"Object",
"value",
",",
"Appendable",
"out",
")",
"throws",
"IOException",
"{",
"encodeHtml",
"(",
"value",
",",
"true",
",",
"true",
",",
"out",
")",
";",
"}"
] | Escapes for use in a (X)HTML document and writes to the provided <code>Appendable</code>.
In addition to the standard XML Body encoding, it turns newlines into <br />, tabs to &#x9;, and spaces to &#160;
@param value the object to be escaped. If value is <code>null</code>, nothing is written.
@deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property.
@see TextInXhtmlEncoder | [
"Escapes",
"for",
"use",
"in",
"a",
"(",
"X",
")",
"HTML",
"document",
"and",
"writes",
"to",
"the",
"provided",
"<code",
">",
"Appendable<",
"/",
"code",
">",
".",
"In",
"addition",
"to",
"the",
"standard",
"XML",
"Body",
"encoding",
"it",
"turns",
"n... | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/EncodingUtils.java#L98-L101 |
graphql-java/graphql-java | src/main/java/graphql/schema/DataFetcherFactories.java | DataFetcherFactories.wrapDataFetcher | public static DataFetcher wrapDataFetcher(DataFetcher delegateDataFetcher, BiFunction<DataFetchingEnvironment, Object, Object> mapFunction) {
return environment -> {
Object value = delegateDataFetcher.get(environment);
if (value instanceof CompletionStage) {
//noinspection unchecked
return ((CompletionStage<Object>) value).thenApply(v -> mapFunction.apply(environment, v));
} else {
return mapFunction.apply(environment, value);
}
};
} | java | public static DataFetcher wrapDataFetcher(DataFetcher delegateDataFetcher, BiFunction<DataFetchingEnvironment, Object, Object> mapFunction) {
return environment -> {
Object value = delegateDataFetcher.get(environment);
if (value instanceof CompletionStage) {
//noinspection unchecked
return ((CompletionStage<Object>) value).thenApply(v -> mapFunction.apply(environment, v));
} else {
return mapFunction.apply(environment, value);
}
};
} | [
"public",
"static",
"DataFetcher",
"wrapDataFetcher",
"(",
"DataFetcher",
"delegateDataFetcher",
",",
"BiFunction",
"<",
"DataFetchingEnvironment",
",",
"Object",
",",
"Object",
">",
"mapFunction",
")",
"{",
"return",
"environment",
"->",
"{",
"Object",
"value",
"="... | This helper function allows you to wrap an existing data fetcher and map the value once it completes. It helps you handle
values that might be {@link java.util.concurrent.CompletionStage} returned values as well as plain old objects.
@param delegateDataFetcher the original data fetcher that is present on a {@link graphql.schema.GraphQLFieldDefinition} say
@param mapFunction the bi function to apply to the original value
@return a new data fetcher that wraps the provided data fetcher | [
"This",
"helper",
"function",
"allows",
"you",
"to",
"wrap",
"an",
"existing",
"data",
"fetcher",
"and",
"map",
"the",
"value",
"once",
"it",
"completes",
".",
"It",
"helps",
"you",
"handle",
"values",
"that",
"might",
"be",
"{",
"@link",
"java",
".",
"u... | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/DataFetcherFactories.java#L35-L45 |
google/Accessibility-Test-Framework-for-Android | src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoRef.java | AccessibilityNodeInfoRef.unOwned | public static AccessibilityNodeInfoRef unOwned(
AccessibilityNodeInfoCompat node) {
return node != null ? new AccessibilityNodeInfoRef(node, false) : null;
} | java | public static AccessibilityNodeInfoRef unOwned(
AccessibilityNodeInfoCompat node) {
return node != null ? new AccessibilityNodeInfoRef(node, false) : null;
} | [
"public",
"static",
"AccessibilityNodeInfoRef",
"unOwned",
"(",
"AccessibilityNodeInfoCompat",
"node",
")",
"{",
"return",
"node",
"!=",
"null",
"?",
"new",
"AccessibilityNodeInfoRef",
"(",
"node",
",",
"false",
")",
":",
"null",
";",
"}"
] | Creates a new instance of this class without assuming ownership of
{@code node}. | [
"Creates",
"a",
"new",
"instance",
"of",
"this",
"class",
"without",
"assuming",
"ownership",
"of",
"{"
] | train | https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoRef.java#L100-L103 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java | JdbcCpoXaAdapter.existsObject | @Override
public <T> long existsObject(String name, T obj, Collection<CpoWhere> wheres) throws CpoException {
return getCurrentResource().existsObject( name, obj, wheres);
} | java | @Override
public <T> long existsObject(String name, T obj, Collection<CpoWhere> wheres) throws CpoException {
return getCurrentResource().existsObject( name, obj, wheres);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"existsObject",
"(",
"String",
"name",
",",
"T",
"obj",
",",
"Collection",
"<",
"CpoWhere",
">",
"wheres",
")",
"throws",
"CpoException",
"{",
"return",
"getCurrentResource",
"(",
")",
".",
"existsObject",
... | The CpoAdapter will check to see if this object exists in the datasource.
<p>
<pre>Example:
<code>
<p>
class SomeObject so = new SomeObject();
long count = 0;
class CpoAdapter cpo = null;
<p>
<p>
try {
<p>
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p>
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
CpoWhere where = cpo.newCpoWhere(CpoWhere.LOGIC_NONE, id, CpoWhere.COMP_EQ);
count = cpo.existsObject("SomeExistCheck",so, where);
if (count>0) {
// object exists
} else {
// object does not exist
}
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the EXISTS Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used.
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. This object will be searched for inside the datasource.
@param wheres A collection of CpoWhere objects that pass in run-time constraints to the function that performs the the
exist
@return The number of objects that exist in the datasource that match the specified object
@throws CpoException Thrown if there are errors accessing the datasource | [
"The",
"CpoAdapter",
"will",
"check",
"to",
"see",
"if",
"this",
"object",
"exists",
"in",
"the",
"datasource",
".",
"<p",
">",
"<pre",
">",
"Example",
":",
"<code",
">",
"<p",
">",
"class",
"SomeObject",
"so",
"=",
"new",
"SomeObject",
"()",
";",
"lon... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L961-L964 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java | UserHandlerImpl.writeUser | private void writeUser(User user, Node node) throws Exception
{
node.setProperty(UserProperties.JOS_EMAIL, user.getEmail());
node.setProperty(UserProperties.JOS_FIRST_NAME, user.getFirstName());
node.setProperty(UserProperties.JOS_LAST_NAME, user.getLastName());
node.setProperty(UserProperties.JOS_PASSWORD, user.getPassword());
node.setProperty(UserProperties.JOS_DISPLAY_NAME, user.getDisplayName());
node.setProperty(UserProperties.JOS_USER_NAME, node.getName());
Calendar calendar = Calendar.getInstance();
calendar.setTime(user.getCreatedDate());
node.setProperty(UserProperties.JOS_CREATED_DATE, calendar);
} | java | private void writeUser(User user, Node node) throws Exception
{
node.setProperty(UserProperties.JOS_EMAIL, user.getEmail());
node.setProperty(UserProperties.JOS_FIRST_NAME, user.getFirstName());
node.setProperty(UserProperties.JOS_LAST_NAME, user.getLastName());
node.setProperty(UserProperties.JOS_PASSWORD, user.getPassword());
node.setProperty(UserProperties.JOS_DISPLAY_NAME, user.getDisplayName());
node.setProperty(UserProperties.JOS_USER_NAME, node.getName());
Calendar calendar = Calendar.getInstance();
calendar.setTime(user.getCreatedDate());
node.setProperty(UserProperties.JOS_CREATED_DATE, calendar);
} | [
"private",
"void",
"writeUser",
"(",
"User",
"user",
",",
"Node",
"node",
")",
"throws",
"Exception",
"{",
"node",
".",
"setProperty",
"(",
"UserProperties",
".",
"JOS_EMAIL",
",",
"user",
".",
"getEmail",
"(",
")",
")",
";",
"node",
".",
"setProperty",
... | Write user properties from the node to the storage.
@param node
the node where user properties are stored
@return {@link User} | [
"Write",
"user",
"properties",
"from",
"the",
"node",
"to",
"the",
"storage",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java#L605-L617 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveNameAndTypeIndex | int resolveNameAndTypeIndex(String name, String descriptor)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameAndTypeIndex(name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index != -1)
{
return index;
}
else
{
int nameIndex = resolveNameIndex(name);
int typeIndex = resolveNameIndex(descriptor);
return addConstantInfo(new NameAndType(nameIndex, typeIndex), size);
}
} | java | int resolveNameAndTypeIndex(String name, String descriptor)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameAndTypeIndex(name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index != -1)
{
return index;
}
else
{
int nameIndex = resolveNameIndex(name);
int typeIndex = resolveNameIndex(descriptor);
return addConstantInfo(new NameAndType(nameIndex, typeIndex), size);
}
} | [
"int",
"resolveNameAndTypeIndex",
"(",
"String",
"name",
",",
"String",
"descriptor",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"size",
"=",
"getConstantPoolSize",
"... | Returns the constant map index to name and type
If entry doesn't exist it is created.
@param name
@param descriptor
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"name",
"and",
"type",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L322-L346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.