repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
hawkular/hawkular-bus | hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java | MessageProcessor.createMessage | protected Message createMessage(ConnectionContext context, BasicMessage basicMessage, Map<String, String> headers)
throws JMSException {
if (context == null) {
throw new IllegalArgumentException("The context is null");
}
if (basicMessage == null) {
throw new IllegalArgumentException("The message is null");
}
Session session = context.getSession();
if (session == null) {
throw new IllegalArgumentException("The context had a null session");
}
TextMessage msg = session.createTextMessage(basicMessage.toJSON());
setHeaders(basicMessage, headers, msg);
log.infof("Created text message [%s] with text [%s]", msg, msg.getText());
return msg;
} | java | protected Message createMessage(ConnectionContext context, BasicMessage basicMessage, Map<String, String> headers)
throws JMSException {
if (context == null) {
throw new IllegalArgumentException("The context is null");
}
if (basicMessage == null) {
throw new IllegalArgumentException("The message is null");
}
Session session = context.getSession();
if (session == null) {
throw new IllegalArgumentException("The context had a null session");
}
TextMessage msg = session.createTextMessage(basicMessage.toJSON());
setHeaders(basicMessage, headers, msg);
log.infof("Created text message [%s] with text [%s]", msg, msg.getText());
return msg;
} | [
"protected",
"Message",
"createMessage",
"(",
"ConnectionContext",
"context",
",",
"BasicMessage",
"basicMessage",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"thro... | Creates a text message that can be send via a producer that contains the given BasicMessage's JSON encoded data.
@param context the context whose session is used to create the message
@param basicMessage contains the data that will be JSON-encoded and encapsulated in the created message, with
optional headers included
@param headers headers for the Message that will override same-named headers in the basic message
@return the message that can be produced
@throws JMSException any error
@throws NullPointerException if the context is null or the context's session is null | [
"Creates",
"a",
"text",
"message",
"that",
"can",
"be",
"send",
"via",
"a",
"producer",
"that",
"contains",
"the",
"given",
"BasicMessage",
"s",
"JSON",
"encoded",
"data",
"."
] | train | https://github.com/hawkular/hawkular-bus/blob/28d6b58bec81a50f8344d39f309b6971271ae627/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L359-L379 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Mod.java | Mod.operate | public XObject operate(XObject left, XObject right)
throws javax.xml.transform.TransformerException
{
return new XNumber(left.num() % right.num());
} | java | public XObject operate(XObject left, XObject right)
throws javax.xml.transform.TransformerException
{
return new XNumber(left.num() % right.num());
} | [
"public",
"XObject",
"operate",
"(",
"XObject",
"left",
",",
"XObject",
"right",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"return",
"new",
"XNumber",
"(",
"left",
".",
"num",
"(",
")",
"%",
"right",
".",
"nu... | Apply the operation to two operands, and return the result.
@param left non-null reference to the evaluated left operand.
@param right non-null reference to the evaluated right operand.
@return non-null reference to the XObject that represents the result of the operation.
@throws javax.xml.transform.TransformerException | [
"Apply",
"the",
"operation",
"to",
"two",
"operands",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Mod.java#L45-L49 |
undertow-io/undertow | core/src/main/java/io/undertow/Handlers.java | Handlers.learningPushHandler | public static LearningPushHandler learningPushHandler(int maxEntries, int maxAge, HttpHandler next) {
return new LearningPushHandler(maxEntries, maxAge, next);
} | java | public static LearningPushHandler learningPushHandler(int maxEntries, int maxAge, HttpHandler next) {
return new LearningPushHandler(maxEntries, maxAge, next);
} | [
"public",
"static",
"LearningPushHandler",
"learningPushHandler",
"(",
"int",
"maxEntries",
",",
"int",
"maxAge",
",",
"HttpHandler",
"next",
")",
"{",
"return",
"new",
"LearningPushHandler",
"(",
"maxEntries",
",",
"maxAge",
",",
"next",
")",
";",
"}"
] | Creates a handler that automatically learns which resources to push based on the referer header
@param maxEntries The maximum number of entries to store
@param maxAge The maximum age of the entries
@param next The next handler
@return A caching push handler | [
"Creates",
"a",
"handler",
"that",
"automatically",
"learns",
"which",
"resources",
"to",
"push",
"based",
"on",
"the",
"referer",
"header"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/Handlers.java#L561-L563 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/op/OpNegateNumber.java | OpNegateNumber.toExprDouble | public static ExprDouble toExprDouble(Expression expr, Position start, Position end) {
if (expr instanceof Literal) {
Double d = ((Literal) expr).getDouble(null);
if (d != null) {
return expr.getFactory().createLitDouble(-d.doubleValue(), start, end);
}
}
return new OpNegateNumber(expr, start, end);
} | java | public static ExprDouble toExprDouble(Expression expr, Position start, Position end) {
if (expr instanceof Literal) {
Double d = ((Literal) expr).getDouble(null);
if (d != null) {
return expr.getFactory().createLitDouble(-d.doubleValue(), start, end);
}
}
return new OpNegateNumber(expr, start, end);
} | [
"public",
"static",
"ExprDouble",
"toExprDouble",
"(",
"Expression",
"expr",
",",
"Position",
"start",
",",
"Position",
"end",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"Literal",
")",
"{",
"Double",
"d",
"=",
"(",
"(",
"Literal",
")",
"expr",
")",
".",... | Create a String expression from a Expression
@param left
@param right
@return String expression
@throws TemplateException | [
"Create",
"a",
"String",
"expression",
"from",
"a",
"Expression"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/op/OpNegateNumber.java#L58-L66 |
kejunxia/AndroidMvc | library/android-mvc/src/main/java/com/shipdream/lib/android/mvc/MvcFragment.java | MvcFragment.onOrientationChanged | protected void onOrientationChanged(int lastOrientation, int currentOrientation) {
if (controller != null) {
controller.onOrientationChanged(
parseOrientation(lastOrientation),
parseOrientation(currentOrientation));
}
} | java | protected void onOrientationChanged(int lastOrientation, int currentOrientation) {
if (controller != null) {
controller.onOrientationChanged(
parseOrientation(lastOrientation),
parseOrientation(currentOrientation));
}
} | [
"protected",
"void",
"onOrientationChanged",
"(",
"int",
"lastOrientation",
",",
"int",
"currentOrientation",
")",
"{",
"if",
"(",
"controller",
"!=",
"null",
")",
"{",
"controller",
".",
"onOrientationChanged",
"(",
"parseOrientation",
"(",
"lastOrientation",
")",
... | Called after {@link #onViewReady(View, Bundle, Reason)} when orientation changed.
@param lastOrientation Orientation before rotation
@param currentOrientation Current orientation | [
"Called",
"after",
"{",
"@link",
"#onViewReady",
"(",
"View",
"Bundle",
"Reason",
")",
"}",
"when",
"orientation",
"changed",
"."
] | train | https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/android-mvc/src/main/java/com/shipdream/lib/android/mvc/MvcFragment.java#L407-L413 |
mapsforge/mapsforge | mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java | Deserializer.getLong | static long getLong(byte[] buffer, int offset) {
return (buffer[offset] & 0xffL) << 56 | (buffer[offset + 1] & 0xffL) << 48 | (buffer[offset + 2] & 0xffL) << 40
| (buffer[offset + 3] & 0xffL) << 32 | (buffer[offset + 4] & 0xffL) << 24
| (buffer[offset + 5] & 0xffL) << 16 | (buffer[offset + 6] & 0xffL) << 8 | (buffer[offset + 7] & 0xffL);
} | java | static long getLong(byte[] buffer, int offset) {
return (buffer[offset] & 0xffL) << 56 | (buffer[offset + 1] & 0xffL) << 48 | (buffer[offset + 2] & 0xffL) << 40
| (buffer[offset + 3] & 0xffL) << 32 | (buffer[offset + 4] & 0xffL) << 24
| (buffer[offset + 5] & 0xffL) << 16 | (buffer[offset + 6] & 0xffL) << 8 | (buffer[offset + 7] & 0xffL);
} | [
"static",
"long",
"getLong",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"buffer",
"[",
"offset",
"]",
"&",
"0xff",
"L",
")",
"<<",
"56",
"|",
"(",
"buffer",
"[",
"offset",
"+",
"1",
"]",
"&",
"0xff",
"L",
")... | Converts eight bytes of a byte array to a signed long.
<p/>
The byte order is big-endian.
@param buffer the byte array.
@param offset the offset in the array.
@return the long value. | [
"Converts",
"eight",
"bytes",
"of",
"a",
"byte",
"array",
"to",
"a",
"signed",
"long",
".",
"<p",
"/",
">",
"The",
"byte",
"order",
"is",
"big",
"-",
"endian",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java#L58-L62 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.getElementsByClass | public static List<Element> getElementsByClass(String className) {
return getElementsByClass(className, Tag.ALL, Document.get().getBody());
} | java | public static List<Element> getElementsByClass(String className) {
return getElementsByClass(className, Tag.ALL, Document.get().getBody());
} | [
"public",
"static",
"List",
"<",
"Element",
">",
"getElementsByClass",
"(",
"String",
"className",
")",
"{",
"return",
"getElementsByClass",
"(",
"className",
",",
"Tag",
".",
"ALL",
",",
"Document",
".",
"get",
"(",
")",
".",
"getBody",
"(",
")",
")",
"... | Returns all elements from the DOM with the given CSS class.<p>
@param className the class name to look for
@return the matching elements | [
"Returns",
"all",
"elements",
"from",
"the",
"DOM",
"with",
"the",
"given",
"CSS",
"class",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1331-L1334 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.createOrUpdateCertificateAsync | public Observable<AppServiceCertificateResourceInner> createOrUpdateCertificateAsync(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) {
return createOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).map(new Func1<ServiceResponse<AppServiceCertificateResourceInner>, AppServiceCertificateResourceInner>() {
@Override
public AppServiceCertificateResourceInner call(ServiceResponse<AppServiceCertificateResourceInner> response) {
return response.body();
}
});
} | java | public Observable<AppServiceCertificateResourceInner> createOrUpdateCertificateAsync(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) {
return createOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).map(new Func1<ServiceResponse<AppServiceCertificateResourceInner>, AppServiceCertificateResourceInner>() {
@Override
public AppServiceCertificateResourceInner call(ServiceResponse<AppServiceCertificateResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AppServiceCertificateResourceInner",
">",
"createOrUpdateCertificateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
",",
"String",
"name",
",",
"AppServiceCertificateResourceInner",
"keyVaultCertificate",
")",
"{"... | Creates or updates a certificate and associates with key vault secret.
Creates or updates a certificate and associates with key vault secret.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@param name Name of the certificate.
@param keyVaultCertificate Key vault certificate resource Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"certificate",
"and",
"associates",
"with",
"key",
"vault",
"secret",
".",
"Creates",
"or",
"updates",
"a",
"certificate",
"and",
"associates",
"with",
"key",
"vault",
"secret",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1220-L1227 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.findAll | public @NotNull <T> List<T> findAll(@NotNull RowMapper<T> rowMapper, @NotNull @SQL String sql, Object... args) {
return findAll(rowMapper, SqlQuery.query(sql, args));
} | java | public @NotNull <T> List<T> findAll(@NotNull RowMapper<T> rowMapper, @NotNull @SQL String sql, Object... args) {
return findAll(rowMapper, SqlQuery.query(sql, args));
} | [
"public",
"@",
"NotNull",
"<",
"T",
">",
"List",
"<",
"T",
">",
"findAll",
"(",
"@",
"NotNull",
"RowMapper",
"<",
"T",
">",
"rowMapper",
",",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"findAll",
... | Executes a query and processes each row of the result with given {@link RowMapper}
to produce a list of results. | [
"Executes",
"a",
"query",
"and",
"processes",
"each",
"row",
"of",
"the",
"result",
"with",
"given",
"{"
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L308-L310 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java | AbstractConversionTable.setTypeConversions | protected void setTypeConversions(List<Pair<String, String>> typeConversions, boolean notifyController) {
this.conversions.clear();
if (typeConversions != null) {
for (final Pair<String, String> entry : typeConversions) {
this.conversions.add(new ConversionMapping(entry.getKey(), entry.getValue()));
}
}
this.list.setInput(this.conversions);
refreshListUI();
if (notifyController) {
preferenceValueChanged();
}
} | java | protected void setTypeConversions(List<Pair<String, String>> typeConversions, boolean notifyController) {
this.conversions.clear();
if (typeConversions != null) {
for (final Pair<String, String> entry : typeConversions) {
this.conversions.add(new ConversionMapping(entry.getKey(), entry.getValue()));
}
}
this.list.setInput(this.conversions);
refreshListUI();
if (notifyController) {
preferenceValueChanged();
}
} | [
"protected",
"void",
"setTypeConversions",
"(",
"List",
"<",
"Pair",
"<",
"String",
",",
"String",
">",
">",
"typeConversions",
",",
"boolean",
"notifyController",
")",
"{",
"this",
".",
"conversions",
".",
"clear",
"(",
")",
";",
"if",
"(",
"typeConversions... | Sets the type conversions to be displayed in this block.
@param typeConversions the type conversions.
@param notifyController indicates if the controller should be notified. | [
"Sets",
"the",
"type",
"conversions",
"to",
"be",
"displayed",
"in",
"this",
"block",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L422-L434 |
apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.hasExplicitConstructor | public static boolean hasExplicitConstructor(AbstractASTTransformation xform, ClassNode cNode) {
List<ConstructorNode> declaredConstructors = cNode.getDeclaredConstructors();
for (ConstructorNode constructorNode : declaredConstructors) {
// allow constructors added by other transforms if flagged as Generated
if (hasAnnotation(constructorNode, GENERATED_TYPE)) {
continue;
}
if (xform != null) {
xform.addError("Error during " + xform.getAnnotationName() +
" processing. Explicit constructors not allowed for class: " +
cNode.getNameWithoutPackage(), constructorNode);
}
return true;
}
return false;
} | java | public static boolean hasExplicitConstructor(AbstractASTTransformation xform, ClassNode cNode) {
List<ConstructorNode> declaredConstructors = cNode.getDeclaredConstructors();
for (ConstructorNode constructorNode : declaredConstructors) {
// allow constructors added by other transforms if flagged as Generated
if (hasAnnotation(constructorNode, GENERATED_TYPE)) {
continue;
}
if (xform != null) {
xform.addError("Error during " + xform.getAnnotationName() +
" processing. Explicit constructors not allowed for class: " +
cNode.getNameWithoutPackage(), constructorNode);
}
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"hasExplicitConstructor",
"(",
"AbstractASTTransformation",
"xform",
",",
"ClassNode",
"cNode",
")",
"{",
"List",
"<",
"ConstructorNode",
">",
"declaredConstructors",
"=",
"cNode",
".",
"getDeclaredConstructors",
"(",
")",
";",
"for",
... | Determine if an explicit (non-generated) constructor is in the class.
@param xform if non null, add an error if an explicit constructor is found
@param cNode the type of the containing class
@return true if an explicit (non-generated) constructor was found | [
"Determine",
"if",
"an",
"explicit",
"(",
"non",
"-",
"generated",
")",
"constructor",
"is",
"in",
"the",
"class",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L360-L375 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/util/EditorUtil.java | EditorUtil.goToLine | public static void goToLine(IEditorPart editorPart, int lineNumber) {
if (!(editorPart instanceof ITextEditor) || lineNumber < DEFAULT_LINE_IN_EDITOR) {
return;
}
ITextEditor editor = (ITextEditor) editorPart;
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (document != null) {
IRegion lineInfo = null;
try {
// line count internaly starts with 0, and not with 1 like in
// GUI
lineInfo = document.getLineInformation(lineNumber - 1);
} catch (BadLocationException e) {
// ignored because line number may not really exist in document,
// we guess this...
}
if (lineInfo != null) {
editor.selectAndReveal(lineInfo.getOffset(), lineInfo.getLength());
}
}
} | java | public static void goToLine(IEditorPart editorPart, int lineNumber) {
if (!(editorPart instanceof ITextEditor) || lineNumber < DEFAULT_LINE_IN_EDITOR) {
return;
}
ITextEditor editor = (ITextEditor) editorPart;
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (document != null) {
IRegion lineInfo = null;
try {
// line count internaly starts with 0, and not with 1 like in
// GUI
lineInfo = document.getLineInformation(lineNumber - 1);
} catch (BadLocationException e) {
// ignored because line number may not really exist in document,
// we guess this...
}
if (lineInfo != null) {
editor.selectAndReveal(lineInfo.getOffset(), lineInfo.getLength());
}
}
} | [
"public",
"static",
"void",
"goToLine",
"(",
"IEditorPart",
"editorPart",
",",
"int",
"lineNumber",
")",
"{",
"if",
"(",
"!",
"(",
"editorPart",
"instanceof",
"ITextEditor",
")",
"||",
"lineNumber",
"<",
"DEFAULT_LINE_IN_EDITOR",
")",
"{",
"return",
";",
"}",
... | Selects and reveals the given line in given editor.
<p>
Must be executed from UI thread.
@param editorPart
@param lineNumber | [
"Selects",
"and",
"reveals",
"the",
"given",
"line",
"in",
"given",
"editor",
".",
"<p",
">",
"Must",
"be",
"executed",
"from",
"UI",
"thread",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/util/EditorUtil.java#L48-L68 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java | ProcessContextProperties.getDataUsage | private Map<String, Set<DataUsage>> getDataUsage(String dataUsageName) throws PropertyException {
String dataUsageString = props.getProperty(dataUsageName);
if (dataUsageString == null) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "No data usage with name \"" + dataUsageName + "\"");
}
Map<String, Set<DataUsage>> result = new HashMap<>();
int delimiterIndex = dataUsageString.indexOf(" ");
if (delimiterIndex == -1) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Invalid property value for data usage with name \"" + dataUsageName + "\"");
}
String attributeString = null;
String dataUsagesString = null;
try {
attributeString = dataUsageString.substring(0, delimiterIndex);
dataUsagesString = dataUsageString.substring(delimiterIndex + 1);
attributeString = attributeString.substring(1, attributeString.length() - 1);
} catch (Exception e) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Invalid property value for data usage with name \"" + dataUsageName + "\"", e);
}
Set<DataUsage> usageModes = new HashSet<>();
StringTokenizer usageModeTokens = StringUtils.splitArrayString(dataUsagesString, " ");
while (usageModeTokens.hasMoreTokens()) {
try {
usageModes.add(DataUsage.parse(usageModeTokens.nextToken()));
} catch (ParameterException e) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Invalid property value for data usage with name \"" + dataUsageName + "\"", e);
}
}
result.put(attributeString, usageModes);
return result;
} | java | private Map<String, Set<DataUsage>> getDataUsage(String dataUsageName) throws PropertyException {
String dataUsageString = props.getProperty(dataUsageName);
if (dataUsageString == null) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "No data usage with name \"" + dataUsageName + "\"");
}
Map<String, Set<DataUsage>> result = new HashMap<>();
int delimiterIndex = dataUsageString.indexOf(" ");
if (delimiterIndex == -1) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Invalid property value for data usage with name \"" + dataUsageName + "\"");
}
String attributeString = null;
String dataUsagesString = null;
try {
attributeString = dataUsageString.substring(0, delimiterIndex);
dataUsagesString = dataUsageString.substring(delimiterIndex + 1);
attributeString = attributeString.substring(1, attributeString.length() - 1);
} catch (Exception e) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Invalid property value for data usage with name \"" + dataUsageName + "\"", e);
}
Set<DataUsage> usageModes = new HashSet<>();
StringTokenizer usageModeTokens = StringUtils.splitArrayString(dataUsagesString, " ");
while (usageModeTokens.hasMoreTokens()) {
try {
usageModes.add(DataUsage.parse(usageModeTokens.nextToken()));
} catch (ParameterException e) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Invalid property value for data usage with name \"" + dataUsageName + "\"", e);
}
}
result.put(attributeString, usageModes);
return result;
} | [
"private",
"Map",
"<",
"String",
",",
"Set",
"<",
"DataUsage",
">",
">",
"getDataUsage",
"(",
"String",
"dataUsageName",
")",
"throws",
"PropertyException",
"{",
"String",
"dataUsageString",
"=",
"props",
".",
"getProperty",
"(",
"dataUsageName",
")",
";",
"if... | Extracts the data usage with the given name in form of a map containing
the attribute as key and the data usages as value.<br>
@param dataUsageName The property-name of the data usage (DATA_USAGE_X)
@return The map-representation of the data usage-property
@throws PropertyException if there is no constraint with the given name
or the value cannot be converted into a number- or string-constraint. | [
"Extracts",
"the",
"data",
"usage",
"with",
"the",
"given",
"name",
"in",
"form",
"of",
"a",
"map",
"containing",
"the",
"attribute",
"as",
"key",
"and",
"the",
"data",
"usages",
"as",
"value",
".",
"<br",
">"
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java#L123-L156 |
twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.getKeyStore | protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception {
KeyStore keystore = null;
if (storeStream != null || storePath != null) {
InputStream inStream = storeStream;
try {
if (inStream == null) {
inStream = new FileInputStream(storePath); //assume it's a file
}
if (storeProvider != null) {
keystore = KeyStore.getInstance(storeType, storeProvider);
} else {
keystore = KeyStore.getInstance(storeType);
}
keystore.load(inStream, storePassword == null ? null : storePassword.toCharArray());
} finally {
if (inStream != null) {
inStream.close();
}
}
}
return keystore;
} | java | protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception {
KeyStore keystore = null;
if (storeStream != null || storePath != null) {
InputStream inStream = storeStream;
try {
if (inStream == null) {
inStream = new FileInputStream(storePath); //assume it's a file
}
if (storeProvider != null) {
keystore = KeyStore.getInstance(storeType, storeProvider);
} else {
keystore = KeyStore.getInstance(storeType);
}
keystore.load(inStream, storePassword == null ? null : storePassword.toCharArray());
} finally {
if (inStream != null) {
inStream.close();
}
}
}
return keystore;
} | [
"protected",
"KeyStore",
"getKeyStore",
"(",
"InputStream",
"storeStream",
",",
"String",
"storePath",
",",
"String",
"storeType",
",",
"String",
"storeProvider",
",",
"String",
"storePassword",
")",
"throws",
"Exception",
"{",
"KeyStore",
"keystore",
"=",
"null",
... | Loads keystore using an input stream or a file path in the same
order of precedence.
Required for integrations to be able to override the mechanism
used to load a keystore in order to provide their own implementation.
@param storeStream keystore input stream
@param storePath path of keystore file
@param storeType keystore type
@param storeProvider keystore provider
@param storePassword keystore password
@return created keystore
@throws Exception if the keystore cannot be obtained | [
"Loads",
"keystore",
"using",
"an",
"input",
"stream",
"or",
"a",
"file",
"path",
"in",
"the",
"same",
"order",
"of",
"precedence",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L243-L264 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/IntStream.java | IntStream.takeUntil | @NotNull
public IntStream takeUntil(@NotNull final IntPredicate stopPredicate) {
return new IntStream(params, new IntTakeUntil(iterator, stopPredicate));
} | java | @NotNull
public IntStream takeUntil(@NotNull final IntPredicate stopPredicate) {
return new IntStream(params, new IntTakeUntil(iterator, stopPredicate));
} | [
"@",
"NotNull",
"public",
"IntStream",
"takeUntil",
"(",
"@",
"NotNull",
"final",
"IntPredicate",
"stopPredicate",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"IntTakeUntil",
"(",
"iterator",
",",
"stopPredicate",
")",
")",
";",
"}"
] | Takes elements while the predicate returns {@code false}.
Once predicate condition is satisfied by an element, the stream
finishes with this element.
<p>This is an intermediate operation.
<p>Example:
<pre>
stopPredicate: (a) -> a > 2
stream: [1, 2, 3, 4, 1, 2, 3, 4]
result: [1, 2, 3]
</pre>
@param stopPredicate the predicate used to take elements
@return the new {@code IntStream}
@since 1.1.6 | [
"Takes",
"elements",
"while",
"the",
"predicate",
"returns",
"{",
"@code",
"false",
"}",
".",
"Once",
"predicate",
"condition",
"is",
"satisfied",
"by",
"an",
"element",
"the",
"stream",
"finishes",
"with",
"this",
"element",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L778-L781 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java | AutomationAccountsInner.getByResourceGroup | public AutomationAccountInner getByResourceGroup(String resourceGroupName, String automationAccountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, automationAccountName).toBlocking().single().body();
} | java | public AutomationAccountInner getByResourceGroup(String resourceGroupName, String automationAccountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, automationAccountName).toBlocking().single().body();
} | [
"public",
"AutomationAccountInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
")",
".",
"toBlocking"... | Get information about an Automation Account.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@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 AutomationAccountInner object if successful. | [
"Get",
"information",
"about",
"an",
"Automation",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java#L383-L385 |
apache/fluo-recipes | modules/accumulo/src/main/java/org/apache/fluo/recipes/accumulo/export/AccumuloReplicator.java | AccumuloReplicator.generateMutations | public static void generateMutations(long seq, TxLog txLog, Consumer<Mutation> consumer) {
Map<Bytes, Mutation> mutationMap = new HashMap<>();
for (LogEntry le : txLog.getLogEntries()) {
LogEntry.Operation op = le.getOp();
Column col = le.getColumn();
byte[] cf = col.getFamily().toArray();
byte[] cq = col.getQualifier().toArray();
byte[] cv = col.getVisibility().toArray();
if (op.equals(LogEntry.Operation.DELETE) || op.equals(LogEntry.Operation.SET)) {
Mutation m = mutationMap.computeIfAbsent(le.getRow(), k -> new Mutation(k.toArray()));
if (op.equals(LogEntry.Operation.DELETE)) {
if (col.isVisibilitySet()) {
m.putDelete(cf, cq, new ColumnVisibility(cv), seq);
} else {
m.putDelete(cf, cq, seq);
}
} else {
if (col.isVisibilitySet()) {
m.put(cf, cq, new ColumnVisibility(cv), seq, le.getValue().toArray());
} else {
m.put(cf, cq, seq, le.getValue().toArray());
}
}
}
}
mutationMap.values().forEach(consumer);
} | java | public static void generateMutations(long seq, TxLog txLog, Consumer<Mutation> consumer) {
Map<Bytes, Mutation> mutationMap = new HashMap<>();
for (LogEntry le : txLog.getLogEntries()) {
LogEntry.Operation op = le.getOp();
Column col = le.getColumn();
byte[] cf = col.getFamily().toArray();
byte[] cq = col.getQualifier().toArray();
byte[] cv = col.getVisibility().toArray();
if (op.equals(LogEntry.Operation.DELETE) || op.equals(LogEntry.Operation.SET)) {
Mutation m = mutationMap.computeIfAbsent(le.getRow(), k -> new Mutation(k.toArray()));
if (op.equals(LogEntry.Operation.DELETE)) {
if (col.isVisibilitySet()) {
m.putDelete(cf, cq, new ColumnVisibility(cv), seq);
} else {
m.putDelete(cf, cq, seq);
}
} else {
if (col.isVisibilitySet()) {
m.put(cf, cq, new ColumnVisibility(cv), seq, le.getValue().toArray());
} else {
m.put(cf, cq, seq, le.getValue().toArray());
}
}
}
}
mutationMap.values().forEach(consumer);
} | [
"public",
"static",
"void",
"generateMutations",
"(",
"long",
"seq",
",",
"TxLog",
"txLog",
",",
"Consumer",
"<",
"Mutation",
">",
"consumer",
")",
"{",
"Map",
"<",
"Bytes",
",",
"Mutation",
">",
"mutationMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",... | Generates Accumulo mutations from a Transaction log. Used to Replicate Fluo table to Accumulo.
@param txLog Transaction log
@param seq Export sequence number
@param consumer generated mutations will be output to this consumer | [
"Generates",
"Accumulo",
"mutations",
"from",
"a",
"Transaction",
"log",
".",
"Used",
"to",
"Replicate",
"Fluo",
"table",
"to",
"Accumulo",
"."
] | train | https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/accumulo/src/main/java/org/apache/fluo/recipes/accumulo/export/AccumuloReplicator.java#L78-L104 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asType | @SuppressWarnings("unchecked")
public static <T> T asType(Map map, Class<T> clazz) {
if (!(clazz.isInstance(map)) && clazz.isInterface() && !Traits.isTrait(clazz)) {
return (T) Proxy.newProxyInstance(
clazz.getClassLoader(),
new Class[]{clazz},
new ConvertedMap(map));
}
try {
return asType((Object) map, clazz);
} catch (GroovyCastException ce) {
try {
return (T) ProxyGenerator.INSTANCE.instantiateAggregateFromBaseClass(map, clazz);
} catch (GroovyRuntimeException cause) {
throw new GroovyCastException("Error casting map to " + clazz.getName() +
", Reason: " + cause.getMessage());
}
}
} | java | @SuppressWarnings("unchecked")
public static <T> T asType(Map map, Class<T> clazz) {
if (!(clazz.isInstance(map)) && clazz.isInterface() && !Traits.isTrait(clazz)) {
return (T) Proxy.newProxyInstance(
clazz.getClassLoader(),
new Class[]{clazz},
new ConvertedMap(map));
}
try {
return asType((Object) map, clazz);
} catch (GroovyCastException ce) {
try {
return (T) ProxyGenerator.INSTANCE.instantiateAggregateFromBaseClass(map, clazz);
} catch (GroovyRuntimeException cause) {
throw new GroovyCastException("Error casting map to " + clazz.getName() +
", Reason: " + cause.getMessage());
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"asType",
"(",
"Map",
"map",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"!",
"(",
"clazz",
".",
"isInstance",
"(",
"map",
")",
")",
"&&",
... | Coerces this map to the given type, using the map's keys as the public
method names, and values as the implementation. Typically the value
would be a closure which behaves like the method implementation.
@param map this map
@param clazz the target type
@return a Proxy of the given type, which defers calls to this map's elements.
@since 1.0 | [
"Coerces",
"this",
"map",
"to",
"the",
"given",
"type",
"using",
"the",
"map",
"s",
"keys",
"as",
"the",
"public",
"method",
"names",
"and",
"values",
"as",
"the",
"implementation",
".",
"Typically",
"the",
"value",
"would",
"be",
"a",
"closure",
"which",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L11809-L11827 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_item_itemId_configuration_POST | public OvhConfigurationItem cart_cartId_item_itemId_configuration_POST(String cartId, Long itemId, String label, String value) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration";
StringBuilder sb = path(qPath, cartId, itemId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "label", label);
addBody(o, "value", value);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhConfigurationItem.class);
} | java | public OvhConfigurationItem cart_cartId_item_itemId_configuration_POST(String cartId, Long itemId, String label, String value) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration";
StringBuilder sb = path(qPath, cartId, itemId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "label", label);
addBody(o, "value", value);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhConfigurationItem.class);
} | [
"public",
"OvhConfigurationItem",
"cart_cartId_item_itemId_configuration_POST",
"(",
"String",
"cartId",
",",
"Long",
"itemId",
",",
"String",
"label",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/item/{itemId}... | Setup configuration item for the product
REST: POST /order/cart/{cartId}/item/{itemId}/configuration
@param cartId [required] Cart identifier
@param itemId [required] Product item identifier
@param label [required] Label for your configuration item
@param value [required] Value or resource URL on API.OVH.COM of your configuration item | [
"Setup",
"configuration",
"item",
"for",
"the",
"product"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8070-L8078 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java | VirtualNetworkTapsInner.getByResourceGroup | public VirtualNetworkTapInner getByResourceGroup(String resourceGroupName, String tapName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, tapName).toBlocking().single().body();
} | java | public VirtualNetworkTapInner getByResourceGroup(String resourceGroupName, String tapName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, tapName).toBlocking().single().body();
} | [
"public",
"VirtualNetworkTapInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"tapName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"tapName",
")",
".",
"toBlocking",
"(",
")",
".",
"si... | Gets information about the specified virtual network tap.
@param resourceGroupName The name of the resource group.
@param tapName The name of virtual network tap.
@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 VirtualNetworkTapInner object if successful. | [
"Gets",
"information",
"about",
"the",
"specified",
"virtual",
"network",
"tap",
"."
] | 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/VirtualNetworkTapsInner.java#L277-L279 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.addDateHeader | public void addDateHeader (@Nonnull @Nonempty final String sName, @Nonnull final LocalDateTime aLDT)
{
addDateHeader (sName, PDTFactory.createZonedDateTime (aLDT));
} | java | public void addDateHeader (@Nonnull @Nonempty final String sName, @Nonnull final LocalDateTime aLDT)
{
addDateHeader (sName, PDTFactory.createZonedDateTime (aLDT));
} | [
"public",
"void",
"addDateHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nonnull",
"final",
"LocalDateTime",
"aLDT",
")",
"{",
"addDateHeader",
"(",
"sName",
",",
"PDTFactory",
".",
"createZonedDateTime",
"(",
"aLDT",
")"... | Add the passed header as a date header.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param aLDT
The LocalDateTime to set as a date. May not be <code>null</code>. | [
"Add",
"the",
"passed",
"header",
"as",
"a",
"date",
"header",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L317-L320 |
KlausBrunner/solarpositioning | src/main/java/net/e175/klaus/solarpositioning/SPA.java | SPA.calculateSolarPosition | public static AzimuthZenithAngle calculateSolarPosition(final GregorianCalendar date, final double latitude,
final double longitude, final double elevation, final double deltaT) {
return calculateSolarPosition(date, latitude, longitude, elevation, deltaT, Double.MIN_VALUE, Double.MIN_VALUE);
} | java | public static AzimuthZenithAngle calculateSolarPosition(final GregorianCalendar date, final double latitude,
final double longitude, final double elevation, final double deltaT) {
return calculateSolarPosition(date, latitude, longitude, elevation, deltaT, Double.MIN_VALUE, Double.MIN_VALUE);
} | [
"public",
"static",
"AzimuthZenithAngle",
"calculateSolarPosition",
"(",
"final",
"GregorianCalendar",
"date",
",",
"final",
"double",
"latitude",
",",
"final",
"double",
"longitude",
",",
"final",
"double",
"elevation",
",",
"final",
"double",
"deltaT",
")",
"{",
... | Calculate topocentric solar position, i.e. the location of the sun on the sky for a certain point in time on a
certain point of the Earth's surface.
This follows the SPA algorithm described in Reda, I.; Andreas, A. (2003): Solar Position Algorithm for Solar
Radiation Applications. NREL Report No. TP-560-34302, Revised January 2008. The algorithm is supposed to work for
the years -2000 to 6000, with uncertainties of +/-0.0003 degrees.
This method does not perform refraction correction.
@param date Observer's local date and time.
@param latitude Observer's latitude, in degrees (negative south of equator).
@param longitude Observer's longitude, in degrees (negative west of Greenwich).
@param elevation Observer's elevation, in meters.
@param deltaT Difference between earth rotation time and terrestrial time (or Universal Time and Terrestrial Time),
in seconds. See
<a href ="http://asa.usno.navy.mil/SecK/DeltaT.html">http://asa.usno.navy.mil/SecK/DeltaT.html</a>.
For the year 2015, a reasonably accurate default would be 68.
@return Topocentric solar position (azimuth measured eastward from north)
@see AzimuthZenithAngle | [
"Calculate",
"topocentric",
"solar",
"position",
"i",
".",
"e",
".",
"the",
"location",
"of",
"the",
"sun",
"on",
"the",
"sky",
"for",
"a",
"certain",
"point",
"in",
"time",
"on",
"a",
"certain",
"point",
"of",
"the",
"Earth",
"s",
"surface",
"."
] | train | https://github.com/KlausBrunner/solarpositioning/blob/25db9b5e966ea325d88bb3b374103f104de256de/src/main/java/net/e175/klaus/solarpositioning/SPA.java#L150-L153 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java | IdentityPatchContext.getEntry | PatchEntry getEntry(final String name, boolean addOn) {
return addOn ? addOns.get(name) : layers.get(name);
} | java | PatchEntry getEntry(final String name, boolean addOn) {
return addOn ? addOns.get(name) : layers.get(name);
} | [
"PatchEntry",
"getEntry",
"(",
"final",
"String",
"name",
",",
"boolean",
"addOn",
")",
"{",
"return",
"addOn",
"?",
"addOns",
".",
"get",
"(",
"name",
")",
":",
"layers",
".",
"get",
"(",
"name",
")",
";",
"}"
] | Get a patch entry for either a layer or add-on.
@param name the layer name
@param addOn whether the target is an add-on
@return the patch entry, {@code null} if it there is no such layer | [
"Get",
"a",
"patch",
"entry",
"for",
"either",
"a",
"layer",
"or",
"add",
"-",
"on",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L135-L137 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/utils/MercatorUtils.java | MercatorUtils.getResolution | public static double getResolution( int zoom, int tileSize ) {
// return (2 * Math.PI * 6378137) / (this.tileSize * 2**zoom)
double initialResolution = 2 * Math.PI * 6378137 / tileSize;
return initialResolution / Math.pow(2, zoom);
} | java | public static double getResolution( int zoom, int tileSize ) {
// return (2 * Math.PI * 6378137) / (this.tileSize * 2**zoom)
double initialResolution = 2 * Math.PI * 6378137 / tileSize;
return initialResolution / Math.pow(2, zoom);
} | [
"public",
"static",
"double",
"getResolution",
"(",
"int",
"zoom",
",",
"int",
"tileSize",
")",
"{",
"// return (2 * Math.PI * 6378137) / (this.tileSize * 2**zoom)",
"double",
"initialResolution",
"=",
"2",
"*",
"Math",
".",
"PI",
"*",
"6378137",
"/",
"tileSize",
";... | Resolution (meters/pixel) for given zoom level (measured at Equator)
@param zoom zoomlevel.
@param tileSize tile size.
@return resolution. | [
"Resolution",
"(",
"meters",
"/",
"pixel",
")",
"for",
"given",
"zoom",
"level",
"(",
"measured",
"at",
"Equator",
")"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/utils/MercatorUtils.java#L284-L288 |
dspinellis/UMLGraph | src/main/java/org/umlgraph/doclet/UmlGraphDoc.java | UmlGraphDoc.generatePackageDiagrams | private static void generatePackageDiagrams(RootDoc root, Options opt, String outputFolder)
throws IOException {
Set<String> packages = new HashSet<String>();
for (ClassDoc classDoc : root.classes()) {
PackageDoc packageDoc = classDoc.containingPackage();
if(!packages.contains(packageDoc.name())) {
packages.add(packageDoc.name());
OptionProvider view = new PackageView(outputFolder, packageDoc, root, opt);
UmlGraph.buildGraph(root, view, packageDoc);
runGraphviz(opt.dotExecutable, outputFolder, packageDoc.name(), packageDoc.name(), root);
alterHtmlDocs(opt, outputFolder, packageDoc.name(), packageDoc.name(),
"package-summary.html", Pattern.compile("(</[Hh]2>)|(<h1 title=\"Package\").*"), root);
}
}
} | java | private static void generatePackageDiagrams(RootDoc root, Options opt, String outputFolder)
throws IOException {
Set<String> packages = new HashSet<String>();
for (ClassDoc classDoc : root.classes()) {
PackageDoc packageDoc = classDoc.containingPackage();
if(!packages.contains(packageDoc.name())) {
packages.add(packageDoc.name());
OptionProvider view = new PackageView(outputFolder, packageDoc, root, opt);
UmlGraph.buildGraph(root, view, packageDoc);
runGraphviz(opt.dotExecutable, outputFolder, packageDoc.name(), packageDoc.name(), root);
alterHtmlDocs(opt, outputFolder, packageDoc.name(), packageDoc.name(),
"package-summary.html", Pattern.compile("(</[Hh]2>)|(<h1 title=\"Package\").*"), root);
}
}
} | [
"private",
"static",
"void",
"generatePackageDiagrams",
"(",
"RootDoc",
"root",
",",
"Options",
"opt",
",",
"String",
"outputFolder",
")",
"throws",
"IOException",
"{",
"Set",
"<",
"String",
">",
"packages",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")... | Generates the package diagrams for all of the packages that contain classes among those
returned by RootDoc.class() | [
"Generates",
"the",
"package",
"diagrams",
"for",
"all",
"of",
"the",
"packages",
"that",
"contain",
"classes",
"among",
"those",
"returned",
"by",
"RootDoc",
".",
"class",
"()"
] | train | https://github.com/dspinellis/UMLGraph/blob/09576db5ae0ea63bfe30ef9fce88a513f9a8d843/src/main/java/org/umlgraph/doclet/UmlGraphDoc.java#L87-L101 |
openxc/openxc-android | library/src/main/java/com/openxc/VehicleManager.java | VehicleManager.addListener | public void addListener(MessageKey key, VehicleMessage.Listener listener) {
addListener(ExactKeyMatcher.buildExactMatcher(key), listener);
} | java | public void addListener(MessageKey key, VehicleMessage.Listener listener) {
addListener(ExactKeyMatcher.buildExactMatcher(key), listener);
} | [
"public",
"void",
"addListener",
"(",
"MessageKey",
"key",
",",
"VehicleMessage",
".",
"Listener",
"listener",
")",
"{",
"addListener",
"(",
"ExactKeyMatcher",
".",
"buildExactMatcher",
"(",
"key",
")",
",",
"listener",
")",
";",
"}"
] | Register to receive a callback when a message with the given key is
received.
@param key The key you want to receive updates.
@param listener An listener instance to receive the callback. | [
"Register",
"to",
"receive",
"a",
"callback",
"when",
"a",
"message",
"with",
"the",
"given",
"key",
"is",
"received",
"."
] | train | https://github.com/openxc/openxc-android/blob/799adbdcd107a72fe89737bbf19c039dc2881665/library/src/main/java/com/openxc/VehicleManager.java#L393-L395 |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/NBTIO.java | NBTIO.writeTag | public static void writeTag(OutputStream out, Tag tag, boolean littleEndian) throws IOException {
writeTag((DataOutput) (littleEndian ? new LittleEndianDataOutputStream(out) : new DataOutputStream(out)), tag);
} | java | public static void writeTag(OutputStream out, Tag tag, boolean littleEndian) throws IOException {
writeTag((DataOutput) (littleEndian ? new LittleEndianDataOutputStream(out) : new DataOutputStream(out)), tag);
} | [
"public",
"static",
"void",
"writeTag",
"(",
"OutputStream",
"out",
",",
"Tag",
"tag",
",",
"boolean",
"littleEndian",
")",
"throws",
"IOException",
"{",
"writeTag",
"(",
"(",
"DataOutput",
")",
"(",
"littleEndian",
"?",
"new",
"LittleEndianDataOutputStream",
"(... | Writes an NBT tag.
@param out Output stream to write to.
@param tag Tag to write.
@param littleEndian Whether to write little endian NBT.
@throws java.io.IOException If an I/O error occurs. | [
"Writes",
"an",
"NBT",
"tag",
"."
] | train | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/NBTIO.java#L216-L218 |
xwiki/xwiki-rendering | xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/InternalWikiScannerContext.java | InternalWikiScannerContext.onVerbatim | public void onVerbatim(String str, WikiParameters params)
{
checkBlockContainer();
fVerbatimContent = str;
fVerbatimParameters = params;
} | java | public void onVerbatim(String str, WikiParameters params)
{
checkBlockContainer();
fVerbatimContent = str;
fVerbatimParameters = params;
} | [
"public",
"void",
"onVerbatim",
"(",
"String",
"str",
",",
"WikiParameters",
"params",
")",
"{",
"checkBlockContainer",
"(",
")",
";",
"fVerbatimContent",
"=",
"str",
";",
"fVerbatimParameters",
"=",
"params",
";",
"}"
] | Waiting for following events to know if the verbatim is inline or not. | [
"Waiting",
"for",
"following",
"events",
"to",
"know",
"if",
"the",
"verbatim",
"is",
"inline",
"or",
"not",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/InternalWikiScannerContext.java#L1131-L1137 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitSync | public EventBus emitSync(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | java | public EventBus emitSync(Enum<?> event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | [
"public",
"EventBus",
"emitSync",
"(",
"Enum",
"<",
"?",
">",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextSync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit an enum event with parameters and force all listener to be called synchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(Enum, Object...) | [
"Emit",
"an",
"enum",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listener",
"to",
"be",
"called",
"synchronously",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1079-L1081 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java | ExpressRouteCircuitConnectionsInner.createOrUpdateAsync | public Observable<ExpressRouteCircuitConnectionInner> createOrUpdateAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() {
@Override
public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitConnectionInner> createOrUpdateAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() {
@Override
public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitConnectionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"peeringName",
",",
"String",
"connectionName",
",",
"ExpressRouteCircuitConnectionInner",
"expressR... | Creates or updates a Express Route Circuit Connection in the specified express route circuits.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param connectionName The name of the express route circuit connection.
@param expressRouteCircuitConnectionParameters Parameters supplied to the create or update express route circuit circuit connection operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"Express",
"Route",
"Circuit",
"Connection",
"in",
"the",
"specified",
"express",
"route",
"circuits",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java#L401-L408 |
groupon/robo-remote | RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java | Client.map | public JSONArray map(String query, String method_name, Object... items) throws Exception {
QueryBuilder builder = new QueryBuilder(API_PORT);
builder.map(query, method_name, items);
return builder.execute();
} | java | public JSONArray map(String query, String method_name, Object... items) throws Exception {
QueryBuilder builder = new QueryBuilder(API_PORT);
builder.map(query, method_name, items);
return builder.execute();
} | [
"public",
"JSONArray",
"map",
"(",
"String",
"query",
",",
"String",
"method_name",
",",
"Object",
"...",
"items",
")",
"throws",
"Exception",
"{",
"QueryBuilder",
"builder",
"=",
"new",
"QueryBuilder",
"(",
"API_PORT",
")",
";",
"builder",
".",
"map",
"(",
... | Used to call a method with a list of arguments
@param query
@param method_name
@param items
@return
@throws Exception | [
"Used",
"to",
"call",
"a",
"method",
"with",
"a",
"list",
"of",
"arguments"
] | train | https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java#L130-L134 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java | MeshGenerator.generateTangents | public static TFloatList generateTangents(TFloatList positions, TFloatList normals, TFloatList textures, TIntList indices) {
final TFloatList tangents = new TFloatArrayList();
generateTangents(positions, normals, textures, indices, tangents);
return tangents;
} | java | public static TFloatList generateTangents(TFloatList positions, TFloatList normals, TFloatList textures, TIntList indices) {
final TFloatList tangents = new TFloatArrayList();
generateTangents(positions, normals, textures, indices, tangents);
return tangents;
} | [
"public",
"static",
"TFloatList",
"generateTangents",
"(",
"TFloatList",
"positions",
",",
"TFloatList",
"normals",
",",
"TFloatList",
"textures",
",",
"TIntList",
"indices",
")",
"{",
"final",
"TFloatList",
"tangents",
"=",
"new",
"TFloatArrayList",
"(",
")",
";"... | Generate the tangents for the positions, normals and texture coords, according to the indices. This assumes that the positions and normals have 3 components, in the x, y, z order, and that the
texture coords have 2, in the u, v (or s, t) order. The tangents are stored as a 4 component vector, in the x, y, z, w order. The w component represents the handedness for the bi-tangent
computation, which must be computed with B = T_w * (N x T).
@param positions The position components
@param normals The normal components
@param textures The texture coord components
@param indices The indices
@return The tangents | [
"Generate",
"the",
"tangents",
"for",
"the",
"positions",
"normals",
"and",
"texture",
"coords",
"according",
"to",
"the",
"indices",
".",
"This",
"assumes",
"that",
"the",
"positions",
"and",
"normals",
"have",
"3",
"components",
"in",
"the",
"x",
"y",
"z",... | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L234-L238 |
MenoData/Time4J | base/src/main/java/net/time4j/clock/DaytimeClock.java | DaytimeClock.getDaytimeReply | private static String getDaytimeReply(
String address,
int port,
int timeout
) throws IOException {
IOException ioe = null;
Socket socket = null;
StringBuilder sb = null;
try {
socket = new Socket(address, port);
socket.setSoTimeout(timeout * 1000);
InputStream is = socket.getInputStream();
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
int len;
char[] chars = new char[100];
sb = new StringBuilder();
while ((len = br.read(chars)) != -1) {
sb.append(chars, 0, len);
}
is.close();
ir.close();
br.close();
} catch (IOException ex) {
ioe = ex;
} finally {
try {
if (socket != null) {
socket.close();
}
} catch (IOException ex) {
System.err.println(
"Ignored exception while closing time server socket: "
+ ex.getMessage()
);
ex.printStackTrace(System.err);
}
}
if (ioe == null) {
return sb.toString();
} else {
throw ioe;
}
} | java | private static String getDaytimeReply(
String address,
int port,
int timeout
) throws IOException {
IOException ioe = null;
Socket socket = null;
StringBuilder sb = null;
try {
socket = new Socket(address, port);
socket.setSoTimeout(timeout * 1000);
InputStream is = socket.getInputStream();
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
int len;
char[] chars = new char[100];
sb = new StringBuilder();
while ((len = br.read(chars)) != -1) {
sb.append(chars, 0, len);
}
is.close();
ir.close();
br.close();
} catch (IOException ex) {
ioe = ex;
} finally {
try {
if (socket != null) {
socket.close();
}
} catch (IOException ex) {
System.err.println(
"Ignored exception while closing time server socket: "
+ ex.getMessage()
);
ex.printStackTrace(System.err);
}
}
if (ioe == null) {
return sb.toString();
} else {
throw ioe;
}
} | [
"private",
"static",
"String",
"getDaytimeReply",
"(",
"String",
"address",
",",
"int",
"port",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"IOException",
"ioe",
"=",
"null",
";",
"Socket",
"socket",
"=",
"null",
";",
"StringBuilder",
"sb",
"="... | Original-Antwort eines älteren Uhrzeit-Servers holen (RFC 867) | [
"Original",
"-",
"Antwort",
"eines",
"älteren",
"Uhrzeit",
"-",
"Servers",
"holen",
"(",
"RFC",
"867",
")"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/clock/DaytimeClock.java#L212-L269 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.implies | public static Boolean implies(Boolean left, Boolean right) {
return !left || Boolean.TRUE.equals(right);
} | java | public static Boolean implies(Boolean left, Boolean right) {
return !left || Boolean.TRUE.equals(right);
} | [
"public",
"static",
"Boolean",
"implies",
"(",
"Boolean",
"left",
",",
"Boolean",
"right",
")",
"{",
"return",
"!",
"left",
"||",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"right",
")",
";",
"}"
] | Logical implication of two boolean operators
@param left left operator
@param right right operator
@return result of logical implication
@since 1.8.3 | [
"Logical",
"implication",
"of",
"two",
"boolean",
"operators"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16621-L16623 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/ResultUtil.java | ResultUtil.getSFTime | static public SFTime getSFTime(String obj, int scale, SFSession session)
throws SFException
{
try
{
return TimeUtil.getSFTime(obj, scale);
}
catch (IllegalArgumentException ex)
{
throw (SFException) IncidentUtil.generateIncidentV2WithException(
session,
new SFException(ErrorCode.INTERNAL_ERROR,
"Invalid time value: " + obj),
null,
null);
}
} | java | static public SFTime getSFTime(String obj, int scale, SFSession session)
throws SFException
{
try
{
return TimeUtil.getSFTime(obj, scale);
}
catch (IllegalArgumentException ex)
{
throw (SFException) IncidentUtil.generateIncidentV2WithException(
session,
new SFException(ErrorCode.INTERNAL_ERROR,
"Invalid time value: " + obj),
null,
null);
}
} | [
"static",
"public",
"SFTime",
"getSFTime",
"(",
"String",
"obj",
",",
"int",
"scale",
",",
"SFSession",
"session",
")",
"throws",
"SFException",
"{",
"try",
"{",
"return",
"TimeUtil",
".",
"getSFTime",
"(",
"obj",
",",
"scale",
")",
";",
"}",
"catch",
"(... | Convert a time internal value (scaled number of seconds + fractional
seconds) into an SFTime.
<p>
Example: getSFTime("123.456", 5) returns an SFTime for 00:02:03.45600.
@param obj time object
@param scale time scale
@param session session object
@return snowflake time object
@throws SFException if time is invalid | [
"Convert",
"a",
"time",
"internal",
"value",
"(",
"scaled",
"number",
"of",
"seconds",
"+",
"fractional",
"seconds",
")",
"into",
"an",
"SFTime",
".",
"<p",
">",
"Example",
":",
"getSFTime",
"(",
"123",
".",
"456",
"5",
")",
"returns",
"an",
"SFTime",
... | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/ResultUtil.java#L738-L754 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/ThemeUtil.java | ThemeUtil.getText | public static CharSequence getText(@NonNull final Context context,
@AttrRes final int resourceId) {
return getText(context, -1, resourceId);
} | java | public static CharSequence getText(@NonNull final Context context,
@AttrRes final int resourceId) {
return getText(context, -1, resourceId);
} | [
"public",
"static",
"CharSequence",
"getText",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"AttrRes",
"final",
"int",
"resourceId",
")",
"{",
"return",
"getText",
"(",
"context",
",",
"-",
"1",
",",
"resourceId",
")",
";",
"}"
] | Obtains the text, which corresponds to a specific resource id, from a context's theme. If the
given resource id is invalid, a {@link NotFoundException} will be thrown.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param resourceId
The resource id of the attribute, which should be obtained, as an {@link Integer}
value. The resource id must corresponds to a valid theme attribute
@return The text, which has been obtained, as an instance of the type {@link CharSequence} | [
"Obtains",
"the",
"text",
"which",
"corresponds",
"to",
"a",
"specific",
"resource",
"id",
"from",
"a",
"context",
"s",
"theme",
".",
"If",
"the",
"given",
"resource",
"id",
"is",
"invalid",
"a",
"{",
"@link",
"NotFoundException",
"}",
"will",
"be",
"throw... | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L257-L260 |
junit-team/junit4 | src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java | BlockJUnit4ClassRunner.possiblyExpectingExceptions | protected Statement possiblyExpectingExceptions(FrameworkMethod method,
Object test, Statement next) {
Test annotation = method.getAnnotation(Test.class);
Class<? extends Throwable> expectedExceptionClass = getExpectedException(annotation);
return expectedExceptionClass != null ? new ExpectException(next, expectedExceptionClass) : next;
} | java | protected Statement possiblyExpectingExceptions(FrameworkMethod method,
Object test, Statement next) {
Test annotation = method.getAnnotation(Test.class);
Class<? extends Throwable> expectedExceptionClass = getExpectedException(annotation);
return expectedExceptionClass != null ? new ExpectException(next, expectedExceptionClass) : next;
} | [
"protected",
"Statement",
"possiblyExpectingExceptions",
"(",
"FrameworkMethod",
"method",
",",
"Object",
"test",
",",
"Statement",
"next",
")",
"{",
"Test",
"annotation",
"=",
"method",
".",
"getAnnotation",
"(",
"Test",
".",
"class",
")",
";",
"Class",
"<",
... | Returns a {@link Statement}: if {@code method}'s {@code @Test} annotation
has the {@link Test#expected()} attribute, return normally only if {@code next}
throws an exception of the correct type, and throw an exception
otherwise. | [
"Returns",
"a",
"{"
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java#L343-L348 |
UrielCh/ovh-java-sdk | ovh-java-sdk-veeamCloudConnect/src/main/java/net/minidev/ovh/api/ApiOvhVeeamCloudConnect.java | ApiOvhVeeamCloudConnect.serviceName_backupRepository_inventoryName_GET | public OvhBackupRepository serviceName_backupRepository_inventoryName_GET(String serviceName, String inventoryName) throws IOException {
String qPath = "/veeamCloudConnect/{serviceName}/backupRepository/{inventoryName}";
StringBuilder sb = path(qPath, serviceName, inventoryName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackupRepository.class);
} | java | public OvhBackupRepository serviceName_backupRepository_inventoryName_GET(String serviceName, String inventoryName) throws IOException {
String qPath = "/veeamCloudConnect/{serviceName}/backupRepository/{inventoryName}";
StringBuilder sb = path(qPath, serviceName, inventoryName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackupRepository.class);
} | [
"public",
"OvhBackupRepository",
"serviceName_backupRepository_inventoryName_GET",
"(",
"String",
"serviceName",
",",
"String",
"inventoryName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/veeamCloudConnect/{serviceName}/backupRepository/{inventoryName}\"",
";",
... | Get this object properties
REST: GET /veeamCloudConnect/{serviceName}/backupRepository/{inventoryName}
@param serviceName [required] Domain of the service
@param inventoryName [required] The inventory name of your backup repository | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-veeamCloudConnect/src/main/java/net/minidev/ovh/api/ApiOvhVeeamCloudConnect.java#L87-L92 |
h2oai/h2o-3 | h2o-core/src/main/java/water/H2ONode.java | H2ONode.sendMessage | public final void sendMessage(ByteBuffer bb, byte msg_priority) {
UDP_TCP_SendThread sendThread = _sendThread;
if (sendThread == null) {
// Sending threads are created lazily.
// This is because we will intern all client nodes including the ones that have nothing to do with the cluster.
// By delaying the initialization to the point when we actually want to send a message, we initialize the sending
// thread just for the nodes that are really part of the cluster.
// The other reason is client disconnect - when removing client we kill the reference to the sending thread, if we
// still do need to communicate with the client later - we just recreate the thread.
if (_removed_from_cloud) {
Log.warn("Node " + this + " is not active in the cloud anymore but we want to communicate with it." +
"Re-opening the communication channel.");
}
sendThread = startSendThread();
}
assert sendThread != null;
sendThread.sendMessage(bb, msg_priority);
} | java | public final void sendMessage(ByteBuffer bb, byte msg_priority) {
UDP_TCP_SendThread sendThread = _sendThread;
if (sendThread == null) {
// Sending threads are created lazily.
// This is because we will intern all client nodes including the ones that have nothing to do with the cluster.
// By delaying the initialization to the point when we actually want to send a message, we initialize the sending
// thread just for the nodes that are really part of the cluster.
// The other reason is client disconnect - when removing client we kill the reference to the sending thread, if we
// still do need to communicate with the client later - we just recreate the thread.
if (_removed_from_cloud) {
Log.warn("Node " + this + " is not active in the cloud anymore but we want to communicate with it." +
"Re-opening the communication channel.");
}
sendThread = startSendThread();
}
assert sendThread != null;
sendThread.sendMessage(bb, msg_priority);
} | [
"public",
"final",
"void",
"sendMessage",
"(",
"ByteBuffer",
"bb",
",",
"byte",
"msg_priority",
")",
"{",
"UDP_TCP_SendThread",
"sendThread",
"=",
"_sendThread",
";",
"if",
"(",
"sendThread",
"==",
"null",
")",
"{",
"// Sending threads are created lazily.",
"// This... | null if Node was removed from cloud or we didn't need to communicate with it yet | [
"null",
"if",
"Node",
"was",
"removed",
"from",
"cloud",
"or",
"we",
"didn",
"t",
"need",
"to",
"communicate",
"with",
"it",
"yet"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/H2ONode.java#L417-L434 |
httl/httl | httl/src/main/java/httl/spi/engines/DefaultEngine.java | DefaultEngine.getResource | public Resource getResource(String name, Locale locale, String encoding) throws IOException {
name = UrlUtils.cleanName(name);
locale = cleanLocale(locale);
return loadResource(name, locale, encoding);
} | java | public Resource getResource(String name, Locale locale, String encoding) throws IOException {
name = UrlUtils.cleanName(name);
locale = cleanLocale(locale);
return loadResource(name, locale, encoding);
} | [
"public",
"Resource",
"getResource",
"(",
"String",
"name",
",",
"Locale",
"locale",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"name",
"=",
"UrlUtils",
".",
"cleanName",
"(",
"name",
")",
";",
"locale",
"=",
"cleanLocale",
"(",
"locale",
... | Get resource.
@param name - resource name
@param locale - resource locale
@param encoding - resource encoding
@return resource instance
@throws IOException - If an I/O error occurs
@see #getEngine() | [
"Get",
"resource",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/engines/DefaultEngine.java#L300-L304 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/internal/util/RegularExpressionConverter.java | RegularExpressionConverter.convertPerlRegexToPattern | public static Pattern convertPerlRegexToPattern(@Nonnull final String regex, @Nonnull final boolean faultTolerant) {
Check.notNull(regex, "regex");
String pattern = regex.trim();
final Matcher matcher = faultTolerant ? PERL_STYLE_TOLERANT.matcher(pattern) : PERL_STYLE.matcher(pattern);
if (!matcher.matches()) {
throw new IllegalArgumentException("The given regular expression '" + pattern
+ "' seems to be not in PERL style or has unsupported modifiers.");
}
pattern = pattern.substring(1);
final int lastIndex = pattern.lastIndexOf('/');
pattern = pattern.substring(0, lastIndex);
final int flags = Flag.convertToBitmask(Flag.parse(matcher.group(1)));
return Pattern.compile(pattern, flags);
} | java | public static Pattern convertPerlRegexToPattern(@Nonnull final String regex, @Nonnull final boolean faultTolerant) {
Check.notNull(regex, "regex");
String pattern = regex.trim();
final Matcher matcher = faultTolerant ? PERL_STYLE_TOLERANT.matcher(pattern) : PERL_STYLE.matcher(pattern);
if (!matcher.matches()) {
throw new IllegalArgumentException("The given regular expression '" + pattern
+ "' seems to be not in PERL style or has unsupported modifiers.");
}
pattern = pattern.substring(1);
final int lastIndex = pattern.lastIndexOf('/');
pattern = pattern.substring(0, lastIndex);
final int flags = Flag.convertToBitmask(Flag.parse(matcher.group(1)));
return Pattern.compile(pattern, flags);
} | [
"public",
"static",
"Pattern",
"convertPerlRegexToPattern",
"(",
"@",
"Nonnull",
"final",
"String",
"regex",
",",
"@",
"Nonnull",
"final",
"boolean",
"faultTolerant",
")",
"{",
"Check",
".",
"notNull",
"(",
"regex",
",",
"\"regex\"",
")",
";",
"String",
"patte... | Converts a PERL style regular expression into Java style.<br>
<br>
The leading and ending slash and the modifiers will be removed.
@param regex
A PERL style regular expression
@param faultTolerant
Fault-tolerant translating the flags
@return Pattern | [
"Converts",
"a",
"PERL",
"style",
"regular",
"expression",
"into",
"Java",
"style",
".",
"<br",
">",
"<br",
">",
"The",
"leading",
"and",
"ending",
"slash",
"and",
"the",
"modifiers",
"will",
"be",
"removed",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/internal/util/RegularExpressionConverter.java#L300-L316 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/client/impl/protocol/task/dynamicconfig/AbstractAddConfigMessageTask.java | AbstractAddConfigMessageTask.mergePolicyConfig | protected MergePolicyConfig mergePolicyConfig(boolean mergePolicyExist, String mergePolicy, int batchSize) {
if (mergePolicyExist) {
MergePolicyConfig config = new MergePolicyConfig(mergePolicy, batchSize);
return config;
}
return new MergePolicyConfig();
} | java | protected MergePolicyConfig mergePolicyConfig(boolean mergePolicyExist, String mergePolicy, int batchSize) {
if (mergePolicyExist) {
MergePolicyConfig config = new MergePolicyConfig(mergePolicy, batchSize);
return config;
}
return new MergePolicyConfig();
} | [
"protected",
"MergePolicyConfig",
"mergePolicyConfig",
"(",
"boolean",
"mergePolicyExist",
",",
"String",
"mergePolicy",
",",
"int",
"batchSize",
")",
"{",
"if",
"(",
"mergePolicyExist",
")",
"{",
"MergePolicyConfig",
"config",
"=",
"new",
"MergePolicyConfig",
"(",
... | returns a MergePolicyConfig based on given parameters if these exist, or the default MergePolicyConfig | [
"returns",
"a",
"MergePolicyConfig",
"based",
"on",
"given",
"parameters",
"if",
"these",
"exist",
"or",
"the",
"default",
"MergePolicyConfig"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/client/impl/protocol/task/dynamicconfig/AbstractAddConfigMessageTask.java#L88-L94 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/util/ImageArchiveUtil.java | ImageArchiveUtil.findEntryByRepoTag | public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest) {
if(repoTag == null || manifest == null) {
return null;
}
for(ImageArchiveManifestEntry entry : manifest.getEntries()) {
for(String entryRepoTag : entry.getRepoTags()) {
if(repoTag.equals(entryRepoTag)) {
return entry;
}
}
}
return null;
} | java | public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest) {
if(repoTag == null || manifest == null) {
return null;
}
for(ImageArchiveManifestEntry entry : manifest.getEntries()) {
for(String entryRepoTag : entry.getRepoTags()) {
if(repoTag.equals(entryRepoTag)) {
return entry;
}
}
}
return null;
} | [
"public",
"static",
"ImageArchiveManifestEntry",
"findEntryByRepoTag",
"(",
"String",
"repoTag",
",",
"ImageArchiveManifest",
"manifest",
")",
"{",
"if",
"(",
"repoTag",
"==",
"null",
"||",
"manifest",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
... | Search the manifest for an entry that has the repository and tag provided.
@param repoTag the repository and tag to search (e.g. busybox:latest).
@param manifest the manifest to be searched
@return the entry found, or null if no match. | [
"Search",
"the",
"manifest",
"for",
"an",
"entry",
"that",
"has",
"the",
"repository",
"and",
"tag",
"provided",
"."
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/ImageArchiveUtil.java#L124-L138 |
prometheus/client_java | simpleclient/src/main/java/io/prometheus/client/CollectorRegistry.java | CollectorRegistry.getSampleValue | public Double getSampleValue(String name, String[] labelNames, String[] labelValues) {
for (Collector.MetricFamilySamples metricFamilySamples : Collections.list(metricFamilySamples())) {
for (Collector.MetricFamilySamples.Sample sample : metricFamilySamples.samples) {
if (sample.name.equals(name)
&& Arrays.equals(sample.labelNames.toArray(), labelNames)
&& Arrays.equals(sample.labelValues.toArray(), labelValues)) {
return sample.value;
}
}
}
return null;
} | java | public Double getSampleValue(String name, String[] labelNames, String[] labelValues) {
for (Collector.MetricFamilySamples metricFamilySamples : Collections.list(metricFamilySamples())) {
for (Collector.MetricFamilySamples.Sample sample : metricFamilySamples.samples) {
if (sample.name.equals(name)
&& Arrays.equals(sample.labelNames.toArray(), labelNames)
&& Arrays.equals(sample.labelValues.toArray(), labelValues)) {
return sample.value;
}
}
}
return null;
} | [
"public",
"Double",
"getSampleValue",
"(",
"String",
"name",
",",
"String",
"[",
"]",
"labelNames",
",",
"String",
"[",
"]",
"labelValues",
")",
"{",
"for",
"(",
"Collector",
".",
"MetricFamilySamples",
"metricFamilySamples",
":",
"Collections",
".",
"list",
"... | Returns the given value, or null if it doesn't exist.
<p>
This is inefficient, and intended only for use in unittests. | [
"Returns",
"the",
"given",
"value",
"or",
"null",
"if",
"it",
"doesn",
"t",
"exist",
".",
"<p",
">",
"This",
"is",
"inefficient",
"and",
"intended",
"only",
"for",
"use",
"in",
"unittests",
"."
] | train | https://github.com/prometheus/client_java/blob/4e0e7527b048f1ffd0382dcb74c0b9dab23b4d9f/simpleclient/src/main/java/io/prometheus/client/CollectorRegistry.java#L246-L257 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/export/CmsEntityWrapper.java | CmsEntityWrapper.setAttributeValueEntity | public void setAttributeValueEntity(String attributeName, CmsEntityWrapper value) {
m_entity.setAttributeValue(attributeName, value.getEntity());
} | java | public void setAttributeValueEntity(String attributeName, CmsEntityWrapper value) {
m_entity.setAttributeValue(attributeName, value.getEntity());
} | [
"public",
"void",
"setAttributeValueEntity",
"(",
"String",
"attributeName",
",",
"CmsEntityWrapper",
"value",
")",
"{",
"m_entity",
".",
"setAttributeValue",
"(",
"attributeName",
",",
"value",
".",
"getEntity",
"(",
")",
")",
";",
"}"
] | Wrapper method.<p>
@param attributeName parameter for the wrapped method
@param value parameter for the wrapped method | [
"Wrapper",
"method",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/export/CmsEntityWrapper.java#L208-L211 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newEntity | public Entity newEntity(List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.ENTITY);
Entity newEntity = new Entity(newId, references);
annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY);
return newEntity;
} | java | public Entity newEntity(List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.ENTITY);
Entity newEntity = new Entity(newId, references);
annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY);
return newEntity;
} | [
"public",
"Entity",
"newEntity",
"(",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"ENTITY",
")",
";",
"Entity",
"newEntity",
"=",
"new",
"Entity",
... | Creates a new Entity. It assigns an appropriate ID to it. The entity is added to the document object.
@param type entity type. 8 values are posible: Person, Organization, Location, Date, Time, Money, Percent, Misc.
@param references it contains one or more span elements. A span can be used to reference the different occurrences of the same named entity in the document. If the entity is composed by multiple words, multiple target elements are used.
@return a new named entity. | [
"Creates",
"a",
"new",
"Entity",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"entity",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L744-L749 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.and | public static Boolean and(Boolean left, Boolean right) {
return left && Boolean.TRUE.equals(right);
} | java | public static Boolean and(Boolean left, Boolean right) {
return left && Boolean.TRUE.equals(right);
} | [
"public",
"static",
"Boolean",
"and",
"(",
"Boolean",
"left",
",",
"Boolean",
"right",
")",
"{",
"return",
"left",
"&&",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"right",
")",
";",
"}"
] | Logical conjunction of two boolean operators.
@param left left operator
@param right right operator
@return result of logical conjunction
@since 1.0 | [
"Logical",
"conjunction",
"of",
"two",
"boolean",
"operators",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16597-L16599 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java | ServerUpdater.setVoiceChannel | public ServerUpdater setVoiceChannel(User user, ServerVoiceChannel channel) {
delegate.setVoiceChannel(user, channel);
return this;
} | java | public ServerUpdater setVoiceChannel(User user, ServerVoiceChannel channel) {
delegate.setVoiceChannel(user, channel);
return this;
} | [
"public",
"ServerUpdater",
"setVoiceChannel",
"(",
"User",
"user",
",",
"ServerVoiceChannel",
"channel",
")",
"{",
"delegate",
".",
"setVoiceChannel",
"(",
"user",
",",
"channel",
")",
";",
"return",
"this",
";",
"}"
] | Queues a moving a user to a different voice channel.
@param user The user who should be moved.
@param channel The new voice channel of the user.
@return The current instance in order to chain call methods. | [
"Queues",
"a",
"moving",
"a",
"user",
"to",
"a",
"different",
"voice",
"channel",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L444-L447 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java | ResponseHandler.handleRedirectResponse | protected void handleRedirectResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders().add(entry.getKey().toHttpString(), entry.getValue()));
exchange.getResponseHeaders().put(Header.LOCATION.toHttpString(), response.getRedirectTo());
response.getHeaders().forEach((key, value) -> exchange.getResponseHeaders().add(key, value));
exchange.endExchange();
} | java | protected void handleRedirectResponse(HttpServerExchange exchange, Response response) {
exchange.setStatusCode(StatusCodes.FOUND);
Server.headers()
.entrySet()
.stream()
.filter(entry -> StringUtils.isNotBlank(entry.getValue()))
.forEach(entry -> exchange.getResponseHeaders().add(entry.getKey().toHttpString(), entry.getValue()));
exchange.getResponseHeaders().put(Header.LOCATION.toHttpString(), response.getRedirectTo());
response.getHeaders().forEach((key, value) -> exchange.getResponseHeaders().add(key, value));
exchange.endExchange();
} | [
"protected",
"void",
"handleRedirectResponse",
"(",
"HttpServerExchange",
"exchange",
",",
"Response",
"response",
")",
"{",
"exchange",
".",
"setStatusCode",
"(",
"StatusCodes",
".",
"FOUND",
")",
";",
"Server",
".",
"headers",
"(",
")",
".",
"entrySet",
"(",
... | Handles a redirect response to the client by sending a 403 status code to the client
@param exchange The Undertow HttpServerExchange
@param response The response object | [
"Handles",
"a",
"redirect",
"response",
"to",
"the",
"client",
"by",
"sending",
"a",
"403",
"status",
"code",
"to",
"the",
"client"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/ResponseHandler.java#L63-L75 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java | RelatedTablesCoreExtension.getRelations | public List<ExtendedRelation> getRelations(String baseTable,
String relatedTable) throws SQLException {
return getRelations(baseTable, null, relatedTable, null, null, null);
} | java | public List<ExtendedRelation> getRelations(String baseTable,
String relatedTable) throws SQLException {
return getRelations(baseTable, null, relatedTable, null, null, null);
} | [
"public",
"List",
"<",
"ExtendedRelation",
">",
"getRelations",
"(",
"String",
"baseTable",
",",
"String",
"relatedTable",
")",
"throws",
"SQLException",
"{",
"return",
"getRelations",
"(",
"baseTable",
",",
"null",
",",
"relatedTable",
",",
"null",
",",
"null",... | Get the relations to the base table and related table
@param baseTable
base table name
@param relatedTable
related table name
@return extended relations
@throws SQLException
upon failure
@since 3.2.0 | [
"Get",
"the",
"relations",
"to",
"the",
"base",
"table",
"and",
"related",
"table"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java#L1079-L1082 |
apache/incubator-shardingsphere | sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ShardingRouterFactory.java | ShardingRouterFactory.newInstance | public static ShardingRouter newInstance(final ShardingRule shardingRule, final ShardingMetaData shardingMetaData, final DatabaseType databaseType, final ParsingResultCache parsingResultCache) {
return HintManager.isDatabaseShardingOnly()
? new DatabaseHintSQLRouter(shardingRule) : new ParsingSQLRouter(shardingRule, shardingMetaData, databaseType, parsingResultCache);
} | java | public static ShardingRouter newInstance(final ShardingRule shardingRule, final ShardingMetaData shardingMetaData, final DatabaseType databaseType, final ParsingResultCache parsingResultCache) {
return HintManager.isDatabaseShardingOnly()
? new DatabaseHintSQLRouter(shardingRule) : new ParsingSQLRouter(shardingRule, shardingMetaData, databaseType, parsingResultCache);
} | [
"public",
"static",
"ShardingRouter",
"newInstance",
"(",
"final",
"ShardingRule",
"shardingRule",
",",
"final",
"ShardingMetaData",
"shardingMetaData",
",",
"final",
"DatabaseType",
"databaseType",
",",
"final",
"ParsingResultCache",
"parsingResultCache",
")",
"{",
"retu... | Create new instance of sharding router.
@param shardingRule sharding rule
@param shardingMetaData sharding meta data
@param databaseType database type
@param parsingResultCache parsing result cache
@return sharding router instance | [
"Create",
"new",
"instance",
"of",
"sharding",
"router",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ShardingRouterFactory.java#L46-L49 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java | ReplicationsInner.updateAsync | public Observable<ReplicationInner> updateAsync(String resourceGroupName, String registryName, String replicationName) {
return updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() {
@Override
public ReplicationInner call(ServiceResponse<ReplicationInner> response) {
return response.body();
}
});
} | java | public Observable<ReplicationInner> updateAsync(String resourceGroupName, String registryName, String replicationName) {
return updateWithServiceResponseAsync(resourceGroupName, registryName, replicationName).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() {
@Override
public ReplicationInner call(ServiceResponse<ReplicationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ReplicationInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"replicationName",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
... | Updates a replication for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param replicationName The name of the replication.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"replication",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java#L591-L598 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/OAuth2Exception.java | OAuth2Exception.valueOf | public static OAuth2Exception valueOf(Map<String, String> errorParams) {
String errorCode = errorParams.get(ERROR);
String errorMessage = errorParams.containsKey(DESCRIPTION) ? errorParams.get(DESCRIPTION)
: null;
OAuth2Exception ex = create(errorCode, errorMessage);
Set<Map.Entry<String, String>> entries = errorParams.entrySet();
for (Map.Entry<String, String> entry : entries) {
String key = entry.getKey();
if (!ERROR.equals(key) && !DESCRIPTION.equals(key)) {
ex.addAdditionalInformation(key, entry.getValue());
}
}
return ex;
} | java | public static OAuth2Exception valueOf(Map<String, String> errorParams) {
String errorCode = errorParams.get(ERROR);
String errorMessage = errorParams.containsKey(DESCRIPTION) ? errorParams.get(DESCRIPTION)
: null;
OAuth2Exception ex = create(errorCode, errorMessage);
Set<Map.Entry<String, String>> entries = errorParams.entrySet();
for (Map.Entry<String, String> entry : entries) {
String key = entry.getKey();
if (!ERROR.equals(key) && !DESCRIPTION.equals(key)) {
ex.addAdditionalInformation(key, entry.getValue());
}
}
return ex;
} | [
"public",
"static",
"OAuth2Exception",
"valueOf",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"errorParams",
")",
"{",
"String",
"errorCode",
"=",
"errorParams",
".",
"get",
"(",
"ERROR",
")",
";",
"String",
"errorMessage",
"=",
"errorParams",
".",
"conta... | Creates an {@link OAuth2Exception} from a Map<String,String>.
@param errorParams
@return | [
"Creates",
"an",
"{",
"@link",
"OAuth2Exception",
"}",
"from",
"a",
"Map<",
";",
"String",
"String>",
";",
"."
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/exceptions/OAuth2Exception.java#L139-L153 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.xmlConversionNameUndefined | public static void xmlConversionNameUndefined(String xmlPath, String className) {
throw new XmlConversionNameException(MSG.INSTANCE.message(xmlConversionNameException,xmlPath,className));
} | java | public static void xmlConversionNameUndefined(String xmlPath, String className) {
throw new XmlConversionNameException(MSG.INSTANCE.message(xmlConversionNameException,xmlPath,className));
} | [
"public",
"static",
"void",
"xmlConversionNameUndefined",
"(",
"String",
"xmlPath",
",",
"String",
"className",
")",
"{",
"throw",
"new",
"XmlConversionNameException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"xmlConversionNameException",
",",
"xmlPath",
",... | Thrown when the conversion name is undefined.
@param xmlPath xml path
@param className class name | [
"Thrown",
"when",
"the",
"conversion",
"name",
"is",
"undefined",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L328-L330 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/engine/ClassParser.java | ClassParser.checkConstantPoolIndex | private void checkConstantPoolIndex(int index) throws InvalidClassFileFormatException {
if (index < 0 || index >= constantPool.length || constantPool[index] == null) {
throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry);
}
} | java | private void checkConstantPoolIndex(int index) throws InvalidClassFileFormatException {
if (index < 0 || index >= constantPool.length || constantPool[index] == null) {
throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry);
}
} | [
"private",
"void",
"checkConstantPoolIndex",
"(",
"int",
"index",
")",
"throws",
"InvalidClassFileFormatException",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"constantPool",
".",
"length",
"||",
"constantPool",
"[",
"index",
"]",
"==",
"null",
")... | Check that a constant pool index is valid.
@param index
the index to check
@throws InvalidClassFileFormatException
if the index is not valid | [
"Check",
"that",
"a",
"constant",
"pool",
"index",
"is",
"valid",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/engine/ClassParser.java#L348-L352 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java | Bidi.fixN0c | private void fixN0c(BracketData bd, int openingIndex, int newPropPosition, byte newProp) {
/* This function calls itself recursively */
IsoRun pLastIsoRun = bd.isoRuns[bd.isoRunLast];
Opening qOpening;
int k, openingPosition, closingPosition;
for (k = openingIndex+1; k < pLastIsoRun.limit; k++) {
qOpening = bd.openings[k];
if (qOpening.match >= 0) /* not an N0c match */
continue;
if (newPropPosition < qOpening.contextPos)
break;
if (newPropPosition >= qOpening.position)
continue;
if (newProp == qOpening.contextDir)
break;
openingPosition = qOpening.position;
dirProps[openingPosition] = newProp;
closingPosition = -(qOpening.match);
dirProps[closingPosition] = newProp;
qOpening.match = 0; /* prevent further changes */
fixN0c(bd, k, openingPosition, newProp);
fixN0c(bd, k, closingPosition, newProp);
}
} | java | private void fixN0c(BracketData bd, int openingIndex, int newPropPosition, byte newProp) {
/* This function calls itself recursively */
IsoRun pLastIsoRun = bd.isoRuns[bd.isoRunLast];
Opening qOpening;
int k, openingPosition, closingPosition;
for (k = openingIndex+1; k < pLastIsoRun.limit; k++) {
qOpening = bd.openings[k];
if (qOpening.match >= 0) /* not an N0c match */
continue;
if (newPropPosition < qOpening.contextPos)
break;
if (newPropPosition >= qOpening.position)
continue;
if (newProp == qOpening.contextDir)
break;
openingPosition = qOpening.position;
dirProps[openingPosition] = newProp;
closingPosition = -(qOpening.match);
dirProps[closingPosition] = newProp;
qOpening.match = 0; /* prevent further changes */
fixN0c(bd, k, openingPosition, newProp);
fixN0c(bd, k, closingPosition, newProp);
}
} | [
"private",
"void",
"fixN0c",
"(",
"BracketData",
"bd",
",",
"int",
"openingIndex",
",",
"int",
"newPropPosition",
",",
"byte",
"newProp",
")",
"{",
"/* This function calls itself recursively */",
"IsoRun",
"pLastIsoRun",
"=",
"bd",
".",
"isoRuns",
"[",
"bd",
".",
... | /* change N0c1 to N0c2 when a preceding bracket is assigned the embedding level | [
"/",
"*",
"change",
"N0c1",
"to",
"N0c2",
"when",
"a",
"preceding",
"bracket",
"is",
"assigned",
"the",
"embedding",
"level"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java#L2097-L2120 |
googleapis/google-api-java-client | google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/GoogleAtom.java | GoogleAtom.getFeedFields | public static String getFeedFields(Class<?> feedClass, Class<?> entryClass) {
StringBuilder fieldsBuf = new StringBuilder();
appendFeedFields(fieldsBuf, feedClass, entryClass);
return fieldsBuf.toString();
} | java | public static String getFeedFields(Class<?> feedClass, Class<?> entryClass) {
StringBuilder fieldsBuf = new StringBuilder();
appendFeedFields(fieldsBuf, feedClass, entryClass);
return fieldsBuf.toString();
} | [
"public",
"static",
"String",
"getFeedFields",
"(",
"Class",
"<",
"?",
">",
"feedClass",
",",
"Class",
"<",
"?",
">",
"entryClass",
")",
"{",
"StringBuilder",
"fieldsBuf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"appendFeedFields",
"(",
"fieldsBuf",
",",... | Returns the fields mask to use for the given data class of key/value pairs for the feed class
and for the entry class. This should only be used if the feed class does not contain the entry
class as a field. The data classes cannot be a {@link Map}, {@link GenericData} or a
{@link Collection}.
@param feedClass feed data class
@param entryClass entry data class | [
"Returns",
"the",
"fields",
"mask",
"to",
"use",
"for",
"the",
"given",
"data",
"class",
"of",
"key",
"/",
"value",
"pairs",
"for",
"the",
"feed",
"class",
"and",
"for",
"the",
"entry",
"class",
".",
"This",
"should",
"only",
"be",
"used",
"if",
"the",... | train | https://github.com/googleapis/google-api-java-client/blob/88decfd14fc40cae6eb6729a45c7d56a1132e450/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/GoogleAtom.java#L77-L81 |
greese/dasein-util | src/main/java/org/dasein/attributes/types/BooleanFactory.java | BooleanFactory.getType | public DataType<Boolean> getType(String grp, Number idx, boolean ml, boolean mv, boolean req, String... params) {
return new BooleanAttribute(grp, idx, ml, mv, req);
} | java | public DataType<Boolean> getType(String grp, Number idx, boolean ml, boolean mv, boolean req, String... params) {
return new BooleanAttribute(grp, idx, ml, mv, req);
} | [
"public",
"DataType",
"<",
"Boolean",
">",
"getType",
"(",
"String",
"grp",
",",
"Number",
"idx",
",",
"boolean",
"ml",
",",
"boolean",
"mv",
",",
"boolean",
"req",
",",
"String",
"...",
"params",
")",
"{",
"return",
"new",
"BooleanAttribute",
"(",
"grp"... | Technically, you can have a multi-lingual or multi-valued boolean, but why would you?
@param ml true if the boolean is multi-lingual
@param mv true if the boolean can support multiple values
@param req true if the boolean is required
@param params unused
@return a boolean instance | [
"Technically",
"you",
"can",
"have",
"a",
"multi",
"-",
"lingual",
"or",
"multi",
"-",
"valued",
"boolean",
"but",
"why",
"would",
"you?"
] | train | https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/types/BooleanFactory.java#L94-L96 |
michael-rapp/AndroidMaterialValidation | library/src/main/java/de/mrapp/android/validation/AbstractValidateableView.java | AbstractValidateableView.setError | public void setError(@Nullable final CharSequence error, @Nullable final Drawable icon) {
setLeftMessage(error, icon);
setActivated(error != null);
} | java | public void setError(@Nullable final CharSequence error, @Nullable final Drawable icon) {
setLeftMessage(error, icon);
setActivated(error != null);
} | [
"public",
"void",
"setError",
"(",
"@",
"Nullable",
"final",
"CharSequence",
"error",
",",
"@",
"Nullable",
"final",
"Drawable",
"icon",
")",
"{",
"setLeftMessage",
"(",
"error",
",",
"icon",
")",
";",
"setActivated",
"(",
"error",
"!=",
"null",
")",
";",
... | Sets an error message and an icon, which should be displayed.
@param error
The error message, which should be displayed, as an instance of the type {@link
CharSequence} or null, if a previously set error message should be cleared be
cleared
@param icon
The icon, which should be displayed,as an instance of the type {@link Drawable} or
null, if no icon should be displayed | [
"Sets",
"an",
"error",
"message",
"and",
"an",
"icon",
"which",
"should",
"be",
"displayed",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/AbstractValidateableView.java#L918-L921 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/Utils.java | Utils.evaluateXPointer | public static String evaluateXPointer(String xpointer, InputStream is) {
String results = "";
// Parse the XPointer into usable namespaces and XPath expressions
int xmlnsStart = xpointer.indexOf("xmlns(") + "xmlns(".length();
int xmlnsEnd = xpointer.indexOf(")", xmlnsStart);
int xpathStart = xpointer.indexOf("xpointer(") + "xpointer(".length();
int xpathEnd = xpointer.indexOf(")", xpathStart);
String xmlnsStr = xpointer.substring(xmlnsStart, xmlnsEnd);
String xpathStr = xpointer.substring(xpathStart, xpathEnd);
// System.out.println("xmlnsStr: "+xmlnsStr+" xpathStr: "+xpathStr);
try {
XPath xpath = XPathFactory.newInstance().newXPath();
String[] namespaces = xmlnsStr.split(",");
// Add namespaces to XPath element
MyNamespaceContext context = new MyNamespaceContext();
for (int i = 0; i < namespaces.length; i++) {
String[] xmlnsParts = namespaces[i].split("=");
context.setNamespace(xmlnsParts[0], xmlnsParts[1]);
xpath.setNamespaceContext(context);
}
InputSource src = new InputSource(is);
results = (String) xpath.evaluate(xpathStr, src);
// System.out.println("results: "+results);
} catch (Exception e) {
jlogger.log(Level.SEVERE,
"Error in evaluating XPointer. " + e.getMessage(), e);
System.out.println("Error in evaluating XPointer. "
+ e.getMessage());
}
return results;
} | java | public static String evaluateXPointer(String xpointer, InputStream is) {
String results = "";
// Parse the XPointer into usable namespaces and XPath expressions
int xmlnsStart = xpointer.indexOf("xmlns(") + "xmlns(".length();
int xmlnsEnd = xpointer.indexOf(")", xmlnsStart);
int xpathStart = xpointer.indexOf("xpointer(") + "xpointer(".length();
int xpathEnd = xpointer.indexOf(")", xpathStart);
String xmlnsStr = xpointer.substring(xmlnsStart, xmlnsEnd);
String xpathStr = xpointer.substring(xpathStart, xpathEnd);
// System.out.println("xmlnsStr: "+xmlnsStr+" xpathStr: "+xpathStr);
try {
XPath xpath = XPathFactory.newInstance().newXPath();
String[] namespaces = xmlnsStr.split(",");
// Add namespaces to XPath element
MyNamespaceContext context = new MyNamespaceContext();
for (int i = 0; i < namespaces.length; i++) {
String[] xmlnsParts = namespaces[i].split("=");
context.setNamespace(xmlnsParts[0], xmlnsParts[1]);
xpath.setNamespaceContext(context);
}
InputSource src = new InputSource(is);
results = (String) xpath.evaluate(xpathStr, src);
// System.out.println("results: "+results);
} catch (Exception e) {
jlogger.log(Level.SEVERE,
"Error in evaluating XPointer. " + e.getMessage(), e);
System.out.println("Error in evaluating XPointer. "
+ e.getMessage());
}
return results;
} | [
"public",
"static",
"String",
"evaluateXPointer",
"(",
"String",
"xpointer",
",",
"InputStream",
"is",
")",
"{",
"String",
"results",
"=",
"\"\"",
";",
"// Parse the XPointer into usable namespaces and XPath expressions\r",
"int",
"xmlnsStart",
"=",
"xpointer",
".",
"in... | Converts an XPointer to XPath and evaulates the result (JAXP) | [
"Converts",
"an",
"XPointer",
"to",
"XPath",
"and",
"evaulates",
"the",
"result",
"(",
"JAXP",
")"
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/Utils.java#L117-L148 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/text/i18n/impl/DefaultTextBundleRegistry.java | DefaultTextBundleRegistry.toJavaResourceName | protected final String toJavaResourceName(String bundleName, Locale locale) {
String fullName = bundleName;
final String localeName = toLocaleStr(locale);
final String suffix = "properties";
if (!"".equals(localeName)) fullName = fullName + "_" + localeName;
StringBuilder sb = new StringBuilder(fullName.length() + 1 + suffix.length());
sb.append(fullName.replace('.', '/')).append('.').append(suffix);
return sb.toString();
} | java | protected final String toJavaResourceName(String bundleName, Locale locale) {
String fullName = bundleName;
final String localeName = toLocaleStr(locale);
final String suffix = "properties";
if (!"".equals(localeName)) fullName = fullName + "_" + localeName;
StringBuilder sb = new StringBuilder(fullName.length() + 1 + suffix.length());
sb.append(fullName.replace('.', '/')).append('.').append(suffix);
return sb.toString();
} | [
"protected",
"final",
"String",
"toJavaResourceName",
"(",
"String",
"bundleName",
",",
"Locale",
"locale",
")",
"{",
"String",
"fullName",
"=",
"bundleName",
";",
"final",
"String",
"localeName",
"=",
"toLocaleStr",
"(",
"locale",
")",
";",
"final",
"String",
... | java properties bundle name
@param bundleName
@param locale
@return convented properties ended file path. | [
"java",
"properties",
"bundle",
"name"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/text/i18n/impl/DefaultTextBundleRegistry.java#L177-L185 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/model/Word.java | Word.getNeoclassicalAffix | public Component getNeoclassicalAffix() {
Preconditions.checkState(isCompound(), MSG_NOT_COMPOUND, this);
Preconditions.checkState(getCompoundType() == CompoundType.NEOCLASSICAL, MSG_NOT_NEOCLASSICAL, this);
for(Component c:components)
if(c.isNeoclassicalAffix())
return c;
throw new IllegalArgumentException(String.format(MSG_NO_NEOCLASSICAL_COMPOUND, this));
} | java | public Component getNeoclassicalAffix() {
Preconditions.checkState(isCompound(), MSG_NOT_COMPOUND, this);
Preconditions.checkState(getCompoundType() == CompoundType.NEOCLASSICAL, MSG_NOT_NEOCLASSICAL, this);
for(Component c:components)
if(c.isNeoclassicalAffix())
return c;
throw new IllegalArgumentException(String.format(MSG_NO_NEOCLASSICAL_COMPOUND, this));
} | [
"public",
"Component",
"getNeoclassicalAffix",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"isCompound",
"(",
")",
",",
"MSG_NOT_COMPOUND",
",",
"this",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"getCompoundType",
"(",
")",
"==",
"CompoundTy... | Returns the {@link Component} object if
@return
The neoclassical component affix
@throws IllegalStateException when this word is not a neoclassical compound | [
"Returns",
"the",
"{",
"@link",
"Component",
"}",
"object",
"if"
] | train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/model/Word.java#L129-L136 |
google/closure-compiler | src/com/google/javascript/jscomp/gwt/super/com/google/javascript/jscomp/SourceMapResolver.java | SourceMapResolver.extractSourceMap | static SourceFile extractSourceMap(
SourceFile jsFile, String sourceMapURL, boolean parseInlineSourceMaps) {
// Javascript version of the compiler can only deal with inline sources.
if (sourceMapURL.startsWith(BASE64_URL_PREFIX)) {
byte[] data =
BaseEncoding.base64().decode(sourceMapURL.substring(BASE64_URL_PREFIX.length()));
String source = new String(data, StandardCharsets.UTF_8);
return SourceFile.fromCode(jsFile.getName() + ".inline.map", source);
}
return null;
} | java | static SourceFile extractSourceMap(
SourceFile jsFile, String sourceMapURL, boolean parseInlineSourceMaps) {
// Javascript version of the compiler can only deal with inline sources.
if (sourceMapURL.startsWith(BASE64_URL_PREFIX)) {
byte[] data =
BaseEncoding.base64().decode(sourceMapURL.substring(BASE64_URL_PREFIX.length()));
String source = new String(data, StandardCharsets.UTF_8);
return SourceFile.fromCode(jsFile.getName() + ".inline.map", source);
}
return null;
} | [
"static",
"SourceFile",
"extractSourceMap",
"(",
"SourceFile",
"jsFile",
",",
"String",
"sourceMapURL",
",",
"boolean",
"parseInlineSourceMaps",
")",
"{",
"// Javascript version of the compiler can only deal with inline sources.",
"if",
"(",
"sourceMapURL",
".",
"startsWith",
... | For a given //# sourceMappingUrl, this locates the appropriate sourcemap on disk. This is use
for sourcemap merging (--apply_input_source_maps) and for error resolution. | [
"For",
"a",
"given",
"//",
"#",
"sourceMappingUrl",
"this",
"locates",
"the",
"appropriate",
"sourcemap",
"on",
"disk",
".",
"This",
"is",
"use",
"for",
"sourcemap",
"merging",
"(",
"--",
"apply_input_source_maps",
")",
"and",
"for",
"error",
"resolution",
"."... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/gwt/super/com/google/javascript/jscomp/SourceMapResolver.java#L33-L43 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogRecord.java | WsLogRecord.createWsLogRecord | public static WsLogRecord createWsLogRecord(TraceComponent tc, Level level, String msg, Object[] msgParms) {
WsLogRecord retMe = new WsLogRecord(level, msg);
retMe.setLoggerName(tc.getName());
retMe.setParameters(msgParms);
retMe.setTraceClass(tc.getTraceClass());
retMe.setResourceBundleName(tc.getResourceBundleName());
if (level.intValue() >= Level.INFO.intValue()) {
retMe.setLocalizable(REQUIRES_LOCALIZATION);
}
else {
retMe.setLocalizable(REQUIRES_NO_LOCALIZATION);
}
return retMe;
} | java | public static WsLogRecord createWsLogRecord(TraceComponent tc, Level level, String msg, Object[] msgParms) {
WsLogRecord retMe = new WsLogRecord(level, msg);
retMe.setLoggerName(tc.getName());
retMe.setParameters(msgParms);
retMe.setTraceClass(tc.getTraceClass());
retMe.setResourceBundleName(tc.getResourceBundleName());
if (level.intValue() >= Level.INFO.intValue()) {
retMe.setLocalizable(REQUIRES_LOCALIZATION);
}
else {
retMe.setLocalizable(REQUIRES_NO_LOCALIZATION);
}
return retMe;
} | [
"public",
"static",
"WsLogRecord",
"createWsLogRecord",
"(",
"TraceComponent",
"tc",
",",
"Level",
"level",
",",
"String",
"msg",
",",
"Object",
"[",
"]",
"msgParms",
")",
"{",
"WsLogRecord",
"retMe",
"=",
"new",
"WsLogRecord",
"(",
"level",
",",
"msg",
")",... | Static method constructs a WsLogRecord object using the given parameters.
This bridges Tr-based trace and Logger based trace | [
"Static",
"method",
"constructs",
"a",
"WsLogRecord",
"object",
"using",
"the",
"given",
"parameters",
".",
"This",
"bridges",
"Tr",
"-",
"based",
"trace",
"and",
"Logger",
"based",
"trace"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/WsLogRecord.java#L514-L529 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Stream.java | Stream.dropWhileIndexed | @NotNull
public Stream<T> dropWhileIndexed(@NotNull IndexedPredicate<? super T> predicate) {
return dropWhileIndexed(0, 1, predicate);
} | java | @NotNull
public Stream<T> dropWhileIndexed(@NotNull IndexedPredicate<? super T> predicate) {
return dropWhileIndexed(0, 1, predicate);
} | [
"@",
"NotNull",
"public",
"Stream",
"<",
"T",
">",
"dropWhileIndexed",
"(",
"@",
"NotNull",
"IndexedPredicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"return",
"dropWhileIndexed",
"(",
"0",
",",
"1",
",",
"predicate",
")",
";",
"}"
] | Drops elements while the {@code IndexedPredicate} is true, then returns the rest.
<p>This is an intermediate operation.
<p>Example:
<pre>
predicate: (index, value) -> (index + value) < 5
stream: [1, 2, 3, 4, 0, 1, 2]
index: [0, 1, 2, 3, 4, 5, 6]
sum: [1, 3, 5, 7, 4, 6, 8]
result: [3, 4, 0, 1, 2]
</pre>
@param predicate the {@code IndexedPredicate} used to drop elements
@return the new stream
@since 1.1.6 | [
"Drops",
"elements",
"while",
"the",
"{",
"@code",
"IndexedPredicate",
"}",
"is",
"true",
"then",
"returns",
"the",
"rest",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L1476-L1479 |
metafacture/metafacture-core | metafacture-commons/src/main/java/org/metafacture/commons/tries/SimpleRegexTrie.java | SimpleRegexTrie.put | public void put(final String keys, final P value) {
if (keys.matches(".*" + SIMPLE_CHARACTER_CLASS + ".*")) {
int charClassStart = keys.indexOf('[', 0);
final int charClassEnd = keys.indexOf(']', 1);
String begin = keys.substring(0, charClassStart);
for (; charClassStart < charClassEnd - 1; charClassStart++) {
char middle = keys.charAt(charClassStart + 1);
String end = keys.substring(charClassEnd + 1, keys.length());
put(begin + middle + end, value);
}
} else
trie.put(keys, value);
} | java | public void put(final String keys, final P value) {
if (keys.matches(".*" + SIMPLE_CHARACTER_CLASS + ".*")) {
int charClassStart = keys.indexOf('[', 0);
final int charClassEnd = keys.indexOf(']', 1);
String begin = keys.substring(0, charClassStart);
for (; charClassStart < charClassEnd - 1; charClassStart++) {
char middle = keys.charAt(charClassStart + 1);
String end = keys.substring(charClassEnd + 1, keys.length());
put(begin + middle + end, value);
}
} else
trie.put(keys, value);
} | [
"public",
"void",
"put",
"(",
"final",
"String",
"keys",
",",
"final",
"P",
"value",
")",
"{",
"if",
"(",
"keys",
".",
"matches",
"(",
"\".*\"",
"+",
"SIMPLE_CHARACTER_CLASS",
"+",
"\".*\"",
")",
")",
"{",
"int",
"charClassStart",
"=",
"keys",
".",
"in... | Enables the use of simple character classes like 'a[agt][ac]'. Calls the
method of {@link WildcardTrie} for further treatment.
@param keys pattern of keys
@param value value to associate with the key pattern | [
"Enables",
"the",
"use",
"of",
"simple",
"character",
"classes",
"like",
"a",
"[",
"agt",
"]",
"[",
"ac",
"]",
".",
"Calls",
"the",
"method",
"of",
"{",
"@link",
"WildcardTrie",
"}",
"for",
"further",
"treatment",
"."
] | train | https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-commons/src/main/java/org/metafacture/commons/tries/SimpleRegexTrie.java#L45-L57 |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaReader.java | AstaReader.processResources | public void processResources(List<Row> permanentRows, List<Row> consumableRows)
{
//
// Process permanent resources
//
for (Row row : permanentRows)
{
Resource resource = m_project.addResource();
resource.setType(ResourceType.WORK);
resource.setUniqueID(row.getInteger("PERMANENT_RESOURCEID"));
resource.setEmailAddress(row.getString("EMAIL_ADDRESS"));
// EFFORT_TIME_UNIT
resource.setName(row.getString("NASE"));
resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV")));
resource.setMaxUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100));
resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER"));
resource.setInitials(getInitials(resource.getName()));
}
//
// Process groups
//
/*
for (Row row : permanentRows)
{
Resource resource = m_project.getResourceByUniqueID(row.getInteger("PERMANENT_RESOURCEID"));
Resource group = m_project.getResourceByUniqueID(row.getInteger("ROLE"));
if (resource != null && group != null)
{
resource.setGroup(group.getName());
}
}
*/
//
// Process consumable resources
//
for (Row row : consumableRows)
{
Resource resource = m_project.addResource();
resource.setType(ResourceType.MATERIAL);
resource.setUniqueID(row.getInteger("CONSUMABLE_RESOURCEID"));
resource.setCostPerUse(row.getDouble("COST_PER_USEDEFAULTSAMOUNT"));
resource.setPeakUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100));
resource.setName(row.getString("NASE"));
resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV")));
resource.setAvailableFrom(row.getDate("AVAILABLE_FROM"));
resource.setAvailableTo(row.getDate("AVAILABLE_TO"));
resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER"));
resource.setMaterialLabel(row.getString("MEASUREMENT"));
resource.setInitials(getInitials(resource.getName()));
}
} | java | public void processResources(List<Row> permanentRows, List<Row> consumableRows)
{
//
// Process permanent resources
//
for (Row row : permanentRows)
{
Resource resource = m_project.addResource();
resource.setType(ResourceType.WORK);
resource.setUniqueID(row.getInteger("PERMANENT_RESOURCEID"));
resource.setEmailAddress(row.getString("EMAIL_ADDRESS"));
// EFFORT_TIME_UNIT
resource.setName(row.getString("NASE"));
resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV")));
resource.setMaxUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100));
resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER"));
resource.setInitials(getInitials(resource.getName()));
}
//
// Process groups
//
/*
for (Row row : permanentRows)
{
Resource resource = m_project.getResourceByUniqueID(row.getInteger("PERMANENT_RESOURCEID"));
Resource group = m_project.getResourceByUniqueID(row.getInteger("ROLE"));
if (resource != null && group != null)
{
resource.setGroup(group.getName());
}
}
*/
//
// Process consumable resources
//
for (Row row : consumableRows)
{
Resource resource = m_project.addResource();
resource.setType(ResourceType.MATERIAL);
resource.setUniqueID(row.getInteger("CONSUMABLE_RESOURCEID"));
resource.setCostPerUse(row.getDouble("COST_PER_USEDEFAULTSAMOUNT"));
resource.setPeakUnits(Double.valueOf(row.getDouble("AVAILABILITY").doubleValue() * 100));
resource.setName(row.getString("NASE"));
resource.setResourceCalendar(deriveResourceCalendar(row.getInteger("CALENDAV")));
resource.setAvailableFrom(row.getDate("AVAILABLE_FROM"));
resource.setAvailableTo(row.getDate("AVAILABLE_TO"));
resource.setGeneric(row.getBoolean("CREATED_AS_FOLDER"));
resource.setMaterialLabel(row.getString("MEASUREMENT"));
resource.setInitials(getInitials(resource.getName()));
}
} | [
"public",
"void",
"processResources",
"(",
"List",
"<",
"Row",
">",
"permanentRows",
",",
"List",
"<",
"Row",
">",
"consumableRows",
")",
"{",
"//",
"// Process permanent resources",
"//",
"for",
"(",
"Row",
"row",
":",
"permanentRows",
")",
"{",
"Resource",
... | Process resources.
@param permanentRows permanent resource data
@param consumableRows consumable resource data | [
"Process",
"resources",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L123-L174 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/CodeVerifierUtil.java | CodeVerifierUtil.generateRandomCodeVerifier | public static String generateRandomCodeVerifier(SecureRandom entropySource, int entropyBytes) {
byte[] randomBytes = new byte[entropyBytes];
entropySource.nextBytes(randomBytes);
return Base64.getUrlEncoder().withoutPadding().encodeToString(randomBytes);
} | java | public static String generateRandomCodeVerifier(SecureRandom entropySource, int entropyBytes) {
byte[] randomBytes = new byte[entropyBytes];
entropySource.nextBytes(randomBytes);
return Base64.getUrlEncoder().withoutPadding().encodeToString(randomBytes);
} | [
"public",
"static",
"String",
"generateRandomCodeVerifier",
"(",
"SecureRandom",
"entropySource",
",",
"int",
"entropyBytes",
")",
"{",
"byte",
"[",
"]",
"randomBytes",
"=",
"new",
"byte",
"[",
"entropyBytes",
"]",
";",
"entropySource",
".",
"nextBytes",
"(",
"r... | Generates a random code verifier string using the provided entropy source and the specified
number of bytes of entropy.
@param entropySource entropy source
@param entropyBytes entropy bytes
@return String generated code verifier | [
"Generates",
"a",
"random",
"code",
"verifier",
"string",
"using",
"the",
"provided",
"entropy",
"source",
"and",
"the",
"specified",
"number",
"of",
"bytes",
"of",
"entropy",
"."
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CodeVerifierUtil.java#L117-L121 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/database/relation/RelationUtil.java | RelationUtil.assumeVectorField | public static <V extends FeatureVector<?>> VectorFieldTypeInformation<V> assumeVectorField(Relation<V> relation) {
try {
return ((VectorFieldTypeInformation<V>) relation.getDataTypeInformation());
}
catch(Exception e) {
throw new UnsupportedOperationException("Expected a vector field, got type information: " + relation.getDataTypeInformation().toString(), e);
}
} | java | public static <V extends FeatureVector<?>> VectorFieldTypeInformation<V> assumeVectorField(Relation<V> relation) {
try {
return ((VectorFieldTypeInformation<V>) relation.getDataTypeInformation());
}
catch(Exception e) {
throw new UnsupportedOperationException("Expected a vector field, got type information: " + relation.getDataTypeInformation().toString(), e);
}
} | [
"public",
"static",
"<",
"V",
"extends",
"FeatureVector",
"<",
"?",
">",
">",
"VectorFieldTypeInformation",
"<",
"V",
">",
"assumeVectorField",
"(",
"Relation",
"<",
"V",
">",
"relation",
")",
"{",
"try",
"{",
"return",
"(",
"(",
"VectorFieldTypeInformation",
... | Get the vector field type information from a relation.
@param relation relation
@param <V> Vector type
@return Vector field type information | [
"Get",
"the",
"vector",
"field",
"type",
"information",
"from",
"a",
"relation",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/database/relation/RelationUtil.java#L66-L73 |
Waikato/moa | moa/src/main/java/moa/gui/GUIDefaults.java | GUIDefaults.getObject | protected static Object getObject(String property, String defaultValue, Class cls) {
Object result;
String tmpStr;
String[] tmpOptions;
result = null;
try {
tmpStr = get(property, defaultValue);
tmpOptions = Utils.splitOptions(tmpStr);
if (tmpOptions.length != 0) {
tmpStr = tmpOptions[0];
tmpOptions[0] = "";
result = Utils.forName(cls, tmpStr, tmpOptions);
}
} catch (Exception e) {
e.printStackTrace();
result = null;
}
return result;
} | java | protected static Object getObject(String property, String defaultValue, Class cls) {
Object result;
String tmpStr;
String[] tmpOptions;
result = null;
try {
tmpStr = get(property, defaultValue);
tmpOptions = Utils.splitOptions(tmpStr);
if (tmpOptions.length != 0) {
tmpStr = tmpOptions[0];
tmpOptions[0] = "";
result = Utils.forName(cls, tmpStr, tmpOptions);
}
} catch (Exception e) {
e.printStackTrace();
result = null;
}
return result;
} | [
"protected",
"static",
"Object",
"getObject",
"(",
"String",
"property",
",",
"String",
"defaultValue",
",",
"Class",
"cls",
")",
"{",
"Object",
"result",
";",
"String",
"tmpStr",
";",
"String",
"[",
"]",
"tmpOptions",
";",
"result",
"=",
"null",
";",
"try... | Tries to instantiate the class stored for this property, optional
options will be set as well. Returns null if unsuccessful.
@param property the property to get the object for
@param defaultValue the default object spec string
@param cls the class the object must be derived from
@return if successful the fully configured object, null
otherwise | [
"Tries",
"to",
"instantiate",
"the",
"class",
"stored",
"for",
"this",
"property",
"optional",
"options",
"will",
"be",
"set",
"as",
"well",
".",
"Returns",
"null",
"if",
"unsuccessful",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/GUIDefaults.java#L105-L126 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java | NumberMath.getMath | public static NumberMath getMath(Number left, Number right) {
// FloatingPointMath wins according to promotion Matrix
if (isFloatingPoint(left) || isFloatingPoint(right)) {
return FloatingPointMath.INSTANCE;
}
NumberMath leftMath = getMath(left);
NumberMath rightMath = getMath(right);
if (leftMath == BigDecimalMath.INSTANCE || rightMath == BigDecimalMath.INSTANCE) {
return BigDecimalMath.INSTANCE;
}
if (leftMath == BigIntegerMath.INSTANCE || rightMath == BigIntegerMath.INSTANCE) {
return BigIntegerMath.INSTANCE;
}
if (leftMath == LongMath.INSTANCE || rightMath == LongMath.INSTANCE) {
return LongMath.INSTANCE;
}
if (leftMath == IntegerMath.INSTANCE || rightMath == IntegerMath.INSTANCE) {
return IntegerMath.INSTANCE;
}
// also for custom Number implementations
return BigDecimalMath.INSTANCE;
} | java | public static NumberMath getMath(Number left, Number right) {
// FloatingPointMath wins according to promotion Matrix
if (isFloatingPoint(left) || isFloatingPoint(right)) {
return FloatingPointMath.INSTANCE;
}
NumberMath leftMath = getMath(left);
NumberMath rightMath = getMath(right);
if (leftMath == BigDecimalMath.INSTANCE || rightMath == BigDecimalMath.INSTANCE) {
return BigDecimalMath.INSTANCE;
}
if (leftMath == BigIntegerMath.INSTANCE || rightMath == BigIntegerMath.INSTANCE) {
return BigIntegerMath.INSTANCE;
}
if (leftMath == LongMath.INSTANCE || rightMath == LongMath.INSTANCE) {
return LongMath.INSTANCE;
}
if (leftMath == IntegerMath.INSTANCE || rightMath == IntegerMath.INSTANCE) {
return IntegerMath.INSTANCE;
}
// also for custom Number implementations
return BigDecimalMath.INSTANCE;
} | [
"public",
"static",
"NumberMath",
"getMath",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"// FloatingPointMath wins according to promotion Matrix",
"if",
"(",
"isFloatingPoint",
"(",
"left",
")",
"||",
"isFloatingPoint",
"(",
"right",
")",
")",
"{",
"... | Determine which NumberMath instance to use, given the supplied operands. This method implements
the type promotion rules discussed in the documentation. Note that by the time this method is
called, any Byte, Character or Short operands will have been promoted to Integer. For reference,
here is the promotion matrix:
bD bI D F L I
bD bD bD D D bD bD
bI bD bI D D bI bI
D D D D D D D
F D D D D D D
L bD bI D D L L
I bD bI D D L I
Note that for division, if either operand isFloatingPoint, the result will be floating. Otherwise,
the result is BigDecimal | [
"Determine",
"which",
"NumberMath",
"instance",
"to",
"use",
"given",
"the",
"supplied",
"operands",
".",
"This",
"method",
"implements",
"the",
"type",
"promotion",
"rules",
"discussed",
"in",
"the",
"documentation",
".",
"Note",
"that",
"by",
"the",
"time",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java#L194-L216 |
jglobus/JGlobus | gss/src/main/java/org/globus/net/BaseServer.java | BaseServer.getHost | public String getHost() {
String host = Util.getLocalHostAddress();
try {
URL u = new URL("http", host, 80, "/");
return u.getHost();
} catch (MalformedURLException e) {
return host;
}
} | java | public String getHost() {
String host = Util.getLocalHostAddress();
try {
URL u = new URL("http", host, 80, "/");
return u.getHost();
} catch (MalformedURLException e) {
return host;
}
} | [
"public",
"String",
"getHost",
"(",
")",
"{",
"String",
"host",
"=",
"Util",
".",
"getLocalHostAddress",
"(",
")",
";",
"try",
"{",
"URL",
"u",
"=",
"new",
"URL",
"(",
"\"http\"",
",",
"host",
",",
"80",
",",
"\"/\"",
")",
";",
"return",
"u",
".",
... | Returns hostname of this server. The format of the host conforms
to RFC 2732, i.e. for a literal IPv6 address, this method will
return the IPv6 address enclosed in square brackets ('[' and ']').
@return hostname | [
"Returns",
"hostname",
"of",
"this",
"server",
".",
"The",
"format",
"of",
"the",
"host",
"conforms",
"to",
"RFC",
"2732",
"i",
".",
"e",
".",
"for",
"a",
"literal",
"IPv6",
"address",
"this",
"method",
"will",
"return",
"the",
"IPv6",
"address",
"enclos... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/net/BaseServer.java#L209-L217 |
jblas-project/jblas | src/main/java/org/jblas/util/Permutations.java | Permutations.permutationFloatMatrixFromPivotIndices | public static FloatMatrix permutationFloatMatrixFromPivotIndices(int size, int[] ipiv) {
int n = ipiv.length;
//System.out.printf("size = %d n = %d\n", size, n);
int indices[] = new int[size];
for (int i = 0; i < size; i++)
indices[i] = i;
//for (int i = 0; i < n; i++)
// System.out.printf("ipiv[%d] = %d\n", i, ipiv[i]);
for (int i = 0; i < n; i++) {
int j = ipiv[i] - 1;
int t = indices[i];
indices[i] = indices[j];
indices[j] = t;
}
FloatMatrix result = new FloatMatrix(size, size);
for (int i = 0; i < size; i++)
result.put(indices[i], i, 1.0f);
return result;
} | java | public static FloatMatrix permutationFloatMatrixFromPivotIndices(int size, int[] ipiv) {
int n = ipiv.length;
//System.out.printf("size = %d n = %d\n", size, n);
int indices[] = new int[size];
for (int i = 0; i < size; i++)
indices[i] = i;
//for (int i = 0; i < n; i++)
// System.out.printf("ipiv[%d] = %d\n", i, ipiv[i]);
for (int i = 0; i < n; i++) {
int j = ipiv[i] - 1;
int t = indices[i];
indices[i] = indices[j];
indices[j] = t;
}
FloatMatrix result = new FloatMatrix(size, size);
for (int i = 0; i < size; i++)
result.put(indices[i], i, 1.0f);
return result;
} | [
"public",
"static",
"FloatMatrix",
"permutationFloatMatrixFromPivotIndices",
"(",
"int",
"size",
",",
"int",
"[",
"]",
"ipiv",
")",
"{",
"int",
"n",
"=",
"ipiv",
".",
"length",
";",
"//System.out.printf(\"size = %d n = %d\\n\", size, n);",
"int",
"indices",
"[",
"]"... | Create a permutation matrix from a LAPACK-style 'ipiv' vector.
@param ipiv row i was interchanged with row ipiv[i] | [
"Create",
"a",
"permutation",
"matrix",
"from",
"a",
"LAPACK",
"-",
"style",
"ipiv",
"vector",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/Permutations.java#L126-L146 |
betfair/cougar | cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IDLReader.java | IDLReader.removeUndefinedOperations | private void removeUndefinedOperations(Node target, Node extensions) throws Exception {
final XPathFactory factory = XPathFactory.newInstance();
final NodeList nodes = (NodeList) factory.newXPath().evaluate("//operation", target, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
final Node targetNode = nodes.item(i);
String nameBasedXpath = DomUtils.getNameBasedXPath(targetNode, true);
log.debug("Checking operation: " + nameBasedXpath);
final NodeList targetNodes = (NodeList) factory.newXPath().evaluate(nameBasedXpath, extensions, XPathConstants.NODESET);
if (targetNodes.getLength() == 0) {
// This operation is not defined in the extensions doc
log.debug("Ignoring IDL defined operation: " + getAttribute(targetNode, "name"));
targetNode.getParentNode().removeChild(targetNode);
}
}
} | java | private void removeUndefinedOperations(Node target, Node extensions) throws Exception {
final XPathFactory factory = XPathFactory.newInstance();
final NodeList nodes = (NodeList) factory.newXPath().evaluate("//operation", target, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
final Node targetNode = nodes.item(i);
String nameBasedXpath = DomUtils.getNameBasedXPath(targetNode, true);
log.debug("Checking operation: " + nameBasedXpath);
final NodeList targetNodes = (NodeList) factory.newXPath().evaluate(nameBasedXpath, extensions, XPathConstants.NODESET);
if (targetNodes.getLength() == 0) {
// This operation is not defined in the extensions doc
log.debug("Ignoring IDL defined operation: " + getAttribute(targetNode, "name"));
targetNode.getParentNode().removeChild(targetNode);
}
}
} | [
"private",
"void",
"removeUndefinedOperations",
"(",
"Node",
"target",
",",
"Node",
"extensions",
")",
"throws",
"Exception",
"{",
"final",
"XPathFactory",
"factory",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
";",
"final",
"NodeList",
"nodes",
"=",
"(",... | Cycle through the target Node and remove any operations not defined in the extensions document. | [
"Cycle",
"through",
"the",
"target",
"Node",
"and",
"remove",
"any",
"operations",
"not",
"defined",
"in",
"the",
"extensions",
"document",
"."
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IDLReader.java#L390-L405 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java | DatabaseRecommendedActionsInner.listByDatabaseAdvisorAsync | public Observable<List<RecommendedActionInner>> listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) {
return listByDatabaseAdvisorWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1<ServiceResponse<List<RecommendedActionInner>>, List<RecommendedActionInner>>() {
@Override
public List<RecommendedActionInner> call(ServiceResponse<List<RecommendedActionInner>> response) {
return response.body();
}
});
} | java | public Observable<List<RecommendedActionInner>> listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) {
return listByDatabaseAdvisorWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1<ServiceResponse<List<RecommendedActionInner>>, List<RecommendedActionInner>>() {
@Override
public List<RecommendedActionInner> call(ServiceResponse<List<RecommendedActionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"RecommendedActionInner",
">",
">",
"listByDatabaseAdvisorAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"advisorName",
")",
"{",
"return",
"listByDatabas... | Gets list of Database Recommended Actions.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param advisorName The name of the Database Advisor.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<RecommendedActionInner> object | [
"Gets",
"list",
"of",
"Database",
"Recommended",
"Actions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java#L114-L121 |
jenkinsci/github-plugin | src/main/java/com/coravy/hudson/plugins/github/GithubProjectProperty.java | GithubProjectProperty.displayNameFor | public static String displayNameFor(@Nonnull Job<?, ?> job) {
GithubProjectProperty ghProp = job.getProperty(GithubProjectProperty.class);
if (ghProp != null && isNotBlank(ghProp.getDisplayName())) {
return ghProp.getDisplayName();
}
return job.getFullName();
} | java | public static String displayNameFor(@Nonnull Job<?, ?> job) {
GithubProjectProperty ghProp = job.getProperty(GithubProjectProperty.class);
if (ghProp != null && isNotBlank(ghProp.getDisplayName())) {
return ghProp.getDisplayName();
}
return job.getFullName();
} | [
"public",
"static",
"String",
"displayNameFor",
"(",
"@",
"Nonnull",
"Job",
"<",
"?",
",",
"?",
">",
"job",
")",
"{",
"GithubProjectProperty",
"ghProp",
"=",
"job",
".",
"getProperty",
"(",
"GithubProjectProperty",
".",
"class",
")",
";",
"if",
"(",
"ghPro... | Extracts value of display name from given job, or just returns full name if field or prop is not defined
@param job project which wants to get current context name to use in GH status API
@return display name or full job name if field is not defined
@since 1.14.1 | [
"Extracts",
"value",
"of",
"display",
"name",
"from",
"given",
"job",
"or",
"just",
"returns",
"full",
"name",
"if",
"field",
"or",
"prop",
"is",
"not",
"defined"
] | train | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/com/coravy/hudson/plugins/github/GithubProjectProperty.java#L91-L98 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.resolveValue | public ModelNode resolveValue(final ExpressionResolver resolver, final ModelNode value) throws OperationFailedException {
final ModelNode node = value.clone();
if (!node.isDefined() && defaultValue != null && defaultValue.isDefined()) {
node.set(defaultValue);
}
ModelNode resolved = resolver.resolveExpressions(node);
resolved = parseResolvedValue(value, resolved);
validator.validateParameter(name, resolved);
return resolved;
} | java | public ModelNode resolveValue(final ExpressionResolver resolver, final ModelNode value) throws OperationFailedException {
final ModelNode node = value.clone();
if (!node.isDefined() && defaultValue != null && defaultValue.isDefined()) {
node.set(defaultValue);
}
ModelNode resolved = resolver.resolveExpressions(node);
resolved = parseResolvedValue(value, resolved);
validator.validateParameter(name, resolved);
return resolved;
} | [
"public",
"ModelNode",
"resolveValue",
"(",
"final",
"ExpressionResolver",
"resolver",
",",
"final",
"ModelNode",
"value",
")",
"throws",
"OperationFailedException",
"{",
"final",
"ModelNode",
"node",
"=",
"value",
".",
"clone",
"(",
")",
";",
"if",
"(",
"!",
... | Takes the given {@code value}, resolves it using the given {@code resolver}
and validates it using this attribute's {@link #getValidator() validator}. If the value is
undefined and a {@link #getDefaultValue() default value} is available, the default value is used.
@param resolver the expression resolver
@param value a node that is expected to be a valid value for an attribute defined by this definition
@return the resolved value, possibly the default value if {@code value} is not defined
@throws OperationFailedException if the value is not valid | [
"Takes",
"the",
"given",
"{",
"@code",
"value",
"}",
"resolves",
"it",
"using",
"the",
"given",
"{",
"@code",
"resolver",
"}",
"and",
"validates",
"it",
"using",
"this",
"attribute",
"s",
"{",
"@link",
"#getValidator",
"()",
"validator",
"}",
".",
"If",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L662-L671 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/api/loader/FileBatch.java | FileBatch.forFiles | public static FileBatch forFiles(List<File> files) throws IOException {
List<String> origPaths = new ArrayList<>(files.size());
List<byte[]> bytes = new ArrayList<>(files.size());
for (File f : files) {
bytes.add(FileUtils.readFileToByteArray(f));
origPaths.add(f.toURI().toString());
}
return new FileBatch(bytes, origPaths);
} | java | public static FileBatch forFiles(List<File> files) throws IOException {
List<String> origPaths = new ArrayList<>(files.size());
List<byte[]> bytes = new ArrayList<>(files.size());
for (File f : files) {
bytes.add(FileUtils.readFileToByteArray(f));
origPaths.add(f.toURI().toString());
}
return new FileBatch(bytes, origPaths);
} | [
"public",
"static",
"FileBatch",
"forFiles",
"(",
"List",
"<",
"File",
">",
"files",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"origPaths",
"=",
"new",
"ArrayList",
"<>",
"(",
"files",
".",
"size",
"(",
")",
")",
";",
"List",
"<",
... | Create a FileBatch from the specified files
@param files Files to create the FileBatch from
@return The created FileBatch
@throws IOException If an error occurs during reading of the file content | [
"Create",
"a",
"FileBatch",
"from",
"the",
"specified",
"files"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/api/loader/FileBatch.java#L105-L113 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java | KnowledgeExchangeHandler.getBoolean | protected Boolean getBoolean(Exchange exchange, Message message, String name) {
Object value = getObject(exchange, message, name);
if (value instanceof Boolean) {
return (Boolean)value;
} else if (value instanceof String) {
return Boolean.valueOf(((String)value).trim());
}
return false;
} | java | protected Boolean getBoolean(Exchange exchange, Message message, String name) {
Object value = getObject(exchange, message, name);
if (value instanceof Boolean) {
return (Boolean)value;
} else if (value instanceof String) {
return Boolean.valueOf(((String)value).trim());
}
return false;
} | [
"protected",
"Boolean",
"getBoolean",
"(",
"Exchange",
"exchange",
",",
"Message",
"message",
",",
"String",
"name",
")",
"{",
"Object",
"value",
"=",
"getObject",
"(",
"exchange",
",",
"message",
",",
"name",
")",
";",
"if",
"(",
"value",
"instanceof",
"B... | Gets a Boolean context property.
@param exchange the exchange
@param message the message
@param name the name
@return the property | [
"Gets",
"a",
"Boolean",
"context",
"property",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java#L186-L194 |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/Utils.java | Utils.join | public static String join(String[] strings, String delimiter)
{
if (strings == null)
{
return null;
}
if (strings.length == 0)
{
return "";
}
boolean useDelimiter = (delimiter != null && delimiter.length() != 0);
StringBuilder sb = new StringBuilder();
for (String string : strings)
{
sb.append(string);
if (useDelimiter);
{
sb.append(delimiter);
}
}
if (useDelimiter && sb.length() != 0)
{
// Remove the last delimiter.
sb.setLength(sb.length() - delimiter.length());
}
return sb.toString();
} | java | public static String join(String[] strings, String delimiter)
{
if (strings == null)
{
return null;
}
if (strings.length == 0)
{
return "";
}
boolean useDelimiter = (delimiter != null && delimiter.length() != 0);
StringBuilder sb = new StringBuilder();
for (String string : strings)
{
sb.append(string);
if (useDelimiter);
{
sb.append(delimiter);
}
}
if (useDelimiter && sb.length() != 0)
{
// Remove the last delimiter.
sb.setLength(sb.length() - delimiter.length());
}
return sb.toString();
} | [
"public",
"static",
"String",
"join",
"(",
"String",
"[",
"]",
"strings",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"strings",
".",
"length",
"==",
"0",
")",
"{",
"ret... | Concatenate string with the specified delimiter.
@param strings
Strings to be concatenated.
@param delimiter
A delimiter used between strings. If {@code null} or an empty
string is given, delimiters are not inserted between strings.
@return
A concatenated string. If {@code strings} is {@code null},
{@code null} is returned. If the size of {@code strings} is 0,
an empty string is returned. | [
"Concatenate",
"string",
"with",
"the",
"specified",
"delimiter",
"."
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L53-L86 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/RadarChart.java | RadarChart.addSeries | public RadarSeries addSeries(String seriesName, double[] values, String[] tooltipOverrides) {
// Sanity checks
sanityCheck(seriesName, values, tooltipOverrides);
RadarSeries series = new RadarSeries(seriesName, values, tooltipOverrides);
seriesMap.put(seriesName, series);
return series;
} | java | public RadarSeries addSeries(String seriesName, double[] values, String[] tooltipOverrides) {
// Sanity checks
sanityCheck(seriesName, values, tooltipOverrides);
RadarSeries series = new RadarSeries(seriesName, values, tooltipOverrides);
seriesMap.put(seriesName, series);
return series;
} | [
"public",
"RadarSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"values",
",",
"String",
"[",
"]",
"tooltipOverrides",
")",
"{",
"// Sanity checks",
"sanityCheck",
"(",
"seriesName",
",",
"values",
",",
"tooltipOverrides",
")",
";",
... | Add a series for a Radar type chart
@param seriesName
@param values
@param tooltipOverrides
@return | [
"Add",
"a",
"series",
"for",
"a",
"Radar",
"type",
"chart"
] | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/RadarChart.java#L87-L97 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeLines | public static <T> File writeLines(Collection<T> list, String path, String charset, boolean isAppend) throws IORuntimeException {
return writeLines(list, file(path), charset, isAppend);
} | java | public static <T> File writeLines(Collection<T> list, String path, String charset, boolean isAppend) throws IORuntimeException {
return writeLines(list, file(path), charset, isAppend);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"writeLines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"String",
"path",
",",
"String",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"writeLines",
"(",
"list",
"... | 将列表写入文件
@param <T> 集合元素类型
@param list 列表
@param path 文件路径
@param charset 字符集
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"将列表写入文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3026-L3028 |
GII/broccoli | broccoli-impl/src/main/java/com/hi3project/broccoli/bsdl/impl/parsing/xml/BSDLXMLStAXParser.java | BSDLXMLStAXParser.processXMLEvent | private ISyntaxElement processXMLEvent(XMLEvent event, Stack<IElementParser> parsersStack) throws ModelException
{
for (IElementParser parser : parsers)
{
if (parser.canParse(event))
{
IElementParser newParser = parser.createNewInstance();
ISyntaxElement parsedElement = newParser.parse(event);
if (!parsersStack.empty())
{
parsersStack.peek().assignParsedElement(newParser.name(), parsedElement);
}
if (event.isStartElement())
{
parsersStack.push(newParser);
}
return parsedElement;
}
}
return null;
} | java | private ISyntaxElement processXMLEvent(XMLEvent event, Stack<IElementParser> parsersStack) throws ModelException
{
for (IElementParser parser : parsers)
{
if (parser.canParse(event))
{
IElementParser newParser = parser.createNewInstance();
ISyntaxElement parsedElement = newParser.parse(event);
if (!parsersStack.empty())
{
parsersStack.peek().assignParsedElement(newParser.name(), parsedElement);
}
if (event.isStartElement())
{
parsersStack.push(newParser);
}
return parsedElement;
}
}
return null;
} | [
"private",
"ISyntaxElement",
"processXMLEvent",
"(",
"XMLEvent",
"event",
",",
"Stack",
"<",
"IElementParser",
">",
"parsersStack",
")",
"throws",
"ModelException",
"{",
"for",
"(",
"IElementParser",
"parser",
":",
"parsers",
")",
"{",
"if",
"(",
"parser",
".",
... | /*
Parses an XMLEvent, delegating on the configured parsers.
The parsersStack is used to hold the ancestor elements whose properties or contained elements are being parsed. | [
"/",
"*",
"Parses",
"an",
"XMLEvent",
"delegating",
"on",
"the",
"configured",
"parsers",
".",
"The",
"parsersStack",
"is",
"used",
"to",
"hold",
"the",
"ancestor",
"elements",
"whose",
"properties",
"or",
"contained",
"elements",
"are",
"being",
"parsed",
"."... | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-impl/src/main/java/com/hi3project/broccoli/bsdl/impl/parsing/xml/BSDLXMLStAXParser.java#L135-L155 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONObject.java | JSONObject.setInternal | private JSONObject setInternal( String key, Object value, JsonConfig jsonConfig ) {
return _setInternal( key, processValue( key, value, jsonConfig ), jsonConfig );
} | java | private JSONObject setInternal( String key, Object value, JsonConfig jsonConfig ) {
return _setInternal( key, processValue( key, value, jsonConfig ), jsonConfig );
} | [
"private",
"JSONObject",
"setInternal",
"(",
"String",
"key",
",",
"Object",
"value",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"return",
"_setInternal",
"(",
"key",
",",
"processValue",
"(",
"key",
",",
"value",
",",
"jsonConfig",
")",
",",
"jsonConfig",
"... | Put a key/value pair in the JSONObject.
@param key A key string.
@param value An object which is the value. It should be of one of these
types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
String, or the JSONNull object.
@return this.
@throws JSONException If the value is non-finite number or if the key is
null. | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L2644-L2646 |
signit-wesign/java-sdk | src/main/java/cn/signit/sdk/util/HmacSignatureBuilder.java | HmacSignatureBuilder.isHashEquals | public boolean isHashEquals(byte[] expectedSignature, BuilderMode builderMode) {
final byte[] signature = build(builderMode);
return MessageDigest.isEqual(signature, expectedSignature);
} | java | public boolean isHashEquals(byte[] expectedSignature, BuilderMode builderMode) {
final byte[] signature = build(builderMode);
return MessageDigest.isEqual(signature, expectedSignature);
} | [
"public",
"boolean",
"isHashEquals",
"(",
"byte",
"[",
"]",
"expectedSignature",
",",
"BuilderMode",
"builderMode",
")",
"{",
"final",
"byte",
"[",
"]",
"signature",
"=",
"build",
"(",
"builderMode",
")",
";",
"return",
"MessageDigest",
".",
"isEqual",
"(",
... | 判断期望摘要是否与已构建的摘要相等.
@param expectedSignature
传入的期望摘要
@param builderMode
采用的构建模式
@return <code>true</code> - 期望摘要与已构建的摘要相等; <code>false</code> -
期望摘要与已构建的摘要不相等
@author zhd
@since 1.0.0 | [
"判断期望摘要是否与已构建的摘要相等",
"."
] | train | https://github.com/signit-wesign/java-sdk/blob/6f3196c9d444818a953396fdaa8ffed9794d9530/src/main/java/cn/signit/sdk/util/HmacSignatureBuilder.java#L680-L683 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/MemoryTreebank.java | MemoryTreebank.loadPath | @Override
public void loadPath(File path, FileFilter filt) {
FilePathProcessor.processPath(path, filt, this);
} | java | @Override
public void loadPath(File path, FileFilter filt) {
FilePathProcessor.processPath(path, filt, this);
} | [
"@",
"Override",
"public",
"void",
"loadPath",
"(",
"File",
"path",
",",
"FileFilter",
"filt",
")",
"{",
"FilePathProcessor",
".",
"processPath",
"(",
"path",
",",
"filt",
",",
"this",
")",
";",
"}"
] | Load trees from given directory.
@param path file or directory to load from
@param filt a FilenameFilter of files to load | [
"Load",
"trees",
"from",
"given",
"directory",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/MemoryTreebank.java#L148-L151 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/network/onlinkipv6prefix.java | onlinkipv6prefix.get | public static onlinkipv6prefix get(nitro_service service, String ipv6prefix) throws Exception{
onlinkipv6prefix obj = new onlinkipv6prefix();
obj.set_ipv6prefix(ipv6prefix);
onlinkipv6prefix response = (onlinkipv6prefix) obj.get_resource(service);
return response;
} | java | public static onlinkipv6prefix get(nitro_service service, String ipv6prefix) throws Exception{
onlinkipv6prefix obj = new onlinkipv6prefix();
obj.set_ipv6prefix(ipv6prefix);
onlinkipv6prefix response = (onlinkipv6prefix) obj.get_resource(service);
return response;
} | [
"public",
"static",
"onlinkipv6prefix",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"ipv6prefix",
")",
"throws",
"Exception",
"{",
"onlinkipv6prefix",
"obj",
"=",
"new",
"onlinkipv6prefix",
"(",
")",
";",
"obj",
".",
"set_ipv6prefix",
"(",
"ipv6prefix",... | Use this API to fetch onlinkipv6prefix resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"onlinkipv6prefix",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/network/onlinkipv6prefix.java#L432-L437 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java | SecurityDomainJBossASClient.createNewDatabaseServerSecurityDomain72 | public void createNewDatabaseServerSecurityDomain72(String securityDomainName, String dsJndiName,
String principalsQuery, String rolesQuery, String hashAlgorithm,
String hashEncoding) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
ModelNode addTopNode = createRequest(ADD, addr);
addTopNode.get(CACHE_TYPE).set("default");
Address authAddr = addr.clone().add(AUTHENTICATION, CLASSIC);
ModelNode addAuthNode = createRequest(ADD, authAddr);
// Create the login module in a separate step
Address loginAddr = authAddr.clone().add("login-module", "Database"); // name = code
ModelNode loginModule = createRequest(ADD, loginAddr); //addAuthNode.get(LOGIN_MODULES);
loginModule.get(CODE).set("Database");
loginModule.get(FLAG).set("required");
ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
moduleOptions.setEmptyList();
moduleOptions.add(DS_JNDI_NAME, dsJndiName);
moduleOptions.add(PRINCIPALS_QUERY, principalsQuery);
moduleOptions.add(ROLES_QUERY, rolesQuery);
moduleOptions.add(HASH_ALGORITHM, (null == hashAlgorithm ? "MD5" : hashAlgorithm));
moduleOptions.add(HASH_ENCODING, (null == hashEncoding ? "base64" : hashEncoding));
ModelNode batch = createBatchRequest(addTopNode, addAuthNode, loginModule);
ModelNode results = execute(batch);
if (!isSuccess(results)) {
throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]");
}
return;
} | java | public void createNewDatabaseServerSecurityDomain72(String securityDomainName, String dsJndiName,
String principalsQuery, String rolesQuery, String hashAlgorithm,
String hashEncoding) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
ModelNode addTopNode = createRequest(ADD, addr);
addTopNode.get(CACHE_TYPE).set("default");
Address authAddr = addr.clone().add(AUTHENTICATION, CLASSIC);
ModelNode addAuthNode = createRequest(ADD, authAddr);
// Create the login module in a separate step
Address loginAddr = authAddr.clone().add("login-module", "Database"); // name = code
ModelNode loginModule = createRequest(ADD, loginAddr); //addAuthNode.get(LOGIN_MODULES);
loginModule.get(CODE).set("Database");
loginModule.get(FLAG).set("required");
ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
moduleOptions.setEmptyList();
moduleOptions.add(DS_JNDI_NAME, dsJndiName);
moduleOptions.add(PRINCIPALS_QUERY, principalsQuery);
moduleOptions.add(ROLES_QUERY, rolesQuery);
moduleOptions.add(HASH_ALGORITHM, (null == hashAlgorithm ? "MD5" : hashAlgorithm));
moduleOptions.add(HASH_ENCODING, (null == hashEncoding ? "base64" : hashEncoding));
ModelNode batch = createBatchRequest(addTopNode, addAuthNode, loginModule);
ModelNode results = execute(batch);
if (!isSuccess(results)) {
throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]");
}
return;
} | [
"public",
"void",
"createNewDatabaseServerSecurityDomain72",
"(",
"String",
"securityDomainName",
",",
"String",
"dsJndiName",
",",
"String",
"principalsQuery",
",",
"String",
"rolesQuery",
",",
"String",
"hashAlgorithm",
",",
"String",
"hashEncoding",
")",
"throws",
"E... | Create a new security domain using the database server authentication method.
This is used when you want to directly authenticate against a db entry.
This is for AS 7.2+ (e.g. EAP 6.1) and works around https://issues.jboss.org/browse/AS7-6527
@param securityDomainName the name of the new security domain
@param dsJndiName the jndi name for the datasource to query against
@param principalsQuery the SQL query for selecting password info for a principal
@param rolesQuery the SQL query for selecting role info for a principal
@param hashAlgorithm if null defaults to "MD5"
@param hashEncoding if null defaults to "base64"
@throws Exception if failed to create security domain | [
"Create",
"a",
"new",
"security",
"domain",
"using",
"the",
"database",
"server",
"authentication",
"method",
".",
"This",
"is",
"used",
"when",
"you",
"want",
"to",
"directly",
"authenticate",
"against",
"a",
"db",
"entry",
".",
"This",
"is",
"for",
"AS",
... | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L207-L238 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_localSeo_account_GET | public ArrayList<Long> serviceName_localSeo_account_GET(String serviceName, String email) throws IOException {
String qPath = "/hosting/web/{serviceName}/localSeo/account";
StringBuilder sb = path(qPath, serviceName);
query(sb, "email", email);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Long> serviceName_localSeo_account_GET(String serviceName, String email) throws IOException {
String qPath = "/hosting/web/{serviceName}/localSeo/account";
StringBuilder sb = path(qPath, serviceName);
query(sb, "email", email);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_localSeo_account_GET",
"(",
"String",
"serviceName",
",",
"String",
"email",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/localSeo/account\"",
";",
"StringBuilder",
"sb",
"... | Local SEO accounts associated to the hosting
REST: GET /hosting/web/{serviceName}/localSeo/account
@param email [required] Filter the value of email property (like)
@param serviceName [required] The internal name of your hosting | [
"Local",
"SEO",
"accounts",
"associated",
"to",
"the",
"hosting"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L880-L886 |
intellimate/Izou | src/main/java/org/intellimate/izou/output/OutputManager.java | OutputManager.getAssociatedOutputExtension | public List<Identification> getAssociatedOutputExtension(OutputPluginModel<?, ?> outputPlugin) {
IdentifiableSet<OutputExtensionModel<?, ?>> outputExtensions = this.outputExtensions.get(outputPlugin.getID());
IdentificationManagerM identificationManager = IdentificationManager.getInstance();
return filterType(outputExtensions, outputPlugin).stream()
.map(identificationManager::getIdentification)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
} | java | public List<Identification> getAssociatedOutputExtension(OutputPluginModel<?, ?> outputPlugin) {
IdentifiableSet<OutputExtensionModel<?, ?>> outputExtensions = this.outputExtensions.get(outputPlugin.getID());
IdentificationManagerM identificationManager = IdentificationManager.getInstance();
return filterType(outputExtensions, outputPlugin).stream()
.map(identificationManager::getIdentification)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
} | [
"public",
"List",
"<",
"Identification",
">",
"getAssociatedOutputExtension",
"(",
"OutputPluginModel",
"<",
"?",
",",
"?",
">",
"outputPlugin",
")",
"{",
"IdentifiableSet",
"<",
"OutputExtensionModel",
"<",
"?",
",",
"?",
">",
">",
"outputExtensions",
"=",
"thi... | returns all the associated OutputExtensions
@param outputPlugin the OutputPlugin to search for
@return a List of Identifications | [
"returns",
"all",
"the",
"associated",
"OutputExtensions"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/output/OutputManager.java#L210-L218 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/JsonMappers.java | JsonMappers.registerLegacyCustomClassesForJSON | public static void registerLegacyCustomClassesForJSON(List<Pair<String,Class>> classes){
for(Pair<String,Class> p : classes){
String s = p.getFirst();
Class c = p.getRight();
//Check if it's a valid class to register...
boolean found = false;
for( Class<?> c2 : REGISTERABLE_CUSTOM_CLASSES){
if(c2.isAssignableFrom(c)){
Map<String,String> map = LegacyMappingHelper.legacyMappingForClass(c2);
map.put(p.getFirst(), p.getSecond().getName());
found = true;
}
}
if(!found){
throw new IllegalArgumentException("Cannot register class for legacy JSON deserialization: class " +
c.getName() + " is not a subtype of classes " + REGISTERABLE_CUSTOM_CLASSES);
}
}
} | java | public static void registerLegacyCustomClassesForJSON(List<Pair<String,Class>> classes){
for(Pair<String,Class> p : classes){
String s = p.getFirst();
Class c = p.getRight();
//Check if it's a valid class to register...
boolean found = false;
for( Class<?> c2 : REGISTERABLE_CUSTOM_CLASSES){
if(c2.isAssignableFrom(c)){
Map<String,String> map = LegacyMappingHelper.legacyMappingForClass(c2);
map.put(p.getFirst(), p.getSecond().getName());
found = true;
}
}
if(!found){
throw new IllegalArgumentException("Cannot register class for legacy JSON deserialization: class " +
c.getName() + " is not a subtype of classes " + REGISTERABLE_CUSTOM_CLASSES);
}
}
} | [
"public",
"static",
"void",
"registerLegacyCustomClassesForJSON",
"(",
"List",
"<",
"Pair",
"<",
"String",
",",
"Class",
">",
">",
"classes",
")",
"{",
"for",
"(",
"Pair",
"<",
"String",
",",
"Class",
">",
"p",
":",
"classes",
")",
"{",
"String",
"s",
... | Register a set of classes (Layer, GraphVertex, InputPreProcessor, IActivation, ILossFunction, ReconstructionDistribution
ONLY) for JSON deserialization, with custom names.<br>
Using this method directly should never be required (instead: use {@link #registerLegacyCustomClassesForJSON(Class[])}
but is added in case it is required in non-standard circumstances. | [
"Register",
"a",
"set",
"of",
"classes",
"(",
"Layer",
"GraphVertex",
"InputPreProcessor",
"IActivation",
"ILossFunction",
"ReconstructionDistribution",
"ONLY",
")",
"for",
"JSON",
"deserialization",
"with",
"custom",
"names",
".",
"<br",
">",
"Using",
"this",
"meth... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/JsonMappers.java#L160-L179 |
Impetus/Kundera | src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java | HibernateClient.getQueryInstance | public SQLQuery getQueryInstance(String nativeQuery, EntityMetadata m)
{
s = getStatelessSession();
SQLQuery q = s.createSQLQuery(nativeQuery).addEntity(m.getEntityClazz());
List<String> relations = m.getRelationNames();
if (relations != null)
{
for (String r : relations)
{
Relation rel = m.getRelation(m.getFieldName(r));
String name = MetadataUtils.getMappedName(m, m.getRelation(r), kunderaMetadata);
if (!((AbstractAttribute) m.getIdAttribute()).getJPAColumnName().equalsIgnoreCase(
name != null ? name : r)
&& rel != null
&& !rel.getProperty().isAnnotationPresent(ManyToMany.class)
&& !rel.getProperty().isAnnotationPresent(OneToMany.class)
&& (rel.getProperty().isAnnotationPresent(OneToOne.class)
&& StringUtils.isBlank(rel.getMappedBy()) || rel.getProperty().isAnnotationPresent(
ManyToOne.class)))
{
q.addScalar(name != null ? name : r);
}
}
}
return q;
} | java | public SQLQuery getQueryInstance(String nativeQuery, EntityMetadata m)
{
s = getStatelessSession();
SQLQuery q = s.createSQLQuery(nativeQuery).addEntity(m.getEntityClazz());
List<String> relations = m.getRelationNames();
if (relations != null)
{
for (String r : relations)
{
Relation rel = m.getRelation(m.getFieldName(r));
String name = MetadataUtils.getMappedName(m, m.getRelation(r), kunderaMetadata);
if (!((AbstractAttribute) m.getIdAttribute()).getJPAColumnName().equalsIgnoreCase(
name != null ? name : r)
&& rel != null
&& !rel.getProperty().isAnnotationPresent(ManyToMany.class)
&& !rel.getProperty().isAnnotationPresent(OneToMany.class)
&& (rel.getProperty().isAnnotationPresent(OneToOne.class)
&& StringUtils.isBlank(rel.getMappedBy()) || rel.getProperty().isAnnotationPresent(
ManyToOne.class)))
{
q.addScalar(name != null ? name : r);
}
}
}
return q;
} | [
"public",
"SQLQuery",
"getQueryInstance",
"(",
"String",
"nativeQuery",
",",
"EntityMetadata",
"m",
")",
"{",
"s",
"=",
"getStatelessSession",
"(",
")",
";",
"SQLQuery",
"q",
"=",
"s",
".",
"createSQLQuery",
"(",
"nativeQuery",
")",
".",
"addEntity",
"(",
"m... | Gets the query instance.
@param nativeQuery
the native query
@param m
the m
@return the query instance | [
"Gets",
"the",
"query",
"instance",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L675-L702 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/ClutoSparseMatrixBuilder.java | ClutoSparseMatrixBuilder.finish | public synchronized void finish() {
if (!isFinished) {
isFinished = true;
try {
writer.close();
// Re-open as a random access file so we can overwrite the 3 int
// header that specifies the number of dimensions and values.
// Note that the location of the matrix data is dependent on
// whether the matrix is to be transposed.
RandomAccessFile matrixRaf =
new RandomAccessFile(matrixFile, "rw");
// Write the header in the first 100 characters. The header is
// the number rows, the number of columns, and the number of non
// zeros on a single line with spaces between them.
StringBuilder sb = new StringBuilder();
sb.append(curRow).append(" ");
sb.append(numCols).append(" ");
sb.append(nonZeroValues).append(" ");
matrixRaf.write(sb.toString().getBytes());
} catch (IOException ioe) {
throw new IOError(ioe);
}
}
} | java | public synchronized void finish() {
if (!isFinished) {
isFinished = true;
try {
writer.close();
// Re-open as a random access file so we can overwrite the 3 int
// header that specifies the number of dimensions and values.
// Note that the location of the matrix data is dependent on
// whether the matrix is to be transposed.
RandomAccessFile matrixRaf =
new RandomAccessFile(matrixFile, "rw");
// Write the header in the first 100 characters. The header is
// the number rows, the number of columns, and the number of non
// zeros on a single line with spaces between them.
StringBuilder sb = new StringBuilder();
sb.append(curRow).append(" ");
sb.append(numCols).append(" ");
sb.append(nonZeroValues).append(" ");
matrixRaf.write(sb.toString().getBytes());
} catch (IOException ioe) {
throw new IOError(ioe);
}
}
} | [
"public",
"synchronized",
"void",
"finish",
"(",
")",
"{",
"if",
"(",
"!",
"isFinished",
")",
"{",
"isFinished",
"=",
"true",
";",
"try",
"{",
"writer",
".",
"close",
"(",
")",
";",
"// Re-open as a random access file so we can overwrite the 3 int",
"// header tha... | {@inheritDoc} Once this method has been called, any subsequent calls will
have no effect and will not throw an exception. | [
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/ClutoSparseMatrixBuilder.java#L260-L284 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/annotation/AnnotationMetadataWriter.java | AnnotationMetadataWriter.pushAnnotationAttributes | @Internal
private static void pushAnnotationAttributes(Type declaringType, ClassVisitor declaringClassWriter, GeneratorAdapter generatorAdapter, Map<? extends CharSequence, Object> annotationData, Map<String, GeneratorAdapter> loadTypeMethods) {
int totalSize = annotationData.size() * 2;
// start a new array
pushNewArray(generatorAdapter, Object.class, totalSize);
int i = 0;
for (Map.Entry<? extends CharSequence, Object> entry : annotationData.entrySet()) {
// use the property name as the key
String memberName = entry.getKey().toString();
pushStoreStringInArray(generatorAdapter, i++, totalSize, memberName);
// use the property type as the value
Object value = entry.getValue();
pushStoreInArray(generatorAdapter, i++, totalSize, () ->
pushValue(declaringType, declaringClassWriter, generatorAdapter, value, loadTypeMethods)
);
}
// invoke the AbstractBeanDefinition.createMap method
generatorAdapter.invokeStatic(Type.getType(AnnotationUtil.class), METHOD_MAP_OF);
} | java | @Internal
private static void pushAnnotationAttributes(Type declaringType, ClassVisitor declaringClassWriter, GeneratorAdapter generatorAdapter, Map<? extends CharSequence, Object> annotationData, Map<String, GeneratorAdapter> loadTypeMethods) {
int totalSize = annotationData.size() * 2;
// start a new array
pushNewArray(generatorAdapter, Object.class, totalSize);
int i = 0;
for (Map.Entry<? extends CharSequence, Object> entry : annotationData.entrySet()) {
// use the property name as the key
String memberName = entry.getKey().toString();
pushStoreStringInArray(generatorAdapter, i++, totalSize, memberName);
// use the property type as the value
Object value = entry.getValue();
pushStoreInArray(generatorAdapter, i++, totalSize, () ->
pushValue(declaringType, declaringClassWriter, generatorAdapter, value, loadTypeMethods)
);
}
// invoke the AbstractBeanDefinition.createMap method
generatorAdapter.invokeStatic(Type.getType(AnnotationUtil.class), METHOD_MAP_OF);
} | [
"@",
"Internal",
"private",
"static",
"void",
"pushAnnotationAttributes",
"(",
"Type",
"declaringType",
",",
"ClassVisitor",
"declaringClassWriter",
",",
"GeneratorAdapter",
"generatorAdapter",
",",
"Map",
"<",
"?",
"extends",
"CharSequence",
",",
"Object",
">",
"anno... | Writes annotation attributes to the given generator.
@param declaringClassWriter The declaring class
@param generatorAdapter The generator adapter
@param annotationData The annotation data
@param loadTypeMethods Generated methods that load types | [
"Writes",
"annotation",
"attributes",
"to",
"the",
"given",
"generator",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/AnnotationMetadataWriter.java#L228-L246 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/source/workunit/ExtractFactory.java | ExtractFactory.getUniqueExtract | public synchronized Extract getUniqueExtract(TableType type, String namespace, String table) {
Extract newExtract = new Extract(type, namespace, table);
while (this.createdInstances.contains(newExtract)) {
if (Strings.isNullOrEmpty(newExtract.getExtractId())) {
newExtract.setExtractId(this.dtf.print(new DateTime()));
} else {
DateTime extractDateTime = this.dtf.parseDateTime(newExtract.getExtractId());
newExtract.setExtractId(this.dtf.print(extractDateTime.plusSeconds(1)));
}
}
this.createdInstances.add(newExtract);
return newExtract;
} | java | public synchronized Extract getUniqueExtract(TableType type, String namespace, String table) {
Extract newExtract = new Extract(type, namespace, table);
while (this.createdInstances.contains(newExtract)) {
if (Strings.isNullOrEmpty(newExtract.getExtractId())) {
newExtract.setExtractId(this.dtf.print(new DateTime()));
} else {
DateTime extractDateTime = this.dtf.parseDateTime(newExtract.getExtractId());
newExtract.setExtractId(this.dtf.print(extractDateTime.plusSeconds(1)));
}
}
this.createdInstances.add(newExtract);
return newExtract;
} | [
"public",
"synchronized",
"Extract",
"getUniqueExtract",
"(",
"TableType",
"type",
",",
"String",
"namespace",
",",
"String",
"table",
")",
"{",
"Extract",
"newExtract",
"=",
"new",
"Extract",
"(",
"type",
",",
"namespace",
",",
"table",
")",
";",
"while",
"... | Returns a unique {@link Extract} instance.
Any two calls of this method from the same {@link ExtractFactory} instance guarantees to
return {@link Extract}s with different IDs.
@param type {@link TableType}
@param namespace dot separated namespace path
@param table table name
@return a unique {@link Extract} instance | [
"Returns",
"a",
"unique",
"{",
"@link",
"Extract",
"}",
"instance",
".",
"Any",
"two",
"calls",
"of",
"this",
"method",
"from",
"the",
"same",
"{",
"@link",
"ExtractFactory",
"}",
"instance",
"guarantees",
"to",
"return",
"{",
"@link",
"Extract",
"}",
"s",... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/source/workunit/ExtractFactory.java#L53-L65 |
h2oai/h2o-2 | src/main/java/water/fvec/ParseDataset2.java | ParseProgress.make | static ParseProgress make( Key[] fkeys ) {
long total = 0;
for( Key fkey : fkeys )
total += getVec(fkey).length();
return new ParseProgress(0,total);
} | java | static ParseProgress make( Key[] fkeys ) {
long total = 0;
for( Key fkey : fkeys )
total += getVec(fkey).length();
return new ParseProgress(0,total);
} | [
"static",
"ParseProgress",
"make",
"(",
"Key",
"[",
"]",
"fkeys",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"Key",
"fkey",
":",
"fkeys",
")",
"total",
"+=",
"getVec",
"(",
"fkey",
")",
".",
"length",
"(",
")",
";",
"return",
"new",
"P... | Total number of steps is equal to total bytecount across files | [
"Total",
"number",
"of",
"steps",
"is",
"equal",
"to",
"total",
"bytecount",
"across",
"files"
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/ParseDataset2.java#L159-L164 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuStreamWaitValue32 | public static int cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, int value, int flags)
{
return checkResult(cuStreamWaitValue32Native(stream, addr, value, flags));
} | java | public static int cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, int value, int flags)
{
return checkResult(cuStreamWaitValue32Native(stream, addr, value, flags));
} | [
"public",
"static",
"int",
"cuStreamWaitValue32",
"(",
"CUstream",
"stream",
",",
"CUdeviceptr",
"addr",
",",
"int",
"value",
",",
"int",
"flags",
")",
"{",
"return",
"checkResult",
"(",
"cuStreamWaitValue32Native",
"(",
"stream",
",",
"addr",
",",
"value",
",... | Wait on a memory location.<br>
<br>
Enqueues a synchronization of the stream on the given memory location.
Work ordered after the operation will block until the given condition on
the memory is satisfied. By default, the condition is to wait for
(int32_t)(*addr - value) >= 0, a cyclic greater-or-equal. Other condition
types can be specified via flags.<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 cuDeviceGetAttributes().
@param stream The stream to synchronize on the memory location.
@param addr The memory location to wait on.
@param value The value to compare with the memory location.
@param flags See {@link CUstreamWaitValue_flags}
@return CUDA_SUCCESS, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_SUPPORTED
@see JCudaDriver#cuStreamWriteValue32
@see JCudaDriver#cuStreamBatchMemOp
@see JCudaDriver#cuMemHostRegister
@see JCudaDriver#cuStreamWaitEvent | [
"Wait",
"on",
"a",
"memory",
"location",
".",
"<br",
">",
"<br",
">",
"Enqueues",
"a",
"synchronization",
"of",
"the",
"stream",
"on",
"the",
"given",
"memory",
"location",
".",
"Work",
"ordered",
"after",
"the",
"operation",
"will",
"block",
"until",
"the... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L13691-L13694 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java | SSLUtils.getSSLEngine | public static SSLEngine getSSLEngine(SSLContext context, FlowType type, SSLLinkConfig config, SSLConnectionLink connLink) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getSSLEngine");
}
// Create a new SSL engine for this connection.
SSLEngine engine = context.createSSLEngine();
configureEngine(engine, type, config, connLink);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getSSLEngine, hc=" + engine.hashCode());
}
return engine;
} | java | public static SSLEngine getSSLEngine(SSLContext context, FlowType type, SSLLinkConfig config, SSLConnectionLink connLink) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getSSLEngine");
}
// Create a new SSL engine for this connection.
SSLEngine engine = context.createSSLEngine();
configureEngine(engine, type, config, connLink);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getSSLEngine, hc=" + engine.hashCode());
}
return engine;
} | [
"public",
"static",
"SSLEngine",
"getSSLEngine",
"(",
"SSLContext",
"context",
",",
"FlowType",
"type",
",",
"SSLLinkConfig",
"config",
",",
"SSLConnectionLink",
"connLink",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
... | Setup the SSL engine for the given context.
@param context used to build the engine
@param type to determine if connection is inbound or outbound
@param config SSL channel configuration
@param connLink
@return SSLEngine | [
"Setup",
"the",
"SSL",
"engine",
"for",
"the",
"given",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java#L1156-L1168 |
bekkopen/NoCommons | src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java | FodselsnummerCalculator.getManyDNumberFodselsnummerForDate | public static List<Fodselsnummer> getManyDNumberFodselsnummerForDate(Date date) {
if (date == null) {
throw new IllegalArgumentException();
}
DateFormat df = new SimpleDateFormat("ddMMyy");
String centuryString = getCentury(date);
String dateString = df.format(date);
dateString = new StringBuilder()
.append(Character.toChars(dateString.charAt(0) + 4)[0])
.append(dateString.substring(1))
.toString();
return generateFodselsnummerForDate(dateString, centuryString);
} | java | public static List<Fodselsnummer> getManyDNumberFodselsnummerForDate(Date date) {
if (date == null) {
throw new IllegalArgumentException();
}
DateFormat df = new SimpleDateFormat("ddMMyy");
String centuryString = getCentury(date);
String dateString = df.format(date);
dateString = new StringBuilder()
.append(Character.toChars(dateString.charAt(0) + 4)[0])
.append(dateString.substring(1))
.toString();
return generateFodselsnummerForDate(dateString, centuryString);
} | [
"public",
"static",
"List",
"<",
"Fodselsnummer",
">",
"getManyDNumberFodselsnummerForDate",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"DateFormat",
"df",
"=",
"n... | Returns a List with with VALID DNumber Fodselsnummer instances for a given Date.
@param date The Date instance
@return A List with Fodelsnummer instances | [
"Returns",
"a",
"List",
"with",
"with",
"VALID",
"DNumber",
"Fodselsnummer",
"instances",
"for",
"a",
"given",
"Date",
"."
] | train | https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java#L41-L53 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInternalContext.java | RpcInternalContext.setLocalAddress | @Deprecated
public RpcInternalContext setLocalAddress(String host, int port) {
if (host == null) {
return this;
}
if (port < 0 || port > 0xFFFF) {
port = 0;
}
// 提前检查是否为空,防止createUnresolved抛出异常,损耗性能
this.localAddress = InetSocketAddress.createUnresolved(host, port);
return this;
} | java | @Deprecated
public RpcInternalContext setLocalAddress(String host, int port) {
if (host == null) {
return this;
}
if (port < 0 || port > 0xFFFF) {
port = 0;
}
// 提前检查是否为空,防止createUnresolved抛出异常,损耗性能
this.localAddress = InetSocketAddress.createUnresolved(host, port);
return this;
} | [
"@",
"Deprecated",
"public",
"RpcInternalContext",
"setLocalAddress",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"port",
"<",
"0",
"||",
"port",
">",
"0xFFFF",
... | set local address.
@param host the host
@param port the port
@return context local address | [
"set",
"local",
"address",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInternalContext.java#L255-L266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.