repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java | PreambleUtil.getHiFieldOffset | static long getHiFieldOffset(final Format format, final HiField hiField) {
"""
Returns the defined byte offset from the start of the preamble given the <i>HiField</i>
and the <i>Format</i>.
Note this can not be used to obtain the stream offsets.
@param format the desired <i>Format</i>
@param hiField the desire... | java | static long getHiFieldOffset(final Format format, final HiField hiField) {
final int formatIdx = format.ordinal();
final int hiFieldIdx = hiField.ordinal();
final long fieldOffset = hiFieldOffset[formatIdx][hiFieldIdx] & 0xFF; //initially a byte
if (fieldOffset == 0) {
throw new SketchesStateExcep... | [
"static",
"long",
"getHiFieldOffset",
"(",
"final",
"Format",
"format",
",",
"final",
"HiField",
"hiField",
")",
"{",
"final",
"int",
"formatIdx",
"=",
"format",
".",
"ordinal",
"(",
")",
";",
"final",
"int",
"hiFieldIdx",
"=",
"hiField",
".",
"ordinal",
"... | Returns the defined byte offset from the start of the preamble given the <i>HiField</i>
and the <i>Format</i>.
Note this can not be used to obtain the stream offsets.
@param format the desired <i>Format</i>
@param hiField the desired preamble <i>HiField</i> after the first eight bytes.
@return the defined byte offset f... | [
"Returns",
"the",
"defined",
"byte",
"offset",
"from",
"the",
"start",
"of",
"the",
"preamble",
"given",
"the",
"<i",
">",
"HiField<",
"/",
"i",
">",
"and",
"the",
"<i",
">",
"Format<",
"/",
"i",
">",
".",
"Note",
"this",
"can",
"not",
"be",
"used",
... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/PreambleUtil.java#L275-L284 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setItem | public final void setItem(final int index, final int id, @NonNull final CharSequence title,
@Nullable final Drawable icon) {
"""
Replaces the item at a specific index with another item.
@param index
The index of the item, which should be replaced, as an {@link Integer} value
@par... | java | public final void setItem(final int index, final int id, @NonNull final CharSequence title,
@Nullable final Drawable icon) {
Item item = new Item(id, title);
item.setIcon(icon);
adapter.set(index, item);
adaptGridViewHeight();
} | [
"public",
"final",
"void",
"setItem",
"(",
"final",
"int",
"index",
",",
"final",
"int",
"id",
",",
"@",
"NonNull",
"final",
"CharSequence",
"title",
",",
"@",
"Nullable",
"final",
"Drawable",
"icon",
")",
"{",
"Item",
"item",
"=",
"new",
"Item",
"(",
... | Replaces the item at a specific index with another item.
@param index
The index of the item, which should be replaced, as an {@link Integer} value
@param id
The id of the item, which should be added, as an {@link Integer} value. The id must
be at least 0
@param title
The title of the item, which should be added, as an... | [
"Replaces",
"the",
"item",
"at",
"a",
"specific",
"index",
"with",
"another",
"item",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2079-L2085 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java | JsiiObject.jsiiSet | protected final void jsiiSet(final String property, @Nullable final Object value) {
"""
Sets a property value of an object.
@param property The name of the property.
@param value The property value.
"""
engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value));
... | java | protected final void jsiiSet(final String property, @Nullable final Object value) {
engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value));
} | [
"protected",
"final",
"void",
"jsiiSet",
"(",
"final",
"String",
"property",
",",
"@",
"Nullable",
"final",
"Object",
"value",
")",
"{",
"engine",
".",
"getClient",
"(",
")",
".",
"setPropertyValue",
"(",
"this",
".",
"objRef",
",",
"property",
",",
"JsiiO... | Sets a property value of an object.
@param property The name of the property.
@param value The property value. | [
"Sets",
"a",
"property",
"value",
"of",
"an",
"object",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L129-L131 |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java | NumberSelectorServiceImpl.searchNumberWithResult | @Override
public NumberSelectionResult searchNumberWithResult(String phone,
Sid sourceOrganizationSid, Sid destinationOrganizationSid) {
"""
The main logic is: -Find a perfect match in DB using different formats.
-If not matched, use available Regexes in the organization. -If not
matched, try wit... | java | @Override
public NumberSelectionResult searchNumberWithResult(String phone,
Sid sourceOrganizationSid, Sid destinationOrganizationSid){
return searchNumberWithResult(phone, sourceOrganizationSid, destinationOrganizationSid, new HashSet<>(Arrays.asList(SearchModifier.ORG_COMPLIANT)));
} | [
"@",
"Override",
"public",
"NumberSelectionResult",
"searchNumberWithResult",
"(",
"String",
"phone",
",",
"Sid",
"sourceOrganizationSid",
",",
"Sid",
"destinationOrganizationSid",
")",
"{",
"return",
"searchNumberWithResult",
"(",
"phone",
",",
"sourceOrganizationSid",
"... | The main logic is: -Find a perfect match in DB using different formats.
-If not matched, use available Regexes in the organization. -If not
matched, try with the special * match.
@param phone
@param sourceOrganizationSid
@param destinationOrganizationSid
@return | [
"The",
"main",
"logic",
"is",
":",
"-",
"Find",
"a",
"perfect",
"match",
"in",
"DB",
"using",
"different",
"formats",
".",
"-",
"If",
"not",
"matched",
"use",
"available",
"Regexes",
"in",
"the",
"organization",
".",
"-",
"If",
"not",
"matched",
"try",
... | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java#L260-L264 |
EdwardRaff/JSAT | JSAT/src/jsat/math/optimization/stochastic/SGDMomentum.java | SGDMomentum.setMomentum | public void setMomentum(double momentum) {
"""
Sets the momentum for accumulating gradients.
@param momentum the momentum buildup term in (0, 1)
"""
if(momentum <= 0 || momentum >= 1 || Double.isNaN(momentum))
throw new IllegalArgumentException("Momentum must be in (0,1) not " + momentum);... | java | public void setMomentum(double momentum)
{
if(momentum <= 0 || momentum >= 1 || Double.isNaN(momentum))
throw new IllegalArgumentException("Momentum must be in (0,1) not " + momentum);
this.momentum = momentum;
} | [
"public",
"void",
"setMomentum",
"(",
"double",
"momentum",
")",
"{",
"if",
"(",
"momentum",
"<=",
"0",
"||",
"momentum",
">=",
"1",
"||",
"Double",
".",
"isNaN",
"(",
"momentum",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Momentum must be... | Sets the momentum for accumulating gradients.
@param momentum the momentum buildup term in (0, 1) | [
"Sets",
"the",
"momentum",
"for",
"accumulating",
"gradients",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/stochastic/SGDMomentum.java#L70-L75 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/ruts/config/ActionMapping.java | ActionMapping.createNextJourney | public NextJourney createNextJourney(PlannedJourneyProvider journeyProvider, HtmlResponse response) {
"""
o routing path of forward e.g. /member/list/ -> MemberListAction
""" // almost copied from super
String path = response.getRoutingPath();
final boolean redirectTo = response.isRedirectTo();... | java | public NextJourney createNextJourney(PlannedJourneyProvider journeyProvider, HtmlResponse response) { // almost copied from super
String path = response.getRoutingPath();
final boolean redirectTo = response.isRedirectTo();
if (path.indexOf(":") < 0) {
if (!path.startsWith("/")) {
... | [
"public",
"NextJourney",
"createNextJourney",
"(",
"PlannedJourneyProvider",
"journeyProvider",
",",
"HtmlResponse",
"response",
")",
"{",
"// almost copied from super",
"String",
"path",
"=",
"response",
".",
"getRoutingPath",
"(",
")",
";",
"final",
"boolean",
"redire... | o routing path of forward e.g. /member/list/ -> MemberListAction | [
"o",
"routing",
"path",
"of",
"forward",
"e",
".",
"g",
".",
"/",
"member",
"/",
"list",
"/",
"-",
">",
"MemberListAction"
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/ruts/config/ActionMapping.java#L126-L138 |
structr/structr | structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java | AuthHelper.getPrincipalForCredential | public static <T> Principal getPrincipalForCredential(final PropertyKey<T> key, final T value) {
"""
Find a {@link Principal} for the given credential
@param key
@param value
@return principal
"""
return getPrincipalForCredential(key, value, false);
} | java | public static <T> Principal getPrincipalForCredential(final PropertyKey<T> key, final T value) {
return getPrincipalForCredential(key, value, false);
} | [
"public",
"static",
"<",
"T",
">",
"Principal",
"getPrincipalForCredential",
"(",
"final",
"PropertyKey",
"<",
"T",
">",
"key",
",",
"final",
"T",
"value",
")",
"{",
"return",
"getPrincipalForCredential",
"(",
"key",
",",
"value",
",",
"false",
")",
";",
"... | Find a {@link Principal} for the given credential
@param key
@param value
@return principal | [
"Find",
"a",
"{",
"@link",
"Principal",
"}",
"for",
"the",
"given",
"credential"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java#L64-L68 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java | MicroWriter.writeToFile | @Nonnull
public static ESuccess writeToFile (@Nonnull final IMicroNode aNode, @Nonnull final File aFile) {
"""
Write a Micro Node to a file using the default settings.
@param aNode
The node to be serialized. May be any kind of node (incl.
documents). May not be <code>null</code>.
@param aFile
The file to ... | java | @Nonnull
public static ESuccess writeToFile (@Nonnull final IMicroNode aNode, @Nonnull final File aFile)
{
return writeToFile (aNode, aFile, XMLWriterSettings.DEFAULT_XML_SETTINGS);
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"writeToFile",
"(",
"@",
"Nonnull",
"final",
"IMicroNode",
"aNode",
",",
"@",
"Nonnull",
"final",
"File",
"aFile",
")",
"{",
"return",
"writeToFile",
"(",
"aNode",
",",
"aFile",
",",
"XMLWriterSettings",
".",
"... | Write a Micro Node to a file using the default settings.
@param aNode
The node to be serialized. May be any kind of node (incl.
documents). May not be <code>null</code>.
@param aFile
The file to write to. May not be <code>null</code>.
@return {@link ESuccess} | [
"Write",
"a",
"Micro",
"Node",
"to",
"a",
"file",
"using",
"the",
"default",
"settings",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L70-L74 |
robinst/autolink-java | src/main/java/org/nibor/autolink/LinkExtractor.java | LinkExtractor.extractSpans | public Iterable<Span> extractSpans(final CharSequence input) {
"""
Extract spans from the input text. A span is a substring of the input and represents either a link
(see {@link LinkSpan}) or plain text outside a link.
<p>
Using this is more convenient than {@link #extractLinks} if you want to transform the who... | java | public Iterable<Span> extractSpans(final CharSequence input) {
if (input == null) {
throw new NullPointerException("input must not be null");
}
return new Iterable<Span>() {
@Override
public Iterator<Span> iterator() {
return new SpanIterator(i... | [
"public",
"Iterable",
"<",
"Span",
">",
"extractSpans",
"(",
"final",
"CharSequence",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"input must not be null\"",
")",
";",
"}",
"return",
"new",
"I... | Extract spans from the input text. A span is a substring of the input and represents either a link
(see {@link LinkSpan}) or plain text outside a link.
<p>
Using this is more convenient than {@link #extractLinks} if you want to transform the whole input text to
a different format.
@param input the input text, must not... | [
"Extract",
"spans",
"from",
"the",
"input",
"text",
".",
"A",
"span",
"is",
"a",
"substring",
"of",
"the",
"input",
"and",
"represents",
"either",
"a",
"link",
"(",
"see",
"{",
"@link",
"LinkSpan",
"}",
")",
"or",
"plain",
"text",
"outside",
"a",
"link... | train | https://github.com/robinst/autolink-java/blob/9b01c2620d450cd51942f4d092e4e7153980c6d8/src/main/java/org/nibor/autolink/LinkExtractor.java#L58-L68 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java | BaseProfile.generateMultiMcfClassCode | void generateMultiMcfClassCode(Definition def, String className, int num) {
"""
generate multi mcf class code
@param def Definition
@param className class name
@param num number of order
"""
if (className == null || className.equals(""))
return;
if (num < 0 || num + 1 > de... | java | void generateMultiMcfClassCode(Definition def, String className, int num)
{
if (className == null || className.equals(""))
return;
if (num < 0 || num + 1 > def.getMcfDefs().size())
return;
try
{
String clazzName = this.getClass().getPackage().getName() + ".code." +... | [
"void",
"generateMultiMcfClassCode",
"(",
"Definition",
"def",
",",
"String",
"className",
",",
"int",
"num",
")",
"{",
"if",
"(",
"className",
"==",
"null",
"||",
"className",
".",
"equals",
"(",
"\"\"",
")",
")",
"return",
";",
"if",
"(",
"num",
"<",
... | generate multi mcf class code
@param def Definition
@param className class name
@param num number of order | [
"generate",
"multi",
"mcf",
"class",
"code"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L256-L286 |
i-net-software/jlessc | src/com/inet/lib/less/FunctionExpression.java | FunctionExpression.getPercent | private double getPercent( int idx, double defaultValue, CssFormatter formatter ) {
"""
Get the idx parameter from the parameter list as percent (range 0 - 1).
@param idx
the index starting with 0
@param defaultValue
the result if such a parameter idx does not exists.
@param formatter
current formatter
@r... | java | private double getPercent( int idx, double defaultValue, CssFormatter formatter ) {
if( parameters.size() <= idx ) {
return defaultValue;
}
return ColorUtils.getPercent( get( idx ), formatter );
} | [
"private",
"double",
"getPercent",
"(",
"int",
"idx",
",",
"double",
"defaultValue",
",",
"CssFormatter",
"formatter",
")",
"{",
"if",
"(",
"parameters",
".",
"size",
"(",
")",
"<=",
"idx",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"ColorUtil... | Get the idx parameter from the parameter list as percent (range 0 - 1).
@param idx
the index starting with 0
@param defaultValue
the result if such a parameter idx does not exists.
@param formatter
current formatter
@return the the percent value | [
"Get",
"the",
"idx",
"parameter",
"from",
"the",
"parameter",
"list",
"as",
"percent",
"(",
"range",
"0",
"-",
"1",
")",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L963-L968 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.availableAutomaticPaymentMeans_GET | public OvhAutomaticPaymentMean availableAutomaticPaymentMeans_GET() throws IOException {
"""
List available payment methods in this Nic's country
REST: GET /me/availableAutomaticPaymentMeans
"""
String qPath = "/me/availableAutomaticPaymentMeans";
StringBuilder sb = path(qPath);
String resp = exec(qPa... | java | public OvhAutomaticPaymentMean availableAutomaticPaymentMeans_GET() throws IOException {
String qPath = "/me/availableAutomaticPaymentMeans";
StringBuilder sb = path(qPath);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAutomaticPaymentMean.class);
} | [
"public",
"OvhAutomaticPaymentMean",
"availableAutomaticPaymentMeans_GET",
"(",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/availableAutomaticPaymentMeans\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"String",
"resp",
"=",
... | List available payment methods in this Nic's country
REST: GET /me/availableAutomaticPaymentMeans | [
"List",
"available",
"payment",
"methods",
"in",
"this",
"Nic",
"s",
"country"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L374-L379 |
voldemort/voldemort | src/java/voldemort/cluster/failuredetector/AbstractFailureDetector.java | AbstractFailureDetector.setAvailable | private boolean setAvailable(NodeStatus nodeStatus, boolean isAvailable) {
"""
We need to distinguish the case where we're newly available and the case
where we're already available. So we check the node status before we
update it and return it to the caller.
@param isAvailable True to set to available, false... | java | private boolean setAvailable(NodeStatus nodeStatus, boolean isAvailable) {
synchronized(nodeStatus) {
boolean previous = nodeStatus.isAvailable();
nodeStatus.setAvailable(isAvailable);
nodeStatus.setLastChecked(getConfig().getTime().getMilliseconds());
return pr... | [
"private",
"boolean",
"setAvailable",
"(",
"NodeStatus",
"nodeStatus",
",",
"boolean",
"isAvailable",
")",
"{",
"synchronized",
"(",
"nodeStatus",
")",
"{",
"boolean",
"previous",
"=",
"nodeStatus",
".",
"isAvailable",
"(",
")",
";",
"nodeStatus",
".",
"setAvail... | We need to distinguish the case where we're newly available and the case
where we're already available. So we check the node status before we
update it and return it to the caller.
@param isAvailable True to set to available, false to make unavailable
@return Previous value of isAvailable | [
"We",
"need",
"to",
"distinguish",
"the",
"case",
"where",
"we",
"re",
"newly",
"available",
"and",
"the",
"case",
"where",
"we",
"re",
"already",
"available",
".",
"So",
"we",
"check",
"the",
"node",
"status",
"before",
"we",
"update",
"it",
"and",
"ret... | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/cluster/failuredetector/AbstractFailureDetector.java#L273-L282 |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java | ConfigurationContext.registerDisablePredicates | @SuppressWarnings("PMD.UseVarargs")
public void registerDisablePredicates(final Predicate<ItemInfo>[] predicates) {
"""
Register disable predicates, used to disable all matched items.
<p>
After registration predicates are applied to all currently registered items to avoid registration
order influence.
@p... | java | @SuppressWarnings("PMD.UseVarargs")
public void registerDisablePredicates(final Predicate<ItemInfo>[] predicates) {
final List<PredicateHandler> list = Arrays.stream(predicates)
.map(p -> new PredicateHandler(p, getScope()))
.collect(Collectors.toList());
disablePredi... | [
"@",
"SuppressWarnings",
"(",
"\"PMD.UseVarargs\"",
")",
"public",
"void",
"registerDisablePredicates",
"(",
"final",
"Predicate",
"<",
"ItemInfo",
">",
"[",
"]",
"predicates",
")",
"{",
"final",
"List",
"<",
"PredicateHandler",
">",
"list",
"=",
"Arrays",
".",
... | Register disable predicates, used to disable all matched items.
<p>
After registration predicates are applied to all currently registered items to avoid registration
order influence.
@param predicates disable predicates | [
"Register",
"disable",
"predicates",
"used",
"to",
"disable",
"all",
"matched",
"items",
".",
"<p",
">",
"After",
"registration",
"predicates",
"are",
"applied",
"to",
"all",
"currently",
"registered",
"items",
"to",
"avoid",
"registration",
"order",
"influence",
... | train | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L474-L481 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java | FieldTable.doSetHandle | public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException {
"""
Reposition to this record using this bookmark.
@param bookmark The handle to use to position the record.
@param iHandleType The type of handle (DATA_SOURCE/OBJECT_ID,OBJECT_SOURCE,BOOKMARK).
@return - true - record found/fals... | java | public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException
{
String strCurrentOrder = this.getRecord().getKeyName();
this.getRecord().setKeyArea(Constants.PRIMARY_KEY);
this.getRecord().getCounterField().setData(bookmark);
boolean bSuccess = this.seek(Constants.... | [
"public",
"boolean",
"doSetHandle",
"(",
"Object",
"bookmark",
",",
"int",
"iHandleType",
")",
"throws",
"DBException",
"{",
"String",
"strCurrentOrder",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"getKeyName",
"(",
")",
";",
"this",
".",
"getRecord",
"("... | Reposition to this record using this bookmark.
@param bookmark The handle to use to position the record.
@param iHandleType The type of handle (DATA_SOURCE/OBJECT_ID,OBJECT_SOURCE,BOOKMARK).
@return - true - record found/false - record not found
@exception FILE_NOT_OPEN.
@exception DBException File exception. | [
"Reposition",
"to",
"this",
"record",
"using",
"this",
"bookmark",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java#L492-L502 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/helper/ItemAdapter.java | ItemAdapter.getItemDetail | private ItemDetail getItemDetail(Gson gson, JsonElement itemType, JsonElement detail) {
"""
get the correct type of item detail, will give null if itemType/detail is empty
"""
if (itemType == null || detail == null) return null;
Item.Type type = gson.fromJson(itemType, Item.Type.class);
Class<? extends ... | java | private ItemDetail getItemDetail(Gson gson, JsonElement itemType, JsonElement detail) {
if (itemType == null || detail == null) return null;
Item.Type type = gson.fromJson(itemType, Item.Type.class);
Class<? extends ItemDetail> detailType;
switch (type) {
case Armor:
detailType = Armor.class;
break... | [
"private",
"ItemDetail",
"getItemDetail",
"(",
"Gson",
"gson",
",",
"JsonElement",
"itemType",
",",
"JsonElement",
"detail",
")",
"{",
"if",
"(",
"itemType",
"==",
"null",
"||",
"detail",
"==",
"null",
")",
"return",
"null",
";",
"Item",
".",
"Type",
"type... | get the correct type of item detail, will give null if itemType/detail is empty | [
"get",
"the",
"correct",
"type",
"of",
"item",
"detail",
"will",
"give",
"null",
"if",
"itemType",
"/",
"detail",
"is",
"empty"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/helper/ItemAdapter.java#L50-L86 |
akamai/AkamaiOPEN-edgegrid-java | edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java | EdgeRcClientCredentialProvider.fromEdgeRc | public static EdgeRcClientCredentialProvider fromEdgeRc(InputStream inputStream, String section)
throws ConfigurationException, IOException {
"""
Loads an EdgeRc configuration file and returns an {@link EdgeRcClientCredentialProvider} to
read {@link ClientCredential}s from it.
@param inputStream an... | java | public static EdgeRcClientCredentialProvider fromEdgeRc(InputStream inputStream, String section)
throws ConfigurationException, IOException {
Objects.requireNonNull(inputStream, "inputStream cannot be null");
return fromEdgeRc(new InputStreamReader(inputStream), section);
} | [
"public",
"static",
"EdgeRcClientCredentialProvider",
"fromEdgeRc",
"(",
"InputStream",
"inputStream",
",",
"String",
"section",
")",
"throws",
"ConfigurationException",
",",
"IOException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"inputStream",
",",
"\"inputStream can... | Loads an EdgeRc configuration file and returns an {@link EdgeRcClientCredentialProvider} to
read {@link ClientCredential}s from it.
@param inputStream an open {@link InputStream} to an EdgeRc file
@param section a config section ({@code null} for the default section)
@return a {@link EdgeRcClientCredentialProvider}
@t... | [
"Loads",
"an",
"EdgeRc",
"configuration",
"file",
"and",
"returns",
"an",
"{",
"@link",
"EdgeRcClientCredentialProvider",
"}",
"to",
"read",
"{",
"@link",
"ClientCredential",
"}",
"s",
"from",
"it",
"."
] | train | https://github.com/akamai/AkamaiOPEN-edgegrid-java/blob/29aa39f0f70f62503e6a434c4470ee25cb640f58/edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java#L78-L82 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.getAndDecryptObject | public JsonObject getAndDecryptObject(String name, String providerName) throws Exception {
"""
Retrieves the decrypted value from the field name and casts it to {@link JsonObject}.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchb... | java | public JsonObject getAndDecryptObject(String name, String providerName) throws Exception {
return (JsonObject) getAndDecrypt(name, providerName);
} | [
"public",
"JsonObject",
"getAndDecryptObject",
"(",
"String",
"name",
",",
"String",
"providerName",
")",
"throws",
"Exception",
"{",
"return",
"(",
"JsonObject",
")",
"getAndDecrypt",
"(",
"name",
",",
"providerName",
")",
";",
"}"
] | Retrieves the decrypted value from the field name and casts it to {@link JsonObject}.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase... | [
"Retrieves",
"the",
"decrypted",
"value",
"from",
"the",
"field",
"name",
"and",
"casts",
"it",
"to",
"{",
"@link",
"JsonObject",
"}",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L769-L771 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java | MpJwtAppSetupUtils.genericCreateArchiveWithPems | protected WebArchive genericCreateArchiveWithPems(String sourceWarName, String baseWarName, List<String> classList) throws Exception {
"""
Create a test war using files from the source war and the classList. Add a default list of pem files
@param sourceWarName - the source war to get xml files from
@param base... | java | protected WebArchive genericCreateArchiveWithPems(String sourceWarName, String baseWarName, List<String> classList) throws Exception {
try {
String warName = baseWarName + ".war";
WebArchive newWar = ShrinkWrap.create(WebArchive.class, warName);
addDefaultFileAssetsForAppsToW... | [
"protected",
"WebArchive",
"genericCreateArchiveWithPems",
"(",
"String",
"sourceWarName",
",",
"String",
"baseWarName",
",",
"List",
"<",
"String",
">",
"classList",
")",
"throws",
"Exception",
"{",
"try",
"{",
"String",
"warName",
"=",
"baseWarName",
"+",
"\".wa... | Create a test war using files from the source war and the classList. Add a default list of pem files
@param sourceWarName - the source war to get xml files from
@param baseWarName - the base name of the war file to create
@param classList - the list of classes to add to the war
@return - return a war built from the sp... | [
"Create",
"a",
"test",
"war",
"using",
"files",
"from",
"the",
"source",
"war",
"and",
"the",
"classList",
".",
"Add",
"a",
"default",
"list",
"of",
"pem",
"files"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/utils/MpJwtAppSetupUtils.java#L176-L190 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/ValueMap.java | ValueMap.getDouble | public double getDouble(String key, double defaultValue) {
"""
Returns the value mapped by {@code key} if it exists and is a double or can be coerced to a
double. Returns {@code defaultValue} otherwise.
"""
Object value = get(key);
if (value instanceof Double) {
return (double) value;
}
... | java | public double getDouble(String key, double defaultValue) {
Object value = get(key);
if (value instanceof Double) {
return (double) value;
}
if (value instanceof Number) {
return ((Number) value).doubleValue();
} else if (value instanceof String) {
try {
return Double.valueO... | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"Object",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"instanceof",
"Double",
")",
"{",
"return",
"(",
"double",
")",
"value",
";",
"}",
... | Returns the value mapped by {@code key} if it exists and is a double or can be coerced to a
double. Returns {@code defaultValue} otherwise. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/ValueMap.java#L224-L238 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkAssign | private Environment checkAssign(Stmt.Assign stmt, Environment environment, EnclosingScope scope)
throws IOException {
"""
Type check an assignment statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return
"""
Tu... | java | private Environment checkAssign(Stmt.Assign stmt, Environment environment, EnclosingScope scope)
throws IOException {
Tuple<LVal> lvals = stmt.getLeftHandSide();
Type[] types = new Type[lvals.size()];
for (int i = 0; i != lvals.size(); ++i) {
types[i] = checkLVal(lvals.get(i), environment);
}
checkMulti... | [
"private",
"Environment",
"checkAssign",
"(",
"Stmt",
".",
"Assign",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"throws",
"IOException",
"{",
"Tuple",
"<",
"LVal",
">",
"lvals",
"=",
"stmt",
".",
"getLeftHandSide",
"(",
")"... | Type check an assignment statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"an",
"assignment",
"statement",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L441-L450 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java | TrifocalExtractGeometries.extractEpipoles | public void extractEpipoles( Point3D_F64 e2 , Point3D_F64 e3 ) {
"""
Extracts the epipoles from the trifocal tensor. Extracted epipoles will have a norm of 1
as an artifact of using SVD.
@param e2 Output: Epipole in image 2. Homogeneous coordinates. Modified
@param e3 Output: Epipole in image 3. Homogeneou... | java | public void extractEpipoles( Point3D_F64 e2 , Point3D_F64 e3 ) {
e2.set(this.e2);
e3.set(this.e3);
} | [
"public",
"void",
"extractEpipoles",
"(",
"Point3D_F64",
"e2",
",",
"Point3D_F64",
"e3",
")",
"{",
"e2",
".",
"set",
"(",
"this",
".",
"e2",
")",
";",
"e3",
".",
"set",
"(",
"this",
".",
"e3",
")",
";",
"}"
] | Extracts the epipoles from the trifocal tensor. Extracted epipoles will have a norm of 1
as an artifact of using SVD.
@param e2 Output: Epipole in image 2. Homogeneous coordinates. Modified
@param e3 Output: Epipole in image 3. Homogeneous coordinates. Modified | [
"Extracts",
"the",
"epipoles",
"from",
"the",
"trifocal",
"tensor",
".",
"Extracted",
"epipoles",
"will",
"have",
"a",
"norm",
"of",
"1",
"as",
"an",
"artifact",
"of",
"using",
"SVD",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalExtractGeometries.java#L144-L147 |
undertow-io/undertow | core/src/main/java/io/undertow/util/DateUtils.java | DateUtils.handleIfUnmodifiedSince | public static boolean handleIfUnmodifiedSince(final HttpServerExchange exchange, final Date lastModified) {
"""
Handles the if-unmodified-since header. returns true if the request should proceed, false otherwise
@param exchange the exchange
@param lastModified The last modified date
@return
"""
... | java | public static boolean handleIfUnmodifiedSince(final HttpServerExchange exchange, final Date lastModified) {
return handleIfUnmodifiedSince(exchange.getRequestHeaders().getFirst(Headers.IF_UNMODIFIED_SINCE), lastModified);
} | [
"public",
"static",
"boolean",
"handleIfUnmodifiedSince",
"(",
"final",
"HttpServerExchange",
"exchange",
",",
"final",
"Date",
"lastModified",
")",
"{",
"return",
"handleIfUnmodifiedSince",
"(",
"exchange",
".",
"getRequestHeaders",
"(",
")",
".",
"getFirst",
"(",
... | Handles the if-unmodified-since header. returns true if the request should proceed, false otherwise
@param exchange the exchange
@param lastModified The last modified date
@return | [
"Handles",
"the",
"if",
"-",
"unmodified",
"-",
"since",
"header",
".",
"returns",
"true",
"if",
"the",
"request",
"should",
"proceed",
"false",
"otherwise"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/DateUtils.java#L212-L214 |
infinispan/infinispan | core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java | InternalCacheRegistryImpl.registerInternalCache | @Override
public synchronized void registerInternalCache(String name, Configuration configuration, EnumSet<Flag> flags) {
"""
Synchronized to prevent users from registering the same configuration at the same time
"""
boolean configPresent = cacheManager.getCacheConfiguration(name) != null;
// ch... | java | @Override
public synchronized void registerInternalCache(String name, Configuration configuration, EnumSet<Flag> flags) {
boolean configPresent = cacheManager.getCacheConfiguration(name) != null;
// check if it already has been defined. Currently we don't support existing user-defined configuration.
... | [
"@",
"Override",
"public",
"synchronized",
"void",
"registerInternalCache",
"(",
"String",
"name",
",",
"Configuration",
"configuration",
",",
"EnumSet",
"<",
"Flag",
">",
"flags",
")",
"{",
"boolean",
"configPresent",
"=",
"cacheManager",
".",
"getCacheConfiguratio... | Synchronized to prevent users from registering the same configuration at the same time | [
"Synchronized",
"to",
"prevent",
"users",
"from",
"registering",
"the",
"same",
"configuration",
"at",
"the",
"same",
"time"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java#L40-L68 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowStack.java | PageFlowStack.popUntil | PageFlowController popUntil( HttpServletRequest request, Class stopAt, boolean onlyIfPresent ) {
"""
Pop page flows from the nesting stack until one of the given type is found.
@return the last popped page flow if one of the given type was found, or <code>null</code>
if none was found.
"""
if (only... | java | PageFlowController popUntil( HttpServletRequest request, Class stopAt, boolean onlyIfPresent )
{
if (onlyIfPresent && lastIndexOf(stopAt) == -1) {
return null;
}
while ( ! isEmpty() )
{
PageFlowController popped = pop( request ).getPageFlow();
... | [
"PageFlowController",
"popUntil",
"(",
"HttpServletRequest",
"request",
",",
"Class",
"stopAt",
",",
"boolean",
"onlyIfPresent",
")",
"{",
"if",
"(",
"onlyIfPresent",
"&&",
"lastIndexOf",
"(",
"stopAt",
")",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"... | Pop page flows from the nesting stack until one of the given type is found.
@return the last popped page flow if one of the given type was found, or <code>null</code>
if none was found. | [
"Pop",
"page",
"flows",
"from",
"the",
"nesting",
"stack",
"until",
"one",
"of",
"the",
"given",
"type",
"is",
"found",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowStack.java#L200-L229 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/httppanel/view/util/HttpTextViewUtils.java | HttpTextViewUtils.validateStartEnd | private static void validateStartEnd(int start, int end) {
"""
Validates the given {@code start} and {@code end} positions.
@param start the start position to be validated
@param end the end position to be validated
@throws IllegalArgumentException if any of the conditions is true:
<ul>
<li>the {@code start... | java | private static void validateStartEnd(int start, int end) {
if (start < 0) {
throw new IllegalArgumentException("Parameter start must not be negative.");
}
if (end < 0) {
throw new IllegalArgumentException("Parameter end must not be negative.");
}
if (start... | [
"private",
"static",
"void",
"validateStartEnd",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"start",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter start must not be negative.\"",
")",
";",
"}",
"if",
"(",
... | Validates the given {@code start} and {@code end} positions.
@param start the start position to be validated
@param end the end position to be validated
@throws IllegalArgumentException if any of the conditions is true:
<ul>
<li>the {@code start} position is negative;</li>
<li>the {@code end} position is negative;</li... | [
"Validates",
"the",
"given",
"{",
"@code",
"start",
"}",
"and",
"{",
"@code",
"end",
"}",
"positions",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httppanel/view/util/HttpTextViewUtils.java#L145-L155 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java | ResourceUtil.getReader | public static BufferedReader getReader(String resurce, Charset charset) {
"""
从ClassPath资源中获取{@link BufferedReader}
@param resurce ClassPath资源
@param charset 编码
@return {@link InputStream}
@since 3.1.2
"""
return getResourceObj(resurce).getReader(charset);
} | java | public static BufferedReader getReader(String resurce, Charset charset) {
return getResourceObj(resurce).getReader(charset);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"String",
"resurce",
",",
"Charset",
"charset",
")",
"{",
"return",
"getResourceObj",
"(",
"resurce",
")",
".",
"getReader",
"(",
"charset",
")",
";",
"}"
] | 从ClassPath资源中获取{@link BufferedReader}
@param resurce ClassPath资源
@param charset 编码
@return {@link InputStream}
@since 3.1.2 | [
"从ClassPath资源中获取",
"{",
"@link",
"BufferedReader",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L87-L89 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.createOrUpdateMultiRolePoolAsync | public Observable<WorkerPoolResourceInner> createOrUpdateMultiRolePoolAsync(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
"""
Create or update a multi-role pool.
Create or update a multi-role pool.
@param resourceGroupName Name of the resource group to which the resour... | java | public Observable<WorkerPoolResourceInner> createOrUpdateMultiRolePoolAsync(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
return createOrUpdateMultiRolePoolWithServiceResponseAsync(resourceGroupName, name, multiRolePoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolR... | [
"public",
"Observable",
"<",
"WorkerPoolResourceInner",
">",
"createOrUpdateMultiRolePoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"WorkerPoolResourceInner",
"multiRolePoolEnvelope",
")",
"{",
"return",
"createOrUpdateMultiRolePoolWithServiceResponse... | Create or update a multi-role pool.
Create or update a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param multiRolePoolEnvelope Properties of the multi-role pool.
@throws IllegalArgumentException thrown if paramete... | [
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"pool",
".",
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L2302-L2309 |
Azure/azure-sdk-for-java | policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java | PolicySetDefinitionsInner.deleteAtManagementGroup | public void deleteAtManagementGroup(String policySetDefinitionName, String managementGroupId) {
"""
Deletes a policy set definition.
This operation deletes the policy set definition in the given management group with the given name.
@param policySetDefinitionName The name of the policy set definition to delete... | java | public void deleteAtManagementGroup(String policySetDefinitionName, String managementGroupId) {
deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body();
} | [
"public",
"void",
"deleteAtManagementGroup",
"(",
"String",
"policySetDefinitionName",
",",
"String",
"managementGroupId",
")",
"{",
"deleteAtManagementGroupWithServiceResponseAsync",
"(",
"policySetDefinitionName",
",",
"managementGroupId",
")",
".",
"toBlocking",
"(",
")",
... | Deletes a policy set definition.
This operation deletes the policy set definition in the given management group with the given name.
@param policySetDefinitionName The name of the policy set definition to delete.
@param managementGroupId The ID of the management group.
@throws IllegalArgumentException thrown if parame... | [
"Deletes",
"a",
"policy",
"set",
"definition",
".",
"This",
"operation",
"deletes",
"the",
"policy",
"set",
"definition",
"in",
"the",
"given",
"management",
"group",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java#L783-L785 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java | CopyManager.copyIn | public long copyIn(final String sql, Reader from) throws SQLException, IOException {
"""
Use COPY FROM STDIN for very fast copying from a Reader into a database table.
@param sql COPY FROM STDIN statement
@param from a CSV file or such
@return number of rows updated for server 8.2 or newer; -1 for older
@thr... | java | public long copyIn(final String sql, Reader from) throws SQLException, IOException {
return copyIn(sql, from, DEFAULT_BUFFER_SIZE);
} | [
"public",
"long",
"copyIn",
"(",
"final",
"String",
"sql",
",",
"Reader",
"from",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"return",
"copyIn",
"(",
"sql",
",",
"from",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | Use COPY FROM STDIN for very fast copying from a Reader into a database table.
@param sql COPY FROM STDIN statement
@param from a CSV file or such
@return number of rows updated for server 8.2 or newer; -1 for older
@throws SQLException on database usage issues
@throws IOException upon reader or database connection fa... | [
"Use",
"COPY",
"FROM",
"STDIN",
"for",
"very",
"fast",
"copying",
"from",
"a",
"Reader",
"into",
"a",
"database",
"table",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java#L155-L157 |
js-lib-com/commons | src/main/java/js/util/Files.java | Files.renameTo | public static void renameTo(File source, File destination) throws IOException {
"""
Thin wrapper for {@link File#renameTo(File)} throwing exception on fail. This method ensures destination file
parent directories exist. If destination file already exist its content is silently overwritten.
<p>
Warning: if desti... | java | public static void renameTo(File source, File destination) throws IOException
{
mkdirs(destination);
// excerpt from File.renameTo API:
// ... and it (n.b. File.renameTo) might not succeed if a file with the destination abstract pathname already exists
//
// so ensure destination does not ... | [
"public",
"static",
"void",
"renameTo",
"(",
"File",
"source",
",",
"File",
"destination",
")",
"throws",
"IOException",
"{",
"mkdirs",
"(",
"destination",
")",
";",
"// excerpt from File.renameTo API:\r",
"// ... and it (n.b. File.renameTo) might not succeed if a file with t... | Thin wrapper for {@link File#renameTo(File)} throwing exception on fail. This method ensures destination file
parent directories exist. If destination file already exist its content is silently overwritten.
<p>
Warning: if destination file exists, it is overwritten and its old content lost.
@param source source file,
... | [
"Thin",
"wrapper",
"for",
"{",
"@link",
"File#renameTo",
"(",
"File",
")",
"}",
"throwing",
"exception",
"on",
"fail",
".",
"This",
"method",
"ensures",
"destination",
"file",
"parent",
"directories",
"exist",
".",
"If",
"destination",
"file",
"already",
"exis... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Files.java#L492-L505 |
joinfaces/joinfaces | joinfaces-tools/joinfaces-scan-tools/src/main/java/org/joinfaces/tools/ScanResultHandler.java | ScanResultHandler.writeClassMap | protected void writeClassMap(File file, Map<String, ? extends Collection<String>> classMap) throws IOException {
"""
Helper method which writes a map of class names to the given file.
@param file The target file in which the class names should be written.
@param classMap The class names which should be wri... | java | protected void writeClassMap(File file, Map<String, ? extends Collection<String>> classMap) throws IOException {
File baseDir = file.getParentFile();
if (baseDir.isDirectory() || baseDir.mkdirs()) {
//noinspection CharsetObjectCanBeUsed
try (PrintWriter printWriter = new PrintWriter(file, "UTF-8")) {
cla... | [
"protected",
"void",
"writeClassMap",
"(",
"File",
"file",
",",
"Map",
"<",
"String",
",",
"?",
"extends",
"Collection",
"<",
"String",
">",
">",
"classMap",
")",
"throws",
"IOException",
"{",
"File",
"baseDir",
"=",
"file",
".",
"getParentFile",
"(",
")",... | Helper method which writes a map of class names to the given file.
@param file The target file in which the class names should be written.
@param classMap The class names which should be written in the target file.
@throws IOException when the class names could not be written to the target file. | [
"Helper",
"method",
"which",
"writes",
"a",
"map",
"of",
"class",
"names",
"to",
"the",
"given",
"file",
"."
] | train | https://github.com/joinfaces/joinfaces/blob/c9fc811a9eaf695820951f2c04715297dd1e6d66/joinfaces-tools/joinfaces-scan-tools/src/main/java/org/joinfaces/tools/ScanResultHandler.java#L76-L93 |
cdk/cdk | storage/io/src/main/java/org/openscience/cdk/io/cml/CMLErrorHandler.java | CMLErrorHandler.print | private void print(String level, SAXParseException exception) {
"""
Internal procedure that outputs an SAXParseException with a significance level
to the cdk.tools.LoggingTool logger.
@param level significance level
@param exception Exception to output
"""
if (level.equals("warning")) {
... | java | private void print(String level, SAXParseException exception) {
if (level.equals("warning")) {
logger.warn("** " + level + ": " + exception.getMessage());
logger.warn(" URI = " + exception.getSystemId());
logger.warn(" line = " + exception.getLineNumber());
} els... | [
"private",
"void",
"print",
"(",
"String",
"level",
",",
"SAXParseException",
"exception",
")",
"{",
"if",
"(",
"level",
".",
"equals",
"(",
"\"warning\"",
")",
")",
"{",
"logger",
".",
"warn",
"(",
"\"** \"",
"+",
"level",
"+",
"\": \"",
"+",
"exception... | Internal procedure that outputs an SAXParseException with a significance level
to the cdk.tools.LoggingTool logger.
@param level significance level
@param exception Exception to output | [
"Internal",
"procedure",
"that",
"outputs",
"an",
"SAXParseException",
"with",
"a",
"significance",
"level",
"to",
"the",
"cdk",
".",
"tools",
".",
"LoggingTool",
"logger",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLErrorHandler.java#L63-L73 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | MetadataGenerationEnvironment.getFieldDefaultValue | public Object getFieldDefaultValue(TypeElement type, String name) {
"""
Return the default value of the field with the specified {@code name}.
@param type the type to consider
@param name the name of the field
@return the default value or {@code null} if the field does not exist or no default
value has been de... | java | public Object getFieldDefaultValue(TypeElement type, String name) {
return this.defaultValues.computeIfAbsent(type, this::resolveFieldValues)
.get(name);
} | [
"public",
"Object",
"getFieldDefaultValue",
"(",
"TypeElement",
"type",
",",
"String",
"name",
")",
"{",
"return",
"this",
".",
"defaultValues",
".",
"computeIfAbsent",
"(",
"type",
",",
"this",
"::",
"resolveFieldValues",
")",
".",
"get",
"(",
"name",
")",
... | Return the default value of the field with the specified {@code name}.
@param type the type to consider
@param name the name of the field
@return the default value or {@code null} if the field does not exist or no default
value has been detected | [
"Return",
"the",
"default",
"value",
"of",
"the",
"field",
"with",
"the",
"specified",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java#L136-L139 |
alkacon/opencms-core | src/org/opencms/cache/CmsVfsMemoryObjectCache.java | CmsVfsMemoryObjectCache.getCacheKeyForCurrentProject | private String getCacheKeyForCurrentProject(CmsObject cms, String rootPath) {
"""
Returns a cache key for the given root path based on the status
of the given CmsObject.<p>
@param cms the cms context
@param rootPath the filename to get the cache key for
@return the cache key for the system id
"""
... | java | private String getCacheKeyForCurrentProject(CmsObject cms, String rootPath) {
// check the project
boolean project = (cms != null) ? cms.getRequestContext().getCurrentProject().isOnlineProject() : false;
return getCacheKey(rootPath, project);
} | [
"private",
"String",
"getCacheKeyForCurrentProject",
"(",
"CmsObject",
"cms",
",",
"String",
"rootPath",
")",
"{",
"// check the project",
"boolean",
"project",
"=",
"(",
"cms",
"!=",
"null",
")",
"?",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentP... | Returns a cache key for the given root path based on the status
of the given CmsObject.<p>
@param cms the cms context
@param rootPath the filename to get the cache key for
@return the cache key for the system id | [
"Returns",
"a",
"cache",
"key",
"for",
"the",
"given",
"root",
"path",
"based",
"on",
"the",
"status",
"of",
"the",
"given",
"CmsObject",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsMemoryObjectCache.java#L172-L177 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CasVersion.java | CasVersion.getDateTime | @SneakyThrows
public static ZonedDateTime getDateTime() {
"""
Gets last modified date/time for the module.
@return the date/time
"""
val clazz = CasVersion.class;
val resource = clazz.getResource(clazz.getSimpleName() + ".class");
if ("file".equals(resource.getProtocol())) {
... | java | @SneakyThrows
public static ZonedDateTime getDateTime() {
val clazz = CasVersion.class;
val resource = clazz.getResource(clazz.getSimpleName() + ".class");
if ("file".equals(resource.getProtocol())) {
return DateTimeUtils.zonedDateTimeOf(new File(resource.toURI()).lastModified())... | [
"@",
"SneakyThrows",
"public",
"static",
"ZonedDateTime",
"getDateTime",
"(",
")",
"{",
"val",
"clazz",
"=",
"CasVersion",
".",
"class",
";",
"val",
"resource",
"=",
"clazz",
".",
"getResource",
"(",
"clazz",
".",
"getSimpleName",
"(",
")",
"+",
"\".class\""... | Gets last modified date/time for the module.
@return the date/time | [
"Gets",
"last",
"modified",
"date",
"/",
"time",
"for",
"the",
"module",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CasVersion.java#L57-L75 |
ltearno/hexa.tools | hexa.core/src/main/java/fr/lteconsulting/hexa/client/form/FormManager.java | FormManager.addGroup | public Object addGroup( String display, String name, Object parent ) {
"""
/*
HashMap<FieldInfo,HTMLStream> fieldCommentsSlots = new HashMap<FieldInfo,
HTMLStream>(); public AcceptsOneWidget addCommentSlot( Object field ) {
FieldInfo info = (FieldInfo)field;
HTMLStream stream = fieldCommentsSlots.get( info )... | java | public Object addGroup( String display, String name, Object parent )
{
int row = display != null ? table.getRowCount() : -1;
// create the new group
GroupInfo parentInfo = (GroupInfo) parent;
GroupInfo info = new GroupInfo( name, parentInfo, row );
// display the new group
if( display != null && row >= 0... | [
"public",
"Object",
"addGroup",
"(",
"String",
"display",
",",
"String",
"name",
",",
"Object",
"parent",
")",
"{",
"int",
"row",
"=",
"display",
"!=",
"null",
"?",
"table",
".",
"getRowCount",
"(",
")",
":",
"-",
"1",
";",
"// create the new group",
"Gr... | /*
HashMap<FieldInfo,HTMLStream> fieldCommentsSlots = new HashMap<FieldInfo,
HTMLStream>(); public AcceptsOneWidget addCommentSlot( Object field ) {
FieldInfo info = (FieldInfo)field;
HTMLStream stream = fieldCommentsSlots.get( info ); if( stream == null )
{ stream = new HTMLStream(); fieldCommentsSlots.put( info, str... | [
"/",
"*",
"HashMap<FieldInfo",
"HTMLStream",
">",
"fieldCommentsSlots",
"=",
"new",
"HashMap<FieldInfo",
"HTMLStream",
">",
"()",
";",
"public",
"AcceptsOneWidget",
"addCommentSlot",
"(",
"Object",
"field",
")",
"{",
"FieldInfo",
"info",
"=",
"(",
"FieldInfo",
")"... | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/form/FormManager.java#L296-L316 |
Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java | DiscordApiImpl.getKnownCustomEmojiOrCreateCustomEmoji | public CustomEmoji getKnownCustomEmojiOrCreateCustomEmoji(JsonNode data) {
"""
Gets a known custom emoji or creates a new (unknown) custom emoji object.
@param data The data of the emoji.
@return The emoji for the given json object.
"""
long id = Long.parseLong(data.get("id").asText());
Cus... | java | public CustomEmoji getKnownCustomEmojiOrCreateCustomEmoji(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
CustomEmoji emoji = customEmojis.get(id);
return emoji == null ? new CustomEmojiImpl(this, data) : emoji;
} | [
"public",
"CustomEmoji",
"getKnownCustomEmojiOrCreateCustomEmoji",
"(",
"JsonNode",
"data",
")",
"{",
"long",
"id",
"=",
"Long",
".",
"parseLong",
"(",
"data",
".",
"get",
"(",
"\"id\"",
")",
".",
"asText",
"(",
")",
")",
";",
"CustomEmoji",
"emoji",
"=",
... | Gets a known custom emoji or creates a new (unknown) custom emoji object.
@param data The data of the emoji.
@return The emoji for the given json object. | [
"Gets",
"a",
"known",
"custom",
"emoji",
"or",
"creates",
"a",
"new",
"(",
"unknown",
")",
"custom",
"emoji",
"object",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java#L824-L828 |
twilio/twilio-java | src/main/java/com/twilio/http/Request.java | Request.getAuthString | public String getAuthString() {
"""
Create auth string from username and password.
@return basic authentication string
"""
String credentials = this.username + ":" + this.password;
try {
String encoded = new Base64().encodeAsString(credentials.getBytes("ascii"));
ret... | java | public String getAuthString() {
String credentials = this.username + ":" + this.password;
try {
String encoded = new Base64().encodeAsString(credentials.getBytes("ascii"));
return "Basic " + encoded;
} catch (final UnsupportedEncodingException e) {
throw ne... | [
"public",
"String",
"getAuthString",
"(",
")",
"{",
"String",
"credentials",
"=",
"this",
".",
"username",
"+",
"\":\"",
"+",
"this",
".",
"password",
";",
"try",
"{",
"String",
"encoded",
"=",
"new",
"Base64",
"(",
")",
".",
"encodeAsString",
"(",
"cred... | Create auth string from username and password.
@return basic authentication string | [
"Create",
"auth",
"string",
"from",
"username",
"and",
"password",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/http/Request.java#L97-L109 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java | JacksonUtils.asValue | public static <T> T asValue(JsonNode node, Class<T> clazz) {
"""
Extract value from a {@link JsonNode}.
@param node
@param clazz
@return
"""
return node != null ? ValueUtils.convertValue(node, clazz) : null;
} | java | public static <T> T asValue(JsonNode node, Class<T> clazz) {
return node != null ? ValueUtils.convertValue(node, clazz) : null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"asValue",
"(",
"JsonNode",
"node",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"node",
"!=",
"null",
"?",
"ValueUtils",
".",
"convertValue",
"(",
"node",
",",
"clazz",
")",
":",
"null",
";",
"}... | Extract value from a {@link JsonNode}.
@param node
@param clazz
@return | [
"Extract",
"value",
"from",
"a",
"{",
"@link",
"JsonNode",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L191-L193 |
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.addCustomPrebuiltDomainAsync | public Observable<List<UUID>> addCustomPrebuiltDomainAsync(UUID appId, String versionId, AddCustomPrebuiltDomainModelsOptionalParameter addCustomPrebuiltDomainOptionalParameter) {
"""
Adds a customizable prebuilt domain along with all of its models to this application.
@param appId The application ID.
@param v... | java | public Observable<List<UUID>> addCustomPrebuiltDomainAsync(UUID appId, String versionId, AddCustomPrebuiltDomainModelsOptionalParameter addCustomPrebuiltDomainOptionalParameter) {
return addCustomPrebuiltDomainWithServiceResponseAsync(appId, versionId, addCustomPrebuiltDomainOptionalParameter).map(new Func1<Ser... | [
"public",
"Observable",
"<",
"List",
"<",
"UUID",
">",
">",
"addCustomPrebuiltDomainAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"AddCustomPrebuiltDomainModelsOptionalParameter",
"addCustomPrebuiltDomainOptionalParameter",
")",
"{",
"return",
"addCustomPre... | Adds a customizable prebuilt domain along with all of its models to this application.
@param appId The application ID.
@param versionId The version ID.
@param addCustomPrebuiltDomainOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thro... | [
"Adds",
"a",
"customizable",
"prebuilt",
"domain",
"along",
"with",
"all",
"of",
"its",
"models",
"to",
"this",
"application",
"."
] | 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#L5570-L5577 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/helpers/JournalHelper.java | JournalHelper.createInstanceAccordingToParameter | public static Object createInstanceAccordingToParameter(String parameterName,
Class<?>[] argClasses,
Object[] args,
Map<String, String> para... | java | public static Object createInstanceAccordingToParameter(String parameterName,
Class<?>[] argClasses,
Object[] args,
Map<String, String> para... | [
"public",
"static",
"Object",
"createInstanceAccordingToParameter",
"(",
"String",
"parameterName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argClasses",
",",
"Object",
"[",
"]",
"args",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"throw... | Look in the system parameters and create an instance of the named class.
@param parameterName
The name of the system parameter that contains the classname
@param argClasses
What types of arguments are required by the constructor?
@param args
Arguments to provide to the instance constructor.
@param parameters
The syste... | [
"Look",
"in",
"the",
"system",
"parameters",
"and",
"create",
"an",
"instance",
"of",
"the",
"named",
"class",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/helpers/JournalHelper.java#L92-L102 |
amzn/ion-java | src/com/amazon/ion/impl/IonBinary.java | IonBinary.unsignedLongToBigInteger | public static BigInteger unsignedLongToBigInteger(int signum, long val) {
"""
Utility method to convert an unsigned magnitude stored as a long to a {@link BigInteger}.
"""
byte[] magnitude = {
(byte) ((val >> 56) & 0xFF),
(byte) ((val >> 48) & 0xFF),
(byte) ((val >> ... | java | public static BigInteger unsignedLongToBigInteger(int signum, long val)
{
byte[] magnitude = {
(byte) ((val >> 56) & 0xFF),
(byte) ((val >> 48) & 0xFF),
(byte) ((val >> 40) & 0xFF),
(byte) ((val >> 32) & 0xFF),
(byte) ((val >> 24) & 0xFF),
... | [
"public",
"static",
"BigInteger",
"unsignedLongToBigInteger",
"(",
"int",
"signum",
",",
"long",
"val",
")",
"{",
"byte",
"[",
"]",
"magnitude",
"=",
"{",
"(",
"byte",
")",
"(",
"(",
"val",
">>",
"56",
")",
"&",
"0xFF",
")",
",",
"(",
"byte",
")",
... | Utility method to convert an unsigned magnitude stored as a long to a {@link BigInteger}. | [
"Utility",
"method",
"to",
"convert",
"an",
"unsigned",
"magnitude",
"stored",
"as",
"a",
"long",
"to",
"a",
"{"
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonBinary.java#L897-L910 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java | AbstractCodeGen.writeLeftCurlyBracket | void writeLeftCurlyBracket(Writer out, int indent) throws IOException {
"""
Output left curly bracket
@param out Writer
@param indent space number
@throws IOException ioException
"""
writeEol(out);
writeWithIndent(out, indent, "{\n");
} | java | void writeLeftCurlyBracket(Writer out, int indent) throws IOException
{
writeEol(out);
writeWithIndent(out, indent, "{\n");
} | [
"void",
"writeLeftCurlyBracket",
"(",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"writeEol",
"(",
"out",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"{\\n\"",
")",
";",
"}"
] | Output left curly bracket
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"left",
"curly",
"bracket"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L189-L193 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java | ConfigValueHelper.checkNormalWithColon | protected static void checkNormalWithColon(String configKey, String configValue) throws SofaRpcRuntimeException {
"""
检查字符串是否是正常值(含冒号),不是则抛出异常
@param configKey 配置项
@param configValue 配置值
@throws SofaRpcRuntimeException 非法异常
"""
checkPattern(configKey, configValue, NORMAL_COLON, "only allow a-zA-... | java | protected static void checkNormalWithColon(String configKey, String configValue) throws SofaRpcRuntimeException {
checkPattern(configKey, configValue, NORMAL_COLON, "only allow a-zA-Z0-9 '-' '_' '.' ':'");
} | [
"protected",
"static",
"void",
"checkNormalWithColon",
"(",
"String",
"configKey",
",",
"String",
"configValue",
")",
"throws",
"SofaRpcRuntimeException",
"{",
"checkPattern",
"(",
"configKey",
",",
"configValue",
",",
"NORMAL_COLON",
",",
"\"only allow a-zA-Z0-9 '-' '_' ... | 检查字符串是否是正常值(含冒号),不是则抛出异常
@param configKey 配置项
@param configValue 配置值
@throws SofaRpcRuntimeException 非法异常 | [
"检查字符串是否是正常值(含冒号),不是则抛出异常"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java#L119-L121 |
phax/ph-commons | ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java | PDTHelper.getStartWeekOfMonth | public static int getStartWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale) {
"""
Get the start--week number for the passed year and month.
@param aDT
The object to use year and month from.
@param aLocale
Locale to use. May not be <code>null</code>.
@return the start week number.... | java | public static int getStartWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale)
{
return getWeekOfWeekBasedYear (aDT.withDayOfMonth (1), aLocale);
} | [
"public",
"static",
"int",
"getStartWeekOfMonth",
"(",
"@",
"Nonnull",
"final",
"LocalDateTime",
"aDT",
",",
"@",
"Nonnull",
"final",
"Locale",
"aLocale",
")",
"{",
"return",
"getWeekOfWeekBasedYear",
"(",
"aDT",
".",
"withDayOfMonth",
"(",
"1",
")",
",",
"aLo... | Get the start--week number for the passed year and month.
@param aDT
The object to use year and month from.
@param aLocale
Locale to use. May not be <code>null</code>.
@return the start week number. | [
"Get",
"the",
"start",
"--",
"week",
"number",
"for",
"the",
"passed",
"year",
"and",
"month",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L207-L210 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/ProductHandler.java | ProductHandler.setProductModules | public void setProductModules(final String name, final List<String> moduleNames) {
"""
Patches the product module names
@param name String
@param moduleNames List<String>
"""
final DbProduct dbProduct = getProduct(name);
dbProduct.setModules(moduleNames);
repositoryHandler.store(dbP... | java | public void setProductModules(final String name, final List<String> moduleNames) {
final DbProduct dbProduct = getProduct(name);
dbProduct.setModules(moduleNames);
repositoryHandler.store(dbProduct);
} | [
"public",
"void",
"setProductModules",
"(",
"final",
"String",
"name",
",",
"final",
"List",
"<",
"String",
">",
"moduleNames",
")",
"{",
"final",
"DbProduct",
"dbProduct",
"=",
"getProduct",
"(",
"name",
")",
";",
"dbProduct",
".",
"setModules",
"(",
"modul... | Patches the product module names
@param name String
@param moduleNames List<String> | [
"Patches",
"the",
"product",
"module",
"names"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ProductHandler.java#L90-L94 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/AmbiguousOptionException.java | AmbiguousOptionException.createMessage | private static String createMessage(String option, Collection<String> matchingOptions) {
"""
Build the exception message from the specified list of options.
@param option
@param matchingOptions
@return
"""
StringBuilder buf = new StringBuilder("Ambiguous option: '");
buf.append(option);
... | java | private static String createMessage(String option, Collection<String> matchingOptions)
{
StringBuilder buf = new StringBuilder("Ambiguous option: '");
buf.append(option);
buf.append("' (could be: ");
Iterator<String> it = matchingOptions.iterator();
while (it.hasNext())
... | [
"private",
"static",
"String",
"createMessage",
"(",
"String",
"option",
",",
"Collection",
"<",
"String",
">",
"matchingOptions",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"\"Ambiguous option: '\"",
")",
";",
"buf",
".",
"append",
"(",... | Build the exception message from the specified list of options.
@param option
@param matchingOptions
@return | [
"Build",
"the",
"exception",
"message",
"from",
"the",
"specified",
"list",
"of",
"options",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/AmbiguousOptionException.java#L67-L87 |
eclipse/xtext-core | org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java | XtextSemanticSequencer.sequence_Negation | protected void sequence_Negation(ISerializationContext context, Negation semanticObject) {
"""
Contexts:
Disjunction returns Negation
Disjunction.Disjunction_1_0 returns Negation
Conjunction returns Negation
Conjunction.Conjunction_1_0 returns Negation
Negation returns Negation
Atom returns Negation
Parenth... | java | protected void sequence_Negation(ISerializationContext context, Negation semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.NEGATION__VALUE) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticOb... | [
"protected",
"void",
"sequence_Negation",
"(",
"ISerializationContext",
"context",
",",
"Negation",
"semanticObject",
")",
"{",
"if",
"(",
"errorAcceptor",
"!=",
"null",
")",
"{",
"if",
"(",
"transientValues",
".",
"isValueTransient",
"(",
"semanticObject",
",",
"... | Contexts:
Disjunction returns Negation
Disjunction.Disjunction_1_0 returns Negation
Conjunction returns Negation
Conjunction.Conjunction_1_0 returns Negation
Negation returns Negation
Atom returns Negation
ParenthesizedCondition returns Negation
Constraint:
value=Negation | [
"Contexts",
":",
"Disjunction",
"returns",
"Negation",
"Disjunction",
".",
"Disjunction_1_0",
"returns",
"Negation",
"Conjunction",
"returns",
"Negation",
"Conjunction",
".",
"Conjunction_1_0",
"returns",
"Negation",
"Negation",
"returns",
"Negation",
"Atom",
"returns",
... | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java#L954-L962 |
intellimate/Izou | src/main/java/org/intellimate/izou/resource/ResourceManager.java | ResourceManager.generateResources | public List<ResourceModel> generateResources(EventModel<?> event) {
"""
generates all the resources for an event
@param event the Event to generate the resources for
@return a List containing all the generated resources
"""
if(!event.getAllInformations().stream()
.anyMatch(eventSubscr... | java | public List<ResourceModel> generateResources(EventModel<?> event) {
if(!event.getAllInformations().stream()
.anyMatch(eventSubscribers::containsKey)) return new LinkedList<>();
List<ResourceBuilderModel> resourceBuilders = event.getAllInformations().stream()
.map(eventSu... | [
"public",
"List",
"<",
"ResourceModel",
">",
"generateResources",
"(",
"EventModel",
"<",
"?",
">",
"event",
")",
"{",
"if",
"(",
"!",
"event",
".",
"getAllInformations",
"(",
")",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"eventSubscribers",
"::",
... | generates all the resources for an event
@param event the Event to generate the resources for
@return a List containing all the generated resources | [
"generates",
"all",
"the",
"resources",
"for",
"an",
"event"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/resource/ResourceManager.java#L40-L52 |
jbundle/webapp | upload/src/main/java/org/jbundle/util/webapp/upload/UploadServlet.java | UploadServlet.sendForm | public void sendForm(HttpServletRequest req, HttpServletResponse res, String strReceiveMessage, Properties properties)
throws ServletException, IOException {
"""
Process an HTML get or post.
@exception ServletException From inherited class.
@exception IOException From inherited class.
"""
res.setCo... | java | public void sendForm(HttpServletRequest req, HttpServletResponse res, String strReceiveMessage, Properties properties)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.write("<html>" + RETURN +
"<head>" + RETURN +
"<title>" +... | [
"public",
"void",
"sendForm",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"String",
"strReceiveMessage",
",",
"Properties",
"properties",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"res",
".",
"setContentType",
"(",
"\"... | Process an HTML get or post.
@exception ServletException From inherited class.
@exception IOException From inherited class. | [
"Process",
"an",
"HTML",
"get",
"or",
"post",
"."
] | train | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/upload/src/main/java/org/jbundle/util/webapp/upload/UploadServlet.java#L167-L207 |
FaritorKang/unmz-common-util | src/main/java/net/unmz/java/util/json/JsonUtils.java | JsonUtils.toBean | public static <T> T toBean(String text, Class<T> clazz) {
"""
指定泛型,JSON串转对象
@param text JSON串
@param clazz 对象类型
@param <T> 对象泛型
@return 转换得到的对象
"""
return JSON.parseObject(text, clazz);
} | java | public static <T> T toBean(String text, Class<T> clazz) {
return JSON.parseObject(text, clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"toBean",
"(",
"String",
"text",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"JSON",
".",
"parseObject",
"(",
"text",
",",
"clazz",
")",
";",
"}"
] | 指定泛型,JSON串转对象
@param text JSON串
@param clazz 对象类型
@param <T> 对象泛型
@return 转换得到的对象 | [
"指定泛型,JSON串转对象"
] | train | https://github.com/FaritorKang/unmz-common-util/blob/2912b8889b85ed910d536f85b24b6fa68035814a/src/main/java/net/unmz/java/util/json/JsonUtils.java#L77-L79 |
kennycason/kumo | kumo-core/src/main/java/com/kennycason/kumo/ParallelLayeredWordCloud.java | ParallelLayeredWordCloud.build | @Override
public void build(final int layer, final List<WordFrequency> wordFrequencies) {
"""
constructs the wordcloud specified by layer using the given
wordfrequencies.<br>
This is a non-blocking call.
@param layer
Wordcloud Layer
@param wordFrequencies
the WordFrequencies to use as input
"""
... | java | @Override
public void build(final int layer, final List<WordFrequency> wordFrequencies) {
final Future<?> completionFuture = executorservice.submit(() -> {
LOGGER.info("Starting to build WordCloud Layer {} in new Thread", layer);
super.build(layer, wordFrequencies);
});
... | [
"@",
"Override",
"public",
"void",
"build",
"(",
"final",
"int",
"layer",
",",
"final",
"List",
"<",
"WordFrequency",
">",
"wordFrequencies",
")",
"{",
"final",
"Future",
"<",
"?",
">",
"completionFuture",
"=",
"executorservice",
".",
"submit",
"(",
"(",
"... | constructs the wordcloud specified by layer using the given
wordfrequencies.<br>
This is a non-blocking call.
@param layer
Wordcloud Layer
@param wordFrequencies
the WordFrequencies to use as input | [
"constructs",
"the",
"wordcloud",
"specified",
"by",
"layer",
"using",
"the",
"given",
"wordfrequencies",
".",
"<br",
">",
"This",
"is",
"a",
"non",
"-",
"blocking",
"call",
"."
] | train | https://github.com/kennycason/kumo/blob/bc577f468f162dbaf61c327a2d4f1989c61c57a0/kumo-core/src/main/java/com/kennycason/kumo/ParallelLayeredWordCloud.java#L40-L48 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/sjavac/server/JavacServer.java | JavacServer.connectGetSysInfo | public static SysInfo connectGetSysInfo(String serverSettings, PrintStream out, PrintStream err) {
"""
Make a request to the server only to get the maximum possible heap size to use for compilations.
@param port_file The port file used to synchronize creation of this server.
@param id The identify of the compi... | java | public static SysInfo connectGetSysInfo(String serverSettings, PrintStream out, PrintStream err) {
SysInfo sysinfo = new SysInfo(-1, -1);
String id = Util.extractStringOption("id", serverSettings);
String portfile = Util.extractStringOption("portfile", serverSettings);
try {
... | [
"public",
"static",
"SysInfo",
"connectGetSysInfo",
"(",
"String",
"serverSettings",
",",
"PrintStream",
"out",
",",
"PrintStream",
"err",
")",
"{",
"SysInfo",
"sysinfo",
"=",
"new",
"SysInfo",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"String",
"id",
"=",
... | Make a request to the server only to get the maximum possible heap size to use for compilations.
@param port_file The port file used to synchronize creation of this server.
@param id The identify of the compilation.
@param out Standard out information.
@param err Standard err information.
@return The maximum heap size... | [
"Make",
"a",
"request",
"to",
"the",
"server",
"only",
"to",
"get",
"the",
"maximum",
"possible",
"heap",
"size",
"to",
"use",
"for",
"compilations",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java#L432-L450 |
shrinkwrap/resolver | maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenManagerBuilder.java | MavenManagerBuilder.artifactTypeRegistry | public ArtifactTypeRegistry artifactTypeRegistry() {
"""
Returns artifact type registry. Defines standard Maven stereotypes.
@return
"""
DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
stereotypes.add(new DefaultArtifactType("pom"));
stereotypes.add(new D... | java | public ArtifactTypeRegistry artifactTypeRegistry() {
DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
stereotypes.add(new DefaultArtifactType("pom"));
stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java"));
stereotypes.add(new DefaultArtif... | [
"public",
"ArtifactTypeRegistry",
"artifactTypeRegistry",
"(",
")",
"{",
"DefaultArtifactTypeRegistry",
"stereotypes",
"=",
"new",
"DefaultArtifactTypeRegistry",
"(",
")",
";",
"stereotypes",
".",
"add",
"(",
"new",
"DefaultArtifactType",
"(",
"\"pom\"",
")",
")",
";"... | Returns artifact type registry. Defines standard Maven stereotypes.
@return | [
"Returns",
"artifact",
"type",
"registry",
".",
"Defines",
"standard",
"Maven",
"stereotypes",
"."
] | train | https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenManagerBuilder.java#L223-L238 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java | ShapeGenerator.createProgressBarIndeterminatePattern | public Shape createProgressBarIndeterminatePattern(int x, int y, int w, int h) {
"""
Return a path for the patterned portion of an indeterminate progress bar.
@param x the X coordinate of the upper-left corner of the region
@param y the Y coordinate of the upper-left corner of the region
@param w the width... | java | public Shape createProgressBarIndeterminatePattern(int x, int y, int w, int h) {
final double wHalf = w / 2.0;
final double xOffset = 5;
path.reset();
path.moveTo(xOffset, 0);
path.lineTo(xOffset+wHalf, 0);
path.curveTo(xOffset+wHalf-5, h/2-4, xOffset+wHalf+5, h/2+4, xOffset+wHalf,... | [
"public",
"Shape",
"createProgressBarIndeterminatePattern",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"final",
"double",
"wHalf",
"=",
"w",
"/",
"2.0",
";",
"final",
"double",
"xOffset",
"=",
"5",
";",
"path",
".",
... | Return a path for the patterned portion of an indeterminate progress bar.
@param x the X coordinate of the upper-left corner of the region
@param y the Y coordinate of the upper-left corner of the region
@param w the width of the region
@param h the height of the region
@return a path representing the shape. | [
"Return",
"a",
"path",
"for",
"the",
"patterned",
"portion",
"of",
"an",
"indeterminate",
"progress",
"bar",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L384-L396 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notNull | public static <T> T notNull (final T aValue, @Nonnull final Supplier <? extends String> aName) {
"""
Check that the passed value is not <code>null</code>.
@param <T>
Type to be checked and returned
@param aValue
The value to check.
@param aName
The name of the value (e.g. the parameter name)
@return The p... | java | public static <T> T notNull (final T aValue, @Nonnull final Supplier <? extends String> aName)
{
if (isEnabled ())
if (aValue == null)
throw new NullPointerException ("The value of '" + aName.get () + "' may not be null!");
return aValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"notNull",
"(",
"final",
"T",
"aValue",
",",
"@",
"Nonnull",
"final",
"Supplier",
"<",
"?",
"extends",
"String",
">",
"aName",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"if",
"(",
"aValue",
"==",
"null... | Check that the passed value is not <code>null</code>.
@param <T>
Type to be checked and returned
@param aValue
The value to check.
@param aName
The name of the value (e.g. the parameter name)
@return The passed value.
@throws NullPointerException
if the passed value is <code>null</code>. | [
"Check",
"that",
"the",
"passed",
"value",
"is",
"not",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L294-L300 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalOutputStream.java | BookKeeperJournalOutputStream.addBookKeeperEntry | private synchronized void addBookKeeperEntry(byte[] buf, int off, int len)
throws IOException {
"""
Write the buffer to a new entry in a BookKeeper ledger or throw
an IOException if we are unable to successfully write to a quorum
of bookies
@param buf Buffer to write from
@param off Offset in the buffer
... | java | private synchronized void addBookKeeperEntry(byte[] buf, int off, int len)
throws IOException {
try {
ledger.addEntry(buf, off, len);
if (LOG.isDebugEnabled()) {
LOG.debug("Last add pushed to ledger " + ledger.getId() + " is " +
ledger.getLastAddPushed());
LOG.debug("La... | [
"private",
"synchronized",
"void",
"addBookKeeperEntry",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"try",
"{",
"ledger",
".",
"addEntry",
"(",
"buf",
",",
"off",
",",
"len",
")",
";",
"if",
... | Write the buffer to a new entry in a BookKeeper ledger or throw
an IOException if we are unable to successfully write to a quorum
of bookies
@param buf Buffer to write from
@param off Offset in the buffer
@param len How many bytes to write, starting the offset
@throws IOException If we are interrupted while writing to ... | [
"Write",
"the",
"buffer",
"to",
"a",
"new",
"entry",
"in",
"a",
"BookKeeper",
"ledger",
"or",
"throw",
"an",
"IOException",
"if",
"we",
"are",
"unable",
"to",
"successfully",
"write",
"to",
"a",
"quorum",
"of",
"bookies"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalOutputStream.java#L69-L85 |
dimaki/refuel | src/main/java/de/dimaki/refuel/Bootstrap.java | Bootstrap.startApp | public void startApp(Path applicationFile, String applicationClass, String methodName) throws IOException {
"""
Start the application
@param applicationFile The application file (e.g. a JAR)
@param applicationClass The application class (e.g. "de.dimaki.jartest.JarTest")
@param methodName The method to be calle... | java | public void startApp(Path applicationFile, String applicationClass, String methodName) throws IOException {
try {
System.out.println("Loading : " + applicationFile.toAbsolutePath().toString());
this.defaultClassLoader = Thread.currentThread().getContextClassLoader();
this.app... | [
"public",
"void",
"startApp",
"(",
"Path",
"applicationFile",
",",
"String",
"applicationClass",
",",
"String",
"methodName",
")",
"throws",
"IOException",
"{",
"try",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Loading : \"",
"+",
"applicationFile",
".",... | Start the application
@param applicationFile The application file (e.g. a JAR)
@param applicationClass The application class (e.g. "de.dimaki.jartest.JarTest")
@param methodName The method to be called (e.g. "start")
@throws IOException In case of an error | [
"Start",
"the",
"application"
] | train | https://github.com/dimaki/refuel/blob/8024ac34f52b33de291d859c3b12fc237783f873/src/main/java/de/dimaki/refuel/Bootstrap.java#L83-L96 |
bwkimmel/jdcp | jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java | FileClassManager.writeClass | private void writeClass(File directory, String name, ByteBuffer def) {
"""
Writes a class definition.
@param directory The directory under which to write the class
definition.
@param name The fully qualified name of the class.
@param def A <code>ByteBuffer</code> containing the class definition.
"""
wr... | java | private void writeClass(File directory, String name, ByteBuffer def) {
writeClass(directory, name, def, computeClassDigest(def));
} | [
"private",
"void",
"writeClass",
"(",
"File",
"directory",
",",
"String",
"name",
",",
"ByteBuffer",
"def",
")",
"{",
"writeClass",
"(",
"directory",
",",
"name",
",",
"def",
",",
"computeClassDigest",
"(",
"def",
")",
")",
";",
"}"
] | Writes a class definition.
@param directory The directory under which to write the class
definition.
@param name The fully qualified name of the class.
@param def A <code>ByteBuffer</code> containing the class definition. | [
"Writes",
"a",
"class",
"definition",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L166-L168 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateProjectHeader | private void populateProjectHeader(Record record, ProjectProperties properties) throws MPXJException {
"""
Populates the project header.
@param record MPX record
@param properties project properties
@throws MPXJException
"""
properties.setProjectTitle(record.getString(0));
properties.setCompan... | java | private void populateProjectHeader(Record record, ProjectProperties properties) throws MPXJException
{
properties.setProjectTitle(record.getString(0));
properties.setCompany(record.getString(1));
properties.setManager(record.getString(2));
properties.setDefaultCalendarName(record.getString(3)... | [
"private",
"void",
"populateProjectHeader",
"(",
"Record",
"record",
",",
"ProjectProperties",
"properties",
")",
"throws",
"MPXJException",
"{",
"properties",
".",
"setProjectTitle",
"(",
"record",
".",
"getString",
"(",
"0",
")",
")",
";",
"properties",
".",
"... | Populates the project header.
@param record MPX record
@param properties project properties
@throws MPXJException | [
"Populates",
"the",
"project",
"header",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L592-L623 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/StringUtils.java | StringUtils.startsWith | private static boolean startsWith(final CharSequence str, final CharSequence prefix, final boolean ignoreCase) {
"""
<p>Check if a CharSequence starts with a specified prefix (optionally case insensitive).</p>
@see java.lang.String#startsWith(String)
@param str the CharSequence to check, may be null
@param p... | java | private static boolean startsWith(final CharSequence str, final CharSequence prefix, final boolean ignoreCase) {
if (str == null || prefix == null) {
return str == prefix;
}
if (prefix.length() > str.length()) {
return false;
}
return CharSequenceUtils.reg... | [
"private",
"static",
"boolean",
"startsWith",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"CharSequence",
"prefix",
",",
"final",
"boolean",
"ignoreCase",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"prefix",
"==",
"null",
")",
"{",
"return",
"s... | <p>Check if a CharSequence starts with a specified prefix (optionally case insensitive).</p>
@see java.lang.String#startsWith(String)
@param str the CharSequence to check, may be null
@param prefix the prefix to find, may be null
@param ignoreCase indicates whether the compare should ignore case
(case insensitive) or... | [
"<p",
">",
"Check",
"if",
"a",
"CharSequence",
"starts",
"with",
"a",
"specified",
"prefix",
"(",
"optionally",
"case",
"insensitive",
")",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L826-L834 |
tango-controls/JTango | client/src/main/java/org/tango/client/database/Database.java | Database.setDeviceProperties | @Override
public void setDeviceProperties(final String deviceName, final Map<String, String[]> properties) throws DevFailed {
"""
Set values of device properties. (execute DbPutDeviceProperty on DB device)
@param deviceName
The device name
@param properties
The properties names and their values
@throws ... | java | @Override
public void setDeviceProperties(final String deviceName, final Map<String, String[]> properties) throws DevFailed {
cache.setDeviceProperties(deviceName, properties);
} | [
"@",
"Override",
"public",
"void",
"setDeviceProperties",
"(",
"final",
"String",
"deviceName",
",",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"properties",
")",
"throws",
"DevFailed",
"{",
"cache",
".",
"setDeviceProperties",
"(",
"deviceNa... | Set values of device properties. (execute DbPutDeviceProperty on DB device)
@param deviceName
The device name
@param properties
The properties names and their values
@throws DevFailed | [
"Set",
"values",
"of",
"device",
"properties",
".",
"(",
"execute",
"DbPutDeviceProperty",
"on",
"DB",
"device",
")"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/Database.java#L144-L147 |
jboss/jboss-el-api_spec | src/main/java/javax/el/ELProcessor.java | ELProcessor.getValue | public Object getValue(String expression, Class<?> expectedType) {
"""
Evaluates an EL expression, and coerces the result to the specified type.
@param expression The EL expression to be evaluated.
@param expectedType Specifies the type that the resultant evaluation
will be coerced to.
@return The result of th... | java | public Object getValue(String expression, Class<?> expectedType) {
ValueExpression exp = factory.createValueExpression(
elManager.getELContext(),
bracket(expression), expectedType);
return exp.getValue(elManager.getELContext());
} | [
"public",
"Object",
"getValue",
"(",
"String",
"expression",
",",
"Class",
"<",
"?",
">",
"expectedType",
")",
"{",
"ValueExpression",
"exp",
"=",
"factory",
".",
"createValueExpression",
"(",
"elManager",
".",
"getELContext",
"(",
")",
",",
"bracket",
"(",
... | Evaluates an EL expression, and coerces the result to the specified type.
@param expression The EL expression to be evaluated.
@param expectedType Specifies the type that the resultant evaluation
will be coerced to.
@return The result of the expression evaluation. | [
"Evaluates",
"an",
"EL",
"expression",
"and",
"coerces",
"the",
"result",
"to",
"the",
"specified",
"type",
"."
] | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELProcessor.java#L125-L130 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java | SqlConnRunner.count | public int count(Connection conn, Entity where) throws SQLException {
"""
结果的条目数
@param conn 数据库连接对象
@param where 查询条件
@return 复合条件的结果数
@throws SQLException SQL执行异常
"""
checkConn(conn);
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = ... | java | public int count(Connection conn, Entity where) throws SQLException {
checkConn(conn);
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = null;
try {
ps = dialect.psForCount(conn, query);
return SqlExecutor.query(ps, new NumberHandler()).i... | [
"public",
"int",
"count",
"(",
"Connection",
"conn",
",",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"checkConn",
"(",
"conn",
")",
";",
"final",
"Query",
"query",
"=",
"new",
"Query",
"(",
"SqlUtil",
".",
"buildConditions",
"(",
"where",
")",
... | 结果的条目数
@param conn 数据库连接对象
@param where 查询条件
@return 复合条件的结果数
@throws SQLException SQL执行异常 | [
"结果的条目数"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L439-L452 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.isActiveInstance | protected boolean isActiveInstance(String instanceId, T jedis) {
"""
Determine if the instance with the given id has been active in the last 4 minutes
@param instanceId the instance to check
@param jedis a thread-safe Redis connection
@return true if the instance with the given id has been active in the last 4 ... | java | protected boolean isActiveInstance(String instanceId, T jedis) {
boolean isActive = ( System.currentTimeMillis() - getLastInstanceActiveTime(instanceId, jedis) < clusterCheckInterval);
if (!isActive) {
removeLastInstanceActiveTime(instanceId, jedis);
}
return isActive;
} | [
"protected",
"boolean",
"isActiveInstance",
"(",
"String",
"instanceId",
",",
"T",
"jedis",
")",
"{",
"boolean",
"isActive",
"=",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"getLastInstanceActiveTime",
"(",
"instanceId",
",",
"jedis",
")",
"<",
"c... | Determine if the instance with the given id has been active in the last 4 minutes
@param instanceId the instance to check
@param jedis a thread-safe Redis connection
@return true if the instance with the given id has been active in the last 4 minutes | [
"Determine",
"if",
"the",
"instance",
"with",
"the",
"given",
"id",
"has",
"been",
"active",
"in",
"the",
"last",
"4",
"minutes"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L657-L663 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java | GVRNewWrapperProvider.wrapColor | @Override
public AiColor wrapColor(ByteBuffer buffer, int offset) {
"""
Wraps a RGBA color.
<p>
A color consists of 4 float values (r,g,b,a) starting from offset
@param buffer
the buffer to wrap
@param offset
the offset into buffer
@return the wrapped color
"""
AiColor color = new AiColo... | java | @Override
public AiColor wrapColor(ByteBuffer buffer, int offset) {
AiColor color = new AiColor(buffer, offset);
return color;
} | [
"@",
"Override",
"public",
"AiColor",
"wrapColor",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"offset",
")",
"{",
"AiColor",
"color",
"=",
"new",
"AiColor",
"(",
"buffer",
",",
"offset",
")",
";",
"return",
"color",
";",
"}"
] | Wraps a RGBA color.
<p>
A color consists of 4 float values (r,g,b,a) starting from offset
@param buffer
the buffer to wrap
@param offset
the offset into buffer
@return the wrapped color | [
"Wraps",
"a",
"RGBA",
"color",
".",
"<p",
">"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java#L23-L27 |
code4everything/util | src/main/java/com/zhazhapan/util/NetUtils.java | NetUtils.evaluate | public static String evaluate(String xpath, String html) throws XPathExpressionException,
ParserConfigurationException {
"""
XPath解析HTML内容
@param xpath xpath表达式
@param html html内容
@return 解析结果
@throws XPathExpressionException 异常
@throws ParserConfigurationException 异常
"""
HtmlCle... | java | public static String evaluate(String xpath, String html) throws XPathExpressionException,
ParserConfigurationException {
HtmlCleaner hc = new HtmlCleaner();
TagNode tn = hc.clean(html);
Document document = new DomSerializer(new CleanerProperties()).createDOM(tn);
XPath xPath ... | [
"public",
"static",
"String",
"evaluate",
"(",
"String",
"xpath",
",",
"String",
"html",
")",
"throws",
"XPathExpressionException",
",",
"ParserConfigurationException",
"{",
"HtmlCleaner",
"hc",
"=",
"new",
"HtmlCleaner",
"(",
")",
";",
"TagNode",
"tn",
"=",
"hc... | XPath解析HTML内容
@param xpath xpath表达式
@param html html内容
@return 解析结果
@throws XPathExpressionException 异常
@throws ParserConfigurationException 异常 | [
"XPath解析HTML内容"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L696-L703 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java | EntityIntrospector.initEntityMetadata | private void initEntityMetadata(ProjectedEntity projectedEntity) {
"""
Initializes the metadata using the given {@link ProjectedEntity} annotation.
@param projectedEntity
the {@link ProjectedEntity} annotation.
"""
String kind = projectedEntity.kind();
if (kind.trim().length() == 0) {
String ... | java | private void initEntityMetadata(ProjectedEntity projectedEntity) {
String kind = projectedEntity.kind();
if (kind.trim().length() == 0) {
String message = String.format("Class %s requires a non-blank Kind", entityClass.getName());
throw new EntityManagerException(message);
}
entityMetadata =... | [
"private",
"void",
"initEntityMetadata",
"(",
"ProjectedEntity",
"projectedEntity",
")",
"{",
"String",
"kind",
"=",
"projectedEntity",
".",
"kind",
"(",
")",
";",
"if",
"(",
"kind",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
... | Initializes the metadata using the given {@link ProjectedEntity} annotation.
@param projectedEntity
the {@link ProjectedEntity} annotation. | [
"Initializes",
"the",
"metadata",
"using",
"the",
"given",
"{",
"@link",
"ProjectedEntity",
"}",
"annotation",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java#L191-L198 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.findEntry | private HashtableEntry findEntry(EvictionTableEntry evt, int retrieveMode, long current, int tableid)
throws IOException,
EOFException,
FileManagerException,
ClassNotFoundException,
HashtableOnDiskException {
"""
**... | java | private HashtableEntry findEntry(EvictionTableEntry evt, int retrieveMode, long current, int tableid)
throws IOException,
EOFException,
FileManagerException,
ClassNotFoundException,
HashtableOnDiskException {
in... | [
"private",
"HashtableEntry",
"findEntry",
"(",
"EvictionTableEntry",
"evt",
",",
"int",
"retrieveMode",
",",
"long",
"current",
",",
"int",
"tableid",
")",
"throws",
"IOException",
",",
"EOFException",
",",
"FileManagerException",
",",
"ClassNotFoundException",
",",
... | ************************************************************************
Search disk for the indicated entry and return it and its
predecessor if any.
*********************************************************************** | [
"************************************************************************",
"Search",
"disk",
"for",
"the",
"indicated",
"entry",
"and",
"return",
"it",
"and",
"its",
"predecessor",
"if",
"any",
".",
"***********************************************************************"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2144-L2192 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.matchAndExtract | public static final Function<String,String> matchAndExtract(final String regex, final int group) {
"""
<p>
Matches the entire target String against the specified regular expression and extracts
the specified group from it (as specified by <tt>java.util.regex.Matcher</tt>.
</p>
<p>
Regular expressions must con... | java | public static final Function<String,String> matchAndExtract(final String regex, final int group) {
return new MatchAndExtract(regex, group);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"matchAndExtract",
"(",
"final",
"String",
"regex",
",",
"final",
"int",
"group",
")",
"{",
"return",
"new",
"MatchAndExtract",
"(",
"regex",
",",
"group",
")",
";",
"}"
] | <p>
Matches the entire target String against the specified regular expression and extracts
the specified group from it (as specified by <tt>java.util.regex.Matcher</tt>.
</p>
<p>
Regular expressions must conform to the <tt>java.util.regex.Pattern</tt> format.
</p>
@param regex the regular expression to match against
@... | [
"<p",
">",
"Matches",
"the",
"entire",
"target",
"String",
"against",
"the",
"specified",
"regular",
"expression",
"and",
"extracts",
"the",
"specified",
"group",
"from",
"it",
"(",
"as",
"specified",
"by",
"<tt",
">",
"java",
".",
"util",
".",
"regex",
".... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L1985-L1987 |
Netflix/spectator | spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java | Scheduler.newThreadFactory | private static ThreadFactory newThreadFactory(final String id) {
"""
Create a thread factory using thread names based on the id. All threads will
be configured as daemon threads.
"""
return new ThreadFactory() {
private final AtomicInteger next = new AtomicInteger();
@Override public Thread n... | java | private static ThreadFactory newThreadFactory(final String id) {
return new ThreadFactory() {
private final AtomicInteger next = new AtomicInteger();
@Override public Thread newThread(Runnable r) {
final String name = "spectator-" + id + "-" + next.getAndIncrement();
final Thread t = ne... | [
"private",
"static",
"ThreadFactory",
"newThreadFactory",
"(",
"final",
"String",
"id",
")",
"{",
"return",
"new",
"ThreadFactory",
"(",
")",
"{",
"private",
"final",
"AtomicInteger",
"next",
"=",
"new",
"AtomicInteger",
"(",
")",
";",
"@",
"Override",
"public... | Create a thread factory using thread names based on the id. All threads will
be configured as daemon threads. | [
"Create",
"a",
"thread",
"factory",
"using",
"thread",
"names",
"based",
"on",
"the",
"id",
".",
"All",
"threads",
"will",
"be",
"configured",
"as",
"daemon",
"threads",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/Scheduler.java#L88-L99 |
weld/core | impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironmentFactory.java | BeanDeployerEnvironmentFactory.newConcurrentEnvironment | public static BeanDeployerEnvironment newConcurrentEnvironment(BeanManagerImpl manager) {
"""
Creates a new threadsafe BeanDeployerEnvironment instance. These instances are used by {@link ConcurrentBeanDeployer} during bootstrap.
"""
return new BeanDeployerEnvironment(Collections.newSetFromMap(new Conc... | java | public static BeanDeployerEnvironment newConcurrentEnvironment(BeanManagerImpl manager) {
return new BeanDeployerEnvironment(Collections.newSetFromMap(new ConcurrentHashMap<SlimAnnotatedTypeContext<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>()), SetMultima... | [
"public",
"static",
"BeanDeployerEnvironment",
"newConcurrentEnvironment",
"(",
"BeanManagerImpl",
"manager",
")",
"{",
"return",
"new",
"BeanDeployerEnvironment",
"(",
"Collections",
".",
"newSetFromMap",
"(",
"new",
"ConcurrentHashMap",
"<",
"SlimAnnotatedTypeContext",
"<... | Creates a new threadsafe BeanDeployerEnvironment instance. These instances are used by {@link ConcurrentBeanDeployer} during bootstrap. | [
"Creates",
"a",
"new",
"threadsafe",
"BeanDeployerEnvironment",
"instance",
".",
"These",
"instances",
"are",
"used",
"by",
"{"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironmentFactory.java#L47-L59 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/Metrics.java | Metrics.gaugeMapSize | @Nullable
public static <T extends Map<?, ?>> T gaugeMapSize(String name, Iterable<Tag> tags, T map) {
"""
Register a gauge that reports the size of the {@link java.util.Map}. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementatio... | java | @Nullable
public static <T extends Map<?, ?>> T gaugeMapSize(String name, Iterable<Tag> tags, T map) {
return globalRegistry.gaugeMapSize(name, tags, map);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
"extends",
"Map",
"<",
"?",
",",
"?",
">",
">",
"T",
"gaugeMapSize",
"(",
"String",
"name",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
",",
"T",
"map",
")",
"{",
"return",
"globalRegistry",
".",
"gaugeMap... | Register a gauge that reports the size of the {@link java.util.Map}. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
{@link java.util.Map#size()} can be expensive for some collection impl... | [
"Register",
"a",
"gauge",
"that",
"reports",
"the",
"size",
"of",
"the",
"{",
"@link",
"java",
".",
"util",
".",
"Map",
"}",
".",
"The",
"registration",
"will",
"keep",
"a",
"weak",
"reference",
"to",
"the",
"collection",
"so",
"it",
"will",
"not",
"pr... | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/Metrics.java#L233-L236 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.quadTo | public void quadTo(double x1, double y1, double z1, double x2, double y2, double z2) {
"""
Adds a curved segment, defined by two new points, to the path by
drawing a Quadratic curve that intersects both the current
coordinates and the specified coordinates {@code (x2,y2,z2)},
using the specified point {@code (x... | java | public void quadTo(double x1, double y1, double z1, double x2, double y2, double z2) {
ensureSlots(true, 6);
this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()].set(x1);
this.numCoordsPr... | [
"public",
"void",
"quadTo",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"z1",
",",
"double",
"x2",
",",
"double",
"y2",
",",
"double",
"z2",
")",
"{",
"ensureSlots",
"(",
"true",
",",
"6",
")",
";",
"this",
".",
"types",
"[",
"this",
... | Adds a curved segment, defined by two new points, to the path by
drawing a Quadratic curve that intersects both the current
coordinates and the specified coordinates {@code (x2,y2,z2)},
using the specified point {@code (x1,y1,z1)} as a quadratic
parametric control point.
All coordinates are specified in double precisio... | [
"Adds",
"a",
"curved",
"segment",
"defined",
"by",
"two",
"new",
"points",
"to",
"the",
"path",
"by",
"drawing",
"a",
"Quadratic",
"curve",
"that",
"intersects",
"both",
"the",
"current",
"coordinates",
"and",
"the",
"specified",
"coordinates",
"{",
"@code",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2140-L2169 |
mgm-tp/jfunk | jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/ConstraintFactory.java | ConstraintFactory.putToCache | private Constraint putToCache(final String id, final Constraint object) {
"""
Puts the given constraint object into the cache using the key id. If an existing
DummyConstraint object is found in the table, the reference will be set to the constraint and
the constraint will not be put into the table.
"""
Co... | java | private Constraint putToCache(final String id, final Constraint object) {
Constraint c = this.map.put(id, object);
if (c instanceof DummyConstraint) {
((DummyConstraint) c).constraint = object;
return null;
}
return c;
} | [
"private",
"Constraint",
"putToCache",
"(",
"final",
"String",
"id",
",",
"final",
"Constraint",
"object",
")",
"{",
"Constraint",
"c",
"=",
"this",
".",
"map",
".",
"put",
"(",
"id",
",",
"object",
")",
";",
"if",
"(",
"c",
"instanceof",
"DummyConstrain... | Puts the given constraint object into the cache using the key id. If an existing
DummyConstraint object is found in the table, the reference will be set to the constraint and
the constraint will not be put into the table. | [
"Puts",
"the",
"given",
"constraint",
"object",
"into",
"the",
"cache",
"using",
"the",
"key",
"id",
".",
"If",
"an",
"existing",
"DummyConstraint",
"object",
"is",
"found",
"in",
"the",
"table",
"the",
"reference",
"will",
"be",
"set",
"to",
"the",
"const... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/ConstraintFactory.java#L182-L189 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/DataframeMatrix.java | DataframeMatrix.parseRecord | public static RealVector parseRecord(Record r, Map<Object, Integer> featureIdsReference) {
"""
Parses a single Record and converts it to RealVector by using an already
existing mapping between feature names and column ids.
@param r
@param featureIdsReference
@return
"""
if(featureIdsReference.isE... | java | public static RealVector parseRecord(Record r, Map<Object, Integer> featureIdsReference) {
if(featureIdsReference.isEmpty()) {
throw new IllegalArgumentException("The featureIdsReference map should not be empty.");
}
int d = featureIdsReference.size();
//create an M... | [
"public",
"static",
"RealVector",
"parseRecord",
"(",
"Record",
"r",
",",
"Map",
"<",
"Object",
",",
"Integer",
">",
"featureIdsReference",
")",
"{",
"if",
"(",
"featureIdsReference",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExceptio... | Parses a single Record and converts it to RealVector by using an already
existing mapping between feature names and column ids.
@param r
@param featureIdsReference
@return | [
"Parses",
"a",
"single",
"Record",
"and",
"converts",
"it",
"to",
"RealVector",
"by",
"using",
"an",
"already",
"existing",
"mapping",
"between",
"feature",
"names",
"and",
"column",
"ids",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/DataframeMatrix.java#L251-L282 |
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/core/TinylogLoggingProvider.java | TinylogLoggingProvider.createLogEntry | private LogEntry createLogEntry(final StackTraceElement stackTraceElement, final String tag, final int tagIndex, final Level level,
final Throwable exception, final Object obj, final Object[] arguments) {
"""
Creates a new log entry.
@param stackTraceElement
Optional stack trace element of caller
@param tag... | java | private LogEntry createLogEntry(final StackTraceElement stackTraceElement, final String tag, final int tagIndex, final Level level,
final Throwable exception, final Object obj, final Object[] arguments) {
Collection<LogEntryValue> required = requiredLogEntryValues[tagIndex][level.ordinal()];
Timestamp timestamp ... | [
"private",
"LogEntry",
"createLogEntry",
"(",
"final",
"StackTraceElement",
"stackTraceElement",
",",
"final",
"String",
"tag",
",",
"final",
"int",
"tagIndex",
",",
"final",
"Level",
"level",
",",
"final",
"Throwable",
"exception",
",",
"final",
"Object",
"obj",
... | Creates a new log entry.
@param stackTraceElement
Optional stack trace element of caller
@param tag
Tag name if issued from a tagged logger
@param tagIndex
Index of tag
@param level
Severity level
@param exception
Caught exception or throwable to log
@param obj
Message to log
@param arguments
Arguments for message
@re... | [
"Creates",
"a",
"new",
"log",
"entry",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/core/TinylogLoggingProvider.java#L352-L385 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java | JobAgentsInner.createOrUpdate | public JobAgentInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) {
"""
Creates or updates a job agent.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API ... | java | public JobAgentInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).toBlocking().last().body();
} | [
"public",
"JobAgentInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"JobAgentInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"s... | Creates or updates a job agent.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent to be created or updated.
@param param... | [
"Creates",
"or",
"updates",
"a",
"job",
"agent",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java#L333-L335 |
webpagebytes/general-cms-plugins | src/main/java/com/webpagebytes/plugins/WPBSQLDataStoreDao.java | WPBSQLDataStoreDao.setObjectProperty | public void setObjectProperty(Object object, String property, Object propertyValue) throws WPBSerializerException {
"""
/*
Given an instance of an object that has a particular property this method will set the object property with the
provided value. It assumes that the object has the setter method for the speci... | java | public void setObjectProperty(Object object, String property, Object propertyValue) throws WPBSerializerException
{
try
{
PropertyDescriptor pd = new PropertyDescriptor(property, object.getClass());
pd.getWriteMethod().invoke(object, propertyValue);
} catch (Exception e)
{
log.log(Level.SEVERE, "ca... | [
"public",
"void",
"setObjectProperty",
"(",
"Object",
"object",
",",
"String",
"property",
",",
"Object",
"propertyValue",
")",
"throws",
"WPBSerializerException",
"{",
"try",
"{",
"PropertyDescriptor",
"pd",
"=",
"new",
"PropertyDescriptor",
"(",
"property",
",",
... | /*
Given an instance of an object that has a particular property this method will set the object property with the
provided value. It assumes that the object has the setter method for the specified interface
@param object The object instance on which the property will be set
@param property The property name that will ... | [
"/",
"*",
"Given",
"an",
"instance",
"of",
"an",
"object",
"that",
"has",
"a",
"particular",
"property",
"this",
"method",
"will",
"set",
"the",
"object",
"property",
"with",
"the",
"provided",
"value",
".",
"It",
"assumes",
"that",
"the",
"object",
"has",... | train | https://github.com/webpagebytes/general-cms-plugins/blob/610dbaa49d92695be642d1888b30bc4671e1b9c1/src/main/java/com/webpagebytes/plugins/WPBSQLDataStoreDao.java#L112-L124 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java | ImageHeaderReaderAbstract.checkSkippedError | protected static void checkSkippedError(long skipped, int instead) throws IOException {
"""
Skipped message error.
@param skipped The skipped value.
@param instead The instead value.
@throws IOException If not skipped the right number of bytes.
"""
if (skipped != instead)
{
thr... | java | protected static void checkSkippedError(long skipped, int instead) throws IOException
{
if (skipped != instead)
{
throw new IOException(MESSAGE_SKIPPED + skipped + MESSAGE_BYTES_INSTEAD_OF + instead);
}
} | [
"protected",
"static",
"void",
"checkSkippedError",
"(",
"long",
"skipped",
",",
"int",
"instead",
")",
"throws",
"IOException",
"{",
"if",
"(",
"skipped",
"!=",
"instead",
")",
"{",
"throw",
"new",
"IOException",
"(",
"MESSAGE_SKIPPED",
"+",
"skipped",
"+",
... | Skipped message error.
@param skipped The skipped value.
@param instead The instead value.
@throws IOException If not skipped the right number of bytes. | [
"Skipped",
"message",
"error",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java#L88-L94 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/FbBotMillServlet.java | FbBotMillServlet.doPost | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
"""
Specifies how to handle a POST request. It parses the request as a
{@link MessengerCallback} object. If the request is not a
MessengerCallback, then the FbBotMillServlet logs an erro... | java | @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
logger.trace("POST received!");
MessengerCallback callback = new MessengerCallback();
// Extrapolates and logs the JSON for debugging.
String json = readerToString(req.getReader... | [
"@",
"Override",
"protected",
"void",
"doPost",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"logger",
".",
"trace",
"(",
"\"POST received!\"",
")",
";",
"MessengerCallback",
"callb... | Specifies how to handle a POST request. It parses the request as a
{@link MessengerCallback} object. If the request is not a
MessengerCallback, then the FbBotMillServlet logs an error and does
nothing, otherwise it will forward the request to all registered bots in
order to let them process the callbacks.
@param req
t... | [
"Specifies",
"how",
"to",
"handle",
"a",
"POST",
"request",
".",
"It",
"parses",
"the",
"request",
"as",
"a",
"{",
"@link",
"MessengerCallback",
"}",
"object",
".",
"If",
"the",
"request",
"is",
"not",
"a",
"MessengerCallback",
"then",
"the",
"FbBotMillServl... | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/FbBotMillServlet.java#L149-L184 |
Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java | ChannelUpdateHandler.handleChannelCategory | private void handleChannelCategory(JsonNode jsonChannel) {
"""
Handles a channel category update.
@param jsonChannel The channel data.
"""
long channelCategoryId = jsonChannel.get("id").asLong();
api.getChannelCategoryById(channelCategoryId).map(ChannelCategoryImpl.class::cast).ifPresent(cha... | java | private void handleChannelCategory(JsonNode jsonChannel) {
long channelCategoryId = jsonChannel.get("id").asLong();
api.getChannelCategoryById(channelCategoryId).map(ChannelCategoryImpl.class::cast).ifPresent(channel -> {
boolean oldNsfwFlag = channel.isNsfw();
boolean newNsfwFla... | [
"private",
"void",
"handleChannelCategory",
"(",
"JsonNode",
"jsonChannel",
")",
"{",
"long",
"channelCategoryId",
"=",
"jsonChannel",
".",
"get",
"(",
"\"id\"",
")",
".",
"asLong",
"(",
")",
";",
"api",
".",
"getChannelCategoryById",
"(",
"channelCategoryId",
"... | Handles a channel category update.
@param jsonChannel The channel data. | [
"Handles",
"a",
"channel",
"category",
"update",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java#L251-L265 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java | PhoneNumberUtil.formatDin5008National | public final String formatDin5008National(final String pphoneNumber, final String pcountryCode) {
"""
format phone number in DIN 5008 national format.
@param pphoneNumber phone number to format
@param pcountryCode iso code of country
@return formated phone number as String
"""
return this.formatDin500... | java | public final String formatDin5008National(final String pphoneNumber, final String pcountryCode) {
return this.formatDin5008National(this.parsePhoneNumber(pphoneNumber, pcountryCode));
} | [
"public",
"final",
"String",
"formatDin5008National",
"(",
"final",
"String",
"pphoneNumber",
",",
"final",
"String",
"pcountryCode",
")",
"{",
"return",
"this",
".",
"formatDin5008National",
"(",
"this",
".",
"parsePhoneNumber",
"(",
"pphoneNumber",
",",
"pcountryC... | format phone number in DIN 5008 national format.
@param pphoneNumber phone number to format
@param pcountryCode iso code of country
@return formated phone number as String | [
"format",
"phone",
"number",
"in",
"DIN",
"5008",
"national",
"format",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java#L951-L953 |
trustathsh/ironcommon | src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java | Properties.getInt | public int getInt(String propertyPath, int defaultValue) {
"""
Get the int-value from the property path. If the property path does not
exist, the default value is returned.
@param propertyPath
Example: foo.bar.key
@param defaultValue
is returned when the propertyPath does not exist
@return the value for th... | java | public int getInt(String propertyPath, int defaultValue) {
Object o = getValue(propertyPath, defaultValue);
return Integer.parseInt(o.toString());
} | [
"public",
"int",
"getInt",
"(",
"String",
"propertyPath",
",",
"int",
"defaultValue",
")",
"{",
"Object",
"o",
"=",
"getValue",
"(",
"propertyPath",
",",
"defaultValue",
")",
";",
"return",
"Integer",
".",
"parseInt",
"(",
"o",
".",
"toString",
"(",
")",
... | Get the int-value from the property path. If the property path does not
exist, the default value is returned.
@param propertyPath
Example: foo.bar.key
@param defaultValue
is returned when the propertyPath does not exist
@return the value for the given propertyPath | [
"Get",
"the",
"int",
"-",
"value",
"from",
"the",
"property",
"path",
".",
"If",
"the",
"property",
"path",
"does",
"not",
"exist",
"the",
"default",
"value",
"is",
"returned",
"."
] | train | https://github.com/trustathsh/ironcommon/blob/fee589a9300ab16744ca12fafae4357dd18c9fcb/src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java#L280-L283 |
alipay/sofa-rpc | extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/common/utils/CalculateUtils.java | CalculateUtils.divide | public static double divide(long numerator, long denominator, int scale) {
"""
计算比率。计算结果四舍五入。
@param numerator 分子
@param denominator 分母
@param scale 保留小数点后位数
@return 比率
"""
BigDecimal numeratorBd = new BigDecimal(numerator);
BigDecimal denominatorBd = new BigDecimal(denominator);
... | java | public static double divide(long numerator, long denominator, int scale) {
BigDecimal numeratorBd = new BigDecimal(numerator);
BigDecimal denominatorBd = new BigDecimal(denominator);
return numeratorBd.divide(denominatorBd, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
} | [
"public",
"static",
"double",
"divide",
"(",
"long",
"numerator",
",",
"long",
"denominator",
",",
"int",
"scale",
")",
"{",
"BigDecimal",
"numeratorBd",
"=",
"new",
"BigDecimal",
"(",
"numerator",
")",
";",
"BigDecimal",
"denominatorBd",
"=",
"new",
"BigDecim... | 计算比率。计算结果四舍五入。
@param numerator 分子
@param denominator 分母
@param scale 保留小数点后位数
@return 比率 | [
"计算比率。计算结果四舍五入。"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/common/utils/CalculateUtils.java#L38-L42 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.getEvse | public Evse getEvse(Long chargingStationTypeId, Long id) {
"""
Find an evse based on its id.
@param chargingStationTypeId charging station identifier.
@param id the id of the evse to find.
@return the evse.
"""
ChargingStationType chargingStationType = chargingStationTypeReposit... | java | public Evse getEvse(Long chargingStationTypeId, Long id) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
return getEvseById(chargingStationType, id);
} | [
"public",
"Evse",
"getEvse",
"(",
"Long",
"chargingStationTypeId",
",",
"Long",
"id",
")",
"{",
"ChargingStationType",
"chargingStationType",
"=",
"chargingStationTypeRepository",
".",
"findOne",
"(",
"chargingStationTypeId",
")",
";",
"return",
"getEvseById",
"(",
"c... | Find an evse based on its id.
@param chargingStationTypeId charging station identifier.
@param id the id of the evse to find.
@return the evse. | [
"Find",
"an",
"evse",
"based",
"on",
"its",
"id",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L292-L296 |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/policy/services/dsl/AutoscalePolicyService.java | AutoscalePolicyService.setAutoscalePolicyOnServer | public OperationFuture<List<Server>> setAutoscalePolicyOnServer(
AutoscalePolicy autoscalePolicy,
Server... servers
) {
"""
set autoscale policy on servers
@param autoscalePolicy autoscale policy
@param servers servers
@return OperationFuture wrapper for servers
"""
ret... | java | public OperationFuture<List<Server>> setAutoscalePolicyOnServer(
AutoscalePolicy autoscalePolicy,
Server... servers
) {
return setAutoscalePolicyOnServer(autoscalePolicy, Arrays.asList(servers));
} | [
"public",
"OperationFuture",
"<",
"List",
"<",
"Server",
">",
">",
"setAutoscalePolicyOnServer",
"(",
"AutoscalePolicy",
"autoscalePolicy",
",",
"Server",
"...",
"servers",
")",
"{",
"return",
"setAutoscalePolicyOnServer",
"(",
"autoscalePolicy",
",",
"Arrays",
".",
... | set autoscale policy on servers
@param autoscalePolicy autoscale policy
@param servers servers
@return OperationFuture wrapper for servers | [
"set",
"autoscale",
"policy",
"on",
"servers"
] | train | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/policy/services/dsl/AutoscalePolicyService.java#L121-L126 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.linkOneToOne | public void linkOneToOne(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean insert) {
"""
Assign FK value of main object with PK values of the reference object.
@param obj real object with reference (proxy) object (or real object with set FK values on insert)
@param cld {@link ClassDescrip... | java | public void linkOneToOne(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean insert)
{
storeAndLinkOneToOne(true, obj, cld, rds, true);
} | [
"public",
"void",
"linkOneToOne",
"(",
"Object",
"obj",
",",
"ClassDescriptor",
"cld",
",",
"ObjectReferenceDescriptor",
"rds",
",",
"boolean",
"insert",
")",
"{",
"storeAndLinkOneToOne",
"(",
"true",
",",
"obj",
",",
"cld",
",",
"rds",
",",
"true",
")",
";"... | Assign FK value of main object with PK values of the reference object.
@param obj real object with reference (proxy) object (or real object with set FK values on insert)
@param cld {@link ClassDescriptor} of the real object
@param rds An {@link ObjectReferenceDescriptor} of real object.
@param insert Show if "linking"... | [
"Assign",
"FK",
"value",
"of",
"main",
"object",
"with",
"PK",
"values",
"of",
"the",
"reference",
"object",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1299-L1302 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.processTopicAdditionalInfo | public void processTopicAdditionalInfo(final BuildData buildData, final SpecTopic specTopic,
final Document document) throws BuildProcessingException {
"""
Adds some debug information and links to the end of the topic
"""
// First check if we should even bother processing any additional inf... | java | public void processTopicAdditionalInfo(final BuildData buildData, final SpecTopic specTopic,
final Document document) throws BuildProcessingException {
// First check if we should even bother processing any additional info based on build data
if (!shouldAddAdditionalInfo(buildData, specTopic... | [
"public",
"void",
"processTopicAdditionalInfo",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"SpecTopic",
"specTopic",
",",
"final",
"Document",
"document",
")",
"throws",
"BuildProcessingException",
"{",
"// First check if we should even bother processing any addition... | Adds some debug information and links to the end of the topic | [
"Adds",
"some",
"debug",
"information",
"and",
"links",
"to",
"the",
"end",
"of",
"the",
"topic"
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L383-L404 |
bsblabs/embed-for-vaadin | com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/PropertiesHelper.java | PropertiesHelper.getIntProperty | public int getIntProperty(String key, int defaultValue) {
"""
Returns the int value for the specified property. If no such key is found,
returns the <tt>defaultValue</tt> instead.
@param key the key of the property
@param defaultValue the default value if no such property is found
@return an int value
@see ... | java | public int getIntProperty(String key, int defaultValue) {
final String value = properties.getProperty(key, String.valueOf(defaultValue));
return Integer.valueOf(value);
} | [
"public",
"int",
"getIntProperty",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"properties",
".",
"getProperty",
"(",
"key",
",",
"String",
".",
"valueOf",
"(",
"defaultValue",
")",
")",
";",
"return",
"Inte... | Returns the int value for the specified property. If no such key is found,
returns the <tt>defaultValue</tt> instead.
@param key the key of the property
@param defaultValue the default value if no such property is found
@return an int value
@see Properties#getProperty(String, String) | [
"Returns",
"the",
"int",
"value",
"for",
"the",
"specified",
"property",
".",
"If",
"no",
"such",
"key",
"is",
"found",
"returns",
"the",
"<tt",
">",
"defaultValue<",
"/",
"tt",
">",
"instead",
"."
] | train | https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/PropertiesHelper.java#L65-L68 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/InstanceInfo.java | InstanceInfo.of | public static InstanceInfo of(
InstanceId instanceId,
MachineTypeId machineType,
AttachedDisk disk,
NetworkInterface networkInterface) {
"""
Returns an {@code InstanceInfo} object given the instance identity, the machine type, a disk to
attach to the instance and a network interface. {@cod... | java | public static InstanceInfo of(
InstanceId instanceId,
MachineTypeId machineType,
AttachedDisk disk,
NetworkInterface networkInterface) {
return newBuilder(instanceId, machineType)
.setAttachedDisks(ImmutableList.of(disk))
.setNetworkInterfaces(ImmutableList.of(networkInterfac... | [
"public",
"static",
"InstanceInfo",
"of",
"(",
"InstanceId",
"instanceId",
",",
"MachineTypeId",
"machineType",
",",
"AttachedDisk",
"disk",
",",
"NetworkInterface",
"networkInterface",
")",
"{",
"return",
"newBuilder",
"(",
"instanceId",
",",
"machineType",
")",
".... | Returns an {@code InstanceInfo} object given the instance identity, the machine type, a disk to
attach to the instance and a network interface. {@code disk} must be a boot disk (i.e. {@link
AttachedDisk.AttachedDiskConfiguration#boot()} returns {@code true}). | [
"Returns",
"an",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/InstanceInfo.java#L645-L654 |
mlhartme/mork | src/main/java/net/oneandone/mork/grammar/Ebnf.java | Ebnf.translate | public static Grammar translate(Rule[] rules, StringArrayList symbolTable) throws ActionException {
"""
helper symbols are added without gaps, starting with freeHelper.
"""
int i;
Ebnf builder;
Grammar tmp;
Grammar buffer;
int firstHelper;
int lastHelper;
... | java | public static Grammar translate(Rule[] rules, StringArrayList symbolTable) throws ActionException {
int i;
Ebnf builder;
Grammar tmp;
Grammar buffer;
int firstHelper;
int lastHelper;
firstHelper = symbolTable.size();
buffer = new Grammar(rules[0].getLeft(... | [
"public",
"static",
"Grammar",
"translate",
"(",
"Rule",
"[",
"]",
"rules",
",",
"StringArrayList",
"symbolTable",
")",
"throws",
"ActionException",
"{",
"int",
"i",
";",
"Ebnf",
"builder",
";",
"Grammar",
"tmp",
";",
"Grammar",
"buffer",
";",
"int",
"firstH... | helper symbols are added without gaps, starting with freeHelper. | [
"helper",
"symbols",
"are",
"added",
"without",
"gaps",
"starting",
"with",
"freeHelper",
"."
] | train | https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Ebnf.java#L30-L53 |
zaproxy/zaproxy | src/org/zaproxy/zap/session/CookieBasedSessionManagementHelper.java | CookieBasedSessionManagementHelper.processMessageToMatchSession | public static void processMessageToMatchSession(HttpMessage message, HttpSession session) {
"""
Modifies a message so its Request Header/Body matches the web session provided.
@param message the message
@param session the session
"""
processMessageToMatchSession(message, message.getRequestHeader().getHtt... | java | public static void processMessageToMatchSession(HttpMessage message, HttpSession session) {
processMessageToMatchSession(message, message.getRequestHeader().getHttpCookies(), session);
} | [
"public",
"static",
"void",
"processMessageToMatchSession",
"(",
"HttpMessage",
"message",
",",
"HttpSession",
"session",
")",
"{",
"processMessageToMatchSession",
"(",
"message",
",",
"message",
".",
"getRequestHeader",
"(",
")",
".",
"getHttpCookies",
"(",
")",
",... | Modifies a message so its Request Header/Body matches the web session provided.
@param message the message
@param session the session | [
"Modifies",
"a",
"message",
"so",
"its",
"Request",
"Header",
"/",
"Body",
"matches",
"the",
"web",
"session",
"provided",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/session/CookieBasedSessionManagementHelper.java#L48-L50 |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java | ParamConverterEngine.newInstance | @Override
public <T> T newInstance(Context context, Class<T> type) throws IllegalArgumentException {
"""
Creates an instance of T from the given HTTP content. Unlike converters, it does not handler generics or
collections.
@param context the HTTP content
@param type the class to instantiate
@return th... | java | @Override
public <T> T newInstance(Context context, Class<T> type) throws IllegalArgumentException {
// Retrieve the factory
for (ParameterFactory factory : factories) {
if (factory.getType().equals(type)) {
// Factory found - instantiate
//noinspection un... | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Context",
"context",
",",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"IllegalArgumentException",
"{",
"// Retrieve the factory",
"for",
"(",
"ParameterFactory",
"factory",
":",
"factories",
... | Creates an instance of T from the given HTTP content. Unlike converters, it does not handler generics or
collections.
@param context the HTTP content
@param type the class to instantiate
@return the created object
@throws IllegalArgumentException if there are no {@link org.wisdom.api.content.ParameterFactory} avail... | [
"Creates",
"an",
"instance",
"of",
"T",
"from",
"the",
"given",
"HTTP",
"content",
".",
"Unlike",
"converters",
"it",
"does",
"not",
"handler",
"generics",
"or",
"collections",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java#L138-L150 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/userdata/UserDataHelpers.java | UserDataHelpers.interceptWritingFiles | static void interceptWritingFiles( Properties props, File outputDirectory ) throws IOException {
"""
Intercepts the properties and writes file contents.
@param props non-null properties
@param outputDirectory a directory into which files should be written
<p>
If null, files sent with {@link #ENCODE_FILE_CONTEN... | java | static void interceptWritingFiles( Properties props, File outputDirectory ) throws IOException {
if( outputDirectory == null )
return;
Logger logger = Logger.getLogger( UserDataHelpers.class.getName());
Set<String> keys = props.stringPropertyNames();
for( final String key : keys ) {
if( ! key.startsWith... | [
"static",
"void",
"interceptWritingFiles",
"(",
"Properties",
"props",
",",
"File",
"outputDirectory",
")",
"throws",
"IOException",
"{",
"if",
"(",
"outputDirectory",
"==",
"null",
")",
"return",
";",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
... | Intercepts the properties and writes file contents.
@param props non-null properties
@param outputDirectory a directory into which files should be written
<p>
If null, files sent with {@link #ENCODE_FILE_CONTENT_PREFIX} will not be written.
</p>
@throws IOException | [
"Intercepts",
"the",
"properties",
"and",
"writes",
"file",
"contents",
".",
"@param",
"props",
"non",
"-",
"null",
"properties",
"@param",
"outputDirectory",
"a",
"directory",
"into",
"which",
"files",
"should",
"be",
"written",
"<p",
">",
"If",
"null",
"file... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/userdata/UserDataHelpers.java#L242-L279 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.isVisible | public static boolean isVisible(JvmDeclaredType fromType, JvmMember target) {
"""
Replies if the target feature is visible from the type.
@param fromType - the type from which the feature visibility is tested.
@param target - the feature to test for the visibility.
@return <code>true</code> if the given type ... | java | public static boolean isVisible(JvmDeclaredType fromType, JvmMember target) {
switch (target.getVisibility()) {
case DEFAULT:
return target.getDeclaringType().getPackageName().equals(fromType.getPackageName());
case PROTECTED:
case PUBLIC:
return true;
case PRIVATE:
default:
}
return false;
} | [
"public",
"static",
"boolean",
"isVisible",
"(",
"JvmDeclaredType",
"fromType",
",",
"JvmMember",
"target",
")",
"{",
"switch",
"(",
"target",
".",
"getVisibility",
"(",
")",
")",
"{",
"case",
"DEFAULT",
":",
"return",
"target",
".",
"getDeclaringType",
"(",
... | Replies if the target feature is visible from the type.
@param fromType - the type from which the feature visibility is tested.
@param target - the feature to test for the visibility.
@return <code>true</code> if the given type can see the target feature. | [
"Replies",
"if",
"the",
"target",
"feature",
"is",
"visible",
"from",
"the",
"type",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L345-L356 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getDungeonInfo | public void getDungeonInfo(String[] ids, Callback<List<Dungeon>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link ... | java | public void getDungeonInfo(String[] ids, Callback<List<Dungeon>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getDungeonInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getDungeonInfo",
"(",
"String",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Dungeon",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"id... | For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of dungeon id
@param callback callback that i... | [
"For",
"more",
"info",
"on",
"Dungeons",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"dungeons",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1287-L1290 |
code4everything/util | src/main/java/com/zhazhapan/util/BeanUtils.java | BeanUtils.bean2Another | public static <T> T bean2Another(Object object, T another, Class<T> clazz) throws IllegalAccessException,
InstantiationException, InvocationTargetException {
"""
将一个Bean的数据装换到另外一个(需实现setter和getter)
@param object 一个Bean
@param clazz 另外一个Bean类
@param another 另一个Bean对象
@param <T> 另外Bean类型
@return... | java | public static <T> T bean2Another(Object object, T another, Class<T> clazz) throws IllegalAccessException,
InstantiationException, InvocationTargetException {
if (Checker.isNull(another)) {
another = clazz.newInstance();
}
return bean2Another(object, clazz, another);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"bean2Another",
"(",
"Object",
"object",
",",
"T",
"another",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"IllegalAccessException",
",",
"InstantiationException",
",",
"InvocationTargetException",
"{",
"if",
"("... | 将一个Bean的数据装换到另外一个(需实现setter和getter)
@param object 一个Bean
@param clazz 另外一个Bean类
@param another 另一个Bean对象
@param <T> 另外Bean类型
@return {@link T}
@throws IllegalAccessException 异常
@throws InvocationTargetException 异常
@throws InstantiationException 异常
@since 1.1.1 | [
"将一个Bean的数据装换到另外一个(需实现setter和getter)"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L83-L89 |
andriusvelykis/reflow-maven-skin | reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java | HtmlTool.setAttr | public String setAttr(String content, String selector, String attributeKey, String value) {
"""
Sets attribute to the given value on elements in HTML.
@param content
HTML content to set attributes on
@param selector
CSS selector for elements to modify
@param attributeKey
Attribute name
@param value
Attri... | java | public String setAttr(String content, String selector, String attributeKey, String value) {
Element body = parseContent(content);
List<Element> elements = body.select(selector);
if (elements.size() > 0) {
for (Element element : elements) {
element.attr(attributeKey, value);
}
return body... | [
"public",
"String",
"setAttr",
"(",
"String",
"content",
",",
"String",
"selector",
",",
"String",
"attributeKey",
",",
"String",
"value",
")",
"{",
"Element",
"body",
"=",
"parseContent",
"(",
"content",
")",
";",
"List",
"<",
"Element",
">",
"elements",
... | Sets attribute to the given value on elements in HTML.
@param content
HTML content to set attributes on
@param selector
CSS selector for elements to modify
@param attributeKey
Attribute name
@param value
Attribute value
@return HTML content with modified elements. If no elements are found, the original content
is retu... | [
"Sets",
"attribute",
"to",
"the",
"given",
"value",
"on",
"elements",
"in",
"HTML",
"."
] | train | https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L584-L600 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.