repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.listHosts
@Override public List<String> listHosts() { """ Returns a list of the hosts/agents that have been registered. """ try { // TODO (dano): only return hosts whose agents completed registration (i.e. has id nodes) return provider.get("listHosts").getChildren(Paths.configHosts()); } catch (KeeperException.NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw new HeliosRuntimeException("listing hosts failed", e); } }
java
@Override public List<String> listHosts() { try { // TODO (dano): only return hosts whose agents completed registration (i.e. has id nodes) return provider.get("listHosts").getChildren(Paths.configHosts()); } catch (KeeperException.NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw new HeliosRuntimeException("listing hosts failed", e); } }
[ "@", "Override", "public", "List", "<", "String", ">", "listHosts", "(", ")", "{", "try", "{", "// TODO (dano): only return hosts whose agents completed registration (i.e. has id nodes)", "return", "provider", ".", "get", "(", "\"listHosts\"", ")", ".", "getChildren", "...
Returns a list of the hosts/agents that have been registered.
[ "Returns", "a", "list", "of", "the", "hosts", "/", "agents", "that", "have", "been", "registered", "." ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L194-L204
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java
LibPQFactory.verifyHostName
@Deprecated public static boolean verifyHostName(String hostname, String pattern) { """ Verifies if given hostname matches pattern. @deprecated use {@link PGjdbcHostnameVerifier} @param hostname input hostname @param pattern domain name pattern @return true when domain matches pattern """ String canonicalHostname; if (hostname.startsWith("[") && hostname.endsWith("]")) { // IPv6 address like [2001:db8:0:1:1:1:1:1] canonicalHostname = hostname.substring(1, hostname.length() - 1); } else { // This converts unicode domain name to ASCII try { canonicalHostname = IDN.toASCII(hostname); } catch (IllegalArgumentException e) { // e.g. hostname is invalid return false; } } return PGjdbcHostnameVerifier.INSTANCE.verifyHostName(canonicalHostname, pattern); }
java
@Deprecated public static boolean verifyHostName(String hostname, String pattern) { String canonicalHostname; if (hostname.startsWith("[") && hostname.endsWith("]")) { // IPv6 address like [2001:db8:0:1:1:1:1:1] canonicalHostname = hostname.substring(1, hostname.length() - 1); } else { // This converts unicode domain name to ASCII try { canonicalHostname = IDN.toASCII(hostname); } catch (IllegalArgumentException e) { // e.g. hostname is invalid return false; } } return PGjdbcHostnameVerifier.INSTANCE.verifyHostName(canonicalHostname, pattern); }
[ "@", "Deprecated", "public", "static", "boolean", "verifyHostName", "(", "String", "hostname", ",", "String", "pattern", ")", "{", "String", "canonicalHostname", ";", "if", "(", "hostname", ".", "startsWith", "(", "\"[\"", ")", "&&", "hostname", ".", "endsWith...
Verifies if given hostname matches pattern. @deprecated use {@link PGjdbcHostnameVerifier} @param hostname input hostname @param pattern domain name pattern @return true when domain matches pattern
[ "Verifies", "if", "given", "hostname", "matches", "pattern", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java#L45-L61
jMotif/GI
src/main/java/net/seninp/gi/rulepruner/RulePrunerFactory.java
RulePrunerFactory.computeGrammarSize
public static Integer computeGrammarSize(GrammarRules rules, Integer paaSize) { """ Computes the size of a normal, i.e. unpruned grammar. @param rules the grammar rules. @param paaSize the SAX transform word size. @return the grammar size, in BYTES. """ // The final grammar's size in BYTES // int res = 0; // The final size is the sum of the sizes of all rules // for (GrammarRuleRecord r : rules) { String ruleStr = r.getRuleString(); String[] tokens = ruleStr.split("\\s+"); int ruleSize = computeRuleSize(paaSize, tokens); res += ruleSize; } return res; }
java
public static Integer computeGrammarSize(GrammarRules rules, Integer paaSize) { // The final grammar's size in BYTES // int res = 0; // The final size is the sum of the sizes of all rules // for (GrammarRuleRecord r : rules) { String ruleStr = r.getRuleString(); String[] tokens = ruleStr.split("\\s+"); int ruleSize = computeRuleSize(paaSize, tokens); res += ruleSize; } return res; }
[ "public", "static", "Integer", "computeGrammarSize", "(", "GrammarRules", "rules", ",", "Integer", "paaSize", ")", "{", "// The final grammar's size in BYTES", "//", "int", "res", "=", "0", ";", "// The final size is the sum of the sizes of all rules", "//", "for", "(", ...
Computes the size of a normal, i.e. unpruned grammar. @param rules the grammar rules. @param paaSize the SAX transform word size. @return the grammar size, in BYTES.
[ "Computes", "the", "size", "of", "a", "normal", "i", ".", "e", ".", "unpruned", "grammar", "." ]
train
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/rulepruner/RulePrunerFactory.java#L26-L42
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/xml/XMLUtils.java
XMLUtils.getNodeList
private NodeList getNodeList(final String xmlString, final String tagName) throws ParserConfigurationException, SAXException, IOException { """ Gets the nodes list for a given tag name. @param xmlString the XML String @param tagName the tag name to be searched @return the Node List for the given tag name @throws ParserConfigurationException if something goes wrong while parsing the XML @throws SAXException if XML is malformed @throws IOException if something goes wrong when reading the file """ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setFeature("http://xml.org/sax/features/namespaces", false); dbf.setFeature("http://xml.org/sax/features/validation", false); dbf.setFeature( "http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); dbf.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xmlString)); Document doc = db.parse(is); LOG.info("Getting tagName: " + tagName); NodeList nodes = doc.getElementsByTagName(tagName); return nodes; }
java
private NodeList getNodeList(final String xmlString, final String tagName) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setFeature("http://xml.org/sax/features/namespaces", false); dbf.setFeature("http://xml.org/sax/features/validation", false); dbf.setFeature( "http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); dbf.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xmlString)); Document doc = db.parse(is); LOG.info("Getting tagName: " + tagName); NodeList nodes = doc.getElementsByTagName(tagName); return nodes; }
[ "private", "NodeList", "getNodeList", "(", "final", "String", "xmlString", ",", "final", "String", "tagName", ")", "throws", "ParserConfigurationException", ",", "SAXException", ",", "IOException", "{", "DocumentBuilderFactory", "dbf", "=", "DocumentBuilderFactory", "."...
Gets the nodes list for a given tag name. @param xmlString the XML String @param tagName the tag name to be searched @return the Node List for the given tag name @throws ParserConfigurationException if something goes wrong while parsing the XML @throws SAXException if XML is malformed @throws IOException if something goes wrong when reading the file
[ "Gets", "the", "nodes", "list", "for", "a", "given", "tag", "name", "." ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/xml/XMLUtils.java#L228-L249
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java
TypeToStringUtils.toStringConstructor
public static String toStringConstructor(final Constructor constructor, final Map<String, Type> generics) { """ <pre>{@code class B extends A<Long> {} class A<T> { A(T arg); } Constructor method = A.class.getConstructor(Object.class); Map<String, Type> generics = (context of B).method().visibleGenericsMap(); TypeToStringUtils.toStringConstructor(constructor, generics) == "A(Long)" }</pre>. @param constructor constructor @param generics required generics (type generics and possible constructor generics) @return constructor string with replaced generic variables @see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names @see ru.vyarus.java.generics.resolver.util.map.IgnoreGenericsMap to print Object instead of not known generic """ return String.format("%s(%s)", constructor.getDeclaringClass().getSimpleName(), toStringTypes(constructor.getGenericParameterTypes(), generics)); }
java
public static String toStringConstructor(final Constructor constructor, final Map<String, Type> generics) { return String.format("%s(%s)", constructor.getDeclaringClass().getSimpleName(), toStringTypes(constructor.getGenericParameterTypes(), generics)); }
[ "public", "static", "String", "toStringConstructor", "(", "final", "Constructor", "constructor", ",", "final", "Map", "<", "String", ",", "Type", ">", "generics", ")", "{", "return", "String", ".", "format", "(", "\"%s(%s)\"", ",", "constructor", ".", "getDecl...
<pre>{@code class B extends A<Long> {} class A<T> { A(T arg); } Constructor method = A.class.getConstructor(Object.class); Map<String, Type> generics = (context of B).method().visibleGenericsMap(); TypeToStringUtils.toStringConstructor(constructor, generics) == "A(Long)" }</pre>. @param constructor constructor @param generics required generics (type generics and possible constructor generics) @return constructor string with replaced generic variables @see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names @see ru.vyarus.java.generics.resolver.util.map.IgnoreGenericsMap to print Object instead of not known generic
[ "<pre", ">", "{", "@code", "class", "B", "extends", "A<Long", ">", "{}", "class", "A<T", ">", "{", "A", "(", "T", "arg", ")", ";", "}" ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L214-L218
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java
BigtableTableAdminClient.dropRowRange
@SuppressWarnings("WeakerAccess") public void dropRowRange(String tableId, String rowKeyPrefix) { """ Drops rows by the specified key prefix and tableId <p>Please note that this method is considered part of the admin API and is rate limited. <p>Sample code: <pre>{@code client.dropRowRange("my-table", "prefix"); }</pre> """ ApiExceptions.callAndTranslateApiException(dropRowRangeAsync(tableId, rowKeyPrefix)); }
java
@SuppressWarnings("WeakerAccess") public void dropRowRange(String tableId, String rowKeyPrefix) { ApiExceptions.callAndTranslateApiException(dropRowRangeAsync(tableId, rowKeyPrefix)); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "void", "dropRowRange", "(", "String", "tableId", ",", "String", "rowKeyPrefix", ")", "{", "ApiExceptions", ".", "callAndTranslateApiException", "(", "dropRowRangeAsync", "(", "tableId", ",", "rowKeyPref...
Drops rows by the specified key prefix and tableId <p>Please note that this method is considered part of the admin API and is rate limited. <p>Sample code: <pre>{@code client.dropRowRange("my-table", "prefix"); }</pre>
[ "Drops", "rows", "by", "the", "specified", "key", "prefix", "and", "tableId" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java#L614-L617
ModeShape/modeshape
sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java
AbstractJavaMetadata.processSimpleType
protected FieldMetadata processSimpleType( FieldDeclaration fieldDeclaration ) { """ Process the simple type of a {@link FieldDeclaration}. @param fieldDeclaration - the field declaration. @return SimpleTypeFieldMetadata. """ SimpleType simpleType = (SimpleType)fieldDeclaration.getType(); FieldMetadata simpleTypeFieldMetadata = FieldMetadata.simpleType(JavaMetadataUtil.getName(simpleType.getName())); // modifiers processModifiersOfFieldDeclaration(fieldDeclaration, simpleTypeFieldMetadata); processVariablesOfVariableDeclarationFragment(fieldDeclaration, simpleTypeFieldMetadata); simpleTypeFieldMetadata.setName(getFieldName(fieldDeclaration)); return simpleTypeFieldMetadata; }
java
protected FieldMetadata processSimpleType( FieldDeclaration fieldDeclaration ) { SimpleType simpleType = (SimpleType)fieldDeclaration.getType(); FieldMetadata simpleTypeFieldMetadata = FieldMetadata.simpleType(JavaMetadataUtil.getName(simpleType.getName())); // modifiers processModifiersOfFieldDeclaration(fieldDeclaration, simpleTypeFieldMetadata); processVariablesOfVariableDeclarationFragment(fieldDeclaration, simpleTypeFieldMetadata); simpleTypeFieldMetadata.setName(getFieldName(fieldDeclaration)); return simpleTypeFieldMetadata; }
[ "protected", "FieldMetadata", "processSimpleType", "(", "FieldDeclaration", "fieldDeclaration", ")", "{", "SimpleType", "simpleType", "=", "(", "SimpleType", ")", "fieldDeclaration", ".", "getType", "(", ")", ";", "FieldMetadata", "simpleTypeFieldMetadata", "=", "FieldM...
Process the simple type of a {@link FieldDeclaration}. @param fieldDeclaration - the field declaration. @return SimpleTypeFieldMetadata.
[ "Process", "the", "simple", "type", "of", "a", "{", "@link", "FieldDeclaration", "}", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java#L589-L598
henkexbg/gallery-api
src/main/java/com/github/henkexbg/gallery/controller/GalleryController.java
GalleryController.getListing
@RequestMapping(value = "/service/**", method = RequestMethod.GET) public @ResponseBody ListingContext getListing(HttpServletRequest servletRequest, Model model) throws IOException { """ Retrieves the listing for a given path (which can be empty). The response can contain media in the shape of {@link GalleryFileHolder} instances as well as sub-directories. @param servletRequest Servlet request @param model Spring web model @return A {@link ListingContext} instance. @throws IOException Sub-types of this exception are thrown for different scenarios, and the {@link IOException} itself for generic errors. """ String path = extractPathFromPattern(servletRequest); LOG.debug("Entering getListing(path={})", path); String contextPath = servletRequest.getContextPath(); try { ListingContext listingContext = new ListingContext(); listingContext.setAllowCustomImageSizes(allowCustomImageSizes); listingContext.setImageFormats(imageFormats); listingContext.setVideoFormats(galleryService.getAvailableVideoModes()); if (StringUtils.isBlank(path)) { listingContext.setDirectories(generateUrlsFromDirectoryPaths(path, contextPath, galleryService.getRootDirectories())); } else { listingContext.setCurrentPathDisplay(path); listingContext.setPreviousPath(getPreviousPath(contextPath, path)); List<GalleryFile> directoryListing = galleryService.getDirectoryListingFiles(path); if (directoryListing == null) { throw new ResourceNotFoundException(); } LOG.debug("{} media files found", directoryListing.size()); List<GalleryFile> galleryImages = directoryListing.stream().filter(gi -> GalleryFileType.IMAGE.equals(gi.getType())) .collect(Collectors.toList()); List<GalleryFileHolder> listing = convertToGalleryFileHolders(contextPath, galleryImages); listingContext.setImages(listing); List<GalleryFile> galleryVideos = directoryListing.stream().filter(gi -> GalleryFileType.VIDEO.equals(gi.getType())) .collect(Collectors.toList()); List<GalleryFileHolder> videoHolders = convertToGalleryFileHolders(contextPath, galleryVideos); listingContext.setVideos(videoHolders); listingContext.setDirectories(generateUrlsFromDirectoryPaths(path, contextPath, galleryService.getDirectories(path))); } return listingContext; } catch (NotAllowedException noe) { LOG.warn("Not allowing resource {}", path); throw new ResourceNotFoundException(); } catch (FileNotFoundException fnfe) { LOG.warn("Could not find resource {}", path); throw new ResourceNotFoundException(); } catch (IOException ioe) { LOG.error("Error when calling getImage", ioe); throw ioe; } }
java
@RequestMapping(value = "/service/**", method = RequestMethod.GET) public @ResponseBody ListingContext getListing(HttpServletRequest servletRequest, Model model) throws IOException { String path = extractPathFromPattern(servletRequest); LOG.debug("Entering getListing(path={})", path); String contextPath = servletRequest.getContextPath(); try { ListingContext listingContext = new ListingContext(); listingContext.setAllowCustomImageSizes(allowCustomImageSizes); listingContext.setImageFormats(imageFormats); listingContext.setVideoFormats(galleryService.getAvailableVideoModes()); if (StringUtils.isBlank(path)) { listingContext.setDirectories(generateUrlsFromDirectoryPaths(path, contextPath, galleryService.getRootDirectories())); } else { listingContext.setCurrentPathDisplay(path); listingContext.setPreviousPath(getPreviousPath(contextPath, path)); List<GalleryFile> directoryListing = galleryService.getDirectoryListingFiles(path); if (directoryListing == null) { throw new ResourceNotFoundException(); } LOG.debug("{} media files found", directoryListing.size()); List<GalleryFile> galleryImages = directoryListing.stream().filter(gi -> GalleryFileType.IMAGE.equals(gi.getType())) .collect(Collectors.toList()); List<GalleryFileHolder> listing = convertToGalleryFileHolders(contextPath, galleryImages); listingContext.setImages(listing); List<GalleryFile> galleryVideos = directoryListing.stream().filter(gi -> GalleryFileType.VIDEO.equals(gi.getType())) .collect(Collectors.toList()); List<GalleryFileHolder> videoHolders = convertToGalleryFileHolders(contextPath, galleryVideos); listingContext.setVideos(videoHolders); listingContext.setDirectories(generateUrlsFromDirectoryPaths(path, contextPath, galleryService.getDirectories(path))); } return listingContext; } catch (NotAllowedException noe) { LOG.warn("Not allowing resource {}", path); throw new ResourceNotFoundException(); } catch (FileNotFoundException fnfe) { LOG.warn("Could not find resource {}", path); throw new ResourceNotFoundException(); } catch (IOException ioe) { LOG.error("Error when calling getImage", ioe); throw ioe; } }
[ "@", "RequestMapping", "(", "value", "=", "\"/service/**\"", ",", "method", "=", "RequestMethod", ".", "GET", ")", "public", "@", "ResponseBody", "ListingContext", "getListing", "(", "HttpServletRequest", "servletRequest", ",", "Model", "model", ")", "throws", "IO...
Retrieves the listing for a given path (which can be empty). The response can contain media in the shape of {@link GalleryFileHolder} instances as well as sub-directories. @param servletRequest Servlet request @param model Spring web model @return A {@link ListingContext} instance. @throws IOException Sub-types of this exception are thrown for different scenarios, and the {@link IOException} itself for generic errors.
[ "Retrieves", "the", "listing", "for", "a", "given", "path", "(", "which", "can", "be", "empty", ")", ".", "The", "response", "can", "contain", "media", "in", "the", "shape", "of", "{", "@link", "GalleryFileHolder", "}", "instances", "as", "well", "as", "...
train
https://github.com/henkexbg/gallery-api/blob/530e68c225b5e8fc3b608d670b34bd539a5b0a71/src/main/java/com/github/henkexbg/gallery/controller/GalleryController.java#L119-L162
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsInner.java
JobsInner.createOrUpdateAsync
public Observable<JobInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { """ Creates or updates a job. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param jobAgentName The name of the job agent. @param jobName The name of the job to get. @param parameters The requested job state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).map(new Func1<ServiceResponse<JobInner>, JobInner>() { @Override public JobInner call(ServiceResponse<JobInner> response) { return response.body(); } }); }
java
public Observable<JobInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).map(new Func1<ServiceResponse<JobInner>, JobInner>() { @Override public JobInner call(ServiceResponse<JobInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "jobName", ",", "JobInner", "parameters", ")", "{", "return", "createOrUpdateWithService...
Creates or updates a job. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param jobAgentName The name of the job agent. @param jobName The name of the job to get. @param parameters The requested job state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobInner object
[ "Creates", "or", "updates", "a", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobsInner.java#L361-L368
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfObject.java
PdfObject.toPdf
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { """ Writes the PDF representation of this <CODE>PdfObject</CODE> as an array of <CODE>byte</CODE>s to the writer. @param writer for backwards compatibility @param os The <CODE>OutputStream</CODE> to write the bytes to. @throws IOException """ if (bytes != null) os.write(bytes); }
java
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { if (bytes != null) os.write(bytes); }
[ "public", "void", "toPdf", "(", "PdfWriter", "writer", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "if", "(", "bytes", "!=", "null", ")", "os", ".", "write", "(", "bytes", ")", ";", "}" ]
Writes the PDF representation of this <CODE>PdfObject</CODE> as an array of <CODE>byte</CODE>s to the writer. @param writer for backwards compatibility @param os The <CODE>OutputStream</CODE> to write the bytes to. @throws IOException
[ "Writes", "the", "PDF", "representation", "of", "this", "<CODE", ">", "PdfObject<", "/", "CODE", ">", "as", "an", "array", "of", "<CODE", ">", "byte<", "/", "CODE", ">", "s", "to", "the", "writer", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfObject.java#L175-L178
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java
Grid.getGridCellsOn
@Pure public Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) { """ Replies the grid cells that are intersecting the specified bounds. @param bounds the bounds. @return the grid cells. """ return getGridCellsOn(bounds, false); }
java
@Pure public Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) { return getGridCellsOn(bounds, false); }
[ "@", "Pure", "public", "Iterable", "<", "GridCell", "<", "P", ">", ">", "getGridCellsOn", "(", "Rectangle2afp", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", ">", "bounds", ")", "{", "return", "getGridCellsOn", "(", "bounds", ",", "fa...
Replies the grid cells that are intersecting the specified bounds. @param bounds the bounds. @return the grid cells.
[ "Replies", "the", "grid", "cells", "that", "are", "intersecting", "the", "specified", "bounds", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java#L278-L281
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/VfsOld.java
VfsOld.lookup
public static PathImpl lookup(String url, Map<String,Object> attr) { """ Returns a new path, including attributes. <p>For example, an application may want to set locale headers for an HTTP request. @param url the relative url @param attr attributes used in searching for the url """ return getPwd().lookup(url, attr); }
java
public static PathImpl lookup(String url, Map<String,Object> attr) { return getPwd().lookup(url, attr); }
[ "public", "static", "PathImpl", "lookup", "(", "String", "url", ",", "Map", "<", "String", ",", "Object", ">", "attr", ")", "{", "return", "getPwd", "(", ")", ".", "lookup", "(", "url", ",", "attr", ")", ";", "}" ]
Returns a new path, including attributes. <p>For example, an application may want to set locale headers for an HTTP request. @param url the relative url @param attr attributes used in searching for the url
[ "Returns", "a", "new", "path", "including", "attributes", ".", "<p", ">", "For", "example", "an", "application", "may", "want", "to", "set", "locale", "headers", "for", "an", "HTTP", "request", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/VfsOld.java#L191-L194
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/impl/Externalizer.java
Externalizer.externalizeUrlWithoutMapping
public static @NotNull String externalizeUrlWithoutMapping(@NotNull String url, @Nullable SlingHttpServletRequest request) { """ Externalizes an URL without applying Sling Mapping. Instead the servlet context path is added and sling namespace mangling is applied manually. Hostname and scheme are not added because they are added by the link handler depending on site URL configuration and secure/non-secure mode. URLs that are already externalized remain untouched. @param url Unexternalized URL (without scheme or hostname) @param request Request @return Exernalized URL without scheme or hostname, the path is URL-encoded if it contains special chars. """ // apply externalization only path part String path = url; // split off query string or fragment that may be appended to the URL String urlRemainder = null; int urlRemainderPos = StringUtils.indexOfAny(path, '?', '#'); if (urlRemainderPos >= 0) { urlRemainder = path.substring(urlRemainderPos); path = path.substring(0, urlRemainderPos); } // apply namespace mangling (e.g. replace jcr: with _jcr_) path = mangleNamespaces(path); // add webapp context path if (request != null) { path = StringUtils.defaultString(request.getContextPath()) + path; //NOPMD } // url-encode path path = Escape.urlEncode(path); path = StringUtils.replace(path, "+", "%20"); // replace %2F back to / for better readability path = StringUtils.replace(path, "%2F", "/"); // build full URL again return path + (urlRemainder != null ? urlRemainder : ""); }
java
public static @NotNull String externalizeUrlWithoutMapping(@NotNull String url, @Nullable SlingHttpServletRequest request) { // apply externalization only path part String path = url; // split off query string or fragment that may be appended to the URL String urlRemainder = null; int urlRemainderPos = StringUtils.indexOfAny(path, '?', '#'); if (urlRemainderPos >= 0) { urlRemainder = path.substring(urlRemainderPos); path = path.substring(0, urlRemainderPos); } // apply namespace mangling (e.g. replace jcr: with _jcr_) path = mangleNamespaces(path); // add webapp context path if (request != null) { path = StringUtils.defaultString(request.getContextPath()) + path; //NOPMD } // url-encode path path = Escape.urlEncode(path); path = StringUtils.replace(path, "+", "%20"); // replace %2F back to / for better readability path = StringUtils.replace(path, "%2F", "/"); // build full URL again return path + (urlRemainder != null ? urlRemainder : ""); }
[ "public", "static", "@", "NotNull", "String", "externalizeUrlWithoutMapping", "(", "@", "NotNull", "String", "url", ",", "@", "Nullable", "SlingHttpServletRequest", "request", ")", "{", "// apply externalization only path part", "String", "path", "=", "url", ";", "// ...
Externalizes an URL without applying Sling Mapping. Instead the servlet context path is added and sling namespace mangling is applied manually. Hostname and scheme are not added because they are added by the link handler depending on site URL configuration and secure/non-secure mode. URLs that are already externalized remain untouched. @param url Unexternalized URL (without scheme or hostname) @param request Request @return Exernalized URL without scheme or hostname, the path is URL-encoded if it contains special chars.
[ "Externalizes", "an", "URL", "without", "applying", "Sling", "Mapping", ".", "Instead", "the", "servlet", "context", "path", "is", "added", "and", "sling", "namespace", "mangling", "is", "applied", "manually", ".", "Hostname", "and", "scheme", "are", "not", "a...
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/impl/Externalizer.java#L111-L140
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.importImage
public void importImage(String resourceGroupName, String registryName, ImportImageParameters parameters) { """ Copies an image to this container registry from the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param parameters The parameters specifying the image to copy and the source container registry. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().last().body(); }
java
public void importImage(String resourceGroupName, String registryName, ImportImageParameters parameters) { importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().last().body(); }
[ "public", "void", "importImage", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "ImportImageParameters", "parameters", ")", "{", "importImageWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "parameters", ")", ".", "...
Copies an image to this container registry from the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param parameters The parameters specifying the image to copy and the source container registry. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Copies", "an", "image", "to", "this", "container", "registry", "from", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L166-L168
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newWasInvalidatedBy
public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity) { """ A factory method to create an instance of an invalidation {@link WasInvalidatedBy} @param id an optional identifier for a usage @param entity an identifier for the created <a href="http://www.w3.org/TR/prov-dm/#invalidation.entity">entity</a> @param activity an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#invalidation.activity">activity</a> that creates the entity @return an instance of {@link WasInvalidatedBy} """ WasInvalidatedBy res = of.createWasInvalidatedBy(); res.setId(id); res.setEntity(entity); res.setActivity(activity); return res; }
java
public WasInvalidatedBy newWasInvalidatedBy(QualifiedName id, QualifiedName entity, QualifiedName activity) { WasInvalidatedBy res = of.createWasInvalidatedBy(); res.setId(id); res.setEntity(entity); res.setActivity(activity); return res; }
[ "public", "WasInvalidatedBy", "newWasInvalidatedBy", "(", "QualifiedName", "id", ",", "QualifiedName", "entity", ",", "QualifiedName", "activity", ")", "{", "WasInvalidatedBy", "res", "=", "of", ".", "createWasInvalidatedBy", "(", ")", ";", "res", ".", "setId", "(...
A factory method to create an instance of an invalidation {@link WasInvalidatedBy} @param id an optional identifier for a usage @param entity an identifier for the created <a href="http://www.w3.org/TR/prov-dm/#invalidation.entity">entity</a> @param activity an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#invalidation.activity">activity</a> that creates the entity @return an instance of {@link WasInvalidatedBy}
[ "A", "factory", "method", "to", "create", "an", "instance", "of", "an", "invalidation", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1459-L1465
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java
OAuth20HandlerInterceptorAdapter.isDeviceTokenRequest
protected boolean isDeviceTokenRequest(final HttpServletRequest request, final HttpServletResponse response) { """ Is device token request boolean. @param request the request @param response the response @return the boolean """ val requestPath = request.getRequestURI(); val pattern = String.format("(%s)", OAuth20Constants.DEVICE_AUTHZ_URL); return doesUriMatchPattern(requestPath, pattern); }
java
protected boolean isDeviceTokenRequest(final HttpServletRequest request, final HttpServletResponse response) { val requestPath = request.getRequestURI(); val pattern = String.format("(%s)", OAuth20Constants.DEVICE_AUTHZ_URL); return doesUriMatchPattern(requestPath, pattern); }
[ "protected", "boolean", "isDeviceTokenRequest", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ")", "{", "val", "requestPath", "=", "request", ".", "getRequestURI", "(", ")", ";", "val", "pattern", "=", "String", "....
Is device token request boolean. @param request the request @param response the response @return the boolean
[ "Is", "device", "token", "request", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java#L75-L79
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java
CFMLExpressionInterpreter.functionArgDeclaration
private Ref functionArgDeclaration() throws PageException { """ Liest einen gelableten Funktionsparamter ein <br /> EBNF:<br /> <code>assignOp [":" spaces assignOp];</code> @return CFXD Element @throws PageException """ Ref ref = impOp(); if (cfml.forwardIfCurrent(':') || cfml.forwardIfCurrent('=')) { cfml.removeSpace(); ref = new LFunctionValue(ref, assignOp()); } return ref; }
java
private Ref functionArgDeclaration() throws PageException { Ref ref = impOp(); if (cfml.forwardIfCurrent(':') || cfml.forwardIfCurrent('=')) { cfml.removeSpace(); ref = new LFunctionValue(ref, assignOp()); } return ref; }
[ "private", "Ref", "functionArgDeclaration", "(", ")", "throws", "PageException", "{", "Ref", "ref", "=", "impOp", "(", ")", ";", "if", "(", "cfml", ".", "forwardIfCurrent", "(", "'", "'", ")", "||", "cfml", ".", "forwardIfCurrent", "(", "'", "'", ")", ...
Liest einen gelableten Funktionsparamter ein <br /> EBNF:<br /> <code>assignOp [":" spaces assignOp];</code> @return CFXD Element @throws PageException
[ "Liest", "einen", "gelableten", "Funktionsparamter", "ein", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "assignOp", "[", ":", "spaces", "assignOp", "]", ";", "<", "/", "code", ">" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L285-L292
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java
FastaWriterHelper.writeNucleotideSequence
public static void writeNucleotideSequence(File file, Collection<DNASequence> dnaSequences) throws Exception { """ Write a collection of NucleotideSequences to a file @param file @param dnaSequences @throws Exception """ FileOutputStream outputStream = new FileOutputStream(file); BufferedOutputStream bo = new BufferedOutputStream(outputStream); writeNucleotideSequence(bo, dnaSequences); bo.close(); outputStream.close(); }
java
public static void writeNucleotideSequence(File file, Collection<DNASequence> dnaSequences) throws Exception { FileOutputStream outputStream = new FileOutputStream(file); BufferedOutputStream bo = new BufferedOutputStream(outputStream); writeNucleotideSequence(bo, dnaSequences); bo.close(); outputStream.close(); }
[ "public", "static", "void", "writeNucleotideSequence", "(", "File", "file", ",", "Collection", "<", "DNASequence", ">", "dnaSequences", ")", "throws", "Exception", "{", "FileOutputStream", "outputStream", "=", "new", "FileOutputStream", "(", "file", ")", ";", "Buf...
Write a collection of NucleotideSequences to a file @param file @param dnaSequences @throws Exception
[ "Write", "a", "collection", "of", "NucleotideSequences", "to", "a", "file" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java#L119-L125
samskivert/samskivert
src/main/java/com/samskivert/servlet/util/ParameterUtil.java
ParameterUtil.requireIntParameter
public static int requireIntParameter ( HttpServletRequest req, String name, String invalidDataMessage) throws DataValidationException { """ Fetches the supplied parameter from the request and converts it to an integer. If the parameter does not exist or is not a well-formed integer, a data validation exception is thrown with the supplied message. """ return parseIntParameter(getParameter(req, name, false), invalidDataMessage); }
java
public static int requireIntParameter ( HttpServletRequest req, String name, String invalidDataMessage) throws DataValidationException { return parseIntParameter(getParameter(req, name, false), invalidDataMessage); }
[ "public", "static", "int", "requireIntParameter", "(", "HttpServletRequest", "req", ",", "String", "name", ",", "String", "invalidDataMessage", ")", "throws", "DataValidationException", "{", "return", "parseIntParameter", "(", "getParameter", "(", "req", ",", "name", ...
Fetches the supplied parameter from the request and converts it to an integer. If the parameter does not exist or is not a well-formed integer, a data validation exception is thrown with the supplied message.
[ "Fetches", "the", "supplied", "parameter", "from", "the", "request", "and", "converts", "it", "to", "an", "integer", ".", "If", "the", "parameter", "does", "not", "exist", "or", "is", "not", "a", "well", "-", "formed", "integer", "a", "data", "validation",...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ParameterUtil.java#L86-L91
VoltDB/voltdb
src/frontend/org/voltcore/zk/LeaderElector.java
LeaderElector.createParticipantNode
public static String createParticipantNode(ZooKeeper zk, String dir, String prefix, byte[] data) throws KeeperException, InterruptedException { """ Provide a way for clients to create nodes which comply with the leader election format without participating in a leader election @throws InterruptedException @throws KeeperException """ createRootIfNotExist(zk, dir); String node = zk.create(ZKUtil.joinZKPath(dir, prefix + "_"), data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL); // Unlock the dir as initialized zk.setData(dir, new byte[] {INITIALIZED}, -1); return node; }
java
public static String createParticipantNode(ZooKeeper zk, String dir, String prefix, byte[] data) throws KeeperException, InterruptedException { createRootIfNotExist(zk, dir); String node = zk.create(ZKUtil.joinZKPath(dir, prefix + "_"), data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL); // Unlock the dir as initialized zk.setData(dir, new byte[] {INITIALIZED}, -1); return node; }
[ "public", "static", "String", "createParticipantNode", "(", "ZooKeeper", "zk", ",", "String", "dir", ",", "String", "prefix", ",", "byte", "[", "]", "data", ")", "throws", "KeeperException", ",", "InterruptedException", "{", "createRootIfNotExist", "(", "zk", ",...
Provide a way for clients to create nodes which comply with the leader election format without participating in a leader election @throws InterruptedException @throws KeeperException
[ "Provide", "a", "way", "for", "clients", "to", "create", "nodes", "which", "comply", "with", "the", "leader", "election", "format", "without", "participating", "in", "a", "leader", "election" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/LeaderElector.java#L113-L125
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCompositeEntityChild
public OperationStatus deleteCompositeEntityChild(UUID appId, String versionId, UUID cEntityId, UUID cChildId) { """ Deletes a composite entity extractor child from the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param cChildId The hierarchical entity extractor child ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return deleteCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, cChildId).toBlocking().single().body(); }
java
public OperationStatus deleteCompositeEntityChild(UUID appId, String versionId, UUID cEntityId, UUID cChildId) { return deleteCompositeEntityChildWithServiceResponseAsync(appId, versionId, cEntityId, cChildId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteCompositeEntityChild", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "UUID", "cChildId", ")", "{", "return", "deleteCompositeEntityChildWithServiceResponseAsync", "(", "appId", ",", "versionId", ",",...
Deletes a composite entity extractor child from the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param cChildId The hierarchical entity extractor child ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Deletes", "a", "composite", "entity", "extractor", "child", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7022-L7024
stackify/stackify-api-java
src/main/java/com/stackify/api/common/lang/Throwables.java
Throwables.toErrorItemBuilderWithoutCause
private static ErrorItem.Builder toErrorItemBuilderWithoutCause(final String logMessage, final Throwable t) { """ Converts a Throwable to an ErrorItem.Builder and ignores the cause @param logMessage The log message @param t The Throwable to be converted @return The ErrorItem.Builder without the innerError populated """ ErrorItem.Builder builder = ErrorItem.newBuilder(); builder.message(toErrorItemMessage(logMessage, t.getMessage())); builder.errorType(t.getClass().getCanonicalName()); List<TraceFrame> stackFrames = new ArrayList<TraceFrame>(); StackTraceElement[] stackTrace = t.getStackTrace(); if ((stackTrace != null) && (0 < stackTrace.length)) { StackTraceElement firstFrame = stackTrace[0]; builder.sourceMethod(firstFrame.getClassName() + "." + firstFrame.getMethodName()); for (int i = 0; i < stackTrace.length; ++i) { TraceFrame stackFrame = StackTraceElements.toTraceFrame(stackTrace[i]); stackFrames.add(stackFrame); } } builder.stackTrace(stackFrames); return builder; }
java
private static ErrorItem.Builder toErrorItemBuilderWithoutCause(final String logMessage, final Throwable t) { ErrorItem.Builder builder = ErrorItem.newBuilder(); builder.message(toErrorItemMessage(logMessage, t.getMessage())); builder.errorType(t.getClass().getCanonicalName()); List<TraceFrame> stackFrames = new ArrayList<TraceFrame>(); StackTraceElement[] stackTrace = t.getStackTrace(); if ((stackTrace != null) && (0 < stackTrace.length)) { StackTraceElement firstFrame = stackTrace[0]; builder.sourceMethod(firstFrame.getClassName() + "." + firstFrame.getMethodName()); for (int i = 0; i < stackTrace.length; ++i) { TraceFrame stackFrame = StackTraceElements.toTraceFrame(stackTrace[i]); stackFrames.add(stackFrame); } } builder.stackTrace(stackFrames); return builder; }
[ "private", "static", "ErrorItem", ".", "Builder", "toErrorItemBuilderWithoutCause", "(", "final", "String", "logMessage", ",", "final", "Throwable", "t", ")", "{", "ErrorItem", ".", "Builder", "builder", "=", "ErrorItem", ".", "newBuilder", "(", ")", ";", "build...
Converts a Throwable to an ErrorItem.Builder and ignores the cause @param logMessage The log message @param t The Throwable to be converted @return The ErrorItem.Builder without the innerError populated
[ "Converts", "a", "Throwable", "to", "an", "ErrorItem", ".", "Builder", "and", "ignores", "the", "cause" ]
train
https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/lang/Throwables.java#L109-L131
ag-gipp/MathMLTools
mathml-core/src/main/java/com/formulasearchengine/mathmltools/querygenerator/NtcirTopicReader.java
NtcirTopicReader.extractPatterns
public final List<NtcirPattern> extractPatterns() throws XPathExpressionException { """ Splits the given NTCIR query file into individual queries, converts each query into an XQuery using QVarXQueryGenerator, and returns the result as a list of NtcirPatterns for each individual query. @return List of NtcirPatterns for each query @throws XPathExpressionException Thrown if xpaths fail to compile or fail to evaluate + """ final XPath xpath = XMLHelper.namespaceAwareXpath("t", NS_NII); final XPathExpression xNum = xpath.compile("./t:num"); final XPathExpression xFormula = xpath.compile("./t:query/t:formula"); final NonWhitespaceNodeList topicList = new NonWhitespaceNodeList( topics.getElementsByTagNameNS(NS_NII, "topic")); for (final Node node : topicList) { final String num = xNum.evaluate(node); final NonWhitespaceNodeList formulae = new NonWhitespaceNodeList((NodeList) xFormula.evaluate(node, XPathConstants.NODESET)); for (final Node formula : formulae) { final String id = formula.getAttributes().getNamedItem("id").getTextContent(); final Node mathMLNode = NonWhitespaceNodeList.getFirstChild(formula); queryGenerator.setMainElement(NonWhitespaceNodeList.getFirstChild(mathMLNode)); patterns.add(new NtcirPattern(num, id, queryGenerator.toString(), mathMLNode)); } } return patterns; }
java
public final List<NtcirPattern> extractPatterns() throws XPathExpressionException { final XPath xpath = XMLHelper.namespaceAwareXpath("t", NS_NII); final XPathExpression xNum = xpath.compile("./t:num"); final XPathExpression xFormula = xpath.compile("./t:query/t:formula"); final NonWhitespaceNodeList topicList = new NonWhitespaceNodeList( topics.getElementsByTagNameNS(NS_NII, "topic")); for (final Node node : topicList) { final String num = xNum.evaluate(node); final NonWhitespaceNodeList formulae = new NonWhitespaceNodeList((NodeList) xFormula.evaluate(node, XPathConstants.NODESET)); for (final Node formula : formulae) { final String id = formula.getAttributes().getNamedItem("id").getTextContent(); final Node mathMLNode = NonWhitespaceNodeList.getFirstChild(formula); queryGenerator.setMainElement(NonWhitespaceNodeList.getFirstChild(mathMLNode)); patterns.add(new NtcirPattern(num, id, queryGenerator.toString(), mathMLNode)); } } return patterns; }
[ "public", "final", "List", "<", "NtcirPattern", ">", "extractPatterns", "(", ")", "throws", "XPathExpressionException", "{", "final", "XPath", "xpath", "=", "XMLHelper", ".", "namespaceAwareXpath", "(", "\"t\"", ",", "NS_NII", ")", ";", "final", "XPathExpression",...
Splits the given NTCIR query file into individual queries, converts each query into an XQuery using QVarXQueryGenerator, and returns the result as a list of NtcirPatterns for each individual query. @return List of NtcirPatterns for each query @throws XPathExpressionException Thrown if xpaths fail to compile or fail to evaluate +
[ "Splits", "the", "given", "NTCIR", "query", "file", "into", "individual", "queries", "converts", "each", "query", "into", "an", "XQuery", "using", "QVarXQueryGenerator", "and", "returns", "the", "result", "as", "a", "list", "of", "NtcirPatterns", "for", "each", ...
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-core/src/main/java/com/formulasearchengine/mathmltools/querygenerator/NtcirTopicReader.java#L86-L104
shrinkwrap/resolver
maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/ConfigurationUtils.java
ConfigurationUtils.valueAsString
static String valueAsString(Map<String, Object> map, Key key, String defaultValue) { """ Fetches a value specified by key @param map XPP3 map equivalent @param key navigation key @param defaultValue Default value if no such key exists @return String representation of the value """ Validate.notNullOrEmpty(key.key, "Key for plugin configuration must be set"); if (map.containsKey(key.key)) { return map.get(key.key).toString().length() == 0 ? defaultValue : map.get(key.key).toString(); } return defaultValue; }
java
static String valueAsString(Map<String, Object> map, Key key, String defaultValue) { Validate.notNullOrEmpty(key.key, "Key for plugin configuration must be set"); if (map.containsKey(key.key)) { return map.get(key.key).toString().length() == 0 ? defaultValue : map.get(key.key).toString(); } return defaultValue; }
[ "static", "String", "valueAsString", "(", "Map", "<", "String", ",", "Object", ">", "map", ",", "Key", "key", ",", "String", "defaultValue", ")", "{", "Validate", ".", "notNullOrEmpty", "(", "key", ".", "key", ",", "\"Key for plugin configuration must be set\"",...
Fetches a value specified by key @param map XPP3 map equivalent @param key navigation key @param defaultValue Default value if no such key exists @return String representation of the value
[ "Fetches", "a", "value", "specified", "by", "key" ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/ConfigurationUtils.java#L45-L51
vdmeer/asciitable
src/main/java/de/vandermeer/asciitable/CWC_LongestLine.java
CWC_LongestLine.add
public CWC_LongestLine add(final int minWidth, final int maxWidth) { """ Creates a new width object. @param minWidth minimum column width as number of characters @param maxWidth maximum column width as number of characters @return self to allow for chaining """ this.minWidths = ArrayUtils.add(this.minWidths, minWidth); this.maxWidths = ArrayUtils.add(this.maxWidths, maxWidth); return this; }
java
public CWC_LongestLine add(final int minWidth, final int maxWidth) { this.minWidths = ArrayUtils.add(this.minWidths, minWidth); this.maxWidths = ArrayUtils.add(this.maxWidths, maxWidth); return this; }
[ "public", "CWC_LongestLine", "add", "(", "final", "int", "minWidth", ",", "final", "int", "maxWidth", ")", "{", "this", ".", "minWidths", "=", "ArrayUtils", ".", "add", "(", "this", ".", "minWidths", ",", "minWidth", ")", ";", "this", ".", "maxWidths", "...
Creates a new width object. @param minWidth minimum column width as number of characters @param maxWidth maximum column width as number of characters @return self to allow for chaining
[ "Creates", "a", "new", "width", "object", "." ]
train
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/CWC_LongestLine.java#L51-L55
IBM-Cloud/gp-java-client
src/main/java/com/ibm/g11n/pipeline/client/ServiceAccount.java
ServiceAccount.getInstance
public static ServiceAccount getInstance(String url, String instanceId, TokenManager tokenManager) { """ Returns an instance of ServiceAccount for the specified IBM Globalization Pipeline service URL and credentials. <p> All arguments must no be null. @param url The service URL of Globlization Pipeline service. (e.g. https://gp-rest.ng.bluemix.net/translate/rest) @param instanceId The instance ID of the service instance. (e.g. d3f537cd617f34c86ac6b270f3065e73) @param tokenManager IAM Token Manager. @return An instance of ServiceAccount """ if (url.endsWith("/")) { // trim off trailing slash url = url.substring(0, url.length() - 1); } return new ServiceAccount(url, instanceId, tokenManager); }
java
public static ServiceAccount getInstance(String url, String instanceId, TokenManager tokenManager) { if (url.endsWith("/")) { // trim off trailing slash url = url.substring(0, url.length() - 1); } return new ServiceAccount(url, instanceId, tokenManager); }
[ "public", "static", "ServiceAccount", "getInstance", "(", "String", "url", ",", "String", "instanceId", ",", "TokenManager", "tokenManager", ")", "{", "if", "(", "url", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "// trim off trailing slash", "url", "=", "ur...
Returns an instance of ServiceAccount for the specified IBM Globalization Pipeline service URL and credentials. <p> All arguments must no be null. @param url The service URL of Globlization Pipeline service. (e.g. https://gp-rest.ng.bluemix.net/translate/rest) @param instanceId The instance ID of the service instance. (e.g. d3f537cd617f34c86ac6b270f3065e73) @param tokenManager IAM Token Manager. @return An instance of ServiceAccount
[ "Returns", "an", "instance", "of", "ServiceAccount", "for", "the", "specified", "IBM", "Globalization", "Pipeline", "service", "URL", "and", "credentials", ".", "<p", ">", "All", "arguments", "must", "no", "be", "null", "." ]
train
https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/ServiceAccount.java#L206-L215
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/AbstractFullProjection.java
AbstractFullProjection.projectScaledToDataSpace
@Override public <NV extends NumberVector> NV projectScaledToDataSpace(double[] v, NumberVector.Factory<NV> factory) { """ Project a vector from scaled space to data space. @param <NV> Vector type @param v vector in scaled space @param factory Object factory @return vector in data space """ final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getUnscaled(v[d]); } return factory.newNumberVector(vec); }
java
@Override public <NV extends NumberVector> NV projectScaledToDataSpace(double[] v, NumberVector.Factory<NV> factory) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getUnscaled(v[d]); } return factory.newNumberVector(vec); }
[ "@", "Override", "public", "<", "NV", "extends", "NumberVector", ">", "NV", "projectScaledToDataSpace", "(", "double", "[", "]", "v", ",", "NumberVector", ".", "Factory", "<", "NV", ">", "factory", ")", "{", "final", "int", "dim", "=", "v", ".", "length"...
Project a vector from scaled space to data space. @param <NV> Vector type @param v vector in scaled space @param factory Object factory @return vector in data space
[ "Project", "a", "vector", "from", "scaled", "space", "to", "data", "space", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/AbstractFullProjection.java#L163-L171
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java
MathRandom.getCalendar
public Calendar getCalendar(final Calendar min, final Calendar max) { """ Returns a random Calendar object in the range of [min, max]. @param min minimum value for generated Calendar object @param max maximum value for generated Calendar object """ long millis = getLong(min.getTimeInMillis(), max.getTimeInMillis()); return createCalendar(millis); }
java
public Calendar getCalendar(final Calendar min, final Calendar max) { long millis = getLong(min.getTimeInMillis(), max.getTimeInMillis()); return createCalendar(millis); }
[ "public", "Calendar", "getCalendar", "(", "final", "Calendar", "min", ",", "final", "Calendar", "max", ")", "{", "long", "millis", "=", "getLong", "(", "min", ".", "getTimeInMillis", "(", ")", ",", "max", ".", "getTimeInMillis", "(", ")", ")", ";", "retu...
Returns a random Calendar object in the range of [min, max]. @param min minimum value for generated Calendar object @param max maximum value for generated Calendar object
[ "Returns", "a", "random", "Calendar", "object", "in", "the", "range", "of", "[", "min", "max", "]", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L178-L181
meertensinstituut/mtas
src/main/java/mtas/parser/cql/util/MtasCQLParserBasicSentenceCondition.java
MtasCQLParserBasicSentenceCondition.setOccurence
public void setOccurence(int min, int max) throws ParseException { """ Sets the occurence. @param min the min @param max the max @throws ParseException the parse exception """ if (!simplified) { if ((min < 0) || (min > max) || (max < 1)) { throw new ParseException("Illegal number {" + min + "," + max + "}"); } if (min == 0) { optional = true; } minimumOccurence = Math.max(1, min); maximumOccurence = max; } else { throw new ParseException("already simplified"); } }
java
public void setOccurence(int min, int max) throws ParseException { if (!simplified) { if ((min < 0) || (min > max) || (max < 1)) { throw new ParseException("Illegal number {" + min + "," + max + "}"); } if (min == 0) { optional = true; } minimumOccurence = Math.max(1, min); maximumOccurence = max; } else { throw new ParseException("already simplified"); } }
[ "public", "void", "setOccurence", "(", "int", "min", ",", "int", "max", ")", "throws", "ParseException", "{", "if", "(", "!", "simplified", ")", "{", "if", "(", "(", "min", "<", "0", ")", "||", "(", "min", ">", "max", ")", "||", "(", "max", "<", ...
Sets the occurence. @param min the min @param max the max @throws ParseException the parse exception
[ "Sets", "the", "occurence", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/parser/cql/util/MtasCQLParserBasicSentenceCondition.java#L128-L141
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java
Organizer.makeCopies
public static <K> void makeCopies(Map<K, Copier> aFrom, Map<K, Copier> aTo) { """ Copy data from object to object @param <K> the key @param aFrom the object to copy from @param aTo the object to copy to """ makeAuditableCopies(aFrom, aTo, null); }
java
public static <K> void makeCopies(Map<K, Copier> aFrom, Map<K, Copier> aTo) { makeAuditableCopies(aFrom, aTo, null); }
[ "public", "static", "<", "K", ">", "void", "makeCopies", "(", "Map", "<", "K", ",", "Copier", ">", "aFrom", ",", "Map", "<", "K", ",", "Copier", ">", "aTo", ")", "{", "makeAuditableCopies", "(", "aFrom", ",", "aTo", ",", "null", ")", ";", "}" ]
Copy data from object to object @param <K> the key @param aFrom the object to copy from @param aTo the object to copy to
[ "Copy", "data", "from", "object", "to", "object" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java#L832-L835
mockito/mockito
src/main/java/org/mockito/AdditionalAnswers.java
AdditionalAnswers.answersWithDelay
@Incubating public static <T> Answer<T> answersWithDelay(long sleepyTime, Answer<T> answer) { """ Returns an answer after a delay with a defined length. @param <T> return type @param sleepyTime the delay in milliseconds @param answer interface to the answer which provides the intended return value. @return the answer object to use @since 2.8.44 """ return (Answer<T>) new AnswersWithDelay(sleepyTime, (Answer<Object>) answer); }
java
@Incubating public static <T> Answer<T> answersWithDelay(long sleepyTime, Answer<T> answer) { return (Answer<T>) new AnswersWithDelay(sleepyTime, (Answer<Object>) answer); }
[ "@", "Incubating", "public", "static", "<", "T", ">", "Answer", "<", "T", ">", "answersWithDelay", "(", "long", "sleepyTime", ",", "Answer", "<", "T", ">", "answer", ")", "{", "return", "(", "Answer", "<", "T", ">", ")", "new", "AnswersWithDelay", "(",...
Returns an answer after a delay with a defined length. @param <T> return type @param sleepyTime the delay in milliseconds @param answer interface to the answer which provides the intended return value. @return the answer object to use @since 2.8.44
[ "Returns", "an", "answer", "after", "a", "delay", "with", "a", "defined", "length", "." ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/AdditionalAnswers.java#L333-L336
js-lib-com/commons
src/main/java/js/util/Strings.java
Strings.save
public static void save(CharSequence chars, Writer writer) throws IOException { """ Copy source characters to requested output characters stream. If given <code>chars</code> parameter is null or empty this method does nothing. @param chars source characters stream, @param writer target writer. @throws IOException if copy operation fails. """ if(chars != null) { StringReader reader = new StringReader(chars.toString()); Files.copy(reader, writer); } }
java
public static void save(CharSequence chars, Writer writer) throws IOException { if(chars != null) { StringReader reader = new StringReader(chars.toString()); Files.copy(reader, writer); } }
[ "public", "static", "void", "save", "(", "CharSequence", "chars", ",", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "chars", "!=", "null", ")", "{", "StringReader", "reader", "=", "new", "StringReader", "(", "chars", ".", "toString", "...
Copy source characters to requested output characters stream. If given <code>chars</code> parameter is null or empty this method does nothing. @param chars source characters stream, @param writer target writer. @throws IOException if copy operation fails.
[ "Copy", "source", "characters", "to", "requested", "output", "characters", "stream", ".", "If", "given", "<code", ">", "chars<", "/", "code", ">", "parameter", "is", "null", "or", "empty", "this", "method", "does", "nothing", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L1509-L1515
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java
StringUtil.setLength
public static String setLength( String original, int length, char padChar ) { """ Set the length of the string, padding with the supplied character if the supplied string is shorter than desired, or truncating the string if it is longer than desired. Unlike {@link #justifyLeft(String, int, char)}, this method does not remove leading and trailing whitespace. @param original the string for which the length is to be set; may not be null @param length the desired length; must be positive @param padChar the character to use for padding, if the supplied string is not long enough @return the string of the desired length @see #justifyLeft(String, int, char) """ return justifyLeft(original, length, padChar, false); }
java
public static String setLength( String original, int length, char padChar ) { return justifyLeft(original, length, padChar, false); }
[ "public", "static", "String", "setLength", "(", "String", "original", ",", "int", "length", ",", "char", "padChar", ")", "{", "return", "justifyLeft", "(", "original", ",", "length", ",", "padChar", ",", "false", ")", ";", "}" ]
Set the length of the string, padding with the supplied character if the supplied string is shorter than desired, or truncating the string if it is longer than desired. Unlike {@link #justifyLeft(String, int, char)}, this method does not remove leading and trailing whitespace. @param original the string for which the length is to be set; may not be null @param length the desired length; must be positive @param padChar the character to use for padding, if the supplied string is not long enough @return the string of the desired length @see #justifyLeft(String, int, char)
[ "Set", "the", "length", "of", "the", "string", "padding", "with", "the", "supplied", "character", "if", "the", "supplied", "string", "is", "shorter", "than", "desired", "or", "truncating", "the", "string", "if", "it", "is", "longer", "than", "desired", ".", ...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L227-L231
m-m-m/util
value/src/main/java/net/sf/mmm/util/value/impl/ComposedValueConverterFactoryImpl.java
ComposedValueConverterFactoryImpl.setConverters
@Inject public void setConverters(List<ValueConverter<?, ?>> converterList) { """ This method injects a {@link List} of {@link ValueConverter}s to use as default. @param converterList is the list of converters to register. """ getInitializationState().requireNotInitilized(); this.converters = new ArrayList<>(converterList.size()); for (ValueConverter<?, ?> converter : converterList) { if (!(converter instanceof ComposedValueConverter)) { this.converters.add(converter); } } }
java
@Inject public void setConverters(List<ValueConverter<?, ?>> converterList) { getInitializationState().requireNotInitilized(); this.converters = new ArrayList<>(converterList.size()); for (ValueConverter<?, ?> converter : converterList) { if (!(converter instanceof ComposedValueConverter)) { this.converters.add(converter); } } }
[ "@", "Inject", "public", "void", "setConverters", "(", "List", "<", "ValueConverter", "<", "?", ",", "?", ">", ">", "converterList", ")", "{", "getInitializationState", "(", ")", ".", "requireNotInitilized", "(", ")", ";", "this", ".", "converters", "=", "...
This method injects a {@link List} of {@link ValueConverter}s to use as default. @param converterList is the list of converters to register.
[ "This", "method", "injects", "a", "{", "@link", "List", "}", "of", "{", "@link", "ValueConverter", "}", "s", "to", "use", "as", "default", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/value/src/main/java/net/sf/mmm/util/value/impl/ComposedValueConverterFactoryImpl.java#L81-L91
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_rsva_serviceName_allowedRateCodes_GET
public ArrayList<OvhRateCodeInformation> billingAccount_rsva_serviceName_allowedRateCodes_GET(String billingAccount, String serviceName) throws IOException { """ Compatible rate codes related to this value added service REST: GET /telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t18); }
java
public ArrayList<OvhRateCodeInformation> billingAccount_rsva_serviceName_allowedRateCodes_GET(String billingAccount, String serviceName) throws IOException { String qPath = "/telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t18); }
[ "public", "ArrayList", "<", "OvhRateCodeInformation", ">", "billingAccount_rsva_serviceName_allowedRateCodes_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/rsva/{serv...
Compatible rate codes related to this value added service REST: GET /telephony/{billingAccount}/rsva/{serviceName}/allowedRateCodes @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Compatible", "rate", "codes", "related", "to", "this", "value", "added", "service" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6008-L6013
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Setter.java
Setter.setDatePicker
public void setDatePicker(final DatePicker datePicker, final int year, final int monthOfYear, final int dayOfMonth) { """ Sets the date in a given {@link DatePicker}. @param datePicker the {@code DatePicker} object. @param year the year e.g. 2011 @param monthOfYear the month which is starting from zero e.g. 03 @param dayOfMonth the day e.g. 10 """ if(datePicker != null){ Activity activity = activityUtils.getCurrentActivity(false); if(activity != null){ activity.runOnUiThread(new Runnable() { public void run() { try{ datePicker.updateDate(year, monthOfYear, dayOfMonth); }catch (Exception ignored){} } }); } } }
java
public void setDatePicker(final DatePicker datePicker, final int year, final int monthOfYear, final int dayOfMonth) { if(datePicker != null){ Activity activity = activityUtils.getCurrentActivity(false); if(activity != null){ activity.runOnUiThread(new Runnable() { public void run() { try{ datePicker.updateDate(year, monthOfYear, dayOfMonth); }catch (Exception ignored){} } }); } } }
[ "public", "void", "setDatePicker", "(", "final", "DatePicker", "datePicker", ",", "final", "int", "year", ",", "final", "int", "monthOfYear", ",", "final", "int", "dayOfMonth", ")", "{", "if", "(", "datePicker", "!=", "null", ")", "{", "Activity", "activity"...
Sets the date in a given {@link DatePicker}. @param datePicker the {@code DatePicker} object. @param year the year e.g. 2011 @param monthOfYear the month which is starting from zero e.g. 03 @param dayOfMonth the day e.g. 10
[ "Sets", "the", "date", "in", "a", "given", "{", "@link", "DatePicker", "}", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Setter.java#L54-L69
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.getProperty
public static Object getProperty(Object obj, String prop, Object defaultValue) { """ to get a visible Propety (Field or Getter) of a object @param obj Object to invoke @param prop property to call @return property value """ // first try field Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop, null); if (!ArrayUtil.isEmpty(fields)) { try { return fields[0].get(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } // then getter try { char first = prop.charAt(0); if (first >= '0' && first <= '9') return defaultValue; return getGetter(obj.getClass(), prop).invoke(obj); } catch (Throwable e1) { ExceptionUtil.rethrowIfNecessary(e1); return defaultValue; } }
java
public static Object getProperty(Object obj, String prop, Object defaultValue) { // first try field Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop, null); if (!ArrayUtil.isEmpty(fields)) { try { return fields[0].get(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } // then getter try { char first = prop.charAt(0); if (first >= '0' && first <= '9') return defaultValue; return getGetter(obj.getClass(), prop).invoke(obj); } catch (Throwable e1) { ExceptionUtil.rethrowIfNecessary(e1); return defaultValue; } }
[ "public", "static", "Object", "getProperty", "(", "Object", "obj", ",", "String", "prop", ",", "Object", "defaultValue", ")", "{", "// first try field", "Field", "[", "]", "fields", "=", "getFieldsIgnoreCase", "(", "obj", ".", "getClass", "(", ")", ",", "pro...
to get a visible Propety (Field or Getter) of a object @param obj Object to invoke @param prop property to call @return property value
[ "to", "get", "a", "visible", "Propety", "(", "Field", "or", "Getter", ")", "of", "a", "object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1214-L1237
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/Scanner.java
Scanner.scanIdentifier
private Token scanIdentifier(int c) throws IOException { """ The first character has already been scanned when this is called. """ int startLine = mSource.getLineNumber(); int startPos = mSource.getStartPosition(); int endPos = mSource.getEndPosition(); mWord.setLength(0); mWord.append((char)c); loop: while ( (c = mSource.peek()) != -1 ) { switch (c) { case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': case '$': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mSource.read(); endPos = mSource.getEndPosition(); mWord.append((char)c); continue loop; } if (Character.isLetterOrDigit((char)c)) { mSource.read(); endPos = mSource.getEndPosition(); mWord.append((char)c); } else { break; } } int id = Token.findReservedWordID(mWord); Token t; if (id != Token.UNKNOWN) { t = new Token(startLine, startPos, endPos, id); } else { t = new StringToken(startLine, startPos, endPos, Token.IDENT, mWord.toString()); } mWord.setLength(0); return t; }
java
private Token scanIdentifier(int c) throws IOException { int startLine = mSource.getLineNumber(); int startPos = mSource.getStartPosition(); int endPos = mSource.getEndPosition(); mWord.setLength(0); mWord.append((char)c); loop: while ( (c = mSource.peek()) != -1 ) { switch (c) { case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': case '$': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mSource.read(); endPos = mSource.getEndPosition(); mWord.append((char)c); continue loop; } if (Character.isLetterOrDigit((char)c)) { mSource.read(); endPos = mSource.getEndPosition(); mWord.append((char)c); } else { break; } } int id = Token.findReservedWordID(mWord); Token t; if (id != Token.UNKNOWN) { t = new Token(startLine, startPos, endPos, id); } else { t = new StringToken(startLine, startPos, endPos, Token.IDENT, mWord.toString()); } mWord.setLength(0); return t; }
[ "private", "Token", "scanIdentifier", "(", "int", "c", ")", "throws", "IOException", "{", "int", "startLine", "=", "mSource", ".", "getLineNumber", "(", ")", ";", "int", "startPos", "=", "mSource", ".", "getStartPosition", "(", ")", ";", "int", "endPos", "...
The first character has already been scanned when this is called.
[ "The", "first", "character", "has", "already", "been", "scanned", "when", "this", "is", "called", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Scanner.java#L761-L816
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java
VpnGatewaysInner.beginUpdateTagsAsync
public Observable<VpnGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String gatewayName) { """ Updates virtual wan vpn gateway tags. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnGatewayInner object """ return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<VpnGatewayInner>, VpnGatewayInner>() { @Override public VpnGatewayInner call(ServiceResponse<VpnGatewayInner> response) { return response.body(); } }); }
java
public Observable<VpnGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String gatewayName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<VpnGatewayInner>, VpnGatewayInner>() { @Override public VpnGatewayInner call(ServiceResponse<VpnGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnGatewayInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ")", ".", "map", "...
Updates virtual wan vpn gateway tags. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnGatewayInner object
[ "Updates", "virtual", "wan", "vpn", "gateway", "tags", "." ]
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/VpnGatewaysInner.java#L546-L553
iig-uni-freiburg/SEWOL
ext/org/deckfour/spex/SXTag.java
SXTag.addComment
public synchronized void addComment(String comment) throws IOException { """ Adds a comment to this node. <b>WARNING:</b> This will close the last added child node, if applicable! <b>NOTICE:</b> Syntactically spoken, comments act like child nodes. This means, they are treated just like child nodes with respect to indentation and embedding them into the document. Therefore, if you want to add a comment to a specific node, it is advised to add the comment to this node's supernode in advance. This procedure will preserve correct formatting of the resulting document. @param comment Text of the comment to be added (without leading and trailing XML-style comment indicators!). """ // reject modification of already closed node if(isOpen==false) { throw new IOException("Attempted to add comment child node to already closed tag '" + name + "'!"); } if(lastChildNode==null) { // no child nodes yet, close opening tag writer.write(">"); } else { lastChildNode.close(); } // comment starts in new line writer.write("\n"); SXCommentNode commentNode = new SXCommentNode(comment, writer, tabLevel+1, tabString); lastChildNode = commentNode; }
java
public synchronized void addComment(String comment) throws IOException { // reject modification of already closed node if(isOpen==false) { throw new IOException("Attempted to add comment child node to already closed tag '" + name + "'!"); } if(lastChildNode==null) { // no child nodes yet, close opening tag writer.write(">"); } else { lastChildNode.close(); } // comment starts in new line writer.write("\n"); SXCommentNode commentNode = new SXCommentNode(comment, writer, tabLevel+1, tabString); lastChildNode = commentNode; }
[ "public", "synchronized", "void", "addComment", "(", "String", "comment", ")", "throws", "IOException", "{", "// reject modification of already closed node", "if", "(", "isOpen", "==", "false", ")", "{", "throw", "new", "IOException", "(", "\"Attempted to add comment ch...
Adds a comment to this node. <b>WARNING:</b> This will close the last added child node, if applicable! <b>NOTICE:</b> Syntactically spoken, comments act like child nodes. This means, they are treated just like child nodes with respect to indentation and embedding them into the document. Therefore, if you want to add a comment to a specific node, it is advised to add the comment to this node's supernode in advance. This procedure will preserve correct formatting of the resulting document. @param comment Text of the comment to be added (without leading and trailing XML-style comment indicators!).
[ "Adds", "a", "comment", "to", "this", "node", ".", "<b", ">", "WARNING", ":", "<", "/", "b", ">", "This", "will", "close", "the", "last", "added", "child", "node", "if", "applicable!", "<b", ">", "NOTICE", ":", "<", "/", "b", ">", "Syntactically", ...
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/spex/SXTag.java#L204-L219
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/GeometryEngine.java
GeometryEngine.geometryToJson
public static String geometryToJson(int wkid, Geometry geometry) { """ Exports the specified geometry instance to it's JSON representation. See OperatorExportToJson. @see GeometryEngine#geometryToJson(SpatialReference spatialiReference, Geometry geometry) @param wkid The spatial reference Well Known ID to be used for the JSON representation. @param geometry The geometry to be exported to JSON. @return The JSON representation of the specified Geometry. """ return GeometryEngine.geometryToJson( wkid > 0 ? SpatialReference.create(wkid) : null, geometry); }
java
public static String geometryToJson(int wkid, Geometry geometry) { return GeometryEngine.geometryToJson( wkid > 0 ? SpatialReference.create(wkid) : null, geometry); }
[ "public", "static", "String", "geometryToJson", "(", "int", "wkid", ",", "Geometry", "geometry", ")", "{", "return", "GeometryEngine", ".", "geometryToJson", "(", "wkid", ">", "0", "?", "SpatialReference", ".", "create", "(", "wkid", ")", ":", "null", ",", ...
Exports the specified geometry instance to it's JSON representation. See OperatorExportToJson. @see GeometryEngine#geometryToJson(SpatialReference spatialiReference, Geometry geometry) @param wkid The spatial reference Well Known ID to be used for the JSON representation. @param geometry The geometry to be exported to JSON. @return The JSON representation of the specified Geometry.
[ "Exports", "the", "specified", "geometry", "instance", "to", "it", "s", "JSON", "representation", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/GeometryEngine.java#L111-L114
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java
TransitionFactory.getBuilder
public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) { """ Get the model builder for a given transition @param srcState the current VM state @param dstState the current VM state @return the list of possible transitions. {@code null} if no transition is available """ Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState); if (dstCompliant == null) { return null; } return dstCompliant.get(srcState); }
java
public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) { Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState); if (dstCompliant == null) { return null; } return dstCompliant.get(srcState); }
[ "public", "VMTransitionBuilder", "getBuilder", "(", "VMState", "srcState", ",", "VMState", "dstState", ")", "{", "Map", "<", "VMState", ",", "VMTransitionBuilder", ">", "dstCompliant", "=", "vmAMB2", ".", "get", "(", "dstState", ")", ";", "if", "(", "dstCompli...
Get the model builder for a given transition @param srcState the current VM state @param dstState the current VM state @return the list of possible transitions. {@code null} if no transition is available
[ "Get", "the", "model", "builder", "for", "a", "given", "transition" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java#L108-L114
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java
Holiday.isBetween
@Override public boolean isBetween(Date start, Date end) { """ Check whether this holiday occurs at least once between the two dates given. @hide draft / provisional / internal are hidden on Android """ return rule.isBetween(start, end); }
java
@Override public boolean isBetween(Date start, Date end) { return rule.isBetween(start, end); }
[ "@", "Override", "public", "boolean", "isBetween", "(", "Date", "start", ",", "Date", "end", ")", "{", "return", "rule", ".", "isBetween", "(", "start", ",", "end", ")", ";", "}" ]
Check whether this holiday occurs at least once between the two dates given. @hide draft / provisional / internal are hidden on Android
[ "Check", "whether", "this", "holiday", "occurs", "at", "least", "once", "between", "the", "two", "dates", "given", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java#L117-L120
molgenis/molgenis
molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java
PostgreSqlExceptionTranslator.translateNotNullViolation
MolgenisValidationException translateNotNullViolation(PSQLException pSqlException) { """ Package private for testability @param pSqlException PostgreSQL exception @return translated validation exception """ ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage(); String tableName = serverErrorMessage.getTable(); String message = serverErrorMessage.getMessage(); Matcher matcher = Pattern.compile("null value in column \"?(.*?)\"? violates not-null constraint") .matcher(message); boolean matches = matcher.matches(); if (matches) { // exception message when adding data that does not match constraint String columnName = matcher.group(1); EntityTypeDescription entityTypeDescription = entityTypeRegistry.getEntityTypeDescription(tableName); entityTypeDescription.getAttributeDescriptionMap().get(columnName); ConstraintViolation constraintViolation = new ConstraintViolation( format( "The attribute '%s' of entity '%s' can not be null.", tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN), tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN)), null); return new MolgenisValidationException(singleton(constraintViolation)); } else { // exception message when applying constraint on existing data matcher = Pattern.compile("column \"(.*?)\" contains null values").matcher(message); matches = matcher.matches(); if (!matches) { throw new RuntimeException(ERROR_TRANSLATING_EXCEPTION_MSG, pSqlException); } String columnName = matcher.group(1); ConstraintViolation constraintViolation = new ConstraintViolation( format( "The attribute '%s' of entity '%s' contains null values.", tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN), tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN)), null); return new MolgenisValidationException(singleton(constraintViolation)); } }
java
MolgenisValidationException translateNotNullViolation(PSQLException pSqlException) { ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage(); String tableName = serverErrorMessage.getTable(); String message = serverErrorMessage.getMessage(); Matcher matcher = Pattern.compile("null value in column \"?(.*?)\"? violates not-null constraint") .matcher(message); boolean matches = matcher.matches(); if (matches) { // exception message when adding data that does not match constraint String columnName = matcher.group(1); EntityTypeDescription entityTypeDescription = entityTypeRegistry.getEntityTypeDescription(tableName); entityTypeDescription.getAttributeDescriptionMap().get(columnName); ConstraintViolation constraintViolation = new ConstraintViolation( format( "The attribute '%s' of entity '%s' can not be null.", tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN), tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN)), null); return new MolgenisValidationException(singleton(constraintViolation)); } else { // exception message when applying constraint on existing data matcher = Pattern.compile("column \"(.*?)\" contains null values").matcher(message); matches = matcher.matches(); if (!matches) { throw new RuntimeException(ERROR_TRANSLATING_EXCEPTION_MSG, pSqlException); } String columnName = matcher.group(1); ConstraintViolation constraintViolation = new ConstraintViolation( format( "The attribute '%s' of entity '%s' contains null values.", tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN), tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN)), null); return new MolgenisValidationException(singleton(constraintViolation)); } }
[ "MolgenisValidationException", "translateNotNullViolation", "(", "PSQLException", "pSqlException", ")", "{", "ServerErrorMessage", "serverErrorMessage", "=", "pSqlException", ".", "getServerErrorMessage", "(", ")", ";", "String", "tableName", "=", "serverErrorMessage", ".", ...
Package private for testability @param pSqlException PostgreSQL exception @return translated validation exception
[ "Package", "private", "for", "testability" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java#L279-L321
crawljax/crawljax
core/src/main/java/com/crawljax/condition/eventablecondition/EventableConditionChecker.java
EventableConditionChecker.checkXpathStartsWithXpathEventableCondition
public boolean checkXpathStartsWithXpathEventableCondition(Document dom, EventableCondition eventableCondition, String xpath) throws XPathExpressionException { """ Checks whether an XPath expression starts with an XPath eventable condition. @param dom The DOM String. @param eventableCondition The eventable condition. @param xpath The XPath. @return boolean whether xpath starts with xpath location of eventable condition xpath condition @throws XPathExpressionException @throws CrawljaxException when eventableCondition is null or its inXPath has not been set """ if (eventableCondition == null || Strings .isNullOrEmpty(eventableCondition.getInXPath())) { throw new CrawljaxException("Eventable has no XPath condition"); } List<String> expressions = XPathHelper.getXpathForXPathExpressions(dom, eventableCondition.getInXPath()); return checkXPathUnderXPaths(xpath, expressions); }
java
public boolean checkXpathStartsWithXpathEventableCondition(Document dom, EventableCondition eventableCondition, String xpath) throws XPathExpressionException { if (eventableCondition == null || Strings .isNullOrEmpty(eventableCondition.getInXPath())) { throw new CrawljaxException("Eventable has no XPath condition"); } List<String> expressions = XPathHelper.getXpathForXPathExpressions(dom, eventableCondition.getInXPath()); return checkXPathUnderXPaths(xpath, expressions); }
[ "public", "boolean", "checkXpathStartsWithXpathEventableCondition", "(", "Document", "dom", ",", "EventableCondition", "eventableCondition", ",", "String", "xpath", ")", "throws", "XPathExpressionException", "{", "if", "(", "eventableCondition", "==", "null", "||", "Strin...
Checks whether an XPath expression starts with an XPath eventable condition. @param dom The DOM String. @param eventableCondition The eventable condition. @param xpath The XPath. @return boolean whether xpath starts with xpath location of eventable condition xpath condition @throws XPathExpressionException @throws CrawljaxException when eventableCondition is null or its inXPath has not been set
[ "Checks", "whether", "an", "XPath", "expression", "starts", "with", "an", "XPath", "eventable", "condition", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/condition/eventablecondition/EventableConditionChecker.java#L66-L76
radkovo/jStyleParser
src/main/java/org/fit/net/DataURLHandler.java
DataURLHandler.createURL
public static URL createURL(URL base, String urlstring) throws MalformedURLException { """ Creates an URL from string while considering the data: scheme. @param base the base URL used for relative URLs @param urlstring the URL string @return resulting URL @throws MalformedURLException """ if (urlstring.startsWith("data:")) return new URL(null, urlstring, new DataURLHandler()); else { URL ret = new URL(base, urlstring); //fix the incorrect absolute URLs that contain ./ or ../ String path = ret.getPath(); if (path.startsWith("/./") || path.startsWith("/../")) { path = path.substring(1); while (path.startsWith("./") || path.startsWith("../")) { if (path.startsWith("./")) path = path.substring(2); else path = path.substring(3); } URL fixed = new URL(base, "/" + path); log.warn("Normalized non-standard URL %s to %s", ret.toString(), fixed.toString()); ret = fixed; } return ret; } }
java
public static URL createURL(URL base, String urlstring) throws MalformedURLException { if (urlstring.startsWith("data:")) return new URL(null, urlstring, new DataURLHandler()); else { URL ret = new URL(base, urlstring); //fix the incorrect absolute URLs that contain ./ or ../ String path = ret.getPath(); if (path.startsWith("/./") || path.startsWith("/../")) { path = path.substring(1); while (path.startsWith("./") || path.startsWith("../")) { if (path.startsWith("./")) path = path.substring(2); else path = path.substring(3); } URL fixed = new URL(base, "/" + path); log.warn("Normalized non-standard URL %s to %s", ret.toString(), fixed.toString()); ret = fixed; } return ret; } }
[ "public", "static", "URL", "createURL", "(", "URL", "base", ",", "String", "urlstring", ")", "throws", "MalformedURLException", "{", "if", "(", "urlstring", ".", "startsWith", "(", "\"data:\"", ")", ")", "return", "new", "URL", "(", "null", ",", "urlstring",...
Creates an URL from string while considering the data: scheme. @param base the base URL used for relative URLs @param urlstring the URL string @return resulting URL @throws MalformedURLException
[ "Creates", "an", "URL", "from", "string", "while", "considering", "the", "data", ":", "scheme", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/org/fit/net/DataURLHandler.java#L90-L115
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DateTimeUtils.java
DateTimeUtils.zonedDateTimeOf
public static ZonedDateTime zonedDateTimeOf(final long time, final ZoneId zoneId) { """ Utility for creating a ZonedDateTime object from a millisecond timestamp. @param time Milliseconds since Epoch @param zoneId Time zone @return ZonedDateTime representing time """ return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId); }
java
public static ZonedDateTime zonedDateTimeOf(final long time, final ZoneId zoneId) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId); }
[ "public", "static", "ZonedDateTime", "zonedDateTimeOf", "(", "final", "long", "time", ",", "final", "ZoneId", "zoneId", ")", "{", "return", "ZonedDateTime", ".", "ofInstant", "(", "Instant", ".", "ofEpochMilli", "(", "time", ")", ",", "zoneId", ")", ";", "}"...
Utility for creating a ZonedDateTime object from a millisecond timestamp. @param time Milliseconds since Epoch @param zoneId Time zone @return ZonedDateTime representing time
[ "Utility", "for", "creating", "a", "ZonedDateTime", "object", "from", "a", "millisecond", "timestamp", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DateTimeUtils.java#L178-L180
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TableAppender.java
TableAppender.flushRemainingRowsFrom
public void flushRemainingRowsFrom(final XMLUtil util, final Appendable appendable, final int rowIndex) throws IOException { """ Flush all rows from a given position, and do freeze the table @param util a XMLUtil instance for writing XML @param appendable where to write @param rowIndex the first index to use. @throws IOException if an I/O error occurs during the flush """ if (rowIndex == 0) this.appendPreamble(util, appendable); this.appendRows(util, appendable, rowIndex); this.appendPostamble(appendable); }
java
public void flushRemainingRowsFrom(final XMLUtil util, final Appendable appendable, final int rowIndex) throws IOException { if (rowIndex == 0) this.appendPreamble(util, appendable); this.appendRows(util, appendable, rowIndex); this.appendPostamble(appendable); }
[ "public", "void", "flushRemainingRowsFrom", "(", "final", "XMLUtil", "util", ",", "final", "Appendable", "appendable", ",", "final", "int", "rowIndex", ")", "throws", "IOException", "{", "if", "(", "rowIndex", "==", "0", ")", "this", ".", "appendPreamble", "("...
Flush all rows from a given position, and do freeze the table @param util a XMLUtil instance for writing XML @param appendable where to write @param rowIndex the first index to use. @throws IOException if an I/O error occurs during the flush
[ "Flush", "all", "rows", "from", "a", "given", "position", "and", "do", "freeze", "the", "table" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableAppender.java#L118-L124
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java
DependencyExtractors.toDataModel
static IDataModel toDataModel(final InputStream book, final ICellAddress address) { """ Invokes {@link #toDataModel(Workbook, ICellAddress)} with {@link InputStream} converted to {@link Workbook}. """ return toDataModel(ConverterUtils.newWorkbook(book), address); }
java
static IDataModel toDataModel(final InputStream book, final ICellAddress address) { return toDataModel(ConverterUtils.newWorkbook(book), address); }
[ "static", "IDataModel", "toDataModel", "(", "final", "InputStream", "book", ",", "final", "ICellAddress", "address", ")", "{", "return", "toDataModel", "(", "ConverterUtils", ".", "newWorkbook", "(", "book", ")", ",", "address", ")", ";", "}" ]
Invokes {@link #toDataModel(Workbook, ICellAddress)} with {@link InputStream} converted to {@link Workbook}.
[ "Invokes", "{" ]
train
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java#L67-L69
languagetool-org/languagetool
languagetool-language-modules/ca/src/main/java/org/languagetool/tokenizers/ca/CatalanWordTokenizer.java
CatalanWordTokenizer.wordsToAdd
private List<String> wordsToAdd(String s) { """ /* Splits a word containing hyphen(-) if it doesn't exist in the dictionary. """ final List<String> l = new ArrayList<>(); synchronized (this) { //speller is not thread-safe if (!s.isEmpty()) { if (!s.contains("-")) { l.add(s); } else { // words containing hyphen (-) are looked up in the dictionary if (!speller.isMisspelled(s)) { l.add(s); } // words with "ela geminada" with typo: col-legi (col·legi) else if (!speller.isMisspelled(s.replace("l-l", "l·l"))) { l.add(s); } else { // if not found, the word is split final StringTokenizer st2 = new StringTokenizer(s, "-", true); while (st2.hasMoreElements()) { l.add(st2.nextToken()); } } } } return l; } }
java
private List<String> wordsToAdd(String s) { final List<String> l = new ArrayList<>(); synchronized (this) { //speller is not thread-safe if (!s.isEmpty()) { if (!s.contains("-")) { l.add(s); } else { // words containing hyphen (-) are looked up in the dictionary if (!speller.isMisspelled(s)) { l.add(s); } // words with "ela geminada" with typo: col-legi (col·legi) else if (!speller.isMisspelled(s.replace("l-l", "l·l"))) { l.add(s); } else { // if not found, the word is split final StringTokenizer st2 = new StringTokenizer(s, "-", true); while (st2.hasMoreElements()) { l.add(st2.nextToken()); } } } } return l; } }
[ "private", "List", "<", "String", ">", "wordsToAdd", "(", "String", "s", ")", "{", "final", "List", "<", "String", ">", "l", "=", "new", "ArrayList", "<>", "(", ")", ";", "synchronized", "(", "this", ")", "{", "//speller is not thread-safe", "if", "(", ...
/* Splits a word containing hyphen(-) if it doesn't exist in the dictionary.
[ "/", "*", "Splits", "a", "word", "containing", "hyphen", "(", "-", ")", "if", "it", "doesn", "t", "exist", "in", "the", "dictionary", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/ca/src/main/java/org/languagetool/tokenizers/ca/CatalanWordTokenizer.java#L197-L222
youseries/urule
urule-core/src/main/java/com/bstek/urule/model/rete/builder/CriterionBuilder.java
CriterionBuilder.buildNamedCriteria
protected NamedCriteriaNode buildNamedCriteria(NamedCriteria criteria,ConditionNode prevNode,BuildContext context) { """ 带reference name的条件比较特殊,它不需要判断是否有父节点,需要将所有节点都直接挂在ObjectTypeNode下 @param criteria 命名条件对象 @param prevNode 上一节点对象 @param context 上下文对象 @return 返回命名条件节点对象 """ /*if(prevNode!=null){ NamedCriteriaNode targetNode=null; String objectType=context.getObjectType(criteria); String prevObjectType=context.getObjectType(criteria); if(objectType.equals(prevObjectType)){ List<ReteNode> prevChildrenNodes=prevNode.getChildrenNodes(); targetNode = fetchExistNamedCriteriaNode(criteria, prevChildrenNodes); if(targetNode==null){ targetNode=new NamedCriteriaNode(criteria,context.nextId()); prevNode.addLine(targetNode); } }else{ targetNode=buildNewTypeNamedCriteria(criteria,context); } return targetNode; }else{ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }*/ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }
java
protected NamedCriteriaNode buildNamedCriteria(NamedCriteria criteria,ConditionNode prevNode,BuildContext context){ /*if(prevNode!=null){ NamedCriteriaNode targetNode=null; String objectType=context.getObjectType(criteria); String prevObjectType=context.getObjectType(criteria); if(objectType.equals(prevObjectType)){ List<ReteNode> prevChildrenNodes=prevNode.getChildrenNodes(); targetNode = fetchExistNamedCriteriaNode(criteria, prevChildrenNodes); if(targetNode==null){ targetNode=new NamedCriteriaNode(criteria,context.nextId()); prevNode.addLine(targetNode); } }else{ targetNode=buildNewTypeNamedCriteria(criteria,context); } return targetNode; }else{ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }*/ NamedCriteriaNode node=buildNewTypeNamedCriteria(criteria,context); return node; }
[ "protected", "NamedCriteriaNode", "buildNamedCriteria", "(", "NamedCriteria", "criteria", ",", "ConditionNode", "prevNode", ",", "BuildContext", "context", ")", "{", "/*if(prevNode!=null){\n\t\t\tNamedCriteriaNode targetNode=null;\n\t\t\tString objectType=context.getObjectType(criteria);...
带reference name的条件比较特殊,它不需要判断是否有父节点,需要将所有节点都直接挂在ObjectTypeNode下 @param criteria 命名条件对象 @param prevNode 上一节点对象 @param context 上下文对象 @return 返回命名条件节点对象
[ "带reference", "name的条件比较特殊,它不需要判断是否有父节点,需要将所有节点都直接挂在ObjectTypeNode下" ]
train
https://github.com/youseries/urule/blob/3fa0eb4439e97aa292e744bcbd88a9faa36661d8/urule-core/src/main/java/com/bstek/urule/model/rete/builder/CriterionBuilder.java#L79-L101
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java
CDSComparator.compare
@Override public int compare(CDSSequence o1, CDSSequence o2) { """ Used to sort two CDSSequences where Negative Strand makes it tough @param o1 @param o2 @return val """ if(o1.getStrand() != o2.getStrand()){ return o1.getBioBegin() - o2.getBioBegin(); } if(o1.getStrand() == Strand.NEGATIVE){ return -1 * (o1.getBioBegin() - o2.getBioBegin()); } return o1.getBioBegin() - o2.getBioBegin(); }
java
@Override public int compare(CDSSequence o1, CDSSequence o2) { if(o1.getStrand() != o2.getStrand()){ return o1.getBioBegin() - o2.getBioBegin(); } if(o1.getStrand() == Strand.NEGATIVE){ return -1 * (o1.getBioBegin() - o2.getBioBegin()); } return o1.getBioBegin() - o2.getBioBegin(); }
[ "@", "Override", "public", "int", "compare", "(", "CDSSequence", "o1", ",", "CDSSequence", "o2", ")", "{", "if", "(", "o1", ".", "getStrand", "(", ")", "!=", "o2", ".", "getStrand", "(", ")", ")", "{", "return", "o1", ".", "getBioBegin", "(", ")", ...
Used to sort two CDSSequences where Negative Strand makes it tough @param o1 @param o2 @return val
[ "Used", "to", "sort", "two", "CDSSequences", "where", "Negative", "Strand", "makes", "it", "tough" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java#L40-L50
ocpsoft/prettytime
core/src/main/java/org/ocpsoft/prettytime/PrettyTime.java
PrettyTime.registerUnit
public PrettyTime registerUnit(final TimeUnit unit, TimeFormat format) { """ Register the given {@link TimeUnit} and corresponding {@link TimeFormat} instance to be used in calculations. If an entry already exists for the given {@link TimeUnit}, its {@link TimeFormat} will be overwritten with the given {@link TimeFormat}. ({@link TimeUnit} and {@link TimeFormat} must not be <code>null</code>.) """ if (unit == null) throw new IllegalArgumentException("Unit to register must not be null."); if (format == null) throw new IllegalArgumentException("Format to register must not be null."); cachedUnits = null; units.put(unit, format); if (unit instanceof LocaleAware) ((LocaleAware<?>) unit).setLocale(locale); if (format instanceof LocaleAware) ((LocaleAware<?>) format).setLocale(locale); return this; }
java
public PrettyTime registerUnit(final TimeUnit unit, TimeFormat format) { if (unit == null) throw new IllegalArgumentException("Unit to register must not be null."); if (format == null) throw new IllegalArgumentException("Format to register must not be null."); cachedUnits = null; units.put(unit, format); if (unit instanceof LocaleAware) ((LocaleAware<?>) unit).setLocale(locale); if (format instanceof LocaleAware) ((LocaleAware<?>) format).setLocale(locale); return this; }
[ "public", "PrettyTime", "registerUnit", "(", "final", "TimeUnit", "unit", ",", "TimeFormat", "format", ")", "{", "if", "(", "unit", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Unit to register must not be null.\"", ")", ";", "if", "(", ...
Register the given {@link TimeUnit} and corresponding {@link TimeFormat} instance to be used in calculations. If an entry already exists for the given {@link TimeUnit}, its {@link TimeFormat} will be overwritten with the given {@link TimeFormat}. ({@link TimeUnit} and {@link TimeFormat} must not be <code>null</code>.)
[ "Register", "the", "given", "{" ]
train
https://github.com/ocpsoft/prettytime/blob/8a742bd1d8eaacc2a36865d144a43ea0211e25b7/core/src/main/java/org/ocpsoft/prettytime/PrettyTime.java#L652-L667
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCacheManager.java
RemoteCacheManager.getCache
@Override public <K, V> RemoteCache<K, V> getCache(String cacheName) { """ Retrieves a named cache from the remote server if the cache has been defined, otherwise if the cache name is undefined, it will return null. @param cacheName name of cache to retrieve @return a cache instance identified by cacheName or null if the cache name has not been defined """ return getCache(cacheName, configuration.forceReturnValues(), null, null); }
java
@Override public <K, V> RemoteCache<K, V> getCache(String cacheName) { return getCache(cacheName, configuration.forceReturnValues(), null, null); }
[ "@", "Override", "public", "<", "K", ",", "V", ">", "RemoteCache", "<", "K", ",", "V", ">", "getCache", "(", "String", "cacheName", ")", "{", "return", "getCache", "(", "cacheName", ",", "configuration", ".", "forceReturnValues", "(", ")", ",", "null", ...
Retrieves a named cache from the remote server if the cache has been defined, otherwise if the cache name is undefined, it will return null. @param cacheName name of cache to retrieve @return a cache instance identified by cacheName or null if the cache name has not been defined
[ "Retrieves", "a", "named", "cache", "from", "the", "remote", "server", "if", "the", "cache", "has", "been", "defined", "otherwise", "if", "the", "cache", "name", "is", "undefined", "it", "will", "return", "null", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCacheManager.java#L223-L226
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Color.java
Color.scaleCopy
public Color scaleCopy(float value) { """ Scale the components of the colour by the given value @param value The value to scale by @return The copy which has been scaled """ Color copy = new Color(r,g,b,a); copy.r *= value; copy.g *= value; copy.b *= value; copy.a *= value; return copy; }
java
public Color scaleCopy(float value) { Color copy = new Color(r,g,b,a); copy.r *= value; copy.g *= value; copy.b *= value; copy.a *= value; return copy; }
[ "public", "Color", "scaleCopy", "(", "float", "value", ")", "{", "Color", "copy", "=", "new", "Color", "(", "r", ",", "g", ",", "b", ",", "a", ")", ";", "copy", ".", "r", "*=", "value", ";", "copy", ".", "g", "*=", "value", ";", "copy", ".", ...
Scale the components of the colour by the given value @param value The value to scale by @return The copy which has been scaled
[ "Scale", "the", "components", "of", "the", "colour", "by", "the", "given", "value" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Color.java#L383-L391
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java
ElephasModelImport.importElephasSequentialModelAndWeights
public static SparkDl4jMultiLayer importElephasSequentialModelAndWeights(JavaSparkContext sparkContext, String modelHdf5Filename) throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException { """ Load Elephas model stored using model.save(...) in case that the underlying Keras model is a functional `Sequential` instance, which corresponds to a DL4J SparkDl4jMultiLayer. @param sparkContext Java SparkContext @param modelHdf5Filename Path to HDF5 archive storing Elephas model @return SparkDl4jMultiLayer Spark computation graph @throws IOException IO exception @throws InvalidKerasConfigurationException Invalid Keras config @throws UnsupportedKerasConfigurationException Unsupported Keras config @see SparkDl4jMultiLayer """ MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights( modelHdf5Filename, true); Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename); TrainingMaster tm = getTrainingMaster(distributedProperties); return new SparkDl4jMultiLayer(sparkContext, model, tm); }
java
public static SparkDl4jMultiLayer importElephasSequentialModelAndWeights(JavaSparkContext sparkContext, String modelHdf5Filename) throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException { MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights( modelHdf5Filename, true); Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename); TrainingMaster tm = getTrainingMaster(distributedProperties); return new SparkDl4jMultiLayer(sparkContext, model, tm); }
[ "public", "static", "SparkDl4jMultiLayer", "importElephasSequentialModelAndWeights", "(", "JavaSparkContext", "sparkContext", ",", "String", "modelHdf5Filename", ")", "throws", "IOException", ",", "UnsupportedKerasConfigurationException", ",", "InvalidKerasConfigurationException", ...
Load Elephas model stored using model.save(...) in case that the underlying Keras model is a functional `Sequential` instance, which corresponds to a DL4J SparkDl4jMultiLayer. @param sparkContext Java SparkContext @param modelHdf5Filename Path to HDF5 archive storing Elephas model @return SparkDl4jMultiLayer Spark computation graph @throws IOException IO exception @throws InvalidKerasConfigurationException Invalid Keras config @throws UnsupportedKerasConfigurationException Unsupported Keras config @see SparkDl4jMultiLayer
[ "Load", "Elephas", "model", "stored", "using", "model", ".", "save", "(", "...", ")", "in", "case", "that", "the", "underlying", "Keras", "model", "is", "a", "functional", "Sequential", "instance", "which", "corresponds", "to", "a", "DL4J", "SparkDl4jMultiLaye...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java#L92-L102
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java
BeansToExcelOnTemplate.sameValueMergeRows
private void sameValueMergeRows(MergeRow mergeRowAnn, int itemSize, Cell fromCell) { """ 同值纵向合并单元格。 @param mergeRowAnn 纵向合并单元格注解。 @param itemSize 纵向合并行数。 @param fromCell 开始合并单元格。 """ String lastValue = PoiUtil.getCellStringValue(fromCell); int preRow = fromCell.getRowIndex(); val col = fromCell.getColumnIndex(); int i = preRow + 1; for (final int ii = preRow + itemSize; i < ii; ++i) { val cell = sheet.getRow(i).getCell(col); val cellValue = PoiUtil.getCellStringValue(cell); if (StringUtils.equals(cellValue, lastValue)) continue; directMergeRows(mergeRowAnn, preRow, i - 1, col); lastValue = cellValue; preRow = i; } directMergeRows(mergeRowAnn, preRow, i - 1, col); }
java
private void sameValueMergeRows(MergeRow mergeRowAnn, int itemSize, Cell fromCell) { String lastValue = PoiUtil.getCellStringValue(fromCell); int preRow = fromCell.getRowIndex(); val col = fromCell.getColumnIndex(); int i = preRow + 1; for (final int ii = preRow + itemSize; i < ii; ++i) { val cell = sheet.getRow(i).getCell(col); val cellValue = PoiUtil.getCellStringValue(cell); if (StringUtils.equals(cellValue, lastValue)) continue; directMergeRows(mergeRowAnn, preRow, i - 1, col); lastValue = cellValue; preRow = i; } directMergeRows(mergeRowAnn, preRow, i - 1, col); }
[ "private", "void", "sameValueMergeRows", "(", "MergeRow", "mergeRowAnn", ",", "int", "itemSize", ",", "Cell", "fromCell", ")", "{", "String", "lastValue", "=", "PoiUtil", ".", "getCellStringValue", "(", "fromCell", ")", ";", "int", "preRow", "=", "fromCell", "...
同值纵向合并单元格。 @param mergeRowAnn 纵向合并单元格注解。 @param itemSize 纵向合并行数。 @param fromCell 开始合并单元格。
[ "同值纵向合并单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L152-L169
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java
DatabasesInner.listByServerWithServiceResponseAsync
public Observable<ServiceResponse<Page<DatabaseInner>>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName) { """ Gets a list of databases. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DatabaseInner&gt; object """ return listByServerSinglePageAsync(resourceGroupName, serverName) .concatMap(new Func1<ServiceResponse<Page<DatabaseInner>>, Observable<ServiceResponse<Page<DatabaseInner>>>>() { @Override public Observable<ServiceResponse<Page<DatabaseInner>>> call(ServiceResponse<Page<DatabaseInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DatabaseInner>>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName) { return listByServerSinglePageAsync(resourceGroupName, serverName) .concatMap(new Func1<ServiceResponse<Page<DatabaseInner>>, Observable<ServiceResponse<Page<DatabaseInner>>>>() { @Override public Observable<ServiceResponse<Page<DatabaseInner>>> call(ServiceResponse<Page<DatabaseInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DatabaseInner", ">", ">", ">", "listByServerWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ")", "{", "return", "listByServerSinglePageAsync"...
Gets a list of databases. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DatabaseInner&gt; object
[ "Gets", "a", "list", "of", "databases", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L210-L222
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/MediaIntents.java
MediaIntents.newOpenWebBrowserIntent
public static Intent newOpenWebBrowserIntent(String url) { """ Creates an intent that will launch a browser (most probably as other apps may handle specific URLs, e.g. YouTube) to view the provided URL. @param url the URL to open @return the intent """ if (!url.startsWith("https://") && !url.startsWith("http://")) { url = "http://" + url; } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); return intent; }
java
public static Intent newOpenWebBrowserIntent(String url) { if (!url.startsWith("https://") && !url.startsWith("http://")) { url = "http://" + url; } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); return intent; }
[ "public", "static", "Intent", "newOpenWebBrowserIntent", "(", "String", "url", ")", "{", "if", "(", "!", "url", ".", "startsWith", "(", "\"https://\"", ")", "&&", "!", "url", ".", "startsWith", "(", "\"http://\"", ")", ")", "{", "url", "=", "\"http://\"", ...
Creates an intent that will launch a browser (most probably as other apps may handle specific URLs, e.g. YouTube) to view the provided URL. @param url the URL to open @return the intent
[ "Creates", "an", "intent", "that", "will", "launch", "a", "browser", "(", "most", "probably", "as", "other", "apps", "may", "handle", "specific", "URLs", "e", ".", "g", ".", "YouTube", ")", "to", "view", "the", "provided", "URL", "." ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/MediaIntents.java#L195-L201
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/api/TokenService.java
TokenService.updateToken
@Patch("/tokens/ { """ PATCH /tokens/{appId} <p>Activates or deactivates the token of the specified {@code appId}. """appId}") @Consumes("application/json-patch+json") public CompletableFuture<Token> updateToken(ServiceRequestContext ctx, @Param("appId") String appId, JsonNode node, Author author, User loginUser) { if (node.equals(activation)) { return getTokenOrRespondForbidden(ctx, appId, loginUser).thenCompose( token -> mds.activateToken(author, appId) .thenApply(unused -> token.withoutSecret())); } if (node.equals(deactivation)) { return getTokenOrRespondForbidden(ctx, appId, loginUser).thenCompose( token -> mds.deactivateToken(author, appId) .thenApply(unused -> token.withoutSecret())); } throw new IllegalArgumentException("Unsupported JSON patch: " + node + " (expected: " + activation + " or " + deactivation + ')'); }
java
@Patch("/tokens/{appId}") @Consumes("application/json-patch+json") public CompletableFuture<Token> updateToken(ServiceRequestContext ctx, @Param("appId") String appId, JsonNode node, Author author, User loginUser) { if (node.equals(activation)) { return getTokenOrRespondForbidden(ctx, appId, loginUser).thenCompose( token -> mds.activateToken(author, appId) .thenApply(unused -> token.withoutSecret())); } if (node.equals(deactivation)) { return getTokenOrRespondForbidden(ctx, appId, loginUser).thenCompose( token -> mds.deactivateToken(author, appId) .thenApply(unused -> token.withoutSecret())); } throw new IllegalArgumentException("Unsupported JSON patch: " + node + " (expected: " + activation + " or " + deactivation + ')'); }
[ "@", "Patch", "(", "\"/tokens/{appId}\"", ")", "@", "Consumes", "(", "\"application/json-patch+json\"", ")", "public", "CompletableFuture", "<", "Token", ">", "updateToken", "(", "ServiceRequestContext", "ctx", ",", "@", "Param", "(", "\"appId\"", ")", "String", "...
PATCH /tokens/{appId} <p>Activates or deactivates the token of the specified {@code appId}.
[ "PATCH", "/", "tokens", "/", "{", "appId", "}" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/TokenService.java#L140-L157
graknlabs/grakn
server/src/graql/gremlin/sets/EquivalentFragmentSets.java
EquivalentFragmentSets.dataType
public static EquivalentFragmentSet dataType(VarProperty varProperty, Variable resourceType, AttributeType.DataType<?> dataType) { """ An {@link EquivalentFragmentSet} that indicates a variable representing a resource type with a data-type. """ return new AutoValue_DataTypeFragmentSet(varProperty, resourceType, dataType); }
java
public static EquivalentFragmentSet dataType(VarProperty varProperty, Variable resourceType, AttributeType.DataType<?> dataType) { return new AutoValue_DataTypeFragmentSet(varProperty, resourceType, dataType); }
[ "public", "static", "EquivalentFragmentSet", "dataType", "(", "VarProperty", "varProperty", ",", "Variable", "resourceType", ",", "AttributeType", ".", "DataType", "<", "?", ">", "dataType", ")", "{", "return", "new", "AutoValue_DataTypeFragmentSet", "(", "varProperty...
An {@link EquivalentFragmentSet} that indicates a variable representing a resource type with a data-type.
[ "An", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/EquivalentFragmentSets.java#L157-L159
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/codec/CCITTG4Encoder.java
CCITTG4Encoder.fax4Encode
public void fax4Encode(byte[] data, int offset, int size) { """ Encodes a number of lines. @param data the data to be encoded @param offset the offset into the data @param size the size of the data to be encoded """ dataBp = data; offsetData = offset; sizeData = size; while (sizeData > 0) { Fax3Encode2DRow(); System.arraycopy(dataBp, offsetData, refline, 0, rowbytes); offsetData += rowbytes; sizeData -= rowbytes; } }
java
public void fax4Encode(byte[] data, int offset, int size) { dataBp = data; offsetData = offset; sizeData = size; while (sizeData > 0) { Fax3Encode2DRow(); System.arraycopy(dataBp, offsetData, refline, 0, rowbytes); offsetData += rowbytes; sizeData -= rowbytes; } }
[ "public", "void", "fax4Encode", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "size", ")", "{", "dataBp", "=", "data", ";", "offsetData", "=", "offset", ";", "sizeData", "=", "size", ";", "while", "(", "sizeData", ">", "0", ")", ...
Encodes a number of lines. @param data the data to be encoded @param offset the offset into the data @param size the size of the data to be encoded
[ "Encodes", "a", "number", "of", "lines", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/codec/CCITTG4Encoder.java#L83-L93
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/RepositoryException.java
RepositoryException.toFetchException
public final FetchException toFetchException(final String message) { """ Converts RepositoryException into an appropriate FetchException, prepending the specified message. If message is null, original exception message is preserved. @param message message to prepend, which may be null """ Throwable cause; if (this instanceof FetchException) { cause = this; } else { cause = getCause(); } if (cause == null) { cause = this; } else if (cause instanceof FetchException && message == null) { return (FetchException) cause; } String causeMessage = cause.getMessage(); if (causeMessage == null) { causeMessage = message; } else if (message != null) { causeMessage = message + " : " + causeMessage; } return makeFetchException(causeMessage, cause); }
java
public final FetchException toFetchException(final String message) { Throwable cause; if (this instanceof FetchException) { cause = this; } else { cause = getCause(); } if (cause == null) { cause = this; } else if (cause instanceof FetchException && message == null) { return (FetchException) cause; } String causeMessage = cause.getMessage(); if (causeMessage == null) { causeMessage = message; } else if (message != null) { causeMessage = message + " : " + causeMessage; } return makeFetchException(causeMessage, cause); }
[ "public", "final", "FetchException", "toFetchException", "(", "final", "String", "message", ")", "{", "Throwable", "cause", ";", "if", "(", "this", "instanceof", "FetchException", ")", "{", "cause", "=", "this", ";", "}", "else", "{", "cause", "=", "getCause...
Converts RepositoryException into an appropriate FetchException, prepending the specified message. If message is null, original exception message is preserved. @param message message to prepend, which may be null
[ "Converts", "RepositoryException", "into", "an", "appropriate", "FetchException", "prepending", "the", "specified", "message", ".", "If", "message", "is", "null", "original", "exception", "message", "is", "preserved", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/RepositoryException.java#L177-L199
3pillarlabs/spring-data-simpledb
spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/query/SimpleDbQueryMethod.java
SimpleDbQueryMethod.getAnnotationValue
private <T> T getAnnotationValue(String attribute, Class<T> type) { """ Returns the {@link Query} annotation's attribute casted to the given type or default value if no annotation available. @param attribute @param type @return """ Query annotation = method.getAnnotation(Query.class); Object value = annotation == null ? AnnotationUtils.getDefaultValue(Query.class, attribute) : AnnotationUtils .getValue(annotation, attribute); return type.cast(value); }
java
private <T> T getAnnotationValue(String attribute, Class<T> type) { Query annotation = method.getAnnotation(Query.class); Object value = annotation == null ? AnnotationUtils.getDefaultValue(Query.class, attribute) : AnnotationUtils .getValue(annotation, attribute); return type.cast(value); }
[ "private", "<", "T", ">", "T", "getAnnotationValue", "(", "String", "attribute", ",", "Class", "<", "T", ">", "type", ")", "{", "Query", "annotation", "=", "method", ".", "getAnnotation", "(", "Query", ".", "class", ")", ";", "Object", "value", "=", "a...
Returns the {@link Query} annotation's attribute casted to the given type or default value if no annotation available. @param attribute @param type @return
[ "Returns", "the", "{", "@link", "Query", "}", "annotation", "s", "attribute", "casted", "to", "the", "given", "type", "or", "default", "value", "if", "no", "annotation", "available", "." ]
train
https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/query/SimpleDbQueryMethod.java#L108-L115
line/armeria
core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java
HttpFileServiceBuilder.cacheControl
public HttpFileServiceBuilder cacheControl(CharSequence cacheControl) { """ Sets the {@code "cache-control"} header. This method is a shortcut of: <pre>{@code builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }</pre> """ requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
java
public HttpFileServiceBuilder cacheControl(CharSequence cacheControl) { requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
[ "public", "HttpFileServiceBuilder", "cacheControl", "(", "CharSequence", "cacheControl", ")", "{", "requireNonNull", "(", "cacheControl", ",", "\"cacheControl\"", ")", ";", "return", "setHeader", "(", "HttpHeaderNames", ".", "CACHE_CONTROL", ",", "cacheControl", ")", ...
Sets the {@code "cache-control"} header. This method is a shortcut of: <pre>{@code builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }</pre>
[ "Sets", "the", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java#L217-L220
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmLineBreakpointPropertyPage.java
VdmLineBreakpointPropertyPage.createConditionEditor
private void createConditionEditor(Composite parent) throws CoreException { """ Creates the controls that allow the user to specify the breakpoint's condition @param parent the composite in which the condition editor should be created @throws CoreException if an exception occurs accessing the breakpoint """ IVdmLineBreakpoint breakpoint = (IVdmLineBreakpoint) getBreakpoint(); String label = null; // if (BreakpointUtils.getType(breakpoint) != null) { // IBindingService bindingService = // (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class); // if(bindingService != null) { // TriggerSequence keyBinding = // bindingService.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); // if (keyBinding != null) { // label = MessageFormat.format("messageFormat", new String[] {keyBinding.format()}); // } // } // } if (label == null) { label = "Enable Condition"; } Composite conditionComposite = SWTFactory.createGroup(parent, EMPTY_STRING, 1, 1, GridData.FILL_BOTH); fEnableConditionButton = createCheckButton(conditionComposite, label); fEnableConditionButton.setSelection(breakpoint.getExpressionState()); fEnableConditionButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setConditionEnabled(fEnableConditionButton.getSelection()); } }); fConditionEditor = new BreakpointConditionEditor(conditionComposite, this); fSuspendWhenLabel = createLabel(conditionComposite, "Suspend when:"); fConditionIsTrue = createRadioButton(conditionComposite, "condition is 'true'"); fConditionHasChanged = createRadioButton(conditionComposite, "value of condition changes"); // if (breakpoint.isConditionSuspendOnTrue()) { // fConditionIsTrue.setSelection(true); // } // else { fConditionHasChanged.setSelection(true); // } setConditionEnabled(fEnableConditionButton.getSelection()); }
java
private void createConditionEditor(Composite parent) throws CoreException { IVdmLineBreakpoint breakpoint = (IVdmLineBreakpoint) getBreakpoint(); String label = null; // if (BreakpointUtils.getType(breakpoint) != null) { // IBindingService bindingService = // (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class); // if(bindingService != null) { // TriggerSequence keyBinding = // bindingService.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); // if (keyBinding != null) { // label = MessageFormat.format("messageFormat", new String[] {keyBinding.format()}); // } // } // } if (label == null) { label = "Enable Condition"; } Composite conditionComposite = SWTFactory.createGroup(parent, EMPTY_STRING, 1, 1, GridData.FILL_BOTH); fEnableConditionButton = createCheckButton(conditionComposite, label); fEnableConditionButton.setSelection(breakpoint.getExpressionState()); fEnableConditionButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setConditionEnabled(fEnableConditionButton.getSelection()); } }); fConditionEditor = new BreakpointConditionEditor(conditionComposite, this); fSuspendWhenLabel = createLabel(conditionComposite, "Suspend when:"); fConditionIsTrue = createRadioButton(conditionComposite, "condition is 'true'"); fConditionHasChanged = createRadioButton(conditionComposite, "value of condition changes"); // if (breakpoint.isConditionSuspendOnTrue()) { // fConditionIsTrue.setSelection(true); // } // else { fConditionHasChanged.setSelection(true); // } setConditionEnabled(fEnableConditionButton.getSelection()); }
[ "private", "void", "createConditionEditor", "(", "Composite", "parent", ")", "throws", "CoreException", "{", "IVdmLineBreakpoint", "breakpoint", "=", "(", "IVdmLineBreakpoint", ")", "getBreakpoint", "(", ")", ";", "String", "label", "=", "null", ";", "// if (Breakpo...
Creates the controls that allow the user to specify the breakpoint's condition @param parent the composite in which the condition editor should be created @throws CoreException if an exception occurs accessing the breakpoint
[ "Creates", "the", "controls", "that", "allow", "the", "user", "to", "specify", "the", "breakpoint", "s", "condition" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmLineBreakpointPropertyPage.java#L218-L259
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/tools/MungeCsv.java
MungeCsv.parseDataRow
private static RowData parseDataRow(String line, GenMunger munger) { """ This CSV parser is as bare bones as it gets. Our test data doesn't have funny quoting, spacing, or other issues. Can't handle cases where the number of data columns is less than the number of header columns. """ if( line.isEmpty() || line.equals("") ) return null; String[] inputData = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)|(,)", -1); for(int i=0;i<inputData.length;++i) inputData[i]=inputData[i]==null?"":inputData[i]; if( inputData.length != munger.inNames().length ) return null; return munger.fillDefault(inputData); }
java
private static RowData parseDataRow(String line, GenMunger munger) { if( line.isEmpty() || line.equals("") ) return null; String[] inputData = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)|(,)", -1); for(int i=0;i<inputData.length;++i) inputData[i]=inputData[i]==null?"":inputData[i]; if( inputData.length != munger.inNames().length ) return null; return munger.fillDefault(inputData); }
[ "private", "static", "RowData", "parseDataRow", "(", "String", "line", ",", "GenMunger", "munger", ")", "{", "if", "(", "line", ".", "isEmpty", "(", ")", "||", "line", ".", "equals", "(", "\"\"", ")", ")", "return", "null", ";", "String", "[", "]", "...
This CSV parser is as bare bones as it gets. Our test data doesn't have funny quoting, spacing, or other issues. Can't handle cases where the number of data columns is less than the number of header columns.
[ "This", "CSV", "parser", "is", "as", "bare", "bones", "as", "it", "gets", ".", "Our", "test", "data", "doesn", "t", "have", "funny", "quoting", "spacing", "or", "other", "issues", ".", "Can", "t", "handle", "cases", "where", "the", "number", "of", "dat...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/tools/MungeCsv.java#L92-L101
Harium/keel
src/main/java/jdt/triangulation/DelaunayTriangulation.java
DelaunayTriangulation.insertPoint
public void insertPoint(Set<Vector3> vertices, Vector3 p) { """ insert the point to this Delaunay Triangulation. Note: if p is null or already exist in this triangulation p is ignored. @param vertices @param p new vertex to be inserted the triangulation. """ modCount++; updateBoundingBox(p); vertices.add(p); Triangle t = insertPointSimple(vertices, p); if (t == null) // return; Triangle tt = t; //currT = t; // recall the last point for - fast (last) update iterator. do { flip(tt, modCount); tt = tt.canext; } while (tt != t && !tt.halfplane); // Update index with changed triangles /*if(gridIndex != null) { gridIndex.updateIndex(getLastUpdatedTriangles()); }*/ }
java
public void insertPoint(Set<Vector3> vertices, Vector3 p) { modCount++; updateBoundingBox(p); vertices.add(p); Triangle t = insertPointSimple(vertices, p); if (t == null) // return; Triangle tt = t; //currT = t; // recall the last point for - fast (last) update iterator. do { flip(tt, modCount); tt = tt.canext; } while (tt != t && !tt.halfplane); // Update index with changed triangles /*if(gridIndex != null) { gridIndex.updateIndex(getLastUpdatedTriangles()); }*/ }
[ "public", "void", "insertPoint", "(", "Set", "<", "Vector3", ">", "vertices", ",", "Vector3", "p", ")", "{", "modCount", "++", ";", "updateBoundingBox", "(", "p", ")", ";", "vertices", ".", "add", "(", "p", ")", ";", "Triangle", "t", "=", "insertPointS...
insert the point to this Delaunay Triangulation. Note: if p is null or already exist in this triangulation p is ignored. @param vertices @param p new vertex to be inserted the triangulation.
[ "insert", "the", "point", "to", "this", "Delaunay", "Triangulation", ".", "Note", ":", "if", "p", "is", "null", "or", "already", "exist", "in", "this", "triangulation", "p", "is", "ignored", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/DelaunayTriangulation.java#L123-L144
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/html/HtmlBuilder.java
HtmlBuilder.doBegin
private void doBegin(String element, String id, String cssClass) throws IOException { """ Begin an element without closing (no ending &gt;). @param element tag name @param id element ID @param cssClass CSS class name """ writer.write('<'); writer.write(element); attr("id", id); attr("class", cssClass); }
java
private void doBegin(String element, String id, String cssClass) throws IOException { writer.write('<'); writer.write(element); attr("id", id); attr("class", cssClass); }
[ "private", "void", "doBegin", "(", "String", "element", ",", "String", "id", ",", "String", "cssClass", ")", "throws", "IOException", "{", "writer", ".", "write", "(", "'", "'", ")", ";", "writer", ".", "write", "(", "element", ")", ";", "attr", "(", ...
Begin an element without closing (no ending &gt;). @param element tag name @param id element ID @param cssClass CSS class name
[ "Begin", "an", "element", "without", "closing", "(", "no", "ending", "&gt", ";", ")", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/html/HtmlBuilder.java#L43-L48
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJNumberFormat.java
MPXJNumberFormat.applyPattern
public void applyPattern(String primaryPattern, String[] alternativePatterns, char decimalSeparator, char groupingSeparator) { """ This method is used to configure the primary and alternative format patterns. @param primaryPattern new format pattern @param alternativePatterns alternative format patterns @param decimalSeparator Locale specific decimal separator to replace placeholder @param groupingSeparator Locale specific grouping separator to replace placeholder """ m_symbols.setDecimalSeparator(decimalSeparator); m_symbols.setGroupingSeparator(groupingSeparator); setDecimalFormatSymbols(m_symbols); applyPattern(primaryPattern); if (alternativePatterns != null && alternativePatterns.length != 0) { int loop; if (m_alternativeFormats == null || m_alternativeFormats.length != alternativePatterns.length) { m_alternativeFormats = new DecimalFormat[alternativePatterns.length]; for (loop = 0; loop < alternativePatterns.length; loop++) { m_alternativeFormats[loop] = new DecimalFormat(); } } for (loop = 0; loop < alternativePatterns.length; loop++) { m_alternativeFormats[loop].setDecimalFormatSymbols(m_symbols); m_alternativeFormats[loop].applyPattern(alternativePatterns[loop]); } } }
java
public void applyPattern(String primaryPattern, String[] alternativePatterns, char decimalSeparator, char groupingSeparator) { m_symbols.setDecimalSeparator(decimalSeparator); m_symbols.setGroupingSeparator(groupingSeparator); setDecimalFormatSymbols(m_symbols); applyPattern(primaryPattern); if (alternativePatterns != null && alternativePatterns.length != 0) { int loop; if (m_alternativeFormats == null || m_alternativeFormats.length != alternativePatterns.length) { m_alternativeFormats = new DecimalFormat[alternativePatterns.length]; for (loop = 0; loop < alternativePatterns.length; loop++) { m_alternativeFormats[loop] = new DecimalFormat(); } } for (loop = 0; loop < alternativePatterns.length; loop++) { m_alternativeFormats[loop].setDecimalFormatSymbols(m_symbols); m_alternativeFormats[loop].applyPattern(alternativePatterns[loop]); } } }
[ "public", "void", "applyPattern", "(", "String", "primaryPattern", ",", "String", "[", "]", "alternativePatterns", ",", "char", "decimalSeparator", ",", "char", "groupingSeparator", ")", "{", "m_symbols", ".", "setDecimalSeparator", "(", "decimalSeparator", ")", ";"...
This method is used to configure the primary and alternative format patterns. @param primaryPattern new format pattern @param alternativePatterns alternative format patterns @param decimalSeparator Locale specific decimal separator to replace placeholder @param groupingSeparator Locale specific grouping separator to replace placeholder
[ "This", "method", "is", "used", "to", "configure", "the", "primary", "and", "alternative", "format", "patterns", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJNumberFormat.java#L47-L73
jayantk/jklol
src/com/jayantkrish/jklol/p3/P3Parse.java
P3Parse.getUnevaluatedLogicalForm
public Expression2 getUnevaluatedLogicalForm(Environment env, IndexedList<String> symbolTable) { """ Gets an expression that evaluates to the denotation of this parse. The expression will not re-evaluate any already evaluated subexpressions of this parse. {@code env} may be extended with additional variable bindings to capture denotations of already-evaluated subparses. @param env @param symbolTable @return """ List<String> newBindings = Lists.newArrayList(); return getUnevaluatedLogicalForm(env, symbolTable, newBindings); }
java
public Expression2 getUnevaluatedLogicalForm(Environment env, IndexedList<String> symbolTable) { List<String> newBindings = Lists.newArrayList(); return getUnevaluatedLogicalForm(env, symbolTable, newBindings); }
[ "public", "Expression2", "getUnevaluatedLogicalForm", "(", "Environment", "env", ",", "IndexedList", "<", "String", ">", "symbolTable", ")", "{", "List", "<", "String", ">", "newBindings", "=", "Lists", ".", "newArrayList", "(", ")", ";", "return", "getUnevaluat...
Gets an expression that evaluates to the denotation of this parse. The expression will not re-evaluate any already evaluated subexpressions of this parse. {@code env} may be extended with additional variable bindings to capture denotations of already-evaluated subparses. @param env @param symbolTable @return
[ "Gets", "an", "expression", "that", "evaluates", "to", "the", "denotation", "of", "this", "parse", ".", "The", "expression", "will", "not", "re", "-", "evaluate", "any", "already", "evaluated", "subexpressions", "of", "this", "parse", ".", "{", "@code", "env...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/p3/P3Parse.java#L173-L176
google/flatbuffers
java/com/google/flatbuffers/Utf8Safe.java
Utf8Safe.decodeUtf8
@Override public String decodeUtf8(ByteBuffer buffer, int offset, int length) throws IllegalArgumentException { """ Decodes the given UTF-8 portion of the {@link ByteBuffer} into a {@link String}. @throws IllegalArgumentException if the input is not valid UTF-8. """ if (buffer.hasArray()) { return decodeUtf8Array(buffer.array(), buffer.arrayOffset() + offset, length); } else { return decodeUtf8Buffer(buffer, offset, length); } }
java
@Override public String decodeUtf8(ByteBuffer buffer, int offset, int length) throws IllegalArgumentException { if (buffer.hasArray()) { return decodeUtf8Array(buffer.array(), buffer.arrayOffset() + offset, length); } else { return decodeUtf8Buffer(buffer, offset, length); } }
[ "@", "Override", "public", "String", "decodeUtf8", "(", "ByteBuffer", "buffer", ",", "int", "offset", ",", "int", "length", ")", "throws", "IllegalArgumentException", "{", "if", "(", "buffer", ".", "hasArray", "(", ")", ")", "{", "return", "decodeUtf8Array", ...
Decodes the given UTF-8 portion of the {@link ByteBuffer} into a {@link String}. @throws IllegalArgumentException if the input is not valid UTF-8.
[ "Decodes", "the", "given", "UTF", "-", "8", "portion", "of", "the", "{", "@link", "ByteBuffer", "}", "into", "a", "{", "@link", "String", "}", "." ]
train
https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Utf8Safe.java#L286-L294
saxsys/SynchronizeFX
kryo-serializer/src/main/java/de/saxsys/synchronizefx/kryo/KryoInitializer.java
KryoInitializer.registerSerializableClass
<T> void registerSerializableClass(final Class<T> clazz, final Serializer<T> serializer) { """ See {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @param clazz see {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @param serializer see {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @param <T> see {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @see KryoSerializer#registerSerializableClass(Class, Serializer) """ synchronized (customSerializers) { customSerializers.add(new CustomSerializers<>(clazz, serializer)); } }
java
<T> void registerSerializableClass(final Class<T> clazz, final Serializer<T> serializer) { synchronized (customSerializers) { customSerializers.add(new CustomSerializers<>(clazz, serializer)); } }
[ "<", "T", ">", "void", "registerSerializableClass", "(", "final", "Class", "<", "T", ">", "clazz", ",", "final", "Serializer", "<", "T", ">", "serializer", ")", "{", "synchronized", "(", "customSerializers", ")", "{", "customSerializers", ".", "add", "(", ...
See {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @param clazz see {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @param serializer see {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @param <T> see {@link KryoSerializer#registerSerializableClass(Class, Serializer)}. @see KryoSerializer#registerSerializableClass(Class, Serializer)
[ "See", "{", "@link", "KryoSerializer#registerSerializableClass", "(", "Class", "Serializer", ")", "}", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/kryo-serializer/src/main/java/de/saxsys/synchronizefx/kryo/KryoInitializer.java#L81-L85
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Lock.java
Lock.setType
public void setType(String type) throws ApplicationException { """ set the value type readOnly or Exclusive. Specifies the type of lock: read-only or exclusive. Default is Exclusive. A read-only lock allows more than one request to read shared data. An exclusive lock allows only one request to read or write to shared data. @param type value to set @throws ApplicationException """ type = type.toLowerCase().trim(); if (type.equals("exclusive")) { this.type = LockManager.TYPE_EXCLUSIVE; } else if (type.startsWith("read")) { this.type = LockManager.TYPE_READONLY; } else throw new ApplicationException("invalid value [" + type + "] for attribute [type] from tag [lock]", "valid values are [exclusive,read-only]"); }
java
public void setType(String type) throws ApplicationException { type = type.toLowerCase().trim(); if (type.equals("exclusive")) { this.type = LockManager.TYPE_EXCLUSIVE; } else if (type.startsWith("read")) { this.type = LockManager.TYPE_READONLY; } else throw new ApplicationException("invalid value [" + type + "] for attribute [type] from tag [lock]", "valid values are [exclusive,read-only]"); }
[ "public", "void", "setType", "(", "String", "type", ")", "throws", "ApplicationException", "{", "type", "=", "type", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "type", ".", "equals", "(", "\"exclusive\"", ")", ")", "{", "this"...
set the value type readOnly or Exclusive. Specifies the type of lock: read-only or exclusive. Default is Exclusive. A read-only lock allows more than one request to read shared data. An exclusive lock allows only one request to read or write to shared data. @param type value to set @throws ApplicationException
[ "set", "the", "value", "type", "readOnly", "or", "Exclusive", ".", "Specifies", "the", "type", "of", "lock", ":", "read", "-", "only", "or", "exclusive", ".", "Default", "is", "Exclusive", ".", "A", "read", "-", "only", "lock", "allows", "more", "than", ...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Lock.java#L149-L159
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/instance/NodeExtensionFactory.java
NodeExtensionFactory.create
public static NodeExtension create(Node node, List<String> extensionPriorityList) { """ Uses the Hazelcast ServiceLoader to discover all registered {@link NodeExtension} classes and identify the one to instantiate and use as the provided {@code node}'s extension. It chooses the class based on the provided priority list of class names, these are the rules: <ol><li> A class's priority is its zero-based index in the list. </li><li> Lower number means higher priority. </li><li> A class that doesn't appear in the list doesn't qualify for selection. </li></ol> <p> The dynamic selection of the node extension allows Hazelcast Enterprise's JAR to be swapped in for the core Hazelcast JAR with no changes to user's code or configuration. Hazelcast core code can call this method with a priority list naming both the default and the enterprise node extension and it will automatically prefer the Enterprise one when present. <p> The explicit priority list is necessary because a Hazelcast Jet JAR contains both the default node extension and the Jet node extension, but the one to choose depends on whether the user is requesting to start an IMDG or a Jet instance. @param node Hazelcast node whose extension this method must provide @param extensionPriorityList priority list of fully qualified extension class names @return the selected node extension """ try { ClassLoader classLoader = node.getConfigClassLoader(); Class<NodeExtension> chosenExtension = null; int chosenPriority = Integer.MAX_VALUE; for (Iterator<Class<NodeExtension>> iter = ServiceLoader.classIterator(NodeExtension.class, NODE_EXTENSION_FACTORY_ID, classLoader); iter.hasNext(); ) { Class<NodeExtension> currExt = iter.next(); warnIfDuplicate(currExt); int currPriority = extensionPriorityList.indexOf(currExt.getName()); if (currPriority == -1) { continue; } if (currPriority < chosenPriority) { chosenPriority = currPriority; chosenExtension = currExt; } } if (chosenExtension == null) { throw new HazelcastException("ServiceLoader didn't find any services registered under " + NODE_EXTENSION_FACTORY_ID); } return chosenExtension.getConstructor(Node.class).newInstance(node); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } }
java
public static NodeExtension create(Node node, List<String> extensionPriorityList) { try { ClassLoader classLoader = node.getConfigClassLoader(); Class<NodeExtension> chosenExtension = null; int chosenPriority = Integer.MAX_VALUE; for (Iterator<Class<NodeExtension>> iter = ServiceLoader.classIterator(NodeExtension.class, NODE_EXTENSION_FACTORY_ID, classLoader); iter.hasNext(); ) { Class<NodeExtension> currExt = iter.next(); warnIfDuplicate(currExt); int currPriority = extensionPriorityList.indexOf(currExt.getName()); if (currPriority == -1) { continue; } if (currPriority < chosenPriority) { chosenPriority = currPriority; chosenExtension = currExt; } } if (chosenExtension == null) { throw new HazelcastException("ServiceLoader didn't find any services registered under " + NODE_EXTENSION_FACTORY_ID); } return chosenExtension.getConstructor(Node.class).newInstance(node); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } }
[ "public", "static", "NodeExtension", "create", "(", "Node", "node", ",", "List", "<", "String", ">", "extensionPriorityList", ")", "{", "try", "{", "ClassLoader", "classLoader", "=", "node", ".", "getConfigClassLoader", "(", ")", ";", "Class", "<", "NodeExtens...
Uses the Hazelcast ServiceLoader to discover all registered {@link NodeExtension} classes and identify the one to instantiate and use as the provided {@code node}'s extension. It chooses the class based on the provided priority list of class names, these are the rules: <ol><li> A class's priority is its zero-based index in the list. </li><li> Lower number means higher priority. </li><li> A class that doesn't appear in the list doesn't qualify for selection. </li></ol> <p> The dynamic selection of the node extension allows Hazelcast Enterprise's JAR to be swapped in for the core Hazelcast JAR with no changes to user's code or configuration. Hazelcast core code can call this method with a priority list naming both the default and the enterprise node extension and it will automatically prefer the Enterprise one when present. <p> The explicit priority list is necessary because a Hazelcast Jet JAR contains both the default node extension and the Jet node extension, but the one to choose depends on whether the user is requesting to start an IMDG or a Jet instance. @param node Hazelcast node whose extension this method must provide @param extensionPriorityList priority list of fully qualified extension class names @return the selected node extension
[ "Uses", "the", "Hazelcast", "ServiceLoader", "to", "discover", "all", "registered", "{", "@link", "NodeExtension", "}", "classes", "and", "identify", "the", "one", "to", "instantiate", "and", "use", "as", "the", "provided", "{", "@code", "node", "}", "s", "e...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/instance/NodeExtensionFactory.java#L65-L93
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java
JsonObject.getBoolean
public boolean getBoolean(String name, boolean defaultValue) { """ Returns the <code>boolean</code> value of the member with the specified name in this object. If this object does not contain a member with this name, the given default value is returned. If this object contains multiple members with the given name, the last one will be picked. If this member's value does not represent a JSON <code>true</code> or <code>false</code> value, an exception is thrown. @param name the name of the member whose value is to be returned @param defaultValue the value to be returned if the requested member is missing @return the value of the last member with the specified name, or the given default value if this object does not contain a member with that name """ JsonValue value = get(name); return value != null ? value.asBoolean() : defaultValue; }
java
public boolean getBoolean(String name, boolean defaultValue) { JsonValue value = get(name); return value != null ? value.asBoolean() : defaultValue; }
[ "public", "boolean", "getBoolean", "(", "String", "name", ",", "boolean", "defaultValue", ")", "{", "JsonValue", "value", "=", "get", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "value", ".", "asBoolean", "(", ")", ":", "defaultValue", "...
Returns the <code>boolean</code> value of the member with the specified name in this object. If this object does not contain a member with this name, the given default value is returned. If this object contains multiple members with the given name, the last one will be picked. If this member's value does not represent a JSON <code>true</code> or <code>false</code> value, an exception is thrown. @param name the name of the member whose value is to be returned @param defaultValue the value to be returned if the requested member is missing @return the value of the last member with the specified name, or the given default value if this object does not contain a member with that name
[ "Returns", "the", "<code", ">", "boolean<", "/", "code", ">", "value", "of", "the", "member", "with", "the", "specified", "name", "in", "this", "object", ".", "If", "this", "object", "does", "not", "contain", "a", "member", "with", "this", "name", "the",...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L657-L660
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonFromContour.java
DetectPolygonFromContour.configure
private void configure( int width , int height ) { """ Specifies the image's intrinsic parameters and target size @param width Width of the input image @param height Height of the input image """ this.imageWidth = width; this.imageHeight = height; // adjust size based parameters based on image size this.minimumContour = minimumContourConfig.computeI(Math.min(width,height)); this.minimumContour = Math.max(4,minimumContour); // This is needed to avoid processing zero or other impossible this.minimumArea = Math.pow(this.minimumContour /4.0,2); contourFinder.setMinContour(minimumContour); if( helper != null ) helper.setImageShape(width,height); }
java
private void configure( int width , int height ) { this.imageWidth = width; this.imageHeight = height; // adjust size based parameters based on image size this.minimumContour = minimumContourConfig.computeI(Math.min(width,height)); this.minimumContour = Math.max(4,minimumContour); // This is needed to avoid processing zero or other impossible this.minimumArea = Math.pow(this.minimumContour /4.0,2); contourFinder.setMinContour(minimumContour); if( helper != null ) helper.setImageShape(width,height); }
[ "private", "void", "configure", "(", "int", "width", ",", "int", "height", ")", "{", "this", ".", "imageWidth", "=", "width", ";", "this", ".", "imageHeight", "=", "height", ";", "// adjust size based parameters based on image size", "this", ".", "minimumContour",...
Specifies the image's intrinsic parameters and target size @param width Width of the input image @param height Height of the input image
[ "Specifies", "the", "image", "s", "intrinsic", "parameters", "and", "target", "size" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonFromContour.java#L264-L277
akarnokd/ixjava
src/main/java/ix/Ix.java
Ix.orderedMergeArray
public static <T extends Comparable<? super T>> Ix<T> orderedMergeArray(Iterable<? extends T>... sources) { """ Merges self-comparable items from an Iterable sequence of Iterable sequences, picking the smallest item from all those inner Iterables until all sources complete. @param <T> the value type @param sources the Iterable sequence of Iterables of self-comparable items @return the new Ix instance @since 1.0 """ return orderedMergeArray(SelfComparator.INSTANCE, sources); }
java
public static <T extends Comparable<? super T>> Ix<T> orderedMergeArray(Iterable<? extends T>... sources) { return orderedMergeArray(SelfComparator.INSTANCE, sources); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "Ix", "<", "T", ">", "orderedMergeArray", "(", "Iterable", "<", "?", "extends", "T", ">", "...", "sources", ")", "{", "return", "orderedMergeArray", "(", "SelfCompar...
Merges self-comparable items from an Iterable sequence of Iterable sequences, picking the smallest item from all those inner Iterables until all sources complete. @param <T> the value type @param sources the Iterable sequence of Iterables of self-comparable items @return the new Ix instance @since 1.0
[ "Merges", "self", "-", "comparable", "items", "from", "an", "Iterable", "sequence", "of", "Iterable", "sequences", "picking", "the", "smallest", "item", "from", "all", "those", "inner", "Iterables", "until", "all", "sources", "complete", "." ]
train
https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L435-L437
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.simpleTemplate
@Deprecated public static <T> SimpleTemplate<T> simpleTemplate(Class<? extends T> cl, String template, ImmutableList<?> args) { """ Create a new Template expression @deprecated Use {@link #simpleTemplate(Class, String, List)} instead. @param cl type of expression @param template template @param args template parameters @return template expression """ return simpleTemplate(cl, createTemplate(template), args); }
java
@Deprecated public static <T> SimpleTemplate<T> simpleTemplate(Class<? extends T> cl, String template, ImmutableList<?> args) { return simpleTemplate(cl, createTemplate(template), args); }
[ "@", "Deprecated", "public", "static", "<", "T", ">", "SimpleTemplate", "<", "T", ">", "simpleTemplate", "(", "Class", "<", "?", "extends", "T", ">", "cl", ",", "String", "template", ",", "ImmutableList", "<", "?", ">", "args", ")", "{", "return", "sim...
Create a new Template expression @deprecated Use {@link #simpleTemplate(Class, String, List)} instead. @param cl type of expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L256-L259
integration-technology/amazon-mws-orders
src/main/java/com/amazonservices/mws/client/MwsAQCall.java
MwsAQCall.invoke
@Override public MwsReader invoke() { """ Perform a synchronous call with error handling and back-off/retry. @return A MwsReader to read the response from. """ HttpPost request = createRequest(); for (int retryCount = 0;;retryCount++) { try { HttpResponse response = executeRequest(request); StatusLine statusLine = response.getStatusLine(); int status = statusLine.getStatusCode(); String message = statusLine.getReasonPhrase(); rhmd = getResponseHeaderMetadata(response); String body = getResponseBody(response); if (status == HttpStatus.SC_OK) { return new MwsXmlReader(body); } if (status == HttpStatus.SC_INTERNAL_SERVER_ERROR) { if (pauseIfRetryNeeded(retryCount)) { continue; } } throw new MwsException(status, message, null, null, body, rhmd); } catch (Exception e) { throw MwsUtl.wrap(e); } finally { request.releaseConnection(); } } }
java
@Override public MwsReader invoke() { HttpPost request = createRequest(); for (int retryCount = 0;;retryCount++) { try { HttpResponse response = executeRequest(request); StatusLine statusLine = response.getStatusLine(); int status = statusLine.getStatusCode(); String message = statusLine.getReasonPhrase(); rhmd = getResponseHeaderMetadata(response); String body = getResponseBody(response); if (status == HttpStatus.SC_OK) { return new MwsXmlReader(body); } if (status == HttpStatus.SC_INTERNAL_SERVER_ERROR) { if (pauseIfRetryNeeded(retryCount)) { continue; } } throw new MwsException(status, message, null, null, body, rhmd); } catch (Exception e) { throw MwsUtl.wrap(e); } finally { request.releaseConnection(); } } }
[ "@", "Override", "public", "MwsReader", "invoke", "(", ")", "{", "HttpPost", "request", "=", "createRequest", "(", ")", ";", "for", "(", "int", "retryCount", "=", "0", ";", ";", "retryCount", "++", ")", "{", "try", "{", "HttpResponse", "response", "=", ...
Perform a synchronous call with error handling and back-off/retry. @return A MwsReader to read the response from.
[ "Perform", "a", "synchronous", "call", "with", "error", "handling", "and", "back", "-", "off", "/", "retry", "." ]
train
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsAQCall.java#L293-L319
JodaOrg/joda-beans
src/main/java/org/joda/beans/gen/BeanData.java
BeanData.getTypeGenericName
public String getTypeGenericName(int typeParamIndex, boolean includeBrackets) { """ Gets the name of the parameterisation of the bean, such as '{@code <T>}'. @param typeParamIndex the zero-based index of the type parameter @param includeBrackets whether to include brackets @return the generic type name, not null """ String result = typeGenericName[typeParamIndex]; return includeBrackets && result.length() > 0 ? '<' + result + '>' : result; }
java
public String getTypeGenericName(int typeParamIndex, boolean includeBrackets) { String result = typeGenericName[typeParamIndex]; return includeBrackets && result.length() > 0 ? '<' + result + '>' : result; }
[ "public", "String", "getTypeGenericName", "(", "int", "typeParamIndex", ",", "boolean", "includeBrackets", ")", "{", "String", "result", "=", "typeGenericName", "[", "typeParamIndex", "]", ";", "return", "includeBrackets", "&&", "result", ".", "length", "(", ")", ...
Gets the name of the parameterisation of the bean, such as '{@code <T>}'. @param typeParamIndex the zero-based index of the type parameter @param includeBrackets whether to include brackets @return the generic type name, not null
[ "Gets", "the", "name", "of", "the", "parameterisation", "of", "the", "bean", "such", "as", "{" ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/gen/BeanData.java#L883-L886
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java
Options.validOptions
public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) { """ As specified by the Doclet specification. @param options The command line options. @param errorReporter An error reporter to print messages. @return `true` if the options are valid. @see com.sun.javadoc.Doclet#validOptions(String[][], com.sun.javadoc.DocErrorReporter) """ options = new Options().load(options, errorReporter); if ( options != null ) { return Standard.validOptions(options, errorReporter); } else { return false; } }
java
public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) { options = new Options().load(options, errorReporter); if ( options != null ) { return Standard.validOptions(options, errorReporter); } else { return false; } }
[ "public", "static", "boolean", "validOptions", "(", "String", "[", "]", "[", "]", "options", ",", "DocErrorReporter", "errorReporter", ")", "{", "options", "=", "new", "Options", "(", ")", ".", "load", "(", "options", ",", "errorReporter", ")", ";", "if", ...
As specified by the Doclet specification. @param options The command line options. @param errorReporter An error reporter to print messages. @return `true` if the options are valid. @see com.sun.javadoc.Doclet#validOptions(String[][], com.sun.javadoc.DocErrorReporter)
[ "As", "specified", "by", "the", "Doclet", "specification", "." ]
train
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java#L577-L585
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java
UserProfileHandlerImpl.readProfile
private UserProfile readProfile(String userName, Node profileNode) throws RepositoryException { """ Read user profile from storage. @param profileNode the node which stores profile attributes as properties with prefix {@link #ATTRIBUTE_PREFIX} @return {@link UserProfile} instance @throws RepositoryException if unexpected exception is occurred during reading """ UserProfile profile = createUserProfileInstance(userName); PropertyIterator attributes = profileNode.getProperties(); while (attributes.hasNext()) { Property prop = attributes.nextProperty(); if (prop.getName().startsWith(ATTRIBUTE_PREFIX)) { String name = prop.getName().substring(ATTRIBUTE_PREFIX.length()); String value = prop.getString(); profile.setAttribute(name, value); } } return profile; }
java
private UserProfile readProfile(String userName, Node profileNode) throws RepositoryException { UserProfile profile = createUserProfileInstance(userName); PropertyIterator attributes = profileNode.getProperties(); while (attributes.hasNext()) { Property prop = attributes.nextProperty(); if (prop.getName().startsWith(ATTRIBUTE_PREFIX)) { String name = prop.getName().substring(ATTRIBUTE_PREFIX.length()); String value = prop.getString(); profile.setAttribute(name, value); } } return profile; }
[ "private", "UserProfile", "readProfile", "(", "String", "userName", ",", "Node", "profileNode", ")", "throws", "RepositoryException", "{", "UserProfile", "profile", "=", "createUserProfileInstance", "(", "userName", ")", ";", "PropertyIterator", "attributes", "=", "pr...
Read user profile from storage. @param profileNode the node which stores profile attributes as properties with prefix {@link #ATTRIBUTE_PREFIX} @return {@link UserProfile} instance @throws RepositoryException if unexpected exception is occurred during reading
[ "Read", "user", "profile", "from", "storage", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java#L334-L352
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.sendMessageWithMentionsDetect
@ObjectiveCName("sendMessageWithMentionsDetect:withText:withMarkdownText:") public void sendMessageWithMentionsDetect(@NotNull Peer peer, @NotNull String text, @NotNull String markdownText) { """ Send Text Message @param peer destination peer @param text message text """ sendMessage(peer, text, markdownText, null, true); }
java
@ObjectiveCName("sendMessageWithMentionsDetect:withText:withMarkdownText:") public void sendMessageWithMentionsDetect(@NotNull Peer peer, @NotNull String text, @NotNull String markdownText) { sendMessage(peer, text, markdownText, null, true); }
[ "@", "ObjectiveCName", "(", "\"sendMessageWithMentionsDetect:withText:withMarkdownText:\"", ")", "public", "void", "sendMessageWithMentionsDetect", "(", "@", "NotNull", "Peer", "peer", ",", "@", "NotNull", "String", "text", ",", "@", "NotNull", "String", "markdownText", ...
Send Text Message @param peer destination peer @param text message text
[ "Send", "Text", "Message" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L839-L842
susom/database
src/main/java/com/github/susom/database/DatabaseProviderVertx.java
DatabaseProviderVertx.fromPool
@CheckReturnValue public static Builder fromPool(Vertx vertx, Pool pool) { """ Use an externally configured DataSource, Flavor, and optionally a shutdown hook. The shutdown hook may be null if you don't want calls to Builder.close() to attempt any shutdown. The DataSource and Flavor are mandatory. """ WorkerExecutor executor = vertx.createSharedWorkerExecutor("DbWorker-" + poolNameCounter.getAndAdd(1), pool.size); return new BuilderImpl(executor, () -> { try { executor.close(); } catch (Exception e) { log.warn("Problem closing database worker executor", e); } if (pool.poolShutdown != null) { pool.poolShutdown.close(); } }, () -> { try { return pool.dataSource.getConnection(); } catch (Exception e) { throw new DatabaseException("Unable to obtain a connection from DriverManager", e); } }, new OptionsDefault(pool.flavor)); }
java
@CheckReturnValue public static Builder fromPool(Vertx vertx, Pool pool) { WorkerExecutor executor = vertx.createSharedWorkerExecutor("DbWorker-" + poolNameCounter.getAndAdd(1), pool.size); return new BuilderImpl(executor, () -> { try { executor.close(); } catch (Exception e) { log.warn("Problem closing database worker executor", e); } if (pool.poolShutdown != null) { pool.poolShutdown.close(); } }, () -> { try { return pool.dataSource.getConnection(); } catch (Exception e) { throw new DatabaseException("Unable to obtain a connection from DriverManager", e); } }, new OptionsDefault(pool.flavor)); }
[ "@", "CheckReturnValue", "public", "static", "Builder", "fromPool", "(", "Vertx", "vertx", ",", "Pool", "pool", ")", "{", "WorkerExecutor", "executor", "=", "vertx", ".", "createSharedWorkerExecutor", "(", "\"DbWorker-\"", "+", "poolNameCounter", ".", "getAndAdd", ...
Use an externally configured DataSource, Flavor, and optionally a shutdown hook. The shutdown hook may be null if you don't want calls to Builder.close() to attempt any shutdown. The DataSource and Flavor are mandatory.
[ "Use", "an", "externally", "configured", "DataSource", "Flavor", "and", "optionally", "a", "shutdown", "hook", ".", "The", "shutdown", "hook", "may", "be", "null", "if", "you", "don", "t", "want", "calls", "to", "Builder", ".", "close", "()", "to", "attemp...
train
https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProviderVertx.java#L111-L130
OpenTSDB/opentsdb
src/tsd/PutDataPointRpc.java
PutDataPointRpc.execute
@Override public void execute(final TSDB tsdb, final HttpQuery query) throws IOException { """ Handles HTTP RPC put requests @param tsdb The TSDB to which we belong @param query The HTTP query from the user @throws IOException if there is an error parsing the query or formatting the output @throws BadRequestException if the user supplied bad data @since 2.0 """ http_requests.incrementAndGet(); // only accept POST if (query.method() != HttpMethod.POST) { throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED, "Method not allowed", "The HTTP method [" + query.method().getName() + "] is not permitted for this endpoint"); } final List<IncomingDataPoint> dps; //noinspection TryWithIdenticalCatches try { checkAuthorization(tsdb, query); dps = query.serializer() .parsePutV1(IncomingDataPoint.class, HttpJsonSerializer.TR_INCOMING); } catch (BadRequestException e) { illegal_arguments.incrementAndGet(); throw e; } catch (IllegalArgumentException e) { illegal_arguments.incrementAndGet(); throw e; } processDataPoint(tsdb, query, dps); }
java
@Override public void execute(final TSDB tsdb, final HttpQuery query) throws IOException { http_requests.incrementAndGet(); // only accept POST if (query.method() != HttpMethod.POST) { throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED, "Method not allowed", "The HTTP method [" + query.method().getName() + "] is not permitted for this endpoint"); } final List<IncomingDataPoint> dps; //noinspection TryWithIdenticalCatches try { checkAuthorization(tsdb, query); dps = query.serializer() .parsePutV1(IncomingDataPoint.class, HttpJsonSerializer.TR_INCOMING); } catch (BadRequestException e) { illegal_arguments.incrementAndGet(); throw e; } catch (IllegalArgumentException e) { illegal_arguments.incrementAndGet(); throw e; } processDataPoint(tsdb, query, dps); }
[ "@", "Override", "public", "void", "execute", "(", "final", "TSDB", "tsdb", ",", "final", "HttpQuery", "query", ")", "throws", "IOException", "{", "http_requests", ".", "incrementAndGet", "(", ")", ";", "// only accept POST", "if", "(", "query", ".", "method",...
Handles HTTP RPC put requests @param tsdb The TSDB to which we belong @param query The HTTP query from the user @throws IOException if there is an error parsing the query or formatting the output @throws BadRequestException if the user supplied bad data @since 2.0
[ "Handles", "HTTP", "RPC", "put", "requests" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/PutDataPointRpc.java#L271-L297
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
KeyedStream.timeWindow
public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size, Time slide) { """ Windows this {@code KeyedStream} into sliding time windows. <p>This is a shortcut for either {@code .window(SlidingEventTimeWindows.of(size, slide))} or {@code .window(SlidingProcessingTimeWindows.of(size, slide))} depending on the time characteristic set using {@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)} @param size The size of the window. """ if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) { return window(SlidingProcessingTimeWindows.of(size, slide)); } else { return window(SlidingEventTimeWindows.of(size, slide)); } }
java
public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size, Time slide) { if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) { return window(SlidingProcessingTimeWindows.of(size, slide)); } else { return window(SlidingEventTimeWindows.of(size, slide)); } }
[ "public", "WindowedStream", "<", "T", ",", "KEY", ",", "TimeWindow", ">", "timeWindow", "(", "Time", "size", ",", "Time", "slide", ")", "{", "if", "(", "environment", ".", "getStreamTimeCharacteristic", "(", ")", "==", "TimeCharacteristic", ".", "ProcessingTim...
Windows this {@code KeyedStream} into sliding time windows. <p>This is a shortcut for either {@code .window(SlidingEventTimeWindows.of(size, slide))} or {@code .window(SlidingProcessingTimeWindows.of(size, slide))} depending on the time characteristic set using {@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)} @param size The size of the window.
[ "Windows", "this", "{", "@code", "KeyedStream", "}", "into", "sliding", "time", "windows", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L629-L635
cdapio/tigon
tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java
DatumWriterGenerator.getAccessorMethod
private Method getAccessorMethod(TypeToken<?> type) { """ Returns the method for calling {@link FieldAccessor} based on the data type. @param type Data type. @return A {@link org.objectweb.asm.commons.Method} for calling {@link FieldAccessor}. """ Class<?> rawType = type.getRawType(); if (rawType.isPrimitive()) { return getMethod(rawType, String.format("get%c%s", Character.toUpperCase(rawType.getName().charAt(0)), rawType.getName().substring(1)), Object.class); } else { return getMethod(Object.class, "get", Object.class); } }
java
private Method getAccessorMethod(TypeToken<?> type) { Class<?> rawType = type.getRawType(); if (rawType.isPrimitive()) { return getMethod(rawType, String.format("get%c%s", Character.toUpperCase(rawType.getName().charAt(0)), rawType.getName().substring(1)), Object.class); } else { return getMethod(Object.class, "get", Object.class); } }
[ "private", "Method", "getAccessorMethod", "(", "TypeToken", "<", "?", ">", "type", ")", "{", "Class", "<", "?", ">", "rawType", "=", "type", ".", "getRawType", "(", ")", ";", "if", "(", "rawType", ".", "isPrimitive", "(", ")", ")", "{", "return", "ge...
Returns the method for calling {@link FieldAccessor} based on the data type. @param type Data type. @return A {@link org.objectweb.asm.commons.Method} for calling {@link FieldAccessor}.
[ "Returns", "the", "method", "for", "calling", "{" ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java#L935-L946
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getPersonInfo
public PersonInfo getPersonInfo(int personId, String... appendToResponse) throws MovieDbException { """ Get the general person information for a specific id. @param personId personId @param appendToResponse appendToResponse @return @throws MovieDbException exception """ return tmdbPeople.getPersonInfo(personId, appendToResponse); }
java
public PersonInfo getPersonInfo(int personId, String... appendToResponse) throws MovieDbException { return tmdbPeople.getPersonInfo(personId, appendToResponse); }
[ "public", "PersonInfo", "getPersonInfo", "(", "int", "personId", ",", "String", "...", "appendToResponse", ")", "throws", "MovieDbException", "{", "return", "tmdbPeople", ".", "getPersonInfo", "(", "personId", ",", "appendToResponse", ")", ";", "}" ]
Get the general person information for a specific id. @param personId personId @param appendToResponse appendToResponse @return @throws MovieDbException exception
[ "Get", "the", "general", "person", "information", "for", "a", "specific", "id", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1156-L1158
google/closure-templates
java/src/com/google/template/soy/jssrc/dsl/SwitchBuilder.java
SwitchBuilder.addCase
public SwitchBuilder addCase(ImmutableList<Expression> caseLabels, Statement body) { """ Adds a case clause (one or more {@code case} labels followed by a body) to this switch statement. """ Preconditions.checkState(!caseLabels.isEmpty(), "at least one case required"); clauses.add(new Switch.CaseClause(caseLabels, body)); return this; }
java
public SwitchBuilder addCase(ImmutableList<Expression> caseLabels, Statement body) { Preconditions.checkState(!caseLabels.isEmpty(), "at least one case required"); clauses.add(new Switch.CaseClause(caseLabels, body)); return this; }
[ "public", "SwitchBuilder", "addCase", "(", "ImmutableList", "<", "Expression", ">", "caseLabels", ",", "Statement", "body", ")", "{", "Preconditions", ".", "checkState", "(", "!", "caseLabels", ".", "isEmpty", "(", ")", ",", "\"at least one case required\"", ")", ...
Adds a case clause (one or more {@code case} labels followed by a body) to this switch statement.
[ "Adds", "a", "case", "clause", "(", "one", "or", "more", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/SwitchBuilder.java#L37-L41
BlueBrain/bluima
modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/BlueCasUtil.java
BlueCasUtil.fixNoSentences
public static void fixNoSentences(JCas jCas) { """ If this cas has no Sentence annotation, creates one with the whole cas text """ Collection<Sentence> sentences = select(jCas, Sentence.class); if (sentences.size() == 0) { String text = jCas.getDocumentText(); Sentence sentence = new Sentence(jCas, 0, text.length()); sentence.addToIndexes(); } }
java
public static void fixNoSentences(JCas jCas) { Collection<Sentence> sentences = select(jCas, Sentence.class); if (sentences.size() == 0) { String text = jCas.getDocumentText(); Sentence sentence = new Sentence(jCas, 0, text.length()); sentence.addToIndexes(); } }
[ "public", "static", "void", "fixNoSentences", "(", "JCas", "jCas", ")", "{", "Collection", "<", "Sentence", ">", "sentences", "=", "select", "(", "jCas", ",", "Sentence", ".", "class", ")", ";", "if", "(", "sentences", ".", "size", "(", ")", "==", "0",...
If this cas has no Sentence annotation, creates one with the whole cas text
[ "If", "this", "cas", "has", "no", "Sentence", "annotation", "creates", "one", "with", "the", "whole", "cas", "text" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/BlueCasUtil.java#L142-L149
box/box-java-sdk
src/main/java/com/box/sdk/BoxLegalHoldPolicy.java
BoxLegalHoldPolicy.createOngoing
public static BoxLegalHoldPolicy.Info createOngoing(BoxAPIConnection api, String name, String description) { """ Creates a new ongoing Legal Hold Policy. @param api the API connection to be used by the resource. @param name the name of Legal Hold Policy. @param description the description of Legal Hold Policy. @return information about the Legal Hold Policy created. """ URL url = ALL_LEGAL_HOLD_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject requestJSON = new JsonObject() .add("policy_name", name) .add("is_ongoing", true); if (description != null) { requestJSON.add("description", description); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxLegalHoldPolicy createdPolicy = new BoxLegalHoldPolicy(api, responseJSON.get("id").asString()); return createdPolicy.new Info(responseJSON); }
java
public static BoxLegalHoldPolicy.Info createOngoing(BoxAPIConnection api, String name, String description) { URL url = ALL_LEGAL_HOLD_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject requestJSON = new JsonObject() .add("policy_name", name) .add("is_ongoing", true); if (description != null) { requestJSON.add("description", description); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxLegalHoldPolicy createdPolicy = new BoxLegalHoldPolicy(api, responseJSON.get("id").asString()); return createdPolicy.new Info(responseJSON); }
[ "public", "static", "BoxLegalHoldPolicy", ".", "Info", "createOngoing", "(", "BoxAPIConnection", "api", ",", "String", "name", ",", "String", "description", ")", "{", "URL", "url", "=", "ALL_LEGAL_HOLD_URL_TEMPLATE", ".", "build", "(", "api", ".", "getBaseURL", ...
Creates a new ongoing Legal Hold Policy. @param api the API connection to be used by the resource. @param name the name of Legal Hold Policy. @param description the description of Legal Hold Policy. @return information about the Legal Hold Policy created.
[ "Creates", "a", "new", "ongoing", "Legal", "Hold", "Policy", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxLegalHoldPolicy.java#L116-L130
baasbox/Android-SDK
library/src/main/java/com/baasbox/android/BaasDocument.java
BaasDocument.fetchSync
public static BaasResult<BaasDocument> fetchSync(String collection,String id) { """ Synchronously fetches a document from the server @param collection the collection to retrieve the document from. Not <code>null</code> @param id the id of the document to retrieve. Not <code>null</code> @return the result of the request """ return fetchSync(collection,id,false); }
java
public static BaasResult<BaasDocument> fetchSync(String collection,String id){ return fetchSync(collection,id,false); }
[ "public", "static", "BaasResult", "<", "BaasDocument", ">", "fetchSync", "(", "String", "collection", ",", "String", "id", ")", "{", "return", "fetchSync", "(", "collection", ",", "id", ",", "false", ")", ";", "}" ]
Synchronously fetches a document from the server @param collection the collection to retrieve the document from. Not <code>null</code> @param id the id of the document to retrieve. Not <code>null</code> @return the result of the request
[ "Synchronously", "fetches", "a", "document", "from", "the", "server" ]
train
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L417-L419
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/persister/MapTilePersisterModel.java
MapTilePersisterModel.saveTile
protected void saveTile(FileWriting file, Tile tile) throws IOException { """ Save tile. Data are saved this way: <pre> (integer) sheet number (integer) index number inside sheet (integer) tile location x % MapTile.BLOC_SIZE (integer tile location y </pre> @param file The file writer reference. @param tile The tile to save. @throws IOException If error on writing. """ file.writeInteger(tile.getSheet().intValue()); file.writeInteger(tile.getNumber()); file.writeInteger(tile.getInTileX() % BLOC_SIZE); file.writeInteger(tile.getInTileY()); }
java
protected void saveTile(FileWriting file, Tile tile) throws IOException { file.writeInteger(tile.getSheet().intValue()); file.writeInteger(tile.getNumber()); file.writeInteger(tile.getInTileX() % BLOC_SIZE); file.writeInteger(tile.getInTileY()); }
[ "protected", "void", "saveTile", "(", "FileWriting", "file", ",", "Tile", "tile", ")", "throws", "IOException", "{", "file", ".", "writeInteger", "(", "tile", ".", "getSheet", "(", ")", ".", "intValue", "(", ")", ")", ";", "file", ".", "writeInteger", "(...
Save tile. Data are saved this way: <pre> (integer) sheet number (integer) index number inside sheet (integer) tile location x % MapTile.BLOC_SIZE (integer tile location y </pre> @param file The file writer reference. @param tile The tile to save. @throws IOException If error on writing.
[ "Save", "tile", ".", "Data", "are", "saved", "this", "way", ":" ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/persister/MapTilePersisterModel.java#L77-L83
square/dagger
compiler/src/main/java/dagger/internal/codegen/Util.java
Util.typeToString
public static void typeToString(final TypeMirror type, final StringBuilder result, final char innerClassSeparator) { """ Appends a string for {@code type} to {@code result}. Primitive types are always boxed. @param innerClassSeparator either '.' or '$', which will appear in a class name like "java.lang.Map.Entry" or "java.lang.Map$Entry". Use '.' for references to existing types in code. Use '$' to define new class names and for strings that will be used by runtime reflection. """ type.accept(new SimpleTypeVisitor6<Void, Void>() { @Override public Void visitDeclared(DeclaredType declaredType, Void v) { TypeElement typeElement = (TypeElement) declaredType.asElement(); rawTypeToString(result, typeElement, innerClassSeparator); List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments(); if (!typeArguments.isEmpty()) { result.append("<"); for (int i = 0; i < typeArguments.size(); i++) { if (i != 0) { result.append(", "); } typeToString(typeArguments.get(i), result, innerClassSeparator); } result.append(">"); } return null; } @Override public Void visitPrimitive(PrimitiveType primitiveType, Void v) { result.append(box((PrimitiveType) type)); return null; } @Override public Void visitArray(ArrayType arrayType, Void v) { TypeMirror type = arrayType.getComponentType(); if (type instanceof PrimitiveType) { result.append(type.toString()); // Don't box, since this is an array. } else { typeToString(arrayType.getComponentType(), result, innerClassSeparator); } result.append("[]"); return null; } @Override public Void visitTypeVariable(TypeVariable typeVariable, Void v) { result.append(typeVariable.asElement().getSimpleName()); return null; } @Override public Void visitError(ErrorType errorType, Void v) { // Error type found, a type may not yet have been generated, but we need the type // so we can generate the correct code in anticipation of the type being available // to the compiler. // Paramterized types which don't exist are returned as an error type whose name is "<any>" if ("<any>".equals(errorType.toString())) { throw new CodeGenerationIncompleteException( "Type reported as <any> is likely a not-yet generated parameterized type."); } // TODO(cgruber): Figure out a strategy for non-FQCN cases. result.append(errorType.toString()); return null; } @Override protected Void defaultAction(TypeMirror typeMirror, Void v) { throw new UnsupportedOperationException( "Unexpected TypeKind " + typeMirror.getKind() + " for " + typeMirror); } }, null); }
java
public static void typeToString(final TypeMirror type, final StringBuilder result, final char innerClassSeparator) { type.accept(new SimpleTypeVisitor6<Void, Void>() { @Override public Void visitDeclared(DeclaredType declaredType, Void v) { TypeElement typeElement = (TypeElement) declaredType.asElement(); rawTypeToString(result, typeElement, innerClassSeparator); List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments(); if (!typeArguments.isEmpty()) { result.append("<"); for (int i = 0; i < typeArguments.size(); i++) { if (i != 0) { result.append(", "); } typeToString(typeArguments.get(i), result, innerClassSeparator); } result.append(">"); } return null; } @Override public Void visitPrimitive(PrimitiveType primitiveType, Void v) { result.append(box((PrimitiveType) type)); return null; } @Override public Void visitArray(ArrayType arrayType, Void v) { TypeMirror type = arrayType.getComponentType(); if (type instanceof PrimitiveType) { result.append(type.toString()); // Don't box, since this is an array. } else { typeToString(arrayType.getComponentType(), result, innerClassSeparator); } result.append("[]"); return null; } @Override public Void visitTypeVariable(TypeVariable typeVariable, Void v) { result.append(typeVariable.asElement().getSimpleName()); return null; } @Override public Void visitError(ErrorType errorType, Void v) { // Error type found, a type may not yet have been generated, but we need the type // so we can generate the correct code in anticipation of the type being available // to the compiler. // Paramterized types which don't exist are returned as an error type whose name is "<any>" if ("<any>".equals(errorType.toString())) { throw new CodeGenerationIncompleteException( "Type reported as <any> is likely a not-yet generated parameterized type."); } // TODO(cgruber): Figure out a strategy for non-FQCN cases. result.append(errorType.toString()); return null; } @Override protected Void defaultAction(TypeMirror typeMirror, Void v) { throw new UnsupportedOperationException( "Unexpected TypeKind " + typeMirror.getKind() + " for " + typeMirror); } }, null); }
[ "public", "static", "void", "typeToString", "(", "final", "TypeMirror", "type", ",", "final", "StringBuilder", "result", ",", "final", "char", "innerClassSeparator", ")", "{", "type", ".", "accept", "(", "new", "SimpleTypeVisitor6", "<", "Void", ",", "Void", "...
Appends a string for {@code type} to {@code result}. Primitive types are always boxed. @param innerClassSeparator either '.' or '$', which will appear in a class name like "java.lang.Map.Entry" or "java.lang.Map$Entry". Use '.' for references to existing types in code. Use '$' to define new class names and for strings that will be used by runtime reflection.
[ "Appends", "a", "string", "for", "{", "@code", "type", "}", "to", "{", "@code", "result", "}", ".", "Primitive", "types", "are", "always", "boxed", "." ]
train
https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/compiler/src/main/java/dagger/internal/codegen/Util.java#L123-L179
baratine/baratine
core/src/main/java/com/caucho/v5/loader/EnvLoader.java
EnvLoader.getAttribute
public static Object getAttribute(String name) { """ Gets a local variable for the current environment. @param name the attribute name @return the attribute value """ ClassLoader loader = Thread.currentThread().getContextClassLoader(); return getAttribute(name, loader); }
java
public static Object getAttribute(String name) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); return getAttribute(name, loader); }
[ "public", "static", "Object", "getAttribute", "(", "String", "name", ")", "{", "ClassLoader", "loader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "return", "getAttribute", "(", "name", ",", "loader", ")", ";"...
Gets a local variable for the current environment. @param name the attribute name @return the attribute value
[ "Gets", "a", "local", "variable", "for", "the", "current", "environment", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L528-L533
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/model/rich/RichTextFactory.java
RichTextFactory.resolveRichNode
static CMARichNode resolveRichNode(Map<String, Object> rawNode) { """ Resolve one node. @param rawNode the map response from Contentful @return a CMARichNode from this SDK. """ final String type = (String) rawNode.get("nodeType"); if (RESOLVER_MAP.containsKey(type)) { return RESOLVER_MAP.get(type).resolve(rawNode); } else { return null; } }
java
static CMARichNode resolveRichNode(Map<String, Object> rawNode) { final String type = (String) rawNode.get("nodeType"); if (RESOLVER_MAP.containsKey(type)) { return RESOLVER_MAP.get(type).resolve(rawNode); } else { return null; } }
[ "static", "CMARichNode", "resolveRichNode", "(", "Map", "<", "String", ",", "Object", ">", "rawNode", ")", "{", "final", "String", "type", "=", "(", "String", ")", "rawNode", ".", "get", "(", "\"nodeType\"", ")", ";", "if", "(", "RESOLVER_MAP", ".", "con...
Resolve one node. @param rawNode the map response from Contentful @return a CMARichNode from this SDK.
[ "Resolve", "one", "node", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/model/rich/RichTextFactory.java#L265-L272
apache/fluo
modules/core/src/main/java/org/apache/fluo/core/util/CuratorUtil.java
CuratorUtil.newCurator
public static CuratorFramework newCurator(String zookeepers, int timeout, String secret) { """ Creates a curator built using the given zookeeper connection string and timeout """ final ExponentialBackoffRetry retry = new ExponentialBackoffRetry(1000, 10); if (secret.isEmpty()) { return CuratorFrameworkFactory.newClient(zookeepers, timeout, timeout, retry); } else { return CuratorFrameworkFactory.builder().connectString(zookeepers) .connectionTimeoutMs(timeout).sessionTimeoutMs(timeout).retryPolicy(retry) .authorization("digest", ("fluo:" + secret).getBytes(StandardCharsets.UTF_8)) .aclProvider(new ACLProvider() { @Override public List<ACL> getDefaultAcl() { return CREATOR_ALL_ACL; } @Override public List<ACL> getAclForPath(String path) { switch (path) { case ZookeeperPath.ORACLE_GC_TIMESTAMP: // The garbage collection iterator running in Accumulo tservers needs to read this // value w/o authenticating. return PUBLICLY_READABLE_ACL; default: return CREATOR_ALL_ACL; } } }).build(); } }
java
public static CuratorFramework newCurator(String zookeepers, int timeout, String secret) { final ExponentialBackoffRetry retry = new ExponentialBackoffRetry(1000, 10); if (secret.isEmpty()) { return CuratorFrameworkFactory.newClient(zookeepers, timeout, timeout, retry); } else { return CuratorFrameworkFactory.builder().connectString(zookeepers) .connectionTimeoutMs(timeout).sessionTimeoutMs(timeout).retryPolicy(retry) .authorization("digest", ("fluo:" + secret).getBytes(StandardCharsets.UTF_8)) .aclProvider(new ACLProvider() { @Override public List<ACL> getDefaultAcl() { return CREATOR_ALL_ACL; } @Override public List<ACL> getAclForPath(String path) { switch (path) { case ZookeeperPath.ORACLE_GC_TIMESTAMP: // The garbage collection iterator running in Accumulo tservers needs to read this // value w/o authenticating. return PUBLICLY_READABLE_ACL; default: return CREATOR_ALL_ACL; } } }).build(); } }
[ "public", "static", "CuratorFramework", "newCurator", "(", "String", "zookeepers", ",", "int", "timeout", ",", "String", "secret", ")", "{", "final", "ExponentialBackoffRetry", "retry", "=", "new", "ExponentialBackoffRetry", "(", "1000", ",", "10", ")", ";", "if...
Creates a curator built using the given zookeeper connection string and timeout
[ "Creates", "a", "curator", "built", "using", "the", "given", "zookeeper", "connection", "string", "and", "timeout" ]
train
https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/core/src/main/java/org/apache/fluo/core/util/CuratorUtil.java#L88-L116
tango-controls/JTango
server/src/main/java/org/tango/server/admin/AdminDevice.java
AdminDevice.subcribeIDLInEventString
private DevVarLongStringArray subcribeIDLInEventString(final String eventTypeAndIDL, final String deviceName, final String objName) throws DevFailed { """ Manage event subcription with event name like "idl5_archive" or "archive" @param eventTypeAndIDL @param deviceName @param objName @return @throws DevFailed """ // event name like "idl5_archive" or "archive" String event = eventTypeAndIDL; int idlversion = EventManager.MINIMUM_IDL_VERSION; if (eventTypeAndIDL.contains(EventManager.IDL_LATEST)) { idlversion = DeviceImpl.SERVER_VERSION; event = eventTypeAndIDL.substring(eventTypeAndIDL.indexOf("_") + 1, eventTypeAndIDL.length()); } final EventType eventType = EventType.getEvent(event); logger.debug("event subscription/confirmation for {}, attribute/pipe {} with type {} and IDL {}", new Object[]{ deviceName, objName, eventType, idlversion}); final Pair<PipeImpl, AttributeImpl> result = findSubscribers(eventType, deviceName, objName); return subscribeEvent(eventType, deviceName, idlversion, result.getRight(), result.getLeft()); }
java
private DevVarLongStringArray subcribeIDLInEventString(final String eventTypeAndIDL, final String deviceName, final String objName) throws DevFailed { // event name like "idl5_archive" or "archive" String event = eventTypeAndIDL; int idlversion = EventManager.MINIMUM_IDL_VERSION; if (eventTypeAndIDL.contains(EventManager.IDL_LATEST)) { idlversion = DeviceImpl.SERVER_VERSION; event = eventTypeAndIDL.substring(eventTypeAndIDL.indexOf("_") + 1, eventTypeAndIDL.length()); } final EventType eventType = EventType.getEvent(event); logger.debug("event subscription/confirmation for {}, attribute/pipe {} with type {} and IDL {}", new Object[]{ deviceName, objName, eventType, idlversion}); final Pair<PipeImpl, AttributeImpl> result = findSubscribers(eventType, deviceName, objName); return subscribeEvent(eventType, deviceName, idlversion, result.getRight(), result.getLeft()); }
[ "private", "DevVarLongStringArray", "subcribeIDLInEventString", "(", "final", "String", "eventTypeAndIDL", ",", "final", "String", "deviceName", ",", "final", "String", "objName", ")", "throws", "DevFailed", "{", "// event name like \"idl5_archive\" or \"archive\"", "String",...
Manage event subcription with event name like "idl5_archive" or "archive" @param eventTypeAndIDL @param deviceName @param objName @return @throws DevFailed
[ "Manage", "event", "subcription", "with", "event", "name", "like", "idl5_archive", "or", "archive" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L691-L705
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/handler/SetResponseHeadersHandler.java
SetResponseHeadersHandler.setHeaderValue
public void setHeaderValue(String name,String value) { """ Set a header override, every response handled will have this header set. @param name The String name of the header. @param value The String value of the header. """ _fields.put(name,Collections.singletonList(value)); }
java
public void setHeaderValue(String name,String value) { _fields.put(name,Collections.singletonList(value)); }
[ "public", "void", "setHeaderValue", "(", "String", "name", ",", "String", "value", ")", "{", "_fields", ".", "put", "(", "name", ",", "Collections", ".", "singletonList", "(", "value", ")", ")", ";", "}" ]
Set a header override, every response handled will have this header set. @param name The String name of the header. @param value The String value of the header.
[ "Set", "a", "header", "override", "every", "response", "handled", "will", "have", "this", "header", "set", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/handler/SetResponseHeadersHandler.java#L50-L53