repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EventDimensions.java | EventDimensions.withAttributes | public EventDimensions withAttributes(java.util.Map<String, AttributeDimension> attributes) {
setAttributes(attributes);
return this;
} | java | public EventDimensions withAttributes(java.util.Map<String, AttributeDimension> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"EventDimensions",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeDimension",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | Custom attributes that your app reports to Amazon Pinpoint. You can use these attributes as selection criteria
when you create an event filter.
@param attributes
Custom attributes that your app reports to Amazon Pinpoint. You can use these attributes as selection
criteria when you create an event filter.
@return Returns a reference to this object so that method calls can be chained together. | [
"Custom",
"attributes",
"that",
"your",
"app",
"reports",
"to",
"Amazon",
"Pinpoint",
".",
"You",
"can",
"use",
"these",
"attributes",
"as",
"selection",
"criteria",
"when",
"you",
"create",
"an",
"event",
"filter",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EventDimensions.java#L80-L83 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.enumDeclaration | protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(ENUM);
Name name = ident();
List<JCExpression> implementing = List.nil();
if (token.kind == IMPLEMENTS) {
nextToken();
implementing = typeList();
}
List<JCTree> defs = enumBody(name);
mods.flags |= Flags.ENUM;
JCClassDecl result = toP(F.at(pos).
ClassDef(mods, name, List.nil(),
null, implementing, defs));
attach(result, dc);
return result;
} | java | protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
int pos = token.pos;
accept(ENUM);
Name name = ident();
List<JCExpression> implementing = List.nil();
if (token.kind == IMPLEMENTS) {
nextToken();
implementing = typeList();
}
List<JCTree> defs = enumBody(name);
mods.flags |= Flags.ENUM;
JCClassDecl result = toP(F.at(pos).
ClassDef(mods, name, List.nil(),
null, implementing, defs));
attach(result, dc);
return result;
} | [
"protected",
"JCClassDecl",
"enumDeclaration",
"(",
"JCModifiers",
"mods",
",",
"Comment",
"dc",
")",
"{",
"int",
"pos",
"=",
"token",
".",
"pos",
";",
"accept",
"(",
"ENUM",
")",
";",
"Name",
"name",
"=",
"ident",
"(",
")",
";",
"List",
"<",
"JCExpres... | EnumDeclaration = ENUM Ident [IMPLEMENTS TypeList] EnumBody
@param mods The modifiers starting the enum declaration
@param dc The documentation comment for the enum, or null. | [
"EnumDeclaration",
"=",
"ENUM",
"Ident",
"[",
"IMPLEMENTS",
"TypeList",
"]",
"EnumBody"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3433-L3451 |
rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.annotationTypeMatches | public static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node) {
if (node.getKind() != Kind.ANNOTATION) return false;
return typeMatches(type, node, ((JCAnnotation) node.get()).annotationType);
} | java | public static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node) {
if (node.getKind() != Kind.ANNOTATION) return false;
return typeMatches(type, node, ((JCAnnotation) node.get()).annotationType);
} | [
"public",
"static",
"boolean",
"annotationTypeMatches",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"type",
",",
"JavacNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getKind",
"(",
")",
"!=",
"Kind",
".",
"ANNOTATION",
")",
"return",
"false",
... | Checks if the Annotation AST Node provided is likely to be an instance of the provided annotation type.
@param type An actual annotation type, such as {@code lombok.Getter.class}.
@param node A Lombok AST node representing an annotation in source code. | [
"Checks",
"if",
"the",
"Annotation",
"AST",
"Node",
"provided",
"is",
"likely",
"to",
"be",
"an",
"instance",
"of",
"the",
"provided",
"annotation",
"type",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L268-L271 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java | XBaseGridScreen.printStartGridScreenData | public int printStartGridScreenData(PrintWriter out, int iPrintOptions)
{
out.println(Utility.startTag(XMLTags.DATA));
return iPrintOptions;
} | java | public int printStartGridScreenData(PrintWriter out, int iPrintOptions)
{
out.println(Utility.startTag(XMLTags.DATA));
return iPrintOptions;
} | [
"public",
"int",
"printStartGridScreenData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"out",
".",
"println",
"(",
"Utility",
".",
"startTag",
"(",
"XMLTags",
".",
"DATA",
")",
")",
";",
"return",
"iPrintOptions",
";",
"}"
] | Display the start grid in input format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Display",
"the",
"start",
"grid",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java#L146-L150 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXPointer.java | MMAXPointer.setTargetList | public void setTargetList(int i, MMAXAnnotation v) {
if (MMAXPointer_Type.featOkTst && ((MMAXPointer_Type)jcasType).casFeat_targetList == null)
jcasType.jcas.throwFeatMissing("targetList", "de.julielab.jules.types.mmax.MMAXPointer");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXPointer_Type)jcasType).casFeatCode_targetList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXPointer_Type)jcasType).casFeatCode_targetList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setTargetList(int i, MMAXAnnotation v) {
if (MMAXPointer_Type.featOkTst && ((MMAXPointer_Type)jcasType).casFeat_targetList == null)
jcasType.jcas.throwFeatMissing("targetList", "de.julielab.jules.types.mmax.MMAXPointer");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXPointer_Type)jcasType).casFeatCode_targetList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXPointer_Type)jcasType).casFeatCode_targetList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setTargetList",
"(",
"int",
"i",
",",
"MMAXAnnotation",
"v",
")",
"{",
"if",
"(",
"MMAXPointer_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"MMAXPointer_Type",
")",
"jcasType",
")",
".",
"casFeat_targetList",
"==",
"null",
")",
"jcasType",
"."... | indexed setter for targetList - sets an indexed value - The MMAX annotations the pointer points at.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"targetList",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"The",
"MMAX",
"annotations",
"the",
"pointer",
"points",
"at",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXPointer.java#L139-L143 |
mnlipp/jgrapes | org.jgrapes.io/src/org/jgrapes/io/FileStorage.java | FileStorage.onClose | @Handler
public void onClose(Close event, Channel channel)
throws InterruptedException {
Writer writer = inputWriters.get(channel);
if (writer != null) {
writer.close(event);
}
writer = outputWriters.get(channel);
if (writer != null) {
writer.close(event);
}
} | java | @Handler
public void onClose(Close event, Channel channel)
throws InterruptedException {
Writer writer = inputWriters.get(channel);
if (writer != null) {
writer.close(event);
}
writer = outputWriters.get(channel);
if (writer != null) {
writer.close(event);
}
} | [
"@",
"Handler",
"public",
"void",
"onClose",
"(",
"Close",
"event",
",",
"Channel",
"channel",
")",
"throws",
"InterruptedException",
"{",
"Writer",
"writer",
"=",
"inputWriters",
".",
"get",
"(",
"channel",
")",
";",
"if",
"(",
"writer",
"!=",
"null",
")"... | Handle close by closing the file associated with the channel.
@param event the event
@param channel the channel
@throws InterruptedException the interrupted exception | [
"Handle",
"close",
"by",
"closing",
"the",
"file",
"associated",
"with",
"the",
"channel",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/io/FileStorage.java#L383-L394 |
XiaoMi/galaxy-fds-sdk-java | src/main/java/com/xiaomi/infra/galaxy/fds/client/GalaxyFDSClient.java | GalaxyFDSClient.getObject | @Override
public FDSObject getObject(String bucketName, String objectName, long pos)
throws GalaxyFDSClientException {
return this.getObject(bucketName, objectName, null, pos);
} | java | @Override
public FDSObject getObject(String bucketName, String objectName, long pos)
throws GalaxyFDSClientException {
return this.getObject(bucketName, objectName, null, pos);
} | [
"@",
"Override",
"public",
"FDSObject",
"getObject",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"long",
"pos",
")",
"throws",
"GalaxyFDSClientException",
"{",
"return",
"this",
".",
"getObject",
"(",
"bucketName",
",",
"objectName",
",",
"nul... | range mode for getobject while not be autoReConnection
@param bucketName The name of the bucket where the object stores
@param objectName The name of the object to get
@param pos The position to start read
@return
@throws GalaxyFDSClientException | [
"range",
"mode",
"for",
"getobject",
"while",
"not",
"be",
"autoReConnection"
] | train | https://github.com/XiaoMi/galaxy-fds-sdk-java/blob/5e93bc2b574dfa51e47451a0efa80c018ff2c48f/src/main/java/com/xiaomi/infra/galaxy/fds/client/GalaxyFDSClient.java#L1177-L1181 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.likePattern | public ZealotKhala likePattern(String field, String pattern) {
return this.doLikePattern(ZealotConst.ONE_SPACE, field, pattern, true, true);
} | java | public ZealotKhala likePattern(String field, String pattern) {
return this.doLikePattern(ZealotConst.ONE_SPACE, field, pattern, true, true);
} | [
"public",
"ZealotKhala",
"likePattern",
"(",
"String",
"field",
",",
"String",
"pattern",
")",
"{",
"return",
"this",
".",
"doLikePattern",
"(",
"ZealotConst",
".",
"ONE_SPACE",
",",
"field",
",",
"pattern",
",",
"true",
",",
"true",
")",
";",
"}"
] | 根据指定的模式字符串生成like模糊查询的SQL片段.
<p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" b.title LIKE 'Java%' "</p>
@param field 数据库字段
@param pattern 模式字符串
@return ZealotKhala实例 | [
"根据指定的模式字符串生成like模糊查询的SQL片段",
".",
"<p",
">",
"示例:传入",
"{",
"b",
".",
"title",
"Java%",
"}",
"两个参数,生成的SQL片段为:",
"b",
".",
"title",
"LIKE",
"Java%",
"<",
"/",
"p",
">"
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1040-L1042 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.deleteExplicitListItem | public OperationStatus deleteExplicitListItem(UUID appId, String versionId, UUID entityId, long itemId) {
return deleteExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId).toBlocking().single().body();
} | java | public OperationStatus deleteExplicitListItem(UUID appId, String versionId, UUID entityId, long itemId) {
return deleteExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"deleteExplicitListItem",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"long",
"itemId",
")",
"{",
"return",
"deleteExplicitListItemWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityI... | Delete the explicit list item from the Pattern.any explicit list.
@param appId The application ID.
@param versionId The version ID.
@param entityId The pattern.any entity id.
@param itemId The explicit list item which will be deleted.
@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 OperationStatus object if successful. | [
"Delete",
"the",
"explicit",
"list",
"item",
"from",
"the",
"Pattern",
".",
"any",
"explicit",
"list",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L14262-L14264 |
threerings/nenya | core/src/main/java/com/threerings/media/tile/TileManager.java | TileManager.loadTileSet | public UniformTileSet loadTileSet (String rset, String imgPath, int width, int height)
{
return loadTileSet(getImageProvider(rset), rset, imgPath, width, height);
} | java | public UniformTileSet loadTileSet (String rset, String imgPath, int width, int height)
{
return loadTileSet(getImageProvider(rset), rset, imgPath, width, height);
} | [
"public",
"UniformTileSet",
"loadTileSet",
"(",
"String",
"rset",
",",
"String",
"imgPath",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"return",
"loadTileSet",
"(",
"getImageProvider",
"(",
"rset",
")",
",",
"rset",
",",
"imgPath",
",",
"width",
... | Loads up a tileset from the specified image (located in the specified resource set) with
the specified metadata parameters. | [
"Loads",
"up",
"a",
"tileset",
"from",
"the",
"specified",
"image",
"(",
"located",
"in",
"the",
"specified",
"resource",
"set",
")",
"with",
"the",
"specified",
"metadata",
"parameters",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileManager.java#L73-L76 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/XYChart.java | XYChart.addSeries | public XYSeries addSeries(String seriesName, int[] xData, int[] yData, int[] errorBars) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromIntArray(xData),
Utils.getDoubleArrayFromIntArray(yData),
Utils.getDoubleArrayFromIntArray(errorBars),
DataType.Number);
} | java | public XYSeries addSeries(String seriesName, int[] xData, int[] yData, int[] errorBars) {
return addSeries(
seriesName,
Utils.getDoubleArrayFromIntArray(xData),
Utils.getDoubleArrayFromIntArray(yData),
Utils.getDoubleArrayFromIntArray(errorBars),
DataType.Number);
} | [
"public",
"XYSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"int",
"[",
"]",
"xData",
",",
"int",
"[",
"]",
"yData",
",",
"int",
"[",
"]",
"errorBars",
")",
"{",
"return",
"addSeries",
"(",
"seriesName",
",",
"Utils",
".",
"getDoubleArrayFromIntAr... | Add a series for a X-Y type chart using using int arrays with error bars
@param seriesName
@param xData the X-Axis data
@param xData the Y-Axis data
@param errorBars the error bar data
@return A Series object that you can set properties on | [
"Add",
"a",
"series",
"for",
"a",
"X",
"-",
"Y",
"type",
"chart",
"using",
"using",
"int",
"arrays",
"with",
"error",
"bars"
] | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/XYChart.java#L179-L187 |
progolden/vraptor-boilerplate | vraptor-boilerplate-utils/src/main/java/br/com/caelum/vraptor/boilerplate/util/GeneralUtils.java | GeneralUtils.parseLocaleString | public static Locale parseLocaleString(String locale) {
String lang = GeneralUtils.isEmpty(locale) ? "pt" : locale.substring(0, 2);
String country = GeneralUtils.isEmpty(locale) ? "" : locale.substring(3, 5);
return new Locale(lang, country);
} | java | public static Locale parseLocaleString(String locale) {
String lang = GeneralUtils.isEmpty(locale) ? "pt" : locale.substring(0, 2);
String country = GeneralUtils.isEmpty(locale) ? "" : locale.substring(3, 5);
return new Locale(lang, country);
} | [
"public",
"static",
"Locale",
"parseLocaleString",
"(",
"String",
"locale",
")",
"{",
"String",
"lang",
"=",
"GeneralUtils",
".",
"isEmpty",
"(",
"locale",
")",
"?",
"\"pt\"",
":",
"locale",
".",
"substring",
"(",
"0",
",",
"2",
")",
";",
"String",
"coun... | Transforma um string que representa um Locale. A lingua padr�o � pt
universal.
@param locale
String que representa o locale, Ex: pt_BR
@return | [
"Transforma",
"um",
"string",
"que",
"representa",
"um",
"Locale",
".",
"A",
"lingua",
"padr�o",
"�",
"pt",
"universal",
"."
] | train | https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-utils/src/main/java/br/com/caelum/vraptor/boilerplate/util/GeneralUtils.java#L154-L158 |
ModeShape/modeshape | modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java | JcrTools.findOrCreateNode | public Node findOrCreateNode( Session session,
String path ) throws RepositoryException {
return findOrCreateNode(session, path, null, null);
} | java | public Node findOrCreateNode( Session session,
String path ) throws RepositoryException {
return findOrCreateNode(session, path, null, null);
} | [
"public",
"Node",
"findOrCreateNode",
"(",
"Session",
"session",
",",
"String",
"path",
")",
"throws",
"RepositoryException",
"{",
"return",
"findOrCreateNode",
"(",
"session",
",",
"path",
",",
"null",
",",
"null",
")",
";",
"}"
] | Get or create a node at the specified path.
@param session the JCR session. may not be null
@param path the path of the desired node to be found or created. may not be null
@return the existing or newly created node
@throws RepositoryException
@throws IllegalArgumentException if either the session or path argument is null | [
"Get",
"or",
"create",
"a",
"node",
"at",
"the",
"specified",
"path",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java#L339-L342 |
RestComm/cluster | timers/src/main/java/org/restcomm/timers/FaultTolerantScheduler.java | FaultTolerantScheduler.getTimerTaskData | public TimerTaskData getTimerTaskData(Serializable taskID) {
TimerTaskCacheData timerTaskCacheData = new TimerTaskCacheData(taskID, baseFqn, cluster);
if (timerTaskCacheData.exists()) {
return timerTaskCacheData.getTaskData();
}
else {
return null;
}
} | java | public TimerTaskData getTimerTaskData(Serializable taskID) {
TimerTaskCacheData timerTaskCacheData = new TimerTaskCacheData(taskID, baseFqn, cluster);
if (timerTaskCacheData.exists()) {
return timerTaskCacheData.getTaskData();
}
else {
return null;
}
} | [
"public",
"TimerTaskData",
"getTimerTaskData",
"(",
"Serializable",
"taskID",
")",
"{",
"TimerTaskCacheData",
"timerTaskCacheData",
"=",
"new",
"TimerTaskCacheData",
"(",
"taskID",
",",
"baseFqn",
",",
"cluster",
")",
";",
"if",
"(",
"timerTaskCacheData",
".",
"exis... | Retrieves the {@link TimerTaskData} associated with the specified taskID.
@param taskID
@return null if there is no such timer task data | [
"Retrieves",
"the",
"{"
] | train | https://github.com/RestComm/cluster/blob/46bff5e9ae89528ccc7b43ba50a0de5b96913e6f/timers/src/main/java/org/restcomm/timers/FaultTolerantScheduler.java#L187-L195 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java | ManagedClustersInner.getByResourceGroupAsync | public Observable<ManagedClusterInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ManagedClusterInner>, ManagedClusterInner>() {
@Override
public ManagedClusterInner call(ServiceResponse<ManagedClusterInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedClusterInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ManagedClusterInner>, ManagedClusterInner>() {
@Override
public ManagedClusterInner call(ServiceResponse<ManagedClusterInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedClusterInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
... | Gets a managed cluster.
Gets the details of the managed cluster with a specified resource group and name.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagedClusterInner object | [
"Gets",
"a",
"managed",
"cluster",
".",
"Gets",
"the",
"details",
"of",
"the",
"managed",
"cluster",
"with",
"a",
"specified",
"resource",
"group",
"and",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java#L570-L577 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.minMaxColumns | public static List<Row> minMaxColumns(DataRowsFacade data, String... columns) {
return aggregate(data, columns, new String[] {"min", "max"});
} | java | public static List<Row> minMaxColumns(DataRowsFacade data, String... columns) {
return aggregate(data, columns, new String[] {"min", "max"});
} | [
"public",
"static",
"List",
"<",
"Row",
">",
"minMaxColumns",
"(",
"DataRowsFacade",
"data",
",",
"String",
"...",
"columns",
")",
"{",
"return",
"aggregate",
"(",
"data",
",",
"columns",
",",
"new",
"String",
"[",
"]",
"{",
"\"min\"",
",",
"\"max\"",
"}... | Returns the min and max of the given columns.
The list returned is a list of size 2 where each row
@param data the data to get the max for
@param columns the columns to get the
@return | [
"Returns",
"the",
"min",
"and",
"max",
"of",
"the",
"given",
"columns",
".",
"The",
"list",
"returned",
"is",
"a",
"list",
"of",
"size",
"2",
"where",
"each",
"row"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L213-L215 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbooksInner.java | RunbooksInner.createOrUpdate | public RunbookInner createOrUpdate(String resourceGroupName, String automationAccountName, String runbookName, RunbookCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName, parameters).toBlocking().single().body();
} | java | public RunbookInner createOrUpdate(String resourceGroupName, String automationAccountName, String runbookName, RunbookCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName, parameters).toBlocking().single().body();
} | [
"public",
"RunbookInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"runbookName",
",",
"RunbookCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"reso... | Create the runbook identified by runbook name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param runbookName The runbook name.
@param parameters The create or update parameters for runbook. Provide either content link for a published runbook or draft, not both.
@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 RunbookInner object if successful. | [
"Create",
"the",
"runbook",
"identified",
"by",
"runbook",
"name",
"."
] | 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/RunbooksInner.java#L292-L294 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/AmazonWebServiceRequest.java | AmazonWebServiceRequest.putCustomRequestHeader | public String putCustomRequestHeader(String name, String value) {
if (customRequestHeaders == null) {
customRequestHeaders = new HashMap<String, String>();
}
return customRequestHeaders.put(name, value);
} | java | public String putCustomRequestHeader(String name, String value) {
if (customRequestHeaders == null) {
customRequestHeaders = new HashMap<String, String>();
}
return customRequestHeaders.put(name, value);
} | [
"public",
"String",
"putCustomRequestHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"customRequestHeaders",
"==",
"null",
")",
"{",
"customRequestHeaders",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",... | Put a new custom header to the map of custom header names to custom header values, and return
the previous value if the header has already been set in this map.
<p>
Any custom headers that are defined are used in the HTTP request to the AWS service. These
headers will be silently ignored in the event that AWS does not recognize them.
<p>
NOTE: Custom header values set via this method will overwrite any conflicting values coming
from the request parameters.
@param name
The name of the header to add
@param value
The value of the header to add
@return the previous value for the name if it was set, null otherwise | [
"Put",
"a",
"new",
"custom",
"header",
"to",
"the",
"map",
"of",
"custom",
"header",
"names",
"to",
"custom",
"header",
"values",
"and",
"return",
"the",
"previous",
"value",
"if",
"the",
"header",
"has",
"already",
"been",
"set",
"in",
"this",
"map",
".... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/AmazonWebServiceRequest.java#L251-L256 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java | JacksonDBCollection.findAndModify | public T findAndModify(DBObject query, DBObject sort, DBObject update) {
return findAndModify(query, null, sort, false, update, false, false);
} | java | public T findAndModify(DBObject query, DBObject sort, DBObject update) {
return findAndModify(query, null, sort, false, update, false, false);
} | [
"public",
"T",
"findAndModify",
"(",
"DBObject",
"query",
",",
"DBObject",
"sort",
",",
"DBObject",
"update",
")",
"{",
"return",
"findAndModify",
"(",
"query",
",",
"null",
",",
"sort",
",",
"false",
",",
"update",
",",
"false",
",",
"false",
")",
";",
... | calls {@link DBCollection#findAndModify(com.mongodb.DBObject, com.mongodb.DBObject, com.mongodb.DBObject, boolean, com.mongodb.DBObject, boolean, boolean)}
with fields=null, remove=false, returnNew=false, upsert=false
@param query The query
@param sort The sort
@param update The update to apply
@return the old object | [
"calls",
"{",
"@link",
"DBCollection#findAndModify",
"(",
"com",
".",
"mongodb",
".",
"DBObject",
"com",
".",
"mongodb",
".",
"DBObject",
"com",
".",
"mongodb",
".",
"DBObject",
"boolean",
"com",
".",
"mongodb",
".",
"DBObject",
"boolean",
"boolean",
")",
"}... | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L611-L613 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java | ActionInterceptor.postInvoke | public void postInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
postAction( ( ActionInterceptorContext ) context, chain );
} | java | public void postInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
postAction( ( ActionInterceptorContext ) context, chain );
} | [
"public",
"void",
"postInvoke",
"(",
"InterceptorContext",
"context",
",",
"InterceptorChain",
"chain",
")",
"throws",
"InterceptorException",
"{",
"postAction",
"(",
"(",
"ActionInterceptorContext",
")",
"context",
",",
"chain",
")",
";",
"}"
] | Callback invoked after the action is processed. {@link #postAction} may be used instead. | [
"Callback",
"invoked",
"after",
"the",
"action",
"is",
"processed",
".",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java#L117-L120 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/timezone_enum.java | timezone_enum.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
timezone_enum_responses result = (timezone_enum_responses) service.get_payload_formatter().string_to_resource(timezone_enum_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.timezone_enum_response_array);
}
timezone_enum[] result_timezone_enum = new timezone_enum[result.timezone_enum_response_array.length];
for(int i = 0; i < result.timezone_enum_response_array.length; i++)
{
result_timezone_enum[i] = result.timezone_enum_response_array[i].timezone_enum[0];
}
return result_timezone_enum;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
timezone_enum_responses result = (timezone_enum_responses) service.get_payload_formatter().string_to_resource(timezone_enum_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.timezone_enum_response_array);
}
timezone_enum[] result_timezone_enum = new timezone_enum[result.timezone_enum_response_array.length];
for(int i = 0; i < result.timezone_enum_response_array.length; i++)
{
result_timezone_enum[i] = result.timezone_enum_response_array[i].timezone_enum[0];
}
return result_timezone_enum;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"timezone_enum_responses",
"result",
"=",
"(",
"timezone_enum_responses",
")",
"service",
".",
"get_payload_fo... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/timezone_enum.java#L197-L214 |
mojohaus/clirr-maven-plugin | src/main/java/org/codehaus/mojo/clirr/AbstractClirrMojo.java | AbstractClirrMojo.createClassLoader | protected static ClassLoader createClassLoader( Collection artifacts, Set previousArtifacts )
throws MalformedURLException
{
URLClassLoader cl = null;
if ( !artifacts.isEmpty() )
{
List urls = new ArrayList( artifacts.size() );
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
if ( previousArtifacts == null || !previousArtifacts.contains( artifact ) )
{
urls.add( artifact.getFile().toURI().toURL() );
}
}
if ( !urls.isEmpty() )
{
cl = new URLClassLoader( (URL[]) urls.toArray( EMPTY_URL_ARRAY ) );
}
}
return cl;
} | java | protected static ClassLoader createClassLoader( Collection artifacts, Set previousArtifacts )
throws MalformedURLException
{
URLClassLoader cl = null;
if ( !artifacts.isEmpty() )
{
List urls = new ArrayList( artifacts.size() );
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
if ( previousArtifacts == null || !previousArtifacts.contains( artifact ) )
{
urls.add( artifact.getFile().toURI().toURL() );
}
}
if ( !urls.isEmpty() )
{
cl = new URLClassLoader( (URL[]) urls.toArray( EMPTY_URL_ARRAY ) );
}
}
return cl;
} | [
"protected",
"static",
"ClassLoader",
"createClassLoader",
"(",
"Collection",
"artifacts",
",",
"Set",
"previousArtifacts",
")",
"throws",
"MalformedURLException",
"{",
"URLClassLoader",
"cl",
"=",
"null",
";",
"if",
"(",
"!",
"artifacts",
".",
"isEmpty",
"(",
")"... | Create a ClassLoader, which includes the artifacts in <code>artifacts</code>,
but excludes the artifacts in <code>previousArtifacts</code>. The intention is,
that we let BCEL inspect the artifacts in the latter set, using a
{@link ClassLoader}, which contains the dependencies. However, the
{@link ClassLoader} must not contain the jar files, which are being inspected.
@param artifacts The artifacts, from which to build a {@link ClassLoader}.
@param previousArtifacts The artifacts being inspected, or null, if te
returned {@link ClassLoader} should contain all the elements of
<code>artifacts</code>.
@return A {@link ClassLoader} which may be used to inspect the classes in
previousArtifacts.
@throws MalformedURLException Failed to convert a file to an URL. | [
"Create",
"a",
"ClassLoader",
"which",
"includes",
"the",
"artifacts",
"in",
"<code",
">",
"artifacts<",
"/",
"code",
">",
"but",
"excludes",
"the",
"artifacts",
"in",
"<code",
">",
"previousArtifacts<",
"/",
"code",
">",
".",
"The",
"intention",
"is",
"that... | train | https://github.com/mojohaus/clirr-maven-plugin/blob/4348dc31ee003097fa352b1cc3a607dda502bb4c/src/main/java/org/codehaus/mojo/clirr/AbstractClirrMojo.java#L648-L669 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelListAction.java | ModelListAction.customizeListForm | public void customizeListForm(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelListForm modelListForm)
throws Exception {
} | java | public void customizeListForm(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelListForm modelListForm)
throws Exception {
} | [
"public",
"void",
"customizeListForm",
"(",
"ActionMapping",
"actionMapping",
",",
"ActionForm",
"actionForm",
",",
"HttpServletRequest",
"request",
",",
"ModelListForm",
"modelListForm",
")",
"throws",
"Exception",
"{",
"}"
] | 定制ModelListForm
缺省ModelListForm是只有一个List,包含一种Model集合
有的应用可能是两种Model集合,可以继承ModelListForm实现Map-backed ActionForms
再继承本Action,实现本方法。
@param actionMapping
@param actionForm
@param request
@param modelListForm
@throws java.lang.Exception | [
"定制ModelListForm"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelListAction.java#L196-L199 |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.convertDateElementToString | private static String convertDateElementToString(Date currentDate, SimpleDateFormat dateFormat) {
return currentDate.getTime() != 0 ? dateFormat.format(currentDate.getTime()) : "";
} | java | private static String convertDateElementToString(Date currentDate, SimpleDateFormat dateFormat) {
return currentDate.getTime() != 0 ? dateFormat.format(currentDate.getTime()) : "";
} | [
"private",
"static",
"String",
"convertDateElementToString",
"(",
"Date",
"currentDate",
",",
"SimpleDateFormat",
"dateFormat",
")",
"{",
"return",
"currentDate",
".",
"getTime",
"(",
")",
"!=",
"0",
"?",
"dateFormat",
".",
"format",
"(",
"currentDate",
".",
"ge... | The function to convert a date into a string according to the format used.
@param currentDate the date to convert.
@param dateFormat the formatter to convert date element into string.
@return the string that corresponds to the date in the format used. | [
"The",
"function",
"to",
"convert",
"a",
"date",
"into",
"a",
"string",
"according",
"to",
"the",
"format",
"used",
"."
] | train | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L260-L262 |
ziccardi/jnrpe | jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java | PluginRepositoryUtil.parsePluginDefinition | @SuppressWarnings("rawtypes")
private static PluginDefinition parsePluginDefinition(final ClassLoader cl, final Element plugin) throws PluginConfigurationException {
// Check if the plugin definition is inside its own file
if (getAttributeValue(plugin, "definedIn", false) != null) {
StreamManager sm = new StreamManager();
String sFileName = getAttributeValue(plugin, "definedIn", false);
try {
InputStream in = sm.handle(cl.getResourceAsStream(sFileName));
return parseXmlPluginDefinition(cl, in);
} finally {
sm.closeAll();
}
}
String pluginClass = getAttributeValue(plugin, "class", true);
Class clazz;
try {
clazz = LoadedClassCache.getClass(cl, pluginClass);
if (!IPluginInterface.class.isAssignableFrom(clazz)) {
throw new PluginConfigurationException("Specified class '" + clazz.getName() + "' in the plugin.xml file does not implement "
+ "the IPluginInterface interface");
}
if (isAnnotated(clazz)) {
return loadFromPluginAnnotation(clazz);
}
} catch (ClassNotFoundException e) {
throw new PluginConfigurationException(e.getMessage(), e);
}
// The class is not annotated not has an external definition file...
// Loading from current xml file...
String sDescription = getAttributeValue(plugin, "description", false);
@SuppressWarnings("unchecked")
PluginDefinition pluginDef = new PluginDefinition(getAttributeValue(plugin, "name", true), sDescription, clazz);
parseCommandLine(pluginDef, plugin);
return pluginDef;
} | java | @SuppressWarnings("rawtypes")
private static PluginDefinition parsePluginDefinition(final ClassLoader cl, final Element plugin) throws PluginConfigurationException {
// Check if the plugin definition is inside its own file
if (getAttributeValue(plugin, "definedIn", false) != null) {
StreamManager sm = new StreamManager();
String sFileName = getAttributeValue(plugin, "definedIn", false);
try {
InputStream in = sm.handle(cl.getResourceAsStream(sFileName));
return parseXmlPluginDefinition(cl, in);
} finally {
sm.closeAll();
}
}
String pluginClass = getAttributeValue(plugin, "class", true);
Class clazz;
try {
clazz = LoadedClassCache.getClass(cl, pluginClass);
if (!IPluginInterface.class.isAssignableFrom(clazz)) {
throw new PluginConfigurationException("Specified class '" + clazz.getName() + "' in the plugin.xml file does not implement "
+ "the IPluginInterface interface");
}
if (isAnnotated(clazz)) {
return loadFromPluginAnnotation(clazz);
}
} catch (ClassNotFoundException e) {
throw new PluginConfigurationException(e.getMessage(), e);
}
// The class is not annotated not has an external definition file...
// Loading from current xml file...
String sDescription = getAttributeValue(plugin, "description", false);
@SuppressWarnings("unchecked")
PluginDefinition pluginDef = new PluginDefinition(getAttributeValue(plugin, "name", true), sDescription, clazz);
parseCommandLine(pluginDef, plugin);
return pluginDef;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"private",
"static",
"PluginDefinition",
"parsePluginDefinition",
"(",
"final",
"ClassLoader",
"cl",
",",
"final",
"Element",
"plugin",
")",
"throws",
"PluginConfigurationException",
"{",
"// Check if the plugin definition ... | Parse an XML plugin definition.
@param cl
The classloader to be used to load classes
@param plugin
The plugin XML element
@return the parsed plugin definition * @throws PluginConfigurationException
- | [
"Parse",
"an",
"XML",
"plugin",
"definition",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java#L187-L234 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java | PhotosApi.getExif | public ExifData getExif(String photoId, String secret) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.getExif");
params.put("photo_id", photoId);
if (!JinxUtils.isNullOrEmpty(secret)) {
params.put("secret", secret);
}
return jinx.flickrGet(params, ExifData.class);
} | java | public ExifData getExif(String photoId, String secret) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.getExif");
params.put("photo_id", photoId);
if (!JinxUtils.isNullOrEmpty(secret)) {
params.put("secret", secret);
}
return jinx.flickrGet(params, ExifData.class);
} | [
"public",
"ExifData",
"getExif",
"(",
"String",
"photoId",
",",
"String",
"secret",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
... | <br>
Retrieves a list of EXIF/TIFF/GPS tags for a given photo. The calling user must have permission to view the photo.
<br>
This method does not require authentication.
@param photoId Required. The id of the photo to fetch information for.
@param secret Optional. The secret for the photo. If the correct secret is passed then permissions checking is skipped.
This enables the 'sharing' of individual photos by passing around the id and secret.
@return object containing limited information about the photo, and a list of Exif data.
@throws JinxException if there are ay errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.getExif.html">flickr.photos.getExif</a> | [
"<br",
">",
"Retrieves",
"a",
"list",
"of",
"EXIF",
"/",
"TIFF",
"/",
"GPS",
"tags",
"for",
"a",
"given",
"photo",
".",
"The",
"calling",
"user",
"must",
"have",
"permission",
"to",
"view",
"the",
"photo",
".",
"<br",
">",
"This",
"method",
"does",
"... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L281-L290 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletResponse.java | MockHttpServletResponse.setIntHeader | @Override
public void setIntHeader(final String name, final int value) {
headers.put(name, String.valueOf(value));
} | java | @Override
public void setIntHeader(final String name, final int value) {
headers.put(name, String.valueOf(value));
} | [
"@",
"Override",
"public",
"void",
"setIntHeader",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"value",
")",
"{",
"headers",
".",
"put",
"(",
"name",
",",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | Sets an integer header.
@param name the header name.
@param value the header value. | [
"Sets",
"an",
"integer",
"header",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletResponse.java#L197-L200 |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java | LongPacker.packLong | static public int packLong(byte[] ba, long value)
throws IOException {
if (value < 0) {
throw new IllegalArgumentException("negative value: v=" + value);
}
int i = 1;
while ((value & ~0x7FL) != 0) {
ba[i - 1] = (byte) (((int) value & 0x7F) | 0x80);
value >>>= 7;
i++;
}
ba[i - 1] = (byte) value;
return i;
} | java | static public int packLong(byte[] ba, long value)
throws IOException {
if (value < 0) {
throw new IllegalArgumentException("negative value: v=" + value);
}
int i = 1;
while ((value & ~0x7FL) != 0) {
ba[i - 1] = (byte) (((int) value & 0x7F) | 0x80);
value >>>= 7;
i++;
}
ba[i - 1] = (byte) value;
return i;
} | [
"static",
"public",
"int",
"packLong",
"(",
"byte",
"[",
"]",
"ba",
",",
"long",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"negative value: v=\"",
"+",
"value",
")... | Pack non-negative long into byte array. It will occupy 1-10 bytes
depending on value (lower values occupy smaller space)
@param ba the byte array
@param value the long value
@return the number of bytes written
@throws IOException if an error occurs with the stream | [
"Pack",
"non",
"-",
"negative",
"long",
"into",
"byte",
"array",
".",
"It",
"will",
"occupy",
"1",
"-",
"10",
"bytes",
"depending",
"on",
"value",
"(",
"lower",
"values",
"occupy",
"smaller",
"space",
")"
] | train | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java#L71-L86 |
nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createCluster | public static NKey createCluster(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.CLUSTER, random);
} | java | public static NKey createCluster(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.CLUSTER, random);
} | [
"public",
"static",
"NKey",
"createCluster",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"CLUSTER",
",",
"random",
")",
";",
"}"
] | Create an Cluster NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws IOException if the seed cannot be encoded to a string
@throws NoSuchProviderException if the default secure random cannot be created
@throws NoSuchAlgorithmException if the default secure random cannot be created | [
"Create",
"an",
"Cluster",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L497-L500 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/ocr/AipOcr.java | AipOcr.basicGeneral | public JSONObject basicGeneral(byte[] image, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
String base64Content = Base64Util.encode(image);
request.addBody("image", base64Content);
if (options != null) {
request.addBody(options);
}
request.setUri(OcrConsts.GENERAL_BASIC);
postOperation(request);
return requestServer(request);
} | java | public JSONObject basicGeneral(byte[] image, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
String base64Content = Base64Util.encode(image);
request.addBody("image", base64Content);
if (options != null) {
request.addBody(options);
}
request.setUri(OcrConsts.GENERAL_BASIC);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"basicGeneral",
"(",
"byte",
"[",
"]",
"image",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"S... | 通用文字识别接口
用户向服务请求识别某张图中的所有文字
@param image - 二进制图像数据
@param options - 可选参数对象,key: value都为string类型
options - options列表:
language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
probability 是否返回识别结果中每一行的置信度
@return JSONObject | [
"通用文字识别接口",
"用户向服务请求识别某张图中的所有文字"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/ocr/AipOcr.java#L46-L58 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/util/Locales.java | Locales.setLocale | public static void setLocale(final HttpServletRequest request, final Locale locale) {
final HttpSession session = request.getSession(false);
if (null == session) {
LOGGER.warn("Ignores set locale caused by no session");
return;
}
session.setAttribute(Keys.LOCALE, locale);
LOGGER.log(Level.DEBUG, "Client[sessionId={0}] sets locale to [{1}]", new Object[]{session.getId(), locale.toString()});
} | java | public static void setLocale(final HttpServletRequest request, final Locale locale) {
final HttpSession session = request.getSession(false);
if (null == session) {
LOGGER.warn("Ignores set locale caused by no session");
return;
}
session.setAttribute(Keys.LOCALE, locale);
LOGGER.log(Level.DEBUG, "Client[sessionId={0}] sets locale to [{1}]", new Object[]{session.getId(), locale.toString()});
} | [
"public",
"static",
"void",
"setLocale",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"Locale",
"locale",
")",
"{",
"final",
"HttpSession",
"session",
"=",
"request",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"null",
"==",
"sessio... | Sets the specified locale into session of the specified request.
<p>
If no session of the specified request, do nothing.
</p>
@param request the specified request
@param locale a new locale | [
"Sets",
"the",
"specified",
"locale",
"into",
"session",
"of",
"the",
"specified",
"request",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L153-L164 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomMojo.java | AbstractWisdomMojo.getWisdomRootDirectory | public File getWisdomRootDirectory() {
File wisdom;
if (wisdomDirectory == null) {
wisdom = new File(buildDirectory, Constants.WISDOM_DIRECTORY_NAME);
} else {
this.getLog().debug("Using Wisdom Directory : " + wisdomDirectory.getAbsolutePath());
wisdom = wisdomDirectory;
}
if (wisdom.mkdirs()) {
this.getLog().debug(wisdom.getAbsolutePath() + " directory created.");
}
return wisdom;
} | java | public File getWisdomRootDirectory() {
File wisdom;
if (wisdomDirectory == null) {
wisdom = new File(buildDirectory, Constants.WISDOM_DIRECTORY_NAME);
} else {
this.getLog().debug("Using Wisdom Directory : " + wisdomDirectory.getAbsolutePath());
wisdom = wisdomDirectory;
}
if (wisdom.mkdirs()) {
this.getLog().debug(wisdom.getAbsolutePath() + " directory created.");
}
return wisdom;
} | [
"public",
"File",
"getWisdomRootDirectory",
"(",
")",
"{",
"File",
"wisdom",
";",
"if",
"(",
"wisdomDirectory",
"==",
"null",
")",
"{",
"wisdom",
"=",
"new",
"File",
"(",
"buildDirectory",
",",
"Constants",
".",
"WISDOM_DIRECTORY_NAME",
")",
";",
"}",
"else"... | Gets the root directory of the Wisdom server. Generally it's 'target/wisdom' except if the
{@link #wisdomDirectory} parameter is configured. In this case,
it returns the location specified by this parameter.
@return the Wisdom's root. | [
"Gets",
"the",
"root",
"directory",
"of",
"the",
"Wisdom",
"server",
".",
"Generally",
"it",
"s",
"target",
"/",
"wisdom",
"except",
"if",
"the",
"{",
"@link",
"#wisdomDirectory",
"}",
"parameter",
"is",
"configured",
".",
"In",
"this",
"case",
"it",
"retu... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomMojo.java#L134-L147 |
attribyte/wpdb | src/main/java/org/attribyte/wp/db/DB.java | DB.updatePost | public Post updatePost(Post post, final TimeZone tz) throws SQLException {
if(post.id < 1L) {
throw new SQLException("The post id must be specified for update");
}
if(post.modifiedTimestamp < 1) {
post = post.modifiedNow();
}
int offset = tz.getOffset(post.publishTimestamp);
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.updatePostTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(updatePostSQL);
stmt.setLong(1, post.authorId);
stmt.setTimestamp(2, new Timestamp(post.publishTimestamp));
stmt.setTimestamp(3, new Timestamp(post.publishTimestamp - offset));
stmt.setString(4, Strings.nullToEmpty(post.content));
stmt.setString(5, Strings.nullToEmpty(post.title));
stmt.setString(6, Strings.nullToEmpty(post.excerpt));
stmt.setString(7, post.status.toString().toLowerCase());
stmt.setString(8, Strings.nullToEmpty(post.slug));
stmt.setTimestamp(9, new Timestamp(post.modifiedTimestamp));
stmt.setTimestamp(10, new Timestamp(post.modifiedTimestamp - offset));
stmt.setLong(11, post.parentId);
stmt.setString(12, Strings.nullToEmpty(post.guid));
stmt.setString(13, post.type.toString().toLowerCase());
stmt.setString(14, post.mimeType != null ? post.mimeType : "");
stmt.setLong(15, post.id);
stmt.executeUpdate();
return post;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
} | java | public Post updatePost(Post post, final TimeZone tz) throws SQLException {
if(post.id < 1L) {
throw new SQLException("The post id must be specified for update");
}
if(post.modifiedTimestamp < 1) {
post = post.modifiedNow();
}
int offset = tz.getOffset(post.publishTimestamp);
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.updatePostTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(updatePostSQL);
stmt.setLong(1, post.authorId);
stmt.setTimestamp(2, new Timestamp(post.publishTimestamp));
stmt.setTimestamp(3, new Timestamp(post.publishTimestamp - offset));
stmt.setString(4, Strings.nullToEmpty(post.content));
stmt.setString(5, Strings.nullToEmpty(post.title));
stmt.setString(6, Strings.nullToEmpty(post.excerpt));
stmt.setString(7, post.status.toString().toLowerCase());
stmt.setString(8, Strings.nullToEmpty(post.slug));
stmt.setTimestamp(9, new Timestamp(post.modifiedTimestamp));
stmt.setTimestamp(10, new Timestamp(post.modifiedTimestamp - offset));
stmt.setLong(11, post.parentId);
stmt.setString(12, Strings.nullToEmpty(post.guid));
stmt.setString(13, post.type.toString().toLowerCase());
stmt.setString(14, post.mimeType != null ? post.mimeType : "");
stmt.setLong(15, post.id);
stmt.executeUpdate();
return post;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
} | [
"public",
"Post",
"updatePost",
"(",
"Post",
"post",
",",
"final",
"TimeZone",
"tz",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"post",
".",
"id",
"<",
"1L",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"The post id must be specified for update\"",
")"... | Updates a post.
@param post The post to update. The {@code id} must be set.
@param tz The local time zone.
@return The updated post.
@throws SQLException on database error or missing post id. | [
"Updates",
"a",
"post",
"."
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1699-L1736 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/WxaAPI.java | WxaAPI.getnearbypoilist | public static GetnearbypoilistResult getnearbypoilist(String access_token, int page, int page_rows){
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/wxa/getnearbypoilist")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addParameter("page", String.valueOf(page))
.addParameter("page_rows", String.valueOf(page_rows))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,GetnearbypoilistResult.class);
} | java | public static GetnearbypoilistResult getnearbypoilist(String access_token, int page, int page_rows){
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/wxa/getnearbypoilist")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addParameter("page", String.valueOf(page))
.addParameter("page_rows", String.valueOf(page_rows))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,GetnearbypoilistResult.class);
} | [
"public",
"static",
"GetnearbypoilistResult",
"getnearbypoilist",
"(",
"String",
"access_token",
",",
"int",
"page",
",",
"int",
"page_rows",
")",
"{",
"HttpUriRequest",
"httpUriRequest",
"=",
"RequestBuilder",
".",
"get",
"(",
")",
".",
"setHeader",
"(",
"jsonHea... | 附近 查看地点列表
@since 2.8.18
@param access_token access_token
@param page 起始页id(从1开始计数)
@param page_rows 每页展示个数(最多1000个)
@return result | [
"附近",
"查看地点列表"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxaAPI.java#L374-L383 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/OpMapVector.java | OpMapVector.setElementAt | public final void setElementAt(int value, int index)
{
if (index >= m_mapSize)
{
int oldSize = m_mapSize;
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, oldSize);
m_map = newMap;
}
m_map[index] = value;
} | java | public final void setElementAt(int value, int index)
{
if (index >= m_mapSize)
{
int oldSize = m_mapSize;
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, oldSize);
m_map = newMap;
}
m_map[index] = value;
} | [
"public",
"final",
"void",
"setElementAt",
"(",
"int",
"value",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"m_mapSize",
")",
"{",
"int",
"oldSize",
"=",
"m_mapSize",
";",
"m_mapSize",
"+=",
"m_blocksize",
";",
"int",
"newMap",
"[",
"]",
"... | Sets the component at the specified index of this vector to be the
specified object. The previous component at that position is discarded.
The index must be a value greater than or equal to 0 and less
than the current size of the vector.
@param value object to set
@param index Index of where to set the object | [
"Sets",
"the",
"component",
"at",
"the",
"specified",
"index",
"of",
"this",
"vector",
"to",
"be",
"the",
"specified",
"object",
".",
"The",
"previous",
"component",
"at",
"that",
"position",
"is",
"discarded",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/OpMapVector.java#L81-L97 |
JodaOrg/joda-money | src/main/java/org/joda/money/format/MoneyFormatter.java | MoneyFormatter.printIO | public void printIO(Appendable appendable, BigMoneyProvider moneyProvider) throws IOException {
checkNotNull(moneyProvider, "BigMoneyProvider must not be null");
if (isPrinter() == false) {
throw new UnsupportedOperationException("MoneyFomatter has not been configured to be able to print");
}
BigMoney money = BigMoney.of(moneyProvider);
MoneyPrintContext context = new MoneyPrintContext(locale);
printerParser.print(context, appendable, money);
} | java | public void printIO(Appendable appendable, BigMoneyProvider moneyProvider) throws IOException {
checkNotNull(moneyProvider, "BigMoneyProvider must not be null");
if (isPrinter() == false) {
throw new UnsupportedOperationException("MoneyFomatter has not been configured to be able to print");
}
BigMoney money = BigMoney.of(moneyProvider);
MoneyPrintContext context = new MoneyPrintContext(locale);
printerParser.print(context, appendable, money);
} | [
"public",
"void",
"printIO",
"(",
"Appendable",
"appendable",
",",
"BigMoneyProvider",
"moneyProvider",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"moneyProvider",
",",
"\"BigMoneyProvider must not be null\"",
")",
";",
"if",
"(",
"isPrinter",
"(",
")",
... | Prints a monetary value to an {@code Appendable} potentially
throwing an {@code IOException}.
<p>
Example implementations of {@code Appendable} are {@code StringBuilder},
{@code StringBuffer} or {@code Writer}. Note that {@code StringBuilder}
and {@code StringBuffer} never throw an {@code IOException}.
@param appendable the appendable to add to, not null
@param moneyProvider the money to print, not null
@throws UnsupportedOperationException if the formatter is unable to print
@throws MoneyFormatException if there is a problem while printing
@throws IOException if an IO error occurs | [
"Prints",
"a",
"monetary",
"value",
"to",
"an",
"{",
"@code",
"Appendable",
"}",
"potentially",
"throwing",
"an",
"{",
"@code",
"IOException",
"}",
".",
"<p",
">",
"Example",
"implementations",
"of",
"{",
"@code",
"Appendable",
"}",
"are",
"{",
"@code",
"S... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatter.java#L203-L212 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.inducedHomography12 | public static DMatrixRMaj inducedHomography12( TrifocalTensor tensor ,
Vector3D_F64 line3 ,
DMatrixRMaj output ) {
if( output == null )
output = new DMatrixRMaj(3,3);
// H(:,0) = T1*line
DMatrixRMaj T = tensor.T1;
output.data[0] = T.data[0]*line3.x + T.data[1]*line3.y + T.data[2]*line3.z;
output.data[3] = T.data[3]*line3.x + T.data[4]*line3.y + T.data[5]*line3.z;
output.data[6] = T.data[6]*line3.x + T.data[7]*line3.y + T.data[8]*line3.z;
// H(:,0) = T2*line
T = tensor.T2;
output.data[1] = T.data[0]*line3.x + T.data[1]*line3.y + T.data[2]*line3.z;
output.data[4] = T.data[3]*line3.x + T.data[4]*line3.y + T.data[5]*line3.z;
output.data[7] = T.data[6]*line3.x + T.data[7]*line3.y + T.data[8]*line3.z;
// H(:,0) = T3*line
T = tensor.T3;
output.data[2] = T.data[0]*line3.x + T.data[1]*line3.y + T.data[2]*line3.z;
output.data[5] = T.data[3]*line3.x + T.data[4]*line3.y + T.data[5]*line3.z;
output.data[8] = T.data[6]*line3.x + T.data[7]*line3.y + T.data[8]*line3.z;
// Vector3D_F64 temp = new Vector3D_F64();
//
// for( int i = 0; i < 3; i++ ) {
// GeometryMath_F64.mult(tensor.getT(i), line, temp);
// output.unsafe_set(0,i,temp.x);
// output.unsafe_set(1,i,temp.y);
// output.unsafe_set(2,i,temp.z);
// }
return output;
} | java | public static DMatrixRMaj inducedHomography12( TrifocalTensor tensor ,
Vector3D_F64 line3 ,
DMatrixRMaj output ) {
if( output == null )
output = new DMatrixRMaj(3,3);
// H(:,0) = T1*line
DMatrixRMaj T = tensor.T1;
output.data[0] = T.data[0]*line3.x + T.data[1]*line3.y + T.data[2]*line3.z;
output.data[3] = T.data[3]*line3.x + T.data[4]*line3.y + T.data[5]*line3.z;
output.data[6] = T.data[6]*line3.x + T.data[7]*line3.y + T.data[8]*line3.z;
// H(:,0) = T2*line
T = tensor.T2;
output.data[1] = T.data[0]*line3.x + T.data[1]*line3.y + T.data[2]*line3.z;
output.data[4] = T.data[3]*line3.x + T.data[4]*line3.y + T.data[5]*line3.z;
output.data[7] = T.data[6]*line3.x + T.data[7]*line3.y + T.data[8]*line3.z;
// H(:,0) = T3*line
T = tensor.T3;
output.data[2] = T.data[0]*line3.x + T.data[1]*line3.y + T.data[2]*line3.z;
output.data[5] = T.data[3]*line3.x + T.data[4]*line3.y + T.data[5]*line3.z;
output.data[8] = T.data[6]*line3.x + T.data[7]*line3.y + T.data[8]*line3.z;
// Vector3D_F64 temp = new Vector3D_F64();
//
// for( int i = 0; i < 3; i++ ) {
// GeometryMath_F64.mult(tensor.getT(i), line, temp);
// output.unsafe_set(0,i,temp.x);
// output.unsafe_set(1,i,temp.y);
// output.unsafe_set(2,i,temp.z);
// }
return output;
} | [
"public",
"static",
"DMatrixRMaj",
"inducedHomography12",
"(",
"TrifocalTensor",
"tensor",
",",
"Vector3D_F64",
"line3",
",",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"output",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
",",
"3",
... | Computes the homography induced from view 1 to 2 by a line in view 3. The provided line in
view 3 must contain the view 3 observation.
p2 = H12*p1
@param tensor Input: Trifocal tensor
@param line3 Input: Line in view 3. {@link LineGeneral2D_F64 General notation}.
@param output Output: Optional storage for homography. 3x3 matrix
@return Homography from view 1 to 2 | [
"Computes",
"the",
"homography",
"induced",
"from",
"view",
"1",
"to",
"2",
"by",
"a",
"line",
"in",
"view",
"3",
".",
"The",
"provided",
"line",
"in",
"view",
"3",
"must",
"contain",
"the",
"view",
"3",
"observation",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L486-L520 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java | PageFlowRequestProcessor.getPageFlowScopedFormMember | private Field getPageFlowScopedFormMember( ActionMapping mapping, HttpServletRequest request )
{
if ( mapping instanceof PageFlowActionMapping )
{
PageFlowActionMapping pfam = ( PageFlowActionMapping ) mapping;
String formMember = pfam.getFormMember();
if ( formMember == null ) return null;
Field field = null;
FlowController fc = PageFlowRequestWrapper.get( request ).getCurrentFlowController();
try
{
field = fc.getClass().getDeclaredField( formMember );
}
catch ( NoSuchFieldException e )
{
// try finding a non-private field from the class hierarchy
field = InternalUtils.lookupField( fc.getClass(), formMember );
if ( field == null || Modifier.isPrivate( field.getModifiers() ) )
{
LOG.error("Could not find page flow member " + formMember + " as the form bean.");
return null;
}
}
if ( ! Modifier.isPublic( field.getModifiers() ) ) field.setAccessible( true );
return field;
}
return null;
} | java | private Field getPageFlowScopedFormMember( ActionMapping mapping, HttpServletRequest request )
{
if ( mapping instanceof PageFlowActionMapping )
{
PageFlowActionMapping pfam = ( PageFlowActionMapping ) mapping;
String formMember = pfam.getFormMember();
if ( formMember == null ) return null;
Field field = null;
FlowController fc = PageFlowRequestWrapper.get( request ).getCurrentFlowController();
try
{
field = fc.getClass().getDeclaredField( formMember );
}
catch ( NoSuchFieldException e )
{
// try finding a non-private field from the class hierarchy
field = InternalUtils.lookupField( fc.getClass(), formMember );
if ( field == null || Modifier.isPrivate( field.getModifiers() ) )
{
LOG.error("Could not find page flow member " + formMember + " as the form bean.");
return null;
}
}
if ( ! Modifier.isPublic( field.getModifiers() ) ) field.setAccessible( true );
return field;
}
return null;
} | [
"private",
"Field",
"getPageFlowScopedFormMember",
"(",
"ActionMapping",
"mapping",
",",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"mapping",
"instanceof",
"PageFlowActionMapping",
")",
"{",
"PageFlowActionMapping",
"pfam",
"=",
"(",
"PageFlowActionMapping",
... | See if this action mapping is our custom config type, and if so, see if the action should use a member variable
in the page flow controller as its form bean (the <code>useFormBean</code> attribute on
<code>@Jpf.Action</code>). If so, return the appropriate Field in the controller class. | [
"See",
"if",
"this",
"action",
"mapping",
"is",
"our",
"custom",
"config",
"type",
"and",
"if",
"so",
"see",
"if",
"the",
"action",
"should",
"use",
"a",
"member",
"variable",
"in",
"the",
"page",
"flow",
"controller",
"as",
"its",
"form",
"bean",
"(",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L148-L178 |
springfox/springfox | springfox-core/src/main/java/springfox/documentation/builders/DocumentationBuilder.java | DocumentationBuilder.apiListingsByResourceGroupName | public DocumentationBuilder apiListingsByResourceGroupName(Map<String, List<ApiListing>> apiListings) {
nullToEmptyMultimap(apiListings).entrySet().stream().forEachOrdered(entry -> {
List<ApiListing> list;
if (this.apiListings.containsKey(entry.getKey())) {
list = this.apiListings.get(entry.getKey());
list.addAll(entry.getValue());
} else {
list = new ArrayList<>(entry.getValue());
this.apiListings.put(entry.getKey(), list);
}
list.sort(byListingPosition());
});
return this;
} | java | public DocumentationBuilder apiListingsByResourceGroupName(Map<String, List<ApiListing>> apiListings) {
nullToEmptyMultimap(apiListings).entrySet().stream().forEachOrdered(entry -> {
List<ApiListing> list;
if (this.apiListings.containsKey(entry.getKey())) {
list = this.apiListings.get(entry.getKey());
list.addAll(entry.getValue());
} else {
list = new ArrayList<>(entry.getValue());
this.apiListings.put(entry.getKey(), list);
}
list.sort(byListingPosition());
});
return this;
} | [
"public",
"DocumentationBuilder",
"apiListingsByResourceGroupName",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"ApiListing",
">",
">",
"apiListings",
")",
"{",
"nullToEmptyMultimap",
"(",
"apiListings",
")",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
... | Updates the map with new entries
@param apiListings - entries to add to the existing documentation
@return this | [
"Updates",
"the",
"map",
"with",
"new",
"entries"
] | train | https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/builders/DocumentationBuilder.java#L68-L81 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java | SimpleCompareFileExtensions.compareFilesByName | public static boolean compareFilesByName(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, true, false, true)
.getNameEquality();
} | java | public static boolean compareFilesByName(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, true, false, true)
.getNameEquality();
} | [
"public",
"static",
"boolean",
"compareFilesByName",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"true",
","... | Compare files by name.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the name are equal, otherwise false. | [
"Compare",
"files",
"by",
"name",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L196-L201 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/Slider.java | Slider.setValues | public Slider setValues(Integer value1, Integer value2)
{
if (value1 != null && value2 != null)
{
ArrayItemOptions<IntegerItemOptions> options =
new ArrayItemOptions<IntegerItemOptions>();
options.add(new IntegerItemOptions(value1));
options.add(new IntegerItemOptions(value2));
this.options.put("values", options);
}
return this;
} | java | public Slider setValues(Integer value1, Integer value2)
{
if (value1 != null && value2 != null)
{
ArrayItemOptions<IntegerItemOptions> options =
new ArrayItemOptions<IntegerItemOptions>();
options.add(new IntegerItemOptions(value1));
options.add(new IntegerItemOptions(value2));
this.options.put("values", options);
}
return this;
} | [
"public",
"Slider",
"setValues",
"(",
"Integer",
"value1",
",",
"Integer",
"value2",
")",
"{",
"if",
"(",
"value1",
"!=",
"null",
"&&",
"value2",
"!=",
"null",
")",
"{",
"ArrayItemOptions",
"<",
"IntegerItemOptions",
">",
"options",
"=",
"new",
"ArrayItemOpt... | This option can be used to specify multiple handles. If range is set to true, the
length of 'values' should be 2.
@param value1
@param value2
@return instance of the current component | [
"This",
"option",
"can",
"be",
"used",
"to",
"specify",
"multiple",
"handles",
".",
"If",
"range",
"is",
"set",
"to",
"true",
"the",
"length",
"of",
"values",
"should",
"be",
"2",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/Slider.java#L428-L439 |
hibernate/hibernate-ogm | infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedDatastoreProvider.java | InfinispanEmbeddedDatastoreProvider.initializePersistenceStrategy | public void initializePersistenceStrategy(CacheMappingType cacheMappingType, Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes, Iterable<Namespace> namespaces) {
persistenceStrategy = PersistenceStrategy.getInstance(
cacheMappingType,
externalCacheManager,
config.getConfigurationUrl(),
jtaPlatform,
entityTypes,
associationTypes,
idSourceTypes
);
// creates handler for TableGenerator Id sources
boolean requiresCounter = hasIdGeneration( idSourceTypes );
if ( requiresCounter ) {
this.tableClusterHandler = new TableClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager() );
}
// creates handlers for SequenceGenerator Id sources
for ( Namespace namespace : namespaces ) {
for ( Sequence seq : namespace.getSequences() ) {
this.sequenceCounterHandlers.put( seq.getExportIdentifier(),
new SequenceClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager(), seq ) );
}
}
// clear resources
this.externalCacheManager = null;
this.jtaPlatform = null;
} | java | public void initializePersistenceStrategy(CacheMappingType cacheMappingType, Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes, Iterable<Namespace> namespaces) {
persistenceStrategy = PersistenceStrategy.getInstance(
cacheMappingType,
externalCacheManager,
config.getConfigurationUrl(),
jtaPlatform,
entityTypes,
associationTypes,
idSourceTypes
);
// creates handler for TableGenerator Id sources
boolean requiresCounter = hasIdGeneration( idSourceTypes );
if ( requiresCounter ) {
this.tableClusterHandler = new TableClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager() );
}
// creates handlers for SequenceGenerator Id sources
for ( Namespace namespace : namespaces ) {
for ( Sequence seq : namespace.getSequences() ) {
this.sequenceCounterHandlers.put( seq.getExportIdentifier(),
new SequenceClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager(), seq ) );
}
}
// clear resources
this.externalCacheManager = null;
this.jtaPlatform = null;
} | [
"public",
"void",
"initializePersistenceStrategy",
"(",
"CacheMappingType",
"cacheMappingType",
",",
"Set",
"<",
"EntityKeyMetadata",
">",
"entityTypes",
",",
"Set",
"<",
"AssociationKeyMetadata",
">",
"associationTypes",
",",
"Set",
"<",
"IdSourceKeyMetadata",
">",
"id... | Initializes the persistence strategy to be used when accessing the datastore. In particular, all the required
caches will be configured and initialized.
@param cacheMappingType the {@link org.hibernate.ogm.datastore.keyvalue.options.CacheMappingType} to be used
@param entityTypes meta-data of all the entity types registered with the current session factory
@param associationTypes meta-data of all the association types registered with the current session factory
@param idSourceTypes meta-data of all the id source types registered with the current session factory
@param namespaces from the database currently in use | [
"Initializes",
"the",
"persistence",
"strategy",
"to",
"be",
"used",
"when",
"accessing",
"the",
"datastore",
".",
"In",
"particular",
"all",
"the",
"required",
"caches",
"will",
"be",
"configured",
"and",
"initialized",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedDatastoreProvider.java#L108-L136 |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.swapRows | public void swapRows(int i, int j) {
if (i != j) {
Vector ii = getRow(i);
Vector jj = getRow(j);
setRow(i, jj);
setRow(j, ii);
}
} | java | public void swapRows(int i, int j) {
if (i != j) {
Vector ii = getRow(i);
Vector jj = getRow(j);
setRow(i, jj);
setRow(j, ii);
}
} | [
"public",
"void",
"swapRows",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"i",
"!=",
"j",
")",
"{",
"Vector",
"ii",
"=",
"getRow",
"(",
"i",
")",
";",
"Vector",
"jj",
"=",
"getRow",
"(",
"j",
")",
";",
"setRow",
"(",
"i",
",",
"j... | Swaps the specified rows of this matrix.
@param i the row index
@param j the row index | [
"Swaps",
"the",
"specified",
"rows",
"of",
"this",
"matrix",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L473-L481 |
xiancloud/xian | xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/OutputAccessor.java | OutputAccessor.from | public static OutputAccessor from(OutputAccessorPoolHolder poolHolder, ByteBuffer byteBuffer) {
ByteBufferOutputAccessor accessor = poolHolder.getByteBufferOutputAccessor();
accessor.byteBuffer = byteBuffer;
return accessor;
} | java | public static OutputAccessor from(OutputAccessorPoolHolder poolHolder, ByteBuffer byteBuffer) {
ByteBufferOutputAccessor accessor = poolHolder.getByteBufferOutputAccessor();
accessor.byteBuffer = byteBuffer;
return accessor;
} | [
"public",
"static",
"OutputAccessor",
"from",
"(",
"OutputAccessorPoolHolder",
"poolHolder",
",",
"ByteBuffer",
"byteBuffer",
")",
"{",
"ByteBufferOutputAccessor",
"accessor",
"=",
"poolHolder",
".",
"getByteBufferOutputAccessor",
"(",
")",
";",
"accessor",
".",
"byteBu... | Create an {@link OutputAccessor} for the given {@link ByteBuffer}. Instances are pooled within the thread scope.
@param poolHolder
@param byteBuffer
@return | [
"Create",
"an",
"{",
"@link",
"OutputAccessor",
"}",
"for",
"the",
"given",
"{",
"@link",
"ByteBuffer",
"}",
".",
"Instances",
"are",
"pooled",
"within",
"the",
"thread",
"scope",
"."
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/OutputAccessor.java#L49-L55 |
jenkinsci/jenkins | core/src/main/java/hudson/ProxyConfiguration.java | ProxyConfiguration.jenkins48775workaround | private void jenkins48775workaround(Proxy proxy, URL url) {
if ("https".equals(url.getProtocol()) && !authCacheSeeded && proxy != Proxy.NO_PROXY) {
HttpURLConnection preAuth = null;
try {
// We do not care if there is anything at this URL, all we care is that it is using the proxy
preAuth = (HttpURLConnection) new URL("http", url.getHost(), -1, "/").openConnection(proxy);
preAuth.setRequestMethod("HEAD");
preAuth.connect();
} catch (IOException e) {
// ignore, this is just a probe we don't care at all
} finally {
if (preAuth != null) {
preAuth.disconnect();
}
}
authCacheSeeded = true;
} else if ("https".equals(url.getProtocol())){
// if we access any http url using a proxy then the auth cache will have been seeded
authCacheSeeded = authCacheSeeded || proxy != Proxy.NO_PROXY;
}
} | java | private void jenkins48775workaround(Proxy proxy, URL url) {
if ("https".equals(url.getProtocol()) && !authCacheSeeded && proxy != Proxy.NO_PROXY) {
HttpURLConnection preAuth = null;
try {
// We do not care if there is anything at this URL, all we care is that it is using the proxy
preAuth = (HttpURLConnection) new URL("http", url.getHost(), -1, "/").openConnection(proxy);
preAuth.setRequestMethod("HEAD");
preAuth.connect();
} catch (IOException e) {
// ignore, this is just a probe we don't care at all
} finally {
if (preAuth != null) {
preAuth.disconnect();
}
}
authCacheSeeded = true;
} else if ("https".equals(url.getProtocol())){
// if we access any http url using a proxy then the auth cache will have been seeded
authCacheSeeded = authCacheSeeded || proxy != Proxy.NO_PROXY;
}
} | [
"private",
"void",
"jenkins48775workaround",
"(",
"Proxy",
"proxy",
",",
"URL",
"url",
")",
"{",
"if",
"(",
"\"https\"",
".",
"equals",
"(",
"url",
".",
"getProtocol",
"(",
")",
")",
"&&",
"!",
"authCacheSeeded",
"&&",
"proxy",
"!=",
"Proxy",
".",
"NO_PR... | If the first URL we try to access with a HTTP proxy is HTTPS then the authentication cache will not have been
pre-populated, so we try to access at least one HTTP URL before the very first HTTPS url.
@param proxy
@param url the actual URL being opened. | [
"If",
"the",
"first",
"URL",
"we",
"try",
"to",
"access",
"with",
"a",
"HTTP",
"proxy",
"is",
"HTTPS",
"then",
"the",
"authentication",
"cache",
"will",
"not",
"have",
"been",
"pre",
"-",
"populated",
"so",
"we",
"try",
"to",
"access",
"at",
"least",
"... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/ProxyConfiguration.java#L301-L321 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java | JRebirth.runIntoJATSync | public static void runIntoJATSync(final JRebirthRunnable runnable, final long... timeout) {
final SyncRunnable sync = new SyncRunnable(runnable);
if (Platform.isFxApplicationThread()) {
// We are into a JAT so just run it synchronously
sync.run();
// Be careful in this case no timeout protection is achieved
} else {
// The runnable will be run into the JAT during the next round
Platform.runLater(sync);
// Wait the end of the runnable execution
sync.waitEnd(timeout);
}
} | java | public static void runIntoJATSync(final JRebirthRunnable runnable, final long... timeout) {
final SyncRunnable sync = new SyncRunnable(runnable);
if (Platform.isFxApplicationThread()) {
// We are into a JAT so just run it synchronously
sync.run();
// Be careful in this case no timeout protection is achieved
} else {
// The runnable will be run into the JAT during the next round
Platform.runLater(sync);
// Wait the end of the runnable execution
sync.waitEnd(timeout);
}
} | [
"public",
"static",
"void",
"runIntoJATSync",
"(",
"final",
"JRebirthRunnable",
"runnable",
",",
"final",
"long",
"...",
"timeout",
")",
"{",
"final",
"SyncRunnable",
"sync",
"=",
"new",
"SyncRunnable",
"(",
"runnable",
")",
";",
"if",
"(",
"Platform",
".",
... | Run the task into the JavaFX Application Thread [JAT] <b>Synchronously</b>.
@param runnable the task to run
@param timeout the optional timeout value after which the thread will be released (default is 1000 ms) | [
"Run",
"the",
"task",
"into",
"the",
"JavaFX",
"Application",
"Thread",
"[",
"JAT",
"]",
"<b",
">",
"Synchronously<",
"/",
"b",
">",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java#L196-L210 |
jayantk/jklol | src/com/jayantkrish/jklol/inference/JunctionTree.java | JunctionTree.computeMarginal | private static Factor computeMarginal(CliqueTree cliqueTree, int factorNum, boolean useSumProduct) {
Set<Integer> factorNumsToCombine = Sets.newHashSet(cliqueTree.getNeighboringFactors(factorNum));
factorNumsToCombine.removeAll(cliqueTree.getFactorsInMarginal(factorNum));
List<Factor> factorsToCombine = Lists.newArrayList();
for (int adjacentFactorNum : factorNumsToCombine) {
Factor message = cliqueTree.getMessage(adjacentFactorNum, factorNum);
Preconditions.checkState(message != null, "Invalid message passing order! Trying to pass %s -> %s",
adjacentFactorNum, factorNum);
factorsToCombine.add(message);
}
Factor newMarginal = cliqueTree.getMarginal(factorNum).product(factorsToCombine);
cliqueTree.setMarginal(factorNum, newMarginal);
cliqueTree.addFactorsToMarginal(factorNum, factorNumsToCombine);
return newMarginal;
} | java | private static Factor computeMarginal(CliqueTree cliqueTree, int factorNum, boolean useSumProduct) {
Set<Integer> factorNumsToCombine = Sets.newHashSet(cliqueTree.getNeighboringFactors(factorNum));
factorNumsToCombine.removeAll(cliqueTree.getFactorsInMarginal(factorNum));
List<Factor> factorsToCombine = Lists.newArrayList();
for (int adjacentFactorNum : factorNumsToCombine) {
Factor message = cliqueTree.getMessage(adjacentFactorNum, factorNum);
Preconditions.checkState(message != null, "Invalid message passing order! Trying to pass %s -> %s",
adjacentFactorNum, factorNum);
factorsToCombine.add(message);
}
Factor newMarginal = cliqueTree.getMarginal(factorNum).product(factorsToCombine);
cliqueTree.setMarginal(factorNum, newMarginal);
cliqueTree.addFactorsToMarginal(factorNum, factorNumsToCombine);
return newMarginal;
} | [
"private",
"static",
"Factor",
"computeMarginal",
"(",
"CliqueTree",
"cliqueTree",
",",
"int",
"factorNum",
",",
"boolean",
"useSumProduct",
")",
"{",
"Set",
"<",
"Integer",
">",
"factorNumsToCombine",
"=",
"Sets",
".",
"newHashSet",
"(",
"cliqueTree",
".",
"get... | Computes the marginal distribution over the {@code factorNum}'th factor in
{@code cliqueTree}. If {@code useSumProduct} is {@code true}, this computes
marginals; otherwise, it computes max-marginals. Requires that
{@code cliqueTree} contains all of the inbound messages to factor
{@code factorNum}.
@param cliqueTree
@param factorNum
@param useSumProduct
@return | [
"Computes",
"the",
"marginal",
"distribution",
"over",
"the",
"{",
"@code",
"factorNum",
"}",
"th",
"factor",
"in",
"{",
"@code",
"cliqueTree",
"}",
".",
"If",
"{",
"@code",
"useSumProduct",
"}",
"is",
"{",
"@code",
"true",
"}",
"this",
"computes",
"margin... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/inference/JunctionTree.java#L259-L276 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/Bond.java | Bond.getValue | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
double productToModelTimeOffset = 0;
try {
if(referenceDate != null) {
productToModelTimeOffset = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate(), referenceDate);
}
}
catch(UnsupportedOperationException e) {};
// Get random variables
RandomVariable numeraire = model.getNumeraire(productToModelTimeOffset + maturity);
RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(productToModelTimeOffset + maturity);
// Calculate numeraire relative value
RandomVariable values = model.getRandomVariableForConstant(1.0);
values = values.div(numeraire).mult(monteCarloProbabilities);
// Convert back to values
RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime);
RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime);
values = values.mult(numeraireAtEvaluationTime).div(monteCarloProbabilitiesAtEvaluationTime);
// Return values
return values;
} | java | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
double productToModelTimeOffset = 0;
try {
if(referenceDate != null) {
productToModelTimeOffset = FloatingpointDate.getFloatingPointDateFromDate(model.getReferenceDate(), referenceDate);
}
}
catch(UnsupportedOperationException e) {};
// Get random variables
RandomVariable numeraire = model.getNumeraire(productToModelTimeOffset + maturity);
RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(productToModelTimeOffset + maturity);
// Calculate numeraire relative value
RandomVariable values = model.getRandomVariableForConstant(1.0);
values = values.div(numeraire).mult(monteCarloProbabilities);
// Convert back to values
RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime);
RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime);
values = values.mult(numeraireAtEvaluationTime).div(monteCarloProbabilitiesAtEvaluationTime);
// Return values
return values;
} | [
"@",
"Override",
"public",
"RandomVariable",
"getValue",
"(",
"double",
"evaluationTime",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"double",
"productToModelTimeOffset",
"=",
"0",
";",
"try",
"{",
"if",
"(",
"refe... | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"valu... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/Bond.java#L54-L80 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/FilePathProcessor.java | FilePathProcessor.processPath | public static void processPath(File path, FileFilter filter, FileProcessor processor) {
if (path.isDirectory()) {
// if path is a directory, look into it
File[] directoryListing = path.listFiles(filter);
if (directoryListing == null) {
throw new IllegalArgumentException("Directory access problem for: " + path);
}
for (File file : directoryListing) {
processPath(file, filter, processor);
}
} else {
// it's already passed the filter or was uniquely specified
// if (filter.accept(path))
processor.processFile(path);
}
} | java | public static void processPath(File path, FileFilter filter, FileProcessor processor) {
if (path.isDirectory()) {
// if path is a directory, look into it
File[] directoryListing = path.listFiles(filter);
if (directoryListing == null) {
throw new IllegalArgumentException("Directory access problem for: " + path);
}
for (File file : directoryListing) {
processPath(file, filter, processor);
}
} else {
// it's already passed the filter or was uniquely specified
// if (filter.accept(path))
processor.processFile(path);
}
} | [
"public",
"static",
"void",
"processPath",
"(",
"File",
"path",
",",
"FileFilter",
"filter",
",",
"FileProcessor",
"processor",
")",
"{",
"if",
"(",
"path",
".",
"isDirectory",
"(",
")",
")",
"{",
"// if path is a directory, look into it\r",
"File",
"[",
"]",
... | Apply a function to the files under a given directory and
perhaps its subdirectories. If the path is a directory then only
files within the directory (perhaps recursively) that satisfy the
filter are processed. If the <code>path</code>is a file, then
that file is processed regardless of whether it satisfies the
filter. (This semantics was adopted, since otherwise there was no
easy way to go through all the files in a directory without
descending recursively via the specification of a
<code>FileFilter</code>.)
@param path file or directory to load from
@param filter a FileFilter of files to load. The filter may be null,
and then all files are processed.
@param processor The <code>FileProcessor</code> to apply to each
<code>File</code> | [
"Apply",
"a",
"function",
"to",
"the",
"files",
"under",
"a",
"given",
"directory",
"and",
"perhaps",
"its",
"subdirectories",
".",
"If",
"the",
"path",
"is",
"a",
"directory",
"then",
"only",
"files",
"within",
"the",
"directory",
"(",
"perhaps",
"recursive... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/FilePathProcessor.java#L71-L86 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java | ConditionalCheck.isNumber | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static <T extends Number> void isNumber(final boolean condition, @Nonnull final String value, @Nonnull final Class<T> type) {
if (condition) {
Check.isNumber(value, type);
}
} | java | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static <T extends Number> void isNumber(final boolean condition, @Nonnull final String value, @Nonnull final Class<T> type) {
if (condition) {
Check.isNumber(value, type);
}
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"{",
"IllegalNullArgumentException",
".",
"class",
",",
"IllegalNumberArgumentException",
".",
"class",
"}",
")",
"public",
"static",
"<",
"T",
"extends",
"Number",
">",
"void",
"isNumber",
"(",
"final",
"boolean",
"c... | Ensures that a String argument is a number. This overload supports all subclasses of {@code Number}. The number
is first converted to a BigInteger
@param condition
condition must be {@code true}^ so that the check will be performed
@param value
value which must be a number
@param type
requested return value type, must be a subclass of {@code Number}, i.e. one of {@code BigDecimal,
BigInteger, Byte, Double, Float, Integer, Long, Short}
@throws IllegalNumberArgumentException
if the given argument {@code value} is no number | [
"Ensures",
"that",
"a",
"String",
"argument",
"is",
"a",
"number",
".",
"This",
"overload",
"supports",
"all",
"subclasses",
"of",
"{",
"@code",
"Number",
"}",
".",
"The",
"number",
"is",
"first",
"converted",
"to",
"a",
"BigInteger"
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L835-L841 |
zk1931/jzab | src/main/java/com/github/zk1931/jzab/FileUtils.java | FileUtils.writeLongToFile | public static void writeLongToFile(long value, File file) throws IOException {
// Create a temp file in the same directory as the file parameter.
File temp = File.createTempFile(file.getName(), null,
file.getAbsoluteFile().getParentFile());
try (FileOutputStream fos = new FileOutputStream(temp);
OutputStreamWriter os =
new OutputStreamWriter(fos, Charset.forName("UTF-8"));
PrintWriter pw = new PrintWriter(os)) {
pw.print(Long.toString(value));
fos.getChannel().force(true);
}
atomicMove(temp, file);
LOG.debug("Atomically moved {} to {}", temp, file);
} | java | public static void writeLongToFile(long value, File file) throws IOException {
// Create a temp file in the same directory as the file parameter.
File temp = File.createTempFile(file.getName(), null,
file.getAbsoluteFile().getParentFile());
try (FileOutputStream fos = new FileOutputStream(temp);
OutputStreamWriter os =
new OutputStreamWriter(fos, Charset.forName("UTF-8"));
PrintWriter pw = new PrintWriter(os)) {
pw.print(Long.toString(value));
fos.getChannel().force(true);
}
atomicMove(temp, file);
LOG.debug("Atomically moved {} to {}", temp, file);
} | [
"public",
"static",
"void",
"writeLongToFile",
"(",
"long",
"value",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"// Create a temp file in the same directory as the file parameter.",
"File",
"temp",
"=",
"File",
".",
"createTempFile",
"(",
"file",
".",
"ge... | Atomically writes a long integer to a file.
This method writes a long integer to a file by first writing the long
integer to a temporary file and then atomically moving it to the
destination, overwriting the destination file if it already exists.
@param value a long integer value to write.
@param file file to write the value to.
@throws IOException if an I/O error occurs. | [
"Atomically",
"writes",
"a",
"long",
"integer",
"to",
"a",
"file",
"."
] | train | https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/FileUtils.java#L60-L73 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/index/IndexAVL.java | IndexAVL.findFirstRow | @Override
public RowIterator findFirstRow(Session session, PersistentStore store,
Object[] rowdata, int match) {
NodeAVL node = findNode(session, store, rowdata, defaultColMap, match);
return getIterator(session, store, node);
} | java | @Override
public RowIterator findFirstRow(Session session, PersistentStore store,
Object[] rowdata, int match) {
NodeAVL node = findNode(session, store, rowdata, defaultColMap, match);
return getIterator(session, store, node);
} | [
"@",
"Override",
"public",
"RowIterator",
"findFirstRow",
"(",
"Session",
"session",
",",
"PersistentStore",
"store",
",",
"Object",
"[",
"]",
"rowdata",
",",
"int",
"match",
")",
"{",
"NodeAVL",
"node",
"=",
"findNode",
"(",
"session",
",",
"store",
",",
... | Return the first node equal to the indexdata object. The rowdata has
the same column mapping as this index.
@param session session object
@param store store object
@param rowdata array containing index column data
@param match count of columns to match
@return iterator | [
"Return",
"the",
"first",
"node",
"equal",
"to",
"the",
"indexdata",
"object",
".",
"The",
"rowdata",
"has",
"the",
"same",
"column",
"mapping",
"as",
"this",
"index",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/index/IndexAVL.java#L808-L815 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.deleteStorageAccount | public void deleteStorageAccount(String resourceGroupName, String accountName, String storageAccountName) {
deleteStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).toBlocking().single().body();
} | java | public void deleteStorageAccount(String resourceGroupName, String accountName, String storageAccountName) {
deleteStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName).toBlocking().single().body();
} | [
"public",
"void",
"deleteStorageAccount",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"storageAccountName",
")",
"{",
"deleteStorageAccountWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"storageAccountName",
... | Updates the specified Data Lake Analytics account to remove an Azure Storage account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account from which to remove the Azure Storage account.
@param storageAccountName The name of the Azure Storage account to remove
@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 | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"remove",
"an",
"Azure",
"Storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L284-L286 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java | SeqRes2AtomAligner.mapSeqresRecords | public void mapSeqresRecords(Chain atomRes, Chain seqRes) {
List<Group> seqResGroups = seqRes.getAtomGroups();
List<Group> atmResGroups = atomRes.getAtomGroups();
logger.debug("Comparing ATOM {} ({} groups) to SEQRES {} ({} groups) ",
atomRes.getId(), atmResGroups.size(), seqRes.getId(), seqResGroups.size());
List<Group> matchedGroups = trySimpleMatch(seqResGroups, atmResGroups);
if ( matchedGroups != null) {
// update the new SEQRES list
atomRes.setSeqResGroups(matchedGroups);
return;
}
logger.debug("Could not map SEQRES to ATOM records easily, need to align...");
int numAminosSeqres = seqRes.getAtomGroups(GroupType.AMINOACID).size();
int numNucleotidesSeqres = seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size();
if ( numAminosSeqres < 1) {
if ( numNucleotidesSeqres > 1) {
logger.debug("SEQRES chain {} is a nucleotide chain ({} nucleotides), aligning nucleotides...", seqRes.getId(), numNucleotidesSeqres);
alignNucleotideChains(seqRes,atomRes);
return;
} else {
logger.debug("SEQRES chain {} contains {} amino acids and {} nucleotides, ignoring...", seqRes.getId(),numAminosSeqres,numNucleotidesSeqres);
return;
}
}
if ( atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
logger.debug("ATOM chain {} does not contain amino acids, ignoring...", atomRes.getId());
return;
}
logger.debug("Proceeding to do protein alignment for chain {}", atomRes.getId() );
boolean noMatchFound = alignProteinChains(seqResGroups,atomRes.getAtomGroups());
if ( ! noMatchFound){
atomRes.setSeqResGroups(seqResGroups);
}
} | java | public void mapSeqresRecords(Chain atomRes, Chain seqRes) {
List<Group> seqResGroups = seqRes.getAtomGroups();
List<Group> atmResGroups = atomRes.getAtomGroups();
logger.debug("Comparing ATOM {} ({} groups) to SEQRES {} ({} groups) ",
atomRes.getId(), atmResGroups.size(), seqRes.getId(), seqResGroups.size());
List<Group> matchedGroups = trySimpleMatch(seqResGroups, atmResGroups);
if ( matchedGroups != null) {
// update the new SEQRES list
atomRes.setSeqResGroups(matchedGroups);
return;
}
logger.debug("Could not map SEQRES to ATOM records easily, need to align...");
int numAminosSeqres = seqRes.getAtomGroups(GroupType.AMINOACID).size();
int numNucleotidesSeqres = seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size();
if ( numAminosSeqres < 1) {
if ( numNucleotidesSeqres > 1) {
logger.debug("SEQRES chain {} is a nucleotide chain ({} nucleotides), aligning nucleotides...", seqRes.getId(), numNucleotidesSeqres);
alignNucleotideChains(seqRes,atomRes);
return;
} else {
logger.debug("SEQRES chain {} contains {} amino acids and {} nucleotides, ignoring...", seqRes.getId(),numAminosSeqres,numNucleotidesSeqres);
return;
}
}
if ( atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
logger.debug("ATOM chain {} does not contain amino acids, ignoring...", atomRes.getId());
return;
}
logger.debug("Proceeding to do protein alignment for chain {}", atomRes.getId() );
boolean noMatchFound = alignProteinChains(seqResGroups,atomRes.getAtomGroups());
if ( ! noMatchFound){
atomRes.setSeqResGroups(seqResGroups);
}
} | [
"public",
"void",
"mapSeqresRecords",
"(",
"Chain",
"atomRes",
",",
"Chain",
"seqRes",
")",
"{",
"List",
"<",
"Group",
">",
"seqResGroups",
"=",
"seqRes",
".",
"getAtomGroups",
"(",
")",
";",
"List",
"<",
"Group",
">",
"atmResGroups",
"=",
"atomRes",
".",
... | Map the seqRes groups to the atomRes chain.
Updates the atomRes chain object with the mapped data
The seqRes chain should not be needed after this and atomRes should be further used.
@param atomRes the chain containing ATOM groups (in atomGroups slot). This chain
is modified to contain in its seqresGroups slot the mapped atom groups
@param seqRes the chain containing SEQRES groups (in atomGroups slot). This chain
is not modified | [
"Map",
"the",
"seqRes",
"groups",
"to",
"the",
"atomRes",
"chain",
".",
"Updates",
"the",
"atomRes",
"chain",
"object",
"with",
"the",
"mapped",
"data",
"The",
"seqRes",
"chain",
"should",
"not",
"be",
"needed",
"after",
"this",
"and",
"atomRes",
"should",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java#L162-L214 |
ziccardi/jnrpe | jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/HttpUtils.java | HttpUtils.sendPostData | public static void sendPostData(HttpURLConnection conn, String encodedData) throws IOException {
StreamManager sm = new StreamManager();
try {
conn.setDoOutput(true);
conn.setRequestMethod("POST");
if (conn.getRequestProperty("Content-Type") == null) {
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
}
if (encodedData != null) {
if (conn.getRequestProperty("Content-Length") == null) {
conn.setRequestProperty("Content-Length", String.valueOf(encodedData.getBytes("UTF-8").length));
}
DataOutputStream out = new DataOutputStream(sm.handle(conn.getOutputStream()));
out.write(encodedData.getBytes());
out.close();
}
} finally {
sm.closeAll();
}
} | java | public static void sendPostData(HttpURLConnection conn, String encodedData) throws IOException {
StreamManager sm = new StreamManager();
try {
conn.setDoOutput(true);
conn.setRequestMethod("POST");
if (conn.getRequestProperty("Content-Type") == null) {
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
}
if (encodedData != null) {
if (conn.getRequestProperty("Content-Length") == null) {
conn.setRequestProperty("Content-Length", String.valueOf(encodedData.getBytes("UTF-8").length));
}
DataOutputStream out = new DataOutputStream(sm.handle(conn.getOutputStream()));
out.write(encodedData.getBytes());
out.close();
}
} finally {
sm.closeAll();
}
} | [
"public",
"static",
"void",
"sendPostData",
"(",
"HttpURLConnection",
"conn",
",",
"String",
"encodedData",
")",
"throws",
"IOException",
"{",
"StreamManager",
"sm",
"=",
"new",
"StreamManager",
"(",
")",
";",
"try",
"{",
"conn",
".",
"setDoOutput",
"(",
"true... | Submits http post data to an HttpURLConnection.
@param conn teh connection
@param encodedData the encoded data to be sent
@throws IOException on any connection | [
"Submits",
"http",
"post",
"data",
"to",
"an",
"HttpURLConnection",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/HttpUtils.java#L95-L117 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/MRCompactor.java | MRCompactor.checkAlreadyCompactedBasedOnSourceDirName | private static boolean checkAlreadyCompactedBasedOnSourceDirName (FileSystem fs, Dataset dataset) {
try {
Set<Path> renamedDirs = getDeepestLevelRenamedDirsWithFileExistence(fs, dataset.inputPaths());
return !renamedDirs.isEmpty();
} catch (IOException e) {
LOG.error("Failed to get deepest directories from source", e);
return false;
}
} | java | private static boolean checkAlreadyCompactedBasedOnSourceDirName (FileSystem fs, Dataset dataset) {
try {
Set<Path> renamedDirs = getDeepestLevelRenamedDirsWithFileExistence(fs, dataset.inputPaths());
return !renamedDirs.isEmpty();
} catch (IOException e) {
LOG.error("Failed to get deepest directories from source", e);
return false;
}
} | [
"private",
"static",
"boolean",
"checkAlreadyCompactedBasedOnSourceDirName",
"(",
"FileSystem",
"fs",
",",
"Dataset",
"dataset",
")",
"{",
"try",
"{",
"Set",
"<",
"Path",
">",
"renamedDirs",
"=",
"getDeepestLevelRenamedDirsWithFileExistence",
"(",
"fs",
",",
"dataset"... | When renaming source directory strategy is used, a compaction completion means source directories
{@link Dataset#inputPaths()} contains at least one directory which has been renamed to something with
{@link MRCompactor#COMPACTION_RENAME_SOURCE_DIR_SUFFIX}. | [
"When",
"renaming",
"source",
"directory",
"strategy",
"is",
"used",
"a",
"compaction",
"completion",
"means",
"source",
"directories",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/MRCompactor.java#L620-L628 |
xiancloud/xian | xian-message/src/main/java/info/xiancloud/message/short_msg/yunpian/JavaSmsApi.java | JavaSmsApi.sendSms | public static Single<String> sendSms(String apikey, String text, String mobile) {
Map<String, String> params = new HashMap<String, String>();
params.put("apikey", apikey);
params.put("text", text);
params.put("mobile", mobile);
return post(URI_SEND_SMS, params);
} | java | public static Single<String> sendSms(String apikey, String text, String mobile) {
Map<String, String> params = new HashMap<String, String>();
params.put("apikey", apikey);
params.put("text", text);
params.put("mobile", mobile);
return post(URI_SEND_SMS, params);
} | [
"public",
"static",
"Single",
"<",
"String",
">",
"sendSms",
"(",
"String",
"apikey",
",",
"String",
"text",
",",
"String",
"mobile",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">"... | 智能匹配模版接口发短信
@param apikey apikey
@param text 短信内容
@param mobile 接受的手机号
@return json格式字符串 | [
"智能匹配模版接口发短信"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-message/src/main/java/info/xiancloud/message/short_msg/yunpian/JavaSmsApi.java#L90-L96 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateAffineZYX | public Matrix4f rotateAffineZYX(float angleZ, float angleY, float angleX) {
return rotateAffineZYX(angleZ, angleY, angleX, thisOrNew());
} | java | public Matrix4f rotateAffineZYX(float angleZ, float angleY, float angleX) {
return rotateAffineZYX(angleZ, angleY, angleX, thisOrNew());
} | [
"public",
"Matrix4f",
"rotateAffineZYX",
"(",
"float",
"angleZ",
",",
"float",
"angleY",
",",
"float",
"angleX",
")",
"{",
"return",
"rotateAffineZYX",
"(",
"angleZ",
",",
"angleY",
",",
"angleX",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Apply rotation of <code>angleZ</code> radians about the Z axis, followed by a rotation of <code>angleY</code> radians about the Y axis and
followed by a rotation of <code>angleX</code> radians about the X axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
This method assumes that <code>this</code> matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to <code>(0, 0, 0, 1)</code>)
and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
@param angleZ
the angle to rotate about Z
@param angleY
the angle to rotate about Y
@param angleX
the angle to rotate about X
@return a matrix holding the result | [
"Apply",
"rotation",
"of",
"<code",
">",
"angleZ<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angleY<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"and",
"followed",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5579-L5581 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/records/converter/RecordReaderConverter.java | RecordReaderConverter.convert | public static void convert(SequenceRecordReader reader, SequenceRecordWriter writer, boolean closeOnCompletion) throws IOException {
if(!reader.hasNext()){
throw new UnsupportedOperationException("Cannot convert SequenceRecordReader: reader has no next element");
}
while(reader.hasNext()){
writer.write(reader.sequenceRecord());
}
if(closeOnCompletion){
writer.close();
}
} | java | public static void convert(SequenceRecordReader reader, SequenceRecordWriter writer, boolean closeOnCompletion) throws IOException {
if(!reader.hasNext()){
throw new UnsupportedOperationException("Cannot convert SequenceRecordReader: reader has no next element");
}
while(reader.hasNext()){
writer.write(reader.sequenceRecord());
}
if(closeOnCompletion){
writer.close();
}
} | [
"public",
"static",
"void",
"convert",
"(",
"SequenceRecordReader",
"reader",
",",
"SequenceRecordWriter",
"writer",
",",
"boolean",
"closeOnCompletion",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"reader",
".",
"hasNext",
"(",
")",
")",
"{",
"throw",
... | Write all sequences from the specified sequence record reader to the specified sequence record writer.
Closes the sequence record writer on completion.
@param reader Sequence record reader (source of data)
@param writer Sequence record writer (location to write data)
@param closeOnCompletion if true: close the record writer once complete, via {@link SequenceRecordWriter#close()}
@throws IOException If underlying reader/writer throws an exception | [
"Write",
"all",
"sequences",
"from",
"the",
"specified",
"sequence",
"record",
"reader",
"to",
"the",
"specified",
"sequence",
"record",
"writer",
".",
"Closes",
"the",
"sequence",
"record",
"writer",
"on",
"completion",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/records/converter/RecordReaderConverter.java#L93-L106 |
martinpaljak/apdu4j | src/main/java/apdu4j/remote/RemoteTerminal.java | RemoteTerminal.verifyPIN | public boolean verifyPIN(int p2, String text) throws IOException, UserCancelExcption{
Map<String, Object> m = JSONProtocol.cmd("verify");
m.put("p2", p2);
m.put("text", text);
pipe.send(m);
return JSONProtocol.check(m, pipe.recv());
} | java | public boolean verifyPIN(int p2, String text) throws IOException, UserCancelExcption{
Map<String, Object> m = JSONProtocol.cmd("verify");
m.put("p2", p2);
m.put("text", text);
pipe.send(m);
return JSONProtocol.check(m, pipe.recv());
} | [
"public",
"boolean",
"verifyPIN",
"(",
"int",
"p2",
",",
"String",
"text",
")",
"throws",
"IOException",
",",
"UserCancelExcption",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"m",
"=",
"JSONProtocol",
".",
"cmd",
"(",
"\"verify\"",
")",
";",
"m",
"."... | Issues a ISO VERIFY on the remote terminal.
@param p2 P2 parameter in the VERIFY APDU
@param text to be displayed to the user
@return true if VERIFY returned 0x9000, false otherwise
@throws IOException when communication fails | [
"Issues",
"a",
"ISO",
"VERIFY",
"on",
"the",
"remote",
"terminal",
"."
] | train | https://github.com/martinpaljak/apdu4j/blob/dca977bfa9e4fa236a9a7b87a2a09e5472ea9969/src/main/java/apdu4j/remote/RemoteTerminal.java#L175-L181 |
elki-project/elki | elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/AbstractMTreeNode.java | AbstractMTreeNode.adjustEntry | public boolean adjustEntry(E entry, DBID routingObjectID, double parentDistance, AbstractMTree<O, N, E, ?> mTree) {
boolean changed = entry.setRoutingObjectID(routingObjectID);
changed |= entry.setParentDistance(parentDistance);
changed |= entry.setCoveringRadius(coveringRadiusFromEntries(routingObjectID, mTree));
return changed;
} | java | public boolean adjustEntry(E entry, DBID routingObjectID, double parentDistance, AbstractMTree<O, N, E, ?> mTree) {
boolean changed = entry.setRoutingObjectID(routingObjectID);
changed |= entry.setParentDistance(parentDistance);
changed |= entry.setCoveringRadius(coveringRadiusFromEntries(routingObjectID, mTree));
return changed;
} | [
"public",
"boolean",
"adjustEntry",
"(",
"E",
"entry",
",",
"DBID",
"routingObjectID",
",",
"double",
"parentDistance",
",",
"AbstractMTree",
"<",
"O",
",",
"N",
",",
"E",
",",
"?",
">",
"mTree",
")",
"{",
"boolean",
"changed",
"=",
"entry",
".",
"setRou... | Adjusts the parameters of the entry representing this node (e.g. after
insertion of new objects). Subclasses may need to overwrite this method.
@param entry the entry representing this node
@param routingObjectID the id of the (new) routing object of this node
@param parentDistance the distance from the routing object of this node to
the routing object of the parent node
@param mTree the M-Tree object holding this node
@return {@code true} if adjustment of parent is needed | [
"Adjusts",
"the",
"parameters",
"of",
"the",
"entry",
"representing",
"this",
"node",
"(",
"e",
".",
"g",
".",
"after",
"insertion",
"of",
"new",
"objects",
")",
".",
"Subclasses",
"may",
"need",
"to",
"overwrite",
"this",
"method",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/AbstractMTreeNode.java#L72-L77 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractRepositoryClient.java | AbstractRepositoryClient.allFiltersAreEmpty | protected boolean allFiltersAreEmpty(Map<FilterableAttribute, Collection<String>> filters) {
for (Map.Entry<FilterableAttribute, Collection<String>> filter : filters.entrySet()) {
Collection<String> values = filter.getValue();
if (values != null && !values.isEmpty()) {
return false;
}
}
return true;
} | java | protected boolean allFiltersAreEmpty(Map<FilterableAttribute, Collection<String>> filters) {
for (Map.Entry<FilterableAttribute, Collection<String>> filter : filters.entrySet()) {
Collection<String> values = filter.getValue();
if (values != null && !values.isEmpty()) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"allFiltersAreEmpty",
"(",
"Map",
"<",
"FilterableAttribute",
",",
"Collection",
"<",
"String",
">",
">",
"filters",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"FilterableAttribute",
",",
"Collection",
"<",
"String",
">",
">",
"f... | Returns <code>true</code> if all the filters are empty.
@param filters
@return | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"all",
"the",
"filters",
"are",
"empty",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractRepositoryClient.java#L188-L196 |
albfernandez/itext2 | src/main/java/com/lowagie/text/FontFactory.java | FontFactory.getFont | public static Font getFont(String fontname, String encoding, boolean embedded, float size) {
return getFont(fontname, encoding, embedded, size, Font.UNDEFINED, null);
} | java | public static Font getFont(String fontname, String encoding, boolean embedded, float size) {
return getFont(fontname, encoding, embedded, size, Font.UNDEFINED, null);
} | [
"public",
"static",
"Font",
"getFont",
"(",
"String",
"fontname",
",",
"String",
"encoding",
",",
"boolean",
"embedded",
",",
"float",
"size",
")",
"{",
"return",
"getFont",
"(",
"fontname",
",",
"encoding",
",",
"embedded",
",",
"size",
",",
"Font",
".",
... | Constructs a <CODE>Font</CODE>-object.
@param fontname the name of the font
@param encoding the encoding of the font
@param embedded true if the font is to be embedded in the PDF
@param size the size of this font
@return the Font constructed based on the parameters | [
"Constructs",
"a",
"<CODE",
">",
"Font<",
"/",
"CODE",
">",
"-",
"object",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/FontFactory.java#L197-L199 |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.ignoreWarnOrFail | private <T extends Throwable> T ignoreWarnOrFail(Throwable throwable, Class<T> exceptionClassToRaise, String msgKey, Object... objs) {
// Read the value each time in order to allow for changes to the onError setting
switch ((OnError) props.get(OnErrorUtil.CFG_KEY_ON_ERROR)) {
case IGNORE:
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "ignoring error: " + msgKey, objs);
return null;
case WARN:
Tr.warning(tc, msgKey, objs);
return null;
case FAIL:
try {
if (throwable != null && exceptionClassToRaise.isInstance(throwable))
return exceptionClassToRaise.cast(throwable);
Constructor<T> con = exceptionClassToRaise.getConstructor(String.class);
String message = msgKey == null ? throwable.getMessage() : Tr.formatMessage(tc, msgKey, objs);
T failure = con.newInstance(message);
failure.initCause(throwable);
return failure;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return null;
} | java | private <T extends Throwable> T ignoreWarnOrFail(Throwable throwable, Class<T> exceptionClassToRaise, String msgKey, Object... objs) {
// Read the value each time in order to allow for changes to the onError setting
switch ((OnError) props.get(OnErrorUtil.CFG_KEY_ON_ERROR)) {
case IGNORE:
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "ignoring error: " + msgKey, objs);
return null;
case WARN:
Tr.warning(tc, msgKey, objs);
return null;
case FAIL:
try {
if (throwable != null && exceptionClassToRaise.isInstance(throwable))
return exceptionClassToRaise.cast(throwable);
Constructor<T> con = exceptionClassToRaise.getConstructor(String.class);
String message = msgKey == null ? throwable.getMessage() : Tr.formatMessage(tc, msgKey, objs);
T failure = con.newInstance(message);
failure.initCause(throwable);
return failure;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return null;
} | [
"private",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"ignoreWarnOrFail",
"(",
"Throwable",
"throwable",
",",
"Class",
"<",
"T",
">",
"exceptionClassToRaise",
",",
"String",
"msgKey",
",",
"Object",
"...",
"objs",
")",
"{",
"// Read the value each time in order t... | Ignore, warn, or fail when a configuration error occurs.
This is copied from Tim's code in tWAS and updated slightly to
override with the Liberty ignore/warn/fail setting.
Precondition: invoker must have lock on this MongoDBService instance, in order to read the onError property.
@param throwable an already created Throwable object, which can be used if the desired action is fail.
@param exceptionClassToRaise the class of the Throwable object to return
@param msgKey the NLS message key
@param objs list of objects to substitute in the NLS message
@return either null or the Throwable object | [
"Ignore",
"warn",
"or",
"fail",
"when",
"a",
"configuration",
"error",
"occurs",
".",
"This",
"is",
"copied",
"from",
"Tim",
"s",
"code",
"in",
"tWAS",
"and",
"updated",
"slightly",
"to",
"override",
"with",
"the",
"Liberty",
"ignore",
"/",
"warn",
"/",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L354-L383 |
anotheria/configureme | src/main/java/org/configureme/util/IOUtils.java | IOUtils.readInputStreamBufferedAsString | public static String readInputStreamBufferedAsString(final InputStream in, final String charset) throws IOException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new UnicodeReader(in, charset));
StringBuilder result = new StringBuilder();
char[] cbuf = new char[2048];
int read;
while ((read = reader.read(cbuf)) > 0)
result.append(cbuf, 0, read);
return result.toString();
} finally {
closeIgnoringException(reader);
}
} | java | public static String readInputStreamBufferedAsString(final InputStream in, final String charset) throws IOException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new UnicodeReader(in, charset));
StringBuilder result = new StringBuilder();
char[] cbuf = new char[2048];
int read;
while ((read = reader.read(cbuf)) > 0)
result.append(cbuf, 0, read);
return result.toString();
} finally {
closeIgnoringException(reader);
}
} | [
"public",
"static",
"String",
"readInputStreamBufferedAsString",
"(",
"final",
"InputStream",
"in",
",",
"final",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"new",
"BufferedReade... | <p>readInputStreamBufferedAsString.</p>
@param in a {@link java.io.InputStream} object.
@param charset a {@link java.lang.String} object.
@return a {@link java.lang.String} object.
@throws java.io.IOException if any. | [
"<p",
">",
"readInputStreamBufferedAsString",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/util/IOUtils.java#L125-L139 |
amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.toNavigableMap | public NavigableMap<K, V> toNavigableMap(BinaryOperator<V> mergeFunction) {
return collect(Collectors.toMap(Entry::getKey, Entry::getValue, mergeFunction, TreeMap::new));
} | java | public NavigableMap<K, V> toNavigableMap(BinaryOperator<V> mergeFunction) {
return collect(Collectors.toMap(Entry::getKey, Entry::getValue, mergeFunction, TreeMap::new));
} | [
"public",
"NavigableMap",
"<",
"K",
",",
"V",
">",
"toNavigableMap",
"(",
"BinaryOperator",
"<",
"V",
">",
"mergeFunction",
")",
"{",
"return",
"collect",
"(",
"Collectors",
".",
"toMap",
"(",
"Entry",
"::",
"getKey",
",",
"Entry",
"::",
"getValue",
",",
... | Returns a {@link NavigableMap} containing the elements of this stream.
There are no guarantees on the type or serializability of the
{@code NavigableMap} returned; if more control over the returned
{@code Map} is required, use
{@link #toCustomMap(BinaryOperator, Supplier)}.
<p>
If the mapped keys contains duplicates (according to
{@link Object#equals(Object)}), the value mapping function is applied to
each equal element, and the results are merged using the provided merging
function.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
Returned {@code NavigableMap} is guaranteed to be modifiable.
@param mergeFunction a merge function, used to resolve collisions between
values associated with the same key, as supplied to
{@link Map#merge(Object, Object, BiFunction)}
@return a {@code NavigableMap} containing the elements of this stream
@see Collectors#toMap(Function, Function)
@since 0.6.5 | [
"Returns",
"a",
"{",
"@link",
"NavigableMap",
"}",
"containing",
"the",
"elements",
"of",
"this",
"stream",
".",
"There",
"are",
"no",
"guarantees",
"on",
"the",
"type",
"or",
"serializability",
"of",
"the",
"{",
"@code",
"NavigableMap",
"}",
"returned",
";"... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L1389-L1391 |
hawkular/hawkular-inventory | hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java | Related.asTargetWith | public static Related asTargetWith(CanonicalPath entityPath, Relationships.WellKnown relationship) {
return new Related(entityPath, relationship.name(), EntityRole.TARGET);
} | java | public static Related asTargetWith(CanonicalPath entityPath, Relationships.WellKnown relationship) {
return new Related(entityPath, relationship.name(), EntityRole.TARGET);
} | [
"public",
"static",
"Related",
"asTargetWith",
"(",
"CanonicalPath",
"entityPath",
",",
"Relationships",
".",
"WellKnown",
"relationship",
")",
"{",
"return",
"new",
"Related",
"(",
"entityPath",
",",
"relationship",
".",
"name",
"(",
")",
",",
"EntityRole",
"."... | An overloaded version of {@link #asTargetWith(org.hawkular.inventory.paths.CanonicalPath, String)} that uses
one of the {@link org.hawkular.inventory.api.Relationships.WellKnown} as the name of the relationship.
@param entityPath the entity that is the source of the relationship
@param relationship the type of the relationship
@return a new "related" filter instance | [
"An",
"overloaded",
"version",
"of",
"{",
"@link",
"#asTargetWith",
"(",
"org",
".",
"hawkular",
".",
"inventory",
".",
"paths",
".",
"CanonicalPath",
"String",
")",
"}",
"that",
"uses",
"one",
"of",
"the",
"{",
"@link",
"org",
".",
"hawkular",
".",
"inv... | train | https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/filters/Related.java#L112-L114 |
alkacon/opencms-core | src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java | CmsNewResourceTypeDialog.addMessagesToVfsBundle | private void addMessagesToVfsBundle(Map<String, String> messages, CmsFile vfsBundleFile) throws CmsException {
lockTemporary(vfsBundleFile);
CmsObject cms = m_cms;
CmsXmlContent content = CmsXmlContentFactory.unmarshal(cms, vfsBundleFile);
Locale locale = CmsLocaleManager.getDefaultLocale();
if (!content.hasLocale(locale)) {
content.addLocale(cms, locale);
}
Element root = content.getLocaleNode(locale);
for (Entry<String, String> entry : messages.entrySet()) {
Element message = root.addElement(CmsVfsBundleLoaderXml.N_MESSAGE);
Element key = message.addElement(CmsVfsBundleLoaderXml.N_KEY);
key.setText(entry.getKey());
Element value = message.addElement(CmsVfsBundleLoaderXml.N_VALUE);
value.setText(entry.getValue());
}
content.initDocument();
vfsBundleFile.setContents(content.marshal());
cms.writeFile(vfsBundleFile);
} | java | private void addMessagesToVfsBundle(Map<String, String> messages, CmsFile vfsBundleFile) throws CmsException {
lockTemporary(vfsBundleFile);
CmsObject cms = m_cms;
CmsXmlContent content = CmsXmlContentFactory.unmarshal(cms, vfsBundleFile);
Locale locale = CmsLocaleManager.getDefaultLocale();
if (!content.hasLocale(locale)) {
content.addLocale(cms, locale);
}
Element root = content.getLocaleNode(locale);
for (Entry<String, String> entry : messages.entrySet()) {
Element message = root.addElement(CmsVfsBundleLoaderXml.N_MESSAGE);
Element key = message.addElement(CmsVfsBundleLoaderXml.N_KEY);
key.setText(entry.getKey());
Element value = message.addElement(CmsVfsBundleLoaderXml.N_VALUE);
value.setText(entry.getValue());
}
content.initDocument();
vfsBundleFile.setContents(content.marshal());
cms.writeFile(vfsBundleFile);
} | [
"private",
"void",
"addMessagesToVfsBundle",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"messages",
",",
"CmsFile",
"vfsBundleFile",
")",
"throws",
"CmsException",
"{",
"lockTemporary",
"(",
"vfsBundleFile",
")",
";",
"CmsObject",
"cms",
"=",
"m_cms",
";",
... | Adds the given messages to the vfs message bundle.<p>
@param messages the messages
@param vfsBundleFile the bundle file
@throws CmsException if something goes wrong writing the file | [
"Adds",
"the",
"given",
"messages",
"to",
"the",
"vfs",
"message",
"bundle",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java#L502-L522 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java | ServletBeanContext.getService | public <T> T getService(Class<T> serviceClass, Object selector)
{
T service = super.getService(serviceClass, selector);
if (service == null && serviceClass.equals(ControlBeanContextFactory.class)) {
return (T)_bcsp.getService(this, this, serviceClass, selector);
}
return service;
} | java | public <T> T getService(Class<T> serviceClass, Object selector)
{
T service = super.getService(serviceClass, selector);
if (service == null && serviceClass.equals(ControlBeanContextFactory.class)) {
return (T)_bcsp.getService(this, this, serviceClass, selector);
}
return service;
} | [
"public",
"<",
"T",
">",
"T",
"getService",
"(",
"Class",
"<",
"T",
">",
"serviceClass",
",",
"Object",
"selector",
")",
"{",
"T",
"service",
"=",
"super",
".",
"getService",
"(",
"serviceClass",
",",
"selector",
")",
";",
"if",
"(",
"service",
"==",
... | Override ControlBeanContext.getService(). A control bean creates its bean context using the
ControlBeanContextFactory service provided by this context. A control bean will attempt to create
its context before adding its self to this context as a child. This creates a chicken/egg problem since
only a child of a context may request a service from it.
This method provides a way to crack the chicken/egg problem by first trying to get the service using the
control bean context's getService() method, and if that call returns null and the requested service is
the ControlBeanContextFactory then returning an instance of the service provider.
@param serviceClass
@param selector | [
"Override",
"ControlBeanContext",
".",
"getService",
"()",
".",
"A",
"control",
"bean",
"creates",
"its",
"bean",
"context",
"using",
"the",
"ControlBeanContextFactory",
"service",
"provided",
"by",
"this",
"context",
".",
"A",
"control",
"bean",
"will",
"attempt"... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java#L242-L249 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateIntegrationResponseRequest.java | UpdateIntegrationResponseRequest.withResponseTemplates | public UpdateIntegrationResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | java | public UpdateIntegrationResponseRequest withResponseTemplates(java.util.Map<String, String> responseTemplates) {
setResponseTemplates(responseTemplates);
return this;
} | [
"public",
"UpdateIntegrationResponseRequest",
"withResponseTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseTemplates",
")",
"{",
"setResponseTemplates",
"(",
"responseTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The collection of response templates for the integration response as a string-to-string map of key-value pairs.
Response templates are represented as a key/value map, with a content-type as the key and a template as the
value.
</p>
@param responseTemplates
The collection of response templates for the integration response as a string-to-string map of key-value
pairs. Response templates are represented as a key/value map, with a content-type as the key and a
template as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"collection",
"of",
"response",
"templates",
"for",
"the",
"integration",
"response",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"Response",
"templates",
"are",
"represented",
"as",
"a",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateIntegrationResponseRequest.java#L535-L538 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroupsConfig.java | TileGroupsConfig.exports | public static void exports(Media groupsConfig, Iterable<TileGroup> groups)
{
Check.notNull(groupsConfig);
Check.notNull(groups);
final Xml nodeGroups = new Xml(NODE_GROUPS);
nodeGroups.writeString(Constant.XML_HEADER, Constant.ENGINE_WEBSITE);
for (final TileGroup group : groups)
{
exportGroup(nodeGroups, group);
}
nodeGroups.save(groupsConfig);
} | java | public static void exports(Media groupsConfig, Iterable<TileGroup> groups)
{
Check.notNull(groupsConfig);
Check.notNull(groups);
final Xml nodeGroups = new Xml(NODE_GROUPS);
nodeGroups.writeString(Constant.XML_HEADER, Constant.ENGINE_WEBSITE);
for (final TileGroup group : groups)
{
exportGroup(nodeGroups, group);
}
nodeGroups.save(groupsConfig);
} | [
"public",
"static",
"void",
"exports",
"(",
"Media",
"groupsConfig",
",",
"Iterable",
"<",
"TileGroup",
">",
"groups",
")",
"{",
"Check",
".",
"notNull",
"(",
"groupsConfig",
")",
";",
"Check",
".",
"notNull",
"(",
"groups",
")",
";",
"final",
"Xml",
"no... | Export groups to configuration file.
@param groupsConfig The export media (must not be <code>null</code>).
@param groups The groups to export (must not be <code>null</code>).
@throws LionEngineException If unable to write to media. | [
"Export",
"groups",
"to",
"configuration",
"file",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroupsConfig.java#L84-L98 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/ZoneOperationId.java | ZoneOperationId.of | public static ZoneOperationId of(ZoneId zoneId, String operation) {
return new ZoneOperationId(zoneId.getProject(), zoneId.getZone(), operation);
} | java | public static ZoneOperationId of(ZoneId zoneId, String operation) {
return new ZoneOperationId(zoneId.getProject(), zoneId.getZone(), operation);
} | [
"public",
"static",
"ZoneOperationId",
"of",
"(",
"ZoneId",
"zoneId",
",",
"String",
"operation",
")",
"{",
"return",
"new",
"ZoneOperationId",
"(",
"zoneId",
".",
"getProject",
"(",
")",
",",
"zoneId",
".",
"getZone",
"(",
")",
",",
"operation",
")",
";",... | Returns a zone operation identity given the zone identity and the operation name. | [
"Returns",
"a",
"zone",
"operation",
"identity",
"given",
"the",
"zone",
"identity",
"and",
"the",
"operation",
"name",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/ZoneOperationId.java#L91-L93 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/common/internal/RenderingUtils.java | RenderingUtils.drawString | public static void drawString(JComponent c, Graphics g, String text, int x, int y) {
if (drawStringMethod != null) {
try {
drawStringMethod.invoke(null,
c, g, text, Integer.valueOf(x), Integer.valueOf(y));
return;
} catch (IllegalArgumentException e) {
// Use the BasicGraphicsUtils as fallback
} catch (IllegalAccessException e) {
// Use the BasicGraphicsUtils as fallback
} catch (InvocationTargetException e) {
// Use the BasicGraphicsUtils as fallback
}
}
Graphics2D g2 = (Graphics2D) g;
Map<?, ?> oldRenderingHints = installDesktopHints(g2);
BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, -1, x, y);
if (oldRenderingHints != null) {
g2.addRenderingHints(oldRenderingHints);
}
} | java | public static void drawString(JComponent c, Graphics g, String text, int x, int y) {
if (drawStringMethod != null) {
try {
drawStringMethod.invoke(null,
c, g, text, Integer.valueOf(x), Integer.valueOf(y));
return;
} catch (IllegalArgumentException e) {
// Use the BasicGraphicsUtils as fallback
} catch (IllegalAccessException e) {
// Use the BasicGraphicsUtils as fallback
} catch (InvocationTargetException e) {
// Use the BasicGraphicsUtils as fallback
}
}
Graphics2D g2 = (Graphics2D) g;
Map<?, ?> oldRenderingHints = installDesktopHints(g2);
BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, -1, x, y);
if (oldRenderingHints != null) {
g2.addRenderingHints(oldRenderingHints);
}
} | [
"public",
"static",
"void",
"drawString",
"(",
"JComponent",
"c",
",",
"Graphics",
"g",
",",
"String",
"text",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"drawStringMethod",
"!=",
"null",
")",
"{",
"try",
"{",
"drawStringMethod",
".",
"invo... | Draws the string at the specified location underlining the specified character.
@param c JComponent that will display the string, may be null
@param g Graphics to draw the text to
@param text String to display
@param x X coordinate to draw the text at
@param y Y coordinate to draw the text at | [
"Draws",
"the",
"string",
"at",
"the",
"specified",
"location",
"underlining",
"the",
"specified",
"character",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/internal/RenderingUtils.java#L99-L119 |
dita-ot/dita-ot | src/main/java/org/dita/dost/invoker/DefaultLogger.java | DefaultLogger.printMessage | private void printMessage(final String message, final PrintStream stream, final int priority) {
if (useColor && priority == Project.MSG_ERR) {
stream.print(ANSI_RED);
stream.print(message);
stream.println(ANSI_RESET);
} else {
stream.println(message);
}
} | java | private void printMessage(final String message, final PrintStream stream, final int priority) {
if (useColor && priority == Project.MSG_ERR) {
stream.print(ANSI_RED);
stream.print(message);
stream.println(ANSI_RESET);
} else {
stream.println(message);
}
} | [
"private",
"void",
"printMessage",
"(",
"final",
"String",
"message",
",",
"final",
"PrintStream",
"stream",
",",
"final",
"int",
"priority",
")",
"{",
"if",
"(",
"useColor",
"&&",
"priority",
"==",
"Project",
".",
"MSG_ERR",
")",
"{",
"stream",
".",
"prin... | Prints a message to a PrintStream.
@param message The message to print. Should not be <code>null</code>.
@param stream A PrintStream to print the message to. Must not be
<code>null</code>.
@param priority The priority of the message. (Ignored in this
implementation.) | [
"Prints",
"a",
"message",
"to",
"a",
"PrintStream",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/invoker/DefaultLogger.java#L364-L372 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/PeerGroup.java | PeerGroup.connectToLocalHost | @Nullable
public Peer connectToLocalHost() {
lock.lock();
try {
final PeerAddress localhost = PeerAddress.localhost(params);
backoffMap.put(localhost, new ExponentialBackoff(peerBackoffParams));
return connectTo(localhost, true, vConnectTimeoutMillis);
} finally {
lock.unlock();
}
} | java | @Nullable
public Peer connectToLocalHost() {
lock.lock();
try {
final PeerAddress localhost = PeerAddress.localhost(params);
backoffMap.put(localhost, new ExponentialBackoff(peerBackoffParams));
return connectTo(localhost, true, vConnectTimeoutMillis);
} finally {
lock.unlock();
}
} | [
"@",
"Nullable",
"public",
"Peer",
"connectToLocalHost",
"(",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"PeerAddress",
"localhost",
"=",
"PeerAddress",
".",
"localhost",
"(",
"params",
")",
";",
"backoffMap",
".",
"put",
"(",
"lo... | Helper for forcing a connection to localhost. Useful when using regtest mode. Returns the peer object. | [
"Helper",
"for",
"forcing",
"a",
"connection",
"to",
"localhost",
".",
"Useful",
"when",
"using",
"regtest",
"mode",
".",
"Returns",
"the",
"peer",
"object",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L1322-L1332 |
openbase/jul | visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGProcessor.java | SVGProcessor.loadSVGIconFromFile | public static List<SVGPath> loadSVGIconFromFile(final File file) throws CouldNotPerformException {
try {
if (!file.exists()) {
throw new NotAvailableException(file.getAbsolutePath());
}
return generateSvgPathList(FileUtils.readFileToString(file, StandardCharsets.UTF_8));
} catch (final Exception ex) {
throw new CouldNotPerformException("Could not load path File[" + file + "]", ex);
}
} | java | public static List<SVGPath> loadSVGIconFromFile(final File file) throws CouldNotPerformException {
try {
if (!file.exists()) {
throw new NotAvailableException(file.getAbsolutePath());
}
return generateSvgPathList(FileUtils.readFileToString(file, StandardCharsets.UTF_8));
} catch (final Exception ex) {
throw new CouldNotPerformException("Could not load path File[" + file + "]", ex);
}
} | [
"public",
"static",
"List",
"<",
"SVGPath",
">",
"loadSVGIconFromFile",
"(",
"final",
"File",
"file",
")",
"throws",
"CouldNotPerformException",
"{",
"try",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"NotAvailableExceptio... | Method tries to build one or more SVGPaths out of the passed file.
By this the file content is interpreted as svg xml and new SVGPath instances are generated for each found path element
@param file the svg xml file
@return a list of SVGPaths instances where each is representing one found path element
@throws CouldNotPerformException is thrown if the file does not exist or it does not contain any path elements. | [
"Method",
"tries",
"to",
"build",
"one",
"or",
"more",
"SVGPaths",
"out",
"of",
"the",
"passed",
"file",
".",
"By",
"this",
"the",
"file",
"content",
"is",
"interpreted",
"as",
"svg",
"xml",
"and",
"new",
"SVGPath",
"instances",
"are",
"generated",
"for",
... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGProcessor.java#L85-L94 |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/RedirectFilter.java | RedirectFilter.call | @Override
public Result call(final Route route, final RequestContext context) throws Exception {
URI redirectedURI = rewriteURI(context.request());
logger.debug("Redirecting request - rewriting {} to {}", context.request().uri(), redirectedURI);
if (redirectedURI == null) {
return onRewriteFailed(context);
}
return Results.redirect(redirectedURI.toString());
} | java | @Override
public Result call(final Route route, final RequestContext context) throws Exception {
URI redirectedURI = rewriteURI(context.request());
logger.debug("Redirecting request - rewriting {} to {}", context.request().uri(), redirectedURI);
if (redirectedURI == null) {
return onRewriteFailed(context);
}
return Results.redirect(redirectedURI.toString());
} | [
"@",
"Override",
"public",
"Result",
"call",
"(",
"final",
"Route",
"route",
",",
"final",
"RequestContext",
"context",
")",
"throws",
"Exception",
"{",
"URI",
"redirectedURI",
"=",
"rewriteURI",
"(",
"context",
".",
"request",
"(",
")",
")",
";",
"logger",
... | The interception method. It just returns a {@code REDIRECT} result to the computed URI.
@param route the route
@param context the filter context
@return the result
@throws Exception if anything bad happen | [
"The",
"interception",
"method",
".",
"It",
"just",
"returns",
"a",
"{",
"@code",
"REDIRECT",
"}",
"result",
"to",
"the",
"computed",
"URI",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/RedirectFilter.java#L109-L117 |
cojen/Cojen | src/main/java/org/cojen/util/ClassInjector.java | ClassInjector.getNewClass | public Class getNewClass() throws IllegalStateException, ClassFormatError {
if (mClass != null) {
return mClass;
}
ByteArrayOutputStream data = mData;
if (data == null) {
throw new IllegalStateException("Class not defined yet");
}
byte[] bytes = data.toByteArray();
if (DEBUG) {
File file = new File(mName.replace('.', '/') + ".class");
try {
File tempDir = new File(System.getProperty("java.io.tmpdir"));
file = new File(tempDir, file.getPath());
} catch (SecurityException e) {
}
try {
file.getParentFile().mkdirs();
System.out.println("ClassInjector writing to " + file);
OutputStream out = new FileOutputStream(file);
out.write(bytes);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
mClass = mLoader.define(mName, bytes);
mData = null;
return mClass;
} | java | public Class getNewClass() throws IllegalStateException, ClassFormatError {
if (mClass != null) {
return mClass;
}
ByteArrayOutputStream data = mData;
if (data == null) {
throw new IllegalStateException("Class not defined yet");
}
byte[] bytes = data.toByteArray();
if (DEBUG) {
File file = new File(mName.replace('.', '/') + ".class");
try {
File tempDir = new File(System.getProperty("java.io.tmpdir"));
file = new File(tempDir, file.getPath());
} catch (SecurityException e) {
}
try {
file.getParentFile().mkdirs();
System.out.println("ClassInjector writing to " + file);
OutputStream out = new FileOutputStream(file);
out.write(bytes);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
mClass = mLoader.define(mName, bytes);
mData = null;
return mClass;
} | [
"public",
"Class",
"getNewClass",
"(",
")",
"throws",
"IllegalStateException",
",",
"ClassFormatError",
"{",
"if",
"(",
"mClass",
"!=",
"null",
")",
"{",
"return",
"mClass",
";",
"}",
"ByteArrayOutputStream",
"data",
"=",
"mData",
";",
"if",
"(",
"data",
"==... | Returns the newly defined class.
@throws IllegalStateException if class was never defined | [
"Returns",
"the",
"newly",
"defined",
"class",
"."
] | train | https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/util/ClassInjector.java#L269-L301 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java | ArtifactHandler.updateProvider | public void updateProvider(final String gavc, final String provider) {
final DbArtifact artifact = getArtifact(gavc);
repositoryHandler.updateProvider(artifact, provider);
} | java | public void updateProvider(final String gavc, final String provider) {
final DbArtifact artifact = getArtifact(gavc);
repositoryHandler.updateProvider(artifact, provider);
} | [
"public",
"void",
"updateProvider",
"(",
"final",
"String",
"gavc",
",",
"final",
"String",
"provider",
")",
"{",
"final",
"DbArtifact",
"artifact",
"=",
"getArtifact",
"(",
"gavc",
")",
";",
"repositoryHandler",
".",
"updateProvider",
"(",
"artifact",
",",
"p... | Update artifact provider
@param gavc String
@param provider String | [
"Update",
"artifact",
"provider"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java#L223-L226 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.newPostOpenGraphObjectRequest | public static Request newPostOpenGraphObjectRequest(Session session,
OpenGraphObject openGraphObject, Callback callback) {
if (openGraphObject == null) {
throw new FacebookException("openGraphObject cannot be null");
}
if (Utility.isNullOrEmpty(openGraphObject.getType())) {
throw new FacebookException("openGraphObject must have non-null 'type' property");
}
if (Utility.isNullOrEmpty(openGraphObject.getTitle())) {
throw new FacebookException("openGraphObject must have non-null 'title' property");
}
String path = String.format(MY_OBJECTS_FORMAT, openGraphObject.getType());
Bundle bundle = new Bundle();
bundle.putString(OBJECT_PARAM, openGraphObject.getInnerJSONObject().toString());
return new Request(session, path, bundle, HttpMethod.POST, callback);
} | java | public static Request newPostOpenGraphObjectRequest(Session session,
OpenGraphObject openGraphObject, Callback callback) {
if (openGraphObject == null) {
throw new FacebookException("openGraphObject cannot be null");
}
if (Utility.isNullOrEmpty(openGraphObject.getType())) {
throw new FacebookException("openGraphObject must have non-null 'type' property");
}
if (Utility.isNullOrEmpty(openGraphObject.getTitle())) {
throw new FacebookException("openGraphObject must have non-null 'title' property");
}
String path = String.format(MY_OBJECTS_FORMAT, openGraphObject.getType());
Bundle bundle = new Bundle();
bundle.putString(OBJECT_PARAM, openGraphObject.getInnerJSONObject().toString());
return new Request(session, path, bundle, HttpMethod.POST, callback);
} | [
"public",
"static",
"Request",
"newPostOpenGraphObjectRequest",
"(",
"Session",
"session",
",",
"OpenGraphObject",
"openGraphObject",
",",
"Callback",
"callback",
")",
"{",
"if",
"(",
"openGraphObject",
"==",
"null",
")",
"{",
"throw",
"new",
"FacebookException",
"(... | Creates a new Request configured to create a user owned Open Graph object.
@param session
the Session to use, or null; if non-null, the session must be in an opened state
@param openGraphObject
the Open Graph object to create; must not be null, and must have a non-empty type and title
@param callback
a callback that will be called when the request is completed to handle success or error conditions
@return a Request that is ready to execute | [
"Creates",
"a",
"new",
"Request",
"configured",
"to",
"create",
"a",
"user",
"owned",
"Open",
"Graph",
"object",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L680-L696 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addInlineComment | public void addInlineComment(Doc doc, Tag tag, Content htmltree) {
addCommentTags(doc, tag, tag.inlineTags(), false, false, htmltree);
} | java | public void addInlineComment(Doc doc, Tag tag, Content htmltree) {
addCommentTags(doc, tag, tag.inlineTags(), false, false, htmltree);
} | [
"public",
"void",
"addInlineComment",
"(",
"Doc",
"doc",
",",
"Tag",
"tag",
",",
"Content",
"htmltree",
")",
"{",
"addCommentTags",
"(",
"doc",
",",
"tag",
",",
"tag",
".",
"inlineTags",
"(",
")",
",",
"false",
",",
"false",
",",
"htmltree",
")",
";",
... | Add the inline comment.
@param doc the doc for which the inline comment will be added
@param tag the inline tag to be added
@param htmltree the content tree to which the comment will be added | [
"Add",
"the",
"inline",
"comment",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1419-L1421 |
apereo/cas | support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/idp/metadata/generator/BaseSamlIdPMetadataGenerator.java | BaseSamlIdPMetadataGenerator.buildMetadataGeneratorParameters | @SneakyThrows
private String buildMetadataGeneratorParameters(final Pair<String, String> signing, final Pair<String, String> encryption) {
val template = samlIdPMetadataGeneratorConfigurationContext.getResourceLoader().getResource("classpath:/template-idp-metadata.xml");
var signingCert = signing.getKey();
signingCert = StringUtils.remove(signingCert, BEGIN_CERTIFICATE);
signingCert = StringUtils.remove(signingCert, END_CERTIFICATE).trim();
var encryptionCert = encryption.getKey();
encryptionCert = StringUtils.remove(encryptionCert, BEGIN_CERTIFICATE);
encryptionCert = StringUtils.remove(encryptionCert, END_CERTIFICATE).trim();
try (val writer = new StringWriter()) {
IOUtils.copy(template.getInputStream(), writer, StandardCharsets.UTF_8);
val metadata = writer.toString()
.replace("${entityId}", samlIdPMetadataGeneratorConfigurationContext.getEntityId())
.replace("${scope}", samlIdPMetadataGeneratorConfigurationContext.getScope())
.replace("${idpEndpointUrl}", getIdPEndpointUrl())
.replace("${encryptionKey}", encryptionCert)
.replace("${signingKey}", signingCert);
writeMetadata(metadata);
return metadata;
}
} | java | @SneakyThrows
private String buildMetadataGeneratorParameters(final Pair<String, String> signing, final Pair<String, String> encryption) {
val template = samlIdPMetadataGeneratorConfigurationContext.getResourceLoader().getResource("classpath:/template-idp-metadata.xml");
var signingCert = signing.getKey();
signingCert = StringUtils.remove(signingCert, BEGIN_CERTIFICATE);
signingCert = StringUtils.remove(signingCert, END_CERTIFICATE).trim();
var encryptionCert = encryption.getKey();
encryptionCert = StringUtils.remove(encryptionCert, BEGIN_CERTIFICATE);
encryptionCert = StringUtils.remove(encryptionCert, END_CERTIFICATE).trim();
try (val writer = new StringWriter()) {
IOUtils.copy(template.getInputStream(), writer, StandardCharsets.UTF_8);
val metadata = writer.toString()
.replace("${entityId}", samlIdPMetadataGeneratorConfigurationContext.getEntityId())
.replace("${scope}", samlIdPMetadataGeneratorConfigurationContext.getScope())
.replace("${idpEndpointUrl}", getIdPEndpointUrl())
.replace("${encryptionKey}", encryptionCert)
.replace("${signingKey}", signingCert);
writeMetadata(metadata);
return metadata;
}
} | [
"@",
"SneakyThrows",
"private",
"String",
"buildMetadataGeneratorParameters",
"(",
"final",
"Pair",
"<",
"String",
",",
"String",
">",
"signing",
",",
"final",
"Pair",
"<",
"String",
",",
"String",
">",
"encryption",
")",
"{",
"val",
"template",
"=",
"samlIdPM... | Build metadata generator parameters by passing the encryption,
signing and back-channel certs to the parameter generator.
@param signing the signing
@param encryption the encryption
@return the metadata | [
"Build",
"metadata",
"generator",
"parameters",
"by",
"passing",
"the",
"encryption",
"signing",
"and",
"back",
"-",
"channel",
"certs",
"to",
"the",
"parameter",
"generator",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/idp/metadata/generator/BaseSamlIdPMetadataGenerator.java#L96-L120 |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/SharedAccessSignatureCloudBlobClientProvider.java | SharedAccessSignatureCloudBlobClientProvider.generateSharedAccessSignature | @Override
public URI generateSharedAccessSignature(final CloudBlob cloudBlob, final SharedAccessBlobPolicy policy)
throws IOException {
try {
final URI uri = cloudBlob.getStorageUri().getPrimaryUri();
Map<String, String[]> queryString = PathUtility.parseQueryString(this.azureStorageContainerSASToken);
UriQueryBuilder builder = new UriQueryBuilder();
for (Map.Entry<String, String[]> entry : queryString.entrySet()) {
for (String value : entry.getValue()) {
builder.add(entry.getKey(), value);
}
}
URI result = builder.addToURI(uri);
LOG.log(Level.INFO, "Here's the URI: {0}", result);
return result;
} catch (StorageException | URISyntaxException e) {
throw new IOException("Failed to generated a Shared Access Signature.", e);
}
} | java | @Override
public URI generateSharedAccessSignature(final CloudBlob cloudBlob, final SharedAccessBlobPolicy policy)
throws IOException {
try {
final URI uri = cloudBlob.getStorageUri().getPrimaryUri();
Map<String, String[]> queryString = PathUtility.parseQueryString(this.azureStorageContainerSASToken);
UriQueryBuilder builder = new UriQueryBuilder();
for (Map.Entry<String, String[]> entry : queryString.entrySet()) {
for (String value : entry.getValue()) {
builder.add(entry.getKey(), value);
}
}
URI result = builder.addToURI(uri);
LOG.log(Level.INFO, "Here's the URI: {0}", result);
return result;
} catch (StorageException | URISyntaxException e) {
throw new IOException("Failed to generated a Shared Access Signature.", e);
}
} | [
"@",
"Override",
"public",
"URI",
"generateSharedAccessSignature",
"(",
"final",
"CloudBlob",
"cloudBlob",
",",
"final",
"SharedAccessBlobPolicy",
"policy",
")",
"throws",
"IOException",
"{",
"try",
"{",
"final",
"URI",
"uri",
"=",
"cloudBlob",
".",
"getStorageUri",... | Generates a Shared Access Key URI for the given {@link CloudBlob}.
@param cloudBlob cloud blob to create a Shared Access Key URI for.
@param policy an instance of {@link SharedAccessBlobPolicy} that specifies permissions and signature's
validity time period.
@return a Shared Access Key URI for the given {@link CloudBlob}.
@throws IOException | [
"Generates",
"a",
"Shared",
"Access",
"Key",
"URI",
"for",
"the",
"given",
"{"
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/SharedAccessSignatureCloudBlobClientProvider.java#L87-L109 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java | VelocityParser.getKeyWord | public int getKeyWord(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context)
throws InvalidVelocityException
{
int i = currentIndex;
if (i + 1 >= array.length) {
throw new InvalidVelocityException();
}
if (array[i + 1] == '#') {
// A simple line comment
i = getSimpleComment(array, currentIndex, velocityBlock, context);
} else if (array[i + 1] == '*') {
// A multi lines comment
i = getMultilinesComment(array, currentIndex, velocityBlock, context);
} else if (array[i + 1] == '{' || Character.isLetter(array[i + 1])) {
// A directive
i = getDirective(array, currentIndex, velocityBlock, context);
} else {
throw new InvalidVelocityException();
}
return i;
} | java | public int getKeyWord(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context)
throws InvalidVelocityException
{
int i = currentIndex;
if (i + 1 >= array.length) {
throw new InvalidVelocityException();
}
if (array[i + 1] == '#') {
// A simple line comment
i = getSimpleComment(array, currentIndex, velocityBlock, context);
} else if (array[i + 1] == '*') {
// A multi lines comment
i = getMultilinesComment(array, currentIndex, velocityBlock, context);
} else if (array[i + 1] == '{' || Character.isLetter(array[i + 1])) {
// A directive
i = getDirective(array, currentIndex, velocityBlock, context);
} else {
throw new InvalidVelocityException();
}
return i;
} | [
"public",
"int",
"getKeyWord",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"currentIndex",
",",
"StringBuffer",
"velocityBlock",
",",
"VelocityParserContext",
"context",
")",
"throws",
"InvalidVelocityException",
"{",
"int",
"i",
"=",
"currentIndex",
";",
"if",
... | Get any valid Velocity block starting with a sharp character (#if, #somemaccro(), ##comment etc.).
@param array the source to parse
@param currentIndex the current index in the <code>array</code>
@param velocityBlock the buffer where to append matched velocity block
@param context the parser context to put some informations
@return the index in the <code>array</code> after the matched block
@throws InvalidVelocityException not a valid velocity block | [
"Get",
"any",
"valid",
"Velocity",
"block",
"starting",
"with",
"a",
"sharp",
"character",
"(",
"#if",
"#somemaccro",
"()",
"##comment",
"etc",
".",
")",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java#L99-L122 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java | RepositoryApplicationConfiguration.rolloutScheduler | @Bean
@ConditionalOnMissingBean
@Profile("!test")
@ConditionalOnProperty(prefix = "hawkbit.rollout.scheduler", name = "enabled", matchIfMissing = true)
RolloutScheduler rolloutScheduler(final TenantAware tenantAware, final SystemManagement systemManagement,
final RolloutManagement rolloutManagement, final SystemSecurityContext systemSecurityContext) {
return new RolloutScheduler(systemManagement, rolloutManagement, systemSecurityContext);
} | java | @Bean
@ConditionalOnMissingBean
@Profile("!test")
@ConditionalOnProperty(prefix = "hawkbit.rollout.scheduler", name = "enabled", matchIfMissing = true)
RolloutScheduler rolloutScheduler(final TenantAware tenantAware, final SystemManagement systemManagement,
final RolloutManagement rolloutManagement, final SystemSecurityContext systemSecurityContext) {
return new RolloutScheduler(systemManagement, rolloutManagement, systemSecurityContext);
} | [
"@",
"Bean",
"@",
"ConditionalOnMissingBean",
"@",
"Profile",
"(",
"\"!test\"",
")",
"@",
"ConditionalOnProperty",
"(",
"prefix",
"=",
"\"hawkbit.rollout.scheduler\"",
",",
"name",
"=",
"\"enabled\"",
",",
"matchIfMissing",
"=",
"true",
")",
"RolloutScheduler",
"rol... | {@link RolloutScheduler} bean.
Note: does not activate in test profile, otherwise it is hard to test the
rollout handling functionality.
@param systemManagement
to find all tenants
@param rolloutManagement
to run the rollout handler
@param systemSecurityContext
to run as system
@return a new {@link RolloutScheduler} bean. | [
"{",
"@link",
"RolloutScheduler",
"}",
"bean",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/RepositoryApplicationConfiguration.java#L849-L856 |
AlmogBaku/IntlPhoneInput | intlphoneinput/src/main/java/net/rimoto/intlphoneinput/CountriesFetcher.java | CountriesFetcher.getJsonFromRaw | private static String getJsonFromRaw(Context context, int resource) {
String json;
try {
InputStream inputStream = context.getResources().openRawResource(resource);
int size = inputStream.available();
byte[] buffer = new byte[size];
inputStream.read(buffer);
inputStream.close();
json = new String(buffer, "UTF-8");
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
return json;
} | java | private static String getJsonFromRaw(Context context, int resource) {
String json;
try {
InputStream inputStream = context.getResources().openRawResource(resource);
int size = inputStream.available();
byte[] buffer = new byte[size];
inputStream.read(buffer);
inputStream.close();
json = new String(buffer, "UTF-8");
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
return json;
} | [
"private",
"static",
"String",
"getJsonFromRaw",
"(",
"Context",
"context",
",",
"int",
"resource",
")",
"{",
"String",
"json",
";",
"try",
"{",
"InputStream",
"inputStream",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"openRawResource",
"(",
"resource... | Fetch JSON from RAW resource
@param context Context
@param resource Resource int of the RAW file
@return JSON | [
"Fetch",
"JSON",
"from",
"RAW",
"resource"
] | train | https://github.com/AlmogBaku/IntlPhoneInput/blob/ac7313a2d1683feb4d535d5dbee6676b53879059/intlphoneinput/src/main/java/net/rimoto/intlphoneinput/CountriesFetcher.java#L24-L38 |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/ReadableLogRecord.java | ReadableLogRecord.read | private static ReadableLogRecord read(ByteBuffer viewBuffer, long expectedSequenceNumber, ByteBuffer sourceBuffer)
{
ReadableLogRecord logRecord = null;
int absolutePosition = sourceBuffer.position() + viewBuffer.position();
// Read the record magic number field.
final byte[] magicNumberBuffer = new byte[RECORD_MAGIC_NUMBER.length];
viewBuffer.get(magicNumberBuffer);
int recordLength = 0;
if (Arrays.equals(magicNumberBuffer, RECORD_MAGIC_NUMBER))
{
long recordSequenceNumber = viewBuffer.getLong();
if (recordSequenceNumber >= expectedSequenceNumber)
{
// The record sequence is consistent with the expected sequence number supplied by the
// caller. So skip over the actual log record data in this record so that
// we can check the tail sequence number.
recordLength = viewBuffer.getInt();
// Preserve the current byte cursor position so that we can reset back to it later.
// Move the byte cursor to the first byte after the record data.
final int recordDataPosition = viewBuffer.position();
viewBuffer.position(recordDataPosition + recordLength);
// Read the repeated record sequence number
final long tailSequenceNumber = viewBuffer.getLong();
// Because are are only looking for sequence numbers larger than expected the only assurance that we
// have not read garbage following the magic number is that the first and tail sequence numbers are equal.
// Note its still possible garbage is in the data but that can't be helped without changing the log format.
// It will be discovered later no doubt!
if (tailSequenceNumber == recordSequenceNumber)
{
// Return the buffer's pointer to the start of
// the record's data prior to creating a new
// ReadableLogRecord to return to the caller.
viewBuffer.position(recordDataPosition);
logRecord = new ReadableLogRecord(viewBuffer, absolutePosition, tailSequenceNumber);
// Advance the original buffer's position to the end of this record. This ensures that
// the next ReadableLogRecord or WritableLogRecord constructed will read or write the
// next record in the file.
sourceBuffer.position(absolutePosition + HEADER_SIZE + recordLength);
}
}
}
return logRecord;
} | java | private static ReadableLogRecord read(ByteBuffer viewBuffer, long expectedSequenceNumber, ByteBuffer sourceBuffer)
{
ReadableLogRecord logRecord = null;
int absolutePosition = sourceBuffer.position() + viewBuffer.position();
// Read the record magic number field.
final byte[] magicNumberBuffer = new byte[RECORD_MAGIC_NUMBER.length];
viewBuffer.get(magicNumberBuffer);
int recordLength = 0;
if (Arrays.equals(magicNumberBuffer, RECORD_MAGIC_NUMBER))
{
long recordSequenceNumber = viewBuffer.getLong();
if (recordSequenceNumber >= expectedSequenceNumber)
{
// The record sequence is consistent with the expected sequence number supplied by the
// caller. So skip over the actual log record data in this record so that
// we can check the tail sequence number.
recordLength = viewBuffer.getInt();
// Preserve the current byte cursor position so that we can reset back to it later.
// Move the byte cursor to the first byte after the record data.
final int recordDataPosition = viewBuffer.position();
viewBuffer.position(recordDataPosition + recordLength);
// Read the repeated record sequence number
final long tailSequenceNumber = viewBuffer.getLong();
// Because are are only looking for sequence numbers larger than expected the only assurance that we
// have not read garbage following the magic number is that the first and tail sequence numbers are equal.
// Note its still possible garbage is in the data but that can't be helped without changing the log format.
// It will be discovered later no doubt!
if (tailSequenceNumber == recordSequenceNumber)
{
// Return the buffer's pointer to the start of
// the record's data prior to creating a new
// ReadableLogRecord to return to the caller.
viewBuffer.position(recordDataPosition);
logRecord = new ReadableLogRecord(viewBuffer, absolutePosition, tailSequenceNumber);
// Advance the original buffer's position to the end of this record. This ensures that
// the next ReadableLogRecord or WritableLogRecord constructed will read or write the
// next record in the file.
sourceBuffer.position(absolutePosition + HEADER_SIZE + recordLength);
}
}
}
return logRecord;
} | [
"private",
"static",
"ReadableLogRecord",
"read",
"(",
"ByteBuffer",
"viewBuffer",
",",
"long",
"expectedSequenceNumber",
",",
"ByteBuffer",
"sourceBuffer",
")",
"{",
"ReadableLogRecord",
"logRecord",
"=",
"null",
";",
"int",
"absolutePosition",
"=",
"sourceBuffer",
"... | careful with trace in this method as it is called many times from doByteByByteScanning | [
"careful",
"with",
"trace",
"in",
"this",
"method",
"as",
"it",
"is",
"called",
"many",
"times",
"from",
"doByteByByteScanning"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/ReadableLogRecord.java#L87-L141 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java | LegacyDfuImpl.writeImageSize | private void writeImageSize(@NonNull final BluetoothGattCharacteristic characteristic, final int imageSize)
throws DeviceDisconnectedException, DfuException,
UploadAbortedException {
mReceivedData = null;
mError = 0;
mImageSizeInProgress = true;
characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
characteristic.setValue(new byte[4]);
characteristic.setValue(imageSize, BluetoothGattCharacteristic.FORMAT_UINT32, 0);
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Writing to characteristic " + characteristic.getUuid());
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_DEBUG, "gatt.writeCharacteristic(" + characteristic.getUuid() + ")");
mGatt.writeCharacteristic(characteristic);
// We have to wait for confirmation
try {
synchronized (mLock) {
while ((mImageSizeInProgress && mConnected && mError == 0 && !mAborted) || mPaused)
mLock.wait();
}
} catch (final InterruptedException e) {
loge("Sleeping interrupted", e);
}
if (mAborted)
throw new UploadAbortedException();
if (!mConnected)
throw new DeviceDisconnectedException("Unable to write Image Size: device disconnected");
if (mError != 0)
throw new DfuException("Unable to write Image Size", mError);
} | java | private void writeImageSize(@NonNull final BluetoothGattCharacteristic characteristic, final int imageSize)
throws DeviceDisconnectedException, DfuException,
UploadAbortedException {
mReceivedData = null;
mError = 0;
mImageSizeInProgress = true;
characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
characteristic.setValue(new byte[4]);
characteristic.setValue(imageSize, BluetoothGattCharacteristic.FORMAT_UINT32, 0);
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Writing to characteristic " + characteristic.getUuid());
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_DEBUG, "gatt.writeCharacteristic(" + characteristic.getUuid() + ")");
mGatt.writeCharacteristic(characteristic);
// We have to wait for confirmation
try {
synchronized (mLock) {
while ((mImageSizeInProgress && mConnected && mError == 0 && !mAborted) || mPaused)
mLock.wait();
}
} catch (final InterruptedException e) {
loge("Sleeping interrupted", e);
}
if (mAborted)
throw new UploadAbortedException();
if (!mConnected)
throw new DeviceDisconnectedException("Unable to write Image Size: device disconnected");
if (mError != 0)
throw new DfuException("Unable to write Image Size", mError);
} | [
"private",
"void",
"writeImageSize",
"(",
"@",
"NonNull",
"final",
"BluetoothGattCharacteristic",
"characteristic",
",",
"final",
"int",
"imageSize",
")",
"throws",
"DeviceDisconnectedException",
",",
"DfuException",
",",
"UploadAbortedException",
"{",
"mReceivedData",
"=... | Writes the image size to the characteristic. This method is SYNCHRONOUS and wait until the
{@link android.bluetooth.BluetoothGattCallback#onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
will be called or the device gets disconnected. If connection state will change, or an
error will occur, an exception will be thrown.
@param characteristic the characteristic to write to. Should be the DFU PACKET.
@param imageSize the image size in bytes.
@throws DeviceDisconnectedException Thrown when the device will disconnect in the middle of
the transmission.
@throws DfuException Thrown if DFU error occur.
@throws UploadAbortedException Thrown if DFU operation was aborted by user. | [
"Writes",
"the",
"image",
"size",
"to",
"the",
"characteristic",
".",
"This",
"method",
"is",
"SYNCHRONOUS",
"and",
"wait",
"until",
"the",
"{",
"@link",
"android",
".",
"bluetooth",
".",
"BluetoothGattCallback#onCharacteristicWrite",
"(",
"android",
".",
"bluetoo... | train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java#L625-L654 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_vm_vmId_backupJob_GET | public OvhBackupJob serviceName_datacenter_datacenterId_vm_vmId_backupJob_GET(String serviceName, Long datacenterId, Long vmId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackupJob.class);
} | java | public OvhBackupJob serviceName_datacenter_datacenterId_vm_vmId_backupJob_GET(String serviceName, Long datacenterId, Long vmId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackupJob.class);
} | [
"public",
"OvhBackupJob",
"serviceName_datacenter_datacenterId_vm_vmId_backupJob_GET",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"Long",
"vmId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/datacenter/{datacen... | Get this object properties
REST: GET /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob
@param serviceName [required] Domain of the service
@param datacenterId [required]
@param vmId [required] Id of the virtual machine.
@deprecated | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2006-L2011 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | public static int importData(final DataSet dataset, final int offset, final int count, final PreparedStatement stmt,
final Try.BiConsumer<? super PreparedStatement, ? super Object[], SQLException> stmtSetter) throws UncheckedSQLException {
return importData(dataset, offset, count, stmt, 200, 0, stmtSetter);
} | java | public static int importData(final DataSet dataset, final int offset, final int count, final PreparedStatement stmt,
final Try.BiConsumer<? super PreparedStatement, ? super Object[], SQLException> stmtSetter) throws UncheckedSQLException {
return importData(dataset, offset, count, stmt, 200, 0, stmtSetter);
} | [
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"count",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"Try",
".",
"BiConsumer",
"<",
"?",
"super",
"PreparedStatement",... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param offset
@param count
@param stmt the column order in the sql must be consistent with the column order in the DataSet.
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2408-L2411 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_databaseAvailableType_GET | public ArrayList<OvhDatabaseTypeEnum> serviceName_databaseAvailableType_GET(String serviceName) throws IOException {
String qPath = "/hosting/web/{serviceName}/databaseAvailableType";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | java | public ArrayList<OvhDatabaseTypeEnum> serviceName_databaseAvailableType_GET(String serviceName) throws IOException {
String qPath = "/hosting/web/{serviceName}/databaseAvailableType";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | [
"public",
"ArrayList",
"<",
"OvhDatabaseTypeEnum",
">",
"serviceName_databaseAvailableType_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/databaseAvailableType\"",
";",
"StringBuilder",
"sb",
"=",
... | List available database type
REST: GET /hosting/web/{serviceName}/databaseAvailableType
@param serviceName [required] The internal name of your hosting | [
"List",
"available",
"database",
"type"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1534-L1539 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java | JobHistoryService.getFlowSeries | public List<Flow> getFlowSeries(String cluster, String user, String appId,
int limit) throws IOException {
return getFlowSeries(cluster, user, appId, null, false, limit);
} | java | public List<Flow> getFlowSeries(String cluster, String user, String appId,
int limit) throws IOException {
return getFlowSeries(cluster, user, appId, null, false, limit);
} | [
"public",
"List",
"<",
"Flow",
">",
"getFlowSeries",
"(",
"String",
"cluster",
",",
"String",
"user",
",",
"String",
"appId",
",",
"int",
"limit",
")",
"throws",
"IOException",
"{",
"return",
"getFlowSeries",
"(",
"cluster",
",",
"user",
",",
"appId",
",",... | Returns up to {@code limit} most recent flows by application ID. This
version will only populate job-level details not task information. To
include task details use
{@link JobHistoryService#getFlowSeries(String, String, String, String, boolean, int)}
.
@param cluster the cluster identifier
@param user the user running the jobs
@param appId the application description
@param limit the maximum number of Flow instances to return
@return | [
"Returns",
"up",
"to",
"{",
"@code",
"limit",
"}",
"most",
"recent",
"flows",
"by",
"application",
"ID",
".",
"This",
"version",
"will",
"only",
"populate",
"job",
"-",
"level",
"details",
"not",
"task",
"information",
".",
"To",
"include",
"task",
"detail... | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java#L145-L148 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseBitwiseAndExpression | private Expr parseBitwiseAndExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseConditionExpression(scope, terminated);
if (tryAndMatch(terminated, Ampersand) != null) {
Expr rhs = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseAnd(Type.Byte, new Tuple<>(lhs, rhs)), start);
}
return lhs;
} | java | private Expr parseBitwiseAndExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseConditionExpression(scope, terminated);
if (tryAndMatch(terminated, Ampersand) != null) {
Expr rhs = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseAnd(Type.Byte, new Tuple<>(lhs, rhs)), start);
}
return lhs;
} | [
"private",
"Expr",
"parseBitwiseAndExpression",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
";",
"Expr",
"lhs",
"=",
"parseConditionExpression",
"(",
"scope",
",",
"terminated",
")",
";",
"if",
"(",
"tr... | Parse an bitwise "and" expression
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"an",
"bitwise",
"and",
"expression"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1823-L1833 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java | TextFormatter.elapsedAndSize | public static StringBuilder elapsedAndSize(long startTimeNanos, long endTimeNanos, long size) {
final StringBuilder buf = new StringBuilder(16);
appendElapsedAndSize(buf, startTimeNanos, endTimeNanos, size);
return buf;
} | java | public static StringBuilder elapsedAndSize(long startTimeNanos, long endTimeNanos, long size) {
final StringBuilder buf = new StringBuilder(16);
appendElapsedAndSize(buf, startTimeNanos, endTimeNanos, size);
return buf;
} | [
"public",
"static",
"StringBuilder",
"elapsedAndSize",
"(",
"long",
"startTimeNanos",
",",
"long",
"endTimeNanos",
",",
"long",
"size",
")",
"{",
"final",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"16",
")",
";",
"appendElapsedAndSize",
"(",
"buf... | Similar to {@link #appendElapsedAndSize(StringBuilder, long, long, long)} except that this method
creates a new {@link StringBuilder}. | [
"Similar",
"to",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java#L113-L117 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsConfigurationReader.java | CmsConfigurationReader.parseFormatter | public CmsFormatterBean parseFormatter(String typeName, I_CmsXmlContentLocation node) {
String type = getString(node.getSubValue(N_TYPE));
String minWidth = getString(node.getSubValue(N_MIN_WIDTH));
String maxWidth = getString(node.getSubValue(N_MAX_WIDTH));
boolean preview = false;
I_CmsXmlContentValueLocation previewLoc = node.getSubValue(N_IS_PREVIEW);
preview = (previewLoc != null) && Boolean.parseBoolean(previewLoc.asString(m_cms));
String jsp = m_cms.getRequestContext().addSiteRoot(getString(node.getSubValue(N_JSP)));
boolean searchContent = true;
CmsFormatterBean formatterBean = new CmsFormatterBean(
type,
jsp,
minWidth,
maxWidth,
"" + preview,
"" + searchContent,
null);
return formatterBean;
} | java | public CmsFormatterBean parseFormatter(String typeName, I_CmsXmlContentLocation node) {
String type = getString(node.getSubValue(N_TYPE));
String minWidth = getString(node.getSubValue(N_MIN_WIDTH));
String maxWidth = getString(node.getSubValue(N_MAX_WIDTH));
boolean preview = false;
I_CmsXmlContentValueLocation previewLoc = node.getSubValue(N_IS_PREVIEW);
preview = (previewLoc != null) && Boolean.parseBoolean(previewLoc.asString(m_cms));
String jsp = m_cms.getRequestContext().addSiteRoot(getString(node.getSubValue(N_JSP)));
boolean searchContent = true;
CmsFormatterBean formatterBean = new CmsFormatterBean(
type,
jsp,
minWidth,
maxWidth,
"" + preview,
"" + searchContent,
null);
return formatterBean;
} | [
"public",
"CmsFormatterBean",
"parseFormatter",
"(",
"String",
"typeName",
",",
"I_CmsXmlContentLocation",
"node",
")",
"{",
"String",
"type",
"=",
"getString",
"(",
"node",
".",
"getSubValue",
"(",
"N_TYPE",
")",
")",
";",
"String",
"minWidth",
"=",
"getString"... | Parses a formatter bean.<p>
@param typeName the type name for which the formatter is being parsed
@param node the node from which to parse the formatter data
@return the formatter bean from the XML | [
"Parses",
"a",
"formatter",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsConfigurationReader.java#L535-L555 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java | WebhookMessage.from | public static WebhookMessage from(Message message)
{
Checks.notNull(message, "Message");
final String content = message.getContentRaw();
final List<MessageEmbed> embeds = message.getEmbeds();
final boolean isTTS = message.isTTS();
return new WebhookMessage(null, null, content, embeds, isTTS, null);
} | java | public static WebhookMessage from(Message message)
{
Checks.notNull(message, "Message");
final String content = message.getContentRaw();
final List<MessageEmbed> embeds = message.getEmbeds();
final boolean isTTS = message.isTTS();
return new WebhookMessage(null, null, content, embeds, isTTS, null);
} | [
"public",
"static",
"WebhookMessage",
"from",
"(",
"Message",
"message",
")",
"{",
"Checks",
".",
"notNull",
"(",
"message",
",",
"\"Message\"",
")",
";",
"final",
"String",
"content",
"=",
"message",
".",
"getContentRaw",
"(",
")",
";",
"final",
"List",
"... | Creates a new WebhookMessage instance with the provided {@link net.dv8tion.jda.core.entities.Message Message}
as layout for copying.
<br><b>This does not copy the attachments of the provided message!</b>
@param message
The message to copy
@throws java.lang.IllegalArgumentException
If the provided message is {@code null}
@return The resulting WebhookMessage instance | [
"Creates",
"a",
"new",
"WebhookMessage",
"instance",
"with",
"the",
"provided",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"Message",
"Message",
"}",
"as",
"layout",
"for",
"copying",
".",
"<br",
">",
"<b",
">",
... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java#L220-L227 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/provider/AbstractDataProvider.java | AbstractDataProvider.getDetailObject | public final Object getDetailObject(Object selectedObject, boolean forceLoad)
{
if (forceLoad || !isDetailObject(selectedObject))
return loadDetailObject(selectedObject);
return selectedObject;
} | java | public final Object getDetailObject(Object selectedObject, boolean forceLoad)
{
if (forceLoad || !isDetailObject(selectedObject))
return loadDetailObject(selectedObject);
return selectedObject;
} | [
"public",
"final",
"Object",
"getDetailObject",
"(",
"Object",
"selectedObject",
",",
"boolean",
"forceLoad",
")",
"{",
"if",
"(",
"forceLoad",
"||",
"!",
"isDetailObject",
"(",
"selectedObject",
")",
")",
"return",
"loadDetailObject",
"(",
"selectedObject",
")",
... | A basic implementation that directs the necessary logic to {@link #isDetailObject(Object)} and
{@link #loadDetailObject(Object)}. | [
"A",
"basic",
"implementation",
"that",
"directs",
"the",
"necessary",
"logic",
"to",
"{"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/provider/AbstractDataProvider.java#L50-L55 |
CleverTap/clevertap-android-sdk | clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/ProfileHandler.java | ProfileHandler.removeMultiValueForKey | @Deprecated
public void removeMultiValueForKey(String key, String value) {
CleverTapAPI cleverTapAPI = weakReference.get();
if (cleverTapAPI == null) {
Logger.d("CleverTap Instance is null.");
} else {
cleverTapAPI.removeMultiValueForKey(key, value);
}
} | java | @Deprecated
public void removeMultiValueForKey(String key, String value) {
CleverTapAPI cleverTapAPI = weakReference.get();
if (cleverTapAPI == null) {
Logger.d("CleverTap Instance is null.");
} else {
cleverTapAPI.removeMultiValueForKey(key, value);
}
} | [
"@",
"Deprecated",
"public",
"void",
"removeMultiValueForKey",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"CleverTapAPI",
"cleverTapAPI",
"=",
"weakReference",
".",
"get",
"(",
")",
";",
"if",
"(",
"cleverTapAPI",
"==",
"null",
")",
"{",
"Logger... | Remove a unique value from a multi-value user profile property
<p/>
If the key currently contains a scalar value, prior to performing the remove operation
the key will be promoted to a multi-value property with the current value cast to a string.
If the multi-value property is empty after the remove operation, the key will be removed.
@param key String
@param value String
@deprecated use {@link CleverTapAPI#removeMultiValueForKey(String key, String value)} | [
"Remove",
"a",
"unique",
"value",
"from",
"a",
"multi",
"-",
"value",
"user",
"profile",
"property",
"<p",
"/",
">",
"If",
"the",
"key",
"currently",
"contains",
"a",
"scalar",
"value",
"prior",
"to",
"performing",
"the",
"remove",
"operation",
"the",
"key... | train | https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/ProfileHandler.java#L96-L104 |
ops4j/org.ops4j.pax.wicket | service/src/main/java/org/ops4j/pax/wicket/internal/extender/BundleDelegatingExtensionTracker.java | BundleDelegatingExtensionTracker.modifiedWebApplicationFactory | public void
modifiedWebApplicationFactory(WebApplicationFactory<?> webApplicationFactory, Map<String, ?> properties) {
// TODO check if this is really needed or if we are fine with the normal remove/add provided by DS...
synchronized (this) {
removeServicesForServiceReference(webApplicationFactory);
addServicesForServiceReference(webApplicationFactory, properties);
reevaluateAllBundles(webApplicationFactory);
}
} | java | public void
modifiedWebApplicationFactory(WebApplicationFactory<?> webApplicationFactory, Map<String, ?> properties) {
// TODO check if this is really needed or if we are fine with the normal remove/add provided by DS...
synchronized (this) {
removeServicesForServiceReference(webApplicationFactory);
addServicesForServiceReference(webApplicationFactory, properties);
reevaluateAllBundles(webApplicationFactory);
}
} | [
"public",
"void",
"modifiedWebApplicationFactory",
"(",
"WebApplicationFactory",
"<",
"?",
">",
"webApplicationFactory",
",",
"Map",
"<",
"String",
",",
"?",
">",
"properties",
")",
"{",
"// TODO check if this is really needed or if we are fine with the normal remove/add provid... | <p>modifiedWebApplicationFactory.</p>
@param webApplicationFactory a {@link org.ops4j.pax.wicket.api.WebApplicationFactory} object.
@param properties a {@link java.util.Map} object.
@since 3.0.5 | [
"<p",
">",
"modifiedWebApplicationFactory",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/internal/extender/BundleDelegatingExtensionTracker.java#L116-L124 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbOnePhaseXaResourceImpl.java | WSRdbOnePhaseXaResourceImpl.traceXAException | public static final XAException traceXAException(XAException xae, Class<?> callerClass) {
Tr.warning(tc, "THROW_XAEXCEPTION", new Object[]
{ AdapterUtil.getXAExceptionCodeString(xae.errorCode), xae.getMessage() });
return xae;
} | java | public static final XAException traceXAException(XAException xae, Class<?> callerClass) {
Tr.warning(tc, "THROW_XAEXCEPTION", new Object[]
{ AdapterUtil.getXAExceptionCodeString(xae.errorCode), xae.getMessage() });
return xae;
} | [
"public",
"static",
"final",
"XAException",
"traceXAException",
"(",
"XAException",
"xae",
",",
"Class",
"<",
"?",
">",
"callerClass",
")",
"{",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"THROW_XAEXCEPTION\"",
",",
"new",
"Object",
"[",
"]",
"{",
"AdapterUtil"... | Method to translate the XAResource stuff, including the error code. | [
"Method",
"to",
"translate",
"the",
"XAResource",
"stuff",
"including",
"the",
"error",
"code",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbOnePhaseXaResourceImpl.java#L559-L564 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.