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 |
|---|---|---|---|---|---|---|---|---|---|---|
lamydev/Android-Notification | core/src/zemin/notification/NotificationViewCallback.java | NotificationViewCallback.onContentViewChanged | public void onContentViewChanged(NotificationView view, View contentView, int layoutId) {
"""
Called when content view is changed. All child-views were cleared due the
change of content view. You need to re-setup the associated child-views.
@param view
@param contentView
@param layoutId
"""
if (DBG) Log.v(TAG, "onContentViewChanged");
ChildViewManager mgr = view.getChildViewManager();
if (layoutId == R.layout.notification_simple ||
layoutId == R.layout.notification_large_icon ||
layoutId == R.layout.notification_full) {
view.setNotificationTransitionEnabled(false);
mgr.setView(ICON, contentView.findViewById(R.id.switcher_icon));
mgr.setView(TITLE, contentView.findViewById(R.id.switcher_title));
mgr.setView(TEXT, contentView.findViewById(R.id.switcher_text));
mgr.setView(WHEN, contentView.findViewById(R.id.switcher_when));
} else if (layoutId == R.layout.notification_simple_2) {
view.setNotificationTransitionEnabled(true);
mgr.setView(ICON, contentView.findViewById(R.id.icon));
mgr.setView(TITLE, contentView.findViewById(R.id.title));
mgr.setView(TEXT, contentView.findViewById(R.id.text));
mgr.setView(WHEN, contentView.findViewById(R.id.when));
}
} | java | public void onContentViewChanged(NotificationView view, View contentView, int layoutId) {
if (DBG) Log.v(TAG, "onContentViewChanged");
ChildViewManager mgr = view.getChildViewManager();
if (layoutId == R.layout.notification_simple ||
layoutId == R.layout.notification_large_icon ||
layoutId == R.layout.notification_full) {
view.setNotificationTransitionEnabled(false);
mgr.setView(ICON, contentView.findViewById(R.id.switcher_icon));
mgr.setView(TITLE, contentView.findViewById(R.id.switcher_title));
mgr.setView(TEXT, contentView.findViewById(R.id.switcher_text));
mgr.setView(WHEN, contentView.findViewById(R.id.switcher_when));
} else if (layoutId == R.layout.notification_simple_2) {
view.setNotificationTransitionEnabled(true);
mgr.setView(ICON, contentView.findViewById(R.id.icon));
mgr.setView(TITLE, contentView.findViewById(R.id.title));
mgr.setView(TEXT, contentView.findViewById(R.id.text));
mgr.setView(WHEN, contentView.findViewById(R.id.when));
}
} | [
"public",
"void",
"onContentViewChanged",
"(",
"NotificationView",
"view",
",",
"View",
"contentView",
",",
"int",
"layoutId",
")",
"{",
"if",
"(",
"DBG",
")",
"Log",
".",
"v",
"(",
"TAG",
",",
"\"onContentViewChanged\"",
")",
";",
"ChildViewManager",
"mgr",
... | Called when content view is changed. All child-views were cleared due the
change of content view. You need to re-setup the associated child-views.
@param view
@param contentView
@param layoutId | [
"Called",
"when",
"content",
"view",
"is",
"changed",
".",
"All",
"child",
"-",
"views",
"were",
"cleared",
"due",
"the",
"change",
"of",
"content",
"view",
".",
"You",
"need",
"to",
"re",
"-",
"setup",
"the",
"associated",
"child",
"-",
"views",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationViewCallback.java#L72-L97 |
Sciss/abc4j | abc/src/main/java/abc/parser/AbcGrammar.java | AbcGrammar.Tex | Rule Tex() {
"""
tex ::= "\" *(VCHAR / WSP) eol
<p>deprecated - kept only for backward compatibility with abc2mtex
"""
return Sequence('\\', ZeroOrMore(FirstOf(VCHAR(), WSP())), Eol())
.label(Tex);
} | java | Rule Tex() {
return Sequence('\\', ZeroOrMore(FirstOf(VCHAR(), WSP())), Eol())
.label(Tex);
} | [
"Rule",
"Tex",
"(",
")",
"{",
"return",
"Sequence",
"(",
"'",
"'",
",",
"ZeroOrMore",
"(",
"FirstOf",
"(",
"VCHAR",
"(",
")",
",",
"WSP",
"(",
")",
")",
")",
",",
"Eol",
"(",
")",
")",
".",
"label",
"(",
"Tex",
")",
";",
"}"
] | tex ::= "\" *(VCHAR / WSP) eol
<p>deprecated - kept only for backward compatibility with abc2mtex | [
"tex",
"::",
"=",
"\\",
"*",
"(",
"VCHAR",
"/",
"WSP",
")",
"eol",
"<p",
">",
"deprecated",
"-",
"kept",
"only",
"for",
"backward",
"compatibility",
"with",
"abc2mtex"
] | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L2510-L2513 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java | QueryReferenceBroker.retrieveCollections | public void retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException {
"""
Retrieve all Collection attributes of a given instance
@param newObj the instance to be loaded or refreshed
@param cld the ClassDescriptor of the instance
@param forced if set to true, loading is forced even if cld differs
"""
doRetrieveCollections(newObj, cld, forced, false);
} | java | public void retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException
{
doRetrieveCollections(newObj, cld, forced, false);
} | [
"public",
"void",
"retrieveCollections",
"(",
"Object",
"newObj",
",",
"ClassDescriptor",
"cld",
",",
"boolean",
"forced",
")",
"throws",
"PersistenceBrokerException",
"{",
"doRetrieveCollections",
"(",
"newObj",
",",
"cld",
",",
"forced",
",",
"false",
")",
";",
... | Retrieve all Collection attributes of a given instance
@param newObj the instance to be loaded or refreshed
@param cld the ClassDescriptor of the instance
@param forced if set to true, loading is forced even if cld differs | [
"Retrieve",
"all",
"Collection",
"attributes",
"of",
"a",
"given",
"instance"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L938-L941 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/UriResourcePathUtils.java | UriResourcePathUtils.updateUriHost | public static URI updateUriHost(URI uri, String newHostPrefix) {
"""
Creates a new {@link URI} from the given URI by replacing the host value.
@param uri Original URI
@param newHostPrefix New host for the uri
"""
try {
return new URI(uri.getScheme(), uri.getUserInfo(), newHostPrefix + uri.getHost(),
uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
} | java | public static URI updateUriHost(URI uri, String newHostPrefix) {
try {
return new URI(uri.getScheme(), uri.getUserInfo(), newHostPrefix + uri.getHost(),
uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"URI",
"updateUriHost",
"(",
"URI",
"uri",
",",
"String",
"newHostPrefix",
")",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"uri",
".",
"getScheme",
"(",
")",
",",
"uri",
".",
"getUserInfo",
"(",
")",
",",
"newHostPrefix",
"+",
"u... | Creates a new {@link URI} from the given URI by replacing the host value.
@param uri Original URI
@param newHostPrefix New host for the uri | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/UriResourcePathUtils.java#L60-L67 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java | ObjectEnvelopeTable.replaceRegisteredIdentity | boolean replaceRegisteredIdentity(Identity newOid, Identity oldOid) {
"""
Replace the {@link org.apache.ojb.broker.Identity}
of a registered {@link ObjectEnvelope} object.
@param newOid
@param oldOid
@return Returns <em>true</em> if successful.
"""
/*
TODO: Find a better solution
*/
boolean result = false;
Object oe = mhtObjectEnvelopes.remove(oldOid);
if(oe != null)
{
mhtObjectEnvelopes.put(newOid, oe);
int index = mvOrderOfIds.indexOf(oldOid);
mvOrderOfIds.remove(index);
mvOrderOfIds.add(index, newOid);
result = true;
if(log.isDebugEnabled()) log.debug("Replace identity: " + oldOid + " --replaced-by--> " + newOid);
}
else
{
log.warn("Can't replace unregistered object identity (" + oldOid + ") with new identity (" + newOid + ")");
}
return result;
} | java | boolean replaceRegisteredIdentity(Identity newOid, Identity oldOid)
{
/*
TODO: Find a better solution
*/
boolean result = false;
Object oe = mhtObjectEnvelopes.remove(oldOid);
if(oe != null)
{
mhtObjectEnvelopes.put(newOid, oe);
int index = mvOrderOfIds.indexOf(oldOid);
mvOrderOfIds.remove(index);
mvOrderOfIds.add(index, newOid);
result = true;
if(log.isDebugEnabled()) log.debug("Replace identity: " + oldOid + " --replaced-by--> " + newOid);
}
else
{
log.warn("Can't replace unregistered object identity (" + oldOid + ") with new identity (" + newOid + ")");
}
return result;
} | [
"boolean",
"replaceRegisteredIdentity",
"(",
"Identity",
"newOid",
",",
"Identity",
"oldOid",
")",
"{",
"/*\r\n TODO: Find a better solution\r\n */",
"boolean",
"result",
"=",
"false",
";",
"Object",
"oe",
"=",
"mhtObjectEnvelopes",
".",
"remove",
"(",
"ol... | Replace the {@link org.apache.ojb.broker.Identity}
of a registered {@link ObjectEnvelope} object.
@param newOid
@param oldOid
@return Returns <em>true</em> if successful. | [
"Replace",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"ojb",
".",
"broker",
".",
"Identity",
"}",
"of",
"a",
"registered",
"{",
"@link",
"ObjectEnvelope",
"}",
"object",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L825-L846 |
kumuluz/kumuluzee | tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java | EeClassLoader.definePackage | private void definePackage(String className, JarEntryInfo jarEntryInfo) throws IllegalArgumentException {
"""
The default <code>ClassLoader.defineClass()</code> does not create package
for the loaded class and leaves it null. Each package referenced by this
class loader must be created only once before the
<code>ClassLoader.defineClass()</code> call.
The base class <code>ClassLoader</code> keeps cache with created packages
for reuse.
@param className class to load.
@throws IllegalArgumentException
If package name duplicates an existing package either in this
class loader or one of its ancestors.
"""
int index = className.lastIndexOf('.');
String packageName = index > 0 ? className.substring(0, index) : "";
if (getPackage(packageName) == null) {
JarFileInfo jarFileInfo = jarEntryInfo.getJarFileInfo();
definePackage(
packageName, jarFileInfo.getSpecificationTitle(), jarFileInfo.getSpecificationVersion(),
jarFileInfo.getSpecificationVendor(), jarFileInfo.getImplementationTitle(),
jarFileInfo.getImplementationVersion(), jarFileInfo.getImplementationVendor(),
jarFileInfo.getSealURL()
);
}
} | java | private void definePackage(String className, JarEntryInfo jarEntryInfo) throws IllegalArgumentException {
int index = className.lastIndexOf('.');
String packageName = index > 0 ? className.substring(0, index) : "";
if (getPackage(packageName) == null) {
JarFileInfo jarFileInfo = jarEntryInfo.getJarFileInfo();
definePackage(
packageName, jarFileInfo.getSpecificationTitle(), jarFileInfo.getSpecificationVersion(),
jarFileInfo.getSpecificationVendor(), jarFileInfo.getImplementationTitle(),
jarFileInfo.getImplementationVersion(), jarFileInfo.getImplementationVendor(),
jarFileInfo.getSealURL()
);
}
} | [
"private",
"void",
"definePackage",
"(",
"String",
"className",
",",
"JarEntryInfo",
"jarEntryInfo",
")",
"throws",
"IllegalArgumentException",
"{",
"int",
"index",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"String",
"packageName",
"=",
"ind... | The default <code>ClassLoader.defineClass()</code> does not create package
for the loaded class and leaves it null. Each package referenced by this
class loader must be created only once before the
<code>ClassLoader.defineClass()</code> call.
The base class <code>ClassLoader</code> keeps cache with created packages
for reuse.
@param className class to load.
@throws IllegalArgumentException
If package name duplicates an existing package either in this
class loader or one of its ancestors. | [
"The",
"default",
"<code",
">",
"ClassLoader",
".",
"defineClass",
"()",
"<",
"/",
"code",
">",
"does",
"not",
"create",
"package",
"for",
"the",
"loaded",
"class",
"and",
"leaves",
"it",
"null",
".",
"Each",
"package",
"referenced",
"by",
"this",
"class",... | train | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java#L651-L663 |
alibaba/vlayout | vlayout/src/main/java/com/alibaba/android/vlayout/layout/BaseLayoutHelper.java | BaseLayoutHelper.nextView | @Nullable
public final View nextView(RecyclerView.Recycler recycler, LayoutStateWrapper layoutState, LayoutManagerHelper helper, LayoutChunkResult result) {
"""
Retrieve next view and add it into layout, this is to make sure that view are added by order
@param recycler recycler generate views
@param layoutState current layout state
@param helper helper to add views
@param result chunk result to tell layoutManager whether layout process goes end
@return next view to render, null if no more view available
"""
View view = layoutState.next(recycler);
if (view == null) {
// if we are laying out views in scrap, this may return null which means there is
// no more items to layout.
if (DEBUG && !layoutState.hasScrapList()) {
throw new RuntimeException("received null view when unexpected");
}
// if there is no more views can be retrieved, this layout process is finished
result.mFinished = true;
return null;
}
helper.addChildView(layoutState, view);
return view;
} | java | @Nullable
public final View nextView(RecyclerView.Recycler recycler, LayoutStateWrapper layoutState, LayoutManagerHelper helper, LayoutChunkResult result) {
View view = layoutState.next(recycler);
if (view == null) {
// if we are laying out views in scrap, this may return null which means there is
// no more items to layout.
if (DEBUG && !layoutState.hasScrapList()) {
throw new RuntimeException("received null view when unexpected");
}
// if there is no more views can be retrieved, this layout process is finished
result.mFinished = true;
return null;
}
helper.addChildView(layoutState, view);
return view;
} | [
"@",
"Nullable",
"public",
"final",
"View",
"nextView",
"(",
"RecyclerView",
".",
"Recycler",
"recycler",
",",
"LayoutStateWrapper",
"layoutState",
",",
"LayoutManagerHelper",
"helper",
",",
"LayoutChunkResult",
"result",
")",
"{",
"View",
"view",
"=",
"layoutState"... | Retrieve next view and add it into layout, this is to make sure that view are added by order
@param recycler recycler generate views
@param layoutState current layout state
@param helper helper to add views
@param result chunk result to tell layoutManager whether layout process goes end
@return next view to render, null if no more view available | [
"Retrieve",
"next",
"view",
"and",
"add",
"it",
"into",
"layout",
"this",
"is",
"to",
"make",
"sure",
"that",
"view",
"are",
"added",
"by",
"order"
] | train | https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/layout/BaseLayoutHelper.java#L114-L130 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java | CPDefinitionSpecificationOptionValuePersistenceImpl.findByCPOptionCategoryId | @Override
public List<CPDefinitionSpecificationOptionValue> findByCPOptionCategoryId(
long CPOptionCategoryId, int start, int end) {
"""
Returns a range of all the cp definition specification option values where CPOptionCategoryId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionSpecificationOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param CPOptionCategoryId the cp option category ID
@param start the lower bound of the range of cp definition specification option values
@param end the upper bound of the range of cp definition specification option values (not inclusive)
@return the range of matching cp definition specification option values
"""
return findByCPOptionCategoryId(CPOptionCategoryId, start, end, null);
} | java | @Override
public List<CPDefinitionSpecificationOptionValue> findByCPOptionCategoryId(
long CPOptionCategoryId, int start, int end) {
return findByCPOptionCategoryId(CPOptionCategoryId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionSpecificationOptionValue",
">",
"findByCPOptionCategoryId",
"(",
"long",
"CPOptionCategoryId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCPOptionCategoryId",
"(",
"CPOptionCategoryId",
",",
... | Returns a range of all the cp definition specification option values where CPOptionCategoryId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionSpecificationOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param CPOptionCategoryId the cp option category ID
@param start the lower bound of the range of cp definition specification option values
@param end the upper bound of the range of cp definition specification option values (not inclusive)
@return the range of matching cp definition specification option values | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"specification",
"option",
"values",
"where",
"CPOptionCategoryId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java#L3157-L3161 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.animateView | private void animateView(final int diff, final float animationSpeed,
@NonNull final AnimationListener animationListener,
@NonNull final Interpolator interpolator) {
"""
Animates the view to become shown or hidden.
@param diff
The distance the view has to be vertically moved by, as an {@link Integer} value
@param animationSpeed
The speed of the animation in pixels per millisecond as a {@link Float} value
@param animationListener
The listener, which should be notified about the animation's progress, as an instance
of the type {@link AnimationListener}. The listener may not be null
@param interpolator
The interpolator, which should be used by the animation, as an instance of the type
{@link Interpolator}. The interpolator may not be null
"""
if (!isDragging() && !isAnimationRunning()) {
long duration = calculateAnimationDuration(diff, animationSpeed);
Animation animation =
new DraggableViewAnimation(this, diff, duration, animationListener);
animation.setInterpolator(interpolator);
startAnimation(animation);
}
} | java | private void animateView(final int diff, final float animationSpeed,
@NonNull final AnimationListener animationListener,
@NonNull final Interpolator interpolator) {
if (!isDragging() && !isAnimationRunning()) {
long duration = calculateAnimationDuration(diff, animationSpeed);
Animation animation =
new DraggableViewAnimation(this, diff, duration, animationListener);
animation.setInterpolator(interpolator);
startAnimation(animation);
}
} | [
"private",
"void",
"animateView",
"(",
"final",
"int",
"diff",
",",
"final",
"float",
"animationSpeed",
",",
"@",
"NonNull",
"final",
"AnimationListener",
"animationListener",
",",
"@",
"NonNull",
"final",
"Interpolator",
"interpolator",
")",
"{",
"if",
"(",
"!"... | Animates the view to become shown or hidden.
@param diff
The distance the view has to be vertically moved by, as an {@link Integer} value
@param animationSpeed
The speed of the animation in pixels per millisecond as a {@link Float} value
@param animationListener
The listener, which should be notified about the animation's progress, as an instance
of the type {@link AnimationListener}. The listener may not be null
@param interpolator
The interpolator, which should be used by the animation, as an instance of the type
{@link Interpolator}. The interpolator may not be null | [
"Animates",
"the",
"view",
"to",
"become",
"shown",
"or",
"hidden",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L294-L304 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java | SimpleMMcifConsumer.addInformationFromESG | private void addInformationFromESG(EntitySrcGen entitySrcInfo, int entityId, EntityInfo c) {
"""
Add the information from an ESG to a compound.
@param entitySrcInfo
@param entityId
@param c
"""
c.setAtcc(entitySrcInfo.getPdbx_gene_src_atcc());
c.setCell(entitySrcInfo.getPdbx_gene_src_cell());
c.setOrganismCommon(entitySrcInfo.getGene_src_common_name());
c.setOrganismScientific(entitySrcInfo.getPdbx_gene_src_scientific_name());
c.setOrganismTaxId(entitySrcInfo.getPdbx_gene_src_ncbi_taxonomy_id());
c.setExpressionSystemTaxId(entitySrcInfo.getPdbx_host_org_ncbi_taxonomy_id());
c.setExpressionSystem(entitySrcInfo.getPdbx_host_org_scientific_name());
} | java | private void addInformationFromESG(EntitySrcGen entitySrcInfo, int entityId, EntityInfo c) {
c.setAtcc(entitySrcInfo.getPdbx_gene_src_atcc());
c.setCell(entitySrcInfo.getPdbx_gene_src_cell());
c.setOrganismCommon(entitySrcInfo.getGene_src_common_name());
c.setOrganismScientific(entitySrcInfo.getPdbx_gene_src_scientific_name());
c.setOrganismTaxId(entitySrcInfo.getPdbx_gene_src_ncbi_taxonomy_id());
c.setExpressionSystemTaxId(entitySrcInfo.getPdbx_host_org_ncbi_taxonomy_id());
c.setExpressionSystem(entitySrcInfo.getPdbx_host_org_scientific_name());
} | [
"private",
"void",
"addInformationFromESG",
"(",
"EntitySrcGen",
"entitySrcInfo",
",",
"int",
"entityId",
",",
"EntityInfo",
"c",
")",
"{",
"c",
".",
"setAtcc",
"(",
"entitySrcInfo",
".",
"getPdbx_gene_src_atcc",
"(",
")",
")",
";",
"c",
".",
"setCell",
"(",
... | Add the information from an ESG to a compound.
@param entitySrcInfo
@param entityId
@param c | [
"Add",
"the",
"information",
"from",
"an",
"ESG",
"to",
"a",
"compound",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L1196-L1204 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/AbstractFsCheckpointStorage.java | AbstractFsCheckpointStorage.initializeLocationForSavepoint | @Override
public CheckpointStorageLocation initializeLocationForSavepoint(
@SuppressWarnings("unused") long checkpointId,
@Nullable String externalLocationPointer) throws IOException {
"""
Creates a file system based storage location for a savepoint.
<p>This methods implements the logic that decides which location to use (given optional
parameters for a configured location and a location passed for this specific savepoint)
and how to name and initialize the savepoint directory.
@param externalLocationPointer The target location pointer for the savepoint.
Must be a valid URI. Null, if not supplied.
@param checkpointId The checkpoint ID of the savepoint.
@return The checkpoint storage location for the savepoint.
@throws IOException Thrown if the target directory could not be created.
"""
// determine where to write the savepoint to
final Path savepointBasePath;
if (externalLocationPointer != null) {
savepointBasePath = new Path(externalLocationPointer);
}
else if (defaultSavepointDirectory != null) {
savepointBasePath = defaultSavepointDirectory;
}
else {
throw new IllegalArgumentException("No savepoint location given and no default location configured.");
}
// generate the savepoint directory
final FileSystem fs = savepointBasePath.getFileSystem();
final String prefix = "savepoint-" + jobId.toString().substring(0, 6) + '-';
Exception latestException = null;
for (int attempt = 0; attempt < 10; attempt++) {
final Path path = new Path(savepointBasePath, FileUtils.getRandomFilename(prefix));
try {
if (fs.mkdirs(path)) {
// we make the path qualified, to make it independent of default schemes and authorities
final Path qp = path.makeQualified(fs);
return createSavepointLocation(fs, qp);
}
} catch (Exception e) {
latestException = e;
}
}
throw new IOException("Failed to create savepoint directory at " + savepointBasePath, latestException);
} | java | @Override
public CheckpointStorageLocation initializeLocationForSavepoint(
@SuppressWarnings("unused") long checkpointId,
@Nullable String externalLocationPointer) throws IOException {
// determine where to write the savepoint to
final Path savepointBasePath;
if (externalLocationPointer != null) {
savepointBasePath = new Path(externalLocationPointer);
}
else if (defaultSavepointDirectory != null) {
savepointBasePath = defaultSavepointDirectory;
}
else {
throw new IllegalArgumentException("No savepoint location given and no default location configured.");
}
// generate the savepoint directory
final FileSystem fs = savepointBasePath.getFileSystem();
final String prefix = "savepoint-" + jobId.toString().substring(0, 6) + '-';
Exception latestException = null;
for (int attempt = 0; attempt < 10; attempt++) {
final Path path = new Path(savepointBasePath, FileUtils.getRandomFilename(prefix));
try {
if (fs.mkdirs(path)) {
// we make the path qualified, to make it independent of default schemes and authorities
final Path qp = path.makeQualified(fs);
return createSavepointLocation(fs, qp);
}
} catch (Exception e) {
latestException = e;
}
}
throw new IOException("Failed to create savepoint directory at " + savepointBasePath, latestException);
} | [
"@",
"Override",
"public",
"CheckpointStorageLocation",
"initializeLocationForSavepoint",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"long",
"checkpointId",
",",
"@",
"Nullable",
"String",
"externalLocationPointer",
")",
"throws",
"IOException",
"{",
"// determ... | Creates a file system based storage location for a savepoint.
<p>This methods implements the logic that decides which location to use (given optional
parameters for a configured location and a location passed for this specific savepoint)
and how to name and initialize the savepoint directory.
@param externalLocationPointer The target location pointer for the savepoint.
Must be a valid URI. Null, if not supplied.
@param checkpointId The checkpoint ID of the savepoint.
@return The checkpoint storage location for the savepoint.
@throws IOException Thrown if the target directory could not be created. | [
"Creates",
"a",
"file",
"system",
"based",
"storage",
"location",
"for",
"a",
"savepoint",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/AbstractFsCheckpointStorage.java#L127-L167 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.deleteFromTask | public void deleteFromTask(String jobId, String taskId, String filePath) {
"""
Deletes the specified task file from the compute node where the task ran.
@param jobId The ID of the job that contains the task.
@param taskId The ID of the task whose file you want to delete.
@param filePath The path to the task file or directory that you want to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath).toBlocking().single().body();
} | java | public void deleteFromTask(String jobId, String taskId, String filePath) {
deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath).toBlocking().single().body();
} | [
"public",
"void",
"deleteFromTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
",",
"String",
"filePath",
")",
"{",
"deleteFromTaskWithServiceResponseAsync",
"(",
"jobId",
",",
"taskId",
",",
"filePath",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"... | Deletes the specified task file from the compute node where the task ran.
@param jobId The ID of the job that contains the task.
@param taskId The ID of the task whose file you want to delete.
@param filePath The path to the task file or directory that you want to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"task",
"file",
"from",
"the",
"compute",
"node",
"where",
"the",
"task",
"ran",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L145-L147 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java | XMLResource.postQuery | @POST
@Consumes(APPLICATION_QUERY_XML)
public Response postQuery(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream input) {
"""
This method will be called when a HTTP client sends a POST request to an
existing resource with 'application/query+xml' as Content-Type.
@param system
The implementation system.
@param resource
The resource name.
@param input
The input stream.
@param headers
HTTP header attributes.
@return The {@link Response} which can be empty when no response is
expected. Otherwise it holds the response XML file.
"""
return postQuery(system, input, resource, headers);
} | java | @POST
@Consumes(APPLICATION_QUERY_XML)
public Response postQuery(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream input) {
return postQuery(system, input, resource, headers);
} | [
"@",
"POST",
"@",
"Consumes",
"(",
"APPLICATION_QUERY_XML",
")",
"public",
"Response",
"postQuery",
"(",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"SYSTEM",
")",
"final",
"String",
"system",
",",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"RESOURCE",
")... | This method will be called when a HTTP client sends a POST request to an
existing resource with 'application/query+xml' as Content-Type.
@param system
The implementation system.
@param resource
The resource name.
@param input
The input stream.
@param headers
HTTP header attributes.
@return The {@link Response} which can be empty when no response is
expected. Otherwise it holds the response XML file. | [
"This",
"method",
"will",
"be",
"called",
"when",
"a",
"HTTP",
"client",
"sends",
"a",
"POST",
"request",
"to",
"an",
"existing",
"resource",
"with",
"application",
"/",
"query",
"+",
"xml",
"as",
"Content",
"-",
"Type",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java#L100-L106 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/premiumrateservice/GetAllPremiumRates.java | GetAllPremiumRates.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
"""
Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.
"""
// Get the PremiumRateService.
PremiumRateServiceInterface premiumRateService =
adManagerServices.get(session, PremiumRateServiceInterface.class);
// Create a statement to get all premium rates.
StatementBuilder statementBuilder =
new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get premium rates by statement.
PremiumRatePage page =
premiumRateService.getPremiumRatesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (PremiumRate premiumRate : page.getResults()) {
System.out.printf(
"%d) Premium rate with ID %d of type '%s' assigned to rate card with ID %d "
+ "was found.%n",
i++,
premiumRate.getId(),
premiumRate.getPremiumFeature().getClass().getSimpleName(),
premiumRate.getRateCardId());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the PremiumRateService.
PremiumRateServiceInterface premiumRateService =
adManagerServices.get(session, PremiumRateServiceInterface.class);
// Create a statement to get all premium rates.
StatementBuilder statementBuilder =
new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get premium rates by statement.
PremiumRatePage page =
premiumRateService.getPremiumRatesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (PremiumRate premiumRate : page.getResults()) {
System.out.printf(
"%d) Premium rate with ID %d of type '%s' assigned to rate card with ID %d "
+ "was found.%n",
i++,
premiumRate.getId(),
premiumRate.getPremiumFeature().getClass().getSimpleName(),
premiumRate.getRateCardId());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the PremiumRateService.",
"PremiumRateServiceInterface",
"premiumRateService",
"=",
"adManagerServices",
"... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/premiumrateservice/GetAllPremiumRates.java#L51-L87 |
samskivert/samskivert | src/main/java/com/samskivert/util/ObserverList.java | ObserverList.checkedApply | protected boolean checkedApply (ObserverOp<T> obop, T obs) {
"""
Applies the operation to the observer, catching and logging any exceptions thrown in the
process.
"""
try {
return obop.apply(obs);
} catch (Throwable thrown) {
log.warning("ObserverOp choked during notification",
"op", obop, "obs", observerForLog(obs), thrown);
// if they booched it, definitely don't remove them
return true;
}
} | java | protected boolean checkedApply (ObserverOp<T> obop, T obs)
{
try {
return obop.apply(obs);
} catch (Throwable thrown) {
log.warning("ObserverOp choked during notification",
"op", obop, "obs", observerForLog(obs), thrown);
// if they booched it, definitely don't remove them
return true;
}
} | [
"protected",
"boolean",
"checkedApply",
"(",
"ObserverOp",
"<",
"T",
">",
"obop",
",",
"T",
"obs",
")",
"{",
"try",
"{",
"return",
"obop",
".",
"apply",
"(",
"obs",
")",
";",
"}",
"catch",
"(",
"Throwable",
"thrown",
")",
"{",
"log",
".",
"warning",
... | Applies the operation to the observer, catching and logging any exceptions thrown in the
process. | [
"Applies",
"the",
"operation",
"to",
"the",
"observer",
"catching",
"and",
"logging",
"any",
"exceptions",
"thrown",
"in",
"the",
"process",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ObserverList.java#L198-L208 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java | TimePickerDialog.setTimeInterval | @SuppressWarnings("SameParameterValue")
public void setTimeInterval(@IntRange(from=1, to=24) int hourInterval,
@IntRange(from=1, to=60) int minuteInterval) {
"""
Set the interval for selectable times in the TimePickerDialog
This is a convenience wrapper around setSelectableTimes
The interval for all three time components can be set independently
If you are not using the seconds / minutes picker, set the respective item to 60 for
better performance.
@param hourInterval The interval between 2 selectable hours ([1,24])
@param minuteInterval The interval between 2 selectable minutes ([1,60])
"""
setTimeInterval(hourInterval, minuteInterval, 60);
} | java | @SuppressWarnings("SameParameterValue")
public void setTimeInterval(@IntRange(from=1, to=24) int hourInterval,
@IntRange(from=1, to=60) int minuteInterval) {
setTimeInterval(hourInterval, minuteInterval, 60);
} | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"public",
"void",
"setTimeInterval",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"1",
",",
"to",
"=",
"24",
")",
"int",
"hourInterval",
",",
"@",
"IntRange",
"(",
"from",
"=",
"1",
",",
"to",
"=",
... | Set the interval for selectable times in the TimePickerDialog
This is a convenience wrapper around setSelectableTimes
The interval for all three time components can be set independently
If you are not using the seconds / minutes picker, set the respective item to 60 for
better performance.
@param hourInterval The interval between 2 selectable hours ([1,24])
@param minuteInterval The interval between 2 selectable minutes ([1,60]) | [
"Set",
"the",
"interval",
"for",
"selectable",
"times",
"in",
"the",
"TimePickerDialog",
"This",
"is",
"a",
"convenience",
"wrapper",
"around",
"setSelectableTimes",
"The",
"interval",
"for",
"all",
"three",
"time",
"components",
"can",
"be",
"set",
"independently... | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L458-L462 |
aws/aws-sdk-java | aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/SetEndpointAttributesRequest.java | SetEndpointAttributesRequest.withAttributes | public SetEndpointAttributesRequest withAttributes(java.util.Map<String, String> attributes) {
"""
<p>
A map of the endpoint attributes. Attributes in this map include the following:
</p>
<ul>
<li>
<p>
<code>CustomUserData</code> – arbitrary user data to associate with the endpoint. Amazon SNS does not use this
data. The data must be in UTF-8 format and less than 2KB.
</p>
</li>
<li>
<p>
<code>Enabled</code> – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to false
when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it back to true,
typically after updating Token.
</p>
</li>
<li>
<p>
<code>Token</code> – device token, also referred to as a registration id, for an app and mobile device. This is
returned from the notification service when an app and mobile device are registered with the notification
service.
</p>
</li>
</ul>
@param attributes
A map of the endpoint attributes. Attributes in this map include the following:</p>
<ul>
<li>
<p>
<code>CustomUserData</code> – arbitrary user data to associate with the endpoint. Amazon SNS does not use
this data. The data must be in UTF-8 format and less than 2KB.
</p>
</li>
<li>
<p>
<code>Enabled</code> – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to
false when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it
back to true, typically after updating Token.
</p>
</li>
<li>
<p>
<code>Token</code> – device token, also referred to as a registration id, for an app and mobile device.
This is returned from the notification service when an app and mobile device are registered with the
notification service.
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together.
"""
setAttributes(attributes);
return this;
} | java | public SetEndpointAttributesRequest withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"SetEndpointAttributesRequest",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of the endpoint attributes. Attributes in this map include the following:
</p>
<ul>
<li>
<p>
<code>CustomUserData</code> – arbitrary user data to associate with the endpoint. Amazon SNS does not use this
data. The data must be in UTF-8 format and less than 2KB.
</p>
</li>
<li>
<p>
<code>Enabled</code> – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to false
when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it back to true,
typically after updating Token.
</p>
</li>
<li>
<p>
<code>Token</code> – device token, also referred to as a registration id, for an app and mobile device. This is
returned from the notification service when an app and mobile device are registered with the notification
service.
</p>
</li>
</ul>
@param attributes
A map of the endpoint attributes. Attributes in this map include the following:</p>
<ul>
<li>
<p>
<code>CustomUserData</code> – arbitrary user data to associate with the endpoint. Amazon SNS does not use
this data. The data must be in UTF-8 format and less than 2KB.
</p>
</li>
<li>
<p>
<code>Enabled</code> – flag that enables/disables delivery to the endpoint. Amazon SNS will set this to
false when a notification service indicates to Amazon SNS that the endpoint is invalid. Users can set it
back to true, typically after updating Token.
</p>
</li>
<li>
<p>
<code>Token</code> – device token, also referred to as a registration id, for an app and mobile device.
This is returned from the notification service when an app and mobile device are registered with the
notification service.
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"the",
"endpoint",
"attributes",
".",
"Attributes",
"in",
"this",
"map",
"include",
"the",
"following",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"<p",
">",
"<code",
">",
"CustomUserData<",
"/",
"code",
">",
"–",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/SetEndpointAttributesRequest.java#L273-L276 |
jbundle/jbundle | base/model/src/main/java/org/jbundle/base/model/Utility.java | Utility.replaceResources | public static StringBuilder replaceResources(StringBuilder sb, ResourceBundle reg, Map<String, Object> map, PropertyOwner propertyOwner) {
"""
Replace the {} resources in this string.
Typically either reg or map are non-null (the null one is ignored)
@param reg A resource bundle
@param map A map of key/values
@param strResource
@return
"""
return Utility.replaceResources(sb, reg, map, propertyOwner, false);
} | java | public static StringBuilder replaceResources(StringBuilder sb, ResourceBundle reg, Map<String, Object> map, PropertyOwner propertyOwner)
{
return Utility.replaceResources(sb, reg, map, propertyOwner, false);
} | [
"public",
"static",
"StringBuilder",
"replaceResources",
"(",
"StringBuilder",
"sb",
",",
"ResourceBundle",
"reg",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"PropertyOwner",
"propertyOwner",
")",
"{",
"return",
"Utility",
".",
"replaceResources",
... | Replace the {} resources in this string.
Typically either reg or map are non-null (the null one is ignored)
@param reg A resource bundle
@param map A map of key/values
@param strResource
@return | [
"Replace",
"the",
"{}",
"resources",
"in",
"this",
"string",
".",
"Typically",
"either",
"reg",
"or",
"map",
"are",
"non",
"-",
"null",
"(",
"the",
"null",
"one",
"is",
"ignored",
")"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L211-L214 |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java | CalendarFormatterBase.formatTimeZone_Z | void formatTimeZone_Z(StringBuilder b, ZonedDateTime d, int width) {
"""
Format time zone in ISO8601 basic or extended format for field 'Z'.
http://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
"""
if (width == 4) {
// ZZZZ is same as OOOO
formatTimeZone_O(b, d, width);
return;
}
int[] tz = getTzComponents(d);
if (width == 5 && tz[TZOFFSET] == 0) {
b.append('Z');
return;
}
switch (width) {
case 5:
case 3:
case 2:
case 1:
if (tz[TZNEG] == -1) {
b.append('-');
} else {
b.append('+');
}
zeroPad2(b, tz[TZHOURS], 2);
// Delimiter omitted for all except XXXXX
if (width == 5) {
b.append(':');
}
zeroPad2(b, tz[TZMINS], 2);
break;
}
} | java | void formatTimeZone_Z(StringBuilder b, ZonedDateTime d, int width) {
if (width == 4) {
// ZZZZ is same as OOOO
formatTimeZone_O(b, d, width);
return;
}
int[] tz = getTzComponents(d);
if (width == 5 && tz[TZOFFSET] == 0) {
b.append('Z');
return;
}
switch (width) {
case 5:
case 3:
case 2:
case 1:
if (tz[TZNEG] == -1) {
b.append('-');
} else {
b.append('+');
}
zeroPad2(b, tz[TZHOURS], 2);
// Delimiter omitted for all except XXXXX
if (width == 5) {
b.append(':');
}
zeroPad2(b, tz[TZMINS], 2);
break;
}
} | [
"void",
"formatTimeZone_Z",
"(",
"StringBuilder",
"b",
",",
"ZonedDateTime",
"d",
",",
"int",
"width",
")",
"{",
"if",
"(",
"width",
"==",
"4",
")",
"{",
"// ZZZZ is same as OOOO",
"formatTimeZone_O",
"(",
"b",
",",
"d",
",",
"width",
")",
";",
"return",
... | Format time zone in ISO8601 basic or extended format for field 'Z'.
http://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone | [
"Format",
"time",
"zone",
"in",
"ISO8601",
"basic",
"or",
"extended",
"format",
"for",
"field",
"Z",
".",
"http",
":",
"//",
"www",
".",
"unicode",
".",
"org",
"/",
"reports",
"/",
"tr35",
"/",
"tr35",
"-",
"dates",
".",
"html#dfst",
"-",
"zone"
] | train | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L967-L999 |
codescape/bitvunit | bitvunit-core/src/main/java/de/codescape/bitvunit/BitvUnit.java | BitvUnit.assertAccessibility | public static void assertAccessibility(WebDriver webDriver, Testable testable) {
"""
JUnit Assertion to verify a {@link org.openqa.selenium.WebDriver} instance for accessibility.
@param webDriver {@link org.openqa.selenium.WebDriver} instance
@param testable rule(s) to apply
"""
assertThat(webDriver, is(compliantTo(testable)));
} | java | public static void assertAccessibility(WebDriver webDriver, Testable testable) {
assertThat(webDriver, is(compliantTo(testable)));
} | [
"public",
"static",
"void",
"assertAccessibility",
"(",
"WebDriver",
"webDriver",
",",
"Testable",
"testable",
")",
"{",
"assertThat",
"(",
"webDriver",
",",
"is",
"(",
"compliantTo",
"(",
"testable",
")",
")",
")",
";",
"}"
] | JUnit Assertion to verify a {@link org.openqa.selenium.WebDriver} instance for accessibility.
@param webDriver {@link org.openqa.selenium.WebDriver} instance
@param testable rule(s) to apply | [
"JUnit",
"Assertion",
"to",
"verify",
"a",
"{",
"@link",
"org",
".",
"openqa",
".",
"selenium",
".",
"WebDriver",
"}",
"instance",
"for",
"accessibility",
"."
] | train | https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/BitvUnit.java#L38-L40 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/content/ContentProviderUtils.java | ContentProviderUtils.notifyChange | public static void notifyChange(Context context, Uri uri, ContentObserver observer) {
"""
Notify data-set change to the observer.
@param context the context, must not be null.
@param uri the changed uri.
@param observer the observer, can be null.
"""
ContentResolver resolver = context.getContentResolver();
resolver.notifyChange(uri, observer);
} | java | public static void notifyChange(Context context, Uri uri, ContentObserver observer) {
ContentResolver resolver = context.getContentResolver();
resolver.notifyChange(uri, observer);
} | [
"public",
"static",
"void",
"notifyChange",
"(",
"Context",
"context",
",",
"Uri",
"uri",
",",
"ContentObserver",
"observer",
")",
"{",
"ContentResolver",
"resolver",
"=",
"context",
".",
"getContentResolver",
"(",
")",
";",
"resolver",
".",
"notifyChange",
"(",... | Notify data-set change to the observer.
@param context the context, must not be null.
@param uri the changed uri.
@param observer the observer, can be null. | [
"Notify",
"data",
"-",
"set",
"change",
"to",
"the",
"observer",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContentProviderUtils.java#L67-L70 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java | KeysAndAttributes.withKeys | public KeysAndAttributes withKeys(java.util.Map<String, AttributeValue>... keys) {
"""
<p>
The primary key attribute values that define the items and the attributes associated with the items.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setKeys(java.util.Collection)} or {@link #withKeys(java.util.Collection)} if you want to override the
existing values.
</p>
@param keys
The primary key attribute values that define the items and the attributes associated with the items.
@return Returns a reference to this object so that method calls can be chained together.
"""
if (this.keys == null) {
setKeys(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys.length));
}
for (java.util.Map<String, AttributeValue> ele : keys) {
this.keys.add(ele);
}
return this;
} | java | public KeysAndAttributes withKeys(java.util.Map<String, AttributeValue>... keys) {
if (this.keys == null) {
setKeys(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys.length));
}
for (java.util.Map<String, AttributeValue> ele : keys) {
this.keys.add(ele);
}
return this;
} | [
"public",
"KeysAndAttributes",
"withKeys",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"...",
"keys",
")",
"{",
"if",
"(",
"this",
".",
"keys",
"==",
"null",
")",
"{",
"setKeys",
"(",
"new",
"java",
".",
"util",
"... | <p>
The primary key attribute values that define the items and the attributes associated with the items.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setKeys(java.util.Collection)} or {@link #withKeys(java.util.Collection)} if you want to override the
existing values.
</p>
@param keys
The primary key attribute values that define the items and the attributes associated with the items.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"primary",
"key",
"attribute",
"values",
"that",
"define",
"the",
"items",
"and",
"the",
"attributes",
"associated",
"with",
"the",
"items",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"This",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java#L190-L198 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/management/CronUtils.java | CronUtils.unpackSchedule | public static String unpackSchedule(String sauronExpr) {
"""
Converting valid SauronSoftware cron expression to valid Quartz one.
The conversions are the following:
<ul><li>add "seconds" part;</li>
<li>numbers in "day of week" started from 1, not from 0 as in Sauron;</li>
<li>"*/interval" items converted to
"/interval" items;</li>
<li>one of date and day of week should be a question mark.</li>
</ul>
@param sauronExpr Valid SauronSoftware cron expression
@return Similar Quartz cron expression
"""
if (sauronExpr == null) return null;
String[] exprElems = sauronExpr.trim().split("\\s+");
if (exprElems.length == 5) {
// 1. Increase number od days in "days of week"
exprElems[4] = increaseDoW(exprElems[4]);
// 2. Cut right end of an interval in repeating items
exprElems[0] = shrinkRepeating(exprElems[0], "0");
exprElems[1] = shrinkRepeating(exprElems[1], "0");
exprElems[2] = shrinkRepeating(exprElems[2], "1");
exprElems[3] = shrinkRepeating(exprElems[3], "1");
exprElems[4] = shrinkRepeating(exprElems[4], "SUN");
// 3. "Last" processing and question marks inserting
if (!"*".equals(exprElems[4])) {
if (exprElems[2].indexOf('L') >= 0 &&
exprElems[4].indexOf('-') == -1 &&
exprElems[4].indexOf('/') == -1) {
exprElems[4] = exprElems[4] + "L";
}
exprElems[2] = "?";
} else {
exprElems[4] = "?";
}
// 4. Add seconds part
return concat(' ', "0", exprElems[0], exprElems[1], exprElems[2], exprElems[3], exprElems[4]);
} else {
return sauronExpr;
}
} | java | public static String unpackSchedule(String sauronExpr) {
if (sauronExpr == null) return null;
String[] exprElems = sauronExpr.trim().split("\\s+");
if (exprElems.length == 5) {
// 1. Increase number od days in "days of week"
exprElems[4] = increaseDoW(exprElems[4]);
// 2. Cut right end of an interval in repeating items
exprElems[0] = shrinkRepeating(exprElems[0], "0");
exprElems[1] = shrinkRepeating(exprElems[1], "0");
exprElems[2] = shrinkRepeating(exprElems[2], "1");
exprElems[3] = shrinkRepeating(exprElems[3], "1");
exprElems[4] = shrinkRepeating(exprElems[4], "SUN");
// 3. "Last" processing and question marks inserting
if (!"*".equals(exprElems[4])) {
if (exprElems[2].indexOf('L') >= 0 &&
exprElems[4].indexOf('-') == -1 &&
exprElems[4].indexOf('/') == -1) {
exprElems[4] = exprElems[4] + "L";
}
exprElems[2] = "?";
} else {
exprElems[4] = "?";
}
// 4. Add seconds part
return concat(' ', "0", exprElems[0], exprElems[1], exprElems[2], exprElems[3], exprElems[4]);
} else {
return sauronExpr;
}
} | [
"public",
"static",
"String",
"unpackSchedule",
"(",
"String",
"sauronExpr",
")",
"{",
"if",
"(",
"sauronExpr",
"==",
"null",
")",
"return",
"null",
";",
"String",
"[",
"]",
"exprElems",
"=",
"sauronExpr",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\"\\\... | Converting valid SauronSoftware cron expression to valid Quartz one.
The conversions are the following:
<ul><li>add "seconds" part;</li>
<li>numbers in "day of week" started from 1, not from 0 as in Sauron;</li>
<li>"*/interval" items converted to
"/interval" items;</li>
<li>one of date and day of week should be a question mark.</li>
</ul>
@param sauronExpr Valid SauronSoftware cron expression
@return Similar Quartz cron expression | [
"Converting",
"valid",
"SauronSoftware",
"cron",
"expression",
"to",
"valid",
"Quartz",
"one",
".",
"The",
"conversions",
"are",
"the",
"following",
":",
"<ul",
">",
"<li",
">",
"add",
""",
";",
"seconds"",
";",
"part",
";",
"<",
"/",
"li",
">",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/management/CronUtils.java#L95-L123 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/basic/servicegroup_stats.java | servicegroup_stats.get | public static servicegroup_stats get(nitro_service service, String servicegroupname) throws Exception {
"""
Use this API to fetch statistics of servicegroup_stats resource of given name .
"""
servicegroup_stats obj = new servicegroup_stats();
obj.set_servicegroupname(servicegroupname);
servicegroup_stats response = (servicegroup_stats) obj.stat_resource(service);
return response;
} | java | public static servicegroup_stats get(nitro_service service, String servicegroupname) throws Exception{
servicegroup_stats obj = new servicegroup_stats();
obj.set_servicegroupname(servicegroupname);
servicegroup_stats response = (servicegroup_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"servicegroup_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"servicegroupname",
")",
"throws",
"Exception",
"{",
"servicegroup_stats",
"obj",
"=",
"new",
"servicegroup_stats",
"(",
")",
";",
"obj",
".",
"set_servicegroupname",
"(... | Use this API to fetch statistics of servicegroup_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"servicegroup_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/basic/servicegroup_stats.java#L149-L154 |
Azure/azure-sdk-for-java | applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java | EventsImpl.getByType | public EventsResults getByType(String appId, EventType eventType) {
"""
Execute OData query.
Executes an OData query for events.
@param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal.
@param eventType The type of events to query; either a standard event type (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or `$all` to query across all event types. Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', 'customMetrics'
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EventsResults object if successful.
"""
return getByTypeWithServiceResponseAsync(appId, eventType).toBlocking().single().body();
} | java | public EventsResults getByType(String appId, EventType eventType) {
return getByTypeWithServiceResponseAsync(appId, eventType).toBlocking().single().body();
} | [
"public",
"EventsResults",
"getByType",
"(",
"String",
"appId",
",",
"EventType",
"eventType",
")",
"{",
"return",
"getByTypeWithServiceResponseAsync",
"(",
"appId",
",",
"eventType",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",... | Execute OData query.
Executes an OData query for events.
@param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal.
@param eventType The type of events to query; either a standard event type (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or `$all` to query across all event types. Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', 'customMetrics'
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EventsResults object if successful. | [
"Execute",
"OData",
"query",
".",
"Executes",
"an",
"OData",
"query",
"for",
"events",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java#L78-L80 |
telly/groundy | library/src/main/java/com/telly/groundy/GroundyManager.java | GroundyManager.cancelTaskById | public static void cancelTaskById(Context context, final long id, final int reason,
final SingleCancelListener cancelListener,
Class<? extends GroundyService> groundyServiceClass) {
"""
Cancels all tasks of the specified group w/ the specified reason.
@param context used to interact with the service
@param id the value to cancel
@param cancelListener callback for cancel result
"""
if (id <= 0) {
throw new IllegalStateException("id must be greater than zero");
}
new GroundyServiceConnection(context, groundyServiceClass) {
@Override
protected void onGroundyServiceBound(GroundyService.GroundyServiceBinder binder) {
int result = binder.cancelTaskById(id, reason);
if (cancelListener != null) {
cancelListener.onCancelResult(id, result);
}
}
}.start();
} | java | public static void cancelTaskById(Context context, final long id, final int reason,
final SingleCancelListener cancelListener,
Class<? extends GroundyService> groundyServiceClass) {
if (id <= 0) {
throw new IllegalStateException("id must be greater than zero");
}
new GroundyServiceConnection(context, groundyServiceClass) {
@Override
protected void onGroundyServiceBound(GroundyService.GroundyServiceBinder binder) {
int result = binder.cancelTaskById(id, reason);
if (cancelListener != null) {
cancelListener.onCancelResult(id, result);
}
}
}.start();
} | [
"public",
"static",
"void",
"cancelTaskById",
"(",
"Context",
"context",
",",
"final",
"long",
"id",
",",
"final",
"int",
"reason",
",",
"final",
"SingleCancelListener",
"cancelListener",
",",
"Class",
"<",
"?",
"extends",
"GroundyService",
">",
"groundyServiceCla... | Cancels all tasks of the specified group w/ the specified reason.
@param context used to interact with the service
@param id the value to cancel
@param cancelListener callback for cancel result | [
"Cancels",
"all",
"tasks",
"of",
"the",
"specified",
"group",
"w",
"/",
"the",
"specified",
"reason",
"."
] | train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/GroundyManager.java#L99-L114 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelDataImpl.java | ChannelDataImpl.createChild | public ChildChannelDataImpl createChild() {
"""
Create a child data object. Add it to the list of children and return it.
@return child channel data object
"""
String childName = this.name + CHILD_STRING + nextChildId();
ChildChannelDataImpl child = new ChildChannelDataImpl(childName, this);
this.children.add(child);
return child;
} | java | public ChildChannelDataImpl createChild() {
String childName = this.name + CHILD_STRING + nextChildId();
ChildChannelDataImpl child = new ChildChannelDataImpl(childName, this);
this.children.add(child);
return child;
} | [
"public",
"ChildChannelDataImpl",
"createChild",
"(",
")",
"{",
"String",
"childName",
"=",
"this",
".",
"name",
"+",
"CHILD_STRING",
"+",
"nextChildId",
"(",
")",
";",
"ChildChannelDataImpl",
"child",
"=",
"new",
"ChildChannelDataImpl",
"(",
"childName",
",",
"... | Create a child data object. Add it to the list of children and return it.
@return child channel data object | [
"Create",
"a",
"child",
"data",
"object",
".",
"Add",
"it",
"to",
"the",
"list",
"of",
"children",
"and",
"return",
"it",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelDataImpl.java#L229-L234 |
ozimov/cirneco | hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDateWithTime.java | IsDateWithTime.hasHour | public static Matcher<Date> hasHour(final int hour, final ClockPeriod clockPeriod) {
"""
Creates a matcher that matches when the examined {@linkplain Date} has the given values <code>hour</code> and
<code>ClockPeriod</code> (e.g. <em>AM</em>).
"""
return new IsDateWithTime(hour, clockPeriod, null, null, null);
} | java | public static Matcher<Date> hasHour(final int hour, final ClockPeriod clockPeriod) {
return new IsDateWithTime(hour, clockPeriod, null, null, null);
} | [
"public",
"static",
"Matcher",
"<",
"Date",
">",
"hasHour",
"(",
"final",
"int",
"hour",
",",
"final",
"ClockPeriod",
"clockPeriod",
")",
"{",
"return",
"new",
"IsDateWithTime",
"(",
"hour",
",",
"clockPeriod",
",",
"null",
",",
"null",
",",
"null",
")",
... | Creates a matcher that matches when the examined {@linkplain Date} has the given values <code>hour</code> and
<code>ClockPeriod</code> (e.g. <em>AM</em>). | [
"Creates",
"a",
"matcher",
"that",
"matches",
"when",
"the",
"examined",
"{"
] | train | https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDateWithTime.java#L63-L65 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_account_accountName_delegation_accountId_GET | public OvhDelegation domain_account_accountName_delegation_accountId_GET(String domain, String accountName, String accountId) throws IOException {
"""
Get this object properties
REST: GET /email/domain/{domain}/account/{accountName}/delegation/{accountId}
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param accountId [required] OVH customer unique identifier
"""
String qPath = "/email/domain/{domain}/account/{accountName}/delegation/{accountId}";
StringBuilder sb = path(qPath, domain, accountName, accountId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDelegation.class);
} | java | public OvhDelegation domain_account_accountName_delegation_accountId_GET(String domain, String accountName, String accountId) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/delegation/{accountId}";
StringBuilder sb = path(qPath, domain, accountName, accountId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDelegation.class);
} | [
"public",
"OvhDelegation",
"domain_account_accountName_delegation_accountId_GET",
"(",
"String",
"domain",
",",
"String",
"accountName",
",",
"String",
"accountId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/account/{accountName}/delega... | Get this object properties
REST: GET /email/domain/{domain}/account/{accountName}/delegation/{accountId}
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param accountId [required] OVH customer unique identifier | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L575-L580 |
pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/LogMetadata.java | LogMetadata.asEnabled | LogMetadata asEnabled() {
"""
Returns a LogMetadata class with the exact contents of this instance, but the enabled flag set to true. No changes
are performed on this instance.
@return This instance, if isEnabled() == true, of a new instance of the LogMetadata class which will have
isEnabled() == true, otherwise.
"""
return this.enabled ? this : new LogMetadata(this.epoch, true, this.ledgers, this.truncationAddress, this.updateVersion.get());
} | java | LogMetadata asEnabled() {
return this.enabled ? this : new LogMetadata(this.epoch, true, this.ledgers, this.truncationAddress, this.updateVersion.get());
} | [
"LogMetadata",
"asEnabled",
"(",
")",
"{",
"return",
"this",
".",
"enabled",
"?",
"this",
":",
"new",
"LogMetadata",
"(",
"this",
".",
"epoch",
",",
"true",
",",
"this",
".",
"ledgers",
",",
"this",
".",
"truncationAddress",
",",
"this",
".",
"updateVers... | Returns a LogMetadata class with the exact contents of this instance, but the enabled flag set to true. No changes
are performed on this instance.
@return This instance, if isEnabled() == true, of a new instance of the LogMetadata class which will have
isEnabled() == true, otherwise. | [
"Returns",
"a",
"LogMetadata",
"class",
"with",
"the",
"exact",
"contents",
"of",
"this",
"instance",
"but",
"the",
"enabled",
"flag",
"set",
"to",
"true",
".",
"No",
"changes",
"are",
"performed",
"on",
"this",
"instance",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/LogMetadata.java#L243-L245 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.parseAbbrevForwardStep | private AbsAxis parseAbbrevForwardStep() {
"""
Parses the the rule AbrevForwardStep according to the following
production rule:
<p>
[31] AbbrevForwardStep ::= "@"? NodeTest .
</p>
@return FilterAxis
"""
AbsAxis axis;
boolean isAttribute;
if (is(TokenType.AT, true) || mToken.getContent().equals("attribute")
|| mToken.getContent().equals("schema-attribute")) {
// in case of .../attribute(..), or .../schema-attribute() the
// default
// axis
// is the attribute axis
axis = new AttributeAxis(getTransaction());
isAttribute = true;
} else {
// default axis is the child axis
axis = new ChildAxis(getTransaction());
isAttribute = false;
}
final AbsFilter filter = parseNodeTest(isAttribute);
return new FilterAxis(axis, mRTX, filter);
} | java | private AbsAxis parseAbbrevForwardStep() {
AbsAxis axis;
boolean isAttribute;
if (is(TokenType.AT, true) || mToken.getContent().equals("attribute")
|| mToken.getContent().equals("schema-attribute")) {
// in case of .../attribute(..), or .../schema-attribute() the
// default
// axis
// is the attribute axis
axis = new AttributeAxis(getTransaction());
isAttribute = true;
} else {
// default axis is the child axis
axis = new ChildAxis(getTransaction());
isAttribute = false;
}
final AbsFilter filter = parseNodeTest(isAttribute);
return new FilterAxis(axis, mRTX, filter);
} | [
"private",
"AbsAxis",
"parseAbbrevForwardStep",
"(",
")",
"{",
"AbsAxis",
"axis",
";",
"boolean",
"isAttribute",
";",
"if",
"(",
"is",
"(",
"TokenType",
".",
"AT",
",",
"true",
")",
"||",
"mToken",
".",
"getContent",
"(",
")",
".",
"equals",
"(",
"\"attr... | Parses the the rule AbrevForwardStep according to the following
production rule:
<p>
[31] AbbrevForwardStep ::= "@"? NodeTest .
</p>
@return FilterAxis | [
"Parses",
"the",
"the",
"rule",
"AbrevForwardStep",
"according",
"to",
"the",
"following",
"production",
"rule",
":",
"<p",
">",
"[",
"31",
"]",
"AbbrevForwardStep",
"::",
"=",
"@",
"?",
"NodeTest",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L921-L943 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java | ExtendedSwidProcessor.setSupportedLanguages | public ExtendedSwidProcessor setSupportedLanguages(final String... supportedLanguagesList) {
"""
Defines product supported languages (tag: supported_languages).
@param supportedLanguagesList
product supported languages
@return a reference to this object.
"""
SupportedLanguagesComplexType slct = new SupportedLanguagesComplexType();
if (supportedLanguagesList.length > 0) {
for (String supportedLanguage : supportedLanguagesList) {
slct.getLanguage().add(new Token(supportedLanguage, idGenerator.nextId()));
}
}
swidTag.setSupportedLanguages(slct);
return this;
} | java | public ExtendedSwidProcessor setSupportedLanguages(final String... supportedLanguagesList) {
SupportedLanguagesComplexType slct = new SupportedLanguagesComplexType();
if (supportedLanguagesList.length > 0) {
for (String supportedLanguage : supportedLanguagesList) {
slct.getLanguage().add(new Token(supportedLanguage, idGenerator.nextId()));
}
}
swidTag.setSupportedLanguages(slct);
return this;
} | [
"public",
"ExtendedSwidProcessor",
"setSupportedLanguages",
"(",
"final",
"String",
"...",
"supportedLanguagesList",
")",
"{",
"SupportedLanguagesComplexType",
"slct",
"=",
"new",
"SupportedLanguagesComplexType",
"(",
")",
";",
"if",
"(",
"supportedLanguagesList",
".",
"l... | Defines product supported languages (tag: supported_languages).
@param supportedLanguagesList
product supported languages
@return a reference to this object. | [
"Defines",
"product",
"supported",
"languages",
"(",
"tag",
":",
"supported_languages",
")",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L212-L221 |
RestComm/mss-arquillian | mss-arquillian-lifecycle-extension/src/main/java/org/jboss/arquillian/container/mss/extension/lifecycle/LifecycleExecuter.java | LifecycleExecuter.executeBeforeDeploy | public void executeBeforeDeploy(@Observes BeforeDeploy event, TestClass testClass) {
"""
setup with a new configuration and also we have access to the deployment
"""
execute(
testClass.getMethods(
org.jboss.arquillian.container.mobicents.api.annotations.BeforeDeploy.class));
} | java | public void executeBeforeDeploy(@Observes BeforeDeploy event, TestClass testClass)
{
execute(
testClass.getMethods(
org.jboss.arquillian.container.mobicents.api.annotations.BeforeDeploy.class));
} | [
"public",
"void",
"executeBeforeDeploy",
"(",
"@",
"Observes",
"BeforeDeploy",
"event",
",",
"TestClass",
"testClass",
")",
"{",
"execute",
"(",
"testClass",
".",
"getMethods",
"(",
"org",
".",
"jboss",
".",
"arquillian",
".",
"container",
".",
"mobicents",
".... | setup with a new configuration and also we have access to the deployment | [
"setup",
"with",
"a",
"new",
"configuration",
"and",
"also",
"we",
"have",
"access",
"to",
"the",
"deployment"
] | train | https://github.com/RestComm/mss-arquillian/blob/d217b4e53701282c6e7176365a03be6f898342be/mss-arquillian-lifecycle-extension/src/main/java/org/jboss/arquillian/container/mss/extension/lifecycle/LifecycleExecuter.java#L62-L67 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/FloatField.java | FloatField.getSQLFromField | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException {
"""
Move the physical binary data to this SQL parameter row.
@param statement The SQL prepare statement.
@param iType the type of SQL statement.
@param iParamColumn The column in the prepared statement to set the data.
@exception SQLException From SQL calls.
"""
if (this.isNull())
{
if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE))
statement.setNull(iParamColumn, Types.FLOAT);
else
statement.setFloat(iParamColumn, Float.NaN);
}
else
{
if (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.FLOAT_XFER_SUPPORTED))) // HACK for Access
super.getSQLFromField(statement, iType, iParamColumn);
else
statement.setFloat(iParamColumn, (float)this.getValue());
}
} | java | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE))
statement.setNull(iParamColumn, Types.FLOAT);
else
statement.setFloat(iParamColumn, Float.NaN);
}
else
{
if (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.FLOAT_XFER_SUPPORTED))) // HACK for Access
super.getSQLFromField(statement, iType, iParamColumn);
else
statement.setFloat(iParamColumn, (float)this.getValue());
}
} | [
"public",
"void",
"getSQLFromField",
"(",
"PreparedStatement",
"statement",
",",
"int",
"iType",
",",
"int",
"iParamColumn",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"isNull",
"(",
")",
")",
"{",
"if",
"(",
"(",
"this",
".",
"isNullable"... | Move the physical binary data to this SQL parameter row.
@param statement The SQL prepare statement.
@param iType the type of SQL statement.
@param iParamColumn The column in the prepared statement to set the data.
@exception SQLException From SQL calls. | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/FloatField.java#L147-L163 |
lessthanoptimal/BoofCV | demonstrations/src/main/java/boofcv/demonstrations/fiducial/DetectQrCodeApp.java | DetectQrCodeApp.processImage | @Override
public void processImage(int sourceID, long frameID, final BufferedImage buffered, ImageBase input) {
"""
Override this function so that it doesn't threshold the image twice
"""
System.out.flush();
synchronized (bufferedImageLock) {
original = ConvertBufferedImage.checkCopy(buffered, original);
work = ConvertBufferedImage.checkDeclare(buffered, work);
}
if( saveRequested ) {
saveInputImage();
saveRequested = false;
}
final double timeInSeconds;
// TODO Copy all data that's visualized outside so that GUI doesn't lock
synchronized (this) {
long before = System.nanoTime();
detector.process((T)input);
long after = System.nanoTime();
timeInSeconds = (after-before)*1e-9;
}
// create a local copy so that gui and processing thread's dont conflict
synchronized (detected) {
this.detected.reset();
for (QrCode d : detector.getDetections()) {
this.detected.grow().set(d);
}
this.failures.reset();
for (QrCode d : detector.getFailures()) {
if( d.failureCause.ordinal() >= QrCode.Failure.READING_BITS.ordinal())
this.failures.grow().set(d);
}
// System.out.println("Failed "+failures.size());
// for( QrCode qr : failures.toList() ) {
// System.out.println(" cause "+qr.failureCause);
// }
}
controlPanel.polygonPanel.thresholdPanel.updateHistogram((T)input);
SwingUtilities.invokeLater(() -> {
controls.setProcessingTimeS(timeInSeconds);
viewUpdated();
synchronized (detected) {
controlPanel.messagePanel.updateList(detected.toList(),failures.toList());
}
});
} | java | @Override
public void processImage(int sourceID, long frameID, final BufferedImage buffered, ImageBase input) {
System.out.flush();
synchronized (bufferedImageLock) {
original = ConvertBufferedImage.checkCopy(buffered, original);
work = ConvertBufferedImage.checkDeclare(buffered, work);
}
if( saveRequested ) {
saveInputImage();
saveRequested = false;
}
final double timeInSeconds;
// TODO Copy all data that's visualized outside so that GUI doesn't lock
synchronized (this) {
long before = System.nanoTime();
detector.process((T)input);
long after = System.nanoTime();
timeInSeconds = (after-before)*1e-9;
}
// create a local copy so that gui and processing thread's dont conflict
synchronized (detected) {
this.detected.reset();
for (QrCode d : detector.getDetections()) {
this.detected.grow().set(d);
}
this.failures.reset();
for (QrCode d : detector.getFailures()) {
if( d.failureCause.ordinal() >= QrCode.Failure.READING_BITS.ordinal())
this.failures.grow().set(d);
}
// System.out.println("Failed "+failures.size());
// for( QrCode qr : failures.toList() ) {
// System.out.println(" cause "+qr.failureCause);
// }
}
controlPanel.polygonPanel.thresholdPanel.updateHistogram((T)input);
SwingUtilities.invokeLater(() -> {
controls.setProcessingTimeS(timeInSeconds);
viewUpdated();
synchronized (detected) {
controlPanel.messagePanel.updateList(detected.toList(),failures.toList());
}
});
} | [
"@",
"Override",
"public",
"void",
"processImage",
"(",
"int",
"sourceID",
",",
"long",
"frameID",
",",
"final",
"BufferedImage",
"buffered",
",",
"ImageBase",
"input",
")",
"{",
"System",
".",
"out",
".",
"flush",
"(",
")",
";",
"synchronized",
"(",
"buff... | Override this function so that it doesn't threshold the image twice | [
"Override",
"this",
"function",
"so",
"that",
"it",
"doesn",
"t",
"threshold",
"the",
"image",
"twice"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/fiducial/DetectQrCodeApp.java#L191-L241 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.executeScript | public Object executeScript(final String script, final Object... args) {
"""
Execute JavaScript in the context of the currently selected frame or window.
@see JavascriptExecutor#executeScript(String, Object...)
@param script
The JavaScript to execute
@param args
The arguments to the script. May be empty
@return One of Boolean, Long, String, List or WebElement. Or null.
"""
LOGGER.info("executeScript: {}", new ToStringBuilder(this, LoggingToStringStyle.INSTANCE).append("script", script).append("args", args));
return ((JavascriptExecutor) webDriver).executeScript(script, args);
} | java | public Object executeScript(final String script, final Object... args) {
LOGGER.info("executeScript: {}", new ToStringBuilder(this, LoggingToStringStyle.INSTANCE).append("script", script).append("args", args));
return ((JavascriptExecutor) webDriver).executeScript(script, args);
} | [
"public",
"Object",
"executeScript",
"(",
"final",
"String",
"script",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"executeScript: {}\"",
",",
"new",
"ToStringBuilder",
"(",
"this",
",",
"LoggingToStringStyle",
".",
"INSTANCE",... | Execute JavaScript in the context of the currently selected frame or window.
@see JavascriptExecutor#executeScript(String, Object...)
@param script
The JavaScript to execute
@param args
The arguments to the script. May be empty
@return One of Boolean, Long, String, List or WebElement. Or null. | [
"Execute",
"JavaScript",
"in",
"the",
"context",
"of",
"the",
"currently",
"selected",
"frame",
"or",
"window",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L733-L736 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java | JDBC4CallableStatement.setClob | @Override
public void setClob(String parameterName, Clob x) throws SQLException {
"""
Sets the designated parameter to the given java.sql.Clob object.
"""
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public void setClob(String parameterName, Clob x) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"void",
"setClob",
"(",
"String",
"parameterName",
",",
"Clob",
"x",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Sets the designated parameter to the given java.sql.Clob object. | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"java",
".",
"sql",
".",
"Clob",
"object",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L695-L700 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClusterConfigurationsInner.java | ClusterConfigurationsInner.withConfigurations | public ClusterConfigurationsInner withConfigurations(Map<String, Map<String, String>> configurations) {
"""
Set the configuration object for the specified configuration for the specified cluster.
@param configurations the configurations value to set
@return the ClusterConfigurationsInner object itself.
"""
this.configurations = configurations;
return this;
} | java | public ClusterConfigurationsInner withConfigurations(Map<String, Map<String, String>> configurations) {
this.configurations = configurations;
return this;
} | [
"public",
"ClusterConfigurationsInner",
"withConfigurations",
"(",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"configurations",
")",
"{",
"this",
".",
"configurations",
"=",
"configurations",
";",
"return",
"this",
";",
"}"
] | Set the configuration object for the specified configuration for the specified cluster.
@param configurations the configurations value to set
@return the ClusterConfigurationsInner object itself. | [
"Set",
"the",
"configuration",
"object",
"for",
"the",
"specified",
"configuration",
"for",
"the",
"specified",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClusterConfigurationsInner.java#L40-L43 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java | JSONConverter.writeInt | public void writeInt(OutputStream out, int value) throws IOException {
"""
Encode an integer value as JSON. An array is used to wrap the value:
[ Integer ]
@param out The stream to write JSON to
@param value The integer value to encode
@throws IOException If an I/O error occurs
@see #readInt(InputStream)
"""
writeStartArray(out);
writeIntInternal(out, value);
writeEndArray(out);
} | java | public void writeInt(OutputStream out, int value) throws IOException {
writeStartArray(out);
writeIntInternal(out, value);
writeEndArray(out);
} | [
"public",
"void",
"writeInt",
"(",
"OutputStream",
"out",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"writeStartArray",
"(",
"out",
")",
";",
"writeIntInternal",
"(",
"out",
",",
"value",
")",
";",
"writeEndArray",
"(",
"out",
")",
";",
"}"
] | Encode an integer value as JSON. An array is used to wrap the value:
[ Integer ]
@param out The stream to write JSON to
@param value The integer value to encode
@throws IOException If an I/O error occurs
@see #readInt(InputStream) | [
"Encode",
"an",
"integer",
"value",
"as",
"JSON",
".",
"An",
"array",
"is",
"used",
"to",
"wrap",
"the",
"value",
":",
"[",
"Integer",
"]"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L682-L686 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/deployment/ContextPropertiesDeploymentAspect.java | ContextPropertiesDeploymentAspect.setContextProperties | public void setContextProperties(Map<String, String> contextProperties) {
"""
This is called once at AS boot time during deployment aspect parsing;
this provided map is copied.
@param contextProperties
"""
if (contextProperties != null) {
this.contextProperties = new HashMap<String, String>(4);
this.contextProperties.putAll(contextProperties);
}
} | java | public void setContextProperties(Map<String, String> contextProperties)
{
if (contextProperties != null) {
this.contextProperties = new HashMap<String, String>(4);
this.contextProperties.putAll(contextProperties);
}
} | [
"public",
"void",
"setContextProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"contextProperties",
")",
"{",
"if",
"(",
"contextProperties",
"!=",
"null",
")",
"{",
"this",
".",
"contextProperties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Stri... | This is called once at AS boot time during deployment aspect parsing;
this provided map is copied.
@param contextProperties | [
"This",
"is",
"called",
"once",
"at",
"AS",
"boot",
"time",
"during",
"deployment",
"aspect",
"parsing",
";",
"this",
"provided",
"map",
"is",
"copied",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/deployment/ContextPropertiesDeploymentAspect.java#L53-L59 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/SessionManager.java | SessionManager.createSessionId | protected String createSessionId(HttpResponse response) {
"""
Creates a session id and adds the corresponding cookie to the
response.
@param response the response
@return the session id
"""
StringBuilder sessionIdBuilder = new StringBuilder();
byte[] bytes = new byte[16];
secureRandom.nextBytes(bytes);
for (byte b : bytes) {
sessionIdBuilder.append(Integer.toHexString(b & 0xff));
}
String sessionId = sessionIdBuilder.toString();
HttpCookie sessionCookie = new HttpCookie(idName(), sessionId);
sessionCookie.setPath(path);
sessionCookie.setHttpOnly(true);
response.computeIfAbsent(HttpField.SET_COOKIE, CookieList::new)
.value().add(sessionCookie);
response.computeIfAbsent(
HttpField.CACHE_CONTROL, CacheControlDirectives::new)
.value().add(new Directive("no-cache", "SetCookie, Set-Cookie2"));
return sessionId;
} | java | protected String createSessionId(HttpResponse response) {
StringBuilder sessionIdBuilder = new StringBuilder();
byte[] bytes = new byte[16];
secureRandom.nextBytes(bytes);
for (byte b : bytes) {
sessionIdBuilder.append(Integer.toHexString(b & 0xff));
}
String sessionId = sessionIdBuilder.toString();
HttpCookie sessionCookie = new HttpCookie(idName(), sessionId);
sessionCookie.setPath(path);
sessionCookie.setHttpOnly(true);
response.computeIfAbsent(HttpField.SET_COOKIE, CookieList::new)
.value().add(sessionCookie);
response.computeIfAbsent(
HttpField.CACHE_CONTROL, CacheControlDirectives::new)
.value().add(new Directive("no-cache", "SetCookie, Set-Cookie2"));
return sessionId;
} | [
"protected",
"String",
"createSessionId",
"(",
"HttpResponse",
"response",
")",
"{",
"StringBuilder",
"sessionIdBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"16",
"]",
";",
"secureRandom",
".",
"ne... | Creates a session id and adds the corresponding cookie to the
response.
@param response the response
@return the session id | [
"Creates",
"a",
"session",
"id",
"and",
"adds",
"the",
"corresponding",
"cookie",
"to",
"the",
"response",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/SessionManager.java#L343-L360 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java | TitlePaneMaximizeButtonPainter.paintMaximizePressed | private void paintMaximizePressed(Graphics2D g, JComponent c, int width, int height) {
"""
Paint the foreground maximize button pressed state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component.
"""
maximizePainter.paintPressed(g, c, width, height);
} | java | private void paintMaximizePressed(Graphics2D g, JComponent c, int width, int height) {
maximizePainter.paintPressed(g, c, width, height);
} | [
"private",
"void",
"paintMaximizePressed",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"maximizePainter",
".",
"paintPressed",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
")",
";",
"}"
] | Paint the foreground maximize button pressed state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component. | [
"Paint",
"the",
"foreground",
"maximize",
"button",
"pressed",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java#L197-L199 |
tango-controls/JTango | client/src/main/java/org/tango/client/database/cache/NoCacheDatabase.java | NoCacheDatabase.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 DevFailed
"""
final List<String> args = getArray(properties, deviceName);
final DeviceData argin = new DeviceData();
argin.insert(args.toArray(new String[args.size()]));
database.command_inout("DbPutDeviceProperty", argin);
} | java | @Override
public void setDeviceProperties(final String deviceName, final Map<String, String[]> properties) throws DevFailed {
final List<String> args = getArray(properties, deviceName);
final DeviceData argin = new DeviceData();
argin.insert(args.toArray(new String[args.size()]));
database.command_inout("DbPutDeviceProperty", argin);
} | [
"@",
"Override",
"public",
"void",
"setDeviceProperties",
"(",
"final",
"String",
"deviceName",
",",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"properties",
")",
"throws",
"DevFailed",
"{",
"final",
"List",
"<",
"String",
">",
"args",
"=... | 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/cache/NoCacheDatabase.java#L154-L160 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormSpec.java | FormSpec.parseSize | private Size parseSize(String token) {
"""
Parses an encoded size spec and returns the size.
@param token a token that represents a size, either bounded or plain
@return the decoded Size
"""
if (token.startsWith("[") && token.endsWith("]")) {
return parseBoundedSize(token);
}
if (token.startsWith("max(") && token.endsWith(")")) {
return parseOldBoundedSize(token, false);
}
if (token.startsWith("min(") && token.endsWith(")")) {
return parseOldBoundedSize(token, true);
}
return parseAtomicSize(token);
} | java | private Size parseSize(String token) {
if (token.startsWith("[") && token.endsWith("]")) {
return parseBoundedSize(token);
}
if (token.startsWith("max(") && token.endsWith(")")) {
return parseOldBoundedSize(token, false);
}
if (token.startsWith("min(") && token.endsWith(")")) {
return parseOldBoundedSize(token, true);
}
return parseAtomicSize(token);
} | [
"private",
"Size",
"parseSize",
"(",
"String",
"token",
")",
"{",
"if",
"(",
"token",
".",
"startsWith",
"(",
"\"[\"",
")",
"&&",
"token",
".",
"endsWith",
"(",
"\"]\"",
")",
")",
"{",
"return",
"parseBoundedSize",
"(",
"token",
")",
";",
"}",
"if",
... | Parses an encoded size spec and returns the size.
@param token a token that represents a size, either bounded or plain
@return the decoded Size | [
"Parses",
"an",
"encoded",
"size",
"spec",
"and",
"returns",
"the",
"size",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpec.java#L267-L278 |
VoltDB/voltdb | src/catgen/in/javasrc/CatalogType.java | CatalogType.setBaseValues | void setBaseValues(CatalogMap<? extends CatalogType> parentMap, String name) {
"""
This is my lazy hack to avoid using reflection to instantiate records.
"""
if (name == null) {
throw new CatalogException("Null value where it shouldn't be.");
}
m_parentMap = parentMap;
m_typename = name;
} | java | void setBaseValues(CatalogMap<? extends CatalogType> parentMap, String name) {
if (name == null) {
throw new CatalogException("Null value where it shouldn't be.");
}
m_parentMap = parentMap;
m_typename = name;
} | [
"void",
"setBaseValues",
"(",
"CatalogMap",
"<",
"?",
"extends",
"CatalogType",
">",
"parentMap",
",",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"CatalogException",
"(",
"\"Null value where it shouldn't be.\"",
")",
... | This is my lazy hack to avoid using reflection to instantiate records. | [
"This",
"is",
"my",
"lazy",
"hack",
"to",
"avoid",
"using",
"reflection",
"to",
"instantiate",
"records",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/catgen/in/javasrc/CatalogType.java#L215-L221 |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/DateTimePickerUtils.java | DateTimePickerUtils.tryAccessibilityAnnounce | @SuppressLint("NewApi")
public static void tryAccessibilityAnnounce(View view, CharSequence text) {
"""
Try to speak the specified text, for accessibility. Only available on JB or later.
@param text Text to announce.
"""
if (isJellybeanOrLater() && view != null && text != null) {
view.announceForAccessibility(text);
}
} | java | @SuppressLint("NewApi")
public static void tryAccessibilityAnnounce(View view, CharSequence text) {
if (isJellybeanOrLater() && view != null && text != null) {
view.announceForAccessibility(text);
}
} | [
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"public",
"static",
"void",
"tryAccessibilityAnnounce",
"(",
"View",
"view",
",",
"CharSequence",
"text",
")",
"{",
"if",
"(",
"isJellybeanOrLater",
"(",
")",
"&&",
"view",
"!=",
"null",
"&&",
"text",
"!=",
"null"... | Try to speak the specified text, for accessibility. Only available on JB or later.
@param text Text to announce. | [
"Try",
"to",
"speak",
"the",
"specified",
"text",
"for",
"accessibility",
".",
"Only",
"available",
"on",
"JB",
"or",
"later",
"."
] | train | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/DateTimePickerUtils.java#L71-L76 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/event/lineage/LineageInfo.java | LineageInfo.putDestination | @Deprecated
public void putDestination(Descriptor destination, int branchId, State state) {
"""
Put a {@link DatasetDescriptor} of a destination dataset to a state
<p>
Only the {@link org.apache.gobblin.writer.DataWriter} or {@link org.apache.gobblin.publisher.DataPublisher}
is supposed to put the destination dataset information. Since different branches may concurrently put,
the method is implemented to be threadsafe
</p>
@deprecated Use {@link #putDestination(List, int, State)}
"""
putDestination(Lists.newArrayList(destination), branchId, state);
} | java | @Deprecated
public void putDestination(Descriptor destination, int branchId, State state) {
putDestination(Lists.newArrayList(destination), branchId, state);
} | [
"@",
"Deprecated",
"public",
"void",
"putDestination",
"(",
"Descriptor",
"destination",
",",
"int",
"branchId",
",",
"State",
"state",
")",
"{",
"putDestination",
"(",
"Lists",
".",
"newArrayList",
"(",
"destination",
")",
",",
"branchId",
",",
"state",
")",
... | Put a {@link DatasetDescriptor} of a destination dataset to a state
<p>
Only the {@link org.apache.gobblin.writer.DataWriter} or {@link org.apache.gobblin.publisher.DataPublisher}
is supposed to put the destination dataset information. Since different branches may concurrently put,
the method is implemented to be threadsafe
</p>
@deprecated Use {@link #putDestination(List, int, State)} | [
"Put",
"a",
"{",
"@link",
"DatasetDescriptor",
"}",
"of",
"a",
"destination",
"dataset",
"to",
"a",
"state"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/event/lineage/LineageInfo.java#L133-L136 |
Polidea/RxAndroidBle | rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/LoggingIllegalOperationHandler.java | LoggingIllegalOperationHandler.handleMismatchData | @Override
public BleIllegalOperationException handleMismatchData(BluetoothGattCharacteristic characteristic, int neededProperties) {
"""
This method logs a warning.
@param characteristic the characteristic upon which the operation was requested
@param neededProperties bitmask of properties needed by the operation
"""
RxBleLog.w(messageCreator.createMismatchMessage(characteristic, neededProperties));
return null;
} | java | @Override
public BleIllegalOperationException handleMismatchData(BluetoothGattCharacteristic characteristic, int neededProperties) {
RxBleLog.w(messageCreator.createMismatchMessage(characteristic, neededProperties));
return null;
} | [
"@",
"Override",
"public",
"BleIllegalOperationException",
"handleMismatchData",
"(",
"BluetoothGattCharacteristic",
"characteristic",
",",
"int",
"neededProperties",
")",
"{",
"RxBleLog",
".",
"w",
"(",
"messageCreator",
".",
"createMismatchMessage",
"(",
"characteristic",... | This method logs a warning.
@param characteristic the characteristic upon which the operation was requested
@param neededProperties bitmask of properties needed by the operation | [
"This",
"method",
"logs",
"a",
"warning",
"."
] | train | https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/LoggingIllegalOperationHandler.java#L26-L30 |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java | HttpMergeRequestFilter.removeFilter | protected final void removeFilter(IoFilterChain filterChain, IoFilter filter) {
"""
A utility method to remove a filter from a filter chain, without
complaining if it is not in the chain.
@param filterChain the filter chain
@param filter the filter to remove
"""
if (filterChain.contains(filter)) {
filterChain.remove(filter);
}
} | java | protected final void removeFilter(IoFilterChain filterChain, IoFilter filter) {
if (filterChain.contains(filter)) {
filterChain.remove(filter);
}
} | [
"protected",
"final",
"void",
"removeFilter",
"(",
"IoFilterChain",
"filterChain",
",",
"IoFilter",
"filter",
")",
"{",
"if",
"(",
"filterChain",
".",
"contains",
"(",
"filter",
")",
")",
"{",
"filterChain",
".",
"remove",
"(",
"filter",
")",
";",
"}",
"}"... | A utility method to remove a filter from a filter chain, without
complaining if it is not in the chain.
@param filterChain the filter chain
@param filter the filter to remove | [
"A",
"utility",
"method",
"to",
"remove",
"a",
"filter",
"from",
"a",
"filter",
"chain",
"without",
"complaining",
"if",
"it",
"is",
"not",
"in",
"the",
"chain",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java#L397-L401 |
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.createRegexEntityRoleAsync | public Observable<UUID> createRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, CreateRegexEntityRoleOptionalParameter createRegexEntityRoleOptionalParameter) {
"""
Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity model ID.
@param createRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object
"""
return createRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createRegexEntityRoleOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | java | public Observable<UUID> createRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, CreateRegexEntityRoleOptionalParameter createRegexEntityRoleOptionalParameter) {
return createRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createRegexEntityRoleOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UUID",
">",
"createRegexEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"CreateRegexEntityRoleOptionalParameter",
"createRegexEntityRoleOptionalParameter",
")",
"{",
"return",
"createRegexEntity... | Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity model ID.
@param createRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Create",
"an",
"entity",
"role",
"for",
"an",
"entity",
"in",
"the",
"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#L8621-L8628 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java | ApnsClientBuilder.setClientCredentials | public ApnsClientBuilder setClientCredentials(final InputStream p12InputStream, final String p12Password) throws SSLException, IOException {
"""
<p>Sets the TLS credentials for the client under construction using the data from the given PKCS#12 input stream.
Clients constructed with TLS credentials will use TLS-based authentication when sending push notifications. The
PKCS#12 data <em>must</em> contain a certificate/private key pair.</p>
<p>Clients may not have both TLS credentials and a signing key.</p>
@param p12InputStream an input stream to a PKCS#12-formatted file containing the certificate and private key to
be used to identify the client to the APNs server
@param p12Password the password to be used to decrypt the contents of the given PKCS#12 file; passwords may be
blank (i.e. {@code ""}), but must not be {@code null}
@throws SSLException if the given PKCS#12 file could not be loaded or if any other SSL-related problem arises
when constructing the context
@throws IOException if any IO problem occurred while attempting to read the given PKCS#12 input stream
@return a reference to this builder
@since 0.8
"""
final X509Certificate x509Certificate;
final PrivateKey privateKey;
try {
final KeyStore.PrivateKeyEntry privateKeyEntry = P12Util.getFirstPrivateKeyEntryFromP12InputStream(p12InputStream, p12Password);
final Certificate certificate = privateKeyEntry.getCertificate();
if (!(certificate instanceof X509Certificate)) {
throw new KeyStoreException("Found a certificate in the provided PKCS#12 file, but it was not an X.509 certificate.");
}
x509Certificate = (X509Certificate) certificate;
privateKey = privateKeyEntry.getPrivateKey();
} catch (final KeyStoreException e) {
throw new SSLException(e);
}
return this.setClientCredentials(x509Certificate, privateKey, p12Password);
} | java | public ApnsClientBuilder setClientCredentials(final InputStream p12InputStream, final String p12Password) throws SSLException, IOException {
final X509Certificate x509Certificate;
final PrivateKey privateKey;
try {
final KeyStore.PrivateKeyEntry privateKeyEntry = P12Util.getFirstPrivateKeyEntryFromP12InputStream(p12InputStream, p12Password);
final Certificate certificate = privateKeyEntry.getCertificate();
if (!(certificate instanceof X509Certificate)) {
throw new KeyStoreException("Found a certificate in the provided PKCS#12 file, but it was not an X.509 certificate.");
}
x509Certificate = (X509Certificate) certificate;
privateKey = privateKeyEntry.getPrivateKey();
} catch (final KeyStoreException e) {
throw new SSLException(e);
}
return this.setClientCredentials(x509Certificate, privateKey, p12Password);
} | [
"public",
"ApnsClientBuilder",
"setClientCredentials",
"(",
"final",
"InputStream",
"p12InputStream",
",",
"final",
"String",
"p12Password",
")",
"throws",
"SSLException",
",",
"IOException",
"{",
"final",
"X509Certificate",
"x509Certificate",
";",
"final",
"PrivateKey",
... | <p>Sets the TLS credentials for the client under construction using the data from the given PKCS#12 input stream.
Clients constructed with TLS credentials will use TLS-based authentication when sending push notifications. The
PKCS#12 data <em>must</em> contain a certificate/private key pair.</p>
<p>Clients may not have both TLS credentials and a signing key.</p>
@param p12InputStream an input stream to a PKCS#12-formatted file containing the certificate and private key to
be used to identify the client to the APNs server
@param p12Password the password to be used to decrypt the contents of the given PKCS#12 file; passwords may be
blank (i.e. {@code ""}), but must not be {@code null}
@throws SSLException if the given PKCS#12 file could not be loaded or if any other SSL-related problem arises
when constructing the context
@throws IOException if any IO problem occurred while attempting to read the given PKCS#12 input stream
@return a reference to this builder
@since 0.8 | [
"<p",
">",
"Sets",
"the",
"TLS",
"credentials",
"for",
"the",
"client",
"under",
"construction",
"using",
"the",
"data",
"from",
"the",
"given",
"PKCS#12",
"input",
"stream",
".",
"Clients",
"constructed",
"with",
"TLS",
"credentials",
"will",
"use",
"TLS",
... | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java#L216-L236 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | ServerBuilder.childChannelOption | public <T> ServerBuilder childChannelOption(ChannelOption<T> option, T value) {
"""
Sets the {@link ChannelOption} of sockets accepted by {@link Server}.
Note that the previously added option will be overridden if the same option is set again.
<pre>{@code
ServerBuilder sb = new ServerBuilder();
sb.childChannelOption(ChannelOption.SO_REUSEADDR, true)
.childChannelOption(ChannelOption.SO_KEEPALIVE, true);
}</pre>
"""
requireNonNull(option, "option");
checkArgument(!PROHIBITED_SOCKET_OPTIONS.contains(option),
"prohibited socket option: %s", option);
option.validate(value);
childChannelOptions.put(option, value);
return this;
} | java | public <T> ServerBuilder childChannelOption(ChannelOption<T> option, T value) {
requireNonNull(option, "option");
checkArgument(!PROHIBITED_SOCKET_OPTIONS.contains(option),
"prohibited socket option: %s", option);
option.validate(value);
childChannelOptions.put(option, value);
return this;
} | [
"public",
"<",
"T",
">",
"ServerBuilder",
"childChannelOption",
"(",
"ChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"requireNonNull",
"(",
"option",
",",
"\"option\"",
")",
";",
"checkArgument",
"(",
"!",
"PROHIBITED_SOCKET_OPTIONS",
".... | Sets the {@link ChannelOption} of sockets accepted by {@link Server}.
Note that the previously added option will be overridden if the same option is set again.
<pre>{@code
ServerBuilder sb = new ServerBuilder();
sb.childChannelOption(ChannelOption.SO_REUSEADDR, true)
.childChannelOption(ChannelOption.SO_KEEPALIVE, true);
}</pre> | [
"Sets",
"the",
"{",
"@link",
"ChannelOption",
"}",
"of",
"sockets",
"accepted",
"by",
"{",
"@link",
"Server",
"}",
".",
"Note",
"that",
"the",
"previously",
"added",
"option",
"will",
"be",
"overridden",
"if",
"the",
"same",
"option",
"is",
"set",
"again",... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L392-L400 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.ParseItemType | public static Item ParseItemType( String s, boolean checkBlocks ) {
"""
Attempts to parse the item type string.
@param s The string to parse.
@param checkBlocks if string can't be parsed as an item, attempt to parse as a block, if checkBlocks is true
@return The item type, or null if the string is not recognised.
"""
if (s == null)
return null;
Item item = (Item)Item.REGISTRY.getObject(new ResourceLocation(s)); // Minecraft returns null when it doesn't recognise the string
if (item == null && checkBlocks)
{
// Maybe this is a request for a block item?
IBlockState block = MinecraftTypeHelper.ParseBlockType(s);
item = (block != null && block.getBlock() != null) ? Item.getItemFromBlock(block.getBlock()) : null;
}
return item;
} | java | public static Item ParseItemType( String s, boolean checkBlocks )
{
if (s == null)
return null;
Item item = (Item)Item.REGISTRY.getObject(new ResourceLocation(s)); // Minecraft returns null when it doesn't recognise the string
if (item == null && checkBlocks)
{
// Maybe this is a request for a block item?
IBlockState block = MinecraftTypeHelper.ParseBlockType(s);
item = (block != null && block.getBlock() != null) ? Item.getItemFromBlock(block.getBlock()) : null;
}
return item;
} | [
"public",
"static",
"Item",
"ParseItemType",
"(",
"String",
"s",
",",
"boolean",
"checkBlocks",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"Item",
"item",
"=",
"(",
"Item",
")",
"Item",
".",
"REGISTRY",
".",
"getObject",
"(",
... | Attempts to parse the item type string.
@param s The string to parse.
@param checkBlocks if string can't be parsed as an item, attempt to parse as a block, if checkBlocks is true
@return The item type, or null if the string is not recognised. | [
"Attempts",
"to",
"parse",
"the",
"item",
"type",
"string",
"."
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L84-L96 |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java | ShutdownHook.getPID | private String getPID(String dir, String serverName) {
"""
Return PID from server directory for cygwin environment only.
@return PID string or null if not cygwin environment or exception occurs
@throws IOException, FileNotFoundException if anything goes wrong
"""
String pid = null;
if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
String pidFile = dir + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + ".pid" + File.separator
+ serverName + ".pid";
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), "UTF-8"));
try {
return br.readLine();
} finally {
br.close();
}
} catch (IOException e) {
pid = null;
}
if (pid == null) {
Object[] substitution = { dir };
System.out.println(MessageFormat.format(resourceBundle.getString("UNABLE_TO_FIND_PID"), substitution));
}
}
return pid;
} | java | private String getPID(String dir, String serverName) {
String pid = null;
if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
String pidFile = dir + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + ".pid" + File.separator
+ serverName + ".pid";
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), "UTF-8"));
try {
return br.readLine();
} finally {
br.close();
}
} catch (IOException e) {
pid = null;
}
if (pid == null) {
Object[] substitution = { dir };
System.out.println(MessageFormat.format(resourceBundle.getString("UNABLE_TO_FIND_PID"), substitution));
}
}
return pid;
} | [
"private",
"String",
"getPID",
"(",
"String",
"dir",
",",
"String",
"serverName",
")",
"{",
"String",
"pid",
"=",
"null",
";",
"if",
"(",
"platformType",
"==",
"SelfExtractUtils",
".",
"PlatformType_CYGWIN",
")",
"{",
"String",
"pidFile",
"=",
"dir",
"+",
... | Return PID from server directory for cygwin environment only.
@return PID string or null if not cygwin environment or exception occurs
@throws IOException, FileNotFoundException if anything goes wrong | [
"Return",
"PID",
"from",
"server",
"directory",
"for",
"cygwin",
"environment",
"only",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L72-L95 |
gocd/gocd | config/config-api/src/main/java/com/thoughtworks/go/config/BasicCruiseConfig.java | BasicCruiseConfig.addPipeline | @Override
public void addPipeline(String groupName, PipelineConfig pipelineConfig) {
"""
when adding pipelines, groups or environments we must make sure that both merged and basic scopes are updated
"""
groups.addPipeline(groupName, pipelineConfig);
} | java | @Override
public void addPipeline(String groupName, PipelineConfig pipelineConfig) {
groups.addPipeline(groupName, pipelineConfig);
} | [
"@",
"Override",
"public",
"void",
"addPipeline",
"(",
"String",
"groupName",
",",
"PipelineConfig",
"pipelineConfig",
")",
"{",
"groups",
".",
"addPipeline",
"(",
"groupName",
",",
"pipelineConfig",
")",
";",
"}"
] | when adding pipelines, groups or environments we must make sure that both merged and basic scopes are updated | [
"when",
"adding",
"pipelines",
"groups",
"or",
"environments",
"we",
"must",
"make",
"sure",
"that",
"both",
"merged",
"and",
"basic",
"scopes",
"are",
"updated"
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/config/config-api/src/main/java/com/thoughtworks/go/config/BasicCruiseConfig.java#L877-L880 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.andNotLikePattern | public ZealotKhala andNotLikePattern(String field, String pattern) {
"""
根据指定的模式字符串生成带" AND "前缀的" NOT LIKE "模糊查询的SQL片段.
<p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" AND b.title NOT LIKE 'Java%' "</p>
@param field 数据库字段
@param pattern 模式字符串
@return ZealotKhala实例
"""
return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, false);
} | java | public ZealotKhala andNotLikePattern(String field, String pattern) {
return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, false);
} | [
"public",
"ZealotKhala",
"andNotLikePattern",
"(",
"String",
"field",
",",
"String",
"pattern",
")",
"{",
"return",
"this",
".",
"doLikePattern",
"(",
"ZealotConst",
".",
"AND_PREFIX",
",",
"field",
",",
"pattern",
",",
"true",
",",
"false",
")",
";",
"}"
] | 根据指定的模式字符串生成带" AND "前缀的" NOT LIKE "模糊查询的SQL片段.
<p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" AND b.title NOT LIKE 'Java%' "</p>
@param field 数据库字段
@param pattern 模式字符串
@return ZealotKhala实例 | [
"根据指定的模式字符串生成带",
"AND",
"前缀的",
"NOT",
"LIKE",
"模糊查询的SQL片段",
".",
"<p",
">",
"示例:传入",
"{",
"b",
".",
"title",
"Java%",
"}",
"两个参数,生成的SQL片段为:",
"AND",
"b",
".",
"title",
"NOT",
"LIKE",
"Java%",
"<",
"/",
"p",
">"
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1144-L1146 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.foldStatic | public Binder foldStatic(Class<?> target, String method) {
"""
Process the incoming arguments by calling the given static method on the
given class, inserting the result as the first argument.
@param target the class on which the method is defined
@param method the method to invoke on the first argument
@return a new Binder
"""
return foldStatic(lookup, target, method);
} | java | public Binder foldStatic(Class<?> target, String method) {
return foldStatic(lookup, target, method);
} | [
"public",
"Binder",
"foldStatic",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"method",
")",
"{",
"return",
"foldStatic",
"(",
"lookup",
",",
"target",
",",
"method",
")",
";",
"}"
] | Process the incoming arguments by calling the given static method on the
given class, inserting the result as the first argument.
@param target the class on which the method is defined
@param method the method to invoke on the first argument
@return a new Binder | [
"Process",
"the",
"incoming",
"arguments",
"by",
"calling",
"the",
"given",
"static",
"method",
"on",
"the",
"given",
"class",
"inserting",
"the",
"result",
"as",
"the",
"first",
"argument",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L968-L970 |
alkacon/opencms-core | src/org/opencms/gwt/CmsCoreService.java | CmsCoreService.getVaadinWorkplaceLink | public static String getVaadinWorkplaceLink(CmsObject cms, CmsUUID structureId) {
"""
Returns the workplace link.<p>
@param cms the cms context
@param structureId the structure id of the current resource
@return the workplace link
"""
String resourceRootFolder = null;
if (structureId != null) {
try {
resourceRootFolder = CmsResource.getFolderPath(
cms.readResource(structureId, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED).getRootPath());
} catch (CmsException e) {
LOG.debug("Error reading resource for workplace link.", e);
}
}
if (resourceRootFolder == null) {
resourceRootFolder = cms.getRequestContext().getSiteRoot();
}
return getVaadinWorkplaceLink(cms, resourceRootFolder);
} | java | public static String getVaadinWorkplaceLink(CmsObject cms, CmsUUID structureId) {
String resourceRootFolder = null;
if (structureId != null) {
try {
resourceRootFolder = CmsResource.getFolderPath(
cms.readResource(structureId, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED).getRootPath());
} catch (CmsException e) {
LOG.debug("Error reading resource for workplace link.", e);
}
}
if (resourceRootFolder == null) {
resourceRootFolder = cms.getRequestContext().getSiteRoot();
}
return getVaadinWorkplaceLink(cms, resourceRootFolder);
} | [
"public",
"static",
"String",
"getVaadinWorkplaceLink",
"(",
"CmsObject",
"cms",
",",
"CmsUUID",
"structureId",
")",
"{",
"String",
"resourceRootFolder",
"=",
"null",
";",
"if",
"(",
"structureId",
"!=",
"null",
")",
"{",
"try",
"{",
"resourceRootFolder",
"=",
... | Returns the workplace link.<p>
@param cms the cms context
@param structureId the structure id of the current resource
@return the workplace link | [
"Returns",
"the",
"workplace",
"link",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsCoreService.java#L452-L469 |
openengsb/openengsb | components/ekb/persistence-query-edb/src/main/java/org/openengsb/core/ekb/persistence/query/edb/internal/QueryInterfaceService.java | QueryInterfaceService.getDescriptionFromObject | private ModelDescription getDescriptionFromObject(EDBObject obj) {
"""
Extracts the required values to lookup a model class from the given EDBObject. If this object does not contain
the required information, an IllegalArgumentException is thrown.
"""
String modelName = obj.getString(EDBConstants.MODEL_TYPE);
String modelVersion = obj.getString(EDBConstants.MODEL_TYPE_VERSION);
if (modelName == null || modelVersion == null) {
throw new IllegalArgumentException("The object " + obj.getOID() + " contains no model information");
}
return new ModelDescription(modelName, modelVersion);
} | java | private ModelDescription getDescriptionFromObject(EDBObject obj) {
String modelName = obj.getString(EDBConstants.MODEL_TYPE);
String modelVersion = obj.getString(EDBConstants.MODEL_TYPE_VERSION);
if (modelName == null || modelVersion == null) {
throw new IllegalArgumentException("The object " + obj.getOID() + " contains no model information");
}
return new ModelDescription(modelName, modelVersion);
} | [
"private",
"ModelDescription",
"getDescriptionFromObject",
"(",
"EDBObject",
"obj",
")",
"{",
"String",
"modelName",
"=",
"obj",
".",
"getString",
"(",
"EDBConstants",
".",
"MODEL_TYPE",
")",
";",
"String",
"modelVersion",
"=",
"obj",
".",
"getString",
"(",
"EDB... | Extracts the required values to lookup a model class from the given EDBObject. If this object does not contain
the required information, an IllegalArgumentException is thrown. | [
"Extracts",
"the",
"required",
"values",
"to",
"lookup",
"a",
"model",
"class",
"from",
"the",
"given",
"EDBObject",
".",
"If",
"this",
"object",
"does",
"not",
"contain",
"the",
"required",
"information",
"an",
"IllegalArgumentException",
"is",
"thrown",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-query-edb/src/main/java/org/openengsb/core/ekb/persistence/query/edb/internal/QueryInterfaceService.java#L196-L203 |
belaban/JGroups | src/org/jgroups/util/Bits.java | Bits.writeInt | public static void writeInt(int num, ByteBuffer buf) {
"""
Writes an int to a ByteBuffer
@param num the int to be written
@param buf the buffer
"""
if(num == 0) {
buf.put((byte)0);
return;
}
final byte bytes_needed=bytesRequiredFor(num);
buf.put(bytes_needed);
for(int i=0; i < bytes_needed; i++)
buf.put(getByteAt(num, i));
} | java | public static void writeInt(int num, ByteBuffer buf) {
if(num == 0) {
buf.put((byte)0);
return;
}
final byte bytes_needed=bytesRequiredFor(num);
buf.put(bytes_needed);
for(int i=0; i < bytes_needed; i++)
buf.put(getByteAt(num, i));
} | [
"public",
"static",
"void",
"writeInt",
"(",
"int",
"num",
",",
"ByteBuffer",
"buf",
")",
"{",
"if",
"(",
"num",
"==",
"0",
")",
"{",
"buf",
".",
"put",
"(",
"(",
"byte",
")",
"0",
")",
";",
"return",
";",
"}",
"final",
"byte",
"bytes_needed",
"=... | Writes an int to a ByteBuffer
@param num the int to be written
@param buf the buffer | [
"Writes",
"an",
"int",
"to",
"a",
"ByteBuffer"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L86-L95 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/Job.java | Job.futureCall | public <T, T1, T2, T3> FutureValue<T> futureCall(Job3<T, T1, T2, T3> jobInstance,
Value<? extends T1> v1, Value<? extends T2> v2, Value<? extends T3> v3,
JobSetting... settings) {
"""
Invoke this method from within the {@code run} method of a <b>generator
job</b> in order to specify a job node in the generated child job graph.
This version of the method is for child jobs that take three arguments.
@param <T> The return type of the child job being specified
@param <T1> The type of the first input to the child job
@param <T2> The type of the second input to the child job
@param <T3> The type of the third input to the child job
@param jobInstance A user-written job object
@param v1 the first input to the child job
@param v2 the second input to the child job
@param v3 the third input to the child job
@param settings Optional one or more {@code JobSetting}
@return a {@code FutureValue} representing an empty value slot that will be
filled by the output of {@code jobInstance} when it finalizes. This
may be passed in to further invocations of {@code futureCall()} in
order to specify a data dependency.
"""
return futureCallUnchecked(settings, jobInstance, v1, v2, v3);
} | java | public <T, T1, T2, T3> FutureValue<T> futureCall(Job3<T, T1, T2, T3> jobInstance,
Value<? extends T1> v1, Value<? extends T2> v2, Value<? extends T3> v3,
JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance, v1, v2, v3);
} | [
"public",
"<",
"T",
",",
"T1",
",",
"T2",
",",
"T3",
">",
"FutureValue",
"<",
"T",
">",
"futureCall",
"(",
"Job3",
"<",
"T",
",",
"T1",
",",
"T2",
",",
"T3",
">",
"jobInstance",
",",
"Value",
"<",
"?",
"extends",
"T1",
">",
"v1",
",",
"Value",
... | Invoke this method from within the {@code run} method of a <b>generator
job</b> in order to specify a job node in the generated child job graph.
This version of the method is for child jobs that take three arguments.
@param <T> The return type of the child job being specified
@param <T1> The type of the first input to the child job
@param <T2> The type of the second input to the child job
@param <T3> The type of the third input to the child job
@param jobInstance A user-written job object
@param v1 the first input to the child job
@param v2 the second input to the child job
@param v3 the third input to the child job
@param settings Optional one or more {@code JobSetting}
@return a {@code FutureValue} representing an empty value slot that will be
filled by the output of {@code jobInstance} when it finalizes. This
may be passed in to further invocations of {@code futureCall()} in
order to specify a data dependency. | [
"Invoke",
"this",
"method",
"from",
"within",
"the",
"{",
"@code",
"run",
"}",
"method",
"of",
"a",
"<b",
">",
"generator",
"job<",
"/",
"b",
">",
"in",
"order",
"to",
"specify",
"a",
"job",
"node",
"in",
"the",
"generated",
"child",
"job",
"graph",
... | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/Job.java#L264-L268 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.isBetween | public static boolean isBetween(final Date start, final Date end, final Date between) {
"""
Checks if the Date object "between" is between from the given to Date objects.
@param start
the start time.
@param end
the end time.
@param between
the date to compare if it is between.
@return true, if is between otherwise false.
"""
final long min = start.getTime();
final long max = end.getTime();
final long index = between.getTime();
return min <= index && index <= max;
} | java | public static boolean isBetween(final Date start, final Date end, final Date between)
{
final long min = start.getTime();
final long max = end.getTime();
final long index = between.getTime();
return min <= index && index <= max;
} | [
"public",
"static",
"boolean",
"isBetween",
"(",
"final",
"Date",
"start",
",",
"final",
"Date",
"end",
",",
"final",
"Date",
"between",
")",
"{",
"final",
"long",
"min",
"=",
"start",
".",
"getTime",
"(",
")",
";",
"final",
"long",
"max",
"=",
"end",
... | Checks if the Date object "between" is between from the given to Date objects.
@param start
the start time.
@param end
the end time.
@param between
the date to compare if it is between.
@return true, if is between otherwise false. | [
"Checks",
"if",
"the",
"Date",
"object",
"between",
"is",
"between",
"from",
"the",
"given",
"to",
"Date",
"objects",
"."
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L296-L302 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java | FormLayout.insertRow | public void insertRow(int rowIndex, RowSpec rowSpec) {
"""
Inserts the specified column at the specified position. Shifts components that intersect the
new column to the right and readjusts column groups.<p>
The component shift works as follows: components that were located on the right hand side of
the inserted column are shifted one column to the right; component column span is increased
by one if it intersects the new column.<p>
Column group indices that are greater or equal than the given column index will be increased
by one.
@param rowIndex index of the row to be inserted
@param rowSpec specification of the row to be inserted
@throws IndexOutOfBoundsException if the row index is out of range
"""
if (rowIndex < 1 || rowIndex > getRowCount()) {
throw new IndexOutOfBoundsException(
"The row index " + rowIndex
+ " must be in the range [1, " + getRowCount() + "].");
}
rowSpecs.add(rowIndex - 1, rowSpec);
shiftComponentsVertically(rowIndex, false);
adjustGroupIndices(rowGroupIndices, rowIndex, false);
} | java | public void insertRow(int rowIndex, RowSpec rowSpec) {
if (rowIndex < 1 || rowIndex > getRowCount()) {
throw new IndexOutOfBoundsException(
"The row index " + rowIndex
+ " must be in the range [1, " + getRowCount() + "].");
}
rowSpecs.add(rowIndex - 1, rowSpec);
shiftComponentsVertically(rowIndex, false);
adjustGroupIndices(rowGroupIndices, rowIndex, false);
} | [
"public",
"void",
"insertRow",
"(",
"int",
"rowIndex",
",",
"RowSpec",
"rowSpec",
")",
"{",
"if",
"(",
"rowIndex",
"<",
"1",
"||",
"rowIndex",
">",
"getRowCount",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"The row index \"",
"+"... | Inserts the specified column at the specified position. Shifts components that intersect the
new column to the right and readjusts column groups.<p>
The component shift works as follows: components that were located on the right hand side of
the inserted column are shifted one column to the right; component column span is increased
by one if it intersects the new column.<p>
Column group indices that are greater or equal than the given column index will be increased
by one.
@param rowIndex index of the row to be inserted
@param rowSpec specification of the row to be inserted
@throws IndexOutOfBoundsException if the row index is out of range | [
"Inserts",
"the",
"specified",
"column",
"at",
"the",
"specified",
"position",
".",
"Shifts",
"components",
"that",
"intersect",
"the",
"new",
"column",
"to",
"the",
"right",
"and",
"readjusts",
"column",
"groups",
".",
"<p",
">"
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L597-L606 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GGradientToEdgeFeatures.java | GGradientToEdgeFeatures.nonMaxSuppressionCrude4 | static public <D extends ImageGray<D>>
void nonMaxSuppressionCrude4(GrayF32 intensity , D derivX , D derivY , GrayF32 output ) {
"""
<p>
Sets edge intensities to zero if the pixel has an intensity which is less than any of
the two adjacent pixels. Pixel adjacency is determined based upon the sign of the image gradient. Less precise
than other methods, but faster.
</p>
@param intensity Edge intensities. Not modified.
@param derivX Image derivative along x-axis.
@param derivY Image derivative along y-axis.
@param output Filtered intensity. Modified.
"""
if( derivX instanceof GrayF32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayF32) derivX, (GrayF32) derivY,output);
} else if( derivX instanceof GrayS16) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS16) derivX, (GrayS16) derivY,output);
} else if( derivX instanceof GrayS32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS32) derivX, (GrayS32) derivY,output);
} else {
throw new IllegalArgumentException("Unknown input type");
}
} | java | static public <D extends ImageGray<D>>
void nonMaxSuppressionCrude4(GrayF32 intensity , D derivX , D derivY , GrayF32 output )
{
if( derivX instanceof GrayF32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayF32) derivX, (GrayF32) derivY,output);
} else if( derivX instanceof GrayS16) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS16) derivX, (GrayS16) derivY,output);
} else if( derivX instanceof GrayS32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS32) derivX, (GrayS32) derivY,output);
} else {
throw new IllegalArgumentException("Unknown input type");
}
} | [
"static",
"public",
"<",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"void",
"nonMaxSuppressionCrude4",
"(",
"GrayF32",
"intensity",
",",
"D",
"derivX",
",",
"D",
"derivY",
",",
"GrayF32",
"output",
")",
"{",
"if",
"(",
"derivX",
"instanceof",
"GrayF3... | <p>
Sets edge intensities to zero if the pixel has an intensity which is less than any of
the two adjacent pixels. Pixel adjacency is determined based upon the sign of the image gradient. Less precise
than other methods, but faster.
</p>
@param intensity Edge intensities. Not modified.
@param derivX Image derivative along x-axis.
@param derivY Image derivative along y-axis.
@param output Filtered intensity. Modified. | [
"<p",
">",
"Sets",
"edge",
"intensities",
"to",
"zero",
"if",
"the",
"pixel",
"has",
"an",
"intensity",
"which",
"is",
"less",
"than",
"any",
"of",
"the",
"two",
"adjacent",
"pixels",
".",
"Pixel",
"adjacency",
"is",
"determined",
"based",
"upon",
"the",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GGradientToEdgeFeatures.java#L130-L142 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArrayFor | public static <T> Level0ArrayOperator<Byte[],Byte> onArrayFor(final Byte... elements) {
"""
<p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining
"""
return onArrayOf(Types.BYTE, VarArgsUtil.asRequiredObjectArray(elements));
} | java | public static <T> Level0ArrayOperator<Byte[],Byte> onArrayFor(final Byte... elements) {
return onArrayOf(Types.BYTE, VarArgsUtil.asRequiredObjectArray(elements));
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Byte",
"[",
"]",
",",
"Byte",
">",
"onArrayFor",
"(",
"final",
"Byte",
"...",
"elements",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"BYTE",
",",
"VarArgsUtil",
".",
"asRequiredObject... | <p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"array",
"with",
"the",
"specified",
"elements",
"and",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"it",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L880-L882 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/component/container/UITabGroup.java | UITabGroup.attachTo | public UITabGroup attachTo(UIContainer container, boolean displace) {
"""
Attach this {@link UITabGroup} to a {@link UIContainer}.
@param container the container to attach to.
@param displace if true, moves and resize the UIContainer to make place for the UITabGroup
@return this {@link UITab}
"""
attachedContainer = container;
if (activeTab != null)
activeTab.setActive(true);
switch (tabPosition)
{
case TOP:
setPosition(Position.above(this, container, -2));
break;
case BOTTOM:
setPosition(Position.below(this, container, -2));
break;
case LEFT:
setPosition(Position.leftOf(this, container, -2));
break;
case RIGHT:
setPosition(Position.rightOf(this, container, -2));
break;
}
for (UIContainer tabContainer : listTabs.values())
setupTabContainer(tabContainer);
calculateTabPosition();
if (activeTab != null)
{
UITab tab = activeTab;
activeTab = null;
setActiveTab(tab);
}
if (displace)
{
attachedContainer.setPosition(new AttachedContainerPosition(attachedContainer.position()));
attachedContainer.setSize(new AttachedContainerSize(attachedContainer.size()));
}
return this;
} | java | public UITabGroup attachTo(UIContainer container, boolean displace)
{
attachedContainer = container;
if (activeTab != null)
activeTab.setActive(true);
switch (tabPosition)
{
case TOP:
setPosition(Position.above(this, container, -2));
break;
case BOTTOM:
setPosition(Position.below(this, container, -2));
break;
case LEFT:
setPosition(Position.leftOf(this, container, -2));
break;
case RIGHT:
setPosition(Position.rightOf(this, container, -2));
break;
}
for (UIContainer tabContainer : listTabs.values())
setupTabContainer(tabContainer);
calculateTabPosition();
if (activeTab != null)
{
UITab tab = activeTab;
activeTab = null;
setActiveTab(tab);
}
if (displace)
{
attachedContainer.setPosition(new AttachedContainerPosition(attachedContainer.position()));
attachedContainer.setSize(new AttachedContainerSize(attachedContainer.size()));
}
return this;
} | [
"public",
"UITabGroup",
"attachTo",
"(",
"UIContainer",
"container",
",",
"boolean",
"displace",
")",
"{",
"attachedContainer",
"=",
"container",
";",
"if",
"(",
"activeTab",
"!=",
"null",
")",
"activeTab",
".",
"setActive",
"(",
"true",
")",
";",
"switch",
... | Attach this {@link UITabGroup} to a {@link UIContainer}.
@param container the container to attach to.
@param displace if true, moves and resize the UIContainer to make place for the UITabGroup
@return this {@link UITab} | [
"Attach",
"this",
"{",
"@link",
"UITabGroup",
"}",
"to",
"a",
"{",
"@link",
"UIContainer",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/component/container/UITabGroup.java#L299-L340 |
Azure/azure-sdk-for-java | locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java | ManagementLocksInner.listByResourceGroupAsync | public Observable<Page<ManagementLockObjectInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter) {
"""
Gets all the management locks for a resource group.
@param resourceGroupName The name of the resource group containing the locks to get.
@param filter The filter to apply on the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ManagementLockObjectInner> object
"""
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter)
.map(new Func1<ServiceResponse<Page<ManagementLockObjectInner>>, Page<ManagementLockObjectInner>>() {
@Override
public Page<ManagementLockObjectInner> call(ServiceResponse<Page<ManagementLockObjectInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ManagementLockObjectInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter)
.map(new Func1<ServiceResponse<Page<ManagementLockObjectInner>>, Page<ManagementLockObjectInner>>() {
@Override
public Page<ManagementLockObjectInner> call(ServiceResponse<Page<ManagementLockObjectInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ManagementLockObjectInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"filter",
")",
"{",
"return",
"listByResourceGroupWithServiceResponseAsync",
"(",
"resourceGro... | Gets all the management locks for a resource group.
@param resourceGroupName The name of the resource group containing the locks to get.
@param filter The filter to apply on the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ManagementLockObjectInner> object | [
"Gets",
"all",
"the",
"management",
"locks",
"for",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L1444-L1452 |
jenkinsci/jenkins | core/src/main/java/hudson/model/AbstractProject.java | AbstractProject.scheduleBuild2 | @WithBridgeMethods(Future.class)
public QueueTaskFuture<R> scheduleBuild2(int quietPeriod, Cause c, Action... actions) {
"""
Schedules a build of this project, and returns a {@link Future} object
to wait for the completion of the build.
@param actions
For the convenience of the caller, this array can contain null, and those will be silently ignored.
"""
return scheduleBuild2(quietPeriod,c,Arrays.asList(actions));
} | java | @WithBridgeMethods(Future.class)
public QueueTaskFuture<R> scheduleBuild2(int quietPeriod, Cause c, Action... actions) {
return scheduleBuild2(quietPeriod,c,Arrays.asList(actions));
} | [
"@",
"WithBridgeMethods",
"(",
"Future",
".",
"class",
")",
"public",
"QueueTaskFuture",
"<",
"R",
">",
"scheduleBuild2",
"(",
"int",
"quietPeriod",
",",
"Cause",
"c",
",",
"Action",
"...",
"actions",
")",
"{",
"return",
"scheduleBuild2",
"(",
"quietPeriod",
... | Schedules a build of this project, and returns a {@link Future} object
to wait for the completion of the build.
@param actions
For the convenience of the caller, this array can contain null, and those will be silently ignored. | [
"Schedules",
"a",
"build",
"of",
"this",
"project",
"and",
"returns",
"a",
"{",
"@link",
"Future",
"}",
"object",
"to",
"wait",
"for",
"the",
"completion",
"of",
"the",
"build",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractProject.java#L806-L809 |
threerings/narya | core/src/main/java/com/threerings/bureau/server/BureauRegistry.java | BureauRegistry.bureauInitialized | protected void bureauInitialized (ClientObject client, String bureauId) {
"""
Callback for when the bureau client acknowledges starting up. Starts all pending agents and
causes subsequent agent start requests to be sent directly to the bureau.
"""
final Bureau bureau = _bureaus.get(bureauId);
if (bureau == null) {
log.warning("Initialization of non-existent bureau", "bureauId", bureauId);
return;
}
bureau.clientObj = client;
log.info("Bureau created, launching pending agents", "bureau", bureau);
// find all pending agents
Set<AgentObject> pending = Sets.newHashSet();
for (Map.Entry<AgentObject, AgentState> entry :
bureau.agentStates.entrySet()) {
if (entry.getValue() == AgentState.PENDING) {
pending.add(entry.getKey());
}
}
// create them
for (AgentObject agent : pending) {
log.info("Creating agent", "agent", agent.which());
BureauSender.createAgent(bureau.clientObj, agent.getOid());
bureau.agentStates.put(agent, AgentState.STARTED);
}
bureau.summarize();
} | java | protected void bureauInitialized (ClientObject client, String bureauId)
{
final Bureau bureau = _bureaus.get(bureauId);
if (bureau == null) {
log.warning("Initialization of non-existent bureau", "bureauId", bureauId);
return;
}
bureau.clientObj = client;
log.info("Bureau created, launching pending agents", "bureau", bureau);
// find all pending agents
Set<AgentObject> pending = Sets.newHashSet();
for (Map.Entry<AgentObject, AgentState> entry :
bureau.agentStates.entrySet()) {
if (entry.getValue() == AgentState.PENDING) {
pending.add(entry.getKey());
}
}
// create them
for (AgentObject agent : pending) {
log.info("Creating agent", "agent", agent.which());
BureauSender.createAgent(bureau.clientObj, agent.getOid());
bureau.agentStates.put(agent, AgentState.STARTED);
}
bureau.summarize();
} | [
"protected",
"void",
"bureauInitialized",
"(",
"ClientObject",
"client",
",",
"String",
"bureauId",
")",
"{",
"final",
"Bureau",
"bureau",
"=",
"_bureaus",
".",
"get",
"(",
"bureauId",
")",
";",
"if",
"(",
"bureau",
"==",
"null",
")",
"{",
"log",
".",
"w... | Callback for when the bureau client acknowledges starting up. Starts all pending agents and
causes subsequent agent start requests to be sent directly to the bureau. | [
"Callback",
"for",
"when",
"the",
"bureau",
"client",
"acknowledges",
"starting",
"up",
".",
"Starts",
"all",
"pending",
"agents",
"and",
"causes",
"subsequent",
"agent",
"start",
"requests",
"to",
"be",
"sent",
"directly",
"to",
"the",
"bureau",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/bureau/server/BureauRegistry.java#L374-L405 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java | FailoverGroupsInner.createOrUpdate | public FailoverGroupInner createOrUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) {
"""
Creates or updates a failover group.
@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 containing the failover group.
@param failoverGroupName The name of the failover group.
@param parameters The failover group parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FailoverGroupInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().last().body();
} | java | public FailoverGroupInner createOrUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().last().body();
} | [
"public",
"FailoverGroupInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"failoverGroupName",
",",
"FailoverGroupInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupNam... | Creates or updates a failover group.
@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 containing the failover group.
@param failoverGroupName The name of the failover group.
@param parameters The failover group parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FailoverGroupInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"failover",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L226-L228 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeValueForTrafficDirection | public static void setPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index, String value) {
"""
Set the preferred value of traffic direction
used in the attributes for the traffic direction on the roads.
@param direction a direction.
@param index is the index of the supported string to reply
@param value is the preferred name for the traffic direction on the roads.
"""
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder keyName = new StringBuilder();
keyName.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
keyName.append(direction.name());
keyName.append("_"); //$NON-NLS-1$
keyName.append(index);
String sysDef;
try {
sysDef = getSystemDefault(direction, index);
} catch (IndexOutOfBoundsException exception) {
sysDef = null;
}
if (value == null || "".equals(value) //$NON-NLS-1$
|| (sysDef != null && sysDef.equalsIgnoreCase(value))) {
prefs.remove(keyName.toString());
return;
}
prefs.put(keyName.toString(), value);
}
} | java | public static void setPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder keyName = new StringBuilder();
keyName.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
keyName.append(direction.name());
keyName.append("_"); //$NON-NLS-1$
keyName.append(index);
String sysDef;
try {
sysDef = getSystemDefault(direction, index);
} catch (IndexOutOfBoundsException exception) {
sysDef = null;
}
if (value == null || "".equals(value) //$NON-NLS-1$
|| (sysDef != null && sysDef.equalsIgnoreCase(value))) {
prefs.remove(keyName.toString());
return;
}
prefs.put(keyName.toString(), value);
}
} | [
"public",
"static",
"void",
"setPreferredAttributeValueForTrafficDirection",
"(",
"TrafficDirection",
"direction",
",",
"int",
"index",
",",
"String",
"value",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkCon... | Set the preferred value of traffic direction
used in the attributes for the traffic direction on the roads.
@param direction a direction.
@param index is the index of the supported string to reply
@param value is the preferred name for the traffic direction on the roads. | [
"Set",
"the",
"preferred",
"value",
"of",
"traffic",
"direction",
"used",
"in",
"the",
"attributes",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L550-L571 |
calrissian/mango | mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java | JsonMetadata.hasArrayIndex | static boolean hasArrayIndex(Map<String,String> meta, int level) {
"""
Determines whether or not a map of metadata contains array index information at the
given level in a flattened json tree.
@param meta
@param level
@return
"""
return meta.containsKey(level + ARRAY_IDX_SUFFIX);
} | java | static boolean hasArrayIndex(Map<String,String> meta, int level) {
return meta.containsKey(level + ARRAY_IDX_SUFFIX);
} | [
"static",
"boolean",
"hasArrayIndex",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"meta",
",",
"int",
"level",
")",
"{",
"return",
"meta",
".",
"containsKey",
"(",
"level",
"+",
"ARRAY_IDX_SUFFIX",
")",
";",
"}"
] | Determines whether or not a map of metadata contains array index information at the
given level in a flattened json tree.
@param meta
@param level
@return | [
"Determines",
"whether",
"or",
"not",
"a",
"map",
"of",
"metadata",
"contains",
"array",
"index",
"information",
"at",
"the",
"given",
"level",
"in",
"a",
"flattened",
"json",
"tree",
"."
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java#L65-L67 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.addCustomFunction | public void addCustomFunction(String name, int numArgs, CustomFunction function) {
"""
Registers a CustomFunction callback as a function that can be called from
SQLite database triggers.
@param name the name of the sqlite3 function
@param numArgs the number of arguments for the function
@param function callback to call when the function is executed
@hide
"""
// Create wrapper (also validates arguments).
SQLiteCustomFunction wrapper = new SQLiteCustomFunction(name, numArgs, function);
synchronized (mLock) {
throwIfNotOpenLocked();
mConfigurationLocked.customFunctions.add(wrapper);
try {
mConnectionPoolLocked.reconfigure(mConfigurationLocked);
} catch (RuntimeException ex) {
mConfigurationLocked.customFunctions.remove(wrapper);
throw ex;
}
}
} | java | public void addCustomFunction(String name, int numArgs, CustomFunction function) {
// Create wrapper (also validates arguments).
SQLiteCustomFunction wrapper = new SQLiteCustomFunction(name, numArgs, function);
synchronized (mLock) {
throwIfNotOpenLocked();
mConfigurationLocked.customFunctions.add(wrapper);
try {
mConnectionPoolLocked.reconfigure(mConfigurationLocked);
} catch (RuntimeException ex) {
mConfigurationLocked.customFunctions.remove(wrapper);
throw ex;
}
}
} | [
"public",
"void",
"addCustomFunction",
"(",
"String",
"name",
",",
"int",
"numArgs",
",",
"CustomFunction",
"function",
")",
"{",
"// Create wrapper (also validates arguments).",
"SQLiteCustomFunction",
"wrapper",
"=",
"new",
"SQLiteCustomFunction",
"(",
"name",
",",
"n... | Registers a CustomFunction callback as a function that can be called from
SQLite database triggers.
@param name the name of the sqlite3 function
@param numArgs the number of arguments for the function
@param function callback to call when the function is executed
@hide | [
"Registers",
"a",
"CustomFunction",
"callback",
"as",
"a",
"function",
"that",
"can",
"be",
"called",
"from",
"SQLite",
"database",
"triggers",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L845-L860 |
twitter/hraven | hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserBase.java | JobHistoryFileParserBase.getHadoopVersionPut | public Put getHadoopVersionPut(HadoopVersion historyFileVersion, byte[] jobKeyBytes) {
"""
generates a put that sets the hadoop version for a record
@param historyFileVersion
@param jobKeyBytes
@return Put
"""
Put pVersion = new Put(jobKeyBytes);
byte[] valueBytes = null;
valueBytes = Bytes.toBytes(historyFileVersion.toString());
byte[] qualifier = Bytes.toBytes(JobHistoryKeys.hadoopversion.toString().toLowerCase());
pVersion.add(Constants.INFO_FAM_BYTES, qualifier, valueBytes);
return pVersion;
} | java | public Put getHadoopVersionPut(HadoopVersion historyFileVersion, byte[] jobKeyBytes) {
Put pVersion = new Put(jobKeyBytes);
byte[] valueBytes = null;
valueBytes = Bytes.toBytes(historyFileVersion.toString());
byte[] qualifier = Bytes.toBytes(JobHistoryKeys.hadoopversion.toString().toLowerCase());
pVersion.add(Constants.INFO_FAM_BYTES, qualifier, valueBytes);
return pVersion;
} | [
"public",
"Put",
"getHadoopVersionPut",
"(",
"HadoopVersion",
"historyFileVersion",
",",
"byte",
"[",
"]",
"jobKeyBytes",
")",
"{",
"Put",
"pVersion",
"=",
"new",
"Put",
"(",
"jobKeyBytes",
")",
";",
"byte",
"[",
"]",
"valueBytes",
"=",
"null",
";",
"valueBy... | generates a put that sets the hadoop version for a record
@param historyFileVersion
@param jobKeyBytes
@return Put | [
"generates",
"a",
"put",
"that",
"sets",
"the",
"hadoop",
"version",
"for",
"a",
"record"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserBase.java#L57-L64 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java | Entity.getHighlight | public Highlight getHighlight(Field field, Object instance) {
"""
Looks for an apropiate highlight for this field+instance
@param field
@param instance
@return the highlight
"""
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlight(this, field, instance);
} | java | public Highlight getHighlight(Field field, Object instance) {
if (getHighlights() == null) {
return null;
}
return getHighlights().getHighlight(this, field, instance);
} | [
"public",
"Highlight",
"getHighlight",
"(",
"Field",
"field",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"getHighlights",
"(",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"getHighlights",
"(",
")",
".",
"getHighlight",
"(",
"t... | Looks for an apropiate highlight for this field+instance
@param field
@param instance
@return the highlight | [
"Looks",
"for",
"an",
"apropiate",
"highlight",
"for",
"this",
"field",
"+",
"instance"
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L556-L561 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.updateTagAsync | public Observable<Tag> updateTagAsync(UUID projectId, UUID tagId, Tag updatedTag) {
"""
Update a tag.
@param projectId The project id
@param tagId The id of the target tag
@param updatedTag The updated tag model
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Tag object
"""
return updateTagWithServiceResponseAsync(projectId, tagId, updatedTag).map(new Func1<ServiceResponse<Tag>, Tag>() {
@Override
public Tag call(ServiceResponse<Tag> response) {
return response.body();
}
});
} | java | public Observable<Tag> updateTagAsync(UUID projectId, UUID tagId, Tag updatedTag) {
return updateTagWithServiceResponseAsync(projectId, tagId, updatedTag).map(new Func1<ServiceResponse<Tag>, Tag>() {
@Override
public Tag call(ServiceResponse<Tag> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Tag",
">",
"updateTagAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"tagId",
",",
"Tag",
"updatedTag",
")",
"{",
"return",
"updateTagWithServiceResponseAsync",
"(",
"projectId",
",",
"tagId",
",",
"updatedTag",
")",
".",
"map",
"(... | Update a tag.
@param projectId The project id
@param tagId The id of the target tag
@param updatedTag The updated tag model
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Tag object | [
"Update",
"a",
"tag",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L630-L637 |
alipay/sofa-rpc | extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/BoltClientTransport.java | BoltClientTransport.doInvokeAsync | protected ResponseFuture doInvokeAsync(SofaRequest request, RpcInternalContext rpcContext,
InvokeContext invokeContext, int timeoutMillis)
throws RemotingException, InterruptedException {
"""
异步调用
@param request 请求对象
@param rpcContext RPC内置上下文
@param invokeContext 调用上下文
@param timeoutMillis 超时时间(毫秒)
@throws RemotingException 远程调用异常
@throws InterruptedException 中断异常
@since 5.2.0
"""
SofaResponseCallback listener = request.getSofaResponseCallback();
if (listener != null) {
// callback调用
InvokeCallback callback = new BoltInvokerCallback(transportConfig.getConsumerConfig(),
transportConfig.getProviderInfo(), listener, request, rpcContext,
ClassLoaderUtils.getCurrentClassLoader());
// 发起调用
RPC_CLIENT.invokeWithCallback(url, request, invokeContext, callback, timeoutMillis);
return null;
} else {
// future 转为 callback
BoltResponseFuture future = new BoltResponseFuture(request, timeoutMillis);
InvokeCallback callback = new BoltFutureInvokeCallback(transportConfig.getConsumerConfig(),
transportConfig.getProviderInfo(), future, request, rpcContext,
ClassLoaderUtils.getCurrentClassLoader());
// 发起调用
RPC_CLIENT.invokeWithCallback(url, request, invokeContext, callback, timeoutMillis);
future.setSentTime();
return future;
}
} | java | protected ResponseFuture doInvokeAsync(SofaRequest request, RpcInternalContext rpcContext,
InvokeContext invokeContext, int timeoutMillis)
throws RemotingException, InterruptedException {
SofaResponseCallback listener = request.getSofaResponseCallback();
if (listener != null) {
// callback调用
InvokeCallback callback = new BoltInvokerCallback(transportConfig.getConsumerConfig(),
transportConfig.getProviderInfo(), listener, request, rpcContext,
ClassLoaderUtils.getCurrentClassLoader());
// 发起调用
RPC_CLIENT.invokeWithCallback(url, request, invokeContext, callback, timeoutMillis);
return null;
} else {
// future 转为 callback
BoltResponseFuture future = new BoltResponseFuture(request, timeoutMillis);
InvokeCallback callback = new BoltFutureInvokeCallback(transportConfig.getConsumerConfig(),
transportConfig.getProviderInfo(), future, request, rpcContext,
ClassLoaderUtils.getCurrentClassLoader());
// 发起调用
RPC_CLIENT.invokeWithCallback(url, request, invokeContext, callback, timeoutMillis);
future.setSentTime();
return future;
}
} | [
"protected",
"ResponseFuture",
"doInvokeAsync",
"(",
"SofaRequest",
"request",
",",
"RpcInternalContext",
"rpcContext",
",",
"InvokeContext",
"invokeContext",
",",
"int",
"timeoutMillis",
")",
"throws",
"RemotingException",
",",
"InterruptedException",
"{",
"SofaResponseCal... | 异步调用
@param request 请求对象
@param rpcContext RPC内置上下文
@param invokeContext 调用上下文
@param timeoutMillis 超时时间(毫秒)
@throws RemotingException 远程调用异常
@throws InterruptedException 中断异常
@since 5.2.0 | [
"异步调用"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/BoltClientTransport.java#L214-L237 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/windows/WindowsProcessFaxClientSpi.java | WindowsProcessFaxClientSpi.createProcessCommandArgumentsForExistingFaxJob | protected String createProcessCommandArgumentsForExistingFaxJob(String faxActionTypeArgument,FaxJob faxJob) {
"""
This function creates and returns the command line arguments for the fax4j
external exe when running an action on an existing fax job.
@param faxActionTypeArgument
The fax action type argument
@param faxJob
The fax job object
@return The full command line arguments line
"""
//get values from fax job
String faxJobID=faxJob.getID();
//init buffer
StringBuilder buffer=new StringBuilder();
//create command line arguments
this.addCommandLineArgument(buffer,Fax4jExeConstants.ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),faxActionTypeArgument);
this.addCommandLineArgument(buffer,Fax4jExeConstants.SERVER_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),this.faxServerName);
this.addCommandLineArgument(buffer,Fax4jExeConstants.FAX_JOB_ID_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),String.valueOf(faxJobID));
//get text
String commandArguments=buffer.toString();
return commandArguments;
} | java | protected String createProcessCommandArgumentsForExistingFaxJob(String faxActionTypeArgument,FaxJob faxJob)
{
//get values from fax job
String faxJobID=faxJob.getID();
//init buffer
StringBuilder buffer=new StringBuilder();
//create command line arguments
this.addCommandLineArgument(buffer,Fax4jExeConstants.ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),faxActionTypeArgument);
this.addCommandLineArgument(buffer,Fax4jExeConstants.SERVER_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),this.faxServerName);
this.addCommandLineArgument(buffer,Fax4jExeConstants.FAX_JOB_ID_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),String.valueOf(faxJobID));
//get text
String commandArguments=buffer.toString();
return commandArguments;
} | [
"protected",
"String",
"createProcessCommandArgumentsForExistingFaxJob",
"(",
"String",
"faxActionTypeArgument",
",",
"FaxJob",
"faxJob",
")",
"{",
"//get values from fax job",
"String",
"faxJobID",
"=",
"faxJob",
".",
"getID",
"(",
")",
";",
"//init buffer",
"StringBuild... | This function creates and returns the command line arguments for the fax4j
external exe when running an action on an existing fax job.
@param faxActionTypeArgument
The fax action type argument
@param faxJob
The fax job object
@return The full command line arguments line | [
"This",
"function",
"creates",
"and",
"returns",
"the",
"command",
"line",
"arguments",
"for",
"the",
"fax4j",
"external",
"exe",
"when",
"running",
"an",
"action",
"on",
"an",
"existing",
"fax",
"job",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsProcessFaxClientSpi.java#L387-L404 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readResources | public List<CmsResource> readResources(String resourcename, CmsResourceFilter filter) throws CmsException {
"""
Reads all resources below the given path matching the filter criteria,
including the full tree below the path.<p>
@param resourcename the parent path to read the resources from
@param filter the filter
@return a list of <code>{@link CmsResource}</code> objects matching the filter criteria
@throws CmsException if something goes wrong
@see #readResources(String, CmsResourceFilter, boolean)
"""
return readResources(resourcename, filter, true);
} | java | public List<CmsResource> readResources(String resourcename, CmsResourceFilter filter) throws CmsException {
return readResources(resourcename, filter, true);
} | [
"public",
"List",
"<",
"CmsResource",
">",
"readResources",
"(",
"String",
"resourcename",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"return",
"readResources",
"(",
"resourcename",
",",
"filter",
",",
"true",
")",
";",
"}"
] | Reads all resources below the given path matching the filter criteria,
including the full tree below the path.<p>
@param resourcename the parent path to read the resources from
@param filter the filter
@return a list of <code>{@link CmsResource}</code> objects matching the filter criteria
@throws CmsException if something goes wrong
@see #readResources(String, CmsResourceFilter, boolean) | [
"Reads",
"all",
"resources",
"below",
"the",
"given",
"path",
"matching",
"the",
"filter",
"criteria",
"including",
"the",
"full",
"tree",
"below",
"the",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3248-L3251 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/DefaultSplitCharacter.java | DefaultSplitCharacter.getCurrentCharacter | protected char getCurrentCharacter(int current, char[] cc, PdfChunk[] ck) {
"""
Returns the current character
@param current current position in the array
@param cc the character array that has to be checked
@param ck chunk array
@return the current character
"""
if (ck == null) {
return cc[current];
}
return (char)ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]);
} | java | protected char getCurrentCharacter(int current, char[] cc, PdfChunk[] ck) {
if (ck == null) {
return cc[current];
}
return (char)ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]);
} | [
"protected",
"char",
"getCurrentCharacter",
"(",
"int",
"current",
",",
"char",
"[",
"]",
"cc",
",",
"PdfChunk",
"[",
"]",
"ck",
")",
"{",
"if",
"(",
"ck",
"==",
"null",
")",
"{",
"return",
"cc",
"[",
"current",
"]",
";",
"}",
"return",
"(",
"char"... | Returns the current character
@param current current position in the array
@param cc the character array that has to be checked
@param ck chunk array
@return the current character | [
"Returns",
"the",
"current",
"character"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/DefaultSplitCharacter.java#L101-L106 |
HsiangLeekwok/hlklib | hlklib/src/main/java/com/hlk/hlklib/lib/emoji/EmojiUtility.java | EmojiUtility.getEmojiString | public static SpannableString getEmojiString(Context context, String string, boolean adjustEmoji) {
"""
得到一个SpanableString对象。通过传入的字符串进行正则判断,将其中的表情符号转换成表情图片
@param context context
@param string original text
@param adjustEmoji 是否将表情图片缩放成文字大小
@return SpannableStringBuilder
"""
if (null == EmojiList) {
initEmojiItems(context);
}
// 转换 Html,去掉两个表情之间的多个空格
Spanned spanned = Html.fromHtml(string.replace(" ", ""));
SpannableString spannableString = new SpannableString(spanned);
// 通过传入的正则表达式来生成一个pattern
Pattern emojiPatten = Pattern.compile(FACE_REGULAR, Pattern.CASE_INSENSITIVE);
try {
dealExpression(context, spannableString, emojiPatten, 0, adjustEmoji);
} catch (Exception e) {
e.printStackTrace();
}
return spannableString;
} | java | public static SpannableString getEmojiString(Context context, String string, boolean adjustEmoji) {
if (null == EmojiList) {
initEmojiItems(context);
}
// 转换 Html,去掉两个表情之间的多个空格
Spanned spanned = Html.fromHtml(string.replace(" ", ""));
SpannableString spannableString = new SpannableString(spanned);
// 通过传入的正则表达式来生成一个pattern
Pattern emojiPatten = Pattern.compile(FACE_REGULAR, Pattern.CASE_INSENSITIVE);
try {
dealExpression(context, spannableString, emojiPatten, 0, adjustEmoji);
} catch (Exception e) {
e.printStackTrace();
}
return spannableString;
} | [
"public",
"static",
"SpannableString",
"getEmojiString",
"(",
"Context",
"context",
",",
"String",
"string",
",",
"boolean",
"adjustEmoji",
")",
"{",
"if",
"(",
"null",
"==",
"EmojiList",
")",
"{",
"initEmojiItems",
"(",
"context",
")",
";",
"}",
"// 转换 Html,去... | 得到一个SpanableString对象。通过传入的字符串进行正则判断,将其中的表情符号转换成表情图片
@param context context
@param string original text
@param adjustEmoji 是否将表情图片缩放成文字大小
@return SpannableStringBuilder | [
"得到一个SpanableString对象。通过传入的字符串进行正则判断,将其中的表情符号转换成表情图片"
] | train | https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/lib/emoji/EmojiUtility.java#L85-L100 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.generateOmemoSignedPreKey | public T_SigPreKey generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair, int signedPreKeyId)
throws CorruptedOmemoKeyException {
"""
Generate a new signed preKey.
@param identityKeyPair identityKeyPair used to sign the preKey
@param signedPreKeyId id that the preKey will have
@return signedPreKey
@throws CorruptedOmemoKeyException when something goes wrong
"""
return keyUtil().generateOmemoSignedPreKey(identityKeyPair, signedPreKeyId);
} | java | public T_SigPreKey generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair, int signedPreKeyId)
throws CorruptedOmemoKeyException {
return keyUtil().generateOmemoSignedPreKey(identityKeyPair, signedPreKeyId);
} | [
"public",
"T_SigPreKey",
"generateOmemoSignedPreKey",
"(",
"T_IdKeyPair",
"identityKeyPair",
",",
"int",
"signedPreKeyId",
")",
"throws",
"CorruptedOmemoKeyException",
"{",
"return",
"keyUtil",
"(",
")",
".",
"generateOmemoSignedPreKey",
"(",
"identityKeyPair",
",",
"sign... | Generate a new signed preKey.
@param identityKeyPair identityKeyPair used to sign the preKey
@param signedPreKeyId id that the preKey will have
@return signedPreKey
@throws CorruptedOmemoKeyException when something goes wrong | [
"Generate",
"a",
"new",
"signed",
"preKey",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L456-L459 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java | TorqueDBHandling.readTextsCompressed | private void readTextsCompressed(File dir, HashMap results) throws IOException {
"""
Reads the text files in the given directory and puts their content
in the given map after compressing it. Note that this method does not
traverse recursivly into sub-directories.
@param dir The directory to process
@param results Map that will receive the contents (indexed by the relative filenames)
@throws IOException If an error ocurred
"""
if (dir.exists() && dir.isDirectory())
{
File[] files = dir.listFiles();
for (int idx = 0; idx < files.length; idx++)
{
if (files[idx].isDirectory())
{
continue;
}
results.put(files[idx].getName(), readTextCompressed(files[idx]));
}
}
} | java | private void readTextsCompressed(File dir, HashMap results) throws IOException
{
if (dir.exists() && dir.isDirectory())
{
File[] files = dir.listFiles();
for (int idx = 0; idx < files.length; idx++)
{
if (files[idx].isDirectory())
{
continue;
}
results.put(files[idx].getName(), readTextCompressed(files[idx]));
}
}
} | [
"private",
"void",
"readTextsCompressed",
"(",
"File",
"dir",
",",
"HashMap",
"results",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dir",
".",
"exists",
"(",
")",
"&&",
"dir",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"[",
"]",
"files",
"=",
... | Reads the text files in the given directory and puts their content
in the given map after compressing it. Note that this method does not
traverse recursivly into sub-directories.
@param dir The directory to process
@param results Map that will receive the contents (indexed by the relative filenames)
@throws IOException If an error ocurred | [
"Reads",
"the",
"text",
"files",
"in",
"the",
"given",
"directory",
"and",
"puts",
"their",
"content",
"in",
"the",
"given",
"map",
"after",
"compressing",
"it",
".",
"Note",
"that",
"this",
"method",
"does",
"not",
"traverse",
"recursivly",
"into",
"sub",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java#L572-L587 |
carewebframework/carewebframework-vista | org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java | ESigList.add | public ESigItem add(IESigType eSigType, String id, String text, String subGroupName, SignState signState, String data,
String session) {
"""
Ads a new sig item to the list, given the required elements.
@param eSigType The esignature type.
@param id The item id.
@param text The description text.
@param subGroupName The sub group name.
@param signState The signature state.
@param data The data object.
@param session The session id.
@return New sig item.
"""
ESigItem item = new ESigItem(eSigType, id);
item.setText(text);
item.setSubGroupName(subGroupName);
item.setSignState(signState);
item.setData(data);
item.setSession(session);
return add(item);
} | java | public ESigItem add(IESigType eSigType, String id, String text, String subGroupName, SignState signState, String data,
String session) {
ESigItem item = new ESigItem(eSigType, id);
item.setText(text);
item.setSubGroupName(subGroupName);
item.setSignState(signState);
item.setData(data);
item.setSession(session);
return add(item);
} | [
"public",
"ESigItem",
"add",
"(",
"IESigType",
"eSigType",
",",
"String",
"id",
",",
"String",
"text",
",",
"String",
"subGroupName",
",",
"SignState",
"signState",
",",
"String",
"data",
",",
"String",
"session",
")",
"{",
"ESigItem",
"item",
"=",
"new",
... | Ads a new sig item to the list, given the required elements.
@param eSigType The esignature type.
@param id The item id.
@param text The description text.
@param subGroupName The sub group name.
@param signState The signature state.
@param data The data object.
@param session The session id.
@return New sig item. | [
"Ads",
"a",
"new",
"sig",
"item",
"to",
"the",
"list",
"given",
"the",
"required",
"elements",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java#L171-L180 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/qualityindicator/impl/hypervolume/PISAHypervolume.java | PISAHypervolume.surfaceUnchangedTo | private double surfaceUnchangedTo(double[][] front, int noPoints, int objective) {
"""
/* calculate next value regarding dimension 'objective'; consider
points referenced in 'front[0..noPoints-1]'
"""
int i;
double minValue, value;
if (noPoints < 1) {
new JMetalException("run-time error");
}
minValue = front[0][objective];
for (i = 1; i < noPoints; i++) {
value = front[i][objective];
if (value < minValue) {
minValue = value;
}
}
return minValue;
} | java | private double surfaceUnchangedTo(double[][] front, int noPoints, int objective) {
int i;
double minValue, value;
if (noPoints < 1) {
new JMetalException("run-time error");
}
minValue = front[0][objective];
for (i = 1; i < noPoints; i++) {
value = front[i][objective];
if (value < minValue) {
minValue = value;
}
}
return minValue;
} | [
"private",
"double",
"surfaceUnchangedTo",
"(",
"double",
"[",
"]",
"[",
"]",
"front",
",",
"int",
"noPoints",
",",
"int",
"objective",
")",
"{",
"int",
"i",
";",
"double",
"minValue",
",",
"value",
";",
"if",
"(",
"noPoints",
"<",
"1",
")",
"{",
"ne... | /* calculate next value regarding dimension 'objective'; consider
points referenced in 'front[0..noPoints-1]' | [
"/",
"*",
"calculate",
"next",
"value",
"regarding",
"dimension",
"objective",
";",
"consider",
"points",
"referenced",
"in",
"front",
"[",
"0",
"..",
"noPoints",
"-",
"1",
"]"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/qualityindicator/impl/hypervolume/PISAHypervolume.java#L135-L151 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/data/AnyValueMap.java | AnyValueMap.getAsTypeWithDefault | public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) {
"""
Converts map element into a value defined by specied typecode. If conversion
is not possible it returns default value.
@param type the Class type that defined the type of the result
@param key a key of element to get.
@param defaultValue the default value
@return element value defined by the typecode or default value if conversion
is not supported.
@see TypeConverter#toTypeWithDefault(Class, Object, Object)
"""
Object value = getAsObject(key);
return TypeConverter.toTypeWithDefault(type, value, defaultValue);
} | java | public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) {
Object value = getAsObject(key);
return TypeConverter.toTypeWithDefault(type, value, defaultValue);
} | [
"public",
"<",
"T",
">",
"T",
"getAsTypeWithDefault",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"key",
",",
"T",
"defaultValue",
")",
"{",
"Object",
"value",
"=",
"getAsObject",
"(",
"key",
")",
";",
"return",
"TypeConverter",
".",
"toTypeWithD... | Converts map element into a value defined by specied typecode. If conversion
is not possible it returns default value.
@param type the Class type that defined the type of the result
@param key a key of element to get.
@param defaultValue the default value
@return element value defined by the typecode or default value if conversion
is not supported.
@see TypeConverter#toTypeWithDefault(Class, Object, Object) | [
"Converts",
"map",
"element",
"into",
"a",
"value",
"defined",
"by",
"specied",
"typecode",
".",
"If",
"conversion",
"is",
"not",
"possible",
"it",
"returns",
"default",
"value",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L495-L498 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/CollectionUtils.java | CollectionUtils.sortIfNotEmpty | public static <T> void sortIfNotEmpty(final List<T> list, final Comparator<? super T> comparator) {
"""
Sort a collection if it is not empty (to prevent {@link ConcurrentModificationException} if an immutable
empty list that has been returned more than once is being sorted in one thread and iterated through in
another thread -- #334).
@param <T>
the element type
@param list
the list
"""
if (!list.isEmpty()) {
Collections.sort(list, comparator);
}
} | java | public static <T> void sortIfNotEmpty(final List<T> list, final Comparator<? super T> comparator) {
if (!list.isEmpty()) {
Collections.sort(list, comparator);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"sortIfNotEmpty",
"(",
"final",
"List",
"<",
"T",
">",
"list",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comparator",
")",
"{",
"if",
"(",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
... | Sort a collection if it is not empty (to prevent {@link ConcurrentModificationException} if an immutable
empty list that has been returned more than once is being sorted in one thread and iterated through in
another thread -- #334).
@param <T>
the element type
@param list
the list | [
"Sort",
"a",
"collection",
"if",
"it",
"is",
"not",
"empty",
"(",
"to",
"prevent",
"{",
"@link",
"ConcurrentModificationException",
"}",
"if",
"an",
"immutable",
"empty",
"list",
"that",
"has",
"been",
"returned",
"more",
"than",
"once",
"is",
"being",
"sort... | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/CollectionUtils.java#L71-L75 |
mgormley/optimize | src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java | LBFGS_port.CUBIC_MINIMIZER | private static double CUBIC_MINIMIZER(double cm, double u, double fu, double du, double v, double fv, double dv) {
"""
Find a minimizer of an interpolated cubic function.
@param cm The minimizer of the interpolated cubic.
@param u The value of one point, u.
@param fu The value of f(u).
@param du The value of f'(u).
@param v The value of another point, v.
@param fv The value of f(v).
@param du The value of f'(v).
"""
double a, d, gamma, theta, p, q, r, s;
d = (v) - (u);
theta = ((fu) - (fv)) * 3 / d + (du) + (dv);
p = Math.abs(theta);
q = Math.abs(du);
r = Math.abs(dv);
s = max3(p, q, r);
/* gamma = s*sqrt((theta/s)**2 - (du/s) * (dv/s)) */
a = theta / s;
gamma = s * Math.sqrt(a * a - ((du) / s) * ((dv) / s));
if ((v) < (u)) gamma = -gamma;
p = gamma - (du) + theta;
q = gamma - (du) + gamma + (dv);
r = p / q;
(cm) = (u) + r * d;
return cm;
} | java | private static double CUBIC_MINIMIZER(double cm, double u, double fu, double du, double v, double fv, double dv) {
double a, d, gamma, theta, p, q, r, s;
d = (v) - (u);
theta = ((fu) - (fv)) * 3 / d + (du) + (dv);
p = Math.abs(theta);
q = Math.abs(du);
r = Math.abs(dv);
s = max3(p, q, r);
/* gamma = s*sqrt((theta/s)**2 - (du/s) * (dv/s)) */
a = theta / s;
gamma = s * Math.sqrt(a * a - ((du) / s) * ((dv) / s));
if ((v) < (u)) gamma = -gamma;
p = gamma - (du) + theta;
q = gamma - (du) + gamma + (dv);
r = p / q;
(cm) = (u) + r * d;
return cm;
} | [
"private",
"static",
"double",
"CUBIC_MINIMIZER",
"(",
"double",
"cm",
",",
"double",
"u",
",",
"double",
"fu",
",",
"double",
"du",
",",
"double",
"v",
",",
"double",
"fv",
",",
"double",
"dv",
")",
"{",
"double",
"a",
",",
"d",
",",
"gamma",
",",
... | Find a minimizer of an interpolated cubic function.
@param cm The minimizer of the interpolated cubic.
@param u The value of one point, u.
@param fu The value of f(u).
@param du The value of f'(u).
@param v The value of another point, v.
@param fv The value of f(v).
@param du The value of f'(v). | [
"Find",
"a",
"minimizer",
"of",
"an",
"interpolated",
"cubic",
"function",
"."
] | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java#L1786-L1803 |
ow2-chameleon/fuchsia | bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java | HubImpl.verifySubscriberRequestedSubscription | public Boolean verifySubscriberRequestedSubscription(SubscriptionRequest sr) throws SubscriptionOriginVerificationException {
"""
Output method that sends a subscription confirmation for the subscriber to avoid DoS attacks, or false subscription.
@param sr
@return True case the subscription was confirmed, or False otherwise
@throws org.ow2.chameleon.fuchsia.push.base.hub.exception.SubscriptionOriginVerificationException
"""
LOG.info("(Hub) -> Subscriber, sending notification to verify the origin of the subscription {}.", sr.getCallback());
SubscriptionConfirmationRequest sc = new SubscriptionConfirmationRequest(sr.getMode(),
sr.getTopic(), "challenge", "0");
URI uri;
try {
uri = new URIBuilder(sr.getCallback()).setParameters(sc.toRequestParameters()).build();
} catch (URISyntaxException e) {
throw new SubscriptionOriginVerificationException("URISyntaxException while sending a confirmation of subscription", e);
}
HttpGet httpGet = new HttpGet(uri);
CloseableHttpClient httpclient = HttpClients.createDefault();
CloseableHttpResponse response;
try {
response = httpclient.execute(httpGet);
} catch (IOException e) {
throw new SubscriptionOriginVerificationException("IOException while sending a confirmation of subscription", e);
}
LOG.info("Subscriber replied with the http code {}.", response.getStatusLine().getStatusCode());
Integer returnedCode = response.getStatusLine().getStatusCode();
// if code is a success code return true, else false
return (199 < returnedCode) && (returnedCode < 300);
} | java | public Boolean verifySubscriberRequestedSubscription(SubscriptionRequest sr) throws SubscriptionOriginVerificationException {
LOG.info("(Hub) -> Subscriber, sending notification to verify the origin of the subscription {}.", sr.getCallback());
SubscriptionConfirmationRequest sc = new SubscriptionConfirmationRequest(sr.getMode(),
sr.getTopic(), "challenge", "0");
URI uri;
try {
uri = new URIBuilder(sr.getCallback()).setParameters(sc.toRequestParameters()).build();
} catch (URISyntaxException e) {
throw new SubscriptionOriginVerificationException("URISyntaxException while sending a confirmation of subscription", e);
}
HttpGet httpGet = new HttpGet(uri);
CloseableHttpClient httpclient = HttpClients.createDefault();
CloseableHttpResponse response;
try {
response = httpclient.execute(httpGet);
} catch (IOException e) {
throw new SubscriptionOriginVerificationException("IOException while sending a confirmation of subscription", e);
}
LOG.info("Subscriber replied with the http code {}.", response.getStatusLine().getStatusCode());
Integer returnedCode = response.getStatusLine().getStatusCode();
// if code is a success code return true, else false
return (199 < returnedCode) && (returnedCode < 300);
} | [
"public",
"Boolean",
"verifySubscriberRequestedSubscription",
"(",
"SubscriptionRequest",
"sr",
")",
"throws",
"SubscriptionOriginVerificationException",
"{",
"LOG",
".",
"info",
"(",
"\"(Hub) -> Subscriber, sending notification to verify the origin of the subscription {}.\"",
",",
"... | Output method that sends a subscription confirmation for the subscriber to avoid DoS attacks, or false subscription.
@param sr
@return True case the subscription was confirmed, or False otherwise
@throws org.ow2.chameleon.fuchsia.push.base.hub.exception.SubscriptionOriginVerificationException | [
"Output",
"method",
"that",
"sends",
"a",
"subscription",
"confirmation",
"for",
"the",
"subscriber",
"to",
"avoid",
"DoS",
"attacks",
"or",
"false",
"subscription",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java#L134-L165 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_disclaimerAttribute_GET | public ArrayList<OvhDisclaimerAttributeEnum> organizationName_service_exchangeService_domain_domainName_disclaimerAttribute_GET(String organizationName, String exchangeService, String domainName) throws IOException {
"""
Get diclaimer attributes to substitute with Active Directory properties
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimerAttribute
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param domainName [required] Domain name
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimerAttribute";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<OvhDisclaimerAttributeEnum> organizationName_service_exchangeService_domain_domainName_disclaimerAttribute_GET(String organizationName, String exchangeService, String domainName) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimerAttribute";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"OvhDisclaimerAttributeEnum",
">",
"organizationName_service_exchangeService_domain_domainName_disclaimerAttribute_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"domainName",
")",
"throws",
"IOException",
"{"... | Get diclaimer attributes to substitute with Active Directory properties
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimerAttribute
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param domainName [required] Domain name | [
"Get",
"diclaimer",
"attributes",
"to",
"substitute",
"with",
"Active",
"Directory",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L468-L473 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java | AuthorizationProcessManager.startAuthorizationProcess | public void startAuthorizationProcess(final Context context, ResponseListener listener) {
"""
Main method to start authorization process
@param context android context
@param listener response listener that will get the result of the process
"""
authorizationQueue.add(listener);
//start the authorization process only if this is the first time we ask for authorization
if (authorizationQueue.size() == 1) {
try {
if (preferences.clientId.get() == null) {
logger.info("starting registration process");
invokeInstanceRegistrationRequest(context);
} else {
logger.info("starting authorization process");
invokeAuthorizationRequest(context);
}
} catch (Throwable t) {
handleAuthorizationFailure(t);
}
}
else{
logger.info("authorization process already running, adding response listener to the queue");
logger.debug(String.format("authorization process currently handling %d requests", authorizationQueue.size()));
}
} | java | public void startAuthorizationProcess(final Context context, ResponseListener listener) {
authorizationQueue.add(listener);
//start the authorization process only if this is the first time we ask for authorization
if (authorizationQueue.size() == 1) {
try {
if (preferences.clientId.get() == null) {
logger.info("starting registration process");
invokeInstanceRegistrationRequest(context);
} else {
logger.info("starting authorization process");
invokeAuthorizationRequest(context);
}
} catch (Throwable t) {
handleAuthorizationFailure(t);
}
}
else{
logger.info("authorization process already running, adding response listener to the queue");
logger.debug(String.format("authorization process currently handling %d requests", authorizationQueue.size()));
}
} | [
"public",
"void",
"startAuthorizationProcess",
"(",
"final",
"Context",
"context",
",",
"ResponseListener",
"listener",
")",
"{",
"authorizationQueue",
".",
"add",
"(",
"listener",
")",
";",
"//start the authorization process only if this is the first time we ask for authorizat... | Main method to start authorization process
@param context android context
@param listener response listener that will get the result of the process | [
"Main",
"method",
"to",
"start",
"authorization",
"process"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L94-L116 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_serviceMonitoring_monitoringId_alert_email_POST | public OvhEmailAlert serviceName_serviceMonitoring_monitoringId_alert_email_POST(String serviceName, Long monitoringId, String email, OvhAlertLanguageEnum language) throws IOException {
"""
Add a new email alert
REST: POST /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email
@param language [required] Alert language
@param email [required] Alert destination
@param serviceName [required] The internal name of your dedicated server
@param monitoringId [required] This monitoring id
"""
String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email";
StringBuilder sb = path(qPath, serviceName, monitoringId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "language", language);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEmailAlert.class);
} | java | public OvhEmailAlert serviceName_serviceMonitoring_monitoringId_alert_email_POST(String serviceName, Long monitoringId, String email, OvhAlertLanguageEnum language) throws IOException {
String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email";
StringBuilder sb = path(qPath, serviceName, monitoringId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "language", language);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEmailAlert.class);
} | [
"public",
"OvhEmailAlert",
"serviceName_serviceMonitoring_monitoringId_alert_email_POST",
"(",
"String",
"serviceName",
",",
"Long",
"monitoringId",
",",
"String",
"email",
",",
"OvhAlertLanguageEnum",
"language",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
... | Add a new email alert
REST: POST /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/email
@param language [required] Alert language
@param email [required] Alert destination
@param serviceName [required] The internal name of your dedicated server
@param monitoringId [required] This monitoring id | [
"Add",
"a",
"new",
"email",
"alert"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2251-L2259 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java | UrlUtils.toViewBaseUrl | public static String toViewBaseUrl(final FolderJob folder, final String name) {
"""
Helper to create the base url for a view, with or without a given folder
@param folder the folder or {@code null}
@param name the of the view.
@return converted view url.
"""
final StringBuilder sb = new StringBuilder(DEFAULT_BUFFER_SIZE);
final String base = UrlUtils.toBaseUrl(folder);
sb.append(base);
if (!base.endsWith("/")) sb.append('/');
sb.append("view/")
.append(EncodingUtils.encode(name));
return sb.toString();
} | java | public static String toViewBaseUrl(final FolderJob folder, final String name) {
final StringBuilder sb = new StringBuilder(DEFAULT_BUFFER_SIZE);
final String base = UrlUtils.toBaseUrl(folder);
sb.append(base);
if (!base.endsWith("/")) sb.append('/');
sb.append("view/")
.append(EncodingUtils.encode(name));
return sb.toString();
} | [
"public",
"static",
"String",
"toViewBaseUrl",
"(",
"final",
"FolderJob",
"folder",
",",
"final",
"String",
"name",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"DEFAULT_BUFFER_SIZE",
")",
";",
"final",
"String",
"base",
"=",
"Ur... | Helper to create the base url for a view, with or without a given folder
@param folder the folder or {@code null}
@param name the of the view.
@return converted view url. | [
"Helper",
"to",
"create",
"the",
"base",
"url",
"for",
"a",
"view",
"with",
"or",
"without",
"a",
"given",
"folder"
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java#L70-L78 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.write | public static void write(Image image, String imageType, OutputStream out) throws IORuntimeException {
"""
写出图像
@param image {@link Image}
@param imageType 图片类型(图片扩展名)
@param out 写出到的目标流
@throws IORuntimeException IO异常
@since 3.1.2
"""
write(image, imageType, getImageOutputStream(out));
} | java | public static void write(Image image, String imageType, OutputStream out) throws IORuntimeException {
write(image, imageType, getImageOutputStream(out));
} | [
"public",
"static",
"void",
"write",
"(",
"Image",
"image",
",",
"String",
"imageType",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"image",
",",
"imageType",
",",
"getImageOutputStream",
"(",
"out",
")",
")",
";",
"}"... | 写出图像
@param image {@link Image}
@param imageType 图片类型(图片扩展名)
@param out 写出到的目标流
@throws IORuntimeException IO异常
@since 3.1.2 | [
"写出图像"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1402-L1404 |
apache/groovy | src/main/groovy/groovy/util/GroovyScriptEngine.java | GroovyScriptEngine.initGroovyLoader | private GroovyClassLoader initGroovyLoader() {
"""
Initialize a new GroovyClassLoader with a default or
constructor-supplied parentClassLoader.
@return the parent classloader used to load scripts
"""
GroovyClassLoader groovyClassLoader =
AccessController.doPrivileged(new PrivilegedAction<ScriptClassLoader>() {
public ScriptClassLoader run() {
if (parentLoader instanceof GroovyClassLoader) {
return new ScriptClassLoader((GroovyClassLoader) parentLoader);
} else {
return new ScriptClassLoader(parentLoader, config);
}
}
});
for (URL root : roots) groovyClassLoader.addURL(root);
return groovyClassLoader;
} | java | private GroovyClassLoader initGroovyLoader() {
GroovyClassLoader groovyClassLoader =
AccessController.doPrivileged(new PrivilegedAction<ScriptClassLoader>() {
public ScriptClassLoader run() {
if (parentLoader instanceof GroovyClassLoader) {
return new ScriptClassLoader((GroovyClassLoader) parentLoader);
} else {
return new ScriptClassLoader(parentLoader, config);
}
}
});
for (URL root : roots) groovyClassLoader.addURL(root);
return groovyClassLoader;
} | [
"private",
"GroovyClassLoader",
"initGroovyLoader",
"(",
")",
"{",
"GroovyClassLoader",
"groovyClassLoader",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"ScriptClassLoader",
">",
"(",
")",
"{",
"public",
"ScriptClassLoader",
"run",... | Initialize a new GroovyClassLoader with a default or
constructor-supplied parentClassLoader.
@return the parent classloader used to load scripts | [
"Initialize",
"a",
"new",
"GroovyClassLoader",
"with",
"a",
"default",
"or",
"constructor",
"-",
"supplied",
"parentClassLoader",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/GroovyScriptEngine.java#L350-L363 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper.isPurableOperation | boolean isPurableOperation(XtendFunction operation, ISideEffectContext context) {
"""
Replies if the given is purable in the given context.
@param operation the operation to test.
@param context the context.
@return {@code true} if the operation could be marked as pure.
"""
if (isUnpureOperationPrototype(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForNotPureOperation(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForPureOperation(operation)) {
return true;
}
if (context == null) {
return !hasSideEffects(
getInferredPrototype(operation),
operation.getExpression());
}
final Boolean result = internalHasSideEffects(operation.getExpression(), context);
return result == null || !result.booleanValue();
} | java | boolean isPurableOperation(XtendFunction operation, ISideEffectContext context) {
if (isUnpureOperationPrototype(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForNotPureOperation(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForPureOperation(operation)) {
return true;
}
if (context == null) {
return !hasSideEffects(
getInferredPrototype(operation),
operation.getExpression());
}
final Boolean result = internalHasSideEffects(operation.getExpression(), context);
return result == null || !result.booleanValue();
} | [
"boolean",
"isPurableOperation",
"(",
"XtendFunction",
"operation",
",",
"ISideEffectContext",
"context",
")",
"{",
"if",
"(",
"isUnpureOperationPrototype",
"(",
"operation",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"nameValidator",
".... | Replies if the given is purable in the given context.
@param operation the operation to test.
@param context the context.
@return {@code true} if the operation could be marked as pure. | [
"Replies",
"if",
"the",
"given",
"is",
"purable",
"in",
"the",
"given",
"context",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L178-L195 |
rahulsom/genealogy | src/main/java/com/github/rahulsom/genealogy/NameDbUsa.java | NameDbUsa.getName | private String getName(List<? extends Name> list, double probability) {
"""
Finds name at a given cumulative probability accounting for gaps.
@param list The list to look for name in
@param probability the cumulative probability to search for (between 0 and 1)
@return the name
"""
Name name = getNameObject(list, probability * getMax(list));
return name.getValue();
} | java | private String getName(List<? extends Name> list, double probability) {
Name name = getNameObject(list, probability * getMax(list));
return name.getValue();
} | [
"private",
"String",
"getName",
"(",
"List",
"<",
"?",
"extends",
"Name",
">",
"list",
",",
"double",
"probability",
")",
"{",
"Name",
"name",
"=",
"getNameObject",
"(",
"list",
",",
"probability",
"*",
"getMax",
"(",
"list",
")",
")",
";",
"return",
"... | Finds name at a given cumulative probability accounting for gaps.
@param list The list to look for name in
@param probability the cumulative probability to search for (between 0 and 1)
@return the name | [
"Finds",
"name",
"at",
"a",
"given",
"cumulative",
"probability",
"accounting",
"for",
"gaps",
"."
] | train | https://github.com/rahulsom/genealogy/blob/2beb35ab9c6e03080328aa08b18f0a3c5d3f5c12/src/main/java/com/github/rahulsom/genealogy/NameDbUsa.java#L82-L85 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java | ProxiedFileSystemCache.getProxiedFileSystemUsingToken | @Deprecated
public static FileSystem getProxiedFileSystemUsingToken(@NonNull final String userNameToProxyAs,
final Token<?> userNameToken, final URI fsURI, final Configuration conf) throws ExecutionException {
"""
Cached version of {@link ProxiedFileSystemUtils#createProxiedFileSystemUsingToken(String, Token, URI, Configuration)}.
@deprecated use {@link #fromToken}.
"""
try {
return getProxiedFileSystemUsingToken(userNameToProxyAs, userNameToken, fsURI, conf, null);
} catch (IOException ioe) {
throw new ExecutionException(ioe);
}
} | java | @Deprecated
public static FileSystem getProxiedFileSystemUsingToken(@NonNull final String userNameToProxyAs,
final Token<?> userNameToken, final URI fsURI, final Configuration conf) throws ExecutionException {
try {
return getProxiedFileSystemUsingToken(userNameToProxyAs, userNameToken, fsURI, conf, null);
} catch (IOException ioe) {
throw new ExecutionException(ioe);
}
} | [
"@",
"Deprecated",
"public",
"static",
"FileSystem",
"getProxiedFileSystemUsingToken",
"(",
"@",
"NonNull",
"final",
"String",
"userNameToProxyAs",
",",
"final",
"Token",
"<",
"?",
">",
"userNameToken",
",",
"final",
"URI",
"fsURI",
",",
"final",
"Configuration",
... | Cached version of {@link ProxiedFileSystemUtils#createProxiedFileSystemUsingToken(String, Token, URI, Configuration)}.
@deprecated use {@link #fromToken}. | [
"Cached",
"version",
"of",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java#L196-L204 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/AccountUpdater.java | AccountUpdater.setAvatar | public AccountUpdater setAvatar(BufferedImage avatar, String fileType) {
"""
Queues the avatar of the connected account to get updated.
@param avatar The avatar to set.
@param fileType The type of the avatar, e.g. "png" or "jpg".
@return The current instance in order to chain call methods.
"""
delegate.setAvatar(avatar, fileType);
return this;
} | java | public AccountUpdater setAvatar(BufferedImage avatar, String fileType) {
delegate.setAvatar(avatar, fileType);
return this;
} | [
"public",
"AccountUpdater",
"setAvatar",
"(",
"BufferedImage",
"avatar",
",",
"String",
"fileType",
")",
"{",
"delegate",
".",
"setAvatar",
"(",
"avatar",
",",
"fileType",
")",
";",
"return",
"this",
";",
"}"
] | Queues the avatar of the connected account to get updated.
@param avatar The avatar to set.
@param fileType The type of the avatar, e.g. "png" or "jpg".
@return The current instance in order to chain call methods. | [
"Queues",
"the",
"avatar",
"of",
"the",
"connected",
"account",
"to",
"get",
"updated",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/AccountUpdater.java#L62-L65 |
apache/incubator-gobblin | gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixDistributeJobExecutionLauncher.java | GobblinHelixDistributeJobExecutionLauncher.createJobBuilder | private JobConfig.Builder createJobBuilder (Properties jobProps) {
"""
Create a job config builder which has a single task that wraps the original jobProps.
The planning job (which runs the original {@link GobblinHelixJobLauncher}) will be
executed on one of the Helix participants.
We rely on the underlying {@link GobblinHelixJobLauncher} to correctly handle the task
execution timeout so that the planning job itself is relieved of the timeout constrain.
In short, the planning job will run once and requires no timeout.
"""
// Create a single task for job planning
String planningId = getPlanningJobId(jobProps);
Map<String, TaskConfig> taskConfigMap = Maps.newHashMap();
Map<String, String> rawConfigMap = Maps.newHashMap();
for (String key : jobProps.stringPropertyNames()) {
rawConfigMap.put(JOB_PROPS_PREFIX + key, (String)jobProps.get(key));
}
rawConfigMap.put(GobblinClusterConfigurationKeys.TASK_SUCCESS_OPTIONAL_KEY, "true");
// Create a single Job which only contains a single task
taskConfigMap.put(planningId, TaskConfig.Builder.from(rawConfigMap));
JobConfig.Builder jobConfigBuilder = new JobConfig.Builder();
// We want GobblinHelixJobLauncher only run once.
jobConfigBuilder.setMaxAttemptsPerTask(1);
// Planning job never timeout (Helix defaults 1h timeout, set a large number '1 month')
jobConfigBuilder.setTimeoutPerTask(JobConfig.DEFAULT_TIMEOUT_PER_TASK * 24 * 30);
// Planning job should have its own tag support
if (jobProps.containsKey(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TAG_KEY)) {
String jobPlanningTag = jobProps.getProperty(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TAG_KEY);
log.info("PlanningJob {} has tags associated : {}", planningId, jobPlanningTag);
jobConfigBuilder.setInstanceGroupTag(jobPlanningTag);
}
// Planning job should have its own type support
if (jobProps.containsKey(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TYPE_KEY)) {
String jobType = jobProps.getProperty(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TYPE_KEY);
log.info("PlanningJob {} has types associated : {}", planningId, jobType);
jobConfigBuilder.setJobType(jobType);
}
jobConfigBuilder.setNumConcurrentTasksPerInstance(PropertiesUtils.getPropAsInt(jobProps,
GobblinClusterConfigurationKeys.HELIX_CLUSTER_TASK_CONCURRENCY,
GobblinClusterConfigurationKeys.HELIX_CLUSTER_TASK_CONCURRENCY_DEFAULT));
jobConfigBuilder.setFailureThreshold(1);
jobConfigBuilder.addTaskConfigMap(taskConfigMap).setCommand(GobblinTaskRunner.GOBBLIN_JOB_FACTORY_NAME);
return jobConfigBuilder;
} | java | private JobConfig.Builder createJobBuilder (Properties jobProps) {
// Create a single task for job planning
String planningId = getPlanningJobId(jobProps);
Map<String, TaskConfig> taskConfigMap = Maps.newHashMap();
Map<String, String> rawConfigMap = Maps.newHashMap();
for (String key : jobProps.stringPropertyNames()) {
rawConfigMap.put(JOB_PROPS_PREFIX + key, (String)jobProps.get(key));
}
rawConfigMap.put(GobblinClusterConfigurationKeys.TASK_SUCCESS_OPTIONAL_KEY, "true");
// Create a single Job which only contains a single task
taskConfigMap.put(planningId, TaskConfig.Builder.from(rawConfigMap));
JobConfig.Builder jobConfigBuilder = new JobConfig.Builder();
// We want GobblinHelixJobLauncher only run once.
jobConfigBuilder.setMaxAttemptsPerTask(1);
// Planning job never timeout (Helix defaults 1h timeout, set a large number '1 month')
jobConfigBuilder.setTimeoutPerTask(JobConfig.DEFAULT_TIMEOUT_PER_TASK * 24 * 30);
// Planning job should have its own tag support
if (jobProps.containsKey(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TAG_KEY)) {
String jobPlanningTag = jobProps.getProperty(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TAG_KEY);
log.info("PlanningJob {} has tags associated : {}", planningId, jobPlanningTag);
jobConfigBuilder.setInstanceGroupTag(jobPlanningTag);
}
// Planning job should have its own type support
if (jobProps.containsKey(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TYPE_KEY)) {
String jobType = jobProps.getProperty(GobblinClusterConfigurationKeys.HELIX_PLANNING_JOB_TYPE_KEY);
log.info("PlanningJob {} has types associated : {}", planningId, jobType);
jobConfigBuilder.setJobType(jobType);
}
jobConfigBuilder.setNumConcurrentTasksPerInstance(PropertiesUtils.getPropAsInt(jobProps,
GobblinClusterConfigurationKeys.HELIX_CLUSTER_TASK_CONCURRENCY,
GobblinClusterConfigurationKeys.HELIX_CLUSTER_TASK_CONCURRENCY_DEFAULT));
jobConfigBuilder.setFailureThreshold(1);
jobConfigBuilder.addTaskConfigMap(taskConfigMap).setCommand(GobblinTaskRunner.GOBBLIN_JOB_FACTORY_NAME);
return jobConfigBuilder;
} | [
"private",
"JobConfig",
".",
"Builder",
"createJobBuilder",
"(",
"Properties",
"jobProps",
")",
"{",
"// Create a single task for job planning",
"String",
"planningId",
"=",
"getPlanningJobId",
"(",
"jobProps",
")",
";",
"Map",
"<",
"String",
",",
"TaskConfig",
">",
... | Create a job config builder which has a single task that wraps the original jobProps.
The planning job (which runs the original {@link GobblinHelixJobLauncher}) will be
executed on one of the Helix participants.
We rely on the underlying {@link GobblinHelixJobLauncher} to correctly handle the task
execution timeout so that the planning job itself is relieved of the timeout constrain.
In short, the planning job will run once and requires no timeout. | [
"Create",
"a",
"job",
"config",
"builder",
"which",
"has",
"a",
"single",
"task",
"that",
"wraps",
"the",
"original",
"jobProps",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixDistributeJobExecutionLauncher.java#L202-L244 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.