repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendText | public static void sendText(final String message, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendText(message, wsChannel, callback, null);
} | java | public static void sendText(final String message, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendText(message, wsChannel, callback, null);
} | [
"public",
"static",
"void",
"sendText",
"(",
"final",
"String",
"message",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"Void",
">",
"callback",
")",
"{",
"sendText",
"(",
"message",
",",
"wsChannel",
",",
"callback",
... | Sends a complete text message, invoking the callback when complete
@param message The text to send
@param wsChannel The web socket channel
@param callback The callback to invoke on completion | [
"Sends",
"a",
"complete",
"text",
"message",
"invoking",
"the",
"callback",
"when",
"complete"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L49-L51 |
virgo47/javasimon | core/src/main/java/org/javasimon/callback/quantiles/Buckets.java | Buckets.computeQuantile | private double computeQuantile(double ration, int totalCount) throws IllegalStateException, IllegalArgumentException {
if (ration <= 0.0D || ration >= 1.0D) {
throw new IllegalArgumentException("Expected ratio between 0 and 1 excluded: " + ration);
}
final double expectedCount = ration * totalCount;
// Search bucket corresponding to expected count
double lastCount = 0D, newCount;
int bucketIndex = 0;
for (int i = 0; i < buckets.length; i++) {
newCount = lastCount + buckets[i].getCount();
if (expectedCount >= lastCount && expectedCount < newCount) {
bucketIndex = i;
break;
}
lastCount = newCount;
}
// Check that bucket index is in bounds
if (bucketIndex == 0) {
throw new IllegalStateException("Quantile out of bounds: decrease min");
} else if (bucketIndex == bucketNb + 1) {
throw new IllegalStateException("Quantile out of bounds: increase max");
}
// Interpolation of value
final Bucket bucket = buckets[bucketIndex];
return estimateQuantile(bucket, expectedCount, lastCount);
} | java | private double computeQuantile(double ration, int totalCount) throws IllegalStateException, IllegalArgumentException {
if (ration <= 0.0D || ration >= 1.0D) {
throw new IllegalArgumentException("Expected ratio between 0 and 1 excluded: " + ration);
}
final double expectedCount = ration * totalCount;
// Search bucket corresponding to expected count
double lastCount = 0D, newCount;
int bucketIndex = 0;
for (int i = 0; i < buckets.length; i++) {
newCount = lastCount + buckets[i].getCount();
if (expectedCount >= lastCount && expectedCount < newCount) {
bucketIndex = i;
break;
}
lastCount = newCount;
}
// Check that bucket index is in bounds
if (bucketIndex == 0) {
throw new IllegalStateException("Quantile out of bounds: decrease min");
} else if (bucketIndex == bucketNb + 1) {
throw new IllegalStateException("Quantile out of bounds: increase max");
}
// Interpolation of value
final Bucket bucket = buckets[bucketIndex];
return estimateQuantile(bucket, expectedCount, lastCount);
} | [
"private",
"double",
"computeQuantile",
"(",
"double",
"ration",
",",
"int",
"totalCount",
")",
"throws",
"IllegalStateException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"ration",
"<=",
"0.0D",
"||",
"ration",
">=",
"1.0D",
")",
"{",
"throw",
"new",
... | Computes given quantile.
@param ration Nth quantile: 0.5 is median
@param totalCount Total count over all buckets
@return Quantile
@throws IllegalStateException Buckets are poorly configured and
quantile can not be computed
@throws IllegalArgumentException | [
"Computes",
"given",
"quantile",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/Buckets.java#L101-L126 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.scanForUpdatesAsync | public Observable<Void> scanForUpdatesAsync(String deviceName, String resourceGroupName) {
return scanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> scanForUpdatesAsync(String deviceName, String resourceGroupName) {
return scanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"scanForUpdatesAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"scanForUpdatesWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
... | Scans for updates on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Scans",
"for",
"updates",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1707-L1714 |
app55/app55-java | src/support/java/com/googlecode/openbeans/beancontext/BeanContextSupport.java | BeanContextSupport.setLocale | public void setLocale(Locale newLocale) throws PropertyVetoException
{
if (newLocale == null || newLocale == locale)
{
return; // ignore null locale
}
PropertyChangeEvent event = new PropertyChangeEvent(beanContextChildPeer, "locale", locale, newLocale);
// apply change
Locale oldLocale = locale;
locale = newLocale;
try
{
// notify vetoable listeners
vcSupport.fireVetoableChange(event);
}
catch (PropertyVetoException e)
{
// rollback change
locale = oldLocale;
throw e;
}
// Notify BeanContext about this change
this.pcSupport.firePropertyChange(event);
} | java | public void setLocale(Locale newLocale) throws PropertyVetoException
{
if (newLocale == null || newLocale == locale)
{
return; // ignore null locale
}
PropertyChangeEvent event = new PropertyChangeEvent(beanContextChildPeer, "locale", locale, newLocale);
// apply change
Locale oldLocale = locale;
locale = newLocale;
try
{
// notify vetoable listeners
vcSupport.fireVetoableChange(event);
}
catch (PropertyVetoException e)
{
// rollback change
locale = oldLocale;
throw e;
}
// Notify BeanContext about this change
this.pcSupport.firePropertyChange(event);
} | [
"public",
"void",
"setLocale",
"(",
"Locale",
"newLocale",
")",
"throws",
"PropertyVetoException",
"{",
"if",
"(",
"newLocale",
"==",
"null",
"||",
"newLocale",
"==",
"locale",
")",
"{",
"return",
";",
"// ignore null locale",
"}",
"PropertyChangeEvent",
"event",
... | Sets the locale of this context. <code>VetoableChangeListener</code>s and <code>PropertyChangeListener</code>s are notified.
@param newLocale
the new locale to set
@throws PropertyVetoException
if any <code>VetoableChangeListener</code> vetos this change | [
"Sets",
"the",
"locale",
"of",
"this",
"context",
".",
"<code",
">",
"VetoableChangeListener<",
"/",
"code",
">",
"s",
"and",
"<code",
">",
"PropertyChangeListener<",
"/",
"code",
">",
"s",
"are",
"notified",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/beancontext/BeanContextSupport.java#L1240-L1266 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java | EJSContainer.preInvokeORBDispatch | @Override
public Object preInvokeORBDispatch(Object object, String operation) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled()) {
// toString of 'object' can be quite large and can really bloat the
// trace.... so just trace the class name; usually the tie name or
// class loader name. The IOR or classpath is not traced. d133384
String objStr = null;
if (object != null)
objStr = object.getClass().getName();
Tr.debug(tc, "preInvokeORBDispatch(" + objStr + ", " + operation + ")");
}
EJBThreadData threadData = null;
if (object instanceof javax.rmi.CORBA.Tie) {
object = ((javax.rmi.CORBA.Tie) object).getTarget();
if (object instanceof EJSWrapperBase) {
final EJSWrapperBase wrapper = (EJSWrapperBase) object;
BeanMetaData bmd = wrapper.bmd;
// null if EJBFactory
if (bmd != null) {
threadData = svThreadData.get();
// d153263
// push the old class loader to the ORB dispatch stack so that the wrapper classloader
// can be popped off the "stack" before the marshalling the return object in the stub.
// See any generated stub with input param and return to see the problem described in defect
//
// There are 2 paths need to be taken care of:
// 1. in the normal case, the wrapper classloader is popped off when from container.postinvoke().
// 2. after the object resolver preInvoke is performed and exception takes place before
// wrapper.postInvoke() has a chance to clean up.
threadData.pushClassLoader(bmd);
}
}
}
// d646139.2 - For performance, return the EJBThreadData as the cookie to
// avoid needing to look it up again in postInvokeORBDispatch.
// d717291 - Return null to indicate a non-EJB request.
return threadData; // d646139.2
} | java | @Override
public Object preInvokeORBDispatch(Object object, String operation) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled()) {
// toString of 'object' can be quite large and can really bloat the
// trace.... so just trace the class name; usually the tie name or
// class loader name. The IOR or classpath is not traced. d133384
String objStr = null;
if (object != null)
objStr = object.getClass().getName();
Tr.debug(tc, "preInvokeORBDispatch(" + objStr + ", " + operation + ")");
}
EJBThreadData threadData = null;
if (object instanceof javax.rmi.CORBA.Tie) {
object = ((javax.rmi.CORBA.Tie) object).getTarget();
if (object instanceof EJSWrapperBase) {
final EJSWrapperBase wrapper = (EJSWrapperBase) object;
BeanMetaData bmd = wrapper.bmd;
// null if EJBFactory
if (bmd != null) {
threadData = svThreadData.get();
// d153263
// push the old class loader to the ORB dispatch stack so that the wrapper classloader
// can be popped off the "stack" before the marshalling the return object in the stub.
// See any generated stub with input param and return to see the problem described in defect
//
// There are 2 paths need to be taken care of:
// 1. in the normal case, the wrapper classloader is popped off when from container.postinvoke().
// 2. after the object resolver preInvoke is performed and exception takes place before
// wrapper.postInvoke() has a chance to clean up.
threadData.pushClassLoader(bmd);
}
}
}
// d646139.2 - For performance, return the EJBThreadData as the cookie to
// avoid needing to look it up again in postInvokeORBDispatch.
// d717291 - Return null to indicate a non-EJB request.
return threadData; // d646139.2
} | [
"@",
"Override",
"public",
"Object",
"preInvokeORBDispatch",
"(",
"Object",
"object",
",",
"String",
"operation",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
"... | This method is driven when dispatch is called upon a server request.
It should return a 'cookie' Object which uniquely identifies this preinvoke.
This 'cookie' should be passed as a paramater when the corresponding
postinvoke is called.
@param object the IDL Servant or RMI Tie
@param operation the operation being invoked
@return Object a 'cookie' which uniquely identifies this preinvoke() | [
"This",
"method",
"is",
"driven",
"when",
"dispatch",
"is",
"called",
"upon",
"a",
"server",
"request",
".",
"It",
"should",
"return",
"a",
"cookie",
"Object",
"which",
"uniquely",
"identifies",
"this",
"preinvoke",
".",
"This",
"cookie",
"should",
"be",
"pa... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L4444-L4486 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.credit_balance_balanceName_GET | public OvhBalance credit_balance_balanceName_GET(String balanceName) throws IOException {
String qPath = "/me/credit/balance/{balanceName}";
StringBuilder sb = path(qPath, balanceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBalance.class);
} | java | public OvhBalance credit_balance_balanceName_GET(String balanceName) throws IOException {
String qPath = "/me/credit/balance/{balanceName}";
StringBuilder sb = path(qPath, balanceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBalance.class);
} | [
"public",
"OvhBalance",
"credit_balance_balanceName_GET",
"(",
"String",
"balanceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/credit/balance/{balanceName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"balanceName",
")",
"... | Retrieve a credit balance
REST: GET /me/credit/balance/{balanceName}
@param balanceName [required] Balance name | [
"Retrieve",
"a",
"credit",
"balance"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L910-L915 |
deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server/src/main/java/org/nd4j/parameterserver/updater/SynchronousParameterUpdater.java | SynchronousParameterUpdater.partialUpdate | @Override
public void partialUpdate(INDArray arr, INDArray result, long idx, int... dimensions) {
result.tensorAlongDimension((int) idx, dimensions).addi(arr);
} | java | @Override
public void partialUpdate(INDArray arr, INDArray result, long idx, int... dimensions) {
result.tensorAlongDimension((int) idx, dimensions).addi(arr);
} | [
"@",
"Override",
"public",
"void",
"partialUpdate",
"(",
"INDArray",
"arr",
",",
"INDArray",
"result",
",",
"long",
"idx",
",",
"int",
"...",
"dimensions",
")",
"{",
"result",
".",
"tensorAlongDimension",
"(",
"(",
"int",
")",
"idx",
",",
"dimensions",
")"... | Updates result
based on arr along a particular
{@link INDArray#tensorAlongDimension(int, int...)}
@param arr the array to update
@param result the result ndarray to update
@param idx the index to update
@param dimensions the dimensions to update | [
"Updates",
"result",
"based",
"on",
"arr",
"along",
"a",
"particular",
"{",
"@link",
"INDArray#tensorAlongDimension",
"(",
"int",
"int",
"...",
")",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server/src/main/java/org/nd4j/parameterserver/updater/SynchronousParameterUpdater.java#L167-L170 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java | SeaGlassRootPaneUI.installWindowListeners | private void installWindowListeners(JRootPane root, Component parent) {
if (parent instanceof Window) {
window = (Window) parent;
} else {
window = SwingUtilities.getWindowAncestor(parent);
}
if (window != null) {
if (mouseInputListener == null) {
mouseInputListener = createWindowMouseInputListener(root);
}
window.addMouseListener(mouseInputListener);
window.addMouseMotionListener(mouseInputListener);
if (windowListener == null) {
windowListener = createFocusListener();
window.addWindowListener(windowListener);
}
}
} | java | private void installWindowListeners(JRootPane root, Component parent) {
if (parent instanceof Window) {
window = (Window) parent;
} else {
window = SwingUtilities.getWindowAncestor(parent);
}
if (window != null) {
if (mouseInputListener == null) {
mouseInputListener = createWindowMouseInputListener(root);
}
window.addMouseListener(mouseInputListener);
window.addMouseMotionListener(mouseInputListener);
if (windowListener == null) {
windowListener = createFocusListener();
window.addWindowListener(windowListener);
}
}
} | [
"private",
"void",
"installWindowListeners",
"(",
"JRootPane",
"root",
",",
"Component",
"parent",
")",
"{",
"if",
"(",
"parent",
"instanceof",
"Window",
")",
"{",
"window",
"=",
"(",
"Window",
")",
"parent",
";",
"}",
"else",
"{",
"window",
"=",
"SwingUti... | Installs the necessary Listeners on the parent <code>Window</code>, if
there is one.
<p>This takes the parent so that cleanup can be done from <code>
removeNotify</code>, at which point the parent hasn't been reset yet.</p>
@param root the JRootPane.
@param parent The parent of the JRootPane | [
"Installs",
"the",
"necessary",
"Listeners",
"on",
"the",
"parent",
"<code",
">",
"Window<",
"/",
"code",
">",
"if",
"there",
"is",
"one",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java#L347-L366 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.onCheckSetAttribute | private <E> boolean onCheckSetAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass)
{
if (pluralAttribute != null)
{
if (isSetAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass))
{
return true;
}
}
return false;
} | java | private <E> boolean onCheckSetAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass)
{
if (pluralAttribute != null)
{
if (isSetAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass))
{
return true;
}
}
return false;
} | [
"private",
"<",
"E",
">",
"boolean",
"onCheckSetAttribute",
"(",
"PluralAttribute",
"<",
"?",
"super",
"X",
",",
"?",
",",
"?",
">",
"pluralAttribute",
",",
"Class",
"<",
"E",
">",
"paramClass",
")",
"{",
"if",
"(",
"pluralAttribute",
"!=",
"null",
")",
... | On check set attribute.
@param <E>
the element type
@param pluralAttribute
the plural attribute
@param paramClass
the param class
@return true, if successful | [
"On",
"check",
"set",
"attribute",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L956-L968 |
dkmfbk/knowledgestore | ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/AbstractHBaseUtils.java | AbstractHBaseUtils.getScan | public Scan getScan(String tableName,
String famName) throws IOException {
return getResultScan(tableName, famName, null, null);
} | java | public Scan getScan(String tableName,
String famName) throws IOException {
return getResultScan(tableName, famName, null, null);
} | [
"public",
"Scan",
"getScan",
"(",
"String",
"tableName",
",",
"String",
"famName",
")",
"throws",
"IOException",
"{",
"return",
"getResultScan",
"(",
"tableName",
",",
"famName",
",",
"null",
",",
"null",
")",
";",
"}"
] | Creates a result scanner
@param tableName
@param famName
@param conf
@return
@throws IOException | [
"Creates",
"a",
"result",
"scanner"
] | train | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/AbstractHBaseUtils.java#L250-L253 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.fieldsIn | public static Set<VariableElement>
fieldsIn(Set<? extends Element> elements) {
return setFilter(elements, FIELD_KINDS, VariableElement.class);
} | java | public static Set<VariableElement>
fieldsIn(Set<? extends Element> elements) {
return setFilter(elements, FIELD_KINDS, VariableElement.class);
} | [
"public",
"static",
"Set",
"<",
"VariableElement",
">",
"fieldsIn",
"(",
"Set",
"<",
"?",
"extends",
"Element",
">",
"elements",
")",
"{",
"return",
"setFilter",
"(",
"elements",
",",
"FIELD_KINDS",
",",
"VariableElement",
".",
"class",
")",
";",
"}"
] | Returns a set of fields in {@code elements}.
@return a set of fields in {@code elements}
@param elements the elements to filter | [
"Returns",
"a",
"set",
"of",
"fields",
"in",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L102-L105 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/HostCertificateManager.java | HostCertificateManager.replaceCACertificatesAndCRLs | public void replaceCACertificatesAndCRLs(String[] caCert, String[] caCrl) throws HostConfigFault, RuntimeFault, RemoteException {
getVimService().replaceCACertificatesAndCRLs(getMOR(), caCert, caCrl);
} | java | public void replaceCACertificatesAndCRLs(String[] caCert, String[] caCrl) throws HostConfigFault, RuntimeFault, RemoteException {
getVimService().replaceCACertificatesAndCRLs(getMOR(), caCert, caCrl);
} | [
"public",
"void",
"replaceCACertificatesAndCRLs",
"(",
"String",
"[",
"]",
"caCert",
",",
"String",
"[",
"]",
"caCrl",
")",
"throws",
"HostConfigFault",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"getVimService",
"(",
")",
".",
"replaceCACertificatesAndCRLs",... | Replaces the trusted Certificate Authority (CA) certificates and Certification Revocation List (CRL) used by the
server with the provided values. These determine whether the server can verify the identity of an external entity.
@param caCert List of SSL certificates, in PEM format, of all CAs that should be trusted
@param caCrl List of SSL CRLs, in PEM format, issued by trusted CAs from the above list
@throws HostConfigFault
@throws RuntimeFault
@throws RemoteException | [
"Replaces",
"the",
"trusted",
"Certificate",
"Authority",
"(",
"CA",
")",
"certificates",
"and",
"Certification",
"Revocation",
"List",
"(",
"CRL",
")",
"used",
"by",
"the",
"server",
"with",
"the",
"provided",
"values",
".",
"These",
"determine",
"whether",
"... | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/HostCertificateManager.java#L112-L114 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/BillingApi.java | BillingApi.getPlan | public AccountBillingPlanResponse getPlan(String accountId, BillingApi.GetPlanOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling getPlan");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/billing_plan".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_credit_card_information", options.includeCreditCardInformation));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_metadata", options.includeMetadata));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_successor_plans", options.includeSuccessorPlans));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<AccountBillingPlanResponse> localVarReturnType = new GenericType<AccountBillingPlanResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public AccountBillingPlanResponse getPlan(String accountId, BillingApi.GetPlanOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling getPlan");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/billing_plan".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_credit_card_information", options.includeCreditCardInformation));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_metadata", options.includeMetadata));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_successor_plans", options.includeSuccessorPlans));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<AccountBillingPlanResponse> localVarReturnType = new GenericType<AccountBillingPlanResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"AccountBillingPlanResponse",
"getPlan",
"(",
"String",
"accountId",
",",
"BillingApi",
".",
"GetPlanOptions",
"options",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"\"{}\"",
";",
"// verify the required parameter 'accountId' is set",
"... | Get Account Billing Plan
Retrieves the billing plan information for the specified account, including the current billing plan, successor plans, billing address, and billing credit card. By default the successor plan and credit card information is included in the response. This information can be excluded from the response by adding the appropriate optional query string with the `setting` set to **false**. Response The response returns the billing plan information, including the currency code, for the plan. The `billingPlan` and `succesorPlans` property values are the same as those shown in the [ML:Get Billing Plan Details] reference. the `billingAddress` and `creditCardInformation` property values are the same as those shown in the [ML:Update Billing Plan] reference. ###### Note: When credit card number information is shown, a mask is applied to the response so that only the last 4 digits of the card number are visible.
@param accountId The external account number (int) or account ID Guid. (required)
@param options for modifying the method behavior.
@return AccountBillingPlanResponse
@throws ApiException if fails to make API call | [
"Get",
"Account",
"Billing",
"Plan",
"Retrieves",
"the",
"billing",
"plan",
"information",
"for",
"the",
"specified",
"account",
"including",
"the",
"current",
"billing",
"plan",
"successor",
"plans",
"billing",
"address",
"and",
"billing",
"credit",
"card",
".",
... | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/BillingApi.java#L292-L330 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java | ParallelIndexSupervisorTask.allocateSegment | @POST
@Path("/segment/allocate")
@Produces(SmileMediaTypes.APPLICATION_JACKSON_SMILE)
@Consumes(SmileMediaTypes.APPLICATION_JACKSON_SMILE)
public Response allocateSegment(DateTime timestamp, @Context final HttpServletRequest req)
{
ChatHandlers.authorizationCheck(
req,
Action.READ,
getDataSource(),
authorizerMapper
);
if (toolbox == null) {
return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("task is not running yet").build();
}
try {
final SegmentIdWithShardSpec segmentIdentifier = allocateNewSegment(timestamp);
return Response.ok(toolbox.getObjectMapper().writeValueAsBytes(segmentIdentifier)).build();
}
catch (IOException | IllegalStateException e) {
return Response.serverError().entity(Throwables.getStackTraceAsString(e)).build();
}
catch (IllegalArgumentException e) {
return Response.status(Response.Status.BAD_REQUEST).entity(Throwables.getStackTraceAsString(e)).build();
}
} | java | @POST
@Path("/segment/allocate")
@Produces(SmileMediaTypes.APPLICATION_JACKSON_SMILE)
@Consumes(SmileMediaTypes.APPLICATION_JACKSON_SMILE)
public Response allocateSegment(DateTime timestamp, @Context final HttpServletRequest req)
{
ChatHandlers.authorizationCheck(
req,
Action.READ,
getDataSource(),
authorizerMapper
);
if (toolbox == null) {
return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("task is not running yet").build();
}
try {
final SegmentIdWithShardSpec segmentIdentifier = allocateNewSegment(timestamp);
return Response.ok(toolbox.getObjectMapper().writeValueAsBytes(segmentIdentifier)).build();
}
catch (IOException | IllegalStateException e) {
return Response.serverError().entity(Throwables.getStackTraceAsString(e)).build();
}
catch (IllegalArgumentException e) {
return Response.status(Response.Status.BAD_REQUEST).entity(Throwables.getStackTraceAsString(e)).build();
}
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"/segment/allocate\"",
")",
"@",
"Produces",
"(",
"SmileMediaTypes",
".",
"APPLICATION_JACKSON_SMILE",
")",
"@",
"Consumes",
"(",
"SmileMediaTypes",
".",
"APPLICATION_JACKSON_SMILE",
")",
"public",
"Response",
"allocateSegment",
"(",
... | Allocate a new {@link SegmentIdWithShardSpec} for a request from {@link ParallelIndexSubTask}.
The returned segmentIdentifiers have different {@code partitionNum} (thereby different {@link NumberedShardSpec})
per bucket interval. | [
"Allocate",
"a",
"new",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java#L356-L383 |
podio/podio-java | src/main/java/com/podio/app/AppAPI.java | AppAPI.updateApp | public void updateApp(int appId, ApplicationUpdate app) {
getResourceFactory().getApiResource("/app/" + appId)
.entity(app, MediaType.APPLICATION_JSON).put();
} | java | public void updateApp(int appId, ApplicationUpdate app) {
getResourceFactory().getApiResource("/app/" + appId)
.entity(app, MediaType.APPLICATION_JSON).put();
} | [
"public",
"void",
"updateApp",
"(",
"int",
"appId",
",",
"ApplicationUpdate",
"app",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/app/\"",
"+",
"appId",
")",
".",
"entity",
"(",
"app",
",",
"MediaType",
".",
"APPLICATION_JSON",
"... | Updates an app. The update can contain an new configuration for the app,
addition of new fields as well as updates to the configuration of
existing fields. Fields not included will not be deleted. To delete a
field use the "delete field" operation.
When adding/updating/deleting apps and fields, it can be simpler to only
update the app config here and add/update/remove fields using the
field/{field_id} sub resource.
@param appId
The id of the app to be updated
@param app
The updated app definition | [
"Updates",
"an",
"app",
".",
"The",
"update",
"can",
"contain",
"an",
"new",
"configuration",
"for",
"the",
"app",
"addition",
"of",
"new",
"fields",
"as",
"well",
"as",
"updates",
"to",
"the",
"configuration",
"of",
"existing",
"fields",
".",
"Fields",
"n... | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L97-L100 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java | FeatureScopes.createSimpleFeatureCallScope | public IScope createSimpleFeatureCallScope(EObject context, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
IScope root = IScope.NULLSCOPE;
if (context instanceof XFeatureCall) {
XFeatureCall featureCall = (XFeatureCall) context;
if (!featureCall.isExplicitOperationCallOrBuilderSyntax()) {
root = createTypeLiteralScope(context, QualifiedName.EMPTY, root, session, resolvedTypes);
if (isDefiniteTypeLiteral(featureCall)) {
return root;
}
}
}
IScope staticImports = createStaticFeaturesScope(context, root, session);
IScope staticMembers = createStaticScope(asAbstractFeatureCall(context), null, null, staticImports, session, resolvedTypes);
IScope staticExtensions = createStaticExtensionsScope(null, null, context, staticMembers, session, resolvedTypes);
// we don't want to use captured instances of 'IT' as dynamic extension implicit argument
// thus the dynamic extension scope only works for the *real* local variables
IScope dynamicExtensions = createDynamicExtensionsScope(null, null, context, staticExtensions, session, resolvedTypes);
IScope localVariables = createImplicitFeatureCallAndLocalVariableScope(context, dynamicExtensions, session, resolvedTypes);
return localVariables;
} | java | public IScope createSimpleFeatureCallScope(EObject context, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
IScope root = IScope.NULLSCOPE;
if (context instanceof XFeatureCall) {
XFeatureCall featureCall = (XFeatureCall) context;
if (!featureCall.isExplicitOperationCallOrBuilderSyntax()) {
root = createTypeLiteralScope(context, QualifiedName.EMPTY, root, session, resolvedTypes);
if (isDefiniteTypeLiteral(featureCall)) {
return root;
}
}
}
IScope staticImports = createStaticFeaturesScope(context, root, session);
IScope staticMembers = createStaticScope(asAbstractFeatureCall(context), null, null, staticImports, session, resolvedTypes);
IScope staticExtensions = createStaticExtensionsScope(null, null, context, staticMembers, session, resolvedTypes);
// we don't want to use captured instances of 'IT' as dynamic extension implicit argument
// thus the dynamic extension scope only works for the *real* local variables
IScope dynamicExtensions = createDynamicExtensionsScope(null, null, context, staticExtensions, session, resolvedTypes);
IScope localVariables = createImplicitFeatureCallAndLocalVariableScope(context, dynamicExtensions, session, resolvedTypes);
return localVariables;
} | [
"public",
"IScope",
"createSimpleFeatureCallScope",
"(",
"EObject",
"context",
",",
"IFeatureScopeSession",
"session",
",",
"IResolvedTypes",
"resolvedTypes",
")",
"{",
"IScope",
"root",
"=",
"IScope",
".",
"NULLSCOPE",
";",
"if",
"(",
"context",
"instanceof",
"XFea... | This method serves as an entry point for the content assist scoping for simple feature calls.
@param context the context e.g. a for loop expression, a block or a catch clause | [
"This",
"method",
"serves",
"as",
"an",
"entry",
"point",
"for",
"the",
"content",
"assist",
"scoping",
"for",
"simple",
"feature",
"calls",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java#L104-L123 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java | CounterGroup.findCounter | protected Counter findCounter(String counterName, String displayName) {
Counter result = counters.get(counterName);
if (result == null) {
result = new Counter(counterName, displayName);
counters.put(counterName, result);
}
return result;
} | java | protected Counter findCounter(String counterName, String displayName) {
Counter result = counters.get(counterName);
if (result == null) {
result = new Counter(counterName, displayName);
counters.put(counterName, result);
}
return result;
} | [
"protected",
"Counter",
"findCounter",
"(",
"String",
"counterName",
",",
"String",
"displayName",
")",
"{",
"Counter",
"result",
"=",
"counters",
".",
"get",
"(",
"counterName",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
... | Internal to find a counter in a group.
@param counterName the name of the counter
@param displayName the display name of the counter
@return the counter that was found or added | [
"Internal",
"to",
"find",
"a",
"counter",
"in",
"a",
"group",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/CounterGroup.java#L94-L101 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagHtmlBase.java | TagHtmlBase.renderAttributes | protected void renderAttributes(int type, AbstractRenderAppender sb, AbstractAttributeState state, boolean doubleQuote)
{
HashMap map = null;
switch (type) {
case AbstractHtmlState.ATTR_JAVASCRIPT:
assert(state instanceof AbstractHtmlState) : "ATTR_JAVASCRIPT requires a AbstractHtmlState instance";
AbstractHtmlState htmlState = (AbstractHtmlState) state;
map = htmlState.getEventMap();
break;
default:
super.renderAttributes(type, sb, state, doubleQuote);
return;
}
renderGeneral(map, sb, doubleQuote);
} | java | protected void renderAttributes(int type, AbstractRenderAppender sb, AbstractAttributeState state, boolean doubleQuote)
{
HashMap map = null;
switch (type) {
case AbstractHtmlState.ATTR_JAVASCRIPT:
assert(state instanceof AbstractHtmlState) : "ATTR_JAVASCRIPT requires a AbstractHtmlState instance";
AbstractHtmlState htmlState = (AbstractHtmlState) state;
map = htmlState.getEventMap();
break;
default:
super.renderAttributes(type, sb, state, doubleQuote);
return;
}
renderGeneral(map, sb, doubleQuote);
} | [
"protected",
"void",
"renderAttributes",
"(",
"int",
"type",
",",
"AbstractRenderAppender",
"sb",
",",
"AbstractAttributeState",
"state",
",",
"boolean",
"doubleQuote",
")",
"{",
"HashMap",
"map",
"=",
"null",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"Abs... | Render all of the attributes defined in a map and return the string value. The attributes
are rendered with in a name="value" style supported by XML.
@param type an integer key indentifying the map | [
"Render",
"all",
"of",
"the",
"attributes",
"defined",
"in",
"a",
"map",
"and",
"return",
"the",
"string",
"value",
".",
"The",
"attributes",
"are",
"rendered",
"with",
"in",
"a",
"name",
"=",
"value",
"style",
"supported",
"by",
"XML",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagHtmlBase.java#L30-L44 |
roboconf/roboconf-platform | core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java | OpenstackIaasHandler.validateAll | static void validateAll( Map<String,String> targetProperties, String appName, String instanceName )
throws TargetException {
// Basic checks
validate( targetProperties );
// Storage checks
Set<String> mountPoints = new HashSet<> ();
Set<String> volumeNames = new HashSet<> ();
for( String s : findStorageIds( targetProperties )) {
// Unit tests should guarantee there is a default value for the "mount point".
String mountPoint = findStorageProperty( targetProperties, s, VOLUME_MOUNT_POINT_PREFIX );
if( mountPoints.contains( mountPoint ))
throw new TargetException( "Mount point '" + mountPoint + "' is already used by another volume for this VM." );
mountPoints.add( mountPoint );
// Same thing for the volume name
String volumeName = findStorageProperty( targetProperties, s, VOLUME_NAME_PREFIX );
volumeName = expandVolumeName( volumeName, appName, instanceName );
if( volumeNames.contains( volumeName ))
throw new TargetException( "Volume name '" + volumeName + "' is already used by another volume for this VM." );
volumeNames.add( volumeName );
// Validate volume size
String volumesize = findStorageProperty( targetProperties, s, VOLUME_SIZE_GB_PREFIX );
try {
Integer.valueOf( volumesize );
} catch( NumberFormatException e ) {
throw new TargetException( "The volume size must be a valid integer.", e );
}
}
} | java | static void validateAll( Map<String,String> targetProperties, String appName, String instanceName )
throws TargetException {
// Basic checks
validate( targetProperties );
// Storage checks
Set<String> mountPoints = new HashSet<> ();
Set<String> volumeNames = new HashSet<> ();
for( String s : findStorageIds( targetProperties )) {
// Unit tests should guarantee there is a default value for the "mount point".
String mountPoint = findStorageProperty( targetProperties, s, VOLUME_MOUNT_POINT_PREFIX );
if( mountPoints.contains( mountPoint ))
throw new TargetException( "Mount point '" + mountPoint + "' is already used by another volume for this VM." );
mountPoints.add( mountPoint );
// Same thing for the volume name
String volumeName = findStorageProperty( targetProperties, s, VOLUME_NAME_PREFIX );
volumeName = expandVolumeName( volumeName, appName, instanceName );
if( volumeNames.contains( volumeName ))
throw new TargetException( "Volume name '" + volumeName + "' is already used by another volume for this VM." );
volumeNames.add( volumeName );
// Validate volume size
String volumesize = findStorageProperty( targetProperties, s, VOLUME_SIZE_GB_PREFIX );
try {
Integer.valueOf( volumesize );
} catch( NumberFormatException e ) {
throw new TargetException( "The volume size must be a valid integer.", e );
}
}
} | [
"static",
"void",
"validateAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"targetProperties",
",",
"String",
"appName",
",",
"String",
"instanceName",
")",
"throws",
"TargetException",
"{",
"// Basic checks",
"validate",
"(",
"targetProperties",
")",
";",
... | Validates the target properties, including storage ones.
@param targetProperties
@param appName
@param instanceName
@throws TargetException | [
"Validates",
"the",
"target",
"properties",
"including",
"storage",
"ones",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L443-L478 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AbsPathChecker.java | AbsPathChecker.visitFunction | public boolean visitFunction(ExpressionOwner owner, Function func)
{
if((func instanceof FuncCurrent) ||
(func instanceof FuncExtFunction))
m_isAbs = false;
return true;
} | java | public boolean visitFunction(ExpressionOwner owner, Function func)
{
if((func instanceof FuncCurrent) ||
(func instanceof FuncExtFunction))
m_isAbs = false;
return true;
} | [
"public",
"boolean",
"visitFunction",
"(",
"ExpressionOwner",
"owner",
",",
"Function",
"func",
")",
"{",
"if",
"(",
"(",
"func",
"instanceof",
"FuncCurrent",
")",
"||",
"(",
"func",
"instanceof",
"FuncExtFunction",
")",
")",
"m_isAbs",
"=",
"false",
";",
"r... | Visit a function.
@param owner The owner of the expression, to which the expression can
be reset if rewriting takes place.
@param func The function reference object.
@return true if the sub expressions should be traversed. | [
"Visit",
"a",
"function",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AbsPathChecker.java#L60-L66 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDLoss.java | SDLoss.sparseSoftmaxCrossEntropy | public SDVariable sparseSoftmaxCrossEntropy(String name, @NonNull SDVariable logits, @NonNull SDVariable labels) {
validateFloatingPoint("sparse softmax cross entropy", "logits (predictions)", logits);
validateInteger("sparse softmax cross entropy", "labels", labels);
Preconditions.checkState(labels.dataType().isIntType(), "Labels variable must be an integer type: got %s", logits);
SDVariable result = f().lossSparseSoftmaxCrossEntropy(logits, labels);
result = updateVariableNameAndReference(result, name);
result.markAsLoss();
return result;
} | java | public SDVariable sparseSoftmaxCrossEntropy(String name, @NonNull SDVariable logits, @NonNull SDVariable labels) {
validateFloatingPoint("sparse softmax cross entropy", "logits (predictions)", logits);
validateInteger("sparse softmax cross entropy", "labels", labels);
Preconditions.checkState(labels.dataType().isIntType(), "Labels variable must be an integer type: got %s", logits);
SDVariable result = f().lossSparseSoftmaxCrossEntropy(logits, labels);
result = updateVariableNameAndReference(result, name);
result.markAsLoss();
return result;
} | [
"public",
"SDVariable",
"sparseSoftmaxCrossEntropy",
"(",
"String",
"name",
",",
"@",
"NonNull",
"SDVariable",
"logits",
",",
"@",
"NonNull",
"SDVariable",
"labels",
")",
"{",
"validateFloatingPoint",
"(",
"\"sparse softmax cross entropy\"",
",",
"\"logits (predictions)\"... | As per {@link #softmaxCrossEntropy(String, SDVariable, SDVariable, LossReduce)} but the labels variable
is represented as an integer array instead of the equivalent one-hot array.<br>
i.e., if logits are rank N, then labels have rank N-1
@param name Name of the output variable. May be null
@param logits Logits array ("pre-softmax activations")
@param labels Labels array. Must be an integer type.
@return Softmax cross entropy | [
"As",
"per",
"{",
"@link",
"#softmaxCrossEntropy",
"(",
"String",
"SDVariable",
"SDVariable",
"LossReduce",
")",
"}",
"but",
"the",
"labels",
"variable",
"is",
"represented",
"as",
"an",
"integer",
"array",
"instead",
"of",
"the",
"equivalent",
"one",
"-",
"ho... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDLoss.java#L500-L508 |
mediathekview/MServer | src/main/java/mServer/crawler/sender/MediathekBr.java | MediathekBr.getUrl | private String getUrl(MSStringBuilder seiteXml, String pattern) {
return seiteXml.extract(pattern, PATTERN_DLURL, PATTERN_END);
} | java | private String getUrl(MSStringBuilder seiteXml, String pattern) {
return seiteXml.extract(pattern, PATTERN_DLURL, PATTERN_END);
} | [
"private",
"String",
"getUrl",
"(",
"MSStringBuilder",
"seiteXml",
",",
"String",
"pattern",
")",
"{",
"return",
"seiteXml",
".",
"extract",
"(",
"pattern",
",",
"PATTERN_DLURL",
",",
"PATTERN_END",
")",
";",
"}"
] | gets the url for the specified pattern
@param seiteXml The xml site where to extract the url
@param pattern The pattern used to identify the url type
@return The extracted url | [
"gets",
"the",
"url",
"for",
"the",
"specified",
"pattern"
] | train | https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/sender/MediathekBr.java#L585-L587 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/worker/BlockUtils.java | BlockUtils.getUfsBlockPath | public static String getUfsBlockPath(UfsManager.UfsClient ufsInfo, long blockId) {
return PathUtils.concatPath(ufsInfo.getUfsMountPointUri(),
PathUtils.temporaryFileName(MAGIC_NUMBER, ".alluxio_ufs_blocks"), blockId);
} | java | public static String getUfsBlockPath(UfsManager.UfsClient ufsInfo, long blockId) {
return PathUtils.concatPath(ufsInfo.getUfsMountPointUri(),
PathUtils.temporaryFileName(MAGIC_NUMBER, ".alluxio_ufs_blocks"), blockId);
} | [
"public",
"static",
"String",
"getUfsBlockPath",
"(",
"UfsManager",
".",
"UfsClient",
"ufsInfo",
",",
"long",
"blockId",
")",
"{",
"return",
"PathUtils",
".",
"concatPath",
"(",
"ufsInfo",
".",
"getUfsMountPointUri",
"(",
")",
",",
"PathUtils",
".",
"temporaryFi... | For a given block ID, derives the corresponding UFS file of this block if it falls back to
be stored in UFS.
@param ufsInfo the UFS information for the mount point backing this file
@param blockId block ID
@return the UFS path of a block | [
"For",
"a",
"given",
"block",
"ID",
"derives",
"the",
"corresponding",
"UFS",
"file",
"of",
"this",
"block",
"if",
"it",
"falls",
"back",
"to",
"be",
"stored",
"in",
"UFS",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/worker/BlockUtils.java#L32-L35 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.setBodyFilter | public void setBodyFilter(int pathId, String bodyFilter) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_PATH +
" SET " + Constants.PATH_PROFILE_BODY_FILTER + " = ? " +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setString(1, bodyFilter);
statement.setInt(2, pathId);
statement.executeUpdate();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | java | public void setBodyFilter(int pathId, String bodyFilter) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_PATH +
" SET " + Constants.PATH_PROFILE_BODY_FILTER + " = ? " +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setString(1, bodyFilter);
statement.setInt(2, pathId);
statement.executeUpdate();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | [
"public",
"void",
"setBodyFilter",
"(",
"int",
"pathId",
",",
"String",
"bodyFilter",
")",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"(",
"Connection",
"sqlConnection",
"=",
"sqlService",
".",
"getConnection",
"(",
")",
")",
"{",
"stateme... | Sets the body filter for this ID
@param pathId ID of path
@param bodyFilter Body filter to set | [
"Sets",
"the",
"body",
"filter",
"for",
"this",
"ID"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L1177-L1199 |
arakelian/more-commons | src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java | XmlStreamReaderUtils.optionalShortAttribute | public static short optionalShortAttribute(
final XMLStreamReader reader,
final String localName,
final short defaultValue) {
return optionalShortAttribute(reader, null, localName, defaultValue);
} | java | public static short optionalShortAttribute(
final XMLStreamReader reader,
final String localName,
final short defaultValue) {
return optionalShortAttribute(reader, null, localName, defaultValue);
} | [
"public",
"static",
"short",
"optionalShortAttribute",
"(",
"final",
"XMLStreamReader",
"reader",
",",
"final",
"String",
"localName",
",",
"final",
"short",
"defaultValue",
")",
"{",
"return",
"optionalShortAttribute",
"(",
"reader",
",",
"null",
",",
"localName",
... | Returns the value of an attribute as a short. If the attribute is empty, this method returns
the default value provided.
@param reader
<code>XMLStreamReader</code> that contains attribute values.
@param localName
local name of attribute (the namespace is ignored).
@param defaultValue
default value
@return value of attribute, or the default value if the attribute is empty. | [
"Returns",
"the",
"value",
"of",
"an",
"attribute",
"as",
"a",
"short",
".",
"If",
"the",
"attribute",
"is",
"empty",
"this",
"method",
"returns",
"the",
"default",
"value",
"provided",
"."
] | train | https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L887-L892 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/rates/RateLimiterBucket.java | RateLimiterBucket.getPeriodBoundary | private static long getPeriodBoundary(long timestamp, RateBucketPeriod period) {
Calendar lastCal = Calendar.getInstance();
lastCal.setTimeInMillis(timestamp);
switch (period) {
case Second:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.add(Calendar.SECOND, 1);
return lastCal.getTimeInMillis();
case Minute:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.add(Calendar.MINUTE, 1);
return lastCal.getTimeInMillis();
case Hour:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.add(Calendar.HOUR_OF_DAY, 1);
return lastCal.getTimeInMillis();
case Day:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.set(Calendar.HOUR_OF_DAY, 0);
lastCal.add(Calendar.DAY_OF_YEAR, 1);
return lastCal.getTimeInMillis();
case Month:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.set(Calendar.HOUR_OF_DAY, 0);
lastCal.set(Calendar.DAY_OF_MONTH, 1);
lastCal.add(Calendar.MONTH, 1);
return lastCal.getTimeInMillis();
case Year:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.set(Calendar.HOUR_OF_DAY, 0);
lastCal.set(Calendar.DAY_OF_YEAR, 1);
lastCal.add(Calendar.YEAR, 1);
return lastCal.getTimeInMillis();
}
return Long.MAX_VALUE;
} | java | private static long getPeriodBoundary(long timestamp, RateBucketPeriod period) {
Calendar lastCal = Calendar.getInstance();
lastCal.setTimeInMillis(timestamp);
switch (period) {
case Second:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.add(Calendar.SECOND, 1);
return lastCal.getTimeInMillis();
case Minute:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.add(Calendar.MINUTE, 1);
return lastCal.getTimeInMillis();
case Hour:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.add(Calendar.HOUR_OF_DAY, 1);
return lastCal.getTimeInMillis();
case Day:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.set(Calendar.HOUR_OF_DAY, 0);
lastCal.add(Calendar.DAY_OF_YEAR, 1);
return lastCal.getTimeInMillis();
case Month:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.set(Calendar.HOUR_OF_DAY, 0);
lastCal.set(Calendar.DAY_OF_MONTH, 1);
lastCal.add(Calendar.MONTH, 1);
return lastCal.getTimeInMillis();
case Year:
lastCal.set(Calendar.MILLISECOND, 0);
lastCal.set(Calendar.SECOND, 0);
lastCal.set(Calendar.MINUTE, 0);
lastCal.set(Calendar.HOUR_OF_DAY, 0);
lastCal.set(Calendar.DAY_OF_YEAR, 1);
lastCal.add(Calendar.YEAR, 1);
return lastCal.getTimeInMillis();
}
return Long.MAX_VALUE;
} | [
"private",
"static",
"long",
"getPeriodBoundary",
"(",
"long",
"timestamp",
",",
"RateBucketPeriod",
"period",
")",
"{",
"Calendar",
"lastCal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"lastCal",
".",
"setTimeInMillis",
"(",
"timestamp",
")",
";",
"... | Gets the boundary timestamp for the given rate bucket period. In other words,
returns the timestamp associated with when the rate period will reset.
@param timestamp
@param period | [
"Gets",
"the",
"boundary",
"timestamp",
"for",
"the",
"given",
"rate",
"bucket",
"period",
".",
"In",
"other",
"words",
"returns",
"the",
"timestamp",
"associated",
"with",
"when",
"the",
"rate",
"period",
"will",
"reset",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/rates/RateLimiterBucket.java#L81-L125 |
actorapp/droidkit-actors | actors/src/main/java/com/droidkit/actors/ActorSystem.java | ActorSystem.addDispatcher | public void addDispatcher(String dispatcherId) {
addDispatcher(dispatcherId, new ActorDispatcher(dispatcherId, this, Runtime.getRuntime().availableProcessors()));
} | java | public void addDispatcher(String dispatcherId) {
addDispatcher(dispatcherId, new ActorDispatcher(dispatcherId, this, Runtime.getRuntime().availableProcessors()));
} | [
"public",
"void",
"addDispatcher",
"(",
"String",
"dispatcherId",
")",
"{",
"addDispatcher",
"(",
"dispatcherId",
",",
"new",
"ActorDispatcher",
"(",
"dispatcherId",
",",
"this",
",",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"availableProcessors",
"(",
")",
... | Adding dispatcher with threads count = {@code Runtime.getRuntime().availableProcessors()}
@param dispatcherId dispatcher id | [
"Adding",
"dispatcher",
"with",
"threads",
"count",
"=",
"{",
"@code",
"Runtime",
".",
"getRuntime",
"()",
".",
"availableProcessors",
"()",
"}"
] | train | https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/ActorSystem.java#L73-L75 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GatewayResponse.java | GatewayResponse.withResponseTemplates | public GatewayResponse withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | java | public GatewayResponse withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | [
"public",
"GatewayResponse",
"withResponseTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseTemplates",
")",
"{",
"setResponseTemplates",
"(",
"responseTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs.
</p>
@param responseTemplates
Response templates of the <a>GatewayResponse</a> as a string-to-string map of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Response",
"templates",
"of",
"the",
"<a",
">",
"GatewayResponse<",
"/",
"a",
">",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GatewayResponse.java#L546-L549 |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/HttpClientHelper.java | HttpClientHelper.processGoodRespStr | public static JSONObject processGoodRespStr(int responseCode, String goodRespStr) throws JSONException {
JSONObject response = new JSONObject();
response.put("responseCode", responseCode);
if (goodRespStr.equalsIgnoreCase("")) {
response.put("responseMsg", "");
} else {
response.put("responseMsg", new JSONObject(goodRespStr));
}
return response;
} | java | public static JSONObject processGoodRespStr(int responseCode, String goodRespStr) throws JSONException {
JSONObject response = new JSONObject();
response.put("responseCode", responseCode);
if (goodRespStr.equalsIgnoreCase("")) {
response.put("responseMsg", "");
} else {
response.put("responseMsg", new JSONObject(goodRespStr));
}
return response;
} | [
"public",
"static",
"JSONObject",
"processGoodRespStr",
"(",
"int",
"responseCode",
",",
"String",
"goodRespStr",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"response",
"=",
"new",
"JSONObject",
"(",
")",
";",
"response",
".",
"put",
"(",
"\"responseCode\"... | for bad response, whose responseCode is not 200 level
@param responseCode
@param errorCode
@param errorMsg
@return
@throws JSONException | [
"for",
"bad",
"response",
"whose",
"responseCode",
"is",
"not",
"200",
"level"
] | train | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/HttpClientHelper.java#L133-L143 |
Azure/azure-sdk-for-java | policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java | PolicySetDefinitionsInner.createOrUpdateAsync | public Observable<PolicySetDefinitionInner> createOrUpdateAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) {
return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).map(new Func1<ServiceResponse<PolicySetDefinitionInner>, PolicySetDefinitionInner>() {
@Override
public PolicySetDefinitionInner call(ServiceResponse<PolicySetDefinitionInner> response) {
return response.body();
}
});
} | java | public Observable<PolicySetDefinitionInner> createOrUpdateAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) {
return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).map(new Func1<ServiceResponse<PolicySetDefinitionInner>, PolicySetDefinitionInner>() {
@Override
public PolicySetDefinitionInner call(ServiceResponse<PolicySetDefinitionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicySetDefinitionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"policySetDefinitionName",
",",
"PolicySetDefinitionInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"policySetDefinitionName",
",",
"para... | Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the given name.
@param policySetDefinitionName The name of the policy set definition to create.
@param parameters The policy set definition properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicySetDefinitionInner object | [
"Creates",
"or",
"updates",
"a",
"policy",
"set",
"definition",
".",
"This",
"operation",
"creates",
"or",
"updates",
"a",
"policy",
"set",
"definition",
"in",
"the",
"given",
"subscription",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java#L156-L163 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java | MapKeyLoader.triggerLoadingWithDelay | public void triggerLoadingWithDelay() {
if (delayedTrigger == null) {
Runnable runnable = () -> {
Operation op = new TriggerLoadIfNeededOperation(mapName);
opService.invokeOnPartition(SERVICE_NAME, op, mapNamePartition);
};
delayedTrigger = new CoalescingDelayedTrigger(execService, LOADING_TRIGGER_DELAY, LOADING_TRIGGER_DELAY, runnable);
}
delayedTrigger.executeWithDelay();
} | java | public void triggerLoadingWithDelay() {
if (delayedTrigger == null) {
Runnable runnable = () -> {
Operation op = new TriggerLoadIfNeededOperation(mapName);
opService.invokeOnPartition(SERVICE_NAME, op, mapNamePartition);
};
delayedTrigger = new CoalescingDelayedTrigger(execService, LOADING_TRIGGER_DELAY, LOADING_TRIGGER_DELAY, runnable);
}
delayedTrigger.executeWithDelay();
} | [
"public",
"void",
"triggerLoadingWithDelay",
"(",
")",
"{",
"if",
"(",
"delayedTrigger",
"==",
"null",
")",
"{",
"Runnable",
"runnable",
"=",
"(",
")",
"->",
"{",
"Operation",
"op",
"=",
"new",
"TriggerLoadIfNeededOperation",
"(",
"mapName",
")",
";",
"opSer... | Triggers key loading on SENDER if it hadn't started. Delays triggering if invoked multiple times. | [
"Triggers",
"key",
"loading",
"on",
"SENDER",
"if",
"it",
"hadn",
"t",
"started",
".",
"Delays",
"triggering",
"if",
"invoked",
"multiple",
"times",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java#L362-L372 |
groupby/api-java | src/main/java/com/groupbyinc/api/Query.java | Query.addRefinement | private Query addRefinement(String navigationName, Refinement refinement) {
Navigation navigation = navigations.get(navigationName);
if (navigation == null) {
navigation = new Navigation().setName(navigationName);
navigation.setRange(refinement instanceof RefinementRange);
navigations.put(navigationName, navigation);
}
navigation.getRefinements().add(refinement);
return this;
} | java | private Query addRefinement(String navigationName, Refinement refinement) {
Navigation navigation = navigations.get(navigationName);
if (navigation == null) {
navigation = new Navigation().setName(navigationName);
navigation.setRange(refinement instanceof RefinementRange);
navigations.put(navigationName, navigation);
}
navigation.getRefinements().add(refinement);
return this;
} | [
"private",
"Query",
"addRefinement",
"(",
"String",
"navigationName",
",",
"Refinement",
"refinement",
")",
"{",
"Navigation",
"navigation",
"=",
"navigations",
".",
"get",
"(",
"navigationName",
")",
";",
"if",
"(",
"navigation",
"==",
"null",
")",
"{",
"navi... | <code>
Add a refinement. Please note that refinements are case-sensitive
JSON Reference:
Value and range refinements are both appended to an array on the refinements field.
Note the 'type' field, which marks the refinement as either a value or range refinement.
{ "refinements": [ {"type": "Range", "navigationName": "price", "low": "1.0", "high": "2.0"},
{"type": "Value", "navigationName": "brand", "value": "Nike" } ] }
Refinements can be negated by setting the exclude property. An excluded refinement will return
results that do not match the value or fall into the range specified in the refinement.
{ "refinements": [ {"type": "Range", "navigationName": "price", "low": "1.0", "high": "2.0", "exclude": true},
{"type": "Value", "navigationName": "brand", "value": "Nike", "exclude": true } ] }
</code>
@param navigationName
The name of the refinement
@param refinement
The refinement to add | [
"<code",
">",
"Add",
"a",
"refinement",
".",
"Please",
"note",
"that",
"refinements",
"are",
"case",
"-",
"sensitive"
] | train | https://github.com/groupby/api-java/blob/257c4ed0777221e5e4ade3b29b9921300fac4e2e/src/main/java/com/groupbyinc/api/Query.java#L584-L593 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/EventLoopGroups.java | EventLoopGroups.newEventLoopGroup | public static EventLoopGroup newEventLoopGroup(int numThreads, String threadNamePrefix,
boolean useDaemonThreads) {
checkArgument(numThreads > 0, "numThreads: %s (expected: > 0)", numThreads);
requireNonNull(threadNamePrefix, "threadNamePrefix");
final TransportType type = TransportType.detectTransportType();
final String prefix = threadNamePrefix + '-' + type.lowerCasedName();
return newEventLoopGroup(numThreads, new EventLoopThreadFactory(prefix, useDaemonThreads));
} | java | public static EventLoopGroup newEventLoopGroup(int numThreads, String threadNamePrefix,
boolean useDaemonThreads) {
checkArgument(numThreads > 0, "numThreads: %s (expected: > 0)", numThreads);
requireNonNull(threadNamePrefix, "threadNamePrefix");
final TransportType type = TransportType.detectTransportType();
final String prefix = threadNamePrefix + '-' + type.lowerCasedName();
return newEventLoopGroup(numThreads, new EventLoopThreadFactory(prefix, useDaemonThreads));
} | [
"public",
"static",
"EventLoopGroup",
"newEventLoopGroup",
"(",
"int",
"numThreads",
",",
"String",
"threadNamePrefix",
",",
"boolean",
"useDaemonThreads",
")",
"{",
"checkArgument",
"(",
"numThreads",
">",
"0",
",",
"\"numThreads: %s (expected: > 0)\"",
",",
"numThread... | Returns a newly-created {@link EventLoopGroup}.
@param numThreads the number of event loop threads
@param threadNamePrefix the prefix of thread names
@param useDaemonThreads whether to create daemon threads or not | [
"Returns",
"a",
"newly",
"-",
"created",
"{",
"@link",
"EventLoopGroup",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/EventLoopGroups.java#L84-L93 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CameraPlaneProjection.java | CameraPlaneProjection.setPlaneToCamera | public void setPlaneToCamera(Se3_F64 planeToCamera, boolean computeInverse ) {
this.planeToCamera = planeToCamera;
if( computeInverse )
planeToCamera.invert(cameraToPlane);
} | java | public void setPlaneToCamera(Se3_F64 planeToCamera, boolean computeInverse ) {
this.planeToCamera = planeToCamera;
if( computeInverse )
planeToCamera.invert(cameraToPlane);
} | [
"public",
"void",
"setPlaneToCamera",
"(",
"Se3_F64",
"planeToCamera",
",",
"boolean",
"computeInverse",
")",
"{",
"this",
".",
"planeToCamera",
"=",
"planeToCamera",
";",
"if",
"(",
"computeInverse",
")",
"planeToCamera",
".",
"invert",
"(",
"cameraToPlane",
")",... | Specifies camera's extrinsic parameters.
@param planeToCamera Transform from plane to camera reference frame
@param computeInverse Set to true if pixelToPlane is going to be called. performs extra calculation | [
"Specifies",
"camera",
"s",
"extrinsic",
"parameters",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CameraPlaneProjection.java#L90-L95 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/RequestToken.java | RequestToken.loadAndResume | public static RequestToken loadAndResume(Bundle bundle, String name, BaasHandler<?> handler) {
if (bundle == null)
throw new IllegalArgumentException("bunlde cannot be null");
if (name == null)
throw new IllegalArgumentException("name cannot be null");
RequestToken token = bundle.getParcelable(name);
if (token != null && token.resume(handler)) {
return token;
}
return null;
} | java | public static RequestToken loadAndResume(Bundle bundle, String name, BaasHandler<?> handler) {
if (bundle == null)
throw new IllegalArgumentException("bunlde cannot be null");
if (name == null)
throw new IllegalArgumentException("name cannot be null");
RequestToken token = bundle.getParcelable(name);
if (token != null && token.resume(handler)) {
return token;
}
return null;
} | [
"public",
"static",
"RequestToken",
"loadAndResume",
"(",
"Bundle",
"bundle",
",",
"String",
"name",
",",
"BaasHandler",
"<",
"?",
">",
"handler",
")",
"{",
"if",
"(",
"bundle",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"bunlde cann... | Loads a request token from the bundle
and immediately tries to resume the request with handler
@param bundle a non null bundle
@param name the key of the saved token
@param handler a handler to resume the request with.
@return the token if resumed, null otherwise | [
"Loads",
"a",
"request",
"token",
"from",
"the",
"bundle",
"and",
"immediately",
"tries",
"to",
"resume",
"the",
"request",
"with",
"handler"
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/RequestToken.java#L64-L74 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.copySheet | public Sheet copySheet(long sheetId, ContainerDestination containerDestination, EnumSet<SheetCopyInclusion> includes) throws SmartsheetException {
return copySheet(sheetId, containerDestination, includes, null);
} | java | public Sheet copySheet(long sheetId, ContainerDestination containerDestination, EnumSet<SheetCopyInclusion> includes) throws SmartsheetException {
return copySheet(sheetId, containerDestination, includes, null);
} | [
"public",
"Sheet",
"copySheet",
"(",
"long",
"sheetId",
",",
"ContainerDestination",
"containerDestination",
",",
"EnumSet",
"<",
"SheetCopyInclusion",
">",
"includes",
")",
"throws",
"SmartsheetException",
"{",
"return",
"copySheet",
"(",
"sheetId",
",",
"containerDe... | Creates a copy of the specified sheet.
It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/copy
Exceptions:
IllegalArgumentException : if folder is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param sheetId the sheet id
@param containerDestination describes the destination container
@param includes optional parameters to include
@return the sheet
@throws SmartsheetException the smartsheet exception | [
"Creates",
"a",
"copy",
"of",
"the",
"specified",
"sheet",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L1036-L1038 |
leadware/jpersistence-tools | jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java | RestrictionsContainer.addLt | public <Y extends Comparable<? super Y>> RestrictionsContainer addLt(String property, Y value) {
// Ajout de la restriction
restrictions.add(new Lt<Y>(property, value));
// On retourne le conteneur
return this;
} | java | public <Y extends Comparable<? super Y>> RestrictionsContainer addLt(String property, Y value) {
// Ajout de la restriction
restrictions.add(new Lt<Y>(property, value));
// On retourne le conteneur
return this;
} | [
"public",
"<",
"Y",
"extends",
"Comparable",
"<",
"?",
"super",
"Y",
">",
">",
"RestrictionsContainer",
"addLt",
"(",
"String",
"property",
",",
"Y",
"value",
")",
"{",
"// Ajout de la restriction\r",
"restrictions",
".",
"add",
"(",
"new",
"Lt",
"<",
"Y",
... | Methode d'ajout de la restriction Lt
@param property Nom de la Propriete
@param value Valeur de la propriete
@param <Y> Type de valeur
@return Conteneur | [
"Methode",
"d",
"ajout",
"de",
"la",
"restriction",
"Lt"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L153-L160 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/model/entity/core/type/AbstractEntity.java | AbstractEntity.handleJsonArrayToJavaString | @JsonAnySetter
public void handleJsonArrayToJavaString(String name, Object value) {
try {
PropertyUtils.setProperty(this, name,
this.convertListToString(value));
} catch (IllegalAccessException e) {
log.debug("Error setting field " + name + " with value " + value
+ " on entity " + this.getClass().getSimpleName());
this.additionalProperties.put(name, value);
} catch (InvocationTargetException e) {
log.debug("Error setting field " + name + " with value " + value
+ " on entity " + this.getClass().getSimpleName());
this.additionalProperties.put(name, value);
} catch (NoSuchMethodException e) {
log.debug("Error setting field " + name + " with value " + value
+ " on entity " + this.getClass().getSimpleName());
this.additionalProperties.put(name, value);
}
} | java | @JsonAnySetter
public void handleJsonArrayToJavaString(String name, Object value) {
try {
PropertyUtils.setProperty(this, name,
this.convertListToString(value));
} catch (IllegalAccessException e) {
log.debug("Error setting field " + name + " with value " + value
+ " on entity " + this.getClass().getSimpleName());
this.additionalProperties.put(name, value);
} catch (InvocationTargetException e) {
log.debug("Error setting field " + name + " with value " + value
+ " on entity " + this.getClass().getSimpleName());
this.additionalProperties.put(name, value);
} catch (NoSuchMethodException e) {
log.debug("Error setting field " + name + " with value " + value
+ " on entity " + this.getClass().getSimpleName());
this.additionalProperties.put(name, value);
}
} | [
"@",
"JsonAnySetter",
"public",
"void",
"handleJsonArrayToJavaString",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"PropertyUtils",
".",
"setProperty",
"(",
"this",
",",
"name",
",",
"this",
".",
"convertListToString",
"(",
"value",
")... | Unknown properties are handled here. One main purpose of this method is
to handle String values that are sent as json arrays if configured as
multi-values in bh.
@param name
@param value | [
"Unknown",
"properties",
"are",
"handled",
"here",
".",
"One",
"main",
"purpose",
"of",
"this",
"method",
"is",
"to",
"handle",
"String",
"values",
"that",
"are",
"sent",
"as",
"json",
"arrays",
"if",
"configured",
"as",
"multi",
"-",
"values",
"in",
"bh",... | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/model/entity/core/type/AbstractEntity.java#L47-L67 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsUserQueryBuilder.java | CmsUserQueryBuilder.addWebuserCondition | protected void addWebuserCondition(CmsSelectQuery select, CmsOrganizationalUnit orgUnit, TableAlias users) {
String webuserConditionTemplate;
if (orgUnit.hasFlagWebuser()) {
webuserConditionTemplate = "( %1$s >= 32768 AND %1$s < 65536 )";
} else {
webuserConditionTemplate = "( %1$s < 32768 OR %1$s >= 65536 )";
}
String webuserCondition = String.format(webuserConditionTemplate, users.column(colFlags()));
select.addCondition(webuserCondition);
} | java | protected void addWebuserCondition(CmsSelectQuery select, CmsOrganizationalUnit orgUnit, TableAlias users) {
String webuserConditionTemplate;
if (orgUnit.hasFlagWebuser()) {
webuserConditionTemplate = "( %1$s >= 32768 AND %1$s < 65536 )";
} else {
webuserConditionTemplate = "( %1$s < 32768 OR %1$s >= 65536 )";
}
String webuserCondition = String.format(webuserConditionTemplate, users.column(colFlags()));
select.addCondition(webuserCondition);
} | [
"protected",
"void",
"addWebuserCondition",
"(",
"CmsSelectQuery",
"select",
",",
"CmsOrganizationalUnit",
"orgUnit",
",",
"TableAlias",
"users",
")",
"{",
"String",
"webuserConditionTemplate",
";",
"if",
"(",
"orgUnit",
".",
"hasFlagWebuser",
"(",
")",
")",
"{",
... | Adds a check for the web user condition to an SQL query.<p>
@param select the query
@param orgUnit the organizational unit
@param users the user table alias | [
"Adds",
"a",
"check",
"for",
"the",
"web",
"user",
"condition",
"to",
"an",
"SQL",
"query",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserQueryBuilder.java#L365-L375 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs2.java | FindBugs2.createAnalysisCache | protected IAnalysisCache createAnalysisCache() throws IOException {
IAnalysisCache analysisCache = ClassFactory.instance().createAnalysisCache(classPath, bugReporter);
// Register the "built-in" analysis engines
registerBuiltInAnalysisEngines(analysisCache);
// Register analysis engines in plugins
registerPluginAnalysisEngines(detectorFactoryCollection, analysisCache);
// Install the DetectorFactoryCollection as a database
analysisCache.eagerlyPutDatabase(DetectorFactoryCollection.class, detectorFactoryCollection);
Global.setAnalysisCacheForCurrentThread(analysisCache);
return analysisCache;
} | java | protected IAnalysisCache createAnalysisCache() throws IOException {
IAnalysisCache analysisCache = ClassFactory.instance().createAnalysisCache(classPath, bugReporter);
// Register the "built-in" analysis engines
registerBuiltInAnalysisEngines(analysisCache);
// Register analysis engines in plugins
registerPluginAnalysisEngines(detectorFactoryCollection, analysisCache);
// Install the DetectorFactoryCollection as a database
analysisCache.eagerlyPutDatabase(DetectorFactoryCollection.class, detectorFactoryCollection);
Global.setAnalysisCacheForCurrentThread(analysisCache);
return analysisCache;
} | [
"protected",
"IAnalysisCache",
"createAnalysisCache",
"(",
")",
"throws",
"IOException",
"{",
"IAnalysisCache",
"analysisCache",
"=",
"ClassFactory",
".",
"instance",
"(",
")",
".",
"createAnalysisCache",
"(",
"classPath",
",",
"bugReporter",
")",
";",
"// Register th... | Create the analysis cache object and register it for current execution thread.
<p>
This method is protected to allow clients override it and possibly reuse
some previous analysis data (for Eclipse interactive re-build)
@throws IOException
if error occurs registering analysis engines in a plugin | [
"Create",
"the",
"analysis",
"cache",
"object",
"and",
"register",
"it",
"for",
"current",
"execution",
"thread",
".",
"<p",
">",
"This",
"method",
"is",
"protected",
"to",
"allow",
"clients",
"override",
"it",
"and",
"possibly",
"reuse",
"some",
"previous",
... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs2.java#L585-L599 |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/AbstractMonteCarloProduct.java | AbstractMonteCarloProduct.getValuesForModifiedData | public Map<String, Object> getValuesForModifiedData(double evaluationTime, MonteCarloSimulationInterface model, String entityKey, Object dataModified) throws CalculationException
{
Map<String, Object> dataModifiedMap = new HashMap<String, Object>();
dataModifiedMap.put(entityKey, dataModified);
return getValuesForModifiedData(evaluationTime, model, dataModifiedMap);
} | java | public Map<String, Object> getValuesForModifiedData(double evaluationTime, MonteCarloSimulationInterface model, String entityKey, Object dataModified) throws CalculationException
{
Map<String, Object> dataModifiedMap = new HashMap<String, Object>();
dataModifiedMap.put(entityKey, dataModified);
return getValuesForModifiedData(evaluationTime, model, dataModifiedMap);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getValuesForModifiedData",
"(",
"double",
"evaluationTime",
",",
"MonteCarloSimulationInterface",
"model",
",",
"String",
"entityKey",
",",
"Object",
"dataModified",
")",
"throws",
"CalculationException",
"{",
"Map"... | This method returns the value under shifted market data (or model parameters).
In its default implementation it does bump (creating a new model) and revalue.
Override the way the new model is created, to implemented improved techniques (proxy scheme, re-calibration).
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product, except for the market data to modify
@param entityKey The entity to change, it depends on the model if the model reacts to this key.
@param dataModified The new market data object to use (could be of different types)
@return The values of the product.
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"under",
"shifted",
"market",
"data",
"(",
"or",
"model",
"parameters",
")",
".",
"In",
"its",
"default",
"implementation",
"it",
"does",
"bump",
"(",
"creating",
"a",
"new",
"model",
")",
"and",
"revalue",
".",... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/AbstractMonteCarloProduct.java#L164-L169 |
jenkinsci/jenkins | core/src/main/java/hudson/search/Search.java | Search.doSuggestOpenSearch | public void doSuggestOpenSearch(StaplerRequest req, StaplerResponse rsp, @QueryParameter String q) throws IOException, ServletException {
rsp.setContentType(Flavor.JSON.contentType);
DataWriter w = Flavor.JSON.createDataWriter(null, rsp);
w.startArray();
w.value(q);
w.startArray();
for (SuggestedItem item : getSuggestions(req, q))
w.value(item.getPath());
w.endArray();
w.endArray();
} | java | public void doSuggestOpenSearch(StaplerRequest req, StaplerResponse rsp, @QueryParameter String q) throws IOException, ServletException {
rsp.setContentType(Flavor.JSON.contentType);
DataWriter w = Flavor.JSON.createDataWriter(null, rsp);
w.startArray();
w.value(q);
w.startArray();
for (SuggestedItem item : getSuggestions(req, q))
w.value(item.getPath());
w.endArray();
w.endArray();
} | [
"public",
"void",
"doSuggestOpenSearch",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
",",
"@",
"QueryParameter",
"String",
"q",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"rsp",
".",
"setContentType",
"(",
"Flavor",
".",
"JSON",
... | Used by OpenSearch auto-completion. Returns JSON array of the form:
<pre>
["queryString",["comp1","comp2",...]]
</pre>
See http://developer.mozilla.org/en/docs/Supporting_search_suggestions_in_search_plugins | [
"Used",
"by",
"OpenSearch",
"auto",
"-",
"completion",
".",
"Returns",
"JSON",
"array",
"of",
"the",
"form",
":"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/search/Search.java#L113-L124 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.1.7/src/com/ibm/ws/jca17/processor/service/AdministeredObjectResourceFactoryBuilder.java | AdministeredObjectResourceFactoryBuilder.getadminObjectID | private static final String getadminObjectID(String application, String module, String component, String jndiName) {
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append(AppDefinedResource.APPLICATION).append('[').append(application).append(']').append('/');
if (module != null) {
sb.append(AppDefinedResource.MODULE).append('[').append(module).append(']').append('/');
if (component != null)
sb.append(AppDefinedResource.COMPONENT).append('[').append(component).append(']').append('/');
}
}
return sb.append(AdminObjectService.ADMIN_OBJECT).append('[').append(jndiName).append(']').toString();
} | java | private static final String getadminObjectID(String application, String module, String component, String jndiName) {
StringBuilder sb = new StringBuilder(jndiName.length() + 80);
if (application != null) {
sb.append(AppDefinedResource.APPLICATION).append('[').append(application).append(']').append('/');
if (module != null) {
sb.append(AppDefinedResource.MODULE).append('[').append(module).append(']').append('/');
if (component != null)
sb.append(AppDefinedResource.COMPONENT).append('[').append(component).append(']').append('/');
}
}
return sb.append(AdminObjectService.ADMIN_OBJECT).append('[').append(jndiName).append(']').toString();
} | [
"private",
"static",
"final",
"String",
"getadminObjectID",
"(",
"String",
"application",
",",
"String",
"module",
",",
"String",
"component",
",",
"String",
"jndiName",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"jndiName",
".",
"length"... | Utility method that creates a unique identifier for an application defined data source.
For example,
application[MyApp]/module[MyModule]/connectionFactory[java:module/env/jdbc/cf1]
@param application application name if data source is in java:app, java:module, or java:comp. Otherwise null.
@param module module name if data source is in java:module or java:comp. Otherwise null.
@param component component name if data source is in java:comp and isn't in web container. Otherwise null.
@param jndiName configured JNDI name for the data source. For example, java:module/env/jca/cf1
@return the unique identifier | [
"Utility",
"method",
"that",
"creates",
"a",
"unique",
"identifier",
"for",
"an",
"application",
"defined",
"data",
"source",
".",
"For",
"example",
"application",
"[",
"MyApp",
"]",
"/",
"module",
"[",
"MyModule",
"]",
"/",
"connectionFactory",
"[",
"java",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.1.7/src/com/ibm/ws/jca17/processor/service/AdministeredObjectResourceFactoryBuilder.java#L295-L306 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/Graphics.java | Graphics.createText | public static Text createText(String fontName, int size, TextStyle style)
{
return factoryGraphic.createText(fontName, size, style);
} | java | public static Text createText(String fontName, int size, TextStyle style)
{
return factoryGraphic.createText(fontName, size, style);
} | [
"public",
"static",
"Text",
"createText",
"(",
"String",
"fontName",
",",
"int",
"size",
",",
"TextStyle",
"style",
")",
"{",
"return",
"factoryGraphic",
".",
"createText",
"(",
"fontName",
",",
"size",
",",
"style",
")",
";",
"}"
] | Crate a text.
@param fontName The font name (must not be <code>null</code>).
@param size The font size in pixel (must be strictly positive).
@param style The font style (must not be <code>null</code>).
@return The created text.
@throws LionEngineException If invalid arguments. | [
"Crate",
"a",
"text",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/Graphics.java#L99-L102 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java | RpcConfigs.putValue | public static void putValue(String key, Object newValue) {
Object oldValue = CFG.get(key);
if (changed(oldValue, newValue)) {
CFG.put(key, newValue);
List<RpcConfigListener> rpcConfigListeners = CFG_LISTENER.get(key);
if (CommonUtils.isNotEmpty(rpcConfigListeners)) {
for (RpcConfigListener rpcConfigListener : rpcConfigListeners) {
rpcConfigListener.onChange(oldValue, newValue);
}
}
}
} | java | public static void putValue(String key, Object newValue) {
Object oldValue = CFG.get(key);
if (changed(oldValue, newValue)) {
CFG.put(key, newValue);
List<RpcConfigListener> rpcConfigListeners = CFG_LISTENER.get(key);
if (CommonUtils.isNotEmpty(rpcConfigListeners)) {
for (RpcConfigListener rpcConfigListener : rpcConfigListeners) {
rpcConfigListener.onChange(oldValue, newValue);
}
}
}
} | [
"public",
"static",
"void",
"putValue",
"(",
"String",
"key",
",",
"Object",
"newValue",
")",
"{",
"Object",
"oldValue",
"=",
"CFG",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"changed",
"(",
"oldValue",
",",
"newValue",
")",
")",
"{",
"CFG",
".",
... | Put value.
@param key the key
@param newValue the new value | [
"Put",
"value",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java#L130-L141 |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.setGlobalVariable | public void setGlobalVariable(String name, Element value, boolean finalFlag) {
assert (name != null);
// Either modify an existing value (with appropriate checks) or add a
// new one.
if (globalVariables.containsKey(name)) {
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
gvar.setFinalFlag(finalFlag);
} else if (value != null) {
GlobalVariable gvar = new GlobalVariable(finalFlag, value);
globalVariables.put(name, gvar);
}
} | java | public void setGlobalVariable(String name, Element value, boolean finalFlag) {
assert (name != null);
// Either modify an existing value (with appropriate checks) or add a
// new one.
if (globalVariables.containsKey(name)) {
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
gvar.setFinalFlag(finalFlag);
} else if (value != null) {
GlobalVariable gvar = new GlobalVariable(finalFlag, value);
globalVariables.put(name, gvar);
}
} | [
"public",
"void",
"setGlobalVariable",
"(",
"String",
"name",
",",
"Element",
"value",
",",
"boolean",
"finalFlag",
")",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"// Either modify an existing value (with appropriate checks) or add a",
"// new one.",
"if",
"... | Set the variable to the given value. If the value is null, then the
variable will be removed from the context. | [
"Set",
"the",
"variable",
"to",
"the",
"given",
"value",
".",
"If",
"the",
"value",
"is",
"null",
"then",
"the",
"variable",
"will",
"be",
"removed",
"from",
"the",
"context",
"."
] | train | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L649-L665 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java | InboundNatRulesInner.listAsync | public Observable<Page<InboundNatRuleInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<InboundNatRuleInner>>, Page<InboundNatRuleInner>>() {
@Override
public Page<InboundNatRuleInner> call(ServiceResponse<Page<InboundNatRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<InboundNatRuleInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<InboundNatRuleInner>>, Page<InboundNatRuleInner>>() {
@Override
public Page<InboundNatRuleInner> call(ServiceResponse<Page<InboundNatRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"InboundNatRuleInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"loadBalancerName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"loadBal... | Gets all the inbound nat rules in a load balancer.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<InboundNatRuleInner> object | [
"Gets",
"all",
"the",
"inbound",
"nat",
"rules",
"in",
"a",
"load",
"balancer",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java#L143-L151 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameters/ClassParameter.java | ClassParameter.canonicalClassName | public static String canonicalClassName(Class<?> c, Class<?> parent) {
return canonicalClassName(c, parent == null ? null : parent.getPackage());
} | java | public static String canonicalClassName(Class<?> c, Class<?> parent) {
return canonicalClassName(c, parent == null ? null : parent.getPackage());
} | [
"public",
"static",
"String",
"canonicalClassName",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"Class",
"<",
"?",
">",
"parent",
")",
"{",
"return",
"canonicalClassName",
"(",
"c",
",",
"parent",
"==",
"null",
"?",
"null",
":",
"parent",
".",
"getPackage",
... | Get the "simple" form of a class name.
@param c Class name
@param parent Parent/restriction class (to get package name to strip)
@return Simplified class name. | [
"Get",
"the",
"simple",
"form",
"of",
"a",
"class",
"name",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameters/ClassParameter.java#L219-L221 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcrl_serialnumber_binding.java | sslcrl_serialnumber_binding.count_filtered | public static long count_filtered(nitro_service service, String crlname, String filter) throws Exception{
sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding();
obj.set_crlname(crlname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslcrl_serialnumber_binding[] response = (sslcrl_serialnumber_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String crlname, String filter) throws Exception{
sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding();
obj.set_crlname(crlname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslcrl_serialnumber_binding[] response = (sslcrl_serialnumber_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"crlname",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"sslcrl_serialnumber_binding",
"obj",
"=",
"new",
"sslcrl_serialnumber_binding",
"(",
")",
";",
"obj",
... | Use this API to count the filtered set of sslcrl_serialnumber_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"sslcrl_serialnumber_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcrl_serialnumber_binding.java#L174-L185 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getExplicitList | public List<ExplicitListItem> getExplicitList(UUID appId, String versionId, UUID entityId) {
return getExplicitListWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
} | java | public List<ExplicitListItem> getExplicitList(UUID appId, String versionId, UUID entityId) {
return getExplicitListWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
} | [
"public",
"List",
"<",
"ExplicitListItem",
">",
"getExplicitList",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
")",
"{",
"return",
"getExplicitListWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
")",
".",
... | Get the explicit list of the pattern.any entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The Pattern.Any entity id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<ExplicitListItem> object if successful. | [
"Get",
"the",
"explicit",
"list",
"of",
"the",
"pattern",
".",
"any",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9899-L9901 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AligNPE.java | AligNPE.align_NPE | public static Alignable align_NPE(Matrix sim,StrucAligParameters params){
//System.out.println("align_NPE");
float gapOpen = params.getGapOpen();
float gapExtension = params.getGapExtension();
int rows = sim.getRowDimension();
int cols = sim.getColumnDimension();
Alignable al = new StrCompAlignment(rows,cols);
al.setGapExtCol(gapExtension);
al.setGapExtRow(gapExtension);
al.setGapOpenCol(gapOpen);
al.setGapOpenRow(gapOpen);
//System.out.println("size of aligmat: " + rows+1 + " " + cols+1);
//AligMatEl[][] aligmat = new AligMatEl[rows+1][cols+1];
AligMatEl[][] aligmat = al.getAligMat();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
int e=0;
//if ( ( i < rows) &&
// ( j < cols)) {
//TODO: the ALIGFACTOR calc should be hidden in Gotoh!!
e = (int)Math.round(Gotoh.ALIGFACTOR * sim.get(i,j));
//}
//System.out.println(e);
AligMatEl am = new AligMatEl();
am.setValue(e);
//am.setTrack(new IndexPair((short)-99,(short)-99));
aligmat[i+1][j+1] = am;
}
}
//al.setAligMat(aligmat);
new Gotoh(al);
return al;
} | java | public static Alignable align_NPE(Matrix sim,StrucAligParameters params){
//System.out.println("align_NPE");
float gapOpen = params.getGapOpen();
float gapExtension = params.getGapExtension();
int rows = sim.getRowDimension();
int cols = sim.getColumnDimension();
Alignable al = new StrCompAlignment(rows,cols);
al.setGapExtCol(gapExtension);
al.setGapExtRow(gapExtension);
al.setGapOpenCol(gapOpen);
al.setGapOpenRow(gapOpen);
//System.out.println("size of aligmat: " + rows+1 + " " + cols+1);
//AligMatEl[][] aligmat = new AligMatEl[rows+1][cols+1];
AligMatEl[][] aligmat = al.getAligMat();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
int e=0;
//if ( ( i < rows) &&
// ( j < cols)) {
//TODO: the ALIGFACTOR calc should be hidden in Gotoh!!
e = (int)Math.round(Gotoh.ALIGFACTOR * sim.get(i,j));
//}
//System.out.println(e);
AligMatEl am = new AligMatEl();
am.setValue(e);
//am.setTrack(new IndexPair((short)-99,(short)-99));
aligmat[i+1][j+1] = am;
}
}
//al.setAligMat(aligmat);
new Gotoh(al);
return al;
} | [
"public",
"static",
"Alignable",
"align_NPE",
"(",
"Matrix",
"sim",
",",
"StrucAligParameters",
"params",
")",
"{",
"//System.out.println(\"align_NPE\");",
"float",
"gapOpen",
"=",
"params",
".",
"getGapOpen",
"(",
")",
";",
"float",
"gapExtension",
"=",
"params",
... | Align without penalizing end-gaps. Return alignment and score
@param sim the similarity matrix
@param params the structure alignment parameters to be used
@return an Alignable | [
"Align",
"without",
"penalizing",
"end",
"-",
"gaps",
".",
"Return",
"alignment",
"and",
"score"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AligNPE.java#L43-L84 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/utilities/SpaceCharacters.java | SpaceCharacters.indent | public static void indent(int num, PrintWriter out) {
if (num <= SIXTY_FOUR) {
out.write(SIXTY_FOUR_SPACES, 0, num);
return;
} else if (num <= 128){
out.write(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
out.write(SIXTY_FOUR_SPACES, 0, num - SIXTY_FOUR);
} else {
int times = num / SIXTY_FOUR;
int rem = num % SIXTY_FOUR;
for (int i = 0; i< times; i++) {
out.write(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
}
out.write(SIXTY_FOUR_SPACES, 0, rem);
return;
}
} | java | public static void indent(int num, PrintWriter out) {
if (num <= SIXTY_FOUR) {
out.write(SIXTY_FOUR_SPACES, 0, num);
return;
} else if (num <= 128){
out.write(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
out.write(SIXTY_FOUR_SPACES, 0, num - SIXTY_FOUR);
} else {
int times = num / SIXTY_FOUR;
int rem = num % SIXTY_FOUR;
for (int i = 0; i< times; i++) {
out.write(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
}
out.write(SIXTY_FOUR_SPACES, 0, rem);
return;
}
} | [
"public",
"static",
"void",
"indent",
"(",
"int",
"num",
",",
"PrintWriter",
"out",
")",
"{",
"if",
"(",
"num",
"<=",
"SIXTY_FOUR",
")",
"{",
"out",
".",
"write",
"(",
"SIXTY_FOUR_SPACES",
",",
"0",
",",
"num",
")",
";",
"return",
";",
"}",
"else",
... | Write a number of whitespaces to a writer
@param num
@param out | [
"Write",
"a",
"number",
"of",
"whitespaces",
"to",
"a",
"writer"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/SpaceCharacters.java#L28-L44 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.logNormalizeInPlace | public static <E> void logNormalizeInPlace(Counter<E> c) {
double logsum = logSum(c);
// for (E key : c.keySet()) {
// c.incrementCount(key, -logsum);
// }
// This should be faster
for (Map.Entry<E, Double> e : c.entrySet()) {
e.setValue(e.getValue().doubleValue() - logsum);
}
} | java | public static <E> void logNormalizeInPlace(Counter<E> c) {
double logsum = logSum(c);
// for (E key : c.keySet()) {
// c.incrementCount(key, -logsum);
// }
// This should be faster
for (Map.Entry<E, Double> e : c.entrySet()) {
e.setValue(e.getValue().doubleValue() - logsum);
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"logNormalizeInPlace",
"(",
"Counter",
"<",
"E",
">",
"c",
")",
"{",
"double",
"logsum",
"=",
"logSum",
"(",
"c",
")",
";",
"// for (E key : c.keySet()) {\r",
"// c.incrementCount(key, -logsum);\r",
"// }\r",
"// This sho... | Transform log space values into a probability distribution in place. On the
assumption that the values in the Counter are in log space, this method
calculates their sum, and then subtracts the log of their sum from each
element. That is, if a counter has keys c1, c2, c3 with values v1, v2, v3,
the value of c1 becomes v1 - log(e^v1 + e^v2 + e^v3). After this, e^v1 +
e^v2 + e^v3 = 1.0, so Counters.logSum(c) = 0.0 (approximately).
@param c
The Counter to log normalize in place | [
"Transform",
"log",
"space",
"values",
"into",
"a",
"probability",
"distribution",
"in",
"place",
".",
"On",
"the",
"assumption",
"that",
"the",
"values",
"in",
"the",
"Counter",
"are",
"in",
"log",
"space",
"this",
"method",
"calculates",
"their",
"sum",
"a... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L125-L134 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutMethodRequest.java | PutMethodRequest.withRequestModels | public PutMethodRequest withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | java | public PutMethodRequest withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | [
"public",
"PutMethodRequest",
"withRequestModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestModels",
")",
"{",
"setRequestModels",
"(",
"requestModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Specifies the <a>Model</a> resources used for the request's content type. Request models are represented as a
key/value map, with a content type as the key and a <a>Model</a> name as the value.
</p>
@param requestModels
Specifies the <a>Model</a> resources used for the request's content type. Request models are represented
as a key/value map, with a content type as the key and a <a>Model</a> name as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Specifies",
"the",
"<a",
">",
"Model<",
"/",
"a",
">",
"resources",
"used",
"for",
"the",
"request",
"s",
"content",
"type",
".",
"Request",
"models",
"are",
"represented",
"as",
"a",
"key",
"/",
"value",
"map",
"with",
"a",
"content",
"typ... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutMethodRequest.java#L573-L576 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/extension/related/media/MediaRow.java | MediaRow.setData | public void setData(BufferedImage image, String imageFormat, Float quality)
throws IOException {
setData(ImageUtils.writeImageToBytes(image, imageFormat, quality));
} | java | public void setData(BufferedImage image, String imageFormat, Float quality)
throws IOException {
setData(ImageUtils.writeImageToBytes(image, imageFormat, quality));
} | [
"public",
"void",
"setData",
"(",
"BufferedImage",
"image",
",",
"String",
"imageFormat",
",",
"Float",
"quality",
")",
"throws",
"IOException",
"{",
"setData",
"(",
"ImageUtils",
".",
"writeImageToBytes",
"(",
"image",
",",
"imageFormat",
",",
"quality",
")",
... | Set the data from an image with optional quality
@param image
image
@param imageFormat
image format
@param quality
null or quality between 0.0 and 1.0
@throws IOException
upon failure
@since 3.2.0 | [
"Set",
"the",
"data",
"from",
"an",
"image",
"with",
"optional",
"quality"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/related/media/MediaRow.java#L162-L165 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.executeUploadPhotoRequestAsync | @Deprecated
public static RequestAsyncTask executeUploadPhotoRequestAsync(Session session, File file,
Callback callback) throws FileNotFoundException {
return newUploadPhotoRequest(session, file, callback).executeAsync();
} | java | @Deprecated
public static RequestAsyncTask executeUploadPhotoRequestAsync(Session session, File file,
Callback callback) throws FileNotFoundException {
return newUploadPhotoRequest(session, file, callback).executeAsync();
} | [
"@",
"Deprecated",
"public",
"static",
"RequestAsyncTask",
"executeUploadPhotoRequestAsync",
"(",
"Session",
"session",
",",
"File",
"file",
",",
"Callback",
"callback",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"newUploadPhotoRequest",
"(",
"session",
",",... | Starts a new Request configured to upload a photo to the user's default photo album. The photo
will be read from the specified stream.
<p/>
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newUploadPhotoRequest(...).executeAsync();
@param session the Session to use, or null; if non-null, the session must be in an opened state
@param file the file containing the photo to upload
@param callback a callback that will be called when the request is completed to handle success or error conditions
@return a RequestAsyncTask that is executing the request | [
"Starts",
"a",
"new",
"Request",
"configured",
"to",
"upload",
"a",
"photo",
"to",
"the",
"user",
"s",
"default",
"photo",
"album",
".",
"The",
"photo",
"will",
"be",
"read",
"from",
"the",
"specified",
"stream",
".",
"<p",
"/",
">",
"This",
"should",
... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1171-L1175 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopProxy.java | HadoopProxy.setupPropsForProxy | public void setupPropsForProxy(Props props, Props jobProps, final Logger logger)
throws Exception {
if (isProxyEnabled()) {
userToProxy = jobProps.getString(HadoopSecurityManager.USER_TO_PROXY);
logger.info("Need to proxy. Getting tokens.");
// get tokens in to a file, and put the location in props
tokenFile = HadoopJobUtils.getHadoopTokens(hadoopSecurityManager, props, logger);
jobProps.put("env." + HADOOP_TOKEN_FILE_LOCATION, tokenFile.getAbsolutePath());
}
} | java | public void setupPropsForProxy(Props props, Props jobProps, final Logger logger)
throws Exception {
if (isProxyEnabled()) {
userToProxy = jobProps.getString(HadoopSecurityManager.USER_TO_PROXY);
logger.info("Need to proxy. Getting tokens.");
// get tokens in to a file, and put the location in props
tokenFile = HadoopJobUtils.getHadoopTokens(hadoopSecurityManager, props, logger);
jobProps.put("env." + HADOOP_TOKEN_FILE_LOCATION, tokenFile.getAbsolutePath());
}
} | [
"public",
"void",
"setupPropsForProxy",
"(",
"Props",
"props",
",",
"Props",
"jobProps",
",",
"final",
"Logger",
"logger",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isProxyEnabled",
"(",
")",
")",
"{",
"userToProxy",
"=",
"jobProps",
".",
"getString",
"("... | Setup Job Properties when the proxy is enabled
@param props all properties
@param jobProps job properties
@param logger logger handler | [
"Setup",
"Job",
"Properties",
"when",
"the",
"proxy",
"is",
"enabled"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopProxy.java#L76-L85 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuStreamWriteValue32 | public static int cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, int value, int flags)
{
return checkResult(cuStreamWriteValue32Native(stream, addr, value, flags));
} | java | public static int cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, int value, int flags)
{
return checkResult(cuStreamWriteValue32Native(stream, addr, value, flags));
} | [
"public",
"static",
"int",
"cuStreamWriteValue32",
"(",
"CUstream",
"stream",
",",
"CUdeviceptr",
"addr",
",",
"int",
"value",
",",
"int",
"flags",
")",
"{",
"return",
"checkResult",
"(",
"cuStreamWriteValue32Native",
"(",
"stream",
",",
"addr",
",",
"value",
... | Write a value to memory.<br>
<br>
Write a value to memory. Unless the
CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER flag is passed, the write is
preceded by a system-wide memory fence, equivalent to a
__threadfence_system() but scoped to the stream rather than a CUDA
thread.<br>
<br>
If the memory was registered via cuMemHostRegister(), the device pointer
should be obtained with cuMemHostGetDevicePointer(). This function cannot
be used with managed memory (cuMemAllocManaged).<br>
<br>
On Windows, the device must be using TCC, or the operation is not
supported. See cuDeviceGetAttribute().
@param stream The stream to do the write in.
@param addr The device address to write to.
@param value The value to write.
@param flags See {@link CUstreamWriteValue_flags}
@return CUDA_SUCCESS, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_SUPPORTED
@see JCudaDriver#cuStreamWaitValue32
@see JCudaDriver#cuStreamBatchMemOp
@see JCudaDriver#cuMemHostRegister
@see JCudaDriver#cuEventRecord | [
"Write",
"a",
"value",
"to",
"memory",
".",
"<br",
">",
"<br",
">",
"Write",
"a",
"value",
"to",
"memory",
".",
"Unless",
"the",
"CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER",
"flag",
"is",
"passed",
"the",
"write",
"is",
"preceded",
"by",
"a",
"system",
"-",
... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L13724-L13727 |
alkacon/opencms-core | src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBUpdateOU.java | CmsUpdateDBUpdateOU.updateOUs | protected int updateOUs(CmsSetupDb dbCon, String table, String ouColumn) {
System.out.println(new Exception().getStackTrace()[0].toString());
int result = 1;
try {
if (!findOUColumn(dbCon, table, ouColumn)) {
// Alter the table and add the OUs
Map<String, String> replacements = new HashMap<String, String>();
replacements.put(REPLACEMENT_TABLENAME, table);
replacements.put(REPLACEMENT_COLUMNNAME, ouColumn);
String alterQuery = readQuery(QUERY_KEY_ALTER_TABLE);
// Update the database and alter the table to add the OUs
dbCon.updateSqlStatement(alterQuery, replacements, null);
// Insert the value '/' into the OUs
String insertQuery = readQuery(QUERY_ADD_OUS_TO_TABLE);
dbCon.updateSqlStatement(insertQuery, replacements, null);
result = 0;
} else {
System.out.println("column " + ouColumn + " in table " + table + " already exists");
}
// Nothing needs to be done
result = 0;
} catch (SQLException e) {
e.printStackTrace();
result = 1;
}
return result;
} | java | protected int updateOUs(CmsSetupDb dbCon, String table, String ouColumn) {
System.out.println(new Exception().getStackTrace()[0].toString());
int result = 1;
try {
if (!findOUColumn(dbCon, table, ouColumn)) {
// Alter the table and add the OUs
Map<String, String> replacements = new HashMap<String, String>();
replacements.put(REPLACEMENT_TABLENAME, table);
replacements.put(REPLACEMENT_COLUMNNAME, ouColumn);
String alterQuery = readQuery(QUERY_KEY_ALTER_TABLE);
// Update the database and alter the table to add the OUs
dbCon.updateSqlStatement(alterQuery, replacements, null);
// Insert the value '/' into the OUs
String insertQuery = readQuery(QUERY_ADD_OUS_TO_TABLE);
dbCon.updateSqlStatement(insertQuery, replacements, null);
result = 0;
} else {
System.out.println("column " + ouColumn + " in table " + table + " already exists");
}
// Nothing needs to be done
result = 0;
} catch (SQLException e) {
e.printStackTrace();
result = 1;
}
return result;
} | [
"protected",
"int",
"updateOUs",
"(",
"CmsSetupDb",
"dbCon",
",",
"String",
"table",
",",
"String",
"ouColumn",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"new",
"Exception",
"(",
")",
".",
"getStackTrace",
"(",
")",
"[",
"0",
"]",
".",
"toSt... | Updates the database tables with the new OUs if necessary for the given table.<p>
@param dbCon the db connection interface
@param table the table to update
@param ouColumn the column to insert
@return true if everything worked fine, false if not | [
"Updates",
"the",
"database",
"tables",
"with",
"the",
"new",
"OUs",
"if",
"necessary",
"for",
"the",
"given",
"table",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBUpdateOU.java#L138-L169 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/dense/DescribeDenseHogAlg.java | DescribeDenseHogAlg.addToHistogram | void addToHistogram(int cellX, int cellY, int orientationIndex, double magnitude) {
// see if it's being applied to a valid cell in the histogram
if( cellX < 0 || cellX >= cellsPerBlockX)
return;
if( cellY < 0 || cellY >= cellsPerBlockY)
return;
int index = (cellY*cellsPerBlockX + cellX)*orientationBins + orientationIndex;
histogram[index] += magnitude;
} | java | void addToHistogram(int cellX, int cellY, int orientationIndex, double magnitude) {
// see if it's being applied to a valid cell in the histogram
if( cellX < 0 || cellX >= cellsPerBlockX)
return;
if( cellY < 0 || cellY >= cellsPerBlockY)
return;
int index = (cellY*cellsPerBlockX + cellX)*orientationBins + orientationIndex;
histogram[index] += magnitude;
} | [
"void",
"addToHistogram",
"(",
"int",
"cellX",
",",
"int",
"cellY",
",",
"int",
"orientationIndex",
",",
"double",
"magnitude",
")",
"{",
"// see if it's being applied to a valid cell in the histogram",
"if",
"(",
"cellX",
"<",
"0",
"||",
"cellX",
">=",
"cellsPerBlo... | Adds the magnitude to the histogram at the specified cell and orientation
@param cellX cell coordinate
@param cellY cell coordinate
@param orientationIndex orientation coordinate
@param magnitude edge magnitude | [
"Adds",
"the",
"magnitude",
"to",
"the",
"histogram",
"at",
"the",
"specified",
"cell",
"and",
"orientation"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/dense/DescribeDenseHogAlg.java#L330-L339 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.findStaticMethod | public static MethodHandle findStaticMethod(Class<?> clazz, String methodName,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
return findMethod(clazz, methodName, true, expectedReturnType, expectedParameterTypes);
} | java | public static MethodHandle findStaticMethod(Class<?> clazz, String methodName,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
return findMethod(clazz, methodName, true, expectedReturnType, expectedParameterTypes);
} | [
"public",
"static",
"MethodHandle",
"findStaticMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"expectedReturnType",
",",
"Class",
"<",
"?",
">",
"...",
"expectedParameterTypes",
")",
"{",
"return",
"f... | Finds and returns a MethodHandle for a public static method.
@param clazz
the class to search
@param methodName
the name of the method
@param expectedReturnType
the expected return type. If {@code null}, any return type is treated as valid.
@param expectedParameterTypes
expected parameter types
@return a MethodHandle for the specified criteria. Returns {@code null} if no method exists
with the specified criteria. | [
"Finds",
"and",
"returns",
"a",
"MethodHandle",
"for",
"a",
"public",
"static",
"method",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L418-L421 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java | SecondsDescriptor.describe | protected String describe(final Between between, final boolean and) {
return new StringBuilder()
.append(
MessageFormat.format(
bundle.getString("between_x_and_y"),
nominalValue(between.getFrom()),
nominalValue(between.getTo())
)
)
.append(" ").toString();
} | java | protected String describe(final Between between, final boolean and) {
return new StringBuilder()
.append(
MessageFormat.format(
bundle.getString("between_x_and_y"),
nominalValue(between.getFrom()),
nominalValue(between.getTo())
)
)
.append(" ").toString();
} | [
"protected",
"String",
"describe",
"(",
"final",
"Between",
"between",
",",
"final",
"boolean",
"and",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"MessageFormat",
".",
"format",
"(",
"bundle",
".",
"getString",
"(",
"\"between_... | Provide a human readable description for Between instance.
@param between - Between
@return human readable description - String | [
"Provide",
"a",
"human",
"readable",
"description",
"for",
"Between",
"instance",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java#L114-L124 |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaTextFileReader.java | AstaTextFileReader.processFileType | private void processFileType(String token) throws MPXJException
{
String version = token.substring(2).split(" ")[0];
//System.out.println(version);
Class<? extends AbstractFileFormat> fileFormatClass = FILE_VERSION_MAP.get(Integer.valueOf(version));
if (fileFormatClass == null)
{
throw new MPXJException("Unsupported PP file format version " + version);
}
try
{
AbstractFileFormat format = fileFormatClass.newInstance();
m_tableDefinitions = format.tableDefinitions();
m_epochDateFormat = format.epochDateFormat();
}
catch (Exception ex)
{
throw new MPXJException("Failed to configure file format", ex);
}
} | java | private void processFileType(String token) throws MPXJException
{
String version = token.substring(2).split(" ")[0];
//System.out.println(version);
Class<? extends AbstractFileFormat> fileFormatClass = FILE_VERSION_MAP.get(Integer.valueOf(version));
if (fileFormatClass == null)
{
throw new MPXJException("Unsupported PP file format version " + version);
}
try
{
AbstractFileFormat format = fileFormatClass.newInstance();
m_tableDefinitions = format.tableDefinitions();
m_epochDateFormat = format.epochDateFormat();
}
catch (Exception ex)
{
throw new MPXJException("Failed to configure file format", ex);
}
} | [
"private",
"void",
"processFileType",
"(",
"String",
"token",
")",
"throws",
"MPXJException",
"{",
"String",
"version",
"=",
"token",
".",
"substring",
"(",
"2",
")",
".",
"split",
"(",
"\" \"",
")",
"[",
"0",
"]",
";",
"//System.out.println(version);",
"Cla... | Reads the file version and configures the expected file format.
@param token token containing the file version
@throws MPXJException | [
"Reads",
"the",
"file",
"version",
"and",
"configures",
"the",
"expected",
"file",
"format",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaTextFileReader.java#L221-L241 |
mqlight/java-mqlight | mqlight/src/main/java/com/ibm/mqlight/api/security/KeyStoreUtils.java | KeyStoreUtils.createPrivateKey | public static PrivateKey createPrivateKey(File pemKeyFile, char[] passwordChars) throws IOException, GeneralSecurityException {
final String methodName = "createPrivateKey";
logger.entry(methodName, pemKeyFile);
// Read the private key from the PEM format file
final PemFile privateKeyPemFile = new PemFile(pemKeyFile);
final byte[] privateKeyBytes = privateKeyPemFile.getPrivateKeyBytes();
final PrivateKey privateKey;
if (privateKeyPemFile.containsEncryptedPrivateKey()) {
// We should be able to do the follows (using standard JDK classes):
// EncryptedPrivateKeyInfo encryptPrivateKeyInfo = new EncryptedPrivateKeyInfo(privateKeyBytes);
// Cipher cipher = Cipher.getInstance(encryptPrivateKeyInfo.getAlgName());
// PBEKeySpec pbeKeySpec = new PBEKeySpec(passwordChars);
// SecretKeyFactory secFac = SecretKeyFactory.getInstance(encryptPrivateKeyInfo.getAlgName());
// Key pbeKey = secFac.generateSecret(pbeKeySpec);
// AlgorithmParameters algParams = encryptPrivateKeyInfo.getAlgParameters();
// cipher.init(Cipher.DECRYPT_MODE, pbeKey, algParams);
// KeySpec keySpec = encryptPrivateKeyInfo.getKeySpec(cipher);
// privateKey = KeyFactory.getInstance("RSA").generatePrivate(keySpec);
// but this can fail with a: "Unsupported key protection algorithm" if key was generated with openssl
//
// Instead we use the Apache commons SSL PKCS8Key class from Julius Davies (see not-yet-commons-ssl in Maven)
// which seems more reliable
final PKCS8Key key = new PKCS8Key(privateKeyBytes, passwordChars);
privateKey = key.getPrivateKey();
} else {
final KeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
InvalidKeySpecException keyFactoryException = null;
PrivateKey key = null;
for (String alg : new String[] { "RSA", "DSA", "DiffieHellman", "EC" }) {
try {
key = KeyFactory.getInstance(alg).generatePrivate(keySpec);
break;
} catch (InvalidKeySpecException e) {
if (keyFactoryException == null) keyFactoryException = e;
}
}
if (key == null) throw keyFactoryException;
privateKey = key;
}
logger.exit(methodName, privateKey);
return privateKey;
} | java | public static PrivateKey createPrivateKey(File pemKeyFile, char[] passwordChars) throws IOException, GeneralSecurityException {
final String methodName = "createPrivateKey";
logger.entry(methodName, pemKeyFile);
// Read the private key from the PEM format file
final PemFile privateKeyPemFile = new PemFile(pemKeyFile);
final byte[] privateKeyBytes = privateKeyPemFile.getPrivateKeyBytes();
final PrivateKey privateKey;
if (privateKeyPemFile.containsEncryptedPrivateKey()) {
// We should be able to do the follows (using standard JDK classes):
// EncryptedPrivateKeyInfo encryptPrivateKeyInfo = new EncryptedPrivateKeyInfo(privateKeyBytes);
// Cipher cipher = Cipher.getInstance(encryptPrivateKeyInfo.getAlgName());
// PBEKeySpec pbeKeySpec = new PBEKeySpec(passwordChars);
// SecretKeyFactory secFac = SecretKeyFactory.getInstance(encryptPrivateKeyInfo.getAlgName());
// Key pbeKey = secFac.generateSecret(pbeKeySpec);
// AlgorithmParameters algParams = encryptPrivateKeyInfo.getAlgParameters();
// cipher.init(Cipher.DECRYPT_MODE, pbeKey, algParams);
// KeySpec keySpec = encryptPrivateKeyInfo.getKeySpec(cipher);
// privateKey = KeyFactory.getInstance("RSA").generatePrivate(keySpec);
// but this can fail with a: "Unsupported key protection algorithm" if key was generated with openssl
//
// Instead we use the Apache commons SSL PKCS8Key class from Julius Davies (see not-yet-commons-ssl in Maven)
// which seems more reliable
final PKCS8Key key = new PKCS8Key(privateKeyBytes, passwordChars);
privateKey = key.getPrivateKey();
} else {
final KeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
InvalidKeySpecException keyFactoryException = null;
PrivateKey key = null;
for (String alg : new String[] { "RSA", "DSA", "DiffieHellman", "EC" }) {
try {
key = KeyFactory.getInstance(alg).generatePrivate(keySpec);
break;
} catch (InvalidKeySpecException e) {
if (keyFactoryException == null) keyFactoryException = e;
}
}
if (key == null) throw keyFactoryException;
privateKey = key;
}
logger.exit(methodName, privateKey);
return privateKey;
} | [
"public",
"static",
"PrivateKey",
"createPrivateKey",
"(",
"File",
"pemKeyFile",
",",
"char",
"[",
"]",
"passwordChars",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"final",
"String",
"methodName",
"=",
"\"createPrivateKey\"",
";",
"logger",
... | Creates a {@link PrivateKey} instance from the passed private key PEM format file and certificate chain.
@param pemKeyFile
A PEM format file containing the private key.
@param passwordChars
The password that protects the private key.
@return the private key, created by this method.
@throws IOException if the file cannot be read.
@throws GeneralSecurityException if a cryptography problem is encountered. | [
"Creates",
"a",
"{",
"@link",
"PrivateKey",
"}",
"instance",
"from",
"the",
"passed",
"private",
"key",
"PEM",
"format",
"file",
"and",
"certificate",
"chain",
"."
] | train | https://github.com/mqlight/java-mqlight/blob/a565dfa6044050826d1221697da9e3268b557aeb/mqlight/src/main/java/com/ibm/mqlight/api/security/KeyStoreUtils.java#L147-L192 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final Connection conn,
final String insertSQL) throws UncheckedSQLException {
return importData(dataset, selectColumnNames, offset, count, conn, insertSQL, 200, 0);
} | java | public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final Connection conn,
final String insertSQL) throws UncheckedSQLException {
return importData(dataset, selectColumnNames, offset, count, conn, insertSQL, 200, 0);
} | [
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"Collection",
"<",
"String",
">",
"selectColumnNames",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"count",
",",
"final",
"Connection",
"conn",
",",
"final",
"... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param selectColumnNames
@param offset
@param count
@param conn
@param insertSQL the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:
<pre><code>
List<String> columnNameList = new ArrayList<>(dataset.columnNameList());
columnNameList.retainAll(yourSelectColumnNames);
String sql = RE.insert(columnNameList).into(tableName).sql();
</code></pre>
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L1895-L1898 |
stagemonitor/stagemonitor | stagemonitor-core/src/main/java/org/stagemonitor/core/elasticsearch/ElasticsearchClient.java | ElasticsearchClient.scheduleIndexManagement | public void scheduleIndexManagement(String indexPrefix, int optimizeAndMoveIndicesToColdNodesOlderThanDays, int deleteIndicesOlderThanDays) {
if (deleteIndicesOlderThanDays > 0) {
final TimerTask deleteIndicesTask = new DeleteIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
deleteIndicesOlderThanDays, this);
timer.schedule(deleteIndicesTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis());
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask shardAllocationTask = new ShardAllocationTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this, "cold");
timer.schedule(shardAllocationTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis());
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask optimizeIndicesTask = new ForceMergeIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this);
timer.schedule(optimizeIndicesTask, DateUtils.getNextDateAtHour(3), DateUtils.getDayInMillis());
}
} | java | public void scheduleIndexManagement(String indexPrefix, int optimizeAndMoveIndicesToColdNodesOlderThanDays, int deleteIndicesOlderThanDays) {
if (deleteIndicesOlderThanDays > 0) {
final TimerTask deleteIndicesTask = new DeleteIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
deleteIndicesOlderThanDays, this);
timer.schedule(deleteIndicesTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis());
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask shardAllocationTask = new ShardAllocationTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this, "cold");
timer.schedule(shardAllocationTask, TimeUnit.SECONDS.toMillis(5), DateUtils.getDayInMillis());
}
if (optimizeAndMoveIndicesToColdNodesOlderThanDays > 0) {
final TimerTask optimizeIndicesTask = new ForceMergeIndicesTask(corePlugin.getIndexSelector(), indexPrefix,
optimizeAndMoveIndicesToColdNodesOlderThanDays, this);
timer.schedule(optimizeIndicesTask, DateUtils.getNextDateAtHour(3), DateUtils.getDayInMillis());
}
} | [
"public",
"void",
"scheduleIndexManagement",
"(",
"String",
"indexPrefix",
",",
"int",
"optimizeAndMoveIndicesToColdNodesOlderThanDays",
",",
"int",
"deleteIndicesOlderThanDays",
")",
"{",
"if",
"(",
"deleteIndicesOlderThanDays",
">",
"0",
")",
"{",
"final",
"TimerTask",
... | Performs an optimize and delete on logstash-style index patterns [prefix]YYYY.MM.DD
@param indexPrefix the prefix of the logstash-style index pattern | [
"Performs",
"an",
"optimize",
"and",
"delete",
"on",
"logstash",
"-",
"style",
"index",
"patterns",
"[",
"prefix",
"]",
"YYYY",
".",
"MM",
".",
"DD"
] | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/elasticsearch/ElasticsearchClient.java#L352-L371 |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.setDelegationToken | private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN);
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup delegation token in the ugi", e);
}
}
} | java | private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN);
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup delegation token in the ugi", e);
}
}
} | [
"private",
"void",
"setDelegationToken",
"(",
"String",
"delegationTokenStr",
")",
"throws",
"HiveSQLException",
"{",
"this",
".",
"delegationTokenStr",
"=",
"delegationTokenStr",
";",
"if",
"(",
"delegationTokenStr",
"!=",
"null",
")",
"{",
"getHiveConf",
"(",
")",... | Enable delegation token for the session
save the token string and set the token.signature in hive conf. The metastore client uses
this token.signature to determine where to use kerberos or delegation token
@throws HiveException
@throws IOException | [
"Enable",
"delegation",
"token",
"for",
"the",
"session",
"save",
"the",
"token",
"string",
"and",
"set",
"the",
"token",
".",
"signature",
"in",
"hive",
"conf",
".",
"The",
"metastore",
"client",
"uses",
"this",
"token",
".",
"signature",
"to",
"determine",... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L128-L138 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java | ProvisionerImpl.installBundles | protected BundleInstallStatus installBundles(BootstrapConfig config) throws InvalidBundleContextException {
BundleInstallStatus installStatus = new BundleInstallStatus();
KernelResolver resolver = config.getKernelResolver();
ContentBasedLocalBundleRepository repo = BundleRepositoryRegistry.getInstallBundleRepository();
List<KernelBundleElement> bundleList = resolver.getKernelBundles();
if (bundleList == null || bundleList.size() <= 0)
return installStatus;
boolean libertyBoot = Boolean.parseBoolean(config.get(BootstrapConstants.LIBERTY_BOOT_PROPERTY));
for (final KernelBundleElement element : bundleList) {
if (libertyBoot) {
// For boot bundles the LibertyBootRuntime must be used to install the bundles
installLibertBootBundle(element, installStatus);
} else {
installKernelBundle(element, installStatus, repo);
}
}
return installStatus;
} | java | protected BundleInstallStatus installBundles(BootstrapConfig config) throws InvalidBundleContextException {
BundleInstallStatus installStatus = new BundleInstallStatus();
KernelResolver resolver = config.getKernelResolver();
ContentBasedLocalBundleRepository repo = BundleRepositoryRegistry.getInstallBundleRepository();
List<KernelBundleElement> bundleList = resolver.getKernelBundles();
if (bundleList == null || bundleList.size() <= 0)
return installStatus;
boolean libertyBoot = Boolean.parseBoolean(config.get(BootstrapConstants.LIBERTY_BOOT_PROPERTY));
for (final KernelBundleElement element : bundleList) {
if (libertyBoot) {
// For boot bundles the LibertyBootRuntime must be used to install the bundles
installLibertBootBundle(element, installStatus);
} else {
installKernelBundle(element, installStatus, repo);
}
}
return installStatus;
} | [
"protected",
"BundleInstallStatus",
"installBundles",
"(",
"BootstrapConfig",
"config",
")",
"throws",
"InvalidBundleContextException",
"{",
"BundleInstallStatus",
"installStatus",
"=",
"new",
"BundleInstallStatus",
"(",
")",
";",
"KernelResolver",
"resolver",
"=",
"config"... | Install framework bundles.
@param bundleList
Properties describing the bundles to install
@oaran config
Bootstrap configuration containing information about
initial configuration parameters and file locations
@return BundleInstallStatus containing details about the bundles
installed, exceptions that occurred, bundles that couldn't be
found, etc. | [
"Install",
"framework",
"bundles",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/ProvisionerImpl.java#L220-L241 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.rotateTowards | public Matrix4d rotateTowards(Vector3dc direction, Vector3dc up, Matrix4d dest) {
return rotateTowards(direction.x(), direction.y(), direction.z(), up.x(), up.y(), up.z(), dest);
} | java | public Matrix4d rotateTowards(Vector3dc direction, Vector3dc up, Matrix4d dest) {
return rotateTowards(direction.x(), direction.y(), direction.z(), up.x(), up.y(), up.z(), dest);
} | [
"public",
"Matrix4d",
"rotateTowards",
"(",
"Vector3dc",
"direction",
",",
"Vector3dc",
"up",
",",
"Matrix4d",
"dest",
")",
"{",
"return",
"rotateTowards",
"(",
"direction",
".",
"x",
"(",
")",
",",
"direction",
".",
"y",
"(",
")",
",",
"direction",
".",
... | Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local <code>+Z</code> axis with <code>direction</code>
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying it,
use {@link #rotationTowards(Vector3dc, Vector3dc) rotationTowards()}.
<p>
This method is equivalent to calling: <code>mulAffine(new Matrix4d().lookAt(new Vector3d(), new Vector3d(dir).negate(), up).invertAffine(), dest)</code>
@see #rotateTowards(double, double, double, double, double, double, Matrix4d)
@see #rotationTowards(Vector3dc, Vector3dc)
@param direction
the direction to rotate towards
@param up
the up vector
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"model",
"transformation",
"to",
"this",
"matrix",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"+",
"Z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"direction<",
"/",
"co... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L15119-L15121 |
kstateome/canvas-api | src/main/java/edu/ksu/canvas/CanvasApiFactory.java | CanvasApiFactory.getWriter | public <T extends CanvasWriter> T getWriter(Class<T> type, OauthToken oauthToken, Boolean serializeNulls) {
LOG.debug("Factory call to instantiate class: " + type.getName());
RestClient restClient = new RefreshingRestClient();
@SuppressWarnings("unchecked")
Class<T> concreteClass = (Class<T>) writerMap.get(type);
if (concreteClass == null) {
throw new UnsupportedOperationException("No implementation for requested interface found: " + type.getName());
}
LOG.debug("got writer class: " + concreteClass);
try {
Constructor<T> constructor = concreteClass.getConstructor(String.class, Integer.class, OauthToken.class,
RestClient.class, Integer.TYPE, Integer.TYPE, Integer.class, Boolean.class);
return constructor.newInstance(canvasBaseUrl, CANVAS_API_VERSION, oauthToken, restClient,
connectTimeout, readTimeout, null, serializeNulls);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {
throw new UnsupportedOperationException("Unknown error instantiating the concrete API class: " + type.getName(), e);
}
} | java | public <T extends CanvasWriter> T getWriter(Class<T> type, OauthToken oauthToken, Boolean serializeNulls) {
LOG.debug("Factory call to instantiate class: " + type.getName());
RestClient restClient = new RefreshingRestClient();
@SuppressWarnings("unchecked")
Class<T> concreteClass = (Class<T>) writerMap.get(type);
if (concreteClass == null) {
throw new UnsupportedOperationException("No implementation for requested interface found: " + type.getName());
}
LOG.debug("got writer class: " + concreteClass);
try {
Constructor<T> constructor = concreteClass.getConstructor(String.class, Integer.class, OauthToken.class,
RestClient.class, Integer.TYPE, Integer.TYPE, Integer.class, Boolean.class);
return constructor.newInstance(canvasBaseUrl, CANVAS_API_VERSION, oauthToken, restClient,
connectTimeout, readTimeout, null, serializeNulls);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {
throw new UnsupportedOperationException("Unknown error instantiating the concrete API class: " + type.getName(), e);
}
} | [
"public",
"<",
"T",
"extends",
"CanvasWriter",
">",
"T",
"getWriter",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"OauthToken",
"oauthToken",
",",
"Boolean",
"serializeNulls",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Factory call to instantiate class: \"",
"+",
"t... | Get a writer implementation to push data into Canvas while being able to control the behavior of blank values.
If the serializeNulls parameter is set to true, this writer will serialize null fields in the JSON being
sent to Canvas. This is required if you want to explicitly blank out a value that is currently set to something.
@param type Interface type you wish to get an implementation for
@param oauthToken An OAuth token to use for authentication when making API calls
@param serializeNulls Whether or not to include null fields in the serialized JSON. Defaults to false if null
@param <T> A writer implementation
@return An instantiated instance of the requested writer type | [
"Get",
"a",
"writer",
"implementation",
"to",
"push",
"data",
"into",
"Canvas",
"while",
"being",
"able",
"to",
"control",
"the",
"behavior",
"of",
"blank",
"values",
".",
"If",
"the",
"serializeNulls",
"parameter",
"is",
"set",
"to",
"true",
"this",
"writer... | train | https://github.com/kstateome/canvas-api/blob/426bf403a8fd7aca3f170348005feda25b374e5a/src/main/java/edu/ksu/canvas/CanvasApiFactory.java#L126-L146 |
undera/jmeter-plugins | infra/common/src/main/java/kg/apc/jmeter/gui/ComponentBorder.java | ComponentBorder.determineInsetsAndAlignment | private void determineInsetsAndAlignment() {
borderInsets = new Insets(0, 0, 0, 0);
// The insets will only be updated for the edge the component will be
// diplayed on.
//
// The X, Y alignment of the component is controlled by both the edge
// and alignment parameters
if (edge == Edge.TOP) {
borderInsets.top = component.getPreferredSize().height + gap;
component.setAlignmentX(alignment);
component.setAlignmentY(0.0f);
} else if (edge == Edge.BOTTOM) {
borderInsets.bottom = component.getPreferredSize().height + gap;
component.setAlignmentX(alignment);
component.setAlignmentY(1.0f);
} else if (edge == Edge.LEFT) {
borderInsets.left = component.getPreferredSize().width + gap;
component.setAlignmentX(0.0f);
component.setAlignmentY(alignment);
} else if (edge == Edge.RIGHT) {
borderInsets.right = component.getPreferredSize().width + gap;
component.setAlignmentX(1.0f);
component.setAlignmentY(alignment);
}
if (adjustInsets) {
adjustBorderInsets();
}
} | java | private void determineInsetsAndAlignment() {
borderInsets = new Insets(0, 0, 0, 0);
// The insets will only be updated for the edge the component will be
// diplayed on.
//
// The X, Y alignment of the component is controlled by both the edge
// and alignment parameters
if (edge == Edge.TOP) {
borderInsets.top = component.getPreferredSize().height + gap;
component.setAlignmentX(alignment);
component.setAlignmentY(0.0f);
} else if (edge == Edge.BOTTOM) {
borderInsets.bottom = component.getPreferredSize().height + gap;
component.setAlignmentX(alignment);
component.setAlignmentY(1.0f);
} else if (edge == Edge.LEFT) {
borderInsets.left = component.getPreferredSize().width + gap;
component.setAlignmentX(0.0f);
component.setAlignmentY(alignment);
} else if (edge == Edge.RIGHT) {
borderInsets.right = component.getPreferredSize().width + gap;
component.setAlignmentX(1.0f);
component.setAlignmentY(alignment);
}
if (adjustInsets) {
adjustBorderInsets();
}
} | [
"private",
"void",
"determineInsetsAndAlignment",
"(",
")",
"{",
"borderInsets",
"=",
"new",
"Insets",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"// The insets will only be updated for the edge the component will be",
"// diplayed on.",
"//",
"// The X, Y ali... | The insets need to be determined so they are included in the preferred
size of the component the Border is attached to.
The alignment of the component is determined here so it doesn't need
to be recalculated every time the Border is painted. | [
"The",
"insets",
"need",
"to",
"be",
"determined",
"so",
"they",
"are",
"included",
"in",
"the",
"preferred",
"size",
"of",
"the",
"component",
"the",
"Border",
"is",
"attached",
"to",
"."
] | train | https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/infra/common/src/main/java/kg/apc/jmeter/gui/ComponentBorder.java#L201-L231 |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java | AuthenticationApi.changePassword | public ModelApiResponse changePassword(ApiRequestChangePasswordOperation request, String authorization) throws ApiException {
ApiResponse<ModelApiResponse> resp = changePasswordWithHttpInfo(request, authorization);
return resp.getData();
} | java | public ModelApiResponse changePassword(ApiRequestChangePasswordOperation request, String authorization) throws ApiException {
ApiResponse<ModelApiResponse> resp = changePasswordWithHttpInfo(request, authorization);
return resp.getData();
} | [
"public",
"ModelApiResponse",
"changePassword",
"(",
"ApiRequestChangePasswordOperation",
"request",
",",
"String",
"authorization",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ModelApiResponse",
">",
"resp",
"=",
"changePasswordWithHttpInfo",
"(",
"request",
... | Change password
Change the user's password.
@param request request (required)
@param authorization The OAuth 2 bearer access token you received from [/auth/v3/oauth/token](/reference/authentication/Authentication/index.html#retrieveToken). For example: \"Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\" (optional, default to bearer)
@return ModelApiResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Change",
"password",
"Change",
"the",
"user'",
";",
"s",
"password",
"."
] | train | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L297-L300 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/DistributedScanRangeMonitor.java | DistributedScanRangeMonitor.unclaimTask | private void unclaimTask(ClaimedTask claimedTask, boolean releaseTask) {
_claimedTasks.remove(claimedTask.getTaskId());
claimedTask.setComplete(true);
if (releaseTask) {
try {
_scanWorkflow.releaseScanRangeTask(claimedTask.getTask());
_log.info("Released scan range task: {}", claimedTask.getTask());
} catch (Exception e) {
_log.error("Failed to release scan range", e);
}
}
} | java | private void unclaimTask(ClaimedTask claimedTask, boolean releaseTask) {
_claimedTasks.remove(claimedTask.getTaskId());
claimedTask.setComplete(true);
if (releaseTask) {
try {
_scanWorkflow.releaseScanRangeTask(claimedTask.getTask());
_log.info("Released scan range task: {}", claimedTask.getTask());
} catch (Exception e) {
_log.error("Failed to release scan range", e);
}
}
} | [
"private",
"void",
"unclaimTask",
"(",
"ClaimedTask",
"claimedTask",
",",
"boolean",
"releaseTask",
")",
"{",
"_claimedTasks",
".",
"remove",
"(",
"claimedTask",
".",
"getTaskId",
"(",
")",
")",
";",
"claimedTask",
".",
"setComplete",
"(",
"true",
")",
";",
... | Unclaims a previously claimed task. Effectively this stops the renewing the task and, if releaseTask is true,
removes the task permanently from the workflow queue. | [
"Unclaims",
"a",
"previously",
"claimed",
"task",
".",
"Effectively",
"this",
"stops",
"the",
"renewing",
"the",
"task",
"and",
"if",
"releaseTask",
"is",
"true",
"removes",
"the",
"task",
"permanently",
"from",
"the",
"workflow",
"queue",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/DistributedScanRangeMonitor.java#L257-L269 |
adyliu/jafka | src/main/java/io/jafka/log/LogManager.java | LogManager.getLog | public ILog getLog(String topic, int partition) {
TopicNameValidator.validate(topic);
Pool<Integer, Log> p = getLogPool(topic, partition);
return p == null ? null : p.get(partition);
} | java | public ILog getLog(String topic, int partition) {
TopicNameValidator.validate(topic);
Pool<Integer, Log> p = getLogPool(topic, partition);
return p == null ? null : p.get(partition);
} | [
"public",
"ILog",
"getLog",
"(",
"String",
"topic",
",",
"int",
"partition",
")",
"{",
"TopicNameValidator",
".",
"validate",
"(",
"topic",
")",
";",
"Pool",
"<",
"Integer",
",",
"Log",
">",
"p",
"=",
"getLogPool",
"(",
"topic",
",",
"partition",
")",
... | Get the log if exists or return null
@param topic topic name
@param partition partition index
@return a log for the topic or null if not exist | [
"Get",
"the",
"log",
"if",
"exists",
"or",
"return",
"null"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/log/LogManager.java#L450-L454 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRowRendererRenderer.java | WDataTableRowRendererRenderer.getFilterValues | private String getFilterValues(final TableDataModel dataModel, final int rowIndex) {
List<String> filterValues = dataModel.getFilterValues(rowIndex);
if (filterValues == null || filterValues.isEmpty()) {
return null;
}
StringBuffer buf = new StringBuffer(filterValues.get(0));
for (int i = 1; i < filterValues.size(); i++) {
buf.append(", ");
buf.append(filterValues.get(i));
}
return buf.toString();
} | java | private String getFilterValues(final TableDataModel dataModel, final int rowIndex) {
List<String> filterValues = dataModel.getFilterValues(rowIndex);
if (filterValues == null || filterValues.isEmpty()) {
return null;
}
StringBuffer buf = new StringBuffer(filterValues.get(0));
for (int i = 1; i < filterValues.size(); i++) {
buf.append(", ");
buf.append(filterValues.get(i));
}
return buf.toString();
} | [
"private",
"String",
"getFilterValues",
"(",
"final",
"TableDataModel",
"dataModel",
",",
"final",
"int",
"rowIndex",
")",
"{",
"List",
"<",
"String",
">",
"filterValues",
"=",
"dataModel",
".",
"getFilterValues",
"(",
"rowIndex",
")",
";",
"if",
"(",
"filterV... | Retrieves the filter values for the given row in the data model, as a comma-separated string.
@param dataModel the data model.
@param rowIndex the row index.
@return the filter values string. | [
"Retrieves",
"the",
"filter",
"values",
"for",
"the",
"given",
"row",
"in",
"the",
"data",
"model",
"as",
"a",
"comma",
"-",
"separated",
"string",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRowRendererRenderer.java#L163-L178 |
pugwoo/nimble-orm | src/main/java/com/pugwoo/dbhelper/sql/SQLUtils.java | SQLUtils.joinAndGetValue | private static String joinAndGetValue(List<Field> fields, String sep,
List<Object> values, Object obj, boolean isWithNullValue) {
return joinAndGetValueForInsert(fields, sep, null, values, obj, isWithNullValue);
} | java | private static String joinAndGetValue(List<Field> fields, String sep,
List<Object> values, Object obj, boolean isWithNullValue) {
return joinAndGetValueForInsert(fields, sep, null, values, obj, isWithNullValue);
} | [
"private",
"static",
"String",
"joinAndGetValue",
"(",
"List",
"<",
"Field",
">",
"fields",
",",
"String",
"sep",
",",
"List",
"<",
"Object",
">",
"values",
",",
"Object",
"obj",
",",
"boolean",
"isWithNullValue",
")",
"{",
"return",
"joinAndGetValueForInsert"... | 拼凑字段逗号,分隔子句(用于insert),并把参数obj的值放到values中
@param fields
@param sep
@param values
@param obj
@param isWithNullValue 是否把null值放到values中
@return | [
"拼凑字段逗号",
"分隔子句(用于insert),并把参数obj的值放到values中"
] | train | https://github.com/pugwoo/nimble-orm/blob/dd496f3e57029e4f22f9a2f00d18a6513ef94d08/src/main/java/com/pugwoo/dbhelper/sql/SQLUtils.java#L817-L820 |
kiegroup/jbpm | jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java | ClassCacheManager.findCommand | public Command findCommand(String name, ClassLoader cl) {
synchronized (commandCache) {
if (!commandCache.containsKey(name)) {
try {
Command commandInstance = (Command) Class.forName(name, true, cl).newInstance();
commandCache.put(name, commandInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
} else {
Command cmd = commandCache.get(name);
if (!cmd.getClass().getClassLoader().equals(cl)) {
commandCache.remove(name);
try {
Command commandInstance = (Command) Class.forName(name, true, cl).newInstance();
commandCache.put(name, commandInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
}
}
}
return commandCache.get(name);
} | java | public Command findCommand(String name, ClassLoader cl) {
synchronized (commandCache) {
if (!commandCache.containsKey(name)) {
try {
Command commandInstance = (Command) Class.forName(name, true, cl).newInstance();
commandCache.put(name, commandInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
} else {
Command cmd = commandCache.get(name);
if (!cmd.getClass().getClassLoader().equals(cl)) {
commandCache.remove(name);
try {
Command commandInstance = (Command) Class.forName(name, true, cl).newInstance();
commandCache.put(name, commandInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
}
}
}
return commandCache.get(name);
} | [
"public",
"Command",
"findCommand",
"(",
"String",
"name",
",",
"ClassLoader",
"cl",
")",
"{",
"synchronized",
"(",
"commandCache",
")",
"{",
"if",
"(",
"!",
"commandCache",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"try",
"{",
"Command",
"commandIns... | Finds command by FQCN and if not found loads the class and store the instance in
the cache.
@param name - fully qualified class name of the command
@return initialized class instance | [
"Finds",
"command",
"by",
"FQCN",
"and",
"if",
"not",
"found",
"loads",
"the",
"class",
"and",
"store",
"the",
"instance",
"in",
"the",
"cache",
"."
] | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java#L51-L79 |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerFactory.java | ZipFileContainerFactory.createContainer | @Override
public ArtifactContainer createContainer(File cacheDir, Object containerData) {
if ( !(containerData instanceof File) ) {
return null;
}
File fileContainerData = (File) containerData;
if ( !FileUtils.fileIsFile(fileContainerData) ) {
return null;
}
if ( !isZip(fileContainerData) ) {
return null;
}
return new ZipFileContainer(cacheDir, fileContainerData, this);
} | java | @Override
public ArtifactContainer createContainer(File cacheDir, Object containerData) {
if ( !(containerData instanceof File) ) {
return null;
}
File fileContainerData = (File) containerData;
if ( !FileUtils.fileIsFile(fileContainerData) ) {
return null;
}
if ( !isZip(fileContainerData) ) {
return null;
}
return new ZipFileContainer(cacheDir, fileContainerData, this);
} | [
"@",
"Override",
"public",
"ArtifactContainer",
"createContainer",
"(",
"File",
"cacheDir",
",",
"Object",
"containerData",
")",
"{",
"if",
"(",
"!",
"(",
"containerData",
"instanceof",
"File",
")",
")",
"{",
"return",
"null",
";",
"}",
"File",
"fileContainerD... | Attempt to create a root-of-roots zip file type container.
Anser null if the container data is not a file or is not a valid
zip file.
@return A new root-of-roots zip file type container. | [
"Attempt",
"to",
"create",
"a",
"root",
"-",
"of",
"-",
"roots",
"zip",
"file",
"type",
"container",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainerFactory.java#L185-L201 |
alkacon/opencms-core | src/org/opencms/file/CmsUser.java | CmsUser.setAdditionalInfo | public void setAdditionalInfo(String key, Object value) {
if (key == null) {
throw new CmsIllegalArgumentException(
Messages.get().container(Messages.ERR_USER_ADDINFO_KEY_NULL_1, getFullName()));
}
m_additionalInfo.put(key, value);
} | java | public void setAdditionalInfo(String key, Object value) {
if (key == null) {
throw new CmsIllegalArgumentException(
Messages.get().container(Messages.ERR_USER_ADDINFO_KEY_NULL_1, getFullName()));
}
m_additionalInfo.put(key, value);
} | [
"public",
"void",
"setAdditionalInfo",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"CmsIllegalArgumentException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages"... | Stores a value in this users "additional information" storage map with the given access key.<p>
@param key the key to store the value under
@param value the value to store in the users "additional information" storage map
@see #getAdditionalInfo() | [
"Stores",
"a",
"value",
"in",
"this",
"users",
"additional",
"information",
"storage",
"map",
"with",
"the",
"given",
"access",
"key",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsUser.java#L665-L672 |
Azure/azure-sdk-for-java | keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java | VaultsInner.updateAccessPolicy | public VaultAccessPolicyParametersInner updateAccessPolicy(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyProperties properties) {
return updateAccessPolicyWithServiceResponseAsync(resourceGroupName, vaultName, operationKind, properties).toBlocking().single().body();
} | java | public VaultAccessPolicyParametersInner updateAccessPolicy(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyProperties properties) {
return updateAccessPolicyWithServiceResponseAsync(resourceGroupName, vaultName, operationKind, properties).toBlocking().single().body();
} | [
"public",
"VaultAccessPolicyParametersInner",
"updateAccessPolicy",
"(",
"String",
"resourceGroupName",
",",
"String",
"vaultName",
",",
"AccessPolicyUpdateKind",
"operationKind",
",",
"VaultAccessPolicyProperties",
"properties",
")",
"{",
"return",
"updateAccessPolicyWithService... | Update access policies in a key vault in the specified subscription.
@param resourceGroupName The name of the Resource Group to which the vault belongs.
@param vaultName Name of the vault
@param operationKind Name of the operation. Possible values include: 'add', 'replace', 'remove'
@param properties Properties of the access policy
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VaultAccessPolicyParametersInner object if successful. | [
"Update",
"access",
"policies",
"in",
"a",
"key",
"vault",
"in",
"the",
"specified",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L517-L519 |
joniles/mpxj | src/main/java/net/sf/mpxj/fasttrack/FastTrackTable.java | FastTrackTable.getRow | private MapRow getRow(int index)
{
MapRow result;
if (index == m_rows.size())
{
result = new MapRow(this, new HashMap<FastTrackField, Object>());
m_rows.add(result);
}
else
{
result = m_rows.get(index);
}
return result;
} | java | private MapRow getRow(int index)
{
MapRow result;
if (index == m_rows.size())
{
result = new MapRow(this, new HashMap<FastTrackField, Object>());
m_rows.add(result);
}
else
{
result = m_rows.get(index);
}
return result;
} | [
"private",
"MapRow",
"getRow",
"(",
"int",
"index",
")",
"{",
"MapRow",
"result",
";",
"if",
"(",
"index",
"==",
"m_rows",
".",
"size",
"(",
")",
")",
"{",
"result",
"=",
"new",
"MapRow",
"(",
"this",
",",
"new",
"HashMap",
"<",
"FastTrackField",
","... | Retrieve a specific row by index number, creating a blank row if this row does not exist.
@param index index number
@return MapRow instance | [
"Retrieve",
"a",
"specific",
"row",
"by",
"index",
"number",
"creating",
"a",
"blank",
"row",
"if",
"this",
"row",
"does",
"not",
"exist",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackTable.java#L108-L123 |
code4everything/util | src/main/java/com/zhazhapan/util/Checker.java | Checker.checkNull | public static Double checkNull(Double value, double elseValue) {
return checkNull(value, Double.valueOf(elseValue));
} | java | public static Double checkNull(Double value, double elseValue) {
return checkNull(value, Double.valueOf(elseValue));
} | [
"public",
"static",
"Double",
"checkNull",
"(",
"Double",
"value",
",",
"double",
"elseValue",
")",
"{",
"return",
"checkNull",
"(",
"value",
",",
"Double",
".",
"valueOf",
"(",
"elseValue",
")",
")",
";",
"}"
] | 检查Double是否为null
@param value 值
@param elseValue 为null返回的值
@return {@link Double}
@since 1.0.8 | [
"检查Double是否为null"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L1185-L1187 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.doAppendTextInsideTag | private static StringBuffer doAppendTextInsideTag(StringBuffer buffer, String text, String tag, Map<String, String> attributes)
{
return appendClosingTag(appendOpeningTag(buffer, tag, attributes).append(text), tag);
} | java | private static StringBuffer doAppendTextInsideTag(StringBuffer buffer, String text, String tag, Map<String, String> attributes)
{
return appendClosingTag(appendOpeningTag(buffer, tag, attributes).append(text), tag);
} | [
"private",
"static",
"StringBuffer",
"doAppendTextInsideTag",
"(",
"StringBuffer",
"buffer",
",",
"String",
"text",
",",
"String",
"tag",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"return",
"appendClosingTag",
"(",
"appendOpeningTag",
... | Wrap a text inside a tag with attributes.
@param buffer
StringBuffer to fill
@param text
the text to wrap
@param tag
the tag to use
@param attributes
the attribute map
@return the buffer | [
"Wrap",
"a",
"text",
"inside",
"a",
"tag",
"with",
"attributes",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L514-L517 |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.askConfirm | public static Boolean askConfirm(Boolean confirm, String opDesc) throws IOException {
if(confirm) {
System.out.println("Confirmed " + opDesc + " in command-line.");
return true;
} else {
System.out.println("Are you sure you want to " + opDesc + "? (yes/no)");
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String text = buffer.readLine().toLowerCase(Locale.ENGLISH);
boolean go = text.equals("yes") || text.equals("y");
if (!go) {
System.out.println("Did not confirm; " + opDesc + " aborted.");
}
return go;
}
} | java | public static Boolean askConfirm(Boolean confirm, String opDesc) throws IOException {
if(confirm) {
System.out.println("Confirmed " + opDesc + " in command-line.");
return true;
} else {
System.out.println("Are you sure you want to " + opDesc + "? (yes/no)");
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String text = buffer.readLine().toLowerCase(Locale.ENGLISH);
boolean go = text.equals("yes") || text.equals("y");
if (!go) {
System.out.println("Did not confirm; " + opDesc + " aborted.");
}
return go;
}
} | [
"public",
"static",
"Boolean",
"askConfirm",
"(",
"Boolean",
"confirm",
",",
"String",
"opDesc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"confirm",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Confirmed \"",
"+",
"opDesc",
"+",
"\" in comman... | Utility function that pauses and asks for confirmation on dangerous
operations.
@param confirm User has already confirmed in command-line input
@param opDesc Description of the dangerous operation
@throws IOException
@return True if user confirms the operation in either command-line input
or here. | [
"Utility",
"function",
"that",
"pauses",
"and",
"asks",
"for",
"confirmation",
"on",
"dangerous",
"operations",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L99-L113 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/RunContainer.java | RunContainer.copyToOffset | private void copyToOffset(int offset) {
final int minCapacity = 2 * (offset + nbrruns);
if (valueslength.length < minCapacity) {
// expensive case where we need to reallocate
int newCapacity = valueslength.length;
while (newCapacity < minCapacity) {
newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE
: newCapacity < 64 ? newCapacity * 2
: newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4;
}
short[] newvalueslength = new short[newCapacity];
copyValuesLength(this.valueslength, 0, newvalueslength, offset, nbrruns);
this.valueslength = newvalueslength;
} else {
// efficient case where we just copy
copyValuesLength(this.valueslength, 0, this.valueslength, offset, nbrruns);
}
} | java | private void copyToOffset(int offset) {
final int minCapacity = 2 * (offset + nbrruns);
if (valueslength.length < minCapacity) {
// expensive case where we need to reallocate
int newCapacity = valueslength.length;
while (newCapacity < minCapacity) {
newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE
: newCapacity < 64 ? newCapacity * 2
: newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4;
}
short[] newvalueslength = new short[newCapacity];
copyValuesLength(this.valueslength, 0, newvalueslength, offset, nbrruns);
this.valueslength = newvalueslength;
} else {
// efficient case where we just copy
copyValuesLength(this.valueslength, 0, this.valueslength, offset, nbrruns);
}
} | [
"private",
"void",
"copyToOffset",
"(",
"int",
"offset",
")",
"{",
"final",
"int",
"minCapacity",
"=",
"2",
"*",
"(",
"offset",
"+",
"nbrruns",
")",
";",
"if",
"(",
"valueslength",
".",
"length",
"<",
"minCapacity",
")",
"{",
"// expensive case where we need... | Push all values length to the end of the array (resize array if needed) | [
"Push",
"all",
"values",
"length",
"to",
"the",
"end",
"of",
"the",
"array",
"(",
"resize",
"array",
"if",
"needed",
")"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RunContainer.java#L889-L906 |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/Catalogs.java | Catalogs.catalogOptions | private static CaseInsensitiveStringMap catalogOptions(String name, SQLConf conf) {
Map<String, String> allConfs = mapAsJavaMapConverter(conf.getAllConfs()).asJava();
Pattern prefix = Pattern.compile("^spark\\.sql\\.catalog\\." + name + "\\.(.+)");
HashMap<String, String> options = new HashMap<>();
for (Map.Entry<String, String> entry : allConfs.entrySet()) {
Matcher matcher = prefix.matcher(entry.getKey());
if (matcher.matches() && matcher.groupCount() > 0) {
options.put(matcher.group(1), entry.getValue());
}
}
return new CaseInsensitiveStringMap(options);
} | java | private static CaseInsensitiveStringMap catalogOptions(String name, SQLConf conf) {
Map<String, String> allConfs = mapAsJavaMapConverter(conf.getAllConfs()).asJava();
Pattern prefix = Pattern.compile("^spark\\.sql\\.catalog\\." + name + "\\.(.+)");
HashMap<String, String> options = new HashMap<>();
for (Map.Entry<String, String> entry : allConfs.entrySet()) {
Matcher matcher = prefix.matcher(entry.getKey());
if (matcher.matches() && matcher.groupCount() > 0) {
options.put(matcher.group(1), entry.getValue());
}
}
return new CaseInsensitiveStringMap(options);
} | [
"private",
"static",
"CaseInsensitiveStringMap",
"catalogOptions",
"(",
"String",
"name",
",",
"SQLConf",
"conf",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"allConfs",
"=",
"mapAsJavaMapConverter",
"(",
"conf",
".",
"getAllConfs",
"(",
")",
")",
".",... | Extracts a named catalog's configuration from a SQLConf.
@param name a catalog name
@param conf a SQLConf
@return a case insensitive string map of options starting with spark.sql.catalog.(name). | [
"Extracts",
"a",
"named",
"catalog",
"s",
"configuration",
"from",
"a",
"SQLConf",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/Catalogs.java#L98-L111 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.deleteProperty | public static boolean deleteProperty(Scriptable obj, int index)
{
Scriptable base = getBase(obj, index);
if (base == null)
return true;
base.delete(index);
return !base.has(index, obj);
} | java | public static boolean deleteProperty(Scriptable obj, int index)
{
Scriptable base = getBase(obj, index);
if (base == null)
return true;
base.delete(index);
return !base.has(index, obj);
} | [
"public",
"static",
"boolean",
"deleteProperty",
"(",
"Scriptable",
"obj",
",",
"int",
"index",
")",
"{",
"Scriptable",
"base",
"=",
"getBase",
"(",
"obj",
",",
"index",
")",
";",
"if",
"(",
"base",
"==",
"null",
")",
"return",
"true",
";",
"base",
"."... | Removes the property from an object or its prototype chain.
<p>
Searches for a property with <code>index</code> in obj or
its prototype chain. If it is found, the object's delete
method is called.
@param obj a JavaScript object
@param index a property index
@return true if the property doesn't exist or was successfully removed
@since 1.5R2 | [
"Removes",
"the",
"property",
"from",
"an",
"object",
"or",
"its",
"prototype",
"chain",
".",
"<p",
">",
"Searches",
"for",
"a",
"property",
"with",
"<code",
">",
"index<",
"/",
"code",
">",
"in",
"obj",
"or",
"its",
"prototype",
"chain",
".",
"If",
"i... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2599-L2606 |
alkacon/opencms-core | src/org/opencms/i18n/CmsLocaleGroupService.java | CmsLocaleGroupService.attachLocaleGroup | public void attachLocaleGroup(CmsResource secondaryPage, CmsResource primaryPage) throws CmsException {
if (secondaryPage.getStructureId().equals(primaryPage.getStructureId())) {
throw new IllegalArgumentException(
"A page can not be linked with itself as a locale variant: " + secondaryPage.getRootPath());
}
CmsLocaleGroup group = readLocaleGroup(secondaryPage);
if (group.isRealGroup()) {
throw new IllegalArgumentException(
"The page " + secondaryPage.getRootPath() + " is already part of a group. ");
}
// TODO: Check for redundant locales
CmsLocaleGroup targetGroup = readLocaleGroup(primaryPage);
CmsLockActionRecord record = CmsLockUtil.ensureLock(m_cms, secondaryPage);
try {
m_cms.deleteRelationsFromResource(
secondaryPage,
CmsRelationFilter.ALL.filterType(CmsRelationType.LOCALE_VARIANT));
m_cms.addRelationToResource(
secondaryPage,
targetGroup.getPrimaryResource(),
CmsRelationType.LOCALE_VARIANT.getName());
} finally {
if (record.getChange() == LockChange.locked) {
m_cms.unlockResource(secondaryPage);
}
}
} | java | public void attachLocaleGroup(CmsResource secondaryPage, CmsResource primaryPage) throws CmsException {
if (secondaryPage.getStructureId().equals(primaryPage.getStructureId())) {
throw new IllegalArgumentException(
"A page can not be linked with itself as a locale variant: " + secondaryPage.getRootPath());
}
CmsLocaleGroup group = readLocaleGroup(secondaryPage);
if (group.isRealGroup()) {
throw new IllegalArgumentException(
"The page " + secondaryPage.getRootPath() + " is already part of a group. ");
}
// TODO: Check for redundant locales
CmsLocaleGroup targetGroup = readLocaleGroup(primaryPage);
CmsLockActionRecord record = CmsLockUtil.ensureLock(m_cms, secondaryPage);
try {
m_cms.deleteRelationsFromResource(
secondaryPage,
CmsRelationFilter.ALL.filterType(CmsRelationType.LOCALE_VARIANT));
m_cms.addRelationToResource(
secondaryPage,
targetGroup.getPrimaryResource(),
CmsRelationType.LOCALE_VARIANT.getName());
} finally {
if (record.getChange() == LockChange.locked) {
m_cms.unlockResource(secondaryPage);
}
}
} | [
"public",
"void",
"attachLocaleGroup",
"(",
"CmsResource",
"secondaryPage",
",",
"CmsResource",
"primaryPage",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"secondaryPage",
".",
"getStructureId",
"(",
")",
".",
"equals",
"(",
"primaryPage",
".",
"getStructureId",
... | Adds a resource to a locale group.<p>
Note: This is a low level method that is hard to use correctly. Please use attachLocaleGroupIndirect if at all possible.
@param secondaryPage the page to add
@param primaryPage the primary resource of the locale group which the resource should be added to
@throws CmsException if something goes wrong | [
"Adds",
"a",
"resource",
"to",
"a",
"locale",
"group",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsLocaleGroupService.java#L177-L206 |
j256/ormlite-android | src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java | OrmLiteConfigUtil.writeConfigFile | public static void writeConfigFile(OutputStream outputStream, File searchDir) throws SQLException, IOException {
writeConfigFile(outputStream, searchDir, false);
} | java | public static void writeConfigFile(OutputStream outputStream, File searchDir) throws SQLException, IOException {
writeConfigFile(outputStream, searchDir, false);
} | [
"public",
"static",
"void",
"writeConfigFile",
"(",
"OutputStream",
"outputStream",
",",
"File",
"searchDir",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"writeConfigFile",
"(",
"outputStream",
",",
"searchDir",
",",
"false",
")",
";",
"}"
] | Write a configuration file to an output stream with the configuration for classes. | [
"Write",
"a",
"configuration",
"file",
"to",
"an",
"output",
"stream",
"with",
"the",
"configuration",
"for",
"classes",
"."
] | train | https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L205-L207 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java | MethodBuilder.buildDeprecationInfo | public void buildDeprecationInfo(XMLNode node, Content methodDocTree) {
writer.addDeprecated(
(MethodDoc) methods.get(currentMethodIndex), methodDocTree);
} | java | public void buildDeprecationInfo(XMLNode node, Content methodDocTree) {
writer.addDeprecated(
(MethodDoc) methods.get(currentMethodIndex), methodDocTree);
} | [
"public",
"void",
"buildDeprecationInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"methodDocTree",
")",
"{",
"writer",
".",
"addDeprecated",
"(",
"(",
"MethodDoc",
")",
"methods",
".",
"get",
"(",
"currentMethodIndex",
")",
",",
"methodDocTree",
")",
";",
"}"
... | Build the deprecation information.
@param node the XML element that specifies which components to document
@param methodDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"deprecation",
"information",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java#L194-L197 |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.stringJoinAndDecorate | String stringJoinAndDecorate(final List<String> list, final String sep, StringDecorator decorator) {
if (decorator == null) {
decorator = new NothingDecorator();
}
StringBuilder sb = new StringBuilder();
if (list != null) {
boolean first = true;
for (String argument : list) {
if (!first) {
sb.append(sep);
}
sb.append(decorator.decorate(argument));
first = false;
}
}
return sb.toString();
} | java | String stringJoinAndDecorate(final List<String> list, final String sep, StringDecorator decorator) {
if (decorator == null) {
decorator = new NothingDecorator();
}
StringBuilder sb = new StringBuilder();
if (list != null) {
boolean first = true;
for (String argument : list) {
if (!first) {
sb.append(sep);
}
sb.append(decorator.decorate(argument));
first = false;
}
}
return sb.toString();
} | [
"String",
"stringJoinAndDecorate",
"(",
"final",
"List",
"<",
"String",
">",
"list",
",",
"final",
"String",
"sep",
",",
"StringDecorator",
"decorator",
")",
"{",
"if",
"(",
"decorator",
"==",
"null",
")",
"{",
"decorator",
"=",
"new",
"NothingDecorator",
"(... | Join list and separate by sep, each elements is decorate by 'decorator'
@param list
@param decoration
@return | [
"Join",
"list",
"and",
"separate",
"by",
"sep",
"each",
"elements",
"is",
"decorate",
"by",
"decorator"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L256-L272 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.executeObject | @Override
public <T> T executeObject(String name, T object) throws CpoException {
return processExecuteGroup(name, object, object);
} | java | @Override
public <T> T executeObject(String name, T object) throws CpoException {
return processExecuteGroup(name, object, object);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"executeObject",
"(",
"String",
"name",
",",
"T",
"object",
")",
"throws",
"CpoException",
"{",
"return",
"processExecuteGroup",
"(",
"name",
",",
"object",
",",
"object",
")",
";",
"}"
] | Executes an Object whose metadata will call an executable within the datasource. It is assumed that the executable
object exists in the metadatasource. If the executable does not exist, an exception will be thrown.
<p/>
<pre>Example:
<code>
<p/>
class SomeObject so = new SomeObject();
class CpoAdapter cpo = null;
<p/>
try {
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{
cpo.executeObject("execNotifyProc",so);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The filter name which tells the datasource which objects should be returned. The name also signifies
what data in the object will be populated.
@param object 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. If the object does not exist in the datasource, an exception will be thrown.
This object is used to populate the IN arguments used to retrieve the collection of objects. This object defines
the object type that will be returned in the collection and contain the result set data or the OUT Parameters.
@return A result object populate with the OUT arguments
@throws CpoException if there are errors accessing the datasource | [
"Executes",
"an",
"Object",
"whose",
"metadata",
"will",
"call",
"an",
"executable",
"within",
"the",
"datasource",
".",
"It",
"is",
"assumed",
"that",
"the",
"executable",
"object",
"exists",
"in",
"the",
"metadatasource",
".",
"If",
"the",
"executable",
"doe... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L823-L826 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/types/XMLDatastreamProcessor.java | XMLDatastreamProcessor.setXMLContent | public void setXMLContent(byte[] xmlContent) {
if (m_dsType == DS_TYPE.INLINE_XML) {
((DatastreamXMLMetadata)m_ds).xmlContent = xmlContent;
((DatastreamXMLMetadata)m_ds).DSSize = (xmlContent != null) ? xmlContent.length : -1;
} else if (m_dsType == DS_TYPE.MANAGED) {
ByteArrayInputStream bais = new ByteArrayInputStream(xmlContent);
MIMETypedStream s = new MIMETypedStream("text/xml", bais, null,xmlContent.length);
try {
((DatastreamManagedContent)m_ds).putContentStream(s);
} catch (StreamIOException e) {
throw new RuntimeException("Unable to update managed datastream contents", e);
}
} else
// coding error if trying to use other datastream type
throw new RuntimeException("XML datastreams must be of type Managed or Inline");
} | java | public void setXMLContent(byte[] xmlContent) {
if (m_dsType == DS_TYPE.INLINE_XML) {
((DatastreamXMLMetadata)m_ds).xmlContent = xmlContent;
((DatastreamXMLMetadata)m_ds).DSSize = (xmlContent != null) ? xmlContent.length : -1;
} else if (m_dsType == DS_TYPE.MANAGED) {
ByteArrayInputStream bais = new ByteArrayInputStream(xmlContent);
MIMETypedStream s = new MIMETypedStream("text/xml", bais, null,xmlContent.length);
try {
((DatastreamManagedContent)m_ds).putContentStream(s);
} catch (StreamIOException e) {
throw new RuntimeException("Unable to update managed datastream contents", e);
}
} else
// coding error if trying to use other datastream type
throw new RuntimeException("XML datastreams must be of type Managed or Inline");
} | [
"public",
"void",
"setXMLContent",
"(",
"byte",
"[",
"]",
"xmlContent",
")",
"{",
"if",
"(",
"m_dsType",
"==",
"DS_TYPE",
".",
"INLINE_XML",
")",
"{",
"(",
"(",
"DatastreamXMLMetadata",
")",
"m_ds",
")",
".",
"xmlContent",
"=",
"xmlContent",
";",
"(",
"(... | Update the XML content of the datastream wrapped by this class
@param xmlContent | [
"Update",
"the",
"XML",
"content",
"of",
"the",
"datastream",
"wrapped",
"by",
"this",
"class"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/types/XMLDatastreamProcessor.java#L199-L214 |
google/closure-templates | java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java | PyExprUtils.maybeProtect | public static PyExpr maybeProtect(PyExpr expr, int minSafePrecedence) {
// all python operators are left associative, so if this has equivalent precedence we don't need
// to wrap
if (expr.getPrecedence() >= minSafePrecedence) {
return expr;
} else {
return new PyExpr("(" + expr.getText() + ")", Integer.MAX_VALUE);
}
} | java | public static PyExpr maybeProtect(PyExpr expr, int minSafePrecedence) {
// all python operators are left associative, so if this has equivalent precedence we don't need
// to wrap
if (expr.getPrecedence() >= minSafePrecedence) {
return expr;
} else {
return new PyExpr("(" + expr.getText() + ")", Integer.MAX_VALUE);
}
} | [
"public",
"static",
"PyExpr",
"maybeProtect",
"(",
"PyExpr",
"expr",
",",
"int",
"minSafePrecedence",
")",
"{",
"// all python operators are left associative, so if this has equivalent precedence we don't need",
"// to wrap",
"if",
"(",
"expr",
".",
"getPrecedence",
"(",
")",... | Wraps an expression with parenthesis if it's not above the minimum safe precedence.
<p>NOTE: For the sake of brevity, this implementation loses typing information in the
expressions.
@param expr The expression to wrap.
@param minSafePrecedence The minimum safe precedence (not inclusive).
@return The PyExpr potentially wrapped in parenthesis. | [
"Wraps",
"an",
"expression",
"with",
"parenthesis",
"if",
"it",
"s",
"not",
"above",
"the",
"minimum",
"safe",
"precedence",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java#L154-L162 |
tdunning/t-digest | core/src/main/java/com/tdunning/math/stats/AbstractTDigest.java | AbstractTDigest.weightedAverageSorted | private static double weightedAverageSorted(double x1, double w1, double x2, double w2) {
assert x1 <= x2;
final double x = (x1 * w1 + x2 * w2) / (w1 + w2);
return Math.max(x1, Math.min(x, x2));
} | java | private static double weightedAverageSorted(double x1, double w1, double x2, double w2) {
assert x1 <= x2;
final double x = (x1 * w1 + x2 * w2) / (w1 + w2);
return Math.max(x1, Math.min(x, x2));
} | [
"private",
"static",
"double",
"weightedAverageSorted",
"(",
"double",
"x1",
",",
"double",
"w1",
",",
"double",
"x2",
",",
"double",
"w2",
")",
"{",
"assert",
"x1",
"<=",
"x2",
";",
"final",
"double",
"x",
"=",
"(",
"x1",
"*",
"w1",
"+",
"x2",
"*",
... | Compute the weighted average between <code>x1</code> with a weight of
<code>w1</code> and <code>x2</code> with a weight of <code>w2</code>.
This expects <code>x1</code> to be less than or equal to <code>x2</code>
and is guaranteed to return a number between <code>x1</code> and
<code>x2</code>. | [
"Compute",
"the",
"weighted",
"average",
"between",
"<code",
">",
"x1<",
"/",
"code",
">",
"with",
"a",
"weight",
"of",
"<code",
">",
"w1<",
"/",
"code",
">",
"and",
"<code",
">",
"x2<",
"/",
"code",
">",
"with",
"a",
"weight",
"of",
"<code",
">",
... | train | https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AbstractTDigest.java#L50-L54 |
square/okhttp | okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java | Http2Stream.receiveHeaders | void receiveHeaders(Headers headers, boolean inFinished) {
assert (!Thread.holdsLock(Http2Stream.this));
boolean open;
synchronized (this) {
if (!hasResponseHeaders || !inFinished) {
hasResponseHeaders = true;
headersQueue.add(headers);
} else {
this.source.trailers = headers;
}
if (inFinished) {
this.source.finished = true;
}
open = isOpen();
notifyAll();
}
if (!open) {
connection.removeStream(id);
}
} | java | void receiveHeaders(Headers headers, boolean inFinished) {
assert (!Thread.holdsLock(Http2Stream.this));
boolean open;
synchronized (this) {
if (!hasResponseHeaders || !inFinished) {
hasResponseHeaders = true;
headersQueue.add(headers);
} else {
this.source.trailers = headers;
}
if (inFinished) {
this.source.finished = true;
}
open = isOpen();
notifyAll();
}
if (!open) {
connection.removeStream(id);
}
} | [
"void",
"receiveHeaders",
"(",
"Headers",
"headers",
",",
"boolean",
"inFinished",
")",
"{",
"assert",
"(",
"!",
"Thread",
".",
"holdsLock",
"(",
"Http2Stream",
".",
"this",
")",
")",
";",
"boolean",
"open",
";",
"synchronized",
"(",
"this",
")",
"{",
"i... | Accept headers from the network and store them until the client calls {@link #takeHeaders}, or
{@link FramingSource#read} them. | [
"Accept",
"headers",
"from",
"the",
"network",
"and",
"store",
"them",
"until",
"the",
"client",
"calls",
"{"
] | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java#L306-L325 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.randomBinary | public static BMatrixRMaj randomBinary(int numRow , int numCol , Random rand ) {
BMatrixRMaj mat = new BMatrixRMaj(numRow,numCol);
setRandomB(mat, rand);
return mat;
} | java | public static BMatrixRMaj randomBinary(int numRow , int numCol , Random rand ) {
BMatrixRMaj mat = new BMatrixRMaj(numRow,numCol);
setRandomB(mat, rand);
return mat;
} | [
"public",
"static",
"BMatrixRMaj",
"randomBinary",
"(",
"int",
"numRow",
",",
"int",
"numCol",
",",
"Random",
"rand",
")",
"{",
"BMatrixRMaj",
"mat",
"=",
"new",
"BMatrixRMaj",
"(",
"numRow",
",",
"numCol",
")",
";",
"setRandomB",
"(",
"mat",
",",
"rand",
... | Returns new boolean matrix with true or false values selected with equal probability.
@param numRow Number of rows in the new matrix.
@param numCol Number of columns in the new matrix.
@param rand Random number generator used to fill the matrix.
@return The randomly generated matrix. | [
"Returns",
"new",
"boolean",
"matrix",
"with",
"true",
"or",
"false",
"values",
"selected",
"with",
"equal",
"probability",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L284-L290 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/grid/DataRecord.java | DataRecord.setHandle | public void setHandle(Object bookmark, int iHandleType)
{
switch(iHandleType)
{
default:
case DBConstants.BOOKMARK_HANDLE:
m_bookmark = bookmark;
break;
case DBConstants.OBJECT_ID_HANDLE:
case DBConstants.FULL_OBJECT_HANDLE: // Closest match (exact match on multitables)
m_objectID = bookmark;
break;
case DBConstants.DATA_SOURCE_HANDLE:
m_dataSource = bookmark;
break;
case DBConstants.OBJECT_SOURCE_HANDLE:
m_objectSource = bookmark;
break;
}
} | java | public void setHandle(Object bookmark, int iHandleType)
{
switch(iHandleType)
{
default:
case DBConstants.BOOKMARK_HANDLE:
m_bookmark = bookmark;
break;
case DBConstants.OBJECT_ID_HANDLE:
case DBConstants.FULL_OBJECT_HANDLE: // Closest match (exact match on multitables)
m_objectID = bookmark;
break;
case DBConstants.DATA_SOURCE_HANDLE:
m_dataSource = bookmark;
break;
case DBConstants.OBJECT_SOURCE_HANDLE:
m_objectSource = bookmark;
break;
}
} | [
"public",
"void",
"setHandle",
"(",
"Object",
"bookmark",
",",
"int",
"iHandleType",
")",
"{",
"switch",
"(",
"iHandleType",
")",
"{",
"default",
":",
"case",
"DBConstants",
".",
"BOOKMARK_HANDLE",
":",
"m_bookmark",
"=",
"bookmark",
";",
"break",
";",
"case... | This method was created by a SmartGuide.
@param bookmark java.lang.Object The bookmark to set.
@param iHandleType The type of handle you want to retrieve. | [
"This",
"method",
"was",
"created",
"by",
"a",
"SmartGuide",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/DataRecord.java#L142-L161 |
groovy/groovy-core | src/main/groovy/ui/GroovyMain.java | GroovyMain.parseCommandLine | private static CommandLine parseCommandLine(Options options, String[] args) throws ParseException {
CommandLineParser parser = new GroovyInternalPosixParser();
return parser.parse(options, args, true);
} | java | private static CommandLine parseCommandLine(Options options, String[] args) throws ParseException {
CommandLineParser parser = new GroovyInternalPosixParser();
return parser.parse(options, args, true);
} | [
"private",
"static",
"CommandLine",
"parseCommandLine",
"(",
"Options",
"options",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"ParseException",
"{",
"CommandLineParser",
"parser",
"=",
"new",
"GroovyInternalPosixParser",
"(",
")",
";",
"return",
"parser",
"."... | Parse the command line.
@param options the options parser.
@param args the command line args.
@return parsed command line.
@throws ParseException if there was a problem. | [
"Parse",
"the",
"command",
"line",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/ui/GroovyMain.java#L167-L170 |
OpenTSDB/opentsdb | src/tsd/HttpJsonSerializer.java | HttpJsonSerializer.parseUidAssignV1 | public HashMap<String, List<String>> parseUidAssignV1() {
final String json = query.getContent();
if (json == null || json.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Missing message content",
"Supply valid JSON formatted data in the body of your request");
}
try {
return JSON.parseToObject(json, UID_ASSIGN);
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
}
} | java | public HashMap<String, List<String>> parseUidAssignV1() {
final String json = query.getContent();
if (json == null || json.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Missing message content",
"Supply valid JSON formatted data in the body of your request");
}
try {
return JSON.parseToObject(json, UID_ASSIGN);
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
}
} | [
"public",
"HashMap",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"parseUidAssignV1",
"(",
")",
"{",
"final",
"String",
"json",
"=",
"query",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"json",
"==",
"null",
"||",
"json",
".",
"isEmpty",
"("... | Parses a list of metrics, tagk and/or tagvs to assign UIDs to
@return as hash map of lists for the different types
@throws JSONException if parsing failed
@throws BadRequestException if the content was missing or parsing failed | [
"Parses",
"a",
"list",
"of",
"metrics",
"tagk",
"and",
"/",
"or",
"tagvs",
"to",
"assign",
"UIDs",
"to"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpJsonSerializer.java#L224-L236 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.