repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
apereo/cas
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java
AbstractSamlProfileHandlerController.verifySamlAuthenticationRequest
protected Pair<SamlRegisteredService, SamlRegisteredServiceServiceProviderMetadataFacade> verifySamlAuthenticationRequest( final Pair<? extends SignableSAMLObject, MessageContext> authenticationContext, final HttpServletRequest request) throws Exception { val authnRequest = (AuthnRequest) authenticationContext.getKey(); val issuer = SamlIdPUtils.getIssuerFromSamlObject(authnRequest); LOGGER.debug("Located issuer [{}] from authentication request", issuer); val registeredService = verifySamlRegisteredService(issuer); LOGGER.debug("Fetching saml metadata adaptor for [{}]", issuer); val adaptor = SamlRegisteredServiceServiceProviderMetadataFacade.get( samlProfileHandlerConfigurationContext.getSamlRegisteredServiceCachingMetadataResolver(), registeredService, authnRequest); if (adaptor.isEmpty()) { LOGGER.warn("No metadata could be found for [{}]", issuer); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, "Cannot find metadata linked to " + issuer); } val facade = adaptor.get(); verifyAuthenticationContextSignature(authenticationContext, request, authnRequest, facade); SamlUtils.logSamlObject(samlProfileHandlerConfigurationContext.getOpenSamlConfigBean(), authnRequest); return Pair.of(registeredService, facade); }
java
protected Pair<SamlRegisteredService, SamlRegisteredServiceServiceProviderMetadataFacade> verifySamlAuthenticationRequest( final Pair<? extends SignableSAMLObject, MessageContext> authenticationContext, final HttpServletRequest request) throws Exception { val authnRequest = (AuthnRequest) authenticationContext.getKey(); val issuer = SamlIdPUtils.getIssuerFromSamlObject(authnRequest); LOGGER.debug("Located issuer [{}] from authentication request", issuer); val registeredService = verifySamlRegisteredService(issuer); LOGGER.debug("Fetching saml metadata adaptor for [{}]", issuer); val adaptor = SamlRegisteredServiceServiceProviderMetadataFacade.get( samlProfileHandlerConfigurationContext.getSamlRegisteredServiceCachingMetadataResolver(), registeredService, authnRequest); if (adaptor.isEmpty()) { LOGGER.warn("No metadata could be found for [{}]", issuer); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, "Cannot find metadata linked to " + issuer); } val facade = adaptor.get(); verifyAuthenticationContextSignature(authenticationContext, request, authnRequest, facade); SamlUtils.logSamlObject(samlProfileHandlerConfigurationContext.getOpenSamlConfigBean(), authnRequest); return Pair.of(registeredService, facade); }
[ "protected", "Pair", "<", "SamlRegisteredService", ",", "SamlRegisteredServiceServiceProviderMetadataFacade", ">", "verifySamlAuthenticationRequest", "(", "final", "Pair", "<", "?", "extends", "SignableSAMLObject", ",", "MessageContext", ">", "authenticationContext", ",", "fi...
Verify saml authentication request. @param authenticationContext the pair @param request the request @return the pair @throws Exception the exception
[ "Verify", "saml", "authentication", "request", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java#L339-L360
webmetrics/browsermob-proxy
src/main/java/org/java_bandwidthlimiter/StreamManager.java
StreamManager.setMaxBitsPerSecondThreshold
public void setMaxBitsPerSecondThreshold(long maxBitsPerSecond) { //setting the maximimum threshold of bits per second that //we can send EVER in upstream/downstream //the user can later decrease this value but not increment it this.maxBytesPerSecond = maxBitsPerSecond/8; //make sure the streams parameters honor the new max limit setMaxBps(this.downStream, this.downStream.maxBps); setMaxBps(this.upStream, this.upStream.maxBps); }
java
public void setMaxBitsPerSecondThreshold(long maxBitsPerSecond) { //setting the maximimum threshold of bits per second that //we can send EVER in upstream/downstream //the user can later decrease this value but not increment it this.maxBytesPerSecond = maxBitsPerSecond/8; //make sure the streams parameters honor the new max limit setMaxBps(this.downStream, this.downStream.maxBps); setMaxBps(this.upStream, this.upStream.maxBps); }
[ "public", "void", "setMaxBitsPerSecondThreshold", "(", "long", "maxBitsPerSecond", ")", "{", "//setting the maximimum threshold of bits per second that", "//we can send EVER in upstream/downstream", "//the user can later decrease this value but not increment it", "this", ".", "maxBytesPerS...
This function sets the max bits per second threshold {@link #setDownstreamKbps} and {@link #setDownstreamKbps(long)} won't be allowed to set a bandwidth higher than what specified here. @param maxBitsPerSecond The max bits per seconds you want this instance of StreamManager to respect.
[ "This", "function", "sets", "the", "max", "bits", "per", "second", "threshold", "{" ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/java_bandwidthlimiter/StreamManager.java#L205-L213
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.fillInternalShadowRounded
private void fillInternalShadowRounded(Graphics2D g, Shape s) { g.setPaint(getRoundedShadowGradient(s)); g.fill(s); }
java
private void fillInternalShadowRounded(Graphics2D g, Shape s) { g.setPaint(getRoundedShadowGradient(s)); g.fill(s); }
[ "private", "void", "fillInternalShadowRounded", "(", "Graphics2D", "g", ",", "Shape", "s", ")", "{", "g", ".", "setPaint", "(", "getRoundedShadowGradient", "(", "s", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Fill a rounded shadow. @param g the Graphics context to paint with. @param s the shape to fill. This is only used for its bounds.
[ "Fill", "a", "rounded", "shadow", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L110-L113
box/box-java-sdk
src/main/java/com/box/sdk/BoxCollaboration.java
BoxCollaboration.getAllFileCollaborations
public static BoxResourceIterable<Info> getAllFileCollaborations(final BoxAPIConnection api, String fileID, int pageSize, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxCollaboration.Info>( api, GET_ALL_FILE_COLLABORATIONS_URL.buildWithQuery(api.getBaseURL(), builder.toString(), fileID), pageSize) { @Override protected BoxCollaboration.Info factory(JsonObject jsonObject) { String id = jsonObject.get("id").asString(); return new BoxCollaboration(api, id).new Info(jsonObject); } }; }
java
public static BoxResourceIterable<Info> getAllFileCollaborations(final BoxAPIConnection api, String fileID, int pageSize, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxCollaboration.Info>( api, GET_ALL_FILE_COLLABORATIONS_URL.buildWithQuery(api.getBaseURL(), builder.toString(), fileID), pageSize) { @Override protected BoxCollaboration.Info factory(JsonObject jsonObject) { String id = jsonObject.get("id").asString(); return new BoxCollaboration(api, id).new Info(jsonObject); } }; }
[ "public", "static", "BoxResourceIterable", "<", "Info", ">", "getAllFileCollaborations", "(", "final", "BoxAPIConnection", "api", ",", "String", "fileID", ",", "int", "pageSize", ",", "String", "...", "fields", ")", "{", "QueryStringBuilder", "builder", "=", "new"...
Used to retrieve all collaborations associated with the item. @param api BoxAPIConnection from the associated file. @param fileID FileID of the associated file @param pageSize page size for server pages of the Iterable @param fields the optional fields to retrieve. @return An iterable of BoxCollaboration.Info instances associated with the item.
[ "Used", "to", "retrieve", "all", "collaborations", "associated", "with", "the", "item", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxCollaboration.java#L579-L595
Talend/tesb-rt-se
request-callback/src/main/java/org/talend/esb/mep/requestcallback/feature/RequestCallbackFeature.java
RequestCallbackFeature.applyWsdlExtensions
public static void applyWsdlExtensions(Bus bus) { ExtensionRegistry registry = bus.getExtension(WSDLManager.class).getExtensionRegistry(); try { JAXBExtensionHelper.addExtensions(registry, javax.wsdl.Definition.class, org.talend.esb.mep.requestcallback.impl.wsdl.PLType.class); JAXBExtensionHelper.addExtensions(registry, javax.wsdl.Binding.class, org.talend.esb.mep.requestcallback.impl.wsdl.CallbackExtension.class); } catch (JAXBException e) { throw new RuntimeException("Failed to add WSDL JAXB extensions", e); } }
java
public static void applyWsdlExtensions(Bus bus) { ExtensionRegistry registry = bus.getExtension(WSDLManager.class).getExtensionRegistry(); try { JAXBExtensionHelper.addExtensions(registry, javax.wsdl.Definition.class, org.talend.esb.mep.requestcallback.impl.wsdl.PLType.class); JAXBExtensionHelper.addExtensions(registry, javax.wsdl.Binding.class, org.talend.esb.mep.requestcallback.impl.wsdl.CallbackExtension.class); } catch (JAXBException e) { throw new RuntimeException("Failed to add WSDL JAXB extensions", e); } }
[ "public", "static", "void", "applyWsdlExtensions", "(", "Bus", "bus", ")", "{", "ExtensionRegistry", "registry", "=", "bus", ".", "getExtension", "(", "WSDLManager", ".", "class", ")", ".", "getExtensionRegistry", "(", ")", ";", "try", "{", "JAXBExtensionHelper"...
Adds JAXB WSDL extensions to allow work with custom WSDL elements such as \"partner-link\" @param bus CXF bus
[ "Adds", "JAXB", "WSDL", "extensions", "to", "allow", "work", "with", "custom", "WSDL", "elements", "such", "as", "\\", "partner", "-", "link", "\\" ]
train
https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/request-callback/src/main/java/org/talend/esb/mep/requestcallback/feature/RequestCallbackFeature.java#L84-L101
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/graph/rebond/RebondTool.java
RebondTool.bondAtom
private void bondAtom(IAtomContainer container, IAtom atom) { double myCovalentRadius = atom.getCovalentRadius(); double searchRadius = myCovalentRadius + maxCovalentRadius + bondTolerance; Point tupleAtom = new Point(atom.getPoint3d().x, atom.getPoint3d().y, atom.getPoint3d().z); for (Bspt.EnumerateSphere e = bspt.enumHemiSphere(tupleAtom, searchRadius); e.hasMoreElements();) { IAtom atomNear = ((TupleAtom) e.nextElement()).getAtom(); if (!atomNear.equals(atom) && container.getBond(atom, atomNear) == null) { boolean bonded = isBonded(myCovalentRadius, atomNear.getCovalentRadius(), e.foundDistance2()); if (bonded) { IBond bond = atom.getBuilder().newInstance(IBond.class, atom, atomNear, IBond.Order.SINGLE); container.addBond(bond); } } } }
java
private void bondAtom(IAtomContainer container, IAtom atom) { double myCovalentRadius = atom.getCovalentRadius(); double searchRadius = myCovalentRadius + maxCovalentRadius + bondTolerance; Point tupleAtom = new Point(atom.getPoint3d().x, atom.getPoint3d().y, atom.getPoint3d().z); for (Bspt.EnumerateSphere e = bspt.enumHemiSphere(tupleAtom, searchRadius); e.hasMoreElements();) { IAtom atomNear = ((TupleAtom) e.nextElement()).getAtom(); if (!atomNear.equals(atom) && container.getBond(atom, atomNear) == null) { boolean bonded = isBonded(myCovalentRadius, atomNear.getCovalentRadius(), e.foundDistance2()); if (bonded) { IBond bond = atom.getBuilder().newInstance(IBond.class, atom, atomNear, IBond.Order.SINGLE); container.addBond(bond); } } } }
[ "private", "void", "bondAtom", "(", "IAtomContainer", "container", ",", "IAtom", "atom", ")", "{", "double", "myCovalentRadius", "=", "atom", ".", "getCovalentRadius", "(", ")", ";", "double", "searchRadius", "=", "myCovalentRadius", "+", "maxCovalentRadius", "+",...
Rebonds one atom by looking up nearby atom using the binary space partition tree.
[ "Rebonds", "one", "atom", "by", "looking", "up", "nearby", "atom", "using", "the", "binary", "space", "partition", "tree", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/graph/rebond/RebondTool.java#L96-L110
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/Jinx.java
Jinx.uploadOrReplace
protected <T> T uploadOrReplace(Map<String, String> params, byte[] photoData, Class<T> tClass, OAuthRequest request) throws JinxException { String boundary = JinxUtils.generateBoundary(); request.addHeader("Content-Type", "multipart/form-data; boundary=" + boundary); for (Map.Entry<String, String> entry : params.entrySet()) { String key = entry.getKey(); if (!key.equals("photo") && !key.equals("filename") && !key.equals("filemimetype")) { request.addQuerystringParameter(key, String.valueOf(entry.getValue())); } } this.oAuthService.signRequest(this.accessToken, request); // add all parameters to payload params.putAll(request.getOauthParameters()); request.addPayload(buildMultipartBody(params, photoData, boundary)); org.scribe.model.Response flickrResponse = request.send(); if (flickrResponse == null || flickrResponse.getBody() == null) { throw new JinxException("Null return from call to Flickr."); } if (verboseLogging) { JinxLogger.getLogger().log("RESPONSE is " + flickrResponse.getBody()); } // upload returns XML, so convert to json String json = JinxUtils.xml2json(flickrResponse.getBody()); T fromJson = gson.fromJson(json, tClass); if (this.flickrErrorThrowsException && ((Response) fromJson).getCode() != 0) { Response r = (Response) fromJson; throw new JinxException("Flickr returned non-zero status.", null, r); } return fromJson; }
java
protected <T> T uploadOrReplace(Map<String, String> params, byte[] photoData, Class<T> tClass, OAuthRequest request) throws JinxException { String boundary = JinxUtils.generateBoundary(); request.addHeader("Content-Type", "multipart/form-data; boundary=" + boundary); for (Map.Entry<String, String> entry : params.entrySet()) { String key = entry.getKey(); if (!key.equals("photo") && !key.equals("filename") && !key.equals("filemimetype")) { request.addQuerystringParameter(key, String.valueOf(entry.getValue())); } } this.oAuthService.signRequest(this.accessToken, request); // add all parameters to payload params.putAll(request.getOauthParameters()); request.addPayload(buildMultipartBody(params, photoData, boundary)); org.scribe.model.Response flickrResponse = request.send(); if (flickrResponse == null || flickrResponse.getBody() == null) { throw new JinxException("Null return from call to Flickr."); } if (verboseLogging) { JinxLogger.getLogger().log("RESPONSE is " + flickrResponse.getBody()); } // upload returns XML, so convert to json String json = JinxUtils.xml2json(flickrResponse.getBody()); T fromJson = gson.fromJson(json, tClass); if (this.flickrErrorThrowsException && ((Response) fromJson).getCode() != 0) { Response r = (Response) fromJson; throw new JinxException("Flickr returned non-zero status.", null, r); } return fromJson; }
[ "protected", "<", "T", ">", "T", "uploadOrReplace", "(", "Map", "<", "String", ",", "String", ">", "params", ",", "byte", "[", "]", "photoData", ",", "Class", "<", "T", ">", "tClass", ",", "OAuthRequest", "request", ")", "throws", "JinxException", "{", ...
Handle Flickr upload and replace API calls. <br> The action taken will depend on the OAuth request object that is passed in. The upload and replace methods delegate to this method. This method does the work to ensure that the OAuth signature is generated correctly according to Flickr's requirements for uploads. @param params request parameters. @param photoData the data to send to Flickr. @param tClass the class that will be returned. @param <T> type of the class returned. @param request the OAuthRequest object to use. @return an instance of the specified class containing data from Flickr. @throws JinxException if there are any errors.
[ "Handle", "Flickr", "upload", "and", "replace", "API", "calls", ".", "<br", ">", "The", "action", "taken", "will", "depend", "on", "the", "OAuth", "request", "object", "that", "is", "passed", "in", ".", "The", "upload", "and", "replace", "methods", "delega...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/Jinx.java#L637-L672
mangstadt/biweekly
src/main/java/biweekly/component/VAlarm.java
VAlarm.setRepeat
public void setRepeat(int count, Duration pauseDuration) { Repeat repeat = new Repeat(count); DurationProperty duration = new DurationProperty(pauseDuration); setRepeat(repeat); setDuration(duration); }
java
public void setRepeat(int count, Duration pauseDuration) { Repeat repeat = new Repeat(count); DurationProperty duration = new DurationProperty(pauseDuration); setRepeat(repeat); setDuration(duration); }
[ "public", "void", "setRepeat", "(", "int", "count", ",", "Duration", "pauseDuration", ")", "{", "Repeat", "repeat", "=", "new", "Repeat", "(", "count", ")", ";", "DurationProperty", "duration", "=", "new", "DurationProperty", "(", "pauseDuration", ")", ";", ...
Sets the repetition information for the alarm. @param count the repeat count (e.g. "2" to repeat it two more times after it was initially triggered, for a total of three times) @param pauseDuration the length of the pause between repeats @see <a href="http://tools.ietf.org/html/rfc5545#page-133">RFC 5545 p.133</a> @see <a href="http://tools.ietf.org/html/rfc2445#page-126">RFC 2445 p.126-7</a>
[ "Sets", "the", "repetition", "information", "for", "the", "alarm", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/VAlarm.java#L487-L492
cryptomator/cryptofs
src/main/java/org/cryptomator/cryptofs/CryptoFileSystemUri.java
CryptoFileSystemUri.create
public static URI create(Path pathToVault, String... pathComponentsInsideVault) { try { return new URI(URI_SCHEME, pathToVault.toUri().toString(), "/" + String.join("/", pathComponentsInsideVault), null, null); } catch (URISyntaxException e) { throw new IllegalArgumentException("Can not create URI from given input", e); } }
java
public static URI create(Path pathToVault, String... pathComponentsInsideVault) { try { return new URI(URI_SCHEME, pathToVault.toUri().toString(), "/" + String.join("/", pathComponentsInsideVault), null, null); } catch (URISyntaxException e) { throw new IllegalArgumentException("Can not create URI from given input", e); } }
[ "public", "static", "URI", "create", "(", "Path", "pathToVault", ",", "String", "...", "pathComponentsInsideVault", ")", "{", "try", "{", "return", "new", "URI", "(", "URI_SCHEME", ",", "pathToVault", ".", "toUri", "(", ")", ".", "toString", "(", ")", ",",...
Constructs a CryptoFileSystem URI by using the given absolute path to a vault and constructing a path inside the vault from components. @param pathToVault path to the vault @param pathComponentsInsideVault path components to node inside the vault
[ "Constructs", "a", "CryptoFileSystem", "URI", "by", "using", "the", "given", "absolute", "path", "to", "a", "vault", "and", "constructing", "a", "path", "inside", "the", "vault", "from", "components", "." ]
train
https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemUri.java#L73-L79
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.checkForValidName
public static void checkForValidName(final Node node, final String name) { if (!ValidationUtil.isSbeCppName(name)) { handleWarning(node, "name is not valid for C++: " + name); } if (!ValidationUtil.isSbeJavaName(name)) { handleWarning(node, "name is not valid for Java: " + name); } if (!ValidationUtil.isSbeGolangName(name)) { handleWarning(node, "name is not valid for Golang: " + name); } if (!ValidationUtil.isSbeCSharpName(name)) { handleWarning(node, "name is not valid for C#: " + name); } }
java
public static void checkForValidName(final Node node, final String name) { if (!ValidationUtil.isSbeCppName(name)) { handleWarning(node, "name is not valid for C++: " + name); } if (!ValidationUtil.isSbeJavaName(name)) { handleWarning(node, "name is not valid for Java: " + name); } if (!ValidationUtil.isSbeGolangName(name)) { handleWarning(node, "name is not valid for Golang: " + name); } if (!ValidationUtil.isSbeCSharpName(name)) { handleWarning(node, "name is not valid for C#: " + name); } }
[ "public", "static", "void", "checkForValidName", "(", "final", "Node", "node", ",", "final", "String", "name", ")", "{", "if", "(", "!", "ValidationUtil", ".", "isSbeCppName", "(", "name", ")", ")", "{", "handleWarning", "(", "node", ",", "\"name is not vali...
Check name against validity for C++ and Java naming. Warning if not valid. @param node to have the name checked. @param name of the node to be checked.
[ "Check", "name", "against", "validity", "for", "C", "++", "and", "Java", "naming", ".", "Warning", "if", "not", "valid", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L363-L384
progolden/vraptor-boilerplate
vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java
UserBS.retrieveCompanyUser
public CompanyUser retrieveCompanyUser(User user, Company company) { Criteria criteria = this.dao.newCriteria(CompanyUser.class); criteria.add(Restrictions.eq("company", company)); criteria.add(Restrictions.eq("user", user)); return (CompanyUser) criteria.uniqueResult(); }
java
public CompanyUser retrieveCompanyUser(User user, Company company) { Criteria criteria = this.dao.newCriteria(CompanyUser.class); criteria.add(Restrictions.eq("company", company)); criteria.add(Restrictions.eq("user", user)); return (CompanyUser) criteria.uniqueResult(); }
[ "public", "CompanyUser", "retrieveCompanyUser", "(", "User", "user", ",", "Company", "company", ")", "{", "Criteria", "criteria", "=", "this", ".", "dao", ".", "newCriteria", "(", "CompanyUser", ".", "class", ")", ";", "criteria", ".", "add", "(", "Restricti...
Verificar se usuário é de uma determinada instituição. @param user Usuário para verificação. @param company Instituição para verificação. @return CompanyUser Instituição que pertence a determinado usuário.
[ "Verificar", "se", "usuário", "é", "de", "uma", "determinada", "instituição", "." ]
train
https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java#L252-L257
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyCollection.java
PropertyCollection.getValue
public int getValue(String name, String[] choices) { String val = getValue(name, ""); int index = Arrays.asList(choices).indexOf(val); return index == -1 ? 0 : index; }
java
public int getValue(String name, String[] choices) { String val = getValue(name, ""); int index = Arrays.asList(choices).indexOf(val); return index == -1 ? 0 : index; }
[ "public", "int", "getValue", "(", "String", "name", ",", "String", "[", "]", "choices", ")", "{", "String", "val", "=", "getValue", "(", "name", ",", "\"\"", ")", ";", "int", "index", "=", "Arrays", ".", "asList", "(", "choices", ")", ".", "indexOf",...
Returns the index of a property value as it occurs in the choice list. @param name Property name. @param choices Array of possible choice values. The first entry is assumed to be the default. @return Index of the property value in the choices array. Returns 0 if not found.
[ "Returns", "the", "index", "of", "a", "property", "value", "as", "it", "occurs", "in", "the", "choice", "list", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyCollection.java#L133-L137
jmurty/java-xmlbuilder
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
BaseXMLBuilder.toWriter
public void toWriter(boolean wholeDocument, Writer writer, Properties outputProperties) throws TransformerException { StreamResult streamResult = new StreamResult(writer); DOMSource domSource = null; if (wholeDocument) { domSource = new DOMSource(getDocument()); } else { domSource = new DOMSource(getElement()); } TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); if (outputProperties != null) { for (Entry<Object, Object> entry: outputProperties.entrySet()) { serializer.setOutputProperty( (String) entry.getKey(), (String) entry.getValue()); } } serializer.transform(domSource, streamResult); }
java
public void toWriter(boolean wholeDocument, Writer writer, Properties outputProperties) throws TransformerException { StreamResult streamResult = new StreamResult(writer); DOMSource domSource = null; if (wholeDocument) { domSource = new DOMSource(getDocument()); } else { domSource = new DOMSource(getElement()); } TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); if (outputProperties != null) { for (Entry<Object, Object> entry: outputProperties.entrySet()) { serializer.setOutputProperty( (String) entry.getKey(), (String) entry.getValue()); } } serializer.transform(domSource, streamResult); }
[ "public", "void", "toWriter", "(", "boolean", "wholeDocument", ",", "Writer", "writer", ",", "Properties", "outputProperties", ")", "throws", "TransformerException", "{", "StreamResult", "streamResult", "=", "new", "StreamResult", "(", "writer", ")", ";", "DOMSource...
Serialize either the specific Element wrapped by this BaseXMLBuilder, or its entire XML document, to the given writer using the default {@link TransformerFactory} and {@link Transformer} classes. If output options are provided, these options are provided to the {@link Transformer} serializer. @param wholeDocument if true the whole XML document (i.e. the document root) is serialized, if false just the current Element and its descendants are serialized. @param writer a writer to which the serialized document is written. @param outputProperties settings for the {@link Transformer} serializer. This parameter may be null or an empty Properties object, in which case the default output properties will be applied. @throws TransformerException
[ "Serialize", "either", "the", "specific", "Element", "wrapped", "by", "this", "BaseXMLBuilder", "or", "its", "entire", "XML", "document", "to", "the", "given", "writer", "using", "the", "default", "{", "@link", "TransformerFactory", "}", "and", "{", "@link", "...
train
https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L1303-L1325
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java
JMSService.createObjectMessage
public Message createObjectMessage(Serializable messageData, String sender, String recipients) { try { return decorateMessage(getSession().createObjectMessage(messageData), sender, recipients); } catch (JMSException e) { throw MiscUtil.toUnchecked(e); } }
java
public Message createObjectMessage(Serializable messageData, String sender, String recipients) { try { return decorateMessage(getSession().createObjectMessage(messageData), sender, recipients); } catch (JMSException e) { throw MiscUtil.toUnchecked(e); } }
[ "public", "Message", "createObjectMessage", "(", "Serializable", "messageData", ",", "String", "sender", ",", "String", "recipients", ")", "{", "try", "{", "return", "decorateMessage", "(", "getSession", "(", ")", ".", "createObjectMessage", "(", "messageData", ")...
Creates a message. @param messageData Message data. @param sender Sender client ID. @param recipients Comma-delimited list of recipient client IDs @return The newly created message.
[ "Creates", "a", "message", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java#L193-L199
jbundle/osgi
core/src/main/java/org/jbundle/util/osgi/finder/BaseClassFinderService.java
BaseClassFinderService.saveProperties
@Override public boolean saveProperties(String servicePid, Dictionary<String, String> properties) { try { if (servicePid != null) { ServiceReference caRef = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); if (caRef != null) { ConfigurationAdmin configAdmin = (ConfigurationAdmin)bundleContext.getService(caRef); Configuration config = configAdmin.getConfiguration(servicePid); config.update(properties); return true; } } } catch (IOException e) { e.printStackTrace(); } return false; }
java
@Override public boolean saveProperties(String servicePid, Dictionary<String, String> properties) { try { if (servicePid != null) { ServiceReference caRef = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); if (caRef != null) { ConfigurationAdmin configAdmin = (ConfigurationAdmin)bundleContext.getService(caRef); Configuration config = configAdmin.getConfiguration(servicePid); config.update(properties); return true; } } } catch (IOException e) { e.printStackTrace(); } return false; }
[ "@", "Override", "public", "boolean", "saveProperties", "(", "String", "servicePid", ",", "Dictionary", "<", "String", ",", "String", ">", "properties", ")", "{", "try", "{", "if", "(", "servicePid", "!=", "null", ")", "{", "ServiceReference", "caRef", "=", ...
Set the configuration properties for this Pid. @param servicePid The service Pid @param The properties to save. @return True if successful
[ "Set", "the", "configuration", "properties", "for", "this", "Pid", "." ]
train
https://github.com/jbundle/osgi/blob/beb02aef78736a4f799aaac001c8f0327bf0536c/core/src/main/java/org/jbundle/util/osgi/finder/BaseClassFinderService.java#L871-L891
powermock/powermock
powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java
SuppressCode.suppressMethod
public static synchronized void suppressMethod(Class<?> clazz, String methodName, String... additionalMethodNames) { for (Method method : Whitebox.getMethods(clazz, methodName)) { MockRepository.addMethodToSuppress(method); } if (additionalMethodNames != null && additionalMethodNames.length > 0) { for (Method method : Whitebox.getMethods(clazz, additionalMethodNames)) { MockRepository.addMethodToSuppress(method); } } }
java
public static synchronized void suppressMethod(Class<?> clazz, String methodName, String... additionalMethodNames) { for (Method method : Whitebox.getMethods(clazz, methodName)) { MockRepository.addMethodToSuppress(method); } if (additionalMethodNames != null && additionalMethodNames.length > 0) { for (Method method : Whitebox.getMethods(clazz, additionalMethodNames)) { MockRepository.addMethodToSuppress(method); } } }
[ "public", "static", "synchronized", "void", "suppressMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "String", "...", "additionalMethodNames", ")", "{", "for", "(", "Method", "method", ":", "Whitebox", ".", "getMethods", "(", ...
Suppress multiple methods for a class. @param clazz The class whose methods will be suppressed. @param methodName The first method to be suppress in class {@code clazz}. @param additionalMethodNames Additional methods to suppress in class {@code clazz}.
[ "Suppress", "multiple", "methods", "for", "a", "class", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L185-L194
TNG/JGiven
jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java
JGivenMethodRule.getArgumentsFrom
private static List<Object> getArgumentsFrom( Constructor<?> constructor, Object target ) { Class<?> testClass = target.getClass(); Class<?>[] constructorParamClasses = constructor.getParameterTypes(); List<Object> fieldValues = ReflectionUtil.getAllNonStaticFieldValuesFrom( testClass, target, " Consider writing a bug report." ); return getTypeMatchingValuesInOrderOf( constructorParamClasses, fieldValues ); }
java
private static List<Object> getArgumentsFrom( Constructor<?> constructor, Object target ) { Class<?> testClass = target.getClass(); Class<?>[] constructorParamClasses = constructor.getParameterTypes(); List<Object> fieldValues = ReflectionUtil.getAllNonStaticFieldValuesFrom( testClass, target, " Consider writing a bug report." ); return getTypeMatchingValuesInOrderOf( constructorParamClasses, fieldValues ); }
[ "private", "static", "List", "<", "Object", ">", "getArgumentsFrom", "(", "Constructor", "<", "?", ">", "constructor", ",", "Object", "target", ")", "{", "Class", "<", "?", ">", "testClass", "=", "target", ".", "getClass", "(", ")", ";", "Class", "<", ...
Searches for all arguments of the given {@link Parameterized} test class by retrieving the values of all non-static instance fields and comparing their types with the constructor arguments. The order of resulting parameters corresponds to the order of the constructor argument types (which is equal to order of the provided data of the method annotated with {@link Parameterized}). If the constructor contains multiple arguments of the same type, the order of {@link ReflectionUtil#getAllNonStaticFieldValuesFrom(Class, Object, String)} is used. @param constructor {@link Constructor} from which argument types should be retrieved @param target {@link Parameterized} test instance from which arguments tried to be retrieved @return the determined arguments, never {@code null}
[ "Searches", "for", "all", "arguments", "of", "the", "given", "{", "@link", "Parameterized", "}", "test", "class", "by", "retrieving", "the", "values", "of", "all", "non", "-", "static", "instance", "fields", "and", "comparing", "their", "types", "with", "the...
train
https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java#L182-L190
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/common/Preconditions.java
Preconditions.checkElementIndex
public static int checkElementIndex(int index, int size, String desc) { // Carefully optimized for execution by hotspot (explanatory comment above) if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(badElementIndex(index, size, desc)); } return index; }
java
public static int checkElementIndex(int index, int size, String desc) { // Carefully optimized for execution by hotspot (explanatory comment above) if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(badElementIndex(index, size, desc)); } return index; }
[ "public", "static", "int", "checkElementIndex", "(", "int", "index", ",", "int", "size", ",", "String", "desc", ")", "{", "// Carefully optimized for execution by hotspot (explanatory comment above)", "if", "(", "index", "<", "0", "||", "index", ">=", "size", ")", ...
Ensures that {@code index} specifies a valid <i>element</i> in an array, list or string of size {@code size}. An element index may range from zero, inclusive, to {@code size}, exclusive. @param index a user-supplied index identifying an element of an array, list or string @param size the size of that array, list or string @param desc the text to use to describe this index in an error message @return the value of {@code index} @throws IndexOutOfBoundsException if {@code index} is negative or is not less than {@code size} @throws IllegalArgumentException if {@code size} is negative
[ "Ensures", "that", "{", "@code", "index", "}", "specifies", "a", "valid", "<i", ">", "element<", "/", "i", ">", "in", "an", "array", "list", "or", "string", "of", "size", "{", "@code", "size", "}", ".", "An", "element", "index", "may", "range", "from...
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Preconditions.java#L271-L277
trellis-ldp/trellis
core/http/src/main/java/org/trellisldp/http/impl/PostHandler.java
PostHandler.createResource
public CompletionStage<ResponseBuilder> createResource(final ResponseBuilder builder) { LOGGER.debug("Creating resource as {}", getIdentifier()); final TrellisDataset mutable = TrellisDataset.createDataset(); final TrellisDataset immutable = TrellisDataset.createDataset(); return handleResourceCreation(mutable, immutable, builder) .whenComplete((a, b) -> mutable.close()) .whenComplete((a, b) -> immutable.close()); }
java
public CompletionStage<ResponseBuilder> createResource(final ResponseBuilder builder) { LOGGER.debug("Creating resource as {}", getIdentifier()); final TrellisDataset mutable = TrellisDataset.createDataset(); final TrellisDataset immutable = TrellisDataset.createDataset(); return handleResourceCreation(mutable, immutable, builder) .whenComplete((a, b) -> mutable.close()) .whenComplete((a, b) -> immutable.close()); }
[ "public", "CompletionStage", "<", "ResponseBuilder", ">", "createResource", "(", "final", "ResponseBuilder", "builder", ")", "{", "LOGGER", ".", "debug", "(", "\"Creating resource as {}\"", ",", "getIdentifier", "(", ")", ")", ";", "final", "TrellisDataset", "mutabl...
Create a new resource. @param builder the response builder @return the response builder
[ "Create", "a", "new", "resource", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/PostHandler.java#L169-L178
instacount/appengine-counter
src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java
ShardedCounterServiceImpl.assertValidExternalCounterStatus
@VisibleForTesting protected void assertValidExternalCounterStatus(final String counterName, final CounterStatus incomingCounterStatus) { Preconditions.checkNotNull(counterName); Preconditions.checkNotNull(incomingCounterStatus); if (incomingCounterStatus != CounterStatus.AVAILABLE && incomingCounterStatus != CounterStatus.READ_ONLY_COUNT) { final String msg = String.format( "This Counter can only be put into the %s or %s status! %s is not allowed.", CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT, incomingCounterStatus); throw new CounterNotMutableException(counterName, msg); } }
java
@VisibleForTesting protected void assertValidExternalCounterStatus(final String counterName, final CounterStatus incomingCounterStatus) { Preconditions.checkNotNull(counterName); Preconditions.checkNotNull(incomingCounterStatus); if (incomingCounterStatus != CounterStatus.AVAILABLE && incomingCounterStatus != CounterStatus.READ_ONLY_COUNT) { final String msg = String.format( "This Counter can only be put into the %s or %s status! %s is not allowed.", CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT, incomingCounterStatus); throw new CounterNotMutableException(counterName, msg); } }
[ "@", "VisibleForTesting", "protected", "void", "assertValidExternalCounterStatus", "(", "final", "String", "counterName", ",", "final", "CounterStatus", "incomingCounterStatus", ")", "{", "Preconditions", ".", "checkNotNull", "(", "counterName", ")", ";", "Preconditions",...
Helper method to determine if a counter can be put into the {@code incomingCounterStatus} by an external caller. Currently, external callers may only put a Counter into the AVAILABLE or READ_ONLY status. @param counterName The name of the counter. @param incomingCounterStatus The status of an incoming counter that is being updated by an external counter. @return
[ "Helper", "method", "to", "determine", "if", "a", "counter", "can", "be", "put", "into", "the", "{", "@code", "incomingCounterStatus", "}", "by", "an", "external", "caller", ".", "Currently", "external", "callers", "may", "only", "put", "a", "Counter", "into...
train
https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java#L1470-L1483
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.interpretLs
protected int interpretLs(LineParser lp, MessageMgr mm){ String directory = lp.getArgs(); IOFileFilter fileFilter = new WildcardFileFilter(new String[]{ "*.ssc" }); DirectoryLoader dl = new CommonsDirectoryWalker(directory, DirectoryFileFilter.INSTANCE, fileFilter); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } FileSourceList fsl = dl.load(); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } for(FileSource fs : fsl.getSource()){ //TODO need to adapt to new source return mm.report(MessageMgr.createInfoMessage("script file - dir <{}> file <{}>", directory, fs.getBaseFileName())); } return 0; }
java
protected int interpretLs(LineParser lp, MessageMgr mm){ String directory = lp.getArgs(); IOFileFilter fileFilter = new WildcardFileFilter(new String[]{ "*.ssc" }); DirectoryLoader dl = new CommonsDirectoryWalker(directory, DirectoryFileFilter.INSTANCE, fileFilter); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } FileSourceList fsl = dl.load(); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } for(FileSource fs : fsl.getSource()){ //TODO need to adapt to new source return mm.report(MessageMgr.createInfoMessage("script file - dir <{}> file <{}>", directory, fs.getBaseFileName())); } return 0; }
[ "protected", "int", "interpretLs", "(", "LineParser", "lp", ",", "MessageMgr", "mm", ")", "{", "String", "directory", "=", "lp", ".", "getArgs", "(", ")", ";", "IOFileFilter", "fileFilter", "=", "new", "WildcardFileFilter", "(", "new", "String", "[", "]", ...
Interprets the actual ls command @param lp line parser @param mm the message manager to use for reporting errors, warnings, and infos @return 0 for success, non-zero otherwise
[ "Interprets", "the", "actual", "ls", "command" ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L162-L182
OpenTSDB/opentsdb
src/core/Tags.java
Tags.resolveIds
public static HashMap<String, String> resolveIds(final TSDB tsdb, final ArrayList<byte[]> tags) throws NoSuchUniqueId { try { return resolveIdsAsync(tsdb, tags).joinUninterruptibly(); } catch (NoSuchUniqueId e) { throw e; } catch (DeferredGroupException e) { final Throwable ex = Exceptions.getCause(e); if (ex instanceof NoSuchUniqueId) { throw (NoSuchUniqueId)ex; } // TODO process e.results() throw new RuntimeException("Shouldn't be here", e); } catch (Exception e) { throw new RuntimeException("Shouldn't be here", e); } }
java
public static HashMap<String, String> resolveIds(final TSDB tsdb, final ArrayList<byte[]> tags) throws NoSuchUniqueId { try { return resolveIdsAsync(tsdb, tags).joinUninterruptibly(); } catch (NoSuchUniqueId e) { throw e; } catch (DeferredGroupException e) { final Throwable ex = Exceptions.getCause(e); if (ex instanceof NoSuchUniqueId) { throw (NoSuchUniqueId)ex; } // TODO process e.results() throw new RuntimeException("Shouldn't be here", e); } catch (Exception e) { throw new RuntimeException("Shouldn't be here", e); } }
[ "public", "static", "HashMap", "<", "String", ",", "String", ">", "resolveIds", "(", "final", "TSDB", "tsdb", ",", "final", "ArrayList", "<", "byte", "[", "]", ">", "tags", ")", "throws", "NoSuchUniqueId", "{", "try", "{", "return", "resolveIdsAsync", "(",...
Resolves all the tags IDs (name followed by value) into the a map. This function is the opposite of {@link #resolveAll}. @param tsdb The TSDB to use for UniqueId lookups. @param tags The tag IDs to resolve. @return A map mapping tag names to tag values. @throws NoSuchUniqueId if one of the elements in the array contained an invalid ID. @throws IllegalArgumentException if one of the elements in the array had the wrong number of bytes.
[ "Resolves", "all", "the", "tags", "IDs", "(", "name", "followed", "by", "value", ")", "into", "the", "a", "map", ".", "This", "function", "is", "the", "opposite", "of", "{" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Tags.java#L739-L757
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/syncer/Syncer.java
Syncer.updateValues
public <T> void updateValues(T receiver, ISyncHandler<T, ? extends ISyncableData> handler, Map<String, Object> values) { if (receiver == null || handler == null) return; for (Entry<String, Object> entry : values.entrySet()) { ObjectData od = handler.getObjectData(entry.getKey()); if (od != null) od.set(receiver, entry.getValue()); } }
java
public <T> void updateValues(T receiver, ISyncHandler<T, ? extends ISyncableData> handler, Map<String, Object> values) { if (receiver == null || handler == null) return; for (Entry<String, Object> entry : values.entrySet()) { ObjectData od = handler.getObjectData(entry.getKey()); if (od != null) od.set(receiver, entry.getValue()); } }
[ "public", "<", "T", ">", "void", "updateValues", "(", "T", "receiver", ",", "ISyncHandler", "<", "T", ",", "?", "extends", "ISyncableData", ">", "handler", ",", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "if", "(", "receiver", "==", ...
Update the fields values for the receiver object. @param receiver the caller @param handler the handler @param values the values
[ "Update", "the", "fields", "values", "for", "the", "receiver", "object", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/syncer/Syncer.java#L324-L335
aspectran/aspectran
core/src/main/java/com/aspectran/core/activity/request/FileParameter.java
FileParameter.saveAs
public File saveAs(File destFile, boolean overwrite) throws IOException { if (destFile == null) { throw new IllegalArgumentException("destFile can not be null"); } try { destFile = determineDestinationFile(destFile, overwrite); final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int len; try (InputStream input = getInputStream(); OutputStream output = new FileOutputStream(destFile)) { while ((len = input.read(buffer)) != -1) { output.write(buffer, 0, len); } } } catch (Exception e) { throw new IOException("Could not save as file " + destFile, e); } setSavedFile(destFile); return destFile; }
java
public File saveAs(File destFile, boolean overwrite) throws IOException { if (destFile == null) { throw new IllegalArgumentException("destFile can not be null"); } try { destFile = determineDestinationFile(destFile, overwrite); final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int len; try (InputStream input = getInputStream(); OutputStream output = new FileOutputStream(destFile)) { while ((len = input.read(buffer)) != -1) { output.write(buffer, 0, len); } } } catch (Exception e) { throw new IOException("Could not save as file " + destFile, e); } setSavedFile(destFile); return destFile; }
[ "public", "File", "saveAs", "(", "File", "destFile", ",", "boolean", "overwrite", ")", "throws", "IOException", "{", "if", "(", "destFile", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"destFile can not be null\"", ")", ";", "}", ...
Save an file as a given destination file. @param destFile the destination file @param overwrite whether to overwrite if it already exists @return a saved file @throws IOException if an I/O error has occurred
[ "Save", "an", "file", "as", "a", "given", "destination", "file", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/request/FileParameter.java#L177-L198
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java
GenericAuditEventMessageImpl.setAuditSourceId
public void setAuditSourceId(String sourceId, String enterpriseSiteId, RFC3881AuditSourceTypes[] typeCodes) { addAuditSourceIdentification(sourceId, enterpriseSiteId, typeCodes); }
java
public void setAuditSourceId(String sourceId, String enterpriseSiteId, RFC3881AuditSourceTypes[] typeCodes) { addAuditSourceIdentification(sourceId, enterpriseSiteId, typeCodes); }
[ "public", "void", "setAuditSourceId", "(", "String", "sourceId", ",", "String", "enterpriseSiteId", ",", "RFC3881AuditSourceTypes", "[", "]", "typeCodes", ")", "{", "addAuditSourceIdentification", "(", "sourceId", ",", "enterpriseSiteId", ",", "typeCodes", ")", ";", ...
Sets a Audit Source Identification block for a given Audit Source ID, Audit Source Enterprise Site ID, and a list of audit source type codes @param sourceId The Audit Source ID to use @param enterpriseSiteId The Audit Enterprise Site ID to use @param typeCodes The RFC 3881 Audit Source Type codes to use
[ "Sets", "a", "Audit", "Source", "Identification", "block", "for", "a", "given", "Audit", "Source", "ID", "Audit", "Source", "Enterprise", "Site", "ID", "and", "a", "list", "of", "audit", "source", "type", "codes" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java#L103-L106
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.analyzeImageByDomainInStreamAsync
public Observable<DomainModelResults> analyzeImageByDomainInStreamAsync(String model, byte[] image, AnalyzeImageByDomainInStreamOptionalParameter analyzeImageByDomainInStreamOptionalParameter) { return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image, analyzeImageByDomainInStreamOptionalParameter).map(new Func1<ServiceResponse<DomainModelResults>, DomainModelResults>() { @Override public DomainModelResults call(ServiceResponse<DomainModelResults> response) { return response.body(); } }); }
java
public Observable<DomainModelResults> analyzeImageByDomainInStreamAsync(String model, byte[] image, AnalyzeImageByDomainInStreamOptionalParameter analyzeImageByDomainInStreamOptionalParameter) { return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image, analyzeImageByDomainInStreamOptionalParameter).map(new Func1<ServiceResponse<DomainModelResults>, DomainModelResults>() { @Override public DomainModelResults call(ServiceResponse<DomainModelResults> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DomainModelResults", ">", "analyzeImageByDomainInStreamAsync", "(", "String", "model", ",", "byte", "[", "]", "image", ",", "AnalyzeImageByDomainInStreamOptionalParameter", "analyzeImageByDomainInStreamOptionalParameter", ")", "{", "return", "ana...
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API only provides a single domain-specific model: celebrities. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param model The domain-specific content to recognize. @param image An image stream. @param analyzeImageByDomainInStreamOptionalParameter 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 DomainModelResults object
[ "This", "operation", "recognizes", "content", "within", "an", "image", "by", "applying", "a", "domain", "-", "specific", "model", ".", "The", "list", "of", "domain", "-", "specific", "models", "that", "are", "supported", "by", "the", "Computer", "Vision", "A...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L284-L291
hector-client/hector
core/src/main/java/me/prettyprint/cassandra/connection/security/KerberosHelper.java
KerberosHelper.authenticateClient
public static GSSContext authenticateClient(final Socket socket, Subject subject, final String servicePrincipalName) { return Subject.doAs(subject, new PrivilegedAction<GSSContext>() { public GSSContext run() { try { GSSManager manager = GSSManager.getInstance(); GSSName peerName = manager.createName(servicePrincipalName, GSSName.NT_HOSTBASED_SERVICE); GSSContext context = manager.createContext(peerName, null, null, GSSContext.DEFAULT_LIFETIME); // Loop while the context is still not established while (!context.isEstablished()) { context.initSecContext(socket.getInputStream(), socket.getOutputStream()); } return context; } catch (Exception e) { log.error("Unable to authenticate client against Kerberos", e); return null; } } }); }
java
public static GSSContext authenticateClient(final Socket socket, Subject subject, final String servicePrincipalName) { return Subject.doAs(subject, new PrivilegedAction<GSSContext>() { public GSSContext run() { try { GSSManager manager = GSSManager.getInstance(); GSSName peerName = manager.createName(servicePrincipalName, GSSName.NT_HOSTBASED_SERVICE); GSSContext context = manager.createContext(peerName, null, null, GSSContext.DEFAULT_LIFETIME); // Loop while the context is still not established while (!context.isEstablished()) { context.initSecContext(socket.getInputStream(), socket.getOutputStream()); } return context; } catch (Exception e) { log.error("Unable to authenticate client against Kerberos", e); return null; } } }); }
[ "public", "static", "GSSContext", "authenticateClient", "(", "final", "Socket", "socket", ",", "Subject", "subject", ",", "final", "String", "servicePrincipalName", ")", "{", "return", "Subject", ".", "doAs", "(", "subject", ",", "new", "PrivilegedAction", "<", ...
Authenticate client to use this service and return secure context @param socket The socket used for communication @param subject The Kerberos service subject @param servicePrincipalName Service principal name @return context if authorized or null
[ "Authenticate", "client", "to", "use", "this", "service", "and", "return", "secure", "context" ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/connection/security/KerberosHelper.java#L72-L92
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.isBefore
public static IsBefore isBefore(Expression<Date> left, Expression<Date> right) { return new IsBefore(left, right); }
java
public static IsBefore isBefore(Expression<Date> left, Expression<Date> right) { return new IsBefore(left, right); }
[ "public", "static", "IsBefore", "isBefore", "(", "Expression", "<", "Date", ">", "left", ",", "Expression", "<", "Date", ">", "right", ")", "{", "return", "new", "IsBefore", "(", "left", ",", "right", ")", ";", "}" ]
Creates an IsBefore expression from the given expressions. @param left The left hand side of the comparison @param right The right hand side of the comparison. @return An IsBefore expression.
[ "Creates", "an", "IsBefore", "expression", "from", "the", "given", "expressions", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L744-L746
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.listContacts
public ContactList listContacts(int offset, int limit) throws UnauthorizedException, GeneralException { return messageBirdService.requestList(CONTACTPATH, offset, limit, ContactList.class); }
java
public ContactList listContacts(int offset, int limit) throws UnauthorizedException, GeneralException { return messageBirdService.requestList(CONTACTPATH, offset, limit, ContactList.class); }
[ "public", "ContactList", "listContacts", "(", "int", "offset", ",", "int", "limit", ")", "throws", "UnauthorizedException", ",", "GeneralException", "{", "return", "messageBirdService", ".", "requestList", "(", "CONTACTPATH", ",", "offset", ",", "limit", ",", "Con...
Gets a contact listing with specified pagination options. @return Listing of Contact objects.
[ "Gets", "a", "contact", "listing", "with", "specified", "pagination", "options", "." ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L553-L555
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java
IOUtil.asUTF8String
public static String asUTF8String(InputStream in) { // Precondition check Validate.notNull(in, "Stream must be specified"); StringBuilder buffer = new StringBuilder(); String line; try { BufferedReader reader = new BufferedReader(new InputStreamReader(in, CHARSET_UTF8)); while ((line = reader.readLine()) != null) { buffer.append(line).append(Character.LINE_SEPARATOR); } } catch (IOException ioe) { throw new RuntimeException("Error in obtaining string from " + in, ioe); } finally { try { in.close(); } catch (IOException ignore) { if (log.isLoggable(Level.FINER)) { log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring"); } } } return buffer.toString(); }
java
public static String asUTF8String(InputStream in) { // Precondition check Validate.notNull(in, "Stream must be specified"); StringBuilder buffer = new StringBuilder(); String line; try { BufferedReader reader = new BufferedReader(new InputStreamReader(in, CHARSET_UTF8)); while ((line = reader.readLine()) != null) { buffer.append(line).append(Character.LINE_SEPARATOR); } } catch (IOException ioe) { throw new RuntimeException("Error in obtaining string from " + in, ioe); } finally { try { in.close(); } catch (IOException ignore) { if (log.isLoggable(Level.FINER)) { log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring"); } } } return buffer.toString(); }
[ "public", "static", "String", "asUTF8String", "(", "InputStream", "in", ")", "{", "// Precondition check", "Validate", ".", "notNull", "(", "in", ",", "\"Stream must be specified\"", ")", ";", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", ...
Obtains the contents of the specified stream as a String in UTF-8 charset. @param in @throws IllegalArgumentException If the stream was not specified
[ "Obtains", "the", "contents", "of", "the", "specified", "stream", "as", "a", "String", "in", "UTF", "-", "8", "charset", "." ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L99-L124
apache/incubator-heron
heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java
SchedulerStateManagerAdaptor.updateTopology
public Boolean updateTopology(TopologyAPI.Topology topology, String topologyName) { if (getTopology(topologyName) != null) { deleteTopology(topologyName); } return setTopology(topology, topologyName); }
java
public Boolean updateTopology(TopologyAPI.Topology topology, String topologyName) { if (getTopology(topologyName) != null) { deleteTopology(topologyName); } return setTopology(topology, topologyName); }
[ "public", "Boolean", "updateTopology", "(", "TopologyAPI", ".", "Topology", "topology", ",", "String", "topologyName", ")", "{", "if", "(", "getTopology", "(", "topologyName", ")", "!=", "null", ")", "{", "deleteTopology", "(", "topologyName", ")", ";", "}", ...
Update the topology definition for the given topology. If the topology doesn't exist, create it. If it does, update it. @param topologyName the name of the topology @return Boolean - Success or Failure
[ "Update", "the", "topology", "definition", "for", "the", "given", "topology", ".", "If", "the", "topology", "doesn", "t", "exist", "create", "it", ".", "If", "it", "does", "update", "it", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L129-L134
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/core/support/LabelInfo.java
LabelInfo.checkForValidEscapedCharacter
private static void checkForValidEscapedCharacter(int index, String labelDescriptor) { if (index >= labelDescriptor.length()) { throw new IllegalArgumentException( "The label descriptor contains an invalid escape sequence. Backslash " + "characters (\\) must be followed by either an ampersand (&) or another " + "backslash."); } char escapedChar = labelDescriptor.charAt(index); if (escapedChar != '&' && escapedChar != '\\') { throw new IllegalArgumentException( "The label descriptor [" + labelDescriptor + "] contains an invalid escape sequence. Backslash " + "characters (\\) must be followed by either an ampersand (&) or another " + "backslash."); } }
java
private static void checkForValidEscapedCharacter(int index, String labelDescriptor) { if (index >= labelDescriptor.length()) { throw new IllegalArgumentException( "The label descriptor contains an invalid escape sequence. Backslash " + "characters (\\) must be followed by either an ampersand (&) or another " + "backslash."); } char escapedChar = labelDescriptor.charAt(index); if (escapedChar != '&' && escapedChar != '\\') { throw new IllegalArgumentException( "The label descriptor [" + labelDescriptor + "] contains an invalid escape sequence. Backslash " + "characters (\\) must be followed by either an ampersand (&) or another " + "backslash."); } }
[ "private", "static", "void", "checkForValidEscapedCharacter", "(", "int", "index", ",", "String", "labelDescriptor", ")", "{", "if", "(", "index", ">=", "labelDescriptor", ".", "length", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The...
Confirms that the character at the specified index within the given label descriptor is a valid 'escapable' character. i.e. either an ampersand or backslash. @param index The position within the label descriptor of the character to be checked. @param labelDescriptor The label descriptor. @throws NullPointerException if {@code labelDescriptor} is null. @throws IllegalArgumentException if the given {@code index} position is beyond the length of the string or if the character at that position is not an ampersand or backslash.
[ "Confirms", "that", "the", "character", "at", "the", "specified", "index", "within", "the", "given", "label", "descriptor", "is", "a", "valid", "escapable", "character", ".", "i", ".", "e", ".", "either", "an", "ampersand", "or", "backslash", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/core/support/LabelInfo.java#L190-L210
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java
AnnotationUtils.findAnnotationDeclaringClassForTypes
public static Class<?> findAnnotationDeclaringClassForTypes(List<Class<? extends Annotation>> annotationTypes, Class<?> clazz) { Assert.notEmpty(annotationTypes, "The list of annotation types must not be empty"); if (clazz == null || clazz.equals(Object.class)) { return null; } for (Class<? extends Annotation> annotationType : annotationTypes) { if (isAnnotationDeclaredLocally(annotationType, clazz)) { return clazz; } } return findAnnotationDeclaringClassForTypes(annotationTypes, clazz.getSuperclass()); }
java
public static Class<?> findAnnotationDeclaringClassForTypes(List<Class<? extends Annotation>> annotationTypes, Class<?> clazz) { Assert.notEmpty(annotationTypes, "The list of annotation types must not be empty"); if (clazz == null || clazz.equals(Object.class)) { return null; } for (Class<? extends Annotation> annotationType : annotationTypes) { if (isAnnotationDeclaredLocally(annotationType, clazz)) { return clazz; } } return findAnnotationDeclaringClassForTypes(annotationTypes, clazz.getSuperclass()); }
[ "public", "static", "Class", "<", "?", ">", "findAnnotationDeclaringClassForTypes", "(", "List", "<", "Class", "<", "?", "extends", "Annotation", ">", ">", "annotationTypes", ",", "Class", "<", "?", ">", "clazz", ")", "{", "Assert", ".", "notEmpty", "(", "...
Find the first {@link Class} in the inheritance hierarchy of the specified {@code clazz} (including the specified {@code clazz} itself) which declares at least one of the specified {@code annotationTypes}, or {@code null} if none of the specified annotation types could be found. <p>If the supplied {@code clazz} is {@code null}, {@code null} will be returned. <p>If the supplied {@code clazz} is an interface, only the interface itself will be checked; the inheritance hierarchy for interfaces will not be traversed. <p>The standard {@link Class} API does not provide a mechanism for determining which class in an inheritance hierarchy actually declares one of several candidate {@linkplain Annotation annotations}, so we need to handle this explicitly. @param annotationTypes the list of Class objects corresponding to the annotation types @param clazz the Class object corresponding to the class on which to check for the annotations, or {@code null} @return the first {@link Class} in the inheritance hierarchy of the specified {@code clazz} which declares an annotation of at least one of the specified {@code annotationTypes}, or {@code null} if not found @since 3.2.2 @see Class#isAnnotationPresent(Class) @see Class#getDeclaredAnnotations() @see #findAnnotationDeclaringClass(Class, Class) @see #isAnnotationDeclaredLocally(Class, Class)
[ "Find", "the", "first", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L443-L454
the-fascinator/plugin-authentication-internal
src/main/java/com/googlecode/fascinator/authentication/internal/InternalAuthentication.java
InternalAuthentication.createUser
@Override public User createUser(String username, String password) throws AuthenticationException { String user = file_store.getProperty(username); if (user != null) { throw new AuthenticationException("User '" + username + "' already exists."); } // Encrypt the new password String ePwd = encryptPassword(password); file_store.put(username, ePwd); try { saveUsers(); } catch (IOException e) { throw new AuthenticationException("Error changing password: ", e); } return getUser(username); }
java
@Override public User createUser(String username, String password) throws AuthenticationException { String user = file_store.getProperty(username); if (user != null) { throw new AuthenticationException("User '" + username + "' already exists."); } // Encrypt the new password String ePwd = encryptPassword(password); file_store.put(username, ePwd); try { saveUsers(); } catch (IOException e) { throw new AuthenticationException("Error changing password: ", e); } return getUser(username); }
[ "@", "Override", "public", "User", "createUser", "(", "String", "username", ",", "String", "password", ")", "throws", "AuthenticationException", "{", "String", "user", "=", "file_store", ".", "getProperty", "(", "username", ")", ";", "if", "(", "user", "!=", ...
Create a user. @param username The username of the new user. @param password The password of the new user. @return A user object for the newly created in user. @throws AuthenticationException if there was an error creating the user.
[ "Create", "a", "user", "." ]
train
https://github.com/the-fascinator/plugin-authentication-internal/blob/a2b9a0eda9b43bf20583036a406c83c938be3042/src/main/java/com/googlecode/fascinator/authentication/internal/InternalAuthentication.java#L319-L337
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java
CustomDictionary.updateAttributeIfExist
private static boolean updateAttributeIfExist(String key, CoreDictionary.Attribute attribute, TreeMap<String, CoreDictionary.Attribute> map, TreeMap<Integer, CoreDictionary.Attribute> rewriteTable) { int wordID = CoreDictionary.getWordID(key); CoreDictionary.Attribute attributeExisted; if (wordID != -1) { attributeExisted = CoreDictionary.get(wordID); attributeExisted.nature = attribute.nature; attributeExisted.frequency = attribute.frequency; attributeExisted.totalFrequency = attribute.totalFrequency; // 收集该覆写 rewriteTable.put(wordID, attribute); return true; } attributeExisted = map.get(key); if (attributeExisted != null) { attributeExisted.nature = attribute.nature; attributeExisted.frequency = attribute.frequency; attributeExisted.totalFrequency = attribute.totalFrequency; return true; } return false; }
java
private static boolean updateAttributeIfExist(String key, CoreDictionary.Attribute attribute, TreeMap<String, CoreDictionary.Attribute> map, TreeMap<Integer, CoreDictionary.Attribute> rewriteTable) { int wordID = CoreDictionary.getWordID(key); CoreDictionary.Attribute attributeExisted; if (wordID != -1) { attributeExisted = CoreDictionary.get(wordID); attributeExisted.nature = attribute.nature; attributeExisted.frequency = attribute.frequency; attributeExisted.totalFrequency = attribute.totalFrequency; // 收集该覆写 rewriteTable.put(wordID, attribute); return true; } attributeExisted = map.get(key); if (attributeExisted != null) { attributeExisted.nature = attribute.nature; attributeExisted.frequency = attribute.frequency; attributeExisted.totalFrequency = attribute.totalFrequency; return true; } return false; }
[ "private", "static", "boolean", "updateAttributeIfExist", "(", "String", "key", ",", "CoreDictionary", ".", "Attribute", "attribute", ",", "TreeMap", "<", "String", ",", "CoreDictionary", ".", "Attribute", ">", "map", ",", "TreeMap", "<", "Integer", ",", "CoreDi...
如果已经存在该词条,直接更新该词条的属性 @param key 词语 @param attribute 词语的属性 @param map 加载期间的map @param rewriteTable @return 是否更新了
[ "如果已经存在该词条", "直接更新该词条的属性" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L230-L255
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.paintCloseHover
private void paintCloseHover(Graphics2D g, JComponent c, int width, int height) { paintClose(g, c, width, height, hover); }
java
private void paintCloseHover(Graphics2D g, JComponent c, int width, int height) { paintClose(g, c, width, height, hover); }
[ "private", "void", "paintCloseHover", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paintClose", "(", "g", ",", "c", ",", "width", ",", "height", ",", "hover", ")", ";", "}" ]
Paint the background mouse-over 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", "background", "mouse", "-", "over", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L127-L129
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/service/data/process/EngineDataAccessDB.java
EngineDataAccessDB.getVariableNameForTaskInstance
public String getVariableNameForTaskInstance(Long taskInstId, String name) throws SQLException { String query = "select v.VARIABLE_NAME " + "from VARIABLE v, VARIABLE_MAPPING vm, TASK t, TASK_INSTANCE ti " + "where ti.TASK_INSTANCE_ID = ?" + " and ti.TASK_ID = t.TASK_ID" + " and vm.MAPPING_OWNER = 'TASK'" + " and vm.MAPPING_OWNER_ID = t.TASK_ID" + " and v.VARIABLE_ID = vm.VARIABLE_ID" + " and (v.VARIABLE_NAME = ? or vm.VAR_REFERRED_AS = ?)"; Object[] args = new Object[3]; args[0] = taskInstId; args[1] = name; args[2] = name; ResultSet rs = db.runSelect(query, args); if (rs.next()) { /*if (rs.isLast())*/ return rs.getString(1); //else throw new SQLException("getVariableNameForTaskInstance returns non-unique result"); } else throw new SQLException("getVariableNameForTaskInstance returns no result"); }
java
public String getVariableNameForTaskInstance(Long taskInstId, String name) throws SQLException { String query = "select v.VARIABLE_NAME " + "from VARIABLE v, VARIABLE_MAPPING vm, TASK t, TASK_INSTANCE ti " + "where ti.TASK_INSTANCE_ID = ?" + " and ti.TASK_ID = t.TASK_ID" + " and vm.MAPPING_OWNER = 'TASK'" + " and vm.MAPPING_OWNER_ID = t.TASK_ID" + " and v.VARIABLE_ID = vm.VARIABLE_ID" + " and (v.VARIABLE_NAME = ? or vm.VAR_REFERRED_AS = ?)"; Object[] args = new Object[3]; args[0] = taskInstId; args[1] = name; args[2] = name; ResultSet rs = db.runSelect(query, args); if (rs.next()) { /*if (rs.isLast())*/ return rs.getString(1); //else throw new SQLException("getVariableNameForTaskInstance returns non-unique result"); } else throw new SQLException("getVariableNameForTaskInstance returns no result"); }
[ "public", "String", "getVariableNameForTaskInstance", "(", "Long", "taskInstId", ",", "String", "name", ")", "throws", "SQLException", "{", "String", "query", "=", "\"select v.VARIABLE_NAME \"", "+", "\"from VARIABLE v, VARIABLE_MAPPING vm, TASK t, TASK_INSTANCE ti \"", "+", ...
Get the variable name for a task instance with 'Referred as' name @param taskInstId @param name @return @throws SQLException
[ "Get", "the", "variable", "name", "for", "a", "task", "instance", "with", "Referred", "as", "name" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/data/process/EngineDataAccessDB.java#L1169-L1187
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java
FeatureUtilities.getAttributeCaseChecked
public static Object getAttributeCaseChecked( SimpleFeature feature, String field ) { Object attribute = feature.getAttribute(field); if (attribute == null) { attribute = feature.getAttribute(field.toLowerCase()); if (attribute != null) return attribute; attribute = feature.getAttribute(field.toUpperCase()); if (attribute != null) return attribute; // alright, last try, search for it SimpleFeatureType featureType = feature.getFeatureType(); field = findAttributeName(featureType, field); if (field != null) { return feature.getAttribute(field); } } return attribute; }
java
public static Object getAttributeCaseChecked( SimpleFeature feature, String field ) { Object attribute = feature.getAttribute(field); if (attribute == null) { attribute = feature.getAttribute(field.toLowerCase()); if (attribute != null) return attribute; attribute = feature.getAttribute(field.toUpperCase()); if (attribute != null) return attribute; // alright, last try, search for it SimpleFeatureType featureType = feature.getFeatureType(); field = findAttributeName(featureType, field); if (field != null) { return feature.getAttribute(field); } } return attribute; }
[ "public", "static", "Object", "getAttributeCaseChecked", "(", "SimpleFeature", "feature", ",", "String", "field", ")", "{", "Object", "attribute", "=", "feature", ".", "getAttribute", "(", "field", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "a...
Getter for attributes of a feature. <p>If the attribute is not found, checks are done in non case sensitive mode. @param feature the feature from which to get the attribute. @param field the name of the field. @return the attribute or null if none found.
[ "Getter", "for", "attributes", "of", "a", "feature", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java#L590-L608
tzaeschke/zoodb
src/org/zoodb/internal/client/SchemaManager.java
SchemaManager.locateClassDefinition
private ZooClassDef locateClassDefinition(Class<?> cls, Node node) { ZooClassDef def = cache.getSchema(cls, node); if (def == null || def.jdoZooIsDeleted()) { return null; } return def; }
java
private ZooClassDef locateClassDefinition(Class<?> cls, Node node) { ZooClassDef def = cache.getSchema(cls, node); if (def == null || def.jdoZooIsDeleted()) { return null; } return def; }
[ "private", "ZooClassDef", "locateClassDefinition", "(", "Class", "<", "?", ">", "cls", ",", "Node", "node", ")", "{", "ZooClassDef", "def", "=", "cache", ".", "getSchema", "(", "cls", ",", "node", ")", ";", "if", "(", "def", "==", "null", "||", "def", ...
Checks class and disk for class definition. @param cls @param node @return Class definition, may return null if no definition is found.
[ "Checks", "class", "and", "disk", "for", "class", "definition", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/client/SchemaManager.java#L82-L88
e-biz/spring-dbunit
spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java
FlyWeightFlatXmlProducer.buildException
protected final static DataSetException buildException(SAXException cause) { int lineNumber = -1; if (cause instanceof SAXParseException) { lineNumber = ((SAXParseException) cause).getLineNumber(); } Exception exception = cause.getException() == null ? cause : cause.getException(); String message; if (lineNumber >= 0) { message = "Line " + lineNumber + ": " + exception.getMessage(); } else { message = exception.getMessage(); } if (exception instanceof DataSetException) { return (DataSetException) exception; } else { return new DataSetException(message, exception); } }
java
protected final static DataSetException buildException(SAXException cause) { int lineNumber = -1; if (cause instanceof SAXParseException) { lineNumber = ((SAXParseException) cause).getLineNumber(); } Exception exception = cause.getException() == null ? cause : cause.getException(); String message; if (lineNumber >= 0) { message = "Line " + lineNumber + ": " + exception.getMessage(); } else { message = exception.getMessage(); } if (exception instanceof DataSetException) { return (DataSetException) exception; } else { return new DataSetException(message, exception); } }
[ "protected", "final", "static", "DataSetException", "buildException", "(", "SAXException", "cause", ")", "{", "int", "lineNumber", "=", "-", "1", ";", "if", "(", "cause", "instanceof", "SAXParseException", ")", "{", "lineNumber", "=", "(", "(", "SAXParseExceptio...
Wraps a {@link SAXException} into a {@link DataSetException} @param cause The cause to be wrapped into a {@link DataSetException} @return A {@link DataSetException} that wraps the given {@link SAXException}
[ "Wraps", "a", "{", "@link", "SAXException", "}", "into", "a", "{", "@link", "DataSetException", "}" ]
train
https://github.com/e-biz/spring-dbunit/blob/1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b/spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java#L533-L552
jhalterman/failsafe
src/main/java/net/jodah/failsafe/FailsafeExecutor.java
FailsafeExecutor.getAsyncExecution
public <T extends R> CompletableFuture<T> getAsyncExecution(AsyncSupplier<T> supplier) { return callAsync(execution -> Functions.asyncOfExecution(supplier, execution), true); }
java
public <T extends R> CompletableFuture<T> getAsyncExecution(AsyncSupplier<T> supplier) { return callAsync(execution -> Functions.asyncOfExecution(supplier, execution), true); }
[ "public", "<", "T", "extends", "R", ">", "CompletableFuture", "<", "T", ">", "getAsyncExecution", "(", "AsyncSupplier", "<", "T", ">", "supplier", ")", "{", "return", "callAsync", "(", "execution", "->", "Functions", ".", "asyncOfExecution", "(", "supplier", ...
Executes the {@code supplier} asynchronously until a successful result is returned or the configured policies are exceeded. This method is intended for integration with asynchronous code. Retries must be manually scheduled via one of the {@code AsyncExecution.retry} methods. <p> If a configured circuit breaker is open, the resulting future is completed with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code supplier} is null @throws RejectedExecutionException if the {@code supplier} cannot be scheduled for execution
[ "Executes", "the", "{", "@code", "supplier", "}", "asynchronously", "until", "a", "successful", "result", "is", "returned", "or", "the", "configured", "policies", "are", "exceeded", ".", "This", "method", "is", "intended", "for", "integration", "with", "asynchro...
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L123-L125
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingConfigurationReadStepHandler.java
LoggingConfigurationReadStepHandler.setModelValue
static void setModelValue(final ModelNode model, final String value) { if (value != null) { model.set(value); } }
java
static void setModelValue(final ModelNode model, final String value) { if (value != null) { model.set(value); } }
[ "static", "void", "setModelValue", "(", "final", "ModelNode", "model", ",", "final", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "model", ".", "set", "(", "value", ")", ";", "}", "}" ]
Sets the value of the model if the value is not {@code null}. @param model the model to update @param value the value for the model
[ "Sets", "the", "value", "of", "the", "model", "if", "the", "value", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingConfigurationReadStepHandler.java#L89-L93
radkovo/jStyleParser
src/main/java/cz/vutbr/web/css/MediaSpec.java
MediaSpec.valueMatches
protected boolean valueMatches(Float required, float current, boolean min, boolean max) { if (required != null) { if (min) return (current >= required); else if (max) return (current <= required); else return current == required; } else return false; //invalid values don't match }
java
protected boolean valueMatches(Float required, float current, boolean min, boolean max) { if (required != null) { if (min) return (current >= required); else if (max) return (current <= required); else return current == required; } else return false; //invalid values don't match }
[ "protected", "boolean", "valueMatches", "(", "Float", "required", ",", "float", "current", ",", "boolean", "min", ",", "boolean", "max", ")", "{", "if", "(", "required", "!=", "null", ")", "{", "if", "(", "min", ")", "return", "(", "current", ">=", "re...
Checks whether a value coresponds to the given criteria. @param current the actual media value @param required the required value or {@code null} for invalid requirement @param min {@code true} when the required value is the minimal one @param max {@code true} when the required value is the maximal one @return {@code true} when the value matches the criteria.
[ "Checks", "whether", "a", "value", "coresponds", "to", "the", "given", "criteria", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L514-L527
recommenders/rival
rival-split/src/main/java/net/recommenders/rival/split/parser/MovielensParser.java
MovielensParser.parseLine
private void parseLine(final String line, final TemporalDataModelIF<Long, Long> dataset) { String[] toks; if (line.contains("::")) { toks = line.split("::"); } else { toks = line.split("\t"); } // user long userId = Long.parseLong(toks[USER_TOK]); // item long itemId = Long.parseLong(toks[ITEM_TOK]); // timestamp long timestamp = Long.parseLong(toks[TIME_TOK]); // preference double preference = Double.parseDouble(toks[RATING_TOK]); ////// // update information ////// dataset.addPreference(userId, itemId, preference); dataset.addTimestamp(userId, itemId, timestamp); }
java
private void parseLine(final String line, final TemporalDataModelIF<Long, Long> dataset) { String[] toks; if (line.contains("::")) { toks = line.split("::"); } else { toks = line.split("\t"); } // user long userId = Long.parseLong(toks[USER_TOK]); // item long itemId = Long.parseLong(toks[ITEM_TOK]); // timestamp long timestamp = Long.parseLong(toks[TIME_TOK]); // preference double preference = Double.parseDouble(toks[RATING_TOK]); ////// // update information ////// dataset.addPreference(userId, itemId, preference); dataset.addTimestamp(userId, itemId, timestamp); }
[ "private", "void", "parseLine", "(", "final", "String", "line", ",", "final", "TemporalDataModelIF", "<", "Long", ",", "Long", ">", "dataset", ")", "{", "String", "[", "]", "toks", ";", "if", "(", "line", ".", "contains", "(", "\"::\"", ")", ")", "{", ...
A method that parses a line from the file. @param line the line to be parsed @param dataset the dataset where the information parsed from the line will be stored into.
[ "A", "method", "that", "parses", "a", "line", "from", "the", "file", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-split/src/main/java/net/recommenders/rival/split/parser/MovielensParser.java#L84-L104
dropwizard/dropwizard
dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java
ServletEnvironment.addServlet
public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) { final ServletHolder holder = new NonblockingServletHolder(requireNonNull(servlet)); holder.setName(name); handler.getServletHandler().addServlet(holder); final ServletRegistration.Dynamic registration = holder.getRegistration(); checkDuplicateRegistration(name, servlets, "servlet"); return registration; }
java
public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) { final ServletHolder holder = new NonblockingServletHolder(requireNonNull(servlet)); holder.setName(name); handler.getServletHandler().addServlet(holder); final ServletRegistration.Dynamic registration = holder.getRegistration(); checkDuplicateRegistration(name, servlets, "servlet"); return registration; }
[ "public", "ServletRegistration", ".", "Dynamic", "addServlet", "(", "String", "name", ",", "Servlet", "servlet", ")", "{", "final", "ServletHolder", "holder", "=", "new", "NonblockingServletHolder", "(", "requireNonNull", "(", "servlet", ")", ")", ";", "holder", ...
Add a servlet instance. @param name the servlet's name @param servlet the servlet instance @return a {@link javax.servlet.ServletRegistration.Dynamic} instance allowing for further configuration
[ "Add", "a", "servlet", "instance", "." ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L45-L54
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java
BookKeeperLog.updateMetadata
private LogMetadata updateMetadata(LogMetadata currentMetadata, LedgerHandle newLedger, boolean clearEmptyLedgers) throws DurableDataLogException { boolean create = currentMetadata == null; if (create) { // This is the first ledger ever in the metadata. currentMetadata = new LogMetadata(newLedger.getId()); } else { currentMetadata = currentMetadata.addLedger(newLedger.getId()); if (clearEmptyLedgers) { // Remove those ledgers from the metadata that are empty. currentMetadata = currentMetadata.removeEmptyLedgers(Ledgers.MIN_FENCE_LEDGER_COUNT); } } try { persistMetadata(currentMetadata, create); } catch (DurableDataLogException ex) { try { Ledgers.delete(newLedger.getId(), this.bookKeeper); } catch (Exception deleteEx) { log.warn("{}: Unable to delete newly created ledger {}.", this.traceObjectId, newLedger.getId(), deleteEx); ex.addSuppressed(deleteEx); } throw ex; } log.info("{} Metadata updated ({}).", this.traceObjectId, currentMetadata); return currentMetadata; }
java
private LogMetadata updateMetadata(LogMetadata currentMetadata, LedgerHandle newLedger, boolean clearEmptyLedgers) throws DurableDataLogException { boolean create = currentMetadata == null; if (create) { // This is the first ledger ever in the metadata. currentMetadata = new LogMetadata(newLedger.getId()); } else { currentMetadata = currentMetadata.addLedger(newLedger.getId()); if (clearEmptyLedgers) { // Remove those ledgers from the metadata that are empty. currentMetadata = currentMetadata.removeEmptyLedgers(Ledgers.MIN_FENCE_LEDGER_COUNT); } } try { persistMetadata(currentMetadata, create); } catch (DurableDataLogException ex) { try { Ledgers.delete(newLedger.getId(), this.bookKeeper); } catch (Exception deleteEx) { log.warn("{}: Unable to delete newly created ledger {}.", this.traceObjectId, newLedger.getId(), deleteEx); ex.addSuppressed(deleteEx); } throw ex; } log.info("{} Metadata updated ({}).", this.traceObjectId, currentMetadata); return currentMetadata; }
[ "private", "LogMetadata", "updateMetadata", "(", "LogMetadata", "currentMetadata", ",", "LedgerHandle", "newLedger", ",", "boolean", "clearEmptyLedgers", ")", "throws", "DurableDataLogException", "{", "boolean", "create", "=", "currentMetadata", "==", "null", ";", "if",...
Updates the metadata and persists it as a result of adding a new Ledger. @param currentMetadata The current metadata. @param newLedger The newly added Ledger. @param clearEmptyLedgers If true, the new metadata will not not contain any pointers to empty Ledgers. Setting this to true will not remove a pointer to the last few ledgers in the Log (controlled by Ledgers.MIN_FENCE_LEDGER_COUNT), even if they are indeed empty (this is so we don't interfere with any ongoing fencing activities as another instance of this Log may not have yet been fenced out). @return A new instance of the LogMetadata, which includes the new ledger. @throws DurableDataLogException If an Exception occurred.
[ "Updates", "the", "metadata", "and", "persists", "it", "as", "a", "result", "of", "adding", "a", "new", "Ledger", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L742-L770
ogaclejapan/SmartTabLayout
utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java
Bundler.putBundle
public Bundler putBundle(String key, Bundle value) { bundle.putBundle(key, value); return this; }
java
public Bundler putBundle(String key, Bundle value) { bundle.putBundle(key, value); return this; }
[ "public", "Bundler", "putBundle", "(", "String", "key", ",", "Bundle", "value", ")", "{", "bundle", ".", "putBundle", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Bundle object, or null @return this
[ "Inserts", "a", "Bundle", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L344-L347
thorntail/thorntail
core/bootstrap/src/main/java/org/jboss/modules/maven/MavenArtifactUtil.java
MavenArtifactUtil.createMavenArtifactLoader
public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final ArtifactCoordinates coordinates, final String rootName) throws IOException { File fp = mavenResolver.resolveJarArtifact(coordinates); if (fp == null) return null; JarFile jarFile = JDKSpecific.getJarFile(fp, true); return ResourceLoaders.createJarResourceLoader(rootName, jarFile); }
java
public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final ArtifactCoordinates coordinates, final String rootName) throws IOException { File fp = mavenResolver.resolveJarArtifact(coordinates); if (fp == null) return null; JarFile jarFile = JDKSpecific.getJarFile(fp, true); return ResourceLoaders.createJarResourceLoader(rootName, jarFile); }
[ "public", "static", "ResourceLoader", "createMavenArtifactLoader", "(", "final", "MavenResolver", "mavenResolver", ",", "final", "ArtifactCoordinates", "coordinates", ",", "final", "String", "rootName", ")", "throws", "IOException", "{", "File", "fp", "=", "mavenResolve...
A utility method to create a Maven artifact resource loader for the given artifact coordinates. @param mavenResolver the Maven resolver to use (must not be {@code null}) @param coordinates the artifact coordinates to use (must not be {@code null}) @param rootName the resource root name to use (must not be {@code null}) @return the resource loader @throws IOException if the artifact could not be resolved
[ "A", "utility", "method", "to", "create", "a", "Maven", "artifact", "resource", "loader", "for", "the", "given", "artifact", "coordinates", "." ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/bootstrap/src/main/java/org/jboss/modules/maven/MavenArtifactUtil.java#L279-L284
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/Compare.java
Compare.compareTitles
private static boolean compareTitles(String primaryTitle, String firstCompareTitle, String secondCompareTitle, int maxDistance) { // Compare with the first title if (compareDistance(primaryTitle, firstCompareTitle, maxDistance)) { return true; } // Compare with the other title return compareDistance(primaryTitle, secondCompareTitle, maxDistance); }
java
private static boolean compareTitles(String primaryTitle, String firstCompareTitle, String secondCompareTitle, int maxDistance) { // Compare with the first title if (compareDistance(primaryTitle, firstCompareTitle, maxDistance)) { return true; } // Compare with the other title return compareDistance(primaryTitle, secondCompareTitle, maxDistance); }
[ "private", "static", "boolean", "compareTitles", "(", "String", "primaryTitle", ",", "String", "firstCompareTitle", ",", "String", "secondCompareTitle", ",", "int", "maxDistance", ")", "{", "// Compare with the first title", "if", "(", "compareDistance", "(", "primaryTi...
Compare a title with two other titles. @param primaryTitle Primary title @param firstCompareTitle First title to compare with @param secondCompareTitle Second title to compare with @param maxDistance Maximum difference between the titles @return
[ "Compare", "a", "title", "with", "two", "other", "titles", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/Compare.java#L99-L107
TimeAndSpaceIO/SmoothieMap
src/main/java/net/openhft/smoothie/SmoothieMap.java
SmoothieMap.putIfAbsent
@Override public final V putIfAbsent(K key, V value) { long hash; return segment(segmentIndex(hash = keyHashCode(key))).put(this, hash, key, value, true); }
java
@Override public final V putIfAbsent(K key, V value) { long hash; return segment(segmentIndex(hash = keyHashCode(key))).put(this, hash, key, value, true); }
[ "@", "Override", "public", "final", "V", "putIfAbsent", "(", "K", "key", ",", "V", "value", ")", "{", "long", "hash", ";", "return", "segment", "(", "segmentIndex", "(", "hash", "=", "keyHashCode", "(", "key", ")", ")", ")", ".", "put", "(", "this", ...
If the specified key is not already associated with a value (or is mapped to {@code null}) associates it with the given value and returns {@code null}, else returns the current value. @param key key with which the specified value is to be associated @param value value to be associated with the specified key @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key. (A {@code null} return can also indicate that the map previously associated {@code null} with the key.)
[ "If", "the", "specified", "key", "is", "not", "already", "associated", "with", "a", "value", "(", "or", "is", "mapped", "to", "{", "@code", "null", "}", ")", "associates", "it", "with", "the", "given", "value", "and", "returns", "{", "@code", "null", "...
train
https://github.com/TimeAndSpaceIO/SmoothieMap/blob/c798f6cae1d377f6913e8821a1fcf5bf45ee0412/src/main/java/net/openhft/smoothie/SmoothieMap.java#L818-L822
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/MCMutualAuthConfig.java
MCMutualAuthConfig.setProperty
public MCMutualAuthConfig setProperty(String name, String value) { properties.put(name, value); return this; }
java
public MCMutualAuthConfig setProperty(String name, String value) { properties.put(name, value); return this; }
[ "public", "MCMutualAuthConfig", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "properties", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets a property. @param name the name of the property to set @param value the value of the property to set @return the updated MCMutualAuthConfig @throws NullPointerException if name or value is {@code null}
[ "Sets", "a", "property", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/MCMutualAuthConfig.java#L106-L109
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java
PathUtils.removeExtension
public static Path removeExtension(Path path, String... extensions) { String pathString = path.toString(); for (String extension : extensions) { pathString = StringUtils.remove(pathString, extension); } return new Path(pathString); }
java
public static Path removeExtension(Path path, String... extensions) { String pathString = path.toString(); for (String extension : extensions) { pathString = StringUtils.remove(pathString, extension); } return new Path(pathString); }
[ "public", "static", "Path", "removeExtension", "(", "Path", "path", ",", "String", "...", "extensions", ")", "{", "String", "pathString", "=", "path", ".", "toString", "(", ")", ";", "for", "(", "String", "extension", ":", "extensions", ")", "{", "pathStri...
Removes all <code>extensions</code> from <code>path</code> if they exist. <pre> PathUtils.removeExtention("file.txt", ".txt") = file PathUtils.removeExtention("file.txt.gpg", ".txt", ".gpg") = file PathUtils.removeExtention("file", ".txt") = file PathUtils.removeExtention("file.txt", ".tar.gz") = file.txt PathUtils.removeExtention("file.txt.gpg", ".txt") = file.gpg PathUtils.removeExtention("file.txt.gpg", ".gpg") = file.txt </pre> @param path in which the <code>extensions</code> need to be removed @param extensions to be removed @return a new {@link Path} without <code>extensions</code>
[ "Removes", "all", "<code", ">", "extensions<", "/", "code", ">", "from", "<code", ">", "path<", "/", "code", ">", "if", "they", "exist", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java#L127-L134
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java
Matrix.setMatrix
public void setMatrix(int[] r, int j0, int j1, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = j0; j <= j1; j++) { A[r[i]][j] = X.get(i, j - j0); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
java
public void setMatrix(int[] r, int j0, int j1, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = j0; j <= j1; j++) { A[r[i]][j] = X.get(i, j - j0); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
[ "public", "void", "setMatrix", "(", "int", "[", "]", "r", ",", "int", "j0", ",", "int", "j1", ",", "Matrix", "X", ")", "{", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "r", ".", "length", ";", "i", "++", ")", "{", "for", ...
Set a submatrix. @param r Array of row indices. @param j0 Initial column index @param j1 Final column index @param X A(r(:),j0:j1) @throws ArrayIndexOutOfBoundsException Submatrix indices
[ "Set", "a", "submatrix", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L555-L571
alkacon/opencms-core
src/org/opencms/widgets/CmsHtmlWidgetOption.java
CmsHtmlWidgetOption.getButtonBar
public String getButtonBar(Map<String, String> buttonNamesLookUp, String itemSeparator) { return getButtonBar(buttonNamesLookUp, itemSeparator, true); }
java
public String getButtonBar(Map<String, String> buttonNamesLookUp, String itemSeparator) { return getButtonBar(buttonNamesLookUp, itemSeparator, true); }
[ "public", "String", "getButtonBar", "(", "Map", "<", "String", ",", "String", ">", "buttonNamesLookUp", ",", "String", "itemSeparator", ")", "{", "return", "getButtonBar", "(", "buttonNamesLookUp", ",", "itemSeparator", ",", "true", ")", ";", "}" ]
Returns the specific editor button bar string generated from the configuration.<p> The lookup map can contain translations for the button names, the separator and the block names. The button bar will be automatically surrounded by block start and end items if they are not explicitly defined.<p> It may be necessary to write your own method to generate the button bar string for a specific editor widget. In this case, use the method {@link #getButtonBarShownItems()} to get the calculated list of shown button bar items.<p> @param buttonNamesLookUp the lookup map with translations for the button names, the separator and the block names or <code>null</code> @param itemSeparator the separator for the tool bar items @return the button bar string generated from the configuration
[ "Returns", "the", "specific", "editor", "button", "bar", "string", "generated", "from", "the", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsHtmlWidgetOption.java#L539-L542
ronmamo/reflections
src/main/java/org/reflections/vfs/Vfs.java
Vfs.findFiles
public static Iterable<File> findFiles(final Collection<URL> inUrls, final String packagePrefix, final Predicate<String> nameFilter) { Predicate<File> fileNamePredicate = new Predicate<File>() { public boolean apply(File file) { String path = file.getRelativePath(); if (path.startsWith(packagePrefix)) { String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length()); return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1)); } else { return false; } } }; return findFiles(inUrls, fileNamePredicate); }
java
public static Iterable<File> findFiles(final Collection<URL> inUrls, final String packagePrefix, final Predicate<String> nameFilter) { Predicate<File> fileNamePredicate = new Predicate<File>() { public boolean apply(File file) { String path = file.getRelativePath(); if (path.startsWith(packagePrefix)) { String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length()); return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1)); } else { return false; } } }; return findFiles(inUrls, fileNamePredicate); }
[ "public", "static", "Iterable", "<", "File", ">", "findFiles", "(", "final", "Collection", "<", "URL", ">", "inUrls", ",", "final", "String", "packagePrefix", ",", "final", "Predicate", "<", "String", ">", "nameFilter", ")", "{", "Predicate", "<", "File", ...
return an iterable of all {@link org.reflections.vfs.Vfs.File} in given urls, starting with given packagePrefix and matching nameFilter
[ "return", "an", "iterable", "of", "all", "{" ]
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/vfs/Vfs.java#L123-L137
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
PageFlowRequestProcessor.processNoCache
protected void processNoCache( HttpServletRequest request, HttpServletResponse response ) { // // Set the no-cache headers if: // 1) the module is configured for it, or // 2) netui-config.xml has an "always" value for <pageflow-config><prevent-cache>, or // 3) netui-config.xml has an "inDevMode" value for <pageflow-config><prevent-cache>, and we're not in // production mode. // boolean noCache = moduleConfig.getControllerConfig().getNocache(); if ( ! noCache ) { PageFlowConfig pfConfig = ConfigUtil.getConfig().getPageFlowConfig(); if ( pfConfig != null ) { PreventCache preventCache = pfConfig.getPreventCache(); if ( preventCache != null ) { switch ( preventCache.getValue() ) { case PreventCache.INT_ALWAYS: noCache = true; break; case PreventCache.INT_IN_DEV_MODE: noCache = ! _servletContainerAdapter.isInProductionMode(); break; } } } } if ( noCache ) { // // The call to PageFlowPageFilter.preventCache() will cause caching to be prevented // even when we end up forwarding to a page. Normally, no-cache headers are lost // when a server forward occurs. // ServletUtils.preventCache( response ); PageFlowUtils.setPreventCache( request ); } }
java
protected void processNoCache( HttpServletRequest request, HttpServletResponse response ) { // // Set the no-cache headers if: // 1) the module is configured for it, or // 2) netui-config.xml has an "always" value for <pageflow-config><prevent-cache>, or // 3) netui-config.xml has an "inDevMode" value for <pageflow-config><prevent-cache>, and we're not in // production mode. // boolean noCache = moduleConfig.getControllerConfig().getNocache(); if ( ! noCache ) { PageFlowConfig pfConfig = ConfigUtil.getConfig().getPageFlowConfig(); if ( pfConfig != null ) { PreventCache preventCache = pfConfig.getPreventCache(); if ( preventCache != null ) { switch ( preventCache.getValue() ) { case PreventCache.INT_ALWAYS: noCache = true; break; case PreventCache.INT_IN_DEV_MODE: noCache = ! _servletContainerAdapter.isInProductionMode(); break; } } } } if ( noCache ) { // // The call to PageFlowPageFilter.preventCache() will cause caching to be prevented // even when we end up forwarding to a page. Normally, no-cache headers are lost // when a server forward occurs. // ServletUtils.preventCache( response ); PageFlowUtils.setPreventCache( request ); } }
[ "protected", "void", "processNoCache", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "//", "// Set the no-cache headers if:", "// 1) the module is configured for it, or", "// 2) netui-config.xml has an \"always\" value for <pageflow-config>...
Set the no-cache headers. This overrides the base Struts behavior to prevent caching even for the pages.
[ "Set", "the", "no", "-", "cache", "headers", ".", "This", "overrides", "the", "base", "Struts", "behavior", "to", "prevent", "caching", "even", "for", "the", "pages", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L1976-L2020
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java
DefaultEntityManager.invokeCallbackMethod
private static void invokeCallbackMethod(Method callbackMethod, Object listener, Object entity) { try { callbackMethod.invoke(listener, entity); } catch (Exception exp) { String message = String.format("Failed to execute callback method %s of class %s", callbackMethod.getName(), callbackMethod.getDeclaringClass().getName()); throw new EntityManagerException(message, exp); } }
java
private static void invokeCallbackMethod(Method callbackMethod, Object listener, Object entity) { try { callbackMethod.invoke(listener, entity); } catch (Exception exp) { String message = String.format("Failed to execute callback method %s of class %s", callbackMethod.getName(), callbackMethod.getDeclaringClass().getName()); throw new EntityManagerException(message, exp); } }
[ "private", "static", "void", "invokeCallbackMethod", "(", "Method", "callbackMethod", ",", "Object", "listener", ",", "Object", "entity", ")", "{", "try", "{", "callbackMethod", ".", "invoke", "(", "listener", ",", "entity", ")", ";", "}", "catch", "(", "Exc...
Invokes the given callback method on the given target object. @param callbackMethod the callback method @param listener the listener object on which to invoke the method @param entity the entity for which the callback is being invoked.
[ "Invokes", "the", "given", "callback", "method", "on", "the", "given", "target", "object", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L518-L527
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java
RemoteLockMapImpl.getWriter
public LockEntry getWriter(Object obj) { PersistenceBroker broker = getBroker(); Identity oid = new Identity(obj, broker); LockEntry result = null; try { result = getWriterRemote(oid); } catch (Throwable e) { log.error(e); } return result; }
java
public LockEntry getWriter(Object obj) { PersistenceBroker broker = getBroker(); Identity oid = new Identity(obj, broker); LockEntry result = null; try { result = getWriterRemote(oid); } catch (Throwable e) { log.error(e); } return result; }
[ "public", "LockEntry", "getWriter", "(", "Object", "obj", ")", "{", "PersistenceBroker", "broker", "=", "getBroker", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "broker", ")", ";", "LockEntry", "result", "=", "null", ";", "...
returns the LockEntry for the Writer of object obj. If now writer exists, null is returned.
[ "returns", "the", "LockEntry", "for", "the", "Writer", "of", "object", "obj", ".", "If", "now", "writer", "exists", "null", "is", "returned", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java#L64-L79
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java
StringUtilities.indexOf
public static int indexOf(final String input, final char delim, final int fromIndex) { if (input == null) return -1; int index = input.indexOf(delim, fromIndex); if (index != 0) { while (index != -1 && index != (input.length() - 1)) { if (input.charAt(index - 1) != '\\') break; index = input.indexOf(delim, index + 1); } } return index; }
java
public static int indexOf(final String input, final char delim, final int fromIndex) { if (input == null) return -1; int index = input.indexOf(delim, fromIndex); if (index != 0) { while (index != -1 && index != (input.length() - 1)) { if (input.charAt(index - 1) != '\\') break; index = input.indexOf(delim, index + 1); } } return index; }
[ "public", "static", "int", "indexOf", "(", "final", "String", "input", ",", "final", "char", "delim", ",", "final", "int", "fromIndex", ")", "{", "if", "(", "input", "==", "null", ")", "return", "-", "1", ";", "int", "index", "=", "input", ".", "inde...
Gets the first index of a character after fromIndex. Ignoring characters that have been escaped @param input The string to be searched @param delim The character to be found @param fromIndex Start searching from this index @return The index of the found character or -1 if the character wasn't found
[ "Gets", "the", "first", "index", "of", "a", "character", "after", "fromIndex", ".", "Ignoring", "characters", "that", "have", "been", "escaped" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java#L229-L239
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java
StringFunctions.rtrim
public static Expression rtrim(String expression, String characters) { return rtrim(x(expression), characters); }
java
public static Expression rtrim(String expression, String characters) { return rtrim(x(expression), characters); }
[ "public", "static", "Expression", "rtrim", "(", "String", "expression", ",", "String", "characters", ")", "{", "return", "rtrim", "(", "x", "(", "expression", ")", ",", "characters", ")", ";", "}" ]
Returned expression results in the string with all trailing chars removed (any char in the characters string).
[ "Returned", "expression", "results", "in", "the", "string", "with", "all", "trailing", "chars", "removed", "(", "any", "char", "in", "the", "characters", "string", ")", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java#L224-L226
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Consumers.java
Consumers.dict
public static <M extends Map<K, V>, K, V> M dict(Iterator<Pair<K, V>> iterator, Supplier<M> supplier) { final Function<Iterator<Pair<K, V>>, M> consumer = new ConsumeIntoMap<>(supplier); return consumer.apply(iterator); }
java
public static <M extends Map<K, V>, K, V> M dict(Iterator<Pair<K, V>> iterator, Supplier<M> supplier) { final Function<Iterator<Pair<K, V>>, M> consumer = new ConsumeIntoMap<>(supplier); return consumer.apply(iterator); }
[ "public", "static", "<", "M", "extends", "Map", "<", "K", ",", "V", ">", ",", "K", ",", "V", ">", "M", "dict", "(", "Iterator", "<", "Pair", "<", "K", ",", "V", ">", ">", "iterator", ",", "Supplier", "<", "M", ">", "supplier", ")", "{", "fina...
Yields all elements of the iterator (in a map created by the supplier). @param <M> the returned map type @param <K> the map key type @param <V> the map value type @param iterator the iterator that will be consumed @param supplier the factory used to get the returned map @return a map filled with iterator values
[ "Yields", "all", "elements", "of", "the", "iterator", "(", "in", "a", "map", "created", "by", "the", "supplier", ")", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L228-L231
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java
AssetsInner.createOrUpdate
public AssetInner createOrUpdate(String resourceGroupName, String accountName, String assetName, AssetInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, assetName, parameters).toBlocking().single().body(); }
java
public AssetInner createOrUpdate(String resourceGroupName, String accountName, String assetName, AssetInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, assetName, parameters).toBlocking().single().body(); }
[ "public", "AssetInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ",", "AssetInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountNa...
Create or update an Asset. Creates or updates an Asset in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AssetInner object if successful.
[ "Create", "or", "update", "an", "Asset", ".", "Creates", "or", "updates", "an", "Asset", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java#L479-L481
protostuff/protostuff
protostuff-runtime/src/main/java/io/protostuff/runtime/DefaultIdStrategy.java
DefaultIdStrategy.registerDelegate
public <T> boolean registerDelegate(String className, Delegate<T> delegate) { return null == delegateMapping.putIfAbsent(className, new HasDelegate<T>(delegate, this)); }
java
public <T> boolean registerDelegate(String className, Delegate<T> delegate) { return null == delegateMapping.putIfAbsent(className, new HasDelegate<T>(delegate, this)); }
[ "public", "<", "T", ">", "boolean", "registerDelegate", "(", "String", "className", ",", "Delegate", "<", "T", ">", "delegate", ")", "{", "return", "null", "==", "delegateMapping", ".", "putIfAbsent", "(", "className", ",", "new", "HasDelegate", "<", "T", ...
Registers a delegate by specifying the class name. Returns true if registration is successful.
[ "Registers", "a", "delegate", "by", "specifying", "the", "class", "name", ".", "Returns", "true", "if", "registration", "is", "successful", "." ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-runtime/src/main/java/io/protostuff/runtime/DefaultIdStrategy.java#L110-L113
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java
ManagedInstanceKeysInner.listByInstanceWithServiceResponseAsync
public Observable<ServiceResponse<Page<ManagedInstanceKeyInner>>> listByInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String filter) { return listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter) .concatMap(new Func1<ServiceResponse<Page<ManagedInstanceKeyInner>>, Observable<ServiceResponse<Page<ManagedInstanceKeyInner>>>>() { @Override public Observable<ServiceResponse<Page<ManagedInstanceKeyInner>>> call(ServiceResponse<Page<ManagedInstanceKeyInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ManagedInstanceKeyInner>>> listByInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String filter) { return listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter) .concatMap(new Func1<ServiceResponse<Page<ManagedInstanceKeyInner>>, Observable<ServiceResponse<Page<ManagedInstanceKeyInner>>>>() { @Override public Observable<ServiceResponse<Page<ManagedInstanceKeyInner>>> call(ServiceResponse<Page<ManagedInstanceKeyInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ManagedInstanceKeyInner", ">", ">", ">", "listByInstanceWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "managedInstanceName", ",", "final", "String", "fil...
Gets a list of managed instance keys. @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 managedInstanceName The name of the managed instance. @param filter An OData filter expression that filters elements in the collection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ManagedInstanceKeyInner&gt; object
[ "Gets", "a", "list", "of", "managed", "instance", "keys", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceKeysInner.java#L282-L294
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.pauseRecording
public ApiSuccessResponse pauseRecording(String id, PauseRecordingBody pauseRecordingBody) throws ApiException { ApiResponse<ApiSuccessResponse> resp = pauseRecordingWithHttpInfo(id, pauseRecordingBody); return resp.getData(); }
java
public ApiSuccessResponse pauseRecording(String id, PauseRecordingBody pauseRecordingBody) throws ApiException { ApiResponse<ApiSuccessResponse> resp = pauseRecordingWithHttpInfo(id, pauseRecordingBody); return resp.getData(); }
[ "public", "ApiSuccessResponse", "pauseRecording", "(", "String", "id", ",", "PauseRecordingBody", "pauseRecordingBody", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "pauseRecordingWithHttpInfo", "(", "id", ",", "pauseRe...
Pause recording on a call Pause recording on the specified call. @param id The connection ID of the call. (required) @param pauseRecordingBody Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Pause", "recording", "on", "a", "call", "Pause", "recording", "on", "the", "specified", "call", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L2584-L2587
zaproxy/zaproxy
src/org/zaproxy/zap/spider/filters/HttpPrefixFetchFilter.java
HttpPrefixFetchFilter.startsWith
private static boolean startsWith(char[] array, char[] prefix) { if (prefix == null) { return true; } if (array == null) { return false; } int length = prefix.length; if (array.length < length) { return false; } for (int i = 0; i < length; i++) { if (prefix[i] != array[i]) { return false; } } return true; }
java
private static boolean startsWith(char[] array, char[] prefix) { if (prefix == null) { return true; } if (array == null) { return false; } int length = prefix.length; if (array.length < length) { return false; } for (int i = 0; i < length; i++) { if (prefix[i] != array[i]) { return false; } } return true; }
[ "private", "static", "boolean", "startsWith", "(", "char", "[", "]", "array", ",", "char", "[", "]", "prefix", ")", "{", "if", "(", "prefix", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "array", "==", "null", ")", "{", "return", ...
Tells whether or not the given {@code array} starts with the given {@code prefix}. <p> The {@code prefix} might be {@code null} in which case it's considered that the {@code array} starts with the prefix. @param array the array that will be tested if starts with the prefix, might be {@code null} @param prefix the array used as prefix, might be {@code null} @return {@code true} if the {@code array} starts with the {@code prefix}, {@code false} otherwise
[ "Tells", "whether", "or", "not", "the", "given", "{", "@code", "array", "}", "starts", "with", "the", "given", "{", "@code", "prefix", "}", ".", "<p", ">", "The", "{", "@code", "prefix", "}", "might", "be", "{", "@code", "null", "}", "in", "which", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/filters/HttpPrefixFetchFilter.java#L298-L319
aehrc/snorocket
snorocket-core/src/main/java/au/csiro/snorocket/core/NormalisedOntology.java
NormalisedOntology.isChild
private boolean isChild(Node cn, Node cn2) { if (cn == cn2) return false; Queue<Node> toProcess = new LinkedList<Node>(); toProcess.addAll(cn.getParents()); while (!toProcess.isEmpty()) { Node tcn = toProcess.poll(); if (tcn.equals(cn2)) return true; Set<Node> parents = tcn.getParents(); if (parents != null && !parents.isEmpty()) toProcess.addAll(parents); } return false; }
java
private boolean isChild(Node cn, Node cn2) { if (cn == cn2) return false; Queue<Node> toProcess = new LinkedList<Node>(); toProcess.addAll(cn.getParents()); while (!toProcess.isEmpty()) { Node tcn = toProcess.poll(); if (tcn.equals(cn2)) return true; Set<Node> parents = tcn.getParents(); if (parents != null && !parents.isEmpty()) toProcess.addAll(parents); } return false; }
[ "private", "boolean", "isChild", "(", "Node", "cn", ",", "Node", "cn2", ")", "{", "if", "(", "cn", "==", "cn2", ")", "return", "false", ";", "Queue", "<", "Node", ">", "toProcess", "=", "new", "LinkedList", "<", "Node", ">", "(", ")", ";", "toProce...
Indicates if cn is a child of cn2. @param cn @param cn2 @return
[ "Indicates", "if", "cn", "is", "a", "child", "of", "cn2", "." ]
train
https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/NormalisedOntology.java#L2339-L2356
apache/incubator-druid
core/src/main/java/org/apache/druid/java/util/metrics/Monitors.java
Monitors.createCompoundJvmMonitor
public static Monitor createCompoundJvmMonitor(Map<String, String[]> dimensions) { return createCompoundJvmMonitor(dimensions, FeedDefiningMonitor.DEFAULT_METRICS_FEED); }
java
public static Monitor createCompoundJvmMonitor(Map<String, String[]> dimensions) { return createCompoundJvmMonitor(dimensions, FeedDefiningMonitor.DEFAULT_METRICS_FEED); }
[ "public", "static", "Monitor", "createCompoundJvmMonitor", "(", "Map", "<", "String", ",", "String", "[", "]", ">", "dimensions", ")", "{", "return", "createCompoundJvmMonitor", "(", "dimensions", ",", "FeedDefiningMonitor", ".", "DEFAULT_METRICS_FEED", ")", ";", ...
Creates a JVM monitor, configured with the given dimensions, that gathers all currently available JVM-wide monitors. Emitted events have default feed {@link FeedDefiningMonitor#DEFAULT_METRICS_FEED} See: {@link Monitors#createCompoundJvmMonitor(Map, String)} @param dimensions common dimensions to configure the JVM monitor with @return a universally useful JVM-wide monitor
[ "Creates", "a", "JVM", "monitor", "configured", "with", "the", "given", "dimensions", "that", "gathers", "all", "currently", "available", "JVM", "-", "wide", "monitors", ".", "Emitted", "events", "have", "default", "feed", "{", "@link", "FeedDefiningMonitor#DEFAUL...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/metrics/Monitors.java#L36-L39
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/route/ShardingAlgorithmFactory.java
ShardingAlgorithmFactory.newInstance
@SneakyThrows @SuppressWarnings("unchecked") public static <T extends ShardingAlgorithm> T newInstance(final String shardingAlgorithmClassName, final Class<T> superShardingAlgorithmClass) { Class<?> result = Class.forName(shardingAlgorithmClassName); if (!superShardingAlgorithmClass.isAssignableFrom(result)) { throw new ShardingException("Class %s should be implement %s", shardingAlgorithmClassName, superShardingAlgorithmClass.getName()); } return (T) result.newInstance(); }
java
@SneakyThrows @SuppressWarnings("unchecked") public static <T extends ShardingAlgorithm> T newInstance(final String shardingAlgorithmClassName, final Class<T> superShardingAlgorithmClass) { Class<?> result = Class.forName(shardingAlgorithmClassName); if (!superShardingAlgorithmClass.isAssignableFrom(result)) { throw new ShardingException("Class %s should be implement %s", shardingAlgorithmClassName, superShardingAlgorithmClass.getName()); } return (T) result.newInstance(); }
[ "@", "SneakyThrows", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "ShardingAlgorithm", ">", "T", "newInstance", "(", "final", "String", "shardingAlgorithmClassName", ",", "final", "Class", "<", "T", ">", "superShardi...
Create sharding algorithm. @param shardingAlgorithmClassName sharding algorithm class name @param superShardingAlgorithmClass sharding algorithm super class @param <T> class generic type @return sharding algorithm instance
[ "Create", "sharding", "algorithm", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/route/ShardingAlgorithmFactory.java#L42-L50
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/PropertiesField.java
PropertiesField.setProperty
public void setProperty(String strProperty, String strValue) { this.setProperty(strProperty, strValue, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); }
java
public void setProperty(String strProperty, String strValue) { this.setProperty(strProperty, strValue, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); }
[ "public", "void", "setProperty", "(", "String", "strProperty", ",", "String", "strValue", ")", "{", "this", ".", "setProperty", "(", "strProperty", ",", "strValue", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "}" ]
Set this property in the user's property area. @param strProperty The property key. @param strValue The property value.
[ "Set", "this", "property", "in", "the", "user", "s", "property", "area", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L128-L131
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java
Attributes2Impl.isSpecified
public boolean isSpecified (String uri, String localName) { int index = getIndex (uri, localName); if (index < 0) throw new IllegalArgumentException ( "No such attribute: local=" + localName + ", namespace=" + uri); return specified [index]; }
java
public boolean isSpecified (String uri, String localName) { int index = getIndex (uri, localName); if (index < 0) throw new IllegalArgumentException ( "No such attribute: local=" + localName + ", namespace=" + uri); return specified [index]; }
[ "public", "boolean", "isSpecified", "(", "String", "uri", ",", "String", "localName", ")", "{", "int", "index", "=", "getIndex", "(", "uri", ",", "localName", ")", ";", "if", "(", "index", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "...
Returns the current value of an attribute's "specified" flag. @param uri The Namespace URI, or the empty string if the name has no Namespace URI. @param localName The attribute's local name. @return current flag value @exception java.lang.IllegalArgumentException When the supplied names do not identify an attribute.
[ "Returns", "the", "current", "value", "of", "an", "attribute", "s", "specified", "flag", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java#L149-L158
lamydev/Android-Notification
core/src/zemin/notification/NotificationEntry.java
NotificationEntry.setContentAction
public void setContentAction(Action.OnActionListener listener, Bundle extra) { setContentAction(listener, null, null, null, extra); }
java
public void setContentAction(Action.OnActionListener listener, Bundle extra) { setContentAction(listener, null, null, null, extra); }
[ "public", "void", "setContentAction", "(", "Action", ".", "OnActionListener", "listener", ",", "Bundle", "extra", ")", "{", "setContentAction", "(", "listener", ",", "null", ",", "null", ",", "null", ",", "extra", ")", ";", "}" ]
Set a action to be fired when the notification content gets clicked. @param listener @param extra
[ "Set", "a", "action", "to", "be", "fired", "when", "the", "notification", "content", "gets", "clicked", "." ]
train
https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationEntry.java#L408-L410
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/client/ProviderInfo.java
ProviderInfo.setStaticAttrs
public ProviderInfo setStaticAttrs(Map<String, String> staticAttrs) { this.staticAttrs.clear(); this.staticAttrs.putAll(staticAttrs); return this; }
java
public ProviderInfo setStaticAttrs(Map<String, String> staticAttrs) { this.staticAttrs.clear(); this.staticAttrs.putAll(staticAttrs); return this; }
[ "public", "ProviderInfo", "setStaticAttrs", "(", "Map", "<", "String", ",", "String", ">", "staticAttrs", ")", "{", "this", ".", "staticAttrs", ".", "clear", "(", ")", ";", "this", ".", "staticAttrs", ".", "putAll", "(", "staticAttrs", ")", ";", "return", ...
Sets static attribute. @param staticAttrs the static attribute @return the static attribute
[ "Sets", "static", "attribute", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/client/ProviderInfo.java#L412-L416
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_offerTask_GET
public ArrayList<Long> billingAccount_offerTask_GET(String billingAccount, OvhOfferTaskActionEnum action, OvhTaskStatusEnum status, OvhOfferTaskTypeEnum type) throws IOException { String qPath = "/telephony/{billingAccount}/offerTask"; StringBuilder sb = path(qPath, billingAccount); query(sb, "action", action); query(sb, "status", status); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> billingAccount_offerTask_GET(String billingAccount, OvhOfferTaskActionEnum action, OvhTaskStatusEnum status, OvhOfferTaskTypeEnum type) throws IOException { String qPath = "/telephony/{billingAccount}/offerTask"; StringBuilder sb = path(qPath, billingAccount); query(sb, "action", action); query(sb, "status", status); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "billingAccount_offerTask_GET", "(", "String", "billingAccount", ",", "OvhOfferTaskActionEnum", "action", ",", "OvhTaskStatusEnum", "status", ",", "OvhOfferTaskTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPat...
Operations on a telephony service's offer REST: GET /telephony/{billingAccount}/offerTask @param action [required] Filter the value of action property (=) @param type [required] Filter the value of type property (=) @param status [required] Filter the value of status property (=) @param billingAccount [required] The name of your billingAccount
[ "Operations", "on", "a", "telephony", "service", "s", "offer" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8210-L8218
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.createOrUpdateBillingInfo
public BillingInfo createOrUpdateBillingInfo(final String accountCode, final BillingInfo billingInfo) { return doPUT(Account.ACCOUNT_RESOURCE + "/" + accountCode + BillingInfo.BILLING_INFO_RESOURCE, billingInfo, BillingInfo.class); }
java
public BillingInfo createOrUpdateBillingInfo(final String accountCode, final BillingInfo billingInfo) { return doPUT(Account.ACCOUNT_RESOURCE + "/" + accountCode + BillingInfo.BILLING_INFO_RESOURCE, billingInfo, BillingInfo.class); }
[ "public", "BillingInfo", "createOrUpdateBillingInfo", "(", "final", "String", "accountCode", ",", "final", "BillingInfo", "billingInfo", ")", "{", "return", "doPUT", "(", "Account", ".", "ACCOUNT_RESOURCE", "+", "\"/\"", "+", "accountCode", "+", "BillingInfo", ".", ...
Update an account's billing info <p> When new or updated credit card information is updated, the billing information is only saved if the credit card is valid. If the account has a past due invoice, the outstanding balance will be collected to validate the billing information. <p> If the account does not exist before the API request, the account will be created if the billing information is valid. <p> Please note: this API end-point may be used to import billing information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated billing information. @param accountCode recurly account id @param billingInfo billing info object to create or update @return the newly created or update billing info object on success, null otherwise
[ "Update", "an", "account", "s", "billing", "info", "<p", ">", "When", "new", "or", "updated", "credit", "card", "information", "is", "updated", "the", "billing", "information", "is", "only", "saved", "if", "the", "credit", "card", "is", "valid", ".", "If",...
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L779-L782
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
TransformerImpl.transformToRTF
public int transformToRTF(ElemTemplateElement templateParent) throws TransformerException { // Retrieve a DTM to contain the RTF. At this writing, this may be a // multi-document DTM (SAX2RTFDTM). DTM dtmFrag = m_xcontext.getRTFDTM(); return transformToRTF(templateParent,dtmFrag); }
java
public int transformToRTF(ElemTemplateElement templateParent) throws TransformerException { // Retrieve a DTM to contain the RTF. At this writing, this may be a // multi-document DTM (SAX2RTFDTM). DTM dtmFrag = m_xcontext.getRTFDTM(); return transformToRTF(templateParent,dtmFrag); }
[ "public", "int", "transformToRTF", "(", "ElemTemplateElement", "templateParent", ")", "throws", "TransformerException", "{", "// Retrieve a DTM to contain the RTF. At this writing, this may be a", "// multi-document DTM (SAX2RTFDTM).", "DTM", "dtmFrag", "=", "m_xcontext", ".", "get...
Given a stylesheet element, create a result tree fragment from it's contents. The fragment will be built within the shared RTF DTM system used as a variable stack. @param templateParent The template element that holds the fragment. @return the NodeHandle for the root node of the resulting RTF. @throws TransformerException @xsl.usage advanced
[ "Given", "a", "stylesheet", "element", "create", "a", "result", "tree", "fragment", "from", "it", "s", "contents", ".", "The", "fragment", "will", "be", "built", "within", "the", "shared", "RTF", "DTM", "system", "used", "as", "a", "variable", "stack", "."...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java#L1748-L1755
UrielCh/ovh-java-sdk
ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java
ApiOvhMsServices.serviceName_account_userPrincipalName_exchange_configure_POST
public OvhExchangeTask serviceName_account_userPrincipalName_exchange_configure_POST(String serviceName, String userPrincipalName) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/exchange/configure"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhExchangeTask.class); }
java
public OvhExchangeTask serviceName_account_userPrincipalName_exchange_configure_POST(String serviceName, String userPrincipalName) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/exchange/configure"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhExchangeTask.class); }
[ "public", "OvhExchangeTask", "serviceName_account_userPrincipalName_exchange_configure_POST", "(", "String", "serviceName", ",", "String", "userPrincipalName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/msServices/{serviceName}/account/{userPrincipalName}/exchange...
Configure mailbox to be operational REST: POST /msServices/{serviceName}/account/{userPrincipalName}/exchange/configure @param serviceName [required] The internal name of your Active Directory organization @param userPrincipalName [required] User Principal Name API beta
[ "Configure", "mailbox", "to", "be", "operational" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L418-L423
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/CmsCoreProvider.java
CmsCoreProvider.getAdjustedSiteRoot
public String getAdjustedSiteRoot(String siteRoot, String resourcename) { if (resourcename.startsWith(VFS_PATH_SYSTEM)) { return ""; } else { return siteRoot; } }
java
public String getAdjustedSiteRoot(String siteRoot, String resourcename) { if (resourcename.startsWith(VFS_PATH_SYSTEM)) { return ""; } else { return siteRoot; } }
[ "public", "String", "getAdjustedSiteRoot", "(", "String", "siteRoot", ",", "String", "resourcename", ")", "{", "if", "(", "resourcename", ".", "startsWith", "(", "VFS_PATH_SYSTEM", ")", ")", "{", "return", "\"\"", ";", "}", "else", "{", "return", "siteRoot", ...
Returns the adjusted site root for a resource using the provided site root as a base.<p> Usually, this would be the site root for the current site. However, if a resource from the <code>/system/</code> folder is requested, this will be the empty String.<p> @param siteRoot the site root of the current site @param resourcename the resource name to get the adjusted site root for @return the adjusted site root for the resource
[ "Returns", "the", "adjusted", "site", "root", "for", "a", "resource", "using", "the", "provided", "site", "root", "as", "a", "base", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/CmsCoreProvider.java#L254-L261
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java
VirtualMachineScaleSetRollingUpgradesInner.cancelAsync
public Observable<OperationStatusResponseInner> cancelAsync(String resourceGroupName, String vmScaleSetName) { return cancelWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> cancelAsync(String resourceGroupName, String vmScaleSetName) { return cancelWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "cancelAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "cancelWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", ...
Cancels the current virtual machine scale set rolling upgrade. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Cancels", "the", "current", "virtual", "machine", "scale", "set", "rolling", "upgrade", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java#L112-L119
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java
JRebirth.runIntoJITSync
public static void runIntoJITSync(final String runnableName, final Runnable runnable, final long... timeout) { runIntoJITSync(new JrbReferenceRunnable(runnableName, runnable), timeout); }
java
public static void runIntoJITSync(final String runnableName, final Runnable runnable, final long... timeout) { runIntoJITSync(new JrbReferenceRunnable(runnableName, runnable), timeout); }
[ "public", "static", "void", "runIntoJITSync", "(", "final", "String", "runnableName", ",", "final", "Runnable", "runnable", ",", "final", "long", "...", "timeout", ")", "{", "runIntoJITSync", "(", "new", "JrbReferenceRunnable", "(", "runnableName", ",", "runnable"...
Run the task into the JRebirth Internal Thread [JIT] <b>Synchronously</b>. @param runnableName the name of the runnable for logging purpose @param runnable the task to run @param timeout the optional timeout value after which the thread will be released (default is 1000 ms)
[ "Run", "the", "task", "into", "the", "JRebirth", "Internal", "Thread", "[", "JIT", "]", "<b", ">", "Synchronously<", "/", "b", ">", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java#L283-L285
jenkinsci/jenkins
core/src/main/java/jenkins/install/SetupWizard.java
SetupWizard.getPlatformPluginUpdates
@CheckForNull public JSONArray getPlatformPluginUpdates() { final VersionNumber version = getCurrentLevel(); if (version == null) { return null; } return getPlatformPluginsForUpdate(version, Jenkins.getVersion()); }
java
@CheckForNull public JSONArray getPlatformPluginUpdates() { final VersionNumber version = getCurrentLevel(); if (version == null) { return null; } return getPlatformPluginsForUpdate(version, Jenkins.getVersion()); }
[ "@", "CheckForNull", "public", "JSONArray", "getPlatformPluginUpdates", "(", ")", "{", "final", "VersionNumber", "version", "=", "getCurrentLevel", "(", ")", ";", "if", "(", "version", "==", "null", ")", "{", "return", "null", ";", "}", "return", "getPlatformP...
Provides the list of platform plugin updates from the last time the upgrade was run. @return {@code null} if the version range cannot be retrieved.
[ "Provides", "the", "list", "of", "platform", "plugin", "updates", "from", "the", "last", "time", "the", "upgrade", "was", "run", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/SetupWizard.java#L424-L431
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Objects.java
Objects.requireNonNull
public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) { if (obj == null) throw new NullPointerException(messageSupplier.get()); return obj; }
java
public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) { if (obj == null) throw new NullPointerException(messageSupplier.get()); return obj; }
[ "public", "static", "<", "T", ">", "T", "requireNonNull", "(", "T", "obj", ",", "Supplier", "<", "String", ">", "messageSupplier", ")", "{", "if", "(", "obj", "==", "null", ")", "throw", "new", "NullPointerException", "(", "messageSupplier", ".", "get", ...
Checks that the specified object reference is not {@code null} and throws a customized {@link NullPointerException} if it is. <p>Unlike the method {@link #requireNonNull(Object, String)}, this method allows creation of the message to be deferred until after the null check is made. While this may confer a performance advantage in the non-null case, when deciding to call this method care should be taken that the costs of creating the message supplier are less than the cost of just creating the string message directly. @param obj the object reference to check for nullity @param messageSupplier supplier of the detail message to be used in the event that a {@code NullPointerException} is thrown @param <T> the type of the reference @return {@code obj} if not {@code null} @throws NullPointerException if {@code obj} is {@code null} @since 1.8
[ "Checks", "that", "the", "specified", "object", "reference", "is", "not", "{", "@code", "null", "}", "and", "throws", "a", "customized", "{", "@link", "NullPointerException", "}", "if", "it", "is", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Objects.java#L288-L292
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.getProxyClassName
private static String getProxyClassName(String name, Map<String, String> mappedUniName, boolean isUniName) { Set<String> emptyPkgs = Collections.emptySet(); return getProxyClassName(name, emptyPkgs, mappedUniName, isUniName); }
java
private static String getProxyClassName(String name, Map<String, String> mappedUniName, boolean isUniName) { Set<String> emptyPkgs = Collections.emptySet(); return getProxyClassName(name, emptyPkgs, mappedUniName, isUniName); }
[ "private", "static", "String", "getProxyClassName", "(", "String", "name", ",", "Map", "<", "String", ",", "String", ">", "mappedUniName", ",", "boolean", "isUniName", ")", "{", "Set", "<", "String", ">", "emptyPkgs", "=", "Collections", ".", "emptySet", "("...
Gets the proxy class name. @param name the name @param mappedUniName the mapped uni name @param isUniName the is uni name @return the proxy class name
[ "Gets", "the", "proxy", "class", "name", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1490-L1493
scalecube/socketio
src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java
ResourceHandler.isNotModified
private boolean isNotModified(HttpRequest request, long lastModified) throws ParseException { String ifModifiedSince = request.headers().get(HttpHeaderNames.IF_MODIFIED_SINCE); if (ifModifiedSince != null && !ifModifiedSince.equals("")) { SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince); // Only compare up to the second because the datetime format we send to the client does // not have milliseconds long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = lastModified / 1000; return ifModifiedSinceDateSeconds == fileLastModifiedSeconds; } return false; }
java
private boolean isNotModified(HttpRequest request, long lastModified) throws ParseException { String ifModifiedSince = request.headers().get(HttpHeaderNames.IF_MODIFIED_SINCE); if (ifModifiedSince != null && !ifModifiedSince.equals("")) { SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince); // Only compare up to the second because the datetime format we send to the client does // not have milliseconds long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = lastModified / 1000; return ifModifiedSinceDateSeconds == fileLastModifiedSeconds; } return false; }
[ "private", "boolean", "isNotModified", "(", "HttpRequest", "request", ",", "long", "lastModified", ")", "throws", "ParseException", "{", "String", "ifModifiedSince", "=", "request", ".", "headers", "(", ")", ".", "get", "(", "HttpHeaderNames", ".", "IF_MODIFIED_SI...
/* Checks if the content has been modified sicne the date provided by the IF_MODIFIED_SINCE http header
[ "/", "*", "Checks", "if", "the", "content", "has", "been", "modified", "sicne", "the", "date", "provided", "by", "the", "IF_MODIFIED_SINCE", "http", "header" ]
train
https://github.com/scalecube/socketio/blob/bad28fe7a132320750173e7cb71ad6d3688fb626/src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java#L121-L134
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/AltsChannelCrypter.java
AltsChannelCrypter.incrementCounter
static void incrementCounter(byte[] counter, byte[] oldCounter) throws GeneralSecurityException { System.arraycopy(counter, 0, oldCounter, 0, counter.length); int i = 0; for (; i < COUNTER_OVERFLOW_LENGTH; i++) { counter[i]++; if (counter[i] != (byte) 0x00) { break; } } if (i == COUNTER_OVERFLOW_LENGTH) { // Restore old counter value to ensure that encrypt and decrypt keep failing. System.arraycopy(oldCounter, 0, counter, 0, counter.length); throw new GeneralSecurityException("Counter has overflowed."); } }
java
static void incrementCounter(byte[] counter, byte[] oldCounter) throws GeneralSecurityException { System.arraycopy(counter, 0, oldCounter, 0, counter.length); int i = 0; for (; i < COUNTER_OVERFLOW_LENGTH; i++) { counter[i]++; if (counter[i] != (byte) 0x00) { break; } } if (i == COUNTER_OVERFLOW_LENGTH) { // Restore old counter value to ensure that encrypt and decrypt keep failing. System.arraycopy(oldCounter, 0, counter, 0, counter.length); throw new GeneralSecurityException("Counter has overflowed."); } }
[ "static", "void", "incrementCounter", "(", "byte", "[", "]", "counter", ",", "byte", "[", "]", "oldCounter", ")", "throws", "GeneralSecurityException", "{", "System", ".", "arraycopy", "(", "counter", ",", "0", ",", "oldCounter", ",", "0", ",", "counter", ...
Increments {@code counter}, store the unincremented value in {@code oldCounter}.
[ "Increments", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/AltsChannelCrypter.java#L127-L142
threerings/gwt-utils
src/main/java/com/threerings/gwt/util/ListenerList.java
ListenerList.removeListener
public static <L, K> void removeListener (Map<K, ListenerList<L>> map, K key, L listener) { ListenerList<L> list = map.get(key); if (list != null) { list.remove(listener); } }
java
public static <L, K> void removeListener (Map<K, ListenerList<L>> map, K key, L listener) { ListenerList<L> list = map.get(key); if (list != null) { list.remove(listener); } }
[ "public", "static", "<", "L", ",", "K", ">", "void", "removeListener", "(", "Map", "<", "K", ",", "ListenerList", "<", "L", ">", ">", "map", ",", "K", "key", ",", "L", "listener", ")", "{", "ListenerList", "<", "L", ">", "list", "=", "map", ".", ...
Removes a listener from the supplied list in the supplied map.
[ "Removes", "a", "listener", "from", "the", "supplied", "list", "in", "the", "supplied", "map", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ListenerList.java#L68-L74
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.projectiveToIdentityH
public static void projectiveToIdentityH(DMatrixRMaj P , DMatrixRMaj H ) { ProjectiveToIdentity alg = new ProjectiveToIdentity(); if( !alg.process(P)) throw new RuntimeException("WTF this failed?? Probably NaN in P"); alg.computeH(H); }
java
public static void projectiveToIdentityH(DMatrixRMaj P , DMatrixRMaj H ) { ProjectiveToIdentity alg = new ProjectiveToIdentity(); if( !alg.process(P)) throw new RuntimeException("WTF this failed?? Probably NaN in P"); alg.computeH(H); }
[ "public", "static", "void", "projectiveToIdentityH", "(", "DMatrixRMaj", "P", ",", "DMatrixRMaj", "H", ")", "{", "ProjectiveToIdentity", "alg", "=", "new", "ProjectiveToIdentity", "(", ")", ";", "if", "(", "!", "alg", ".", "process", "(", "P", ")", ")", "t...
Finds the transform such that P*H = [I|0] where P is a 3x4 projective camera matrix and H is a 4x4 matrix @param P (Input) camera matrix 3x4 @param H (Output) 4x4 matrix
[ "Finds", "the", "transform", "such", "that", "P", "*", "H", "=", "[", "I|0", "]", "where", "P", "is", "a", "3x4", "projective", "camera", "matrix", "and", "H", "is", "a", "4x4", "matrix" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1005-L1010
OpenLiberty/open-liberty
dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLSharedServerLeaseLog.java
SQLSharedServerLeaseLog.insertNewLease
private void insertNewLease(String recoveryIdentity, String recoveryGroup, Connection conn) throws SQLException { if (tc.isEntryEnabled()) Tr.entry(tc, "insertNewLease", this); short serviceId = (short) 1; String insertString = "INSERT INTO " + _leaseTableName + " (SERVER_IDENTITY, RECOVERY_GROUP, LEASE_OWNER, LEASE_TIME)" + " VALUES (?,?,?,?)"; PreparedStatement specStatement = null; long fir1 = System.currentTimeMillis(); Tr.audit(tc, "WTRN0108I: Insert New Lease for server with recovery identity " + recoveryIdentity); try { if (tc.isDebugEnabled()) Tr.debug(tc, "Need to setup new row using - " + insertString + ", and time: " + fir1); specStatement = conn.prepareStatement(insertString); specStatement.setString(1, recoveryIdentity); specStatement.setString(2, recoveryGroup); specStatement.setString(3, recoveryIdentity); specStatement.setLong(4, fir1); int ret = specStatement.executeUpdate(); if (tc.isDebugEnabled()) Tr.debug(tc, "Have inserted Server row with return: " + ret); } finally { if (specStatement != null && !specStatement.isClosed()) specStatement.close(); } if (tc.isEntryEnabled()) Tr.exit(tc, "insertNewLease"); }
java
private void insertNewLease(String recoveryIdentity, String recoveryGroup, Connection conn) throws SQLException { if (tc.isEntryEnabled()) Tr.entry(tc, "insertNewLease", this); short serviceId = (short) 1; String insertString = "INSERT INTO " + _leaseTableName + " (SERVER_IDENTITY, RECOVERY_GROUP, LEASE_OWNER, LEASE_TIME)" + " VALUES (?,?,?,?)"; PreparedStatement specStatement = null; long fir1 = System.currentTimeMillis(); Tr.audit(tc, "WTRN0108I: Insert New Lease for server with recovery identity " + recoveryIdentity); try { if (tc.isDebugEnabled()) Tr.debug(tc, "Need to setup new row using - " + insertString + ", and time: " + fir1); specStatement = conn.prepareStatement(insertString); specStatement.setString(1, recoveryIdentity); specStatement.setString(2, recoveryGroup); specStatement.setString(3, recoveryIdentity); specStatement.setLong(4, fir1); int ret = specStatement.executeUpdate(); if (tc.isDebugEnabled()) Tr.debug(tc, "Have inserted Server row with return: " + ret); } finally { if (specStatement != null && !specStatement.isClosed()) specStatement.close(); } if (tc.isEntryEnabled()) Tr.exit(tc, "insertNewLease"); }
[ "private", "void", "insertNewLease", "(", "String", "recoveryIdentity", ",", "String", "recoveryGroup", ",", "Connection", "conn", ")", "throws", "SQLException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", ...
Insert a new lease in the table @param recoveryIdentity @param recoveryGroup @param conn @throws SQLException
[ "Insert", "a", "new", "lease", "in", "the", "table" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLSharedServerLeaseLog.java#L457-L493
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getTemplate
public TemplateBean getTemplate() { TemplateBean templateBean = getRequestAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN); if (templateBean == null) { templateBean = new TemplateBean("", ""); } return templateBean; }
java
public TemplateBean getTemplate() { TemplateBean templateBean = getRequestAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN); if (templateBean == null) { templateBean = new TemplateBean("", ""); } return templateBean; }
[ "public", "TemplateBean", "getTemplate", "(", ")", "{", "TemplateBean", "templateBean", "=", "getRequestAttribute", "(", "CmsTemplateContextManager", ".", "ATTR_TEMPLATE_BEAN", ")", ";", "if", "(", "templateBean", "==", "null", ")", "{", "templateBean", "=", "new", ...
Gets a bean containing information about the current template.<p> @return the template information bean
[ "Gets", "a", "bean", "containing", "information", "about", "the", "current", "template", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1634-L1641
openbase/jul
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java
MultiLanguageTextProcessor.addMultiLanguageText
public static MultiLanguageText.Builder addMultiLanguageText(final MultiLanguageText.Builder multiLanguageTextBuilder, final Locale locale, final String multiLanguageText) { return addMultiLanguageText(multiLanguageTextBuilder, locale.getLanguage(), multiLanguageText); }
java
public static MultiLanguageText.Builder addMultiLanguageText(final MultiLanguageText.Builder multiLanguageTextBuilder, final Locale locale, final String multiLanguageText) { return addMultiLanguageText(multiLanguageTextBuilder, locale.getLanguage(), multiLanguageText); }
[ "public", "static", "MultiLanguageText", ".", "Builder", "addMultiLanguageText", "(", "final", "MultiLanguageText", ".", "Builder", "multiLanguageTextBuilder", ",", "final", "Locale", "locale", ",", "final", "String", "multiLanguageText", ")", "{", "return", "addMultiLa...
Add a multiLanguageText to a multiLanguageTextBuilder by locale. This is equivalent to calling {@link #addMultiLanguageText(Builder, String, String)} but the language code is extracted from the locale by calling {@link Locale#getLanguage()}. @param multiLanguageTextBuilder the multiLanguageText builder to be updated @param locale the locale from which the language code is extracted for which the multiLanguageText is added @param multiLanguageText the multiLanguageText to be added @return the updated multiLanguageText builder
[ "Add", "a", "multiLanguageText", "to", "a", "multiLanguageTextBuilder", "by", "locale", ".", "This", "is", "equivalent", "to", "calling", "{", "@link", "#addMultiLanguageText", "(", "Builder", "String", "String", ")", "}", "but", "the", "language", "code", "is",...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L120-L122
WASdev/ci.maven
liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java
SpringBootUtil.getSpringBootMavenPluginClassifier
public static String getSpringBootMavenPluginClassifier(MavenProject project, Log log) { String classifier = null; try { classifier = MavenProjectUtil.getPluginGoalConfigurationString(project, "org.springframework.boot:spring-boot-maven-plugin", "repackage", "classifier"); } catch (PluginScenarioException e) { log.debug("No classifier found for spring-boot-maven-plugin"); } return classifier; }
java
public static String getSpringBootMavenPluginClassifier(MavenProject project, Log log) { String classifier = null; try { classifier = MavenProjectUtil.getPluginGoalConfigurationString(project, "org.springframework.boot:spring-boot-maven-plugin", "repackage", "classifier"); } catch (PluginScenarioException e) { log.debug("No classifier found for spring-boot-maven-plugin"); } return classifier; }
[ "public", "static", "String", "getSpringBootMavenPluginClassifier", "(", "MavenProject", "project", ",", "Log", "log", ")", "{", "String", "classifier", "=", "null", ";", "try", "{", "classifier", "=", "MavenProjectUtil", ".", "getPluginGoalConfigurationString", "(", ...
Read the value of the classifier configuration parameter from the spring-boot-maven-plugin @param project @param log @return the value if it was found, null otherwise
[ "Read", "the", "value", "of", "the", "classifier", "configuration", "parameter", "from", "the", "spring", "-", "boot", "-", "maven", "-", "plugin" ]
train
https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java#L35-L44
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java
CPMeasurementUnitPersistenceImpl.findByGroupId
@Override public List<CPMeasurementUnit> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CPMeasurementUnit> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPMeasurementUnit", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp measurement units where groupId = &#63;. <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 CPMeasurementUnitModelImpl}. 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 groupId the group ID @param start the lower bound of the range of cp measurement units @param end the upper bound of the range of cp measurement units (not inclusive) @return the range of matching cp measurement units
[ "Returns", "a", "range", "of", "all", "the", "cp", "measurement", "units", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L1533-L1537
dustin/java-memcached-client
src/main/java/net/spy/memcached/TapClient.java
TapClient.getNextMessage
public ResponseMessage getNextMessage(long time, TimeUnit timeunit) { try { Object m = rqueue.poll(time, timeunit); if (m == null) { return null; } else if (m instanceof ResponseMessage) { return (ResponseMessage) m; } else if (m instanceof TapAck) { TapAck ack = (TapAck) m; tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(), ack.getCallback()); return null; } else { throw new RuntimeException("Unexpected tap message type"); } } catch (InterruptedException e) { shutdown(); return null; } }
java
public ResponseMessage getNextMessage(long time, TimeUnit timeunit) { try { Object m = rqueue.poll(time, timeunit); if (m == null) { return null; } else if (m instanceof ResponseMessage) { return (ResponseMessage) m; } else if (m instanceof TapAck) { TapAck ack = (TapAck) m; tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(), ack.getCallback()); return null; } else { throw new RuntimeException("Unexpected tap message type"); } } catch (InterruptedException e) { shutdown(); return null; } }
[ "public", "ResponseMessage", "getNextMessage", "(", "long", "time", ",", "TimeUnit", "timeunit", ")", "{", "try", "{", "Object", "m", "=", "rqueue", ".", "poll", "(", "time", ",", "timeunit", ")", ";", "if", "(", "m", "==", "null", ")", "{", "return", ...
Gets the next tap message from the queue of received tap messages. @param time the amount of time to wait for a message. @param timeunit the unit of time to use. @return The tap message at the head of the queue or null if the queue is empty for the given amount of time.
[ "Gets", "the", "next", "tap", "message", "from", "the", "queue", "of", "received", "tap", "messages", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/TapClient.java#L105-L124
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_region_regionName_GET
public OvhRegion project_serviceName_region_regionName_GET(String serviceName, String regionName) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}"; StringBuilder sb = path(qPath, serviceName, regionName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRegion.class); }
java
public OvhRegion project_serviceName_region_regionName_GET(String serviceName, String regionName) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}"; StringBuilder sb = path(qPath, serviceName, regionName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRegion.class); }
[ "public", "OvhRegion", "project_serviceName_region_regionName_GET", "(", "String", "serviceName", ",", "String", "regionName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/region/{regionName}\"", ";", "StringBuilder", "sb", "=", ...
Get information about your region REST: GET /cloud/project/{serviceName}/region/{regionName} @param regionName [required] Public Cloud region @param serviceName [required] Public Cloud project
[ "Get", "information", "about", "your", "region" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L154-L159
diirt/util
src/main/java/org/epics/util/array/ListNumbers.java
ListNumbers.binarySearchValueOrLower
public static int binarySearchValueOrLower(ListNumber values, double value) { if (value <= values.getDouble(0)) { return 0; } if (value >= values.getDouble(values.size() -1)) { return values.size() - 1; } int index = binarySearch(0, values.size() - 1, values, value); while (index != 0 && value == values.getDouble(index - 1)) { index--; } return index; }
java
public static int binarySearchValueOrLower(ListNumber values, double value) { if (value <= values.getDouble(0)) { return 0; } if (value >= values.getDouble(values.size() -1)) { return values.size() - 1; } int index = binarySearch(0, values.size() - 1, values, value); while (index != 0 && value == values.getDouble(index - 1)) { index--; } return index; }
[ "public", "static", "int", "binarySearchValueOrLower", "(", "ListNumber", "values", ",", "double", "value", ")", "{", "if", "(", "value", "<=", "values", ".", "getDouble", "(", "0", ")", ")", "{", "return", "0", ";", "}", "if", "(", "value", ">=", "val...
Finds the value in the list, or the one right below it. @param values a list of values @param value a value @return the index of the value
[ "Finds", "the", "value", "in", "the", "list", "or", "the", "one", "right", "below", "it", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListNumbers.java#L69-L84
PrashamTrivedi/SharedPreferenceInspector
sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/Utils/SharedPreferenceUtils.java
SharedPreferenceUtils.inflateDebugMenu
public void inflateDebugMenu(MenuInflater inflater, Menu menu) { inflater.inflate(R.menu.debug, menu); }
java
public void inflateDebugMenu(MenuInflater inflater, Menu menu) { inflater.inflate(R.menu.debug, menu); }
[ "public", "void", "inflateDebugMenu", "(", "MenuInflater", "inflater", ",", "Menu", "menu", ")", "{", "inflater", ".", "inflate", "(", "R", ".", "menu", ".", "debug", ",", "menu", ")", ";", "}" ]
Inflate menu item for debug. @param inflater: MenuInflater to inflate the menu. @param menu : Menu object to inflate debug menu.
[ "Inflate", "menu", "item", "for", "debug", "." ]
train
https://github.com/PrashamTrivedi/SharedPreferenceInspector/blob/c04d567c4d0fc5e0f8cda308ca85df19c6b3b838/sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/Utils/SharedPreferenceUtils.java#L167-L169
Fleker/ChannelSurfer
library/src/main/java/com/felkertech/channelsurfer/utils/LiveChannelsUtils.java
LiveChannelsUtils.getTvInputProvider
public static TvInputProvider getTvInputProvider(Context mContext, final TvInputProviderCallback callback) { ApplicationInfo app = null; try { Log.d(TAG, mContext.getPackageName()+" >"); app = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = app.metaData; final String service = bundle.getString("TvInputService"); Log.d(TAG, service); Log.d(TAG, mContext.getString(R.string.app_name)); try { Log.d(TAG, "Constructors: " + Class.forName(service).getConstructors().length); // Log.d(TAG, "Constructor 1: " + Class.forName(service).getConstructors()[0].toString()); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { TvInputProvider provider = null; try { provider = (TvInputProvider) Class.forName(service).getConstructors()[0].newInstance(); Log.d(TAG, provider.toString()); callback.onTvInputProviderCallback(provider); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) { e.printStackTrace(); } } }); } catch(ClassNotFoundException e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return null; }
java
public static TvInputProvider getTvInputProvider(Context mContext, final TvInputProviderCallback callback) { ApplicationInfo app = null; try { Log.d(TAG, mContext.getPackageName()+" >"); app = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = app.metaData; final String service = bundle.getString("TvInputService"); Log.d(TAG, service); Log.d(TAG, mContext.getString(R.string.app_name)); try { Log.d(TAG, "Constructors: " + Class.forName(service).getConstructors().length); // Log.d(TAG, "Constructor 1: " + Class.forName(service).getConstructors()[0].toString()); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { TvInputProvider provider = null; try { provider = (TvInputProvider) Class.forName(service).getConstructors()[0].newInstance(); Log.d(TAG, provider.toString()); callback.onTvInputProviderCallback(provider); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) { e.printStackTrace(); } } }); } catch(ClassNotFoundException e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return null; }
[ "public", "static", "TvInputProvider", "getTvInputProvider", "(", "Context", "mContext", ",", "final", "TvInputProviderCallback", "callback", ")", "{", "ApplicationInfo", "app", "=", "null", ";", "try", "{", "Log", ".", "d", "(", "TAG", ",", "mContext", ".", "...
Returns the TvInputProvider that was defined by the project's manifest
[ "Returns", "the", "TvInputProvider", "that", "was", "defined", "by", "the", "project", "s", "manifest" ]
train
https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/utils/LiveChannelsUtils.java#L52-L87
jbundle/webapp
files/src/main/java/org/jbundle/util/webapp/files/DefaultServlet.java
DefaultServlet.setDocBase
@SuppressWarnings({ "rawtypes", "unchecked" }) public boolean setDocBase(String basePath) { proxyDirContext = null; if (basePath == null) return false; Hashtable env = new Hashtable(); File file = new File(basePath); if (!file.exists()) return false; if (!file.isDirectory()) return false; env.put(ProxyDirContext.CONTEXT, file.getPath()); FileDirContext fileContext = new FileDirContext(env); fileContext.setDocBase(file.getPath()); proxyDirContext = new ProxyDirContext(env, fileContext); /* Can't figure this one out InitialContext cx = null; try { cx.rebind(RESOURCES_JNDI_NAME, obj); } catch (NamingException e) { e.printStackTrace(); } */ // Load the proxy dir context. return true; }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public boolean setDocBase(String basePath) { proxyDirContext = null; if (basePath == null) return false; Hashtable env = new Hashtable(); File file = new File(basePath); if (!file.exists()) return false; if (!file.isDirectory()) return false; env.put(ProxyDirContext.CONTEXT, file.getPath()); FileDirContext fileContext = new FileDirContext(env); fileContext.setDocBase(file.getPath()); proxyDirContext = new ProxyDirContext(env, fileContext); /* Can't figure this one out InitialContext cx = null; try { cx.rebind(RESOURCES_JNDI_NAME, obj); } catch (NamingException e) { e.printStackTrace(); } */ // Load the proxy dir context. return true; }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "boolean", "setDocBase", "(", "String", "basePath", ")", "{", "proxyDirContext", "=", "null", ";", "if", "(", "basePath", "==", "null", ")", "return", "false", ";", ...
Set the local file path to serve files from. @param basePath @return
[ "Set", "the", "local", "file", "path", "to", "serve", "files", "from", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/files/src/main/java/org/jbundle/util/webapp/files/DefaultServlet.java#L123-L151
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java
ExpressRouteConnectionsInner.getAsync
public Observable<ExpressRouteConnectionInner> getAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName) { return getWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() { @Override public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteConnectionInner> getAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName) { return getWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName).map(new Func1<ServiceResponse<ExpressRouteConnectionInner>, ExpressRouteConnectionInner>() { @Override public ExpressRouteConnectionInner call(ServiceResponse<ExpressRouteConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteConnectionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "expressRouteGatewayName", ",", "String", "connectionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "e...
Gets the specified ExpressRouteConnection. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @param connectionName The name of the ExpressRoute connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteConnectionInner object
[ "Gets", "the", "specified", "ExpressRouteConnection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L304-L311
ontop/ontop
core/model/src/main/java/it/unibz/inf/ontop/iq/node/impl/LeftJoinNodeImpl.java
LeftJoinNodeImpl.createProvenanceElements
private Optional<RightProvenance> createProvenanceElements(IQTree rightTree, ImmutableSubstitution<? extends ImmutableTerm> selectedSubstitution, ImmutableSet<Variable> leftVariables, VariableGenerator variableGenerator) { if (selectedSubstitution.getImmutableMap().entrySet().stream() .filter(e -> !leftVariables.contains(e.getKey())) .map(Map.Entry::getValue) .anyMatch(value -> value.getVariableStream() .allMatch(leftVariables::contains) || value.isGround())) { VariableNullability rightVariableNullability = rightTree.getVariableNullability(); Optional<Variable> nonNullableRightVariable = rightTree.getVariables().stream() .filter(v -> !leftVariables.contains(v)) .filter(v -> !rightVariableNullability.isPossiblyNullable(v)) .findFirst(); if (nonNullableRightVariable.isPresent()) { return Optional.of(new RightProvenance(nonNullableRightVariable.get())); } /* * Otherwise, creates a fresh variable and its construction node */ else { Variable provenanceVariable = variableGenerator.generateNewVariable(); ImmutableSet<Variable> newRightProjectedVariables = Stream.concat( Stream.of(provenanceVariable), rightTree.getVariables().stream()) .collect(ImmutableCollectors.toSet()); ConstructionNode newRightConstructionNode = iqFactory.createConstructionNode( newRightProjectedVariables, substitutionFactory.getSubstitution(provenanceVariable, termFactory.getProvenanceSpecialConstant())); return Optional.of(new RightProvenance(provenanceVariable, newRightConstructionNode)); } } else { return Optional.empty(); } }
java
private Optional<RightProvenance> createProvenanceElements(IQTree rightTree, ImmutableSubstitution<? extends ImmutableTerm> selectedSubstitution, ImmutableSet<Variable> leftVariables, VariableGenerator variableGenerator) { if (selectedSubstitution.getImmutableMap().entrySet().stream() .filter(e -> !leftVariables.contains(e.getKey())) .map(Map.Entry::getValue) .anyMatch(value -> value.getVariableStream() .allMatch(leftVariables::contains) || value.isGround())) { VariableNullability rightVariableNullability = rightTree.getVariableNullability(); Optional<Variable> nonNullableRightVariable = rightTree.getVariables().stream() .filter(v -> !leftVariables.contains(v)) .filter(v -> !rightVariableNullability.isPossiblyNullable(v)) .findFirst(); if (nonNullableRightVariable.isPresent()) { return Optional.of(new RightProvenance(nonNullableRightVariable.get())); } /* * Otherwise, creates a fresh variable and its construction node */ else { Variable provenanceVariable = variableGenerator.generateNewVariable(); ImmutableSet<Variable> newRightProjectedVariables = Stream.concat( Stream.of(provenanceVariable), rightTree.getVariables().stream()) .collect(ImmutableCollectors.toSet()); ConstructionNode newRightConstructionNode = iqFactory.createConstructionNode( newRightProjectedVariables, substitutionFactory.getSubstitution(provenanceVariable, termFactory.getProvenanceSpecialConstant())); return Optional.of(new RightProvenance(provenanceVariable, newRightConstructionNode)); } } else { return Optional.empty(); } }
[ "private", "Optional", "<", "RightProvenance", ">", "createProvenanceElements", "(", "IQTree", "rightTree", ",", "ImmutableSubstitution", "<", "?", "extends", "ImmutableTerm", ">", "selectedSubstitution", ",", "ImmutableSet", "<", "Variable", ">", "leftVariables", ",", ...
When at least one value does not depend on a right-specific variable (i.e. is a ground term or only depends on left variables)
[ "When", "at", "least", "one", "value", "does", "not", "depend", "on", "a", "right", "-", "specific", "variable", "(", "i", ".", "e", ".", "is", "a", "ground", "term", "or", "only", "depends", "on", "left", "variables", ")" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/iq/node/impl/LeftJoinNodeImpl.java#L684-L728