repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.elementOpt
public JSONObject elementOpt( String key, Object value, JsonConfig jsonConfig ) { verifyIsNull(); if( key != null && value != null ){ element( key, value, jsonConfig ); } return this; }
java
public JSONObject elementOpt( String key, Object value, JsonConfig jsonConfig ) { verifyIsNull(); if( key != null && value != null ){ element( key, value, jsonConfig ); } return this; }
[ "public", "JSONObject", "elementOpt", "(", "String", "key", ",", "Object", "value", ",", "JsonConfig", "jsonConfig", ")", "{", "verifyIsNull", "(", ")", ";", "if", "(", "key", "!=", "null", "&&", "value", "!=", "null", ")", "{", "element", "(", "key", ...
Put a key/value pair in the JSONObject, but only if the key and the value are both non-null. @param key A key string. @param value An object which is the value. It should be of one of these types: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull object. @return this. @throws JSONException If the value is a non-finite number.
[ "Put", "a", "key", "/", "value", "pair", "in", "the", "JSONObject", "but", "only", "if", "the", "key", "and", "the", "value", "are", "both", "non", "-", "null", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1746-L1752
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.paintCell
private void paintCell(SeaGlassContext context, Graphics g, Rectangle cellRect, int row, int column) { if (table.isEditing() && table.getEditingRow() == row && table.getEditingColumn() == column) { Component component = table.getEditorComponent(); component.setBounds(cellRect); component.validate(); } else { TableCellRenderer renderer = table.getCellRenderer(row, column); Component component = table.prepareRenderer(renderer, row, column); rendererPane.paintComponent(g, component, table, cellRect.x, cellRect.y, cellRect.width, cellRect.height, true); } }
java
private void paintCell(SeaGlassContext context, Graphics g, Rectangle cellRect, int row, int column) { if (table.isEditing() && table.getEditingRow() == row && table.getEditingColumn() == column) { Component component = table.getEditorComponent(); component.setBounds(cellRect); component.validate(); } else { TableCellRenderer renderer = table.getCellRenderer(row, column); Component component = table.prepareRenderer(renderer, row, column); rendererPane.paintComponent(g, component, table, cellRect.x, cellRect.y, cellRect.width, cellRect.height, true); } }
[ "private", "void", "paintCell", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ",", "Rectangle", "cellRect", ",", "int", "row", ",", "int", "column", ")", "{", "if", "(", "table", ".", "isEditing", "(", ")", "&&", "table", ".", "getEditingRow", ...
DOCUMENT ME! @param context DOCUMENT ME! @param g DOCUMENT ME! @param cellRect DOCUMENT ME! @param row DOCUMENT ME! @param column DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L949-L961
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
AbstractCachedGenerator.retrieveFromCache
protected Reader retrieveFromCache(String path, GeneratorContext context, CacheMode cacheMode) { Reader rd = null; String filePath = getTempFilePath(context, cacheMode); FileInputStream fis = null; File file = new File(filePath); if (file.exists()) { try { fis = new FileInputStream(file); } catch (FileNotFoundException e) { throw new BundlingProcessException("An error occured while creating temporary resource for " + filePath, e); } FileChannel inchannel = fis.getChannel(); rd = Channels.newReader(inchannel, context.getConfig().getResourceCharset().newDecoder(), -1); context.setRetrievedFromCache(true); if (LOGGER.isDebugEnabled()) { LOGGER.debug(getName() + " resource '" + path + "' retrieved from cache"); } } return rd; }
java
protected Reader retrieveFromCache(String path, GeneratorContext context, CacheMode cacheMode) { Reader rd = null; String filePath = getTempFilePath(context, cacheMode); FileInputStream fis = null; File file = new File(filePath); if (file.exists()) { try { fis = new FileInputStream(file); } catch (FileNotFoundException e) { throw new BundlingProcessException("An error occured while creating temporary resource for " + filePath, e); } FileChannel inchannel = fis.getChannel(); rd = Channels.newReader(inchannel, context.getConfig().getResourceCharset().newDecoder(), -1); context.setRetrievedFromCache(true); if (LOGGER.isDebugEnabled()) { LOGGER.debug(getName() + " resource '" + path + "' retrieved from cache"); } } return rd; }
[ "protected", "Reader", "retrieveFromCache", "(", "String", "path", ",", "GeneratorContext", "context", ",", "CacheMode", "cacheMode", ")", "{", "Reader", "rd", "=", "null", ";", "String", "filePath", "=", "getTempFilePath", "(", "context", ",", "cacheMode", ")",...
Retrieves the resource from cache if it exists @param path the resource path @param context the generator context @param cacheMode the cache mode @return the reader to the resource
[ "Retrieves", "the", "resource", "from", "cache", "if", "it", "exists" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L456-L478
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/template/TemplateGenerator.java
TemplateGenerator.generateTemplate
public static void generateTemplate( Reader readerTemplate, Writer writerOut, ISymbolTable symTable) throws TemplateParseException { generateTemplate(readerTemplate, writerOut, symTable, false); }
java
public static void generateTemplate( Reader readerTemplate, Writer writerOut, ISymbolTable symTable) throws TemplateParseException { generateTemplate(readerTemplate, writerOut, symTable, false); }
[ "public", "static", "void", "generateTemplate", "(", "Reader", "readerTemplate", ",", "Writer", "writerOut", ",", "ISymbolTable", "symTable", ")", "throws", "TemplateParseException", "{", "generateTemplate", "(", "readerTemplate", ",", "writerOut", ",", "symTable", ",...
Generates a template of any format having embedded Gosu. @param readerTemplate The source of the template. @param writerOut Where the output should go. @param symTable The symbol table to use. @throws TemplateParseException on execution exception
[ "Generates", "a", "template", "of", "any", "format", "having", "embedded", "Gosu", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/template/TemplateGenerator.java#L163-L167
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java
PageParametersExtensions.copyToWicketSession
public static void copyToWicketSession(final PageParameters source, final Session session) { final List<INamedParameters.NamedPair> namedPairs = source.getAllNamed(); for (final INamedParameters.NamedPair namedPair : namedPairs) { session.setAttribute(namedPair.getKey(), namedPair.getValue()); } }
java
public static void copyToWicketSession(final PageParameters source, final Session session) { final List<INamedParameters.NamedPair> namedPairs = source.getAllNamed(); for (final INamedParameters.NamedPair namedPair : namedPairs) { session.setAttribute(namedPair.getKey(), namedPair.getValue()); } }
[ "public", "static", "void", "copyToWicketSession", "(", "final", "PageParameters", "source", ",", "final", "Session", "session", ")", "{", "final", "List", "<", "INamedParameters", ".", "NamedPair", ">", "namedPairs", "=", "source", ".", "getAllNamed", "(", ")",...
Copies all given source {@link org.apache.wicket.request.mapper.parameter.PageParameters} to the given session {@link org.apache.wicket.Session}. @param source The source {@link org.apache.wicket.request.mapper.parameter.PageParameters}. @param session The session where the {@link org.apache.wicket.request.mapper.parameter.PageParameters} are stored.
[ "Copies", "all", "given", "source", "{", "@link", "org", ".", "apache", ".", "wicket", ".", "request", ".", "mapper", ".", "parameter", ".", "PageParameters", "}", "to", "the", "given", "session", "{", "@link", "org", ".", "apache", ".", "wicket", ".", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/parameter/PageParametersExtensions.java#L129-L136
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
DataLabelingServiceClient.formatDataItemName
@Deprecated public static final String formatDataItemName(String project, String dataset, String dataItem) { return DATA_ITEM_PATH_TEMPLATE.instantiate( "project", project, "dataset", dataset, "data_item", dataItem); }
java
@Deprecated public static final String formatDataItemName(String project, String dataset, String dataItem) { return DATA_ITEM_PATH_TEMPLATE.instantiate( "project", project, "dataset", dataset, "data_item", dataItem); }
[ "@", "Deprecated", "public", "static", "final", "String", "formatDataItemName", "(", "String", "project", ",", "String", "dataset", ",", "String", "dataItem", ")", "{", "return", "DATA_ITEM_PATH_TEMPLATE", ".", "instantiate", "(", "\"project\"", ",", "project", ",...
Formats a string containing the fully-qualified path to represent a data_item resource. @deprecated Use the {@link DataItemName} class instead.
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "data_item", "resource", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L174-L180
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java
DerInputBuffer.getGeneralizedTime
public Date getGeneralizedTime(int len) throws IOException { if (len > available()) throw new IOException("short read of DER Generalized Time"); if (len < 13 || len > 23) throw new IOException("DER Generalized Time length error"); return getTime(len, true); }
java
public Date getGeneralizedTime(int len) throws IOException { if (len > available()) throw new IOException("short read of DER Generalized Time"); if (len < 13 || len > 23) throw new IOException("DER Generalized Time length error"); return getTime(len, true); }
[ "public", "Date", "getGeneralizedTime", "(", "int", "len", ")", "throws", "IOException", "{", "if", "(", "len", ">", "available", "(", ")", ")", "throw", "new", "IOException", "(", "\"short read of DER Generalized Time\"", ")", ";", "if", "(", "len", "<", "1...
Returns the Generalized Time value that takes up the specified number of bytes in this buffer. @param len the number of bytes to use
[ "Returns", "the", "Generalized", "Time", "value", "that", "takes", "up", "the", "specified", "number", "of", "bytes", "in", "this", "buffer", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L276-L285
aalmiray/Json-lib
src/main/java/net/sf/json/AbstractJSON.java
AbstractJSON.fireElementAddedEvent
protected static void fireElementAddedEvent( int index, Object element, JsonConfig jsonConfig ) { if( jsonConfig.isEventTriggeringEnabled() ){ for( Iterator listeners = jsonConfig.getJsonEventListeners() .iterator(); listeners.hasNext(); ){ JsonEventListener listener = (JsonEventListener) listeners.next(); try{ listener.onElementAdded( index, element ); }catch( RuntimeException e ){ log.warn( e ); } } } }
java
protected static void fireElementAddedEvent( int index, Object element, JsonConfig jsonConfig ) { if( jsonConfig.isEventTriggeringEnabled() ){ for( Iterator listeners = jsonConfig.getJsonEventListeners() .iterator(); listeners.hasNext(); ){ JsonEventListener listener = (JsonEventListener) listeners.next(); try{ listener.onElementAdded( index, element ); }catch( RuntimeException e ){ log.warn( e ); } } } }
[ "protected", "static", "void", "fireElementAddedEvent", "(", "int", "index", ",", "Object", "element", ",", "JsonConfig", "jsonConfig", ")", "{", "if", "(", "jsonConfig", ".", "isEventTriggeringEnabled", "(", ")", ")", "{", "for", "(", "Iterator", "listeners", ...
Fires an element added event. @param index the index where the element was added @param element the added element
[ "Fires", "an", "element", "added", "event", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/AbstractJSON.java#L110-L122
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java
PreConditionException.validateLesserThan
public static void validateLesserThan( long value, long limit, String identifier ) throws PreConditionException { if( value < limit ) { return; } throw new PreConditionException( identifier + " was not lesser than " + limit + ". Was: " + value ); }
java
public static void validateLesserThan( long value, long limit, String identifier ) throws PreConditionException { if( value < limit ) { return; } throw new PreConditionException( identifier + " was not lesser than " + limit + ". Was: " + value ); }
[ "public", "static", "void", "validateLesserThan", "(", "long", "value", ",", "long", "limit", ",", "String", "identifier", ")", "throws", "PreConditionException", "{", "if", "(", "value", "<", "limit", ")", "{", "return", ";", "}", "throw", "new", "PreCondit...
Validates that the value is lesser than a limit. <p/> This method ensures that <code>value < limit</code>. @param identifier The name of the object. @param limit The limit that the value must be smaller than. @param value The value to be tested. @throws PreConditionException if the condition is not met.
[ "Validates", "that", "the", "value", "is", "lesser", "than", "a", "limit", ".", "<p", "/", ">", "This", "method", "ensures", "that", "<code", ">", "value", "<", "limit<", "/", "code", ">", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java#L148-L156
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java
AtomCache.getStructureForDomain
public Structure getStructureForDomain(String scopId) throws IOException, StructureException { return getStructureForDomain(scopId, ScopFactory.getSCOP()); }
java
public Structure getStructureForDomain(String scopId) throws IOException, StructureException { return getStructureForDomain(scopId, ScopFactory.getSCOP()); }
[ "public", "Structure", "getStructureForDomain", "(", "String", "scopId", ")", "throws", "IOException", ",", "StructureException", "{", "return", "getStructureForDomain", "(", "scopId", ",", "ScopFactory", ".", "getSCOP", "(", ")", ")", ";", "}" ]
Returns the representation of a {@link ScopDomain} as a BioJava {@link Structure} object. @param scopId a SCOP Id @return a Structure object @throws IOException @throws StructureException
[ "Returns", "the", "representation", "of", "a", "{", "@link", "ScopDomain", "}", "as", "a", "BioJava", "{", "@link", "Structure", "}", "object", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java#L644-L646
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java
ImageMiscOps.fillUniform
public static void fillUniform(GrayF32 img, Random rand , float min , float max) { float range = max-min; float[] data = img.data; for (int y = 0; y < img.height; y++) { int index = img.getStartIndex() + y * img.getStride(); for (int x = 0; x < img.width; x++) { data[index++] = rand.nextFloat()*range+min; } } }
java
public static void fillUniform(GrayF32 img, Random rand , float min , float max) { float range = max-min; float[] data = img.data; for (int y = 0; y < img.height; y++) { int index = img.getStartIndex() + y * img.getStride(); for (int x = 0; x < img.width; x++) { data[index++] = rand.nextFloat()*range+min; } } }
[ "public", "static", "void", "fillUniform", "(", "GrayF32", "img", ",", "Random", "rand", ",", "float", "min", ",", "float", "max", ")", "{", "float", "range", "=", "max", "-", "min", ";", "float", "[", "]", "data", "=", "img", ".", "data", ";", "fo...
Sets each value in the image to a value drawn from an uniform distribution that has a range of min &le; X &lt; max. @param img Image which is to be filled. Modified, @param rand Random number generator @param min Minimum value of the distribution, inclusive @param max Maximum value of the distribution, inclusive
[ "Sets", "each", "value", "in", "the", "image", "to", "a", "value", "drawn", "from", "an", "uniform", "distribution", "that", "has", "a", "range", "of", "min", "&le", ";", "X", "&lt", ";", "max", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2454-L2465
Jasig/uPortal
uPortal-spring/src/main/java/org/springframework/web/portlet/HeaderHandlingDispatcherPortlet.java
HeaderHandlingDispatcherPortlet.doRenderService
@Override protected void doRenderService(RenderRequest request, RenderResponse response) throws Exception { super.doRenderService(request, response); }
java
@Override protected void doRenderService(RenderRequest request, RenderResponse response) throws Exception { super.doRenderService(request, response); }
[ "@", "Override", "protected", "void", "doRenderService", "(", "RenderRequest", "request", ",", "RenderResponse", "response", ")", "throws", "Exception", "{", "super", ".", "doRenderService", "(", "request", ",", "response", ")", ";", "}" ]
Processes the actual dispatching to the handler for render requests. <p>The handler will be obtained by applying the portlet's HandlerMappings in order. The HandlerAdapter will be obtained by querying the portlet's installed HandlerAdapters to find the first that supports the handler class. <p>For two-phase render processing <ol> <li>the interceptors and exception handlers should handle the two phases appropriately (if not idempotent skip processing during RENDER_HEADERS phase). <li>Though a streaming portlet likely will invoke RENDER_HEADERS before RENDER_MARKUP, there is no guarantee of order of execution; e.g. render_markup may be called before render_header. The only guarantee is that the resulting markup is inserted in the appropriate order. </ol> <p>For single-phase render, this method executes following normal conventions. <p>For two-phase render, this method will delegate <code>RENDER_MARKUP</code> of a two-phase render processing to the parent class for normal processing. Ideally for the <code> RENDER_HEADERS</code> phase it would invoke the portlet if there were no exceptions from the Action Phase (leave ACTION_EXCEPTION_SESSION_ATTRIBUTE in session and leave rethrowing the exception for the RENDER_MARKUP phase) and probably render no output if there was an exception. However triggerAfterRenderCompletion in the superclass is a private method so it cannot be executed in a subclass. For now we can only have RENDER_HEADERS perform the normal processing until Spring Framework Portlet MVC code incorporates this behavior. @param request current portlet render request @param response current portlet render response @throws Exception in case of any kind of processing failure
[ "Processes", "the", "actual", "dispatching", "to", "the", "handler", "for", "render", "requests", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-spring/src/main/java/org/springframework/web/portlet/HeaderHandlingDispatcherPortlet.java#L86-L90
infinispan/infinispan
lucene/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/DistributedSegmentReadLocker.java
DistributedSegmentReadLocker.isMultiChunked
private boolean isMultiChunked(final String filename) { final FileCacheKey fileCacheKey = new FileCacheKey(indexName, filename, affinitySegmentId); final FileMetadata fileMetadata = metadataCache.get(fileCacheKey); if (fileMetadata==null) { //This might happen under high load when the metadata is being written //using putAsync; in such case we return true as it's the safest option. //Skipping the readlocks is just a performance optimisation, and this //condition is extremely rare. return true; } else { return fileMetadata.isMultiChunked(); } }
java
private boolean isMultiChunked(final String filename) { final FileCacheKey fileCacheKey = new FileCacheKey(indexName, filename, affinitySegmentId); final FileMetadata fileMetadata = metadataCache.get(fileCacheKey); if (fileMetadata==null) { //This might happen under high load when the metadata is being written //using putAsync; in such case we return true as it's the safest option. //Skipping the readlocks is just a performance optimisation, and this //condition is extremely rare. return true; } else { return fileMetadata.isMultiChunked(); } }
[ "private", "boolean", "isMultiChunked", "(", "final", "String", "filename", ")", "{", "final", "FileCacheKey", "fileCacheKey", "=", "new", "FileCacheKey", "(", "indexName", ",", "filename", ",", "affinitySegmentId", ")", ";", "final", "FileMetadata", "fileMetadata",...
Evaluates if the file is potentially being stored as fragmented into multiple chunks; when it's a single chunk we don't need to apply readlocks. @param filename @return true if it is definitely fragmented, or if it's possibly fragmented.
[ "Evaluates", "if", "the", "file", "is", "potentially", "being", "stored", "as", "fragmented", "into", "multiple", "chunks", ";", "when", "it", "s", "a", "single", "chunk", "we", "don", "t", "need", "to", "apply", "readlocks", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/DistributedSegmentReadLocker.java#L108-L121
softindex/datakernel
boot/src/main/java/io/datakernel/service/ServiceGraphModule.java
ServiceGraphModule.registerForSpecificKey
public <T> ServiceGraphModule registerForSpecificKey(Key<T> key, ServiceAdapter<T> factory) { keys.put(key, factory); return this; }
java
public <T> ServiceGraphModule registerForSpecificKey(Key<T> key, ServiceAdapter<T> factory) { keys.put(key, factory); return this; }
[ "public", "<", "T", ">", "ServiceGraphModule", "registerForSpecificKey", "(", "Key", "<", "T", ">", "key", ",", "ServiceAdapter", "<", "T", ">", "factory", ")", "{", "keys", ".", "put", "(", "key", ",", "factory", ")", ";", "return", "this", ";", "}" ]
Puts the key and its factory to the keys @param key key with which the specified factory is to be associated @param factory value to be associated with the specified key @param <T> type of service @return ServiceGraphModule with change
[ "Puts", "the", "key", "and", "its", "factory", "to", "the", "keys" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/service/ServiceGraphModule.java#L156-L159
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbNetworks.java
TmdbNetworks.getNetworkInfo
public Network getNetworkInfo(int networkId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, networkId); URL url = new ApiUrl(apiKey, MethodBase.NETWORK).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, Network.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get network information", url, ex); } }
java
public Network getNetworkInfo(int networkId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, networkId); URL url = new ApiUrl(apiKey, MethodBase.NETWORK).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, Network.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get network information", url, ex); } }
[ "public", "Network", "getNetworkInfo", "(", "int", "networkId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "networkId", ")", ";", ...
This method is used to retrieve the basic information about a TV network. <p> You can use this ID to search for TV shows with the discover method. @param networkId @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "retrieve", "the", "basic", "information", "about", "a", "TV", "network", ".", "<p", ">", "You", "can", "use", "this", "ID", "to", "search", "for", "TV", "shows", "with", "the", "discover", "method", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbNetworks.java#L59-L71
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMesh.java
GVRMesh.createQuad
public void createQuad(float width, float height) { String vertexDescriptor = getVertexBuffer().getDescriptor(); float[] vertices = { width * -0.5f, height * 0.5f, 0.0f, width * -0.5f, height * -0.5f, 0.0f, width * 0.5f, height * 0.5f, 0.0f, width * 0.5f, height * -0.5f, 0.0f }; setVertices(vertices); if (vertexDescriptor.contains("normal")) { final float[] normals = {0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f}; setNormals(normals); } if (vertexDescriptor.contains("texcoord")) { final float[] texCoords = {0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f}; setTexCoords(texCoords); } char[] triangles = { 0, 1, 2, 1, 3, 2 }; setIndices(triangles); }
java
public void createQuad(float width, float height) { String vertexDescriptor = getVertexBuffer().getDescriptor(); float[] vertices = { width * -0.5f, height * 0.5f, 0.0f, width * -0.5f, height * -0.5f, 0.0f, width * 0.5f, height * 0.5f, 0.0f, width * 0.5f, height * -0.5f, 0.0f }; setVertices(vertices); if (vertexDescriptor.contains("normal")) { final float[] normals = {0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f}; setNormals(normals); } if (vertexDescriptor.contains("texcoord")) { final float[] texCoords = {0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f}; setTexCoords(texCoords); } char[] triangles = { 0, 1, 2, 1, 3, 2 }; setIndices(triangles); }
[ "public", "void", "createQuad", "(", "float", "width", ",", "float", "height", ")", "{", "String", "vertexDescriptor", "=", "getVertexBuffer", "(", ")", ".", "getDescriptor", "(", ")", ";", "float", "[", "]", "vertices", "=", "{", "width", "*", "-", "0.5...
Sets the contents of this mesh to be a quad consisting of two triangles, with the specified width and height. If the mesh descriptor allows for normals and/or texture coordinates, they are added. @param width the quad's width @param height the quad's height
[ "Sets", "the", "contents", "of", "this", "mesh", "to", "be", "a", "quad", "consisting", "of", "two", "triangles", "with", "the", "specified", "width", "and", "height", ".", "If", "the", "mesh", "descriptor", "allows", "for", "normals", "and", "/", "or", ...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRMesh.java#L698-L720
RobAustin/low-latency-primitive-concurrent-queues
src/main/java/uk/co/boundedbuffer/ConcurrentBlockingIntQueue.java
ConcurrentBlockingIntQueue.drainTo
int drainTo(int[] target, int maxElements) { // non volatile read ( which is quicker ) int readLocation = this.consumerReadLocation; int i = 0; // to reduce the number of volatile reads we are going to perform a kind of double check reading on the volatile write location int writeLocation = this.writeLocation; do { // in the for loop below, we are blocked reading unit another item is written, this is because we are empty ( aka size()=0) // inside the for loop, getting the 'writeLocation', this will serve as our read memory barrier. if (writeLocation == readLocation) { writeLocation = this.writeLocation; if (writeLocation == readLocation) { setReadLocation(readLocation); return i; } } // sets the nextReadLocation my moving it on by 1, this may cause it it wrap back to the start. readLocation = (readLocation + 1 == capacity) ? 0 : readLocation + 1; // purposely not volatile as the read memory barrier occurred above when we read 'writeLocation' target[i] = data[readLocation]; } while (i <= maxElements); setReadLocation(readLocation); return maxElements; }
java
int drainTo(int[] target, int maxElements) { // non volatile read ( which is quicker ) int readLocation = this.consumerReadLocation; int i = 0; // to reduce the number of volatile reads we are going to perform a kind of double check reading on the volatile write location int writeLocation = this.writeLocation; do { // in the for loop below, we are blocked reading unit another item is written, this is because we are empty ( aka size()=0) // inside the for loop, getting the 'writeLocation', this will serve as our read memory barrier. if (writeLocation == readLocation) { writeLocation = this.writeLocation; if (writeLocation == readLocation) { setReadLocation(readLocation); return i; } } // sets the nextReadLocation my moving it on by 1, this may cause it it wrap back to the start. readLocation = (readLocation + 1 == capacity) ? 0 : readLocation + 1; // purposely not volatile as the read memory barrier occurred above when we read 'writeLocation' target[i] = data[readLocation]; } while (i <= maxElements); setReadLocation(readLocation); return maxElements; }
[ "int", "drainTo", "(", "int", "[", "]", "target", ",", "int", "maxElements", ")", "{", "// non volatile read ( which is quicker )", "int", "readLocation", "=", "this", ".", "consumerReadLocation", ";", "int", "i", "=", "0", ";", "// to reduce the number of volatile...
Removes at most the given number of available elements from this queue and adds them to the given collection. A failure encountered while attempting to add elements to collection <tt>c</tt> may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in <tt>IllegalArgumentException</tt>. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress. @param target the array to transfer elements into @param maxElements the maximum number of elements to transfer @return the number of elements transferred @throws UnsupportedOperationException if addition of elements is not supported by the specified collection @throws ClassCastException if the class of an element of this queue prevents it from being added to the specified collection @throws NullPointerException if the specified collection is null @throws IllegalArgumentException if the specified collection is this queue, or some property of an element of this queue prevents it from being added to the specified collection
[ "Removes", "at", "most", "the", "given", "number", "of", "available", "elements", "from", "this", "queue", "and", "adds", "them", "to", "the", "given", "collection", ".", "A", "failure", "encountered", "while", "attempting", "to", "add", "elements", "to", "c...
train
https://github.com/RobAustin/low-latency-primitive-concurrent-queues/blob/ffcf95a8135750c0b23cd486346a1f68a4724b1c/src/main/java/uk/co/boundedbuffer/ConcurrentBlockingIntQueue.java#L386-L425
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Admin.java
Admin.doUpdateMonitor
private void doUpdateMonitor() throws PageException { ClassDefinition cd = new ClassDefinitionImpl(getString("admin", action, "class"), getString("bundleName", null), getString("bundleVersion", null), config.getIdentification()); admin.updateMonitor(cd, getString("admin", "updateMonitor", "monitorType"), getString("admin", "updateMonitor", "name"), getBool("admin", "updateMonitor", "logEnabled")); store(); adminSync.broadcast(attributes, config); }
java
private void doUpdateMonitor() throws PageException { ClassDefinition cd = new ClassDefinitionImpl(getString("admin", action, "class"), getString("bundleName", null), getString("bundleVersion", null), config.getIdentification()); admin.updateMonitor(cd, getString("admin", "updateMonitor", "monitorType"), getString("admin", "updateMonitor", "name"), getBool("admin", "updateMonitor", "logEnabled")); store(); adminSync.broadcast(attributes, config); }
[ "private", "void", "doUpdateMonitor", "(", ")", "throws", "PageException", "{", "ClassDefinition", "cd", "=", "new", "ClassDefinitionImpl", "(", "getString", "(", "\"admin\"", ",", "action", ",", "\"class\"", ")", ",", "getString", "(", "\"bundleName\"", ",", "n...
/* private void doUpdateUpdateLogSettings() throws PageException { int level=LogUtil.toIntType(getString("admin", "updateUpdateLogSettings", "level"), -1); String source=getString("admin", "updateUpdateLogSettings", "path"); if(source.indexOf("{")==-1){ Resource res = ResourceUtil.toResourceNotExisting(pageContext, source, false); String tmp=SystemUtil.addPlaceHolder(res, config, null); if(tmp!=null) source=tmp; else source=ContractPath.call(pageContext, source); } admin.updateLogSettings( getString("admin", "updateUpdateLogSettings", "name"), level, source, getInt("admin", "updateUpdateLogSettings", "maxfile"), getInt("admin", "updateUpdateLogSettings", "maxfilesize") ); store(); adminSync.broadcast(attributes, config); }
[ "/", "*", "private", "void", "doUpdateUpdateLogSettings", "()", "throws", "PageException", "{", "int", "level", "=", "LogUtil", ".", "toIntType", "(", "getString", "(", "admin", "updateUpdateLogSettings", "level", ")", "-", "1", ")", ";", "String", "source", "...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Admin.java#L4146-L4153
Crab2died/Excel4J
src/main/java/com/github/crab2died/utils/Utils.java
Utils.getterOrSetter
public static Method getterOrSetter(Class clazz, String fieldName, FieldAccessType methodType) throws IntrospectionException { if (null == fieldName || "".equals(fieldName)) return null; BeanInfo beanInfo = Introspector.getBeanInfo(clazz); PropertyDescriptor[] props = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor prop : props) { if (fieldName.equals(prop.getName())) { if (FieldAccessType.SETTER == methodType) { return prop.getWriteMethod(); } if (FieldAccessType.GETTER == methodType) { return prop.getReadMethod(); } } } throw new IntrospectionException("Can not get the getter or setter method"); }
java
public static Method getterOrSetter(Class clazz, String fieldName, FieldAccessType methodType) throws IntrospectionException { if (null == fieldName || "".equals(fieldName)) return null; BeanInfo beanInfo = Introspector.getBeanInfo(clazz); PropertyDescriptor[] props = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor prop : props) { if (fieldName.equals(prop.getName())) { if (FieldAccessType.SETTER == methodType) { return prop.getWriteMethod(); } if (FieldAccessType.GETTER == methodType) { return prop.getReadMethod(); } } } throw new IntrospectionException("Can not get the getter or setter method"); }
[ "public", "static", "Method", "getterOrSetter", "(", "Class", "clazz", ",", "String", "fieldName", ",", "FieldAccessType", "methodType", ")", "throws", "IntrospectionException", "{", "if", "(", "null", "==", "fieldName", "||", "\"\"", ".", "equals", "(", "fieldN...
<p>根据java对象属性{@link Field}获取该属性的getter或setter方法名, 另对{@link boolean}及{@link Boolean}做了行管处理</p> @param clazz 操作对象 @param fieldName 对象属性 @param methodType 方法类型,getter或setter枚举 @return getter或setter方法 @throws IntrospectionException 异常 @author Crab2Died
[ "<p", ">", "根据java对象属性", "{", "@link", "Field", "}", "获取该属性的getter或setter方法名,", "另对", "{", "@link", "boolean", "}", "及", "{", "@link", "Boolean", "}", "做了行管处理<", "/", "p", ">" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/utils/Utils.java#L230-L249
line/armeria
core/src/main/java/com/linecorp/armeria/server/HttpStatusException.java
HttpStatusException.of
public static HttpStatusException of(int statusCode) { if (statusCode < 0 || statusCode >= 1000) { final HttpStatus status = HttpStatus.valueOf(statusCode); if (Flags.verboseExceptions()) { return new HttpStatusException(status); } else { return new HttpStatusException(status, false); } } else { return EXCEPTIONS[statusCode]; } }
java
public static HttpStatusException of(int statusCode) { if (statusCode < 0 || statusCode >= 1000) { final HttpStatus status = HttpStatus.valueOf(statusCode); if (Flags.verboseExceptions()) { return new HttpStatusException(status); } else { return new HttpStatusException(status, false); } } else { return EXCEPTIONS[statusCode]; } }
[ "public", "static", "HttpStatusException", "of", "(", "int", "statusCode", ")", "{", "if", "(", "statusCode", "<", "0", "||", "statusCode", ">=", "1000", ")", "{", "final", "HttpStatus", "status", "=", "HttpStatus", ".", "valueOf", "(", "statusCode", ")", ...
Returns a new {@link HttpStatusException} instance with the specified HTTP status code.
[ "Returns", "a", "new", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/HttpStatusException.java#L42-L53
leancloud/java-sdk-all
core/src/main/java/cn/leancloud/upload/QiniuAccessor.java
QiniuAccessor.makeFile
public QiniuMKFileResponseData makeFile(int fileTotalSize, List<String> uploadFileCtxs, int retry) throws Exception { try { String endPoint = String.format(QINIU_MKFILE_EP, this.uploadUrl, fileTotalSize, Base64.encodeToString(this.fileKey.getBytes(), Base64.URL_SAFE | Base64.NO_WRAP)); final String joinedFileCtx = StringUtil.join(",", uploadFileCtxs); Request.Builder builder = new Request.Builder(); builder.url(endPoint); builder.addHeader(HEAD_CONTENT_TYPE, TEXT_CONTENT_TYPE); builder.addHeader(HEAD_CONTENT_LENGTH, String.valueOf(joinedFileCtx.length())); builder.addHeader(HEAD_AUTHORIZATION, "UpToken " + this.uploadToken); LOGGER.d("makeFile to qiniu with uploadUrl: " + endPoint); builder = builder.post(RequestBody.create(MediaType.parse(TEXT_CONTENT_TYPE), joinedFileCtx)); Response response = this.client.newCall(builder.build()).execute(); return parseQiniuResponse(response, QiniuMKFileResponseData.class); } catch (Exception e) { if (retry-- > 0) { return makeFile(fileTotalSize, uploadFileCtxs, retry); } else { LOGGER.w(e); } } return null; }
java
public QiniuMKFileResponseData makeFile(int fileTotalSize, List<String> uploadFileCtxs, int retry) throws Exception { try { String endPoint = String.format(QINIU_MKFILE_EP, this.uploadUrl, fileTotalSize, Base64.encodeToString(this.fileKey.getBytes(), Base64.URL_SAFE | Base64.NO_WRAP)); final String joinedFileCtx = StringUtil.join(",", uploadFileCtxs); Request.Builder builder = new Request.Builder(); builder.url(endPoint); builder.addHeader(HEAD_CONTENT_TYPE, TEXT_CONTENT_TYPE); builder.addHeader(HEAD_CONTENT_LENGTH, String.valueOf(joinedFileCtx.length())); builder.addHeader(HEAD_AUTHORIZATION, "UpToken " + this.uploadToken); LOGGER.d("makeFile to qiniu with uploadUrl: " + endPoint); builder = builder.post(RequestBody.create(MediaType.parse(TEXT_CONTENT_TYPE), joinedFileCtx)); Response response = this.client.newCall(builder.build()).execute(); return parseQiniuResponse(response, QiniuMKFileResponseData.class); } catch (Exception e) { if (retry-- > 0) { return makeFile(fileTotalSize, uploadFileCtxs, retry); } else { LOGGER.w(e); } } return null; }
[ "public", "QiniuMKFileResponseData", "makeFile", "(", "int", "fileTotalSize", ",", "List", "<", "String", ">", "uploadFileCtxs", ",", "int", "retry", ")", "throws", "Exception", "{", "try", "{", "String", "endPoint", "=", "String", ".", "format", "(", "QINIU_M...
REST API POST /mkfile/<fileSize>/key/<encodedKey>/mimeType/<encodedMimeType>/x:user-var/<encodedUserVars> HTTP/1.1 Host: <UpHost> Content-Type: text/plain Content-Length: <ctxListSize> Authorization: UpToken <UploadToken> <ctxList> Request params: - fileSize - encodeKey - encodedMimeType - encodedUserVars Response: { "hash": "<ContentHash string>", "key": "<Key string>" } @param fileTotalSize @param uploadFileCtxs @param retry @return @throws Exception
[ "REST", "API", "POST", "/", "mkfile", "/", "<fileSize", ">", "/", "key", "/", "<encodedKey", ">", "/", "mimeType", "/", "<encodedMimeType", ">", "/", "x", ":", "user", "-", "var", "/", "<encodedUserVars", ">", "HTTP", "/", "1", ".", "1", "Host", ":",...
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/upload/QiniuAccessor.java#L332-L356
Harium/keel
src/main/java/com/harium/keel/catalano/math/ComplexNumber.java
ComplexNumber.Add
public static ComplexNumber Add(ComplexNumber z1, double scalar) { return new ComplexNumber(z1.real + scalar, z1.imaginary); }
java
public static ComplexNumber Add(ComplexNumber z1, double scalar) { return new ComplexNumber(z1.real + scalar, z1.imaginary); }
[ "public", "static", "ComplexNumber", "Add", "(", "ComplexNumber", "z1", ",", "double", "scalar", ")", "{", "return", "new", "ComplexNumber", "(", "z1", ".", "real", "+", "scalar", ",", "z1", ".", "imaginary", ")", ";", "}" ]
Adds the complex number with a scalar value. @param z1 Complex Number. @param scalar Scalar value. @return Returns new ComplexNumber instance containing the add of specified complex number with scalar value.
[ "Adds", "the", "complex", "number", "with", "a", "scalar", "value", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/ComplexNumber.java#L252-L254
VoltDB/voltdb
src/frontend/org/voltdb/expressions/AbstractExpression.java
AbstractExpression.loadFromJSONArrayChild
public static List<AbstractExpression> loadFromJSONArrayChild( List<AbstractExpression> starter, JSONObject parent, String label, StmtTableScan tableScan) throws JSONException { if (parent.isNull(label)) { return null; } JSONArray jarray = parent.getJSONArray(label); return loadFromJSONArray(starter, jarray, tableScan); }
java
public static List<AbstractExpression> loadFromJSONArrayChild( List<AbstractExpression> starter, JSONObject parent, String label, StmtTableScan tableScan) throws JSONException { if (parent.isNull(label)) { return null; } JSONArray jarray = parent.getJSONArray(label); return loadFromJSONArray(starter, jarray, tableScan); }
[ "public", "static", "List", "<", "AbstractExpression", ">", "loadFromJSONArrayChild", "(", "List", "<", "AbstractExpression", ">", "starter", ",", "JSONObject", "parent", ",", "String", "label", ",", "StmtTableScan", "tableScan", ")", "throws", "JSONException", "{",...
For TVEs, it is only serialized column index and table index. In order to match expression, there needs more information to revert back the table name, table alisa and column name. By adding @param tableScan, the TVE will load table name, table alias and column name for TVE. @param starter @param parent @param label @param tableScan @throws JSONException
[ "For", "TVEs", "it", "is", "only", "serialized", "column", "index", "and", "table", "index", ".", "In", "order", "to", "match", "expression", "there", "needs", "more", "information", "to", "revert", "back", "the", "table", "name", "table", "alisa", "and", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/AbstractExpression.java#L812-L823
evernote/android-intent
library/src/main/java/com/evernote/android/intent/CreateNewNoteIntentBuilder.java
CreateNewNoteIntentBuilder.setTags
public CreateNewNoteIntentBuilder setTags(@Nullable ArrayList<String> tags) { return putStringArrayList(EvernoteIntent.EXTRA_TAG_NAME_LIST, tags); }
java
public CreateNewNoteIntentBuilder setTags(@Nullable ArrayList<String> tags) { return putStringArrayList(EvernoteIntent.EXTRA_TAG_NAME_LIST, tags); }
[ "public", "CreateNewNoteIntentBuilder", "setTags", "(", "@", "Nullable", "ArrayList", "<", "String", ">", "tags", ")", "{", "return", "putStringArrayList", "(", "EvernoteIntent", ".", "EXTRA_TAG_NAME_LIST", ",", "tags", ")", ";", "}" ]
Set the tags for the new note. <b>Caution: </b>Any existing tags are overwritten. Use {@link #addTags(ArrayList)} to keep the already set tags in this builder. @param tags The tags which should be added to the new note. If {@code null} then the current value gets removed. @return This Builder object to allow for chaining of calls to set methods.
[ "Set", "the", "tags", "for", "the", "new", "note", ".", "<b", ">", "Caution", ":", "<", "/", "b", ">", "Any", "existing", "tags", "are", "overwritten", ".", "Use", "{", "@link", "#addTags", "(", "ArrayList", ")", "}", "to", "keep", "the", "already", ...
train
https://github.com/evernote/android-intent/blob/5df1bec46b0a7d27be816d62f8fd2c10bda731ea/library/src/main/java/com/evernote/android/intent/CreateNewNoteIntentBuilder.java#L121-L123
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java
ShuttleList.indexOf
protected int indexOf(final Object o) { final int size = dataModel.getSize(); for (int i = 0; i < size; i++) { if (comparator == null) { if (o.equals(dataModel.getElementAt(i))) { return i; } } else if (comparator.compare(o, dataModel.getElementAt(i)) == 0) { return i; } } return -1; }
java
protected int indexOf(final Object o) { final int size = dataModel.getSize(); for (int i = 0; i < size; i++) { if (comparator == null) { if (o.equals(dataModel.getElementAt(i))) { return i; } } else if (comparator.compare(o, dataModel.getElementAt(i)) == 0) { return i; } } return -1; }
[ "protected", "int", "indexOf", "(", "final", "Object", "o", ")", "{", "final", "int", "size", "=", "dataModel", ".", "getSize", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "compar...
Get the index of a given object in the underlying data model. @param o Object to locate @return index of object in model, -1 if not found
[ "Get", "the", "index", "of", "a", "given", "object", "in", "the", "underlying", "data", "model", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/ShuttleList.java#L510-L523
davidmoten/rxjava-jdbc
src/main/java/com/github/davidmoten/rx/jdbc/Database.java
Database.beginTransactionOnNext_
public <T> Transformer<T, T> beginTransactionOnNext_() { return new Transformer<T, T>() { @Override public Observable<T> call(Observable<T> source) { return beginTransactionOnNext(Database.this, source); } }; }
java
public <T> Transformer<T, T> beginTransactionOnNext_() { return new Transformer<T, T>() { @Override public Observable<T> call(Observable<T> source) { return beginTransactionOnNext(Database.this, source); } }; }
[ "public", "<", "T", ">", "Transformer", "<", "T", ",", "T", ">", "beginTransactionOnNext_", "(", ")", "{", "return", "new", "Transformer", "<", "T", ",", "T", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "T", ">", "call", "(", ...
Starts a database transaction for each onNext call. Following database calls will be subscribed on current thread (Schedulers.trampoline()) and share the same {@link Connection} until transaction is rolled back or committed. @return begin transaction Transformer
[ "Starts", "a", "database", "transaction", "for", "each", "onNext", "call", ".", "Following", "database", "calls", "will", "be", "subscribed", "on", "current", "thread", "(", "Schedulers", ".", "trampoline", "()", ")", "and", "share", "the", "same", "{", "@li...
train
https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Database.java#L771-L778
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java
CrossTabColorShema.setTotalColorForRow
public void setTotalColorForRow(int row, Color color){ int map = (colors[0].length-1) - row; colors[colors.length-1][map]=color; }
java
public void setTotalColorForRow(int row, Color color){ int map = (colors[0].length-1) - row; colors[colors.length-1][map]=color; }
[ "public", "void", "setTotalColorForRow", "(", "int", "row", ",", "Color", "color", ")", "{", "int", "map", "=", "(", "colors", "[", "0", "]", ".", "length", "-", "1", ")", "-", "row", ";", "colors", "[", "colors", ".", "length", "-", "1", "]", "[...
* Sets the color for each total for the row @param row (starting from 1) @param color
[ "*", "Sets", "the", "color", "for", "each", "total", "for", "the", "row" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java#L92-L95
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
MapView.getWorldToViewTransformation
public Matrix getWorldToViewTransformation() { if (viewState.getScale() > 0) { double dX = -(viewState.getX() * viewState.getScale()) + width / 2; double dY = viewState.getY() * viewState.getScale() + height / 2; return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY); } return new Matrix(1, 0, 0, 1, 0, 0); }
java
public Matrix getWorldToViewTransformation() { if (viewState.getScale() > 0) { double dX = -(viewState.getX() * viewState.getScale()) + width / 2; double dY = viewState.getY() * viewState.getScale() + height / 2; return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY); } return new Matrix(1, 0, 0, 1, 0, 0); }
[ "public", "Matrix", "getWorldToViewTransformation", "(", ")", "{", "if", "(", "viewState", ".", "getScale", "(", ")", ">", "0", ")", "{", "double", "dX", "=", "-", "(", "viewState", ".", "getX", "(", ")", "*", "viewState", ".", "getScale", "(", ")", ...
Return the world-to-view space transformation matrix. @return transformation matrix
[ "Return", "the", "world", "-", "to", "-", "view", "space", "transformation", "matrix", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L141-L148
box/box-java-sdk
src/main/java/com/box/sdk/LargeFileUpload.java
LargeFileUpload.generateDigest
public String generateDigest(InputStream stream) { MessageDigest digest = null; try { digest = MessageDigest.getInstance(DIGEST_ALGORITHM_SHA1); } catch (NoSuchAlgorithmException ae) { throw new BoxAPIException("Digest algorithm not found", ae); } //Calcuate the digest using the stream. DigestInputStream dis = new DigestInputStream(stream, digest); try { int value = dis.read(); while (value != -1) { value = dis.read(); } } catch (IOException ioe) { throw new BoxAPIException("Reading the stream failed.", ioe); } //Get the calculated digest for the stream byte[] digestBytes = digest.digest(); return Base64.encode(digestBytes); }
java
public String generateDigest(InputStream stream) { MessageDigest digest = null; try { digest = MessageDigest.getInstance(DIGEST_ALGORITHM_SHA1); } catch (NoSuchAlgorithmException ae) { throw new BoxAPIException("Digest algorithm not found", ae); } //Calcuate the digest using the stream. DigestInputStream dis = new DigestInputStream(stream, digest); try { int value = dis.read(); while (value != -1) { value = dis.read(); } } catch (IOException ioe) { throw new BoxAPIException("Reading the stream failed.", ioe); } //Get the calculated digest for the stream byte[] digestBytes = digest.digest(); return Base64.encode(digestBytes); }
[ "public", "String", "generateDigest", "(", "InputStream", "stream", ")", "{", "MessageDigest", "digest", "=", "null", ";", "try", "{", "digest", "=", "MessageDigest", ".", "getInstance", "(", "DIGEST_ALGORITHM_SHA1", ")", ";", "}", "catch", "(", "NoSuchAlgorithm...
Generates the Base64 encoded SHA-1 hash for content available in the stream. It can be used to calculate the hash of a file. @param stream the input stream of the file or data. @return the Base64 encoded hash string.
[ "Generates", "the", "Base64", "encoded", "SHA", "-", "1", "hash", "for", "content", "available", "in", "the", "stream", ".", "It", "can", "be", "used", "to", "calculate", "the", "hash", "of", "a", "file", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/LargeFileUpload.java#L220-L242
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java
SegmentAggregator.mergeInStorage
private CompletableFuture<SegmentProperties> mergeInStorage(SegmentMetadata transactionMetadata, MergeSegmentOperation mergeOp, TimeoutTimer timer) { return this.storage .getStreamSegmentInfo(transactionMetadata.getName(), timer.getRemaining()) .thenAcceptAsync(transProperties -> { // One last verification before the actual merger: // Check that the Storage agrees with our metadata (if not, we have a problem ...) if (transProperties.getLength() != transactionMetadata.getStorageLength()) { throw new CompletionException(new DataCorruptionException(String.format( "Transaction Segment '%s' cannot be merged into parent '%s' because its metadata disagrees with the Storage. Metadata.StorageLength=%d, Storage.StorageLength=%d", transactionMetadata.getName(), this.metadata.getName(), transactionMetadata.getStorageLength(), transProperties.getLength()))); } if (transProperties.getLength() != mergeOp.getLength()) { throw new CompletionException(new DataCorruptionException(String.format( "Transaction Segment '%s' cannot be merged into parent '%s' because the declared length in the operation disagrees with the Storage. Operation.Length=%d, Storage.StorageLength=%d", transactionMetadata.getName(), this.metadata.getName(), mergeOp.getLength(), transProperties.getLength()))); } }, this.executor) .thenComposeAsync(v -> createSegmentIfNecessary( () -> storage.concat(this.handle.get(), mergeOp.getStreamSegmentOffset(), transactionMetadata.getName(), timer.getRemaining()), timer.getRemaining()), this.executor) .exceptionally(ex -> { ex = Exceptions.unwrap(ex); if (transactionMetadata.getLength() == 0 && ex instanceof StreamSegmentNotExistsException && ((StreamSegmentNotExistsException) ex).getStreamSegmentName().equals(transactionMetadata.getName())) { log.warn("{}: Not applying '{}' because source segment is missing (storage) and had no data.", this.traceObjectId, mergeOp); return null; } else { throw new CompletionException(ex); } }) .thenComposeAsync(v -> storage.getStreamSegmentInfo(this.metadata.getName(), timer.getRemaining()), this.executor); }
java
private CompletableFuture<SegmentProperties> mergeInStorage(SegmentMetadata transactionMetadata, MergeSegmentOperation mergeOp, TimeoutTimer timer) { return this.storage .getStreamSegmentInfo(transactionMetadata.getName(), timer.getRemaining()) .thenAcceptAsync(transProperties -> { // One last verification before the actual merger: // Check that the Storage agrees with our metadata (if not, we have a problem ...) if (transProperties.getLength() != transactionMetadata.getStorageLength()) { throw new CompletionException(new DataCorruptionException(String.format( "Transaction Segment '%s' cannot be merged into parent '%s' because its metadata disagrees with the Storage. Metadata.StorageLength=%d, Storage.StorageLength=%d", transactionMetadata.getName(), this.metadata.getName(), transactionMetadata.getStorageLength(), transProperties.getLength()))); } if (transProperties.getLength() != mergeOp.getLength()) { throw new CompletionException(new DataCorruptionException(String.format( "Transaction Segment '%s' cannot be merged into parent '%s' because the declared length in the operation disagrees with the Storage. Operation.Length=%d, Storage.StorageLength=%d", transactionMetadata.getName(), this.metadata.getName(), mergeOp.getLength(), transProperties.getLength()))); } }, this.executor) .thenComposeAsync(v -> createSegmentIfNecessary( () -> storage.concat(this.handle.get(), mergeOp.getStreamSegmentOffset(), transactionMetadata.getName(), timer.getRemaining()), timer.getRemaining()), this.executor) .exceptionally(ex -> { ex = Exceptions.unwrap(ex); if (transactionMetadata.getLength() == 0 && ex instanceof StreamSegmentNotExistsException && ((StreamSegmentNotExistsException) ex).getStreamSegmentName().equals(transactionMetadata.getName())) { log.warn("{}: Not applying '{}' because source segment is missing (storage) and had no data.", this.traceObjectId, mergeOp); return null; } else { throw new CompletionException(ex); } }) .thenComposeAsync(v -> storage.getStreamSegmentInfo(this.metadata.getName(), timer.getRemaining()), this.executor); }
[ "private", "CompletableFuture", "<", "SegmentProperties", ">", "mergeInStorage", "(", "SegmentMetadata", "transactionMetadata", ",", "MergeSegmentOperation", "mergeOp", ",", "TimeoutTimer", "timer", ")", "{", "return", "this", ".", "storage", ".", "getStreamSegmentInfo", ...
Executes the merge of the Source StreamSegment with given metadata into this one in Storage.
[ "Executes", "the", "merge", "of", "the", "Source", "StreamSegment", "with", "given", "metadata", "into", "this", "one", "in", "Storage", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L943-L982
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.addObject
public JSONObject addObject(JSONObject obj, RequestOptions requestOptions) throws AlgoliaException { return client.postRequest("/1/indexes/" + encodedIndexName, obj.toString(), true, false, requestOptions); }
java
public JSONObject addObject(JSONObject obj, RequestOptions requestOptions) throws AlgoliaException { return client.postRequest("/1/indexes/" + encodedIndexName, obj.toString(), true, false, requestOptions); }
[ "public", "JSONObject", "addObject", "(", "JSONObject", "obj", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "return", "client", ".", "postRequest", "(", "\"/1/indexes/\"", "+", "encodedIndexName", ",", "obj", ".", "toString", "(",...
Add an object in this index @param obj the object to add @param requestOptions Options to pass to this request
[ "Add", "an", "object", "in", "this", "index" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L83-L85
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java
PredicateUtils.createCompareCondition
public static Optional<Condition> createCompareCondition(final PredicateCompareRightValue compareRightValue, final Column column) { return compareRightValue.getExpression() instanceof SimpleExpressionSegment ? Optional.of(new Condition(column, ((SimpleExpressionSegment) compareRightValue.getExpression()).getSQLExpression())) : Optional.<Condition>absent(); }
java
public static Optional<Condition> createCompareCondition(final PredicateCompareRightValue compareRightValue, final Column column) { return compareRightValue.getExpression() instanceof SimpleExpressionSegment ? Optional.of(new Condition(column, ((SimpleExpressionSegment) compareRightValue.getExpression()).getSQLExpression())) : Optional.<Condition>absent(); }
[ "public", "static", "Optional", "<", "Condition", ">", "createCompareCondition", "(", "final", "PredicateCompareRightValue", "compareRightValue", ",", "final", "Column", "column", ")", "{", "return", "compareRightValue", ".", "getExpression", "(", ")", "instanceof", "...
Create condition of compare operator. @param compareRightValue right value of compare operator @param column column @return condition
[ "Create", "condition", "of", "compare", "operator", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java#L100-L103
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/RepeatableReadStrategy.java
RepeatableReadStrategy.releaseLock
public boolean releaseLock(TransactionImpl tx, Object obj) { LockEntry writer = getWriter(obj); if (writer != null && writer.isOwnedBy(tx)) { removeWriter(writer); return true; } if (hasReadLock(tx, obj)) { removeReader(tx, obj); return true; } return false; }
java
public boolean releaseLock(TransactionImpl tx, Object obj) { LockEntry writer = getWriter(obj); if (writer != null && writer.isOwnedBy(tx)) { removeWriter(writer); return true; } if (hasReadLock(tx, obj)) { removeReader(tx, obj); return true; } return false; }
[ "public", "boolean", "releaseLock", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "LockEntry", "writer", "=", "getWriter", "(", "obj", ")", ";", "if", "(", "writer", "!=", "null", "&&", "writer", ".", "isOwnedBy", "(", "tx", ")", ")", "...
release a lock on Object obj for Transaction tx. @param tx the transaction releasing the lock @param obj the Object to be unlocked @return true if successful, else false
[ "release", "a", "lock", "on", "Object", "obj", "for", "Transaction", "tx", ".", "@param", "tx", "the", "transaction", "releasing", "the", "lock", "@param", "obj", "the", "Object", "to", "be", "unlocked", "@return", "true", "if", "successful", "else", "false"...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RepeatableReadStrategy.java#L144-L158
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.WSG84_L4
public static Point2d WSG84_L4(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
java
public static Point2d WSG84_L4(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
[ "public", "static", "Point2d", "WSG84_L4", "(", "double", "lambda", ",", "double", "phi", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "WSG84_NTFLamdaPhi", "(", "lambda", ",", "phi", ")", ";", "return", "NTFLambdaPhi_NTFLambert", "(", "ntfLambdaPhi", ".", ...
This function convert WSG84 GPS coordinate to France Lambert IV coordinate. @param lambda in degrees. @param phi in degrees. @return the France Lambert IV coordinates.
[ "This", "function", "convert", "WSG84", "GPS", "coordinate", "to", "France", "Lambert", "IV", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1115-L1123
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Model.java
Model.setRaw
private <T extends Model> T setRaw(String attributeName, Object value) { if (manageTime && attributeName.equalsIgnoreCase("created_at")) { throw new IllegalArgumentException("cannot set 'created_at'"); } metaModelLocal.checkAttribute(attributeName); if (willAttributeModifyModel(attributeName, value)) { attributes.put(attributeName, value); dirtyAttributeNames.add(attributeName); } return (T) this; }
java
private <T extends Model> T setRaw(String attributeName, Object value) { if (manageTime && attributeName.equalsIgnoreCase("created_at")) { throw new IllegalArgumentException("cannot set 'created_at'"); } metaModelLocal.checkAttribute(attributeName); if (willAttributeModifyModel(attributeName, value)) { attributes.put(attributeName, value); dirtyAttributeNames.add(attributeName); } return (T) this; }
[ "private", "<", "T", "extends", "Model", ">", "T", "setRaw", "(", "String", "attributeName", ",", "Object", "value", ")", "{", "if", "(", "manageTime", "&&", "attributeName", ".", "equalsIgnoreCase", "(", "\"created_at\"", ")", ")", "{", "throw", "new", "I...
Sets raw value of an attribute, without applying conversions.
[ "Sets", "raw", "value", "of", "an", "attribute", "without", "applying", "conversions", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L374-L385
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.getHypothesis
public static float getHypothesis(ProbabilisticNetwork bn, String nodeName, String status) throws ShanksException { ProbabilisticNode node = ShanksAgentBayesianReasoningCapability .getNode(bn, nodeName); int states = node.getStatesSize(); for (int i = 0; i < states; i++) { if (status.equals(node.getStateAt(i))) { return node.getMarginalAt(i); } } throw new UnknowkNodeStateException(bn, nodeName, status); }
java
public static float getHypothesis(ProbabilisticNetwork bn, String nodeName, String status) throws ShanksException { ProbabilisticNode node = ShanksAgentBayesianReasoningCapability .getNode(bn, nodeName); int states = node.getStatesSize(); for (int i = 0; i < states; i++) { if (status.equals(node.getStateAt(i))) { return node.getMarginalAt(i); } } throw new UnknowkNodeStateException(bn, nodeName, status); }
[ "public", "static", "float", "getHypothesis", "(", "ProbabilisticNetwork", "bn", ",", "String", "nodeName", ",", "String", "status", ")", "throws", "ShanksException", "{", "ProbabilisticNode", "node", "=", "ShanksAgentBayesianReasoningCapability", ".", "getNode", "(", ...
Get the value of a status in a node @param bn @param nodeName @param status @return a float with the probability @throws UnknownNodeException @throws UnknowkNodeStateException
[ "Get", "the", "value", "of", "a", "status", "in", "a", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java#L378-L389
aoindustries/aocode-public
src/main/java/com/aoindustries/util/EncodingUtils.java
EncodingUtils.encodeHtml
@Deprecated public static String encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException { if(value==null) return null; StringBuilder result = new StringBuilder(); encodeHtml(value, make_br, make_nbsp, result); return result.toString(); }
java
@Deprecated public static String encodeHtml(Object value, boolean make_br, boolean make_nbsp) throws IOException { if(value==null) return null; StringBuilder result = new StringBuilder(); encodeHtml(value, make_br, make_nbsp, result); return result.toString(); }
[ "@", "Deprecated", "public", "static", "String", "encodeHtml", "(", "Object", "value", ",", "boolean", "make_br", ",", "boolean", "make_nbsp", ")", "throws", "IOException", "{", "if", "(", "value", "==", "null", ")", "return", "null", ";", "StringBuilder", "...
@param value the string to be escaped. @return if value is null then null otherwise value escaped @deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property. @see TextInXhtmlEncoder
[ "@param", "value", "the", "string", "to", "be", "escaped", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/EncodingUtils.java#L261-L267
jhalterman/failsafe
src/main/java/net/jodah/failsafe/CircuitBreaker.java
CircuitBreaker.withFailureThreshold
public synchronized CircuitBreaker<R> withFailureThreshold(int failures, int executions) { Assert.isTrue(failures >= 1, "failures must be greater than or equal to 1"); Assert.isTrue(executions >= 1, "executions must be greater than or equal to 1"); Assert.isTrue(executions >= failures, "executions must be greater than or equal to failures"); this.failureThreshold = new Ratio(failures, executions); state.get().setFailureThreshold(failureThreshold); return this; }
java
public synchronized CircuitBreaker<R> withFailureThreshold(int failures, int executions) { Assert.isTrue(failures >= 1, "failures must be greater than or equal to 1"); Assert.isTrue(executions >= 1, "executions must be greater than or equal to 1"); Assert.isTrue(executions >= failures, "executions must be greater than or equal to failures"); this.failureThreshold = new Ratio(failures, executions); state.get().setFailureThreshold(failureThreshold); return this; }
[ "public", "synchronized", "CircuitBreaker", "<", "R", ">", "withFailureThreshold", "(", "int", "failures", ",", "int", "executions", ")", "{", "Assert", ".", "isTrue", "(", "failures", ">=", "1", ",", "\"failures must be greater than or equal to 1\"", ")", ";", "A...
Sets the ratio of successive failures that must occur when in a closed state in order to open the circuit. For example: 5, 10 would open the circuit if 5 out of the last 10 executions result in a failure. The circuit will not be opened until at least the given number of {@code executions} have taken place. @param failures The number of failures that must occur in order to open the circuit @param executions The number of executions to measure the {@code failures} against @throws IllegalArgumentException if {@code failures} < 1, {@code executions} < 1, or {@code failures} is > {@code executions}
[ "Sets", "the", "ratio", "of", "successive", "failures", "that", "must", "occur", "when", "in", "a", "closed", "state", "in", "order", "to", "open", "the", "circuit", ".", "For", "example", ":", "5", "10", "would", "open", "the", "circuit", "if", "5", "...
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/CircuitBreaker.java#L313-L320
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java
HttpFields.formatDate
public static String formatDate(StringBuffer buf, long date, boolean cookie) { HttpCal gc = new HttpCal(); gc.setTimeInMillis(date); formatDate(buf,gc,cookie); return buf.toString(); }
java
public static String formatDate(StringBuffer buf, long date, boolean cookie) { HttpCal gc = new HttpCal(); gc.setTimeInMillis(date); formatDate(buf,gc,cookie); return buf.toString(); }
[ "public", "static", "String", "formatDate", "(", "StringBuffer", "buf", ",", "long", "date", ",", "boolean", "cookie", ")", "{", "HttpCal", "gc", "=", "new", "HttpCal", "(", ")", ";", "gc", ".", "setTimeInMillis", "(", "date", ")", ";", "formatDate", "("...
Format HTTP date "EEE, dd MMM yyyy HH:mm:ss 'GMT'" or "EEE, dd-MMM-yy HH:mm:ss 'GMT'"for cookies
[ "Format", "HTTP", "date", "EEE", "dd", "MMM", "yyyy", "HH", ":", "mm", ":", "ss", "GMT", "or", "EEE", "dd", "-", "MMM", "-", "yy", "HH", ":", "mm", ":", "ss", "GMT", "for", "cookies" ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java#L343-L349
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
MultiUserChat.changeAffiliationByAdmin
private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCAdmin iq = new MUCAdmin(); iq.setTo(room); iq.setType(IQ.Type.set); // Set the new affiliation. MUCItem item = new MUCItem(affiliation, jid, reason); iq.addItem(item); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); }
java
private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCAdmin iq = new MUCAdmin(); iq.setTo(room); iq.setType(IQ.Type.set); // Set the new affiliation. MUCItem item = new MUCItem(affiliation, jid, reason); iq.addItem(item); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); }
[ "private", "void", "changeAffiliationByAdmin", "(", "Jid", "jid", ",", "MUCAffiliation", "affiliation", ",", "String", "reason", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "MUCAdmin", ...
Tries to change the affiliation with an 'muc#admin' namespace @param jid @param affiliation @param reason the reason for the affiliation change (optional) @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Tries", "to", "change", "the", "affiliation", "with", "an", "muc#admin", "namespace" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1614-L1623
jenetics/jenetics
jenetics/src/main/java/io/jenetics/PermutationChromosome.java
PermutationChromosome.ofInteger
public static PermutationChromosome<Integer> ofInteger(final int start, final int end) { if (end <= start) { throw new IllegalArgumentException(format( "end <= start: %d <= %d", end, start )); } return ofInteger(IntRange.of(start, end), end - start); }
java
public static PermutationChromosome<Integer> ofInteger(final int start, final int end) { if (end <= start) { throw new IllegalArgumentException(format( "end <= start: %d <= %d", end, start )); } return ofInteger(IntRange.of(start, end), end - start); }
[ "public", "static", "PermutationChromosome", "<", "Integer", ">", "ofInteger", "(", "final", "int", "start", ",", "final", "int", "end", ")", "{", "if", "(", "end", "<=", "start", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\...
Create an integer permutation chromosome with the given range. @since 2.0 @param start the start of the integer range (inclusively) of the returned chromosome. @param end the end of the integer range (exclusively) of the returned chromosome. @return a integer permutation chromosome with the given integer range values. @throws IllegalArgumentException if {@code start >= end} or {@code start <= 0}
[ "Create", "an", "integer", "permutation", "chromosome", "with", "the", "given", "range", "." ]
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/PermutationChromosome.java#L283-L292
gwtbootstrap3/gwtbootstrap3-extras
src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java
Animate.stopAnimation
public static final <T extends UIObject> void stopAnimation(final T widget, final String animation){ if (widget != null && animation != null) { stopAnimation(widget.getElement(), animation); } }
java
public static final <T extends UIObject> void stopAnimation(final T widget, final String animation){ if (widget != null && animation != null) { stopAnimation(widget.getElement(), animation); } }
[ "public", "static", "final", "<", "T", "extends", "UIObject", ">", "void", "stopAnimation", "(", "final", "T", "widget", ",", "final", "String", "animation", ")", "{", "if", "(", "widget", "!=", "null", "&&", "animation", "!=", "null", ")", "{", "stopAni...
Removes custom animation class and stops animation. @param widget Element to remove style from. @param animation Animation CSS class to remove.
[ "Removes", "custom", "animation", "class", "and", "stops", "animation", "." ]
train
https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java#L334-L338
code4everything/util
src/main/java/com/zhazhapan/util/FileExecutor.java
FileExecutor.mergeFiles
public static void mergeFiles(File[] files, File destinationFile, String[] filterRegex) throws IOException { if (filterRegex.length < files.length) { filterRegex = ArrayUtils.concatArrays(filterRegex, new String[files.length - filterRegex.length]); } createNewFile(destinationFile); int i = 0; for (File file : files) { mergeFiles(file, destinationFile, filterRegex[i++]); } }
java
public static void mergeFiles(File[] files, File destinationFile, String[] filterRegex) throws IOException { if (filterRegex.length < files.length) { filterRegex = ArrayUtils.concatArrays(filterRegex, new String[files.length - filterRegex.length]); } createNewFile(destinationFile); int i = 0; for (File file : files) { mergeFiles(file, destinationFile, filterRegex[i++]); } }
[ "public", "static", "void", "mergeFiles", "(", "File", "[", "]", "files", ",", "File", "destinationFile", ",", "String", "[", "]", "filterRegex", ")", "throws", "IOException", "{", "if", "(", "filterRegex", ".", "length", "<", "files", ".", "length", ")", ...
合并文件 @param files 文件数组 @param destinationFile 目标文件 @param filterRegex 过滤规则数组(正则表达式,与文件数组一一对应,即第个文件使用一个过滤规则,为空时不过滤) @throws IOException 异常
[ "合并文件" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L719-L728
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/StartupConfiguration.java
StartupConfiguration.append
private static Configuration append(Configuration base, Configuration additional) { final CompositeConfiguration result = new CompositeConfiguration(); result.addConfiguration(additional); result.addConfiguration(base); return result; }
java
private static Configuration append(Configuration base, Configuration additional) { final CompositeConfiguration result = new CompositeConfiguration(); result.addConfiguration(additional); result.addConfiguration(base); return result; }
[ "private", "static", "Configuration", "append", "(", "Configuration", "base", ",", "Configuration", "additional", ")", "{", "final", "CompositeConfiguration", "result", "=", "new", "CompositeConfiguration", "(", ")", ";", "result", ".", "addConfiguration", "(", "add...
Takes two configuration and returns their union, with the second overriding the first. @param base the base configuration. @param additional the additional set of properties, some of which may override those specified in <code>base</code>. @return the union of the two configurations, as specified above.
[ "Takes", "two", "configuration", "and", "returns", "their", "union", "with", "the", "second", "overriding", "the", "first", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/StartupConfiguration.java#L634-L639
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/spec/FontSpec.java
FontSpec.getCloneWithDifferentFont
@Nonnull public FontSpec getCloneWithDifferentFont (@Nonnull final PreloadFont aNewFont) { ValueEnforcer.notNull (aNewFont, "NewFont"); if (aNewFont.equals (m_aPreloadFont)) return this; // Don't copy loaded font! return new FontSpec (aNewFont, m_fFontSize, m_aColor); }
java
@Nonnull public FontSpec getCloneWithDifferentFont (@Nonnull final PreloadFont aNewFont) { ValueEnforcer.notNull (aNewFont, "NewFont"); if (aNewFont.equals (m_aPreloadFont)) return this; // Don't copy loaded font! return new FontSpec (aNewFont, m_fFontSize, m_aColor); }
[ "@", "Nonnull", "public", "FontSpec", "getCloneWithDifferentFont", "(", "@", "Nonnull", "final", "PreloadFont", "aNewFont", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aNewFont", ",", "\"NewFont\"", ")", ";", "if", "(", "aNewFont", ".", "equals", "(", "m_...
Return a clone of this object but with a different font. @param aNewFont The new font to use. Must not be <code>null</code>. @return this if the fonts are equal - a new object otherwise.
[ "Return", "a", "clone", "of", "this", "object", "but", "with", "a", "different", "font", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/FontSpec.java#L112-L120
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java
JdbcControlImpl.getConnectionFromDriverManager
private Connection getConnectionFromDriverManager(String dbDriverClassName, String dbUrlStr, String userName, String password, String propertiesString) throws SQLException { Connection con = null; try { Class.forName(dbDriverClassName); if (!EMPTY_STRING.equals(userName)) { con = DriverManager.getConnection(dbUrlStr, userName, password); } else if (!EMPTY_STRING.equals(propertiesString)) { Properties props = parseProperties(propertiesString); if (props == null) { throw new ControlException("Invalid properties annotation value: " + propertiesString); } con = DriverManager.getConnection(dbUrlStr, props); } else { con = DriverManager.getConnection(dbUrlStr); } } catch (ClassNotFoundException e) { throw new ControlException("Database driver class not found!", e); } return con; }
java
private Connection getConnectionFromDriverManager(String dbDriverClassName, String dbUrlStr, String userName, String password, String propertiesString) throws SQLException { Connection con = null; try { Class.forName(dbDriverClassName); if (!EMPTY_STRING.equals(userName)) { con = DriverManager.getConnection(dbUrlStr, userName, password); } else if (!EMPTY_STRING.equals(propertiesString)) { Properties props = parseProperties(propertiesString); if (props == null) { throw new ControlException("Invalid properties annotation value: " + propertiesString); } con = DriverManager.getConnection(dbUrlStr, props); } else { con = DriverManager.getConnection(dbUrlStr); } } catch (ClassNotFoundException e) { throw new ControlException("Database driver class not found!", e); } return con; }
[ "private", "Connection", "getConnectionFromDriverManager", "(", "String", "dbDriverClassName", ",", "String", "dbUrlStr", ",", "String", "userName", ",", "String", "password", ",", "String", "propertiesString", ")", "throws", "SQLException", "{", "Connection", "con", ...
Get a JDBC connection from the DriverManager. @param dbDriverClassName Specified in the subclasse's ConnectionDriver annotation. @param dbUrlStr Specified in the subclasse's ConnectionDriver annotation. @param userName Specified in the subclasse's ConnectionDriver annotation. @param password Specified in the subclasse's ConnectionDriver annotation. @return null if a connection cannot be established. @throws SQLException
[ "Get", "a", "JDBC", "connection", "from", "the", "DriverManager", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java#L433-L456
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getBoolean
public Boolean getBoolean(int field, String falseText) { Boolean result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = ((m_fields[field].equalsIgnoreCase(falseText) == true) ? Boolean.FALSE : Boolean.TRUE); } else { result = null; } return (result); }
java
public Boolean getBoolean(int field, String falseText) { Boolean result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = ((m_fields[field].equalsIgnoreCase(falseText) == true) ? Boolean.FALSE : Boolean.TRUE); } else { result = null; } return (result); }
[ "public", "Boolean", "getBoolean", "(", "int", "field", ",", "String", "falseText", ")", "{", "Boolean", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "...
Accessor method to retrieve a Boolean instance. @param field the index number of the field to be retrieved @param falseText locale specific text representing false @return the value of the required field
[ "Accessor", "method", "to", "retrieve", "a", "Boolean", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L728-L742
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java
Quicksort.partition
private static int partition(int[] intArray, int start, int end) { int pivot = intArray[end]; int index = start - 1; for(int j = start; j < end; j++) { if(intArray[j] <= pivot) { index++; XORSwap.swap(intArray, index, j); } } XORSwap.swap(intArray, index + 1, end); return index + 1; }
java
private static int partition(int[] intArray, int start, int end) { int pivot = intArray[end]; int index = start - 1; for(int j = start; j < end; j++) { if(intArray[j] <= pivot) { index++; XORSwap.swap(intArray, index, j); } } XORSwap.swap(intArray, index + 1, end); return index + 1; }
[ "private", "static", "int", "partition", "(", "int", "[", "]", "intArray", ",", "int", "start", ",", "int", "end", ")", "{", "int", "pivot", "=", "intArray", "[", "end", "]", ";", "int", "index", "=", "start", "-", "1", ";", "for", "(", "int", "j...
Routine that arranges the elements in ascending order around a pivot. This routine runs in O(n) time. @param intArray array that we want to sort @param start index of the starting point to sort @param end index of the end point to sort @return an integer that represent the index of the pivot
[ "Routine", "that", "arranges", "the", "elements", "in", "ascending", "order", "around", "a", "pivot", ".", "This", "routine", "runs", "in", "O", "(", "n", ")", "time", "." ]
train
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java#L254-L268
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformClob.java
TransformClob.transformOut
@Override public Clob transformOut(JdbcPreparedStatementFactory jpsf, char[] attributeObject) throws CpoException { CLOB newClob = null; try { if (attributeObject != null) { newClob = CLOB.createTemporary(jpsf.getPreparedStatement().getConnection(), false, CLOB.DURATION_SESSION); jpsf.AddReleasible(new OracleTemporaryClob(newClob)); Writer cos = newClob.setCharacterStream(0); cos.write(attributeObject); cos.close(); } } catch (Exception e) { String msg = "Error CLOBing Char Array"; logger.error(msg, e); throw new CpoException(msg, e); } return newClob; }
java
@Override public Clob transformOut(JdbcPreparedStatementFactory jpsf, char[] attributeObject) throws CpoException { CLOB newClob = null; try { if (attributeObject != null) { newClob = CLOB.createTemporary(jpsf.getPreparedStatement().getConnection(), false, CLOB.DURATION_SESSION); jpsf.AddReleasible(new OracleTemporaryClob(newClob)); Writer cos = newClob.setCharacterStream(0); cos.write(attributeObject); cos.close(); } } catch (Exception e) { String msg = "Error CLOBing Char Array"; logger.error(msg, e); throw new CpoException(msg, e); } return newClob; }
[ "@", "Override", "public", "Clob", "transformOut", "(", "JdbcPreparedStatementFactory", "jpsf", ",", "char", "[", "]", "attributeObject", ")", "throws", "CpoException", "{", "CLOB", "newClob", "=", "null", ";", "try", "{", "if", "(", "attributeObject", "!=", "...
Transforms the data from the class attribute to the object required by the datasource @param cpoAdapter The CpoAdapter for the datasource where the attribute is being persisted @param parentObject The object that contains the attribute being persisted. @param attributeObject The object that represents the attribute being persisted. @return The object to be stored in the datasource @throws CpoException
[ "Transforms", "the", "data", "from", "the", "class", "attribute", "to", "the", "object", "required", "by", "the", "datasource" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformClob.java#L86-L105
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java
MethodSimulator.mergeMethodHandleStore
private void mergeMethodHandleStore(final int index, final MethodHandle methodHandle) { localVariables.merge(index, new MethodHandle(methodHandle), Element::merge); }
java
private void mergeMethodHandleStore(final int index, final MethodHandle methodHandle) { localVariables.merge(index, new MethodHandle(methodHandle), Element::merge); }
[ "private", "void", "mergeMethodHandleStore", "(", "final", "int", "index", ",", "final", "MethodHandle", "methodHandle", ")", "{", "localVariables", ".", "merge", "(", "index", ",", "new", "MethodHandle", "(", "methodHandle", ")", ",", "Element", "::", "merge", ...
Merges a stored method handle to the local variables. @param index The index of the variable @param methodHandle The method handle to merge
[ "Merges", "a", "stored", "method", "handle", "to", "the", "local", "variables", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L236-L238
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java
CmsContainerpageController.getNewElement
public void getNewElement(final String resourceType, final I_CmsSimpleCallback<CmsContainerElementData> callback) { CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() { @Override public void execute() { getContainerpageService().getNewElementData( getData().getRpcContext(), getData().getDetailId(), getRequestParams(), resourceType, getPageState(), getLocale(), this); } @Override protected void onResponse(CmsContainerElementData result) { m_elements.put(result.getClientId(), result); callback.execute(result); } }; action.execute(); }
java
public void getNewElement(final String resourceType, final I_CmsSimpleCallback<CmsContainerElementData> callback) { CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() { @Override public void execute() { getContainerpageService().getNewElementData( getData().getRpcContext(), getData().getDetailId(), getRequestParams(), resourceType, getPageState(), getLocale(), this); } @Override protected void onResponse(CmsContainerElementData result) { m_elements.put(result.getClientId(), result); callback.execute(result); } }; action.execute(); }
[ "public", "void", "getNewElement", "(", "final", "String", "resourceType", ",", "final", "I_CmsSimpleCallback", "<", "CmsContainerElementData", ">", "callback", ")", "{", "CmsRpcAction", "<", "CmsContainerElementData", ">", "action", "=", "new", "CmsRpcAction", "<", ...
Returns the element data for a resource type representing a new element.<p> @param resourceType the resource type name @param callback the callback to execute with the new element data
[ "Returns", "the", "element", "data", "for", "a", "resource", "type", "representing", "a", "new", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L1738-L1763
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.billboardSpherical
public Matrix4f billboardSpherical(Vector3fc objPos, Vector3fc targetPos) { float toDirX = targetPos.x() - objPos.x(); float toDirY = targetPos.y() - objPos.y(); float toDirZ = targetPos.z() - objPos.z(); float x = -toDirY; float y = toDirX; float w = (float) Math.sqrt(toDirX * toDirX + toDirY * toDirY + toDirZ * toDirZ) + toDirZ; float invNorm = (float) (1.0 / Math.sqrt(x * x + y * y + w * w)); x *= invNorm; y *= invNorm; w *= invNorm; float q00 = (x + x) * x; float q11 = (y + y) * y; float q01 = (x + x) * y; float q03 = (x + x) * w; float q13 = (y + y) * w; this._m00(1.0f - q11); this._m01(q01); this._m02(-q13); this._m03(0.0f); this._m10(q01); this._m11(1.0f - q00); this._m12(q03); this._m13(0.0f); this._m20(q13); this._m21(-q03); this._m22(1.0f - q11 - q00); this._m23(0.0f); this._m30(objPos.x()); this._m31(objPos.y()); this._m32(objPos.z()); this._m33(1.0f); _properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL); return this; }
java
public Matrix4f billboardSpherical(Vector3fc objPos, Vector3fc targetPos) { float toDirX = targetPos.x() - objPos.x(); float toDirY = targetPos.y() - objPos.y(); float toDirZ = targetPos.z() - objPos.z(); float x = -toDirY; float y = toDirX; float w = (float) Math.sqrt(toDirX * toDirX + toDirY * toDirY + toDirZ * toDirZ) + toDirZ; float invNorm = (float) (1.0 / Math.sqrt(x * x + y * y + w * w)); x *= invNorm; y *= invNorm; w *= invNorm; float q00 = (x + x) * x; float q11 = (y + y) * y; float q01 = (x + x) * y; float q03 = (x + x) * w; float q13 = (y + y) * w; this._m00(1.0f - q11); this._m01(q01); this._m02(-q13); this._m03(0.0f); this._m10(q01); this._m11(1.0f - q00); this._m12(q03); this._m13(0.0f); this._m20(q13); this._m21(-q03); this._m22(1.0f - q11 - q00); this._m23(0.0f); this._m30(objPos.x()); this._m31(objPos.y()); this._m32(objPos.z()); this._m33(1.0f); _properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL); return this; }
[ "public", "Matrix4f", "billboardSpherical", "(", "Vector3fc", "objPos", ",", "Vector3fc", "targetPos", ")", "{", "float", "toDirX", "=", "targetPos", ".", "x", "(", ")", "-", "objPos", ".", "x", "(", ")", ";", "float", "toDirY", "=", "targetPos", ".", "y...
Set this matrix to a spherical billboard transformation that rotates the local +Z axis of a given object with position <code>objPos</code> towards a target position at <code>targetPos</code> using a shortest arc rotation by not preserving any <i>up</i> vector of the object. <p> This method can be used to create the complete model transformation for a given object, including the translation of the object to its position <code>objPos</code>. <p> In order to specify an <i>up</i> vector which needs to be maintained when rotating the +Z axis of the object, use {@link #billboardSpherical(Vector3fc, Vector3fc, Vector3fc)}. @see #billboardSpherical(Vector3fc, Vector3fc, Vector3fc) @param objPos the position of the object to rotate towards <code>targetPos</code> @param targetPos the position of the target (for example the camera) towards which to rotate the object @return this
[ "Set", "this", "matrix", "to", "a", "spherical", "billboard", "transformation", "that", "rotates", "the", "local", "+", "Z", "axis", "of", "a", "given", "object", "with", "position", "<code", ">", "objPos<", "/", "code", ">", "towards", "a", "target", "pos...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L13402-L13436
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optCharSequence
@Nullable public static CharSequence optCharSequence(@Nullable Bundle bundle, @Nullable String key) { return optCharSequence(bundle, key, null); }
java
@Nullable public static CharSequence optCharSequence(@Nullable Bundle bundle, @Nullable String key) { return optCharSequence(bundle, key, null); }
[ "@", "Nullable", "public", "static", "CharSequence", "optCharSequence", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optCharSequence", "(", "bundle", ",", "key", ",", "null", ")", ";", "}" ]
Returns a optional {@link CharSequence} value. In other words, returns the value mapped by key if it exists and is a {@link CharSequence}. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null. @param bundle a bundle. If the bundle is null, this method will return null. @param key a key for the value. @return a {@link CharSequence} value if exists, null otherwise. @see android.os.Bundle#getCharSequence(String)
[ "Returns", "a", "optional", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L329-L332
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/StringUtils.java
StringUtils.trim
public static String trim(String s, int maxWidth) { if (s.length() <= maxWidth) { return (s); } return (s.substring(0, maxWidth)); }
java
public static String trim(String s, int maxWidth) { if (s.length() <= maxWidth) { return (s); } return (s.substring(0, maxWidth)); }
[ "public", "static", "String", "trim", "(", "String", "s", ",", "int", "maxWidth", ")", "{", "if", "(", "s", ".", "length", "(", ")", "<=", "maxWidth", ")", "{", "return", "(", "s", ")", ";", "}", "return", "(", "s", ".", "substring", "(", "0", ...
Returns s if it's at most maxWidth chars, otherwise chops right side to fit.
[ "Returns", "s", "if", "it", "s", "at", "most", "maxWidth", "chars", "otherwise", "chops", "right", "side", "to", "fit", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L518-L523
threerings/narya
tools/src/main/java/com/threerings/presents/tools/ActionScriptUtils.java
ActionScriptUtils.addExistingImports
public static void addExistingImports (String asFile, ImportSet imports) { // Discover the location of the 'public class' declaration. // We won't search past there. Matcher m = AS_PUBLIC_CLASS_DECL.matcher(asFile); int searchTo = asFile.length(); if (m.find()) { searchTo = m.start(); } m = AS_IMPORT.matcher(asFile.substring(0, searchTo)); while (m.find()) { imports.add(m.group(3)); } }
java
public static void addExistingImports (String asFile, ImportSet imports) { // Discover the location of the 'public class' declaration. // We won't search past there. Matcher m = AS_PUBLIC_CLASS_DECL.matcher(asFile); int searchTo = asFile.length(); if (m.find()) { searchTo = m.start(); } m = AS_IMPORT.matcher(asFile.substring(0, searchTo)); while (m.find()) { imports.add(m.group(3)); } }
[ "public", "static", "void", "addExistingImports", "(", "String", "asFile", ",", "ImportSet", "imports", ")", "{", "// Discover the location of the 'public class' declaration.", "// We won't search past there.", "Matcher", "m", "=", "AS_PUBLIC_CLASS_DECL", ".", "matcher", "(",...
Adds an existing ActionScript file's imports to the given ImportSet. @param asFile a String containing the contents of an ActionScript file
[ "Adds", "an", "existing", "ActionScript", "file", "s", "imports", "to", "the", "given", "ImportSet", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/ActionScriptUtils.java#L46-L60
arxanchain/java-common
src/main/java/com/arxanfintech/common/util/ByteUtil.java
ByteUtil.matchingNibbleLength
public static int matchingNibbleLength(byte[] a, byte[] b) { int i = 0; int length = a.length < b.length ? a.length : b.length; while (i < length) { if (a[i] != b[i]) return i; i++; } return i; }
java
public static int matchingNibbleLength(byte[] a, byte[] b) { int i = 0; int length = a.length < b.length ? a.length : b.length; while (i < length) { if (a[i] != b[i]) return i; i++; } return i; }
[ "public", "static", "int", "matchingNibbleLength", "(", "byte", "[", "]", "a", ",", "byte", "[", "]", "b", ")", "{", "int", "i", "=", "0", ";", "int", "length", "=", "a", ".", "length", "<", "b", ".", "length", "?", "a", ".", "length", ":", "b"...
Returns the amount of nibbles that match each other from 0 ... amount will never be larger than smallest input @param a first input @param b second input @return Number of bytes that match
[ "Returns", "the", "amount", "of", "nibbles", "that", "match", "each", "other", "from", "0", "...", "amount", "will", "never", "be", "larger", "than", "smallest", "input" ]
train
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L135-L144
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listSecurityPolicies
public ListSecurityPoliciesResponse listSecurityPolicies() { ListSecurityPoliciesRequest request = new ListSecurityPoliciesRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SECURITY_POLICY); return invokeHttpClient(internalRequest, ListSecurityPoliciesResponse.class); }
java
public ListSecurityPoliciesResponse listSecurityPolicies() { ListSecurityPoliciesRequest request = new ListSecurityPoliciesRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SECURITY_POLICY); return invokeHttpClient(internalRequest, ListSecurityPoliciesResponse.class); }
[ "public", "ListSecurityPoliciesResponse", "listSecurityPolicies", "(", ")", "{", "ListSecurityPoliciesRequest", "request", "=", "new", "ListSecurityPoliciesRequest", "(", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET"...
List all your live security policys. @return The list of all your live security policys
[ "List", "all", "your", "live", "security", "policys", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1243-L1247
SonarSource/sonarqube
server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java
DatabaseUtils.executeLargeInputs
public static <OUTPUT, INPUT extends Comparable<INPUT>> List<OUTPUT> executeLargeInputs(Collection<INPUT> input, Function<List<INPUT>, List<OUTPUT>> function) { return executeLargeInputs(input, function, i -> i); }
java
public static <OUTPUT, INPUT extends Comparable<INPUT>> List<OUTPUT> executeLargeInputs(Collection<INPUT> input, Function<List<INPUT>, List<OUTPUT>> function) { return executeLargeInputs(input, function, i -> i); }
[ "public", "static", "<", "OUTPUT", ",", "INPUT", "extends", "Comparable", "<", "INPUT", ">", ">", "List", "<", "OUTPUT", ">", "executeLargeInputs", "(", "Collection", "<", "INPUT", ">", "input", ",", "Function", "<", "List", "<", "INPUT", ">", ",", "List...
Partition by 1000 elements a list of input and execute a function on each part. The goal is to prevent issue with ORACLE when there's more than 1000 elements in a 'in ('X', 'Y', ...)' and with MsSQL when there's more than 2000 parameters in a query
[ "Partition", "by", "1000", "elements", "a", "list", "of", "input", "and", "execute", "a", "function", "on", "each", "part", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java#L107-L109
pravega/pravega
controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java
StreamMetrics.updateStream
public void updateStream(String scope, String streamName, Duration latency) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(UPDATE_STREAM), 1); DYNAMIC_LOGGER.incCounterValue(UPDATE_STREAM, 1, streamTags(scope, streamName)); updateStreamLatency.reportSuccessValue(latency.toMillis()); }
java
public void updateStream(String scope, String streamName, Duration latency) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(UPDATE_STREAM), 1); DYNAMIC_LOGGER.incCounterValue(UPDATE_STREAM, 1, streamTags(scope, streamName)); updateStreamLatency.reportSuccessValue(latency.toMillis()); }
[ "public", "void", "updateStream", "(", "String", "scope", ",", "String", "streamName", ",", "Duration", "latency", ")", "{", "DYNAMIC_LOGGER", ".", "incCounterValue", "(", "globalMetricName", "(", "UPDATE_STREAM", ")", ",", "1", ")", ";", "DYNAMIC_LOGGER", ".", ...
This method increments the global and Stream-specific counters of Stream updates and reports the latency of the operation. @param scope Scope. @param streamName Name of the Stream. @param latency Latency of the updateStream operation.
[ "This", "method", "increments", "the", "global", "and", "Stream", "-", "specific", "counters", "of", "Stream", "updates", "and", "reports", "the", "latency", "of", "the", "operation", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java#L139-L143
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/operation/RecurseDirectoryAndAddFiles.java
RecurseDirectoryAndAddFiles.recurseAndAddFiles
private void recurseAndAddFiles(GraphRewrite event, FileService fileService, WindupJavaConfigurationService javaConfigurationService, FileModel file) { if (javaConfigurationService.checkIfIgnored(event, file)) return; String filePath = file.getFilePath(); File fileReference = new File(filePath); Long directorySize = new Long(0); if (fileReference.isDirectory()) { File[] subFiles = fileReference.listFiles(); if (subFiles != null) { for (File reference : subFiles) { FileModel subFile = fileService.createByFilePath(file, reference.getAbsolutePath()); recurseAndAddFiles(event, fileService, javaConfigurationService, subFile); if (subFile.isDirectory()) { directorySize = directorySize + subFile.getDirectorySize(); } else { directorySize = directorySize + subFile.getSize(); } } } file.setDirectorySize(directorySize); } }
java
private void recurseAndAddFiles(GraphRewrite event, FileService fileService, WindupJavaConfigurationService javaConfigurationService, FileModel file) { if (javaConfigurationService.checkIfIgnored(event, file)) return; String filePath = file.getFilePath(); File fileReference = new File(filePath); Long directorySize = new Long(0); if (fileReference.isDirectory()) { File[] subFiles = fileReference.listFiles(); if (subFiles != null) { for (File reference : subFiles) { FileModel subFile = fileService.createByFilePath(file, reference.getAbsolutePath()); recurseAndAddFiles(event, fileService, javaConfigurationService, subFile); if (subFile.isDirectory()) { directorySize = directorySize + subFile.getDirectorySize(); } else { directorySize = directorySize + subFile.getSize(); } } } file.setDirectorySize(directorySize); } }
[ "private", "void", "recurseAndAddFiles", "(", "GraphRewrite", "event", ",", "FileService", "fileService", ",", "WindupJavaConfigurationService", "javaConfigurationService", ",", "FileModel", "file", ")", "{", "if", "(", "javaConfigurationService", ".", "checkIfIgnored", "...
Recurses the given folder and creates the FileModels vertices for the child files to the graph.
[ "Recurses", "the", "given", "folder", "and", "creates", "the", "FileModels", "vertices", "for", "the", "child", "files", "to", "the", "graph", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/operation/RecurseDirectoryAndAddFiles.java#L51-L81
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper.hasSideEffects
protected Boolean hasSideEffects(InferredPrototype calledOperation, XExpression expr, ISideEffectContext context) { final SideEffectContext ctx = new SideEffectContext(calledOperation, context); return internalHasSideEffects(expr, ctx); }
java
protected Boolean hasSideEffects(InferredPrototype calledOperation, XExpression expr, ISideEffectContext context) { final SideEffectContext ctx = new SideEffectContext(calledOperation, context); return internalHasSideEffects(expr, ctx); }
[ "protected", "Boolean", "hasSideEffects", "(", "InferredPrototype", "calledOperation", ",", "XExpression", "expr", ",", "ISideEffectContext", "context", ")", "{", "final", "SideEffectContext", "ctx", "=", "new", "SideEffectContext", "(", "calledOperation", ",", "context...
Determine if the given expression has a side effect. @param calledOperation the called operation, not yet in the call stack. @param expr the expression. @param context the context. @return {@code true} if the expression has a side effect.
[ "Determine", "if", "the", "given", "expression", "has", "a", "side", "effect", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L240-L243
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/ssl_cert.java
ssl_cert.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ssl_cert_responses result = (ssl_cert_responses) service.get_payload_formatter().string_to_resource(ssl_cert_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ssl_cert_response_array); } ssl_cert[] result_ssl_cert = new ssl_cert[result.ssl_cert_response_array.length]; for(int i = 0; i < result.ssl_cert_response_array.length; i++) { result_ssl_cert[i] = result.ssl_cert_response_array[i].ssl_cert[0]; } return result_ssl_cert; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ssl_cert_responses result = (ssl_cert_responses) service.get_payload_formatter().string_to_resource(ssl_cert_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ssl_cert_response_array); } ssl_cert[] result_ssl_cert = new ssl_cert[result.ssl_cert_response_array.length]; for(int i = 0; i < result.ssl_cert_response_array.length; i++) { result_ssl_cert[i] = result.ssl_cert_response_array[i].ssl_cert[0]; } return result_ssl_cert; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ssl_cert_responses", "result", "=", "(", "ssl_cert_responses", ")", "service", ".", "get_payload_formatter", ...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/ssl_cert.java#L265-L282
paypal/SeLion
dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java
XmlDataProviderImpl.loadDataFromXmlFile
private List<?> loadDataFromXmlFile() { logger.entering(); Preconditions.checkArgument(resource.getCls() != null, "Please provide a valid type."); List<?> returned; try { JAXBContext context = JAXBContext.newInstance(Wrapper.class, resource.getCls()); Unmarshaller unmarshaller = context.createUnmarshaller(); StreamSource xmlStreamSource = new StreamSource(resource.getInputStream()); Wrapper<?> wrapper = unmarshaller.unmarshal(xmlStreamSource, Wrapper.class).getValue(); returned = wrapper.getList(); } catch (JAXBException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error unmarshalling XML file.", excp); } logger.exiting(returned); return returned; }
java
private List<?> loadDataFromXmlFile() { logger.entering(); Preconditions.checkArgument(resource.getCls() != null, "Please provide a valid type."); List<?> returned; try { JAXBContext context = JAXBContext.newInstance(Wrapper.class, resource.getCls()); Unmarshaller unmarshaller = context.createUnmarshaller(); StreamSource xmlStreamSource = new StreamSource(resource.getInputStream()); Wrapper<?> wrapper = unmarshaller.unmarshal(xmlStreamSource, Wrapper.class).getValue(); returned = wrapper.getList(); } catch (JAXBException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error unmarshalling XML file.", excp); } logger.exiting(returned); return returned; }
[ "private", "List", "<", "?", ">", "loadDataFromXmlFile", "(", ")", "{", "logger", ".", "entering", "(", ")", ";", "Preconditions", ".", "checkArgument", "(", "resource", ".", "getCls", "(", ")", "!=", "null", ",", "\"Please provide a valid type.\"", ")", ";"...
Generates a list of the declared type after parsing the XML file. @return A {@link List} of object of declared type {@link XmlFileSystemResource#getCls()}.
[ "Generates", "a", "list", "of", "the", "declared", "type", "after", "parsing", "the", "XML", "file", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java#L343-L361
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.isRelated
private boolean isRelated(Task task, List<Relation> list) { boolean result = false; for (Relation relation : list) { if (relation.getTargetTask().getUniqueID().intValue() == task.getUniqueID().intValue()) { result = true; break; } } return result; }
java
private boolean isRelated(Task task, List<Relation> list) { boolean result = false; for (Relation relation : list) { if (relation.getTargetTask().getUniqueID().intValue() == task.getUniqueID().intValue()) { result = true; break; } } return result; }
[ "private", "boolean", "isRelated", "(", "Task", "task", ",", "List", "<", "Relation", ">", "list", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "Relation", "relation", ":", "list", ")", "{", "if", "(", "relation", ".", "getTargetTask", ...
Internal method used to test for the existence of a relationship with a task. @param task target task @param list list of relationships @return boolean flag
[ "Internal", "method", "used", "to", "test", "for", "the", "existence", "of", "a", "relationship", "with", "a", "task", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L5020-L5032
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureLoader.java
TextureLoader.getTexture
public static Texture getTexture(String format, InputStream in, boolean flipped, int filter) throws IOException { return InternalTextureLoader.get().getTexture(in, in.toString()+"."+format, flipped, filter); }
java
public static Texture getTexture(String format, InputStream in, boolean flipped, int filter) throws IOException { return InternalTextureLoader.get().getTexture(in, in.toString()+"."+format, flipped, filter); }
[ "public", "static", "Texture", "getTexture", "(", "String", "format", ",", "InputStream", "in", ",", "boolean", "flipped", ",", "int", "filter", ")", "throws", "IOException", "{", "return", "InternalTextureLoader", ".", "get", "(", ")", ".", "getTexture", "(",...
Load a texture with a given format from the supplied input stream @param format The format of the texture to be loaded (something like "PNG" or "TGA") @param in The input stream from which the image data will be read @param flipped True if the image should be flipped vertically on loading @param filter The GL texture filter to use for scaling up and down @return The newly created texture @throws IOException Indicates a failure to read the image data
[ "Load", "a", "texture", "with", "a", "given", "format", "from", "the", "supplied", "input", "stream" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureLoader.java#L63-L65
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.buildFieldsSummary
public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters[VisibleMemberMap.FIELDS]; VisibleMemberMap visibleMemberMap = visibleMemberMaps[VisibleMemberMap.FIELDS]; addSummary(writer, visibleMemberMap, true, memberSummaryTree); }
java
public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters[VisibleMemberMap.FIELDS]; VisibleMemberMap visibleMemberMap = visibleMemberMaps[VisibleMemberMap.FIELDS]; addSummary(writer, visibleMemberMap, true, memberSummaryTree); }
[ "public", "void", "buildFieldsSummary", "(", "XMLNode", "node", ",", "Content", "memberSummaryTree", ")", "{", "MemberSummaryWriter", "writer", "=", "memberSummaryWriters", "[", "VisibleMemberMap", ".", "FIELDS", "]", ";", "VisibleMemberMap", "visibleMemberMap", "=", ...
Build the summary for the fields. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added
[ "Build", "the", "summary", "for", "the", "fields", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java#L264-L270
JOML-CI/JOML
src/org/joml/Vector4f.java
Vector4f.rotateAbout
public Vector4f rotateAbout(float angle, float x, float y, float z) { return rotateAxis(angle, x, y, z, thisOrNew()); }
java
public Vector4f rotateAbout(float angle, float x, float y, float z) { return rotateAxis(angle, x, y, z, thisOrNew()); }
[ "public", "Vector4f", "rotateAbout", "(", "float", "angle", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "return", "rotateAxis", "(", "angle", ",", "x", ",", "y", ",", "z", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Rotate this vector the specified radians around the given rotation axis. @param angle the angle in radians @param x the x component of the rotation axis @param y the y component of the rotation axis @param z the z component of the rotation axis @return a vector holding the result
[ "Rotate", "this", "vector", "the", "specified", "radians", "around", "the", "given", "rotation", "axis", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector4f.java#L1018-L1020
Alexey1Gavrilov/ExpectIt
expectit-core/src/main/java/net/sf/expectit/matcher/MultiMatcher.java
MultiMatcher.findResultWithMaxEnd
private static Result findResultWithMaxEnd(List<Result> successResults) { return Collections.max( successResults, new Comparator<Result>() { @Override public int compare(Result o1, Result o2) { return Integer.valueOf(o1.end()).compareTo(o2.end()); } }); }
java
private static Result findResultWithMaxEnd(List<Result> successResults) { return Collections.max( successResults, new Comparator<Result>() { @Override public int compare(Result o1, Result o2) { return Integer.valueOf(o1.end()).compareTo(o2.end()); } }); }
[ "private", "static", "Result", "findResultWithMaxEnd", "(", "List", "<", "Result", ">", "successResults", ")", "{", "return", "Collections", ".", "max", "(", "successResults", ",", "new", "Comparator", "<", "Result", ">", "(", ")", "{", "@", "Override", "pub...
Find the result with the maximum end position and use it as delegate.
[ "Find", "the", "result", "with", "the", "maximum", "end", "position", "and", "use", "it", "as", "delegate", "." ]
train
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/MultiMatcher.java#L86-L94
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java
TransformerHandlerImpl.notationDecl
public void notationDecl(String name, String publicId, String systemId) throws SAXException { if (m_dtdHandler != null) { m_dtdHandler.notationDecl(name, publicId, systemId); } }
java
public void notationDecl(String name, String publicId, String systemId) throws SAXException { if (m_dtdHandler != null) { m_dtdHandler.notationDecl(name, publicId, systemId); } }
[ "public", "void", "notationDecl", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", "{", "if", "(", "m_dtdHandler", "!=", "null", ")", "{", "m_dtdHandler", ".", "notationDecl", "(", "name", ",", "publ...
Filter a notation declaration event. @param name The notation name. @param publicId The notation's public identifier, or null. @param systemId The notation's system identifier, or null. @throws SAXException The client may throw an exception during processing. @see org.xml.sax.DTDHandler#notationDecl
[ "Filter", "a", "notation", "declaration", "event", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L276-L284
js-lib-com/commons
src/main/java/js/converter/CharactersConverter.java
CharactersConverter.asObject
@Override public <T> T asObject(String string, Class<T> valueType) throws BugError { // at this point value type is guaranteed to be char or Character if (string.length() > 1) { throw new ConverterException("Trying to convert a larger string into a single character."); } return (T) (Character) string.charAt(0); }
java
@Override public <T> T asObject(String string, Class<T> valueType) throws BugError { // at this point value type is guaranteed to be char or Character if (string.length() > 1) { throw new ConverterException("Trying to convert a larger string into a single character."); } return (T) (Character) string.charAt(0); }
[ "@", "Override", "public", "<", "T", ">", "T", "asObject", "(", "String", "string", ",", "Class", "<", "T", ">", "valueType", ")", "throws", "BugError", "{", "// at this point value type is guaranteed to be char or Character\r", "if", "(", "string", ".", "length",...
Return the first character from given string. @throws ConverterException if given string has more than one single character.
[ "Return", "the", "first", "character", "from", "given", "string", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/CharactersConverter.java#L22-L29
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createTextElement
protected Element createTextElement(String data, float width) { Element el = createTextElement(width); Text text = doc.createTextNode(data); el.appendChild(text); return el; }
java
protected Element createTextElement(String data, float width) { Element el = createTextElement(width); Text text = doc.createTextNode(data); el.appendChild(text); return el; }
[ "protected", "Element", "createTextElement", "(", "String", "data", ",", "float", "width", ")", "{", "Element", "el", "=", "createTextElement", "(", "width", ")", ";", "Text", "text", "=", "doc", ".", "createTextNode", "(", "data", ")", ";", "el", ".", "...
Creates an element that represents a single positioned box containing the specified text string. @param data the text string to be contained in the created box. @return the resulting DOM element
[ "Creates", "an", "element", "that", "represents", "a", "single", "positioned", "box", "containing", "the", "specified", "text", "string", "." ]
train
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L320-L326
google/j2objc
jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java
TextUtils.dumpSpans
public static void dumpSpans(CharSequence cs, Printer printer, String prefix) { if (cs instanceof Spanned) { Spanned sp = (Spanned) cs; Object[] os = sp.getSpans(0, cs.length(), Object.class); for (int i = 0; i < os.length; i++) { Object o = os[i]; printer.println(prefix + cs.subSequence(sp.getSpanStart(o), sp.getSpanEnd(o)) + ": " + Integer.toHexString(System.identityHashCode(o)) + " " + o.getClass().getCanonicalName() + " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o) + ") fl=#" + sp.getSpanFlags(o)); } } else { printer.println(prefix + cs + ": (no spans)"); } }
java
public static void dumpSpans(CharSequence cs, Printer printer, String prefix) { if (cs instanceof Spanned) { Spanned sp = (Spanned) cs; Object[] os = sp.getSpans(0, cs.length(), Object.class); for (int i = 0; i < os.length; i++) { Object o = os[i]; printer.println(prefix + cs.subSequence(sp.getSpanStart(o), sp.getSpanEnd(o)) + ": " + Integer.toHexString(System.identityHashCode(o)) + " " + o.getClass().getCanonicalName() + " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o) + ") fl=#" + sp.getSpanFlags(o)); } } else { printer.println(prefix + cs + ": (no spans)"); } }
[ "public", "static", "void", "dumpSpans", "(", "CharSequence", "cs", ",", "Printer", "printer", ",", "String", "prefix", ")", "{", "if", "(", "cs", "instanceof", "Spanned", ")", "{", "Spanned", "sp", "=", "(", "Spanned", ")", "cs", ";", "Object", "[", "...
Debugging tool to print the spans in a CharSequence. The output will be printed one span per line. If the CharSequence is not a Spanned, then the entire string will be printed on a single line.
[ "Debugging", "tool", "to", "print", "the", "spans", "in", "a", "CharSequence", ".", "The", "output", "will", "be", "printed", "one", "span", "per", "line", ".", "If", "the", "CharSequence", "is", "not", "a", "Spanned", "then", "the", "entire", "string", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L776-L793
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java
P2sVpnGatewaysInner.beginUpdateTags
public P2SVpnGatewayInner beginUpdateTags(String resourceGroupName, String gatewayName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); }
java
public P2SVpnGatewayInner beginUpdateTags(String resourceGroupName, String gatewayName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); }
[ "public", "P2SVpnGatewayInner", "beginUpdateTags", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ")", ".", "toBlocking", "(", ")", ".", "sing...
Updates virtual wan p2s vpn gateway tags. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the P2SVpnGatewayInner object if successful.
[ "Updates", "virtual", "wan", "p2s", "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/P2sVpnGatewaysInner.java#L533-L535
jbossws/jbossws-spi
src/main/java/org/jboss/wsf/spi/util/StAXUtils.java
StAXUtils.createXMLInputFactory
public static XMLInputFactory createXMLInputFactory(boolean nsAware) { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, nsAware); factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); factory.setXMLResolver(new XMLResolver() { public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException { throw Messages.MESSAGES.readingExternalEntitiesDisabled(); } }); return factory; }
java
public static XMLInputFactory createXMLInputFactory(boolean nsAware) { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, nsAware); factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE); factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); factory.setXMLResolver(new XMLResolver() { public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException { throw Messages.MESSAGES.readingExternalEntitiesDisabled(); } }); return factory; }
[ "public", "static", "XMLInputFactory", "createXMLInputFactory", "(", "boolean", "nsAware", ")", "{", "XMLInputFactory", "factory", "=", "XMLInputFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setProperty", "(", "XMLInputFactory", ".", "IS_NAMESPACE_AWAR...
Return a new factory so that the caller can set sticky parameters. @param nsAware true is nsAware @return XMLInputFactory
[ "Return", "a", "new", "factory", "so", "that", "the", "caller", "can", "set", "sticky", "parameters", "." ]
train
https://github.com/jbossws/jbossws-spi/blob/845e66c18679ce3aaf76f849822110b4650a9d78/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java#L70-L86
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java
ReflectionUtils.declaresException
public static boolean declaresException(Method method, Class<?> exceptionType) { Assert.notNull(method, "Method must not be null"); Class<?>[] declaredExceptions = method.getExceptionTypes(); for (Class<?> declaredException : declaredExceptions) { if (declaredException.isAssignableFrom(exceptionType)) { return true; } } return false; }
java
public static boolean declaresException(Method method, Class<?> exceptionType) { Assert.notNull(method, "Method must not be null"); Class<?>[] declaredExceptions = method.getExceptionTypes(); for (Class<?> declaredException : declaredExceptions) { if (declaredException.isAssignableFrom(exceptionType)) { return true; } } return false; }
[ "public", "static", "boolean", "declaresException", "(", "Method", "method", ",", "Class", "<", "?", ">", "exceptionType", ")", "{", "Assert", ".", "notNull", "(", "method", ",", "\"Method must not be null\"", ")", ";", "Class", "<", "?", ">", "[", "]", "d...
Determine whether the given method explicitly declares the given exception or one of its superclasses, which means that an exception of that type can be propagated as-is within a reflective invocation. @param method the declaring method @param exceptionType the exception to throw @return {@code true} if the exception can be thrown as-is; {@code false} if it needs to be wrapped
[ "Determine", "whether", "the", "given", "method", "explicitly", "declares", "the", "given", "exception", "or", "one", "of", "its", "superclasses", "which", "means", "that", "an", "exception", "of", "that", "type", "can", "be", "propagated", "as", "-", "is", ...
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java#L330-L339
igniterealtime/Smack
smack-openpgp/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManager.java
OXInstantMessagingManager.decryptAndVerify
public OpenPgpMessage decryptAndVerify(OpenPgpElement element, OpenPgpContact sender) throws SmackException.NotLoggedInException, PGPException, IOException, XmlPullParserException { OpenPgpMessage decrypted = openPgpManager.decryptOpenPgpElement(element, sender); if (decrypted.getState() != OpenPgpMessage.State.signcrypt) { throw new IllegalArgumentException("Decrypted message does appear to not be an OX message. (State: " + decrypted.getState() + ")"); } return decrypted; }
java
public OpenPgpMessage decryptAndVerify(OpenPgpElement element, OpenPgpContact sender) throws SmackException.NotLoggedInException, PGPException, IOException, XmlPullParserException { OpenPgpMessage decrypted = openPgpManager.decryptOpenPgpElement(element, sender); if (decrypted.getState() != OpenPgpMessage.State.signcrypt) { throw new IllegalArgumentException("Decrypted message does appear to not be an OX message. (State: " + decrypted.getState() + ")"); } return decrypted; }
[ "public", "OpenPgpMessage", "decryptAndVerify", "(", "OpenPgpElement", "element", ",", "OpenPgpContact", "sender", ")", "throws", "SmackException", ".", "NotLoggedInException", ",", "PGPException", ",", "IOException", ",", "XmlPullParserException", "{", "OpenPgpMessage", ...
Manually decrypt and verify an {@link OpenPgpElement}. @param element encrypted, signed {@link OpenPgpElement}. @param sender sender of the message. @return decrypted, verified message @throws SmackException.NotLoggedInException In case we are not logged in (we need our jid to access our keys) @throws PGPException in case of an PGP error @throws IOException in case of an IO error (reading keys, streams etc) @throws XmlPullParserException in case that the content of the {@link OpenPgpElement} is not a valid {@link OpenPgpContentElement} or broken XML. @throws IllegalArgumentException if the elements content is not a {@link SigncryptElement}. This happens, if the element likely is not an OX message.
[ "Manually", "decrypt", "and", "verify", "an", "{", "@link", "OpenPgpElement", "}", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManager.java#L335-L344
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
CreateBuilderImpl.findNode
static String findNode(final List<String> children, final String path, final String protectedId) { final String protectedPrefix = getProtectedPrefix(protectedId); String foundNode = Iterables.find ( children, new Predicate<String>() { @Override public boolean apply(String node) { return node.startsWith(protectedPrefix); } }, null ); if ( foundNode != null ) { foundNode = ZKPaths.makePath(path, foundNode); } return foundNode; }
java
static String findNode(final List<String> children, final String path, final String protectedId) { final String protectedPrefix = getProtectedPrefix(protectedId); String foundNode = Iterables.find ( children, new Predicate<String>() { @Override public boolean apply(String node) { return node.startsWith(protectedPrefix); } }, null ); if ( foundNode != null ) { foundNode = ZKPaths.makePath(path, foundNode); } return foundNode; }
[ "static", "String", "findNode", "(", "final", "List", "<", "String", ">", "children", ",", "final", "String", "path", ",", "final", "String", "protectedId", ")", "{", "final", "String", "protectedPrefix", "=", "getProtectedPrefix", "(", "protectedId", ")", ";"...
Attempt to find the znode that matches the given path and protected id @param children a list of candidates znodes @param path the path @param protectedId the protected id @return the absolute path of the znode or <code>null</code> if it is not found
[ "Attempt", "to", "find", "the", "znode", "that", "matches", "the", "given", "path", "and", "protected", "id" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java#L823-L844
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.writeErrorResponse
protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(header, error); final MessageOutputStream output = channel.writeMessage(); try { writeHeader(response, output); output.close(); } finally { StreamUtils.safeClose(output); } }
java
protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(header, error); final MessageOutputStream output = channel.writeMessage(); try { writeHeader(response, output); output.close(); } finally { StreamUtils.safeClose(output); } }
[ "protected", "static", "void", "writeErrorResponse", "(", "final", "Channel", "channel", ",", "final", "ManagementRequestHeader", "header", ",", "final", "Throwable", "error", ")", "throws", "IOException", "{", "final", "ManagementResponseHeader", "response", "=", "Ma...
Write an error response. @param channel the channel @param header the request @param error the error @throws IOException
[ "Write", "an", "error", "response", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L507-L516
JOML-CI/JOML
src/org/joml/sampling/StratifiedSampling.java
StratifiedSampling.generateCentered
public void generateCentered(int n, float centering, Callback2d callback) { float start = centering * 0.5f; float end = 1.0f - centering; for (int y = 0; y < n; y++) { for (int x = 0; x < n; x++) { float sampleX = ((start + rnd.nextFloat() * end) / n + (float) x / n) * 2.0f - 1.0f; float sampleY = ((start + rnd.nextFloat() * end) / n + (float) y / n) * 2.0f - 1.0f; callback.onNewSample(sampleX, sampleY); } } }
java
public void generateCentered(int n, float centering, Callback2d callback) { float start = centering * 0.5f; float end = 1.0f - centering; for (int y = 0; y < n; y++) { for (int x = 0; x < n; x++) { float sampleX = ((start + rnd.nextFloat() * end) / n + (float) x / n) * 2.0f - 1.0f; float sampleY = ((start + rnd.nextFloat() * end) / n + (float) y / n) * 2.0f - 1.0f; callback.onNewSample(sampleX, sampleY); } } }
[ "public", "void", "generateCentered", "(", "int", "n", ",", "float", "centering", ",", "Callback2d", "callback", ")", "{", "float", "start", "=", "centering", "*", "0.5f", ";", "float", "end", "=", "1.0f", "-", "centering", ";", "for", "(", "int", "y", ...
Generate <code>n * n</code> random sample positions in the unit square of <code>x, y = [-1..+1]</code>. <p> Each sample within its stratum is confined to be within <code>[-centering/2..1-centering]</code> of its stratum. @param n the number of strata in each dimension @param centering determines how much the random samples in each stratum are confined to be near the center of the stratum. Possible values are <code>[0..1]</code> @param callback will be called for each generated sample position
[ "Generate", "<code", ">", "n", "*", "n<", "/", "code", ">", "random", "sample", "positions", "in", "the", "unit", "square", "of", "<code", ">", "x", "y", "=", "[", "-", "1", "..", "+", "1", "]", "<", "/", "code", ">", ".", "<p", ">", "Each", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/sampling/StratifiedSampling.java#L81-L91
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/runtime/WrapperTypeConversionUtil.java
WrapperTypeConversionUtil.getCompatibleType
protected static int getCompatibleType(Number left, Number right) { return Math.max(getNumberType(left), getNumberType(right)); }
java
protected static int getCompatibleType(Number left, Number right) { return Math.max(getNumberType(left), getNumberType(right)); }
[ "protected", "static", "int", "getCompatibleType", "(", "Number", "left", ",", "Number", "right", ")", "{", "return", "Math", ".", "max", "(", "getNumberType", "(", "left", ")", ",", "getNumberType", "(", "right", ")", ")", ";", "}" ]
Get the type most compatible between the two values that would be the most safe to compare against. This is generally the highest degree of the number type. For example, a {@link #TYPE_INT} compared to a {@link #TYPE_LONG} would compare against the long data type to avoid losing data from a long to an int. @param left The left side value to compare @param right The right side value to compare @return {@link #TYPE_DOUBLE}, {@link #TYPE_FLOAT}, {@link #TYPE_LONG}, or {@link #TYPE_INT} based on the compatible data type @see #getNumberType(Number)
[ "Get", "the", "type", "most", "compatible", "between", "the", "two", "values", "that", "would", "be", "the", "most", "safe", "to", "compare", "against", ".", "This", "is", "generally", "the", "highest", "degree", "of", "the", "number", "type", ".", "For", ...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/runtime/WrapperTypeConversionUtil.java#L410-L412
threerings/gwt-utils
src/main/java/com/threerings/gwt/util/SimpleDataModel.java
SimpleDataModel.addItem
public void addItem (int index, T item) { if (_items == null) { return; } _items.add(index, item); }
java
public void addItem (int index, T item) { if (_items == null) { return; } _items.add(index, item); }
[ "public", "void", "addItem", "(", "int", "index", ",", "T", "item", ")", "{", "if", "(", "_items", "==", "null", ")", "{", "return", ";", "}", "_items", ".", "add", "(", "index", ",", "item", ")", ";", "}" ]
Adds an item to this model. Does not force the refresh of any display.
[ "Adds", "an", "item", "to", "this", "model", ".", "Does", "not", "force", "the", "refresh", "of", "any", "display", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/SimpleDataModel.java#L73-L79
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/velocity/VelocityLogger.java
VelocityLogger.logVelocityMessage
@Override public void logVelocityMessage(final int level, final String message) { switch (level) { case LogSystem.WARN_ID: LOG.warn(message); break; case LogSystem.INFO_ID: LOG.info(message); break; case LogSystem.DEBUG_ID: LOG.debug(message); break; case LogSystem.ERROR_ID: LOG.error(message); break; default: LOG.debug(message); break; } }
java
@Override public void logVelocityMessage(final int level, final String message) { switch (level) { case LogSystem.WARN_ID: LOG.warn(message); break; case LogSystem.INFO_ID: LOG.info(message); break; case LogSystem.DEBUG_ID: LOG.debug(message); break; case LogSystem.ERROR_ID: LOG.error(message); break; default: LOG.debug(message); break; } }
[ "@", "Override", "public", "void", "logVelocityMessage", "(", "final", "int", "level", ",", "final", "String", "message", ")", "{", "switch", "(", "level", ")", "{", "case", "LogSystem", ".", "WARN_ID", ":", "LOG", ".", "warn", "(", "message", ")", ";", ...
Log velocity engine messages. @param level severity level @param message complete error message
[ "Log", "velocity", "engine", "messages", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/velocity/VelocityLogger.java#L36-L55
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UserPoolType.java
UserPoolType.withUserPoolTags
public UserPoolType withUserPoolTags(java.util.Map<String, String> userPoolTags) { setUserPoolTags(userPoolTags); return this; }
java
public UserPoolType withUserPoolTags(java.util.Map<String, String> userPoolTags) { setUserPoolTags(userPoolTags); return this; }
[ "public", "UserPoolType", "withUserPoolTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "userPoolTags", ")", "{", "setUserPoolTags", "(", "userPoolTags", ")", ";", "return", "this", ";", "}" ]
<p> The tags that are assigned to the user pool. A tag is a label that you can apply to user pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. </p> @param userPoolTags The tags that are assigned to the user pool. A tag is a label that you can apply to user pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "that", "are", "assigned", "to", "the", "user", "pool", ".", "A", "tag", "is", "a", "label", "that", "you", "can", "apply", "to", "user", "pools", "to", "categorize", "and", "manage", "them", "in", "different", "ways", "such",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UserPoolType.java#L1557-L1560
apache/fluo-recipes
modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java
CollisionFreeMap.get
public V get(SnapshotBase tx, K key) { byte[] k = serializer.serialize(key); int hash = Hashing.murmur3_32().hashBytes(k).asInt(); String bucketId = genBucketId(Math.abs(hash % numBuckets), numBuckets); BytesBuilder rowBuilder = Bytes.builder(); rowBuilder.append(updatePrefix).append(bucketId).append(':').append(k); Iterator<RowColumnValue> iter = tx.scanner().over(Span.prefix(rowBuilder.toBytes())).build().iterator(); Iterator<V> ui; if (iter.hasNext()) { ui = Iterators.transform(iter, rcv -> deserVal(rcv.getValue())); } else { ui = Collections.<V>emptyList().iterator(); } rowBuilder.setLength(0); rowBuilder.append(dataPrefix).append(bucketId).append(':').append(k); Bytes dataRow = rowBuilder.toBytes(); Bytes cv = tx.get(dataRow, DATA_COLUMN); if (!ui.hasNext()) { if (cv == null) { return null; } else { return deserVal(cv); } } return combiner.combine(key, concat(ui, cv)).orElse(null); }
java
public V get(SnapshotBase tx, K key) { byte[] k = serializer.serialize(key); int hash = Hashing.murmur3_32().hashBytes(k).asInt(); String bucketId = genBucketId(Math.abs(hash % numBuckets), numBuckets); BytesBuilder rowBuilder = Bytes.builder(); rowBuilder.append(updatePrefix).append(bucketId).append(':').append(k); Iterator<RowColumnValue> iter = tx.scanner().over(Span.prefix(rowBuilder.toBytes())).build().iterator(); Iterator<V> ui; if (iter.hasNext()) { ui = Iterators.transform(iter, rcv -> deserVal(rcv.getValue())); } else { ui = Collections.<V>emptyList().iterator(); } rowBuilder.setLength(0); rowBuilder.append(dataPrefix).append(bucketId).append(':').append(k); Bytes dataRow = rowBuilder.toBytes(); Bytes cv = tx.get(dataRow, DATA_COLUMN); if (!ui.hasNext()) { if (cv == null) { return null; } else { return deserVal(cv); } } return combiner.combine(key, concat(ui, cv)).orElse(null); }
[ "public", "V", "get", "(", "SnapshotBase", "tx", ",", "K", "key", ")", "{", "byte", "[", "]", "k", "=", "serializer", ".", "serialize", "(", "key", ")", ";", "int", "hash", "=", "Hashing", ".", "murmur3_32", "(", ")", ".", "hashBytes", "(", "k", ...
This method will retrieve the current value for key and any outstanding updates and combine them using the configured {@link Combiner}. The result from the combiner is returned.
[ "This", "method", "will", "retrieve", "the", "current", "value", "for", "key", "and", "any", "outstanding", "updates", "and", "combine", "them", "using", "the", "configured", "{" ]
train
https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java#L151-L188
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/kd/MinimalisticMemoryKDTree.java
MinimalisticMemoryKDTree.buildTree
private void buildTree(int left, int right, int axis, SortDBIDsBySingleDimension comp) { int middle = (left + right) >>> 1; comp.setDimension(axis); QuickSelectDBIDs.quickSelect(sorted, comp, left, right, middle); final int next = (axis + 1) % dims; if(left + leafsize < middle) { buildTree(left, middle, next, comp); } ++middle; if(middle + leafsize < right) { buildTree(middle, right, next, comp); } }
java
private void buildTree(int left, int right, int axis, SortDBIDsBySingleDimension comp) { int middle = (left + right) >>> 1; comp.setDimension(axis); QuickSelectDBIDs.quickSelect(sorted, comp, left, right, middle); final int next = (axis + 1) % dims; if(left + leafsize < middle) { buildTree(left, middle, next, comp); } ++middle; if(middle + leafsize < right) { buildTree(middle, right, next, comp); } }
[ "private", "void", "buildTree", "(", "int", "left", ",", "int", "right", ",", "int", "axis", ",", "SortDBIDsBySingleDimension", "comp", ")", "{", "int", "middle", "=", "(", "left", "+", "right", ")", ">>>", "1", ";", "comp", ".", "setDimension", "(", "...
Recursively build the tree by partial sorting. O(n log n) complexity. Apparently there exists a variant in only O(n log log n)? Please contribute! @param left Interval minimum @param right Interval maximum @param axis Current splitting axis @param comp Comparator
[ "Recursively", "build", "the", "tree", "by", "partial", "sorting", ".", "O", "(", "n", "log", "n", ")", "complexity", ".", "Apparently", "there", "exists", "a", "variant", "in", "only", "O", "(", "n", "log", "log", "n", ")", "?", "Please", "contribute!...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/kd/MinimalisticMemoryKDTree.java#L192-L205
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java
ComboBoxArrowButtonPainter.createButtonPath
private Shape createButtonPath(CornerSize size, int x, int y, int w, int h) { return shapeGenerator.createRoundRectangle(x, y, w, h, size, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); }
java
private Shape createButtonPath(CornerSize size, int x, int y, int w, int h) { return shapeGenerator.createRoundRectangle(x, y, w, h, size, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); }
[ "private", "Shape", "createButtonPath", "(", "CornerSize", "size", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "return", "shapeGenerator", ".", "createRoundRectangle", "(", "x", ",", "y", ",", "w", ",", "h", ",", "si...
DOCUMENT ME! @param size DOCUMENT ME! @param x DOCUMENT ME! @param y DOCUMENT ME! @param w DOCUMENT ME! @param h DOCUMENT ME! @return DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java#L217-L220
Karumien/jasper-utils
src/main/java/cz/i24/util/jasper/QRCodeColored.java
QRCodeColored.withHint
public QRCodeColored withHint(EncodeHintType hintType, Object value) { this.hints.put(hintType, value); return this; }
java
public QRCodeColored withHint(EncodeHintType hintType, Object value) { this.hints.put(hintType, value); return this; }
[ "public", "QRCodeColored", "withHint", "(", "EncodeHintType", "hintType", ",", "Object", "value", ")", "{", "this", ".", "hints", ".", "put", "(", "hintType", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets hint to {@link com.google.zxing.qrcode.QRCodeWriter#encode} @return the current QRCode object
[ "Sets", "hint", "to", "{", "@link", "com", ".", "google", ".", "zxing", ".", "qrcode", ".", "QRCodeWriter#encode", "}" ]
train
https://github.com/Karumien/jasper-utils/blob/7abc795511aca090089e404c14763b13cbeade72/src/main/java/cz/i24/util/jasper/QRCodeColored.java#L87-L90
OwlPlatform/java-owl-sensor
src/main/java/com/owlplatform/sensor/SensorIoHandler.java
SensorIoHandler.messageReceived
@Override public void messageReceived(IoSession session, Object message) throws Exception { log.debug("{} <-- {}", session, message); if (this.sensorIoAdapter == null) { log.warn( "No SensorIoAdapter defined. Ignoring message from {}: {}", session, message); return; } if (message instanceof SampleMessage) { if (this.sensorIoAdapter != null) { this.sensorIoAdapter.sensorSampleReceived(session, (SampleMessage) message); } } else if (message instanceof HandshakeMessage) { log.debug("Received handshake message from {}: {}", session, message); if (this.sensorIoAdapter != null) { this.sensorIoAdapter.handshakeMessageReceived(session, (HandshakeMessage) message); } } else { log.warn("Unhandled message type for session {}: {}", session, message); } }
java
@Override public void messageReceived(IoSession session, Object message) throws Exception { log.debug("{} <-- {}", session, message); if (this.sensorIoAdapter == null) { log.warn( "No SensorIoAdapter defined. Ignoring message from {}: {}", session, message); return; } if (message instanceof SampleMessage) { if (this.sensorIoAdapter != null) { this.sensorIoAdapter.sensorSampleReceived(session, (SampleMessage) message); } } else if (message instanceof HandshakeMessage) { log.debug("Received handshake message from {}: {}", session, message); if (this.sensorIoAdapter != null) { this.sensorIoAdapter.handshakeMessageReceived(session, (HandshakeMessage) message); } } else { log.warn("Unhandled message type for session {}: {}", session, message); } }
[ "@", "Override", "public", "void", "messageReceived", "(", "IoSession", "session", ",", "Object", "message", ")", "throws", "Exception", "{", "log", ".", "debug", "(", "\"{} <-- {}\"", ",", "session", ",", "message", ")", ";", "if", "(", "this", ".", "sens...
Demultiplexes the message type and passes it to the appropriate method of the IOAdapter. @see SensorIoAdapter#sensorSampleReceived(IoSession, SampleMessage) @see SensorIoAdapter#handshakeMessageReceived(IoSession, HandshakeMessage)
[ "Demultiplexes", "the", "message", "type", "and", "passes", "it", "to", "the", "appropriate", "method", "of", "the", "IOAdapter", "." ]
train
https://github.com/OwlPlatform/java-owl-sensor/blob/7d98e985f2fc150dd696ca5683ad9ef6514be92b/src/main/java/com/owlplatform/sensor/SensorIoHandler.java#L78-L107
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.updateComputeNodeUser
public void updateComputeNodeUser(String poolId, String nodeId, String userName, String sshPublicKey, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { NodeUpdateUserParameter param = new NodeUpdateUserParameter(); param.withSshPublicKey(sshPublicKey); updateComputeNodeUser(poolId, nodeId, userName, param, additionalBehaviors); }
java
public void updateComputeNodeUser(String poolId, String nodeId, String userName, String sshPublicKey, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { NodeUpdateUserParameter param = new NodeUpdateUserParameter(); param.withSshPublicKey(sshPublicKey); updateComputeNodeUser(poolId, nodeId, userName, param, additionalBehaviors); }
[ "public", "void", "updateComputeNodeUser", "(", "String", "poolId", ",", "String", "nodeId", ",", "String", "userName", ",", "String", "sshPublicKey", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", ...
Updates the specified user account on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node where the user account will be updated. @param userName The name of the user account to update. @param sshPublicKey The SSH public key that can be used for remote login to the compute node. If null, the SSH public key is removed. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Updates", "the", "specified", "user", "account", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L195-L200
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Downloader.java
Downloader.fetchContent
public String fetchContent(URL url, boolean useProxy) throws DownloadFailedException { try (HttpResourceConnection conn = new HttpResourceConnection(settings, useProxy); ByteArrayOutputStream out = new ByteArrayOutputStream()) { final InputStream in = conn.fetch(url); IOUtils.copy(in, out); return out.toString(UTF8); } catch (IOException ex) { final String msg = format("Download failed, unable to retrieve '%s'", url.toString()); throw new DownloadFailedException(msg, ex); } }
java
public String fetchContent(URL url, boolean useProxy) throws DownloadFailedException { try (HttpResourceConnection conn = new HttpResourceConnection(settings, useProxy); ByteArrayOutputStream out = new ByteArrayOutputStream()) { final InputStream in = conn.fetch(url); IOUtils.copy(in, out); return out.toString(UTF8); } catch (IOException ex) { final String msg = format("Download failed, unable to retrieve '%s'", url.toString()); throw new DownloadFailedException(msg, ex); } }
[ "public", "String", "fetchContent", "(", "URL", "url", ",", "boolean", "useProxy", ")", "throws", "DownloadFailedException", "{", "try", "(", "HttpResourceConnection", "conn", "=", "new", "HttpResourceConnection", "(", "settings", ",", "useProxy", ")", ";", "ByteA...
Retrieves a file from a given URL and returns the contents. @param url the URL of the file to download @param useProxy whether to use the configured proxy when downloading files @return the content of the file @throws DownloadFailedException is thrown if there is an error downloading the file
[ "Retrieves", "a", "file", "from", "a", "given", "URL", "and", "returns", "the", "contents", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Downloader.java#L100-L110
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setShardingKeysIfValid
public final boolean setShardingKeysIfValid(Object shardingKey, Object superShardingKey, int timeout) throws SQLException { if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey + " within " + timeout + " seconds"); boolean updated = mcf.jdbcRuntime.doSetShardingKeysIfValid(sqlConn, shardingKey, superShardingKey, timeout); if (updated) { currentShardingKey = shardingKey; if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED) currentSuperShardingKey = superShardingKey; connectionPropertyChanged = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "successful? " + updated); return updated; }
java
public final boolean setShardingKeysIfValid(Object shardingKey, Object superShardingKey, int timeout) throws SQLException { if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3)) throw new SQLFeatureNotSupportedException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey + " within " + timeout + " seconds"); boolean updated = mcf.jdbcRuntime.doSetShardingKeysIfValid(sqlConn, shardingKey, superShardingKey, timeout); if (updated) { currentShardingKey = shardingKey; if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED) currentSuperShardingKey = superShardingKey; connectionPropertyChanged = true; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "successful? " + updated); return updated; }
[ "public", "final", "boolean", "setShardingKeysIfValid", "(", "Object", "shardingKey", ",", "Object", "superShardingKey", ",", "int", "timeout", ")", "throws", "SQLException", "{", "if", "(", "mcf", ".", "beforeJDBCVersion", "(", "JDBCRuntimeVersion", ".", "VERSION_4...
Updates the value of the sharding keys after validating them. @param shardingKey the new sharding key. @param superShardingKey the new super sharding key. The 'unchanged' constant can be used to avoid changing it. @param timeout number of seconds within which validation must be done. 0 indicates no timeout. @return true if the sharding keys are valid and were successfully set on the connection. Otherwise, false.
[ "Updates", "the", "value", "of", "the", "sharding", "keys", "after", "validating", "them", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L4119-L4138
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.insertBusHaltBefore
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, String name, BusItineraryHaltType type) { assert beforeHalt != null; assert this.contains(beforeHalt); int haltIndex = -1; int indexBefore = -1; if (!beforeHalt.isValidPrimitive()) { haltIndex = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, beforeHalt); assert haltIndex != -1; indexBefore = this.invalidHalts.get(haltIndex).getInvalidListIndex(); } else { haltIndex = ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, beforeHalt); assert haltIndex != -1; indexBefore = this.validHalts.get(haltIndex).getInvalidListIndex(); } BusItineraryHalt temp; //decal insertion id invalid halts for (int i = haltIndex; i < this.invalidHalts.size(); ++i) { temp = this.invalidHalts.get(i); if (temp.getInvalidListIndex() >= indexBefore) { temp.setInvalidListIndex(temp.getInvalidListIndex() + 1); } } //decal insertion id valid halts final Iterator<BusItineraryHalt> it = this.validHalts.iterator(); while (it.hasNext()) { temp = it.next(); if (temp.getInvalidListIndex() >= indexBefore) { temp.setInvalidListIndex(temp.getInvalidListIndex() + 1); } } return this.addBusHalt(id, name, type, indexBefore); }
java
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, String name, BusItineraryHaltType type) { assert beforeHalt != null; assert this.contains(beforeHalt); int haltIndex = -1; int indexBefore = -1; if (!beforeHalt.isValidPrimitive()) { haltIndex = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, beforeHalt); assert haltIndex != -1; indexBefore = this.invalidHalts.get(haltIndex).getInvalidListIndex(); } else { haltIndex = ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, beforeHalt); assert haltIndex != -1; indexBefore = this.validHalts.get(haltIndex).getInvalidListIndex(); } BusItineraryHalt temp; //decal insertion id invalid halts for (int i = haltIndex; i < this.invalidHalts.size(); ++i) { temp = this.invalidHalts.get(i); if (temp.getInvalidListIndex() >= indexBefore) { temp.setInvalidListIndex(temp.getInvalidListIndex() + 1); } } //decal insertion id valid halts final Iterator<BusItineraryHalt> it = this.validHalts.iterator(); while (it.hasNext()) { temp = it.next(); if (temp.getInvalidListIndex() >= indexBefore) { temp.setInvalidListIndex(temp.getInvalidListIndex() + 1); } } return this.addBusHalt(id, name, type, indexBefore); }
[ "public", "BusItineraryHalt", "insertBusHaltBefore", "(", "BusItineraryHalt", "beforeHalt", ",", "UUID", "id", ",", "String", "name", ",", "BusItineraryHaltType", "type", ")", "{", "assert", "beforeHalt", "!=", "null", ";", "assert", "this", ".", "contains", "(", ...
Insert newHalt before beforeHalt in the ordered list of {@link BusItineraryHalt}. @param beforeHalt the halt where insert the new halt @param id id of the new halt @param name name of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code>
[ "Insert", "newHalt", "before", "beforeHalt", "in", "the", "ordered", "list", "of", "{", "@link", "BusItineraryHalt", "}", ".", "@param", "beforeHalt", "the", "halt", "where", "insert", "the", "new", "halt", "@param", "id", "id", "of", "the", "new", "halt", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1261-L1294
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java
StringUtil.CJKIndexOf
public static int CJKIndexOf(String str, int offset) { for ( int j = offset; j < str.length(); j++ ) { if ( isCJKChar(str.charAt(j)) ) { return j; } } return -1; }
java
public static int CJKIndexOf(String str, int offset) { for ( int j = offset; j < str.length(); j++ ) { if ( isCJKChar(str.charAt(j)) ) { return j; } } return -1; }
[ "public", "static", "int", "CJKIndexOf", "(", "String", "str", ",", "int", "offset", ")", "{", "for", "(", "int", "j", "=", "offset", ";", "j", "<", "str", ".", "length", "(", ")", ";", "j", "++", ")", "{", "if", "(", "isCJKChar", "(", "str", "...
get the index of the first CJK char of the specified string @param str @param offset @return integer
[ "get", "the", "index", "of", "the", "first", "CJK", "char", "of", "the", "specified", "string" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/StringUtil.java#L463-L472
Azure/azure-sdk-for-java
resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java
ResourceGroupsInner.createOrUpdate
public ResourceGroupInner createOrUpdate(String resourceGroupName, ResourceGroupInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); }
java
public ResourceGroupInner createOrUpdate(String resourceGroupName, ResourceGroupInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); }
[ "public", "ResourceGroupInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "ResourceGroupInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".",...
Creates a resource group. @param resourceGroupName The name of the resource group to create or update. @param parameters Parameters supplied to the create or update a resource group. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ResourceGroupInner object if successful.
[ "Creates", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java#L445-L447
matomo-org/piwik-java-tracker
src/main/java/org/piwik/java/tracking/PiwikRequest.java
PiwikRequest.addCustomTrackingParameter
public void addCustomTrackingParameter(String key, Object value){ if (key == null){ throw new NullPointerException("Key cannot be null."); } if (value == null){ throw new NullPointerException("Cannot add a null custom tracking parameter."); } else{ List l = customTrackingParameters.get(key); if (l == null){ l = new ArrayList(); customTrackingParameters.put(key, l); } l.add(value); } }
java
public void addCustomTrackingParameter(String key, Object value){ if (key == null){ throw new NullPointerException("Key cannot be null."); } if (value == null){ throw new NullPointerException("Cannot add a null custom tracking parameter."); } else{ List l = customTrackingParameters.get(key); if (l == null){ l = new ArrayList(); customTrackingParameters.put(key, l); } l.add(value); } }
[ "public", "void", "addCustomTrackingParameter", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Key cannot be null.\"", ")", ";", "}", "if", "(", "value", "==",...
Add a custom tracking parameter to the specified key. This allows users to have multiple parameters with the same name and different values, commonly used during situations where list parameters are needed @param key the parameter's key. Cannot be null @param value the parameter's value. Cannot be null
[ "Add", "a", "custom", "tracking", "parameter", "to", "the", "specified", "key", ".", "This", "allows", "users", "to", "have", "multiple", "parameters", "with", "the", "same", "name", "and", "different", "values", "commonly", "used", "during", "situations", "wh...
train
https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L490-L505
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/java/de/knightsoftnet/validators/rebind/BeanHelperCache.java
BeanHelperCache.createHelper
public BeanHelper createHelper(final Class<?> clazz, final TreeLogger logger, final GeneratorContext context) throws UnableToCompleteException { final JClassType beanType = context.getTypeOracle().findType(clazz.getCanonicalName()); return doCreateHelper(clazz, beanType, logger, context); }
java
public BeanHelper createHelper(final Class<?> clazz, final TreeLogger logger, final GeneratorContext context) throws UnableToCompleteException { final JClassType beanType = context.getTypeOracle().findType(clazz.getCanonicalName()); return doCreateHelper(clazz, beanType, logger, context); }
[ "public", "BeanHelper", "createHelper", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "TreeLogger", "logger", ",", "final", "GeneratorContext", "context", ")", "throws", "UnableToCompleteException", "{", "final", "JClassType", "beanType", "=", "cont...
Creates a BeanHelper and writes an interface containing its instance. Also, recursively creates any BeanHelpers on its constrained properties. (Public for testing.) @param clazz class type @param logger tree logger to use @param context generator context @return bean helper instance @throws UnableToCompleteException if generation can not be done
[ "Creates", "a", "BeanHelper", "and", "writes", "an", "interface", "containing", "its", "instance", ".", "Also", "recursively", "creates", "any", "BeanHelpers", "on", "its", "constrained", "properties", ".", "(", "Public", "for", "testing", ".", ")" ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/rebind/BeanHelperCache.java#L74-L78
jenkinsci/jenkins
core/src/main/java/hudson/util/HttpResponses.java
HttpResponses.errorJSON
public static HttpResponse errorJSON(@Nonnull String message, @Nonnull Map<?,?> data) { return new JSONObjectResponse(data).error(message); }
java
public static HttpResponse errorJSON(@Nonnull String message, @Nonnull Map<?,?> data) { return new JSONObjectResponse(data).error(message); }
[ "public", "static", "HttpResponse", "errorJSON", "(", "@", "Nonnull", "String", "message", ",", "@", "Nonnull", "Map", "<", "?", ",", "?", ">", "data", ")", "{", "return", "new", "JSONObjectResponse", "(", "data", ")", ".", "error", "(", "message", ")", ...
Set the response as an error response plus some data. @param message The error "message" set on the response. @param data The data. @return {@code this} object. @since 2.119
[ "Set", "the", "response", "as", "an", "error", "response", "plus", "some", "data", ".", "@param", "message", "The", "error", "message", "set", "on", "the", "response", ".", "@param", "data", "The", "data", ".", "@return", "{", "@code", "this", "}", "obje...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/HttpResponses.java#L110-L112
jdereg/java-util
src/main/java/com/cedarsoftware/util/ReflectionUtils.java
ReflectionUtils.getDeclaredFields
public static void getDeclaredFields(Class c, Collection<Field> fields) { try { Field[] local = c.getDeclaredFields(); for (Field field : local) { if (!field.isAccessible()) { try { field.setAccessible(true); } catch (Exception ignored) { } } int modifiers = field.getModifiers(); if (!Modifier.isStatic(modifiers) && !field.getName().startsWith("this$") && !Modifier.isTransient(modifiers)) { // speed up: do not count static fields, do not go back up to enclosing object in nested case, do not consider transients fields.add(field); } } } catch (Throwable ignored) { ExceptionUtilities.safelyIgnoreException(ignored); } }
java
public static void getDeclaredFields(Class c, Collection<Field> fields) { try { Field[] local = c.getDeclaredFields(); for (Field field : local) { if (!field.isAccessible()) { try { field.setAccessible(true); } catch (Exception ignored) { } } int modifiers = field.getModifiers(); if (!Modifier.isStatic(modifiers) && !field.getName().startsWith("this$") && !Modifier.isTransient(modifiers)) { // speed up: do not count static fields, do not go back up to enclosing object in nested case, do not consider transients fields.add(field); } } } catch (Throwable ignored) { ExceptionUtilities.safelyIgnoreException(ignored); } }
[ "public", "static", "void", "getDeclaredFields", "(", "Class", "c", ",", "Collection", "<", "Field", ">", "fields", ")", "{", "try", "{", "Field", "[", "]", "local", "=", "c", ".", "getDeclaredFields", "(", ")", ";", "for", "(", "Field", "field", ":", ...
Get all non static, non transient, fields of the passed in class, including private fields. Note, the special this$ field is also not returned. The resulting fields are stored in a Collection. @param c Class instance that would need further processing (reference fields). This makes field traversal on a class faster as it does not need to continually process known fields like primitives.
[ "Get", "all", "non", "static", "non", "transient", "fields", "of", "the", "passed", "in", "class", "including", "private", "fields", ".", "Note", "the", "special", "this$", "field", "is", "also", "not", "returned", ".", "The", "resulting", "fields", "are", ...
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/ReflectionUtils.java#L159-L189
waldheinz/fat32-lib
src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java
FatLfnDirectory.addFile
@Override public FatLfnDirectoryEntry addFile(String name) throws IOException { checkWritable(); checkUniqueName(name); name = name.trim(); final ShortName sn = makeShortName(name); final FatLfnDirectoryEntry entry = new FatLfnDirectoryEntry(name, sn, this, false); dir.addEntries(entry.compactForm()); shortNameIndex.put(sn, entry); longNameIndex.put(name.toLowerCase(Locale.ROOT), entry); getFile(entry.realEntry); dir.setDirty(); return entry; }
java
@Override public FatLfnDirectoryEntry addFile(String name) throws IOException { checkWritable(); checkUniqueName(name); name = name.trim(); final ShortName sn = makeShortName(name); final FatLfnDirectoryEntry entry = new FatLfnDirectoryEntry(name, sn, this, false); dir.addEntries(entry.compactForm()); shortNameIndex.put(sn, entry); longNameIndex.put(name.toLowerCase(Locale.ROOT), entry); getFile(entry.realEntry); dir.setDirty(); return entry; }
[ "@", "Override", "public", "FatLfnDirectoryEntry", "addFile", "(", "String", "name", ")", "throws", "IOException", "{", "checkWritable", "(", ")", ";", "checkUniqueName", "(", "name", ")", ";", "name", "=", "name", ".", "trim", "(", ")", ";", "final", "Sho...
<p> {@inheritDoc} </p><p> According to the FAT file system specification, leading and trailing spaces in the {@code name} are ignored by this method. </p> @param name {@inheritDoc} @return {@inheritDoc} @throws IOException {@inheritDoc}
[ "<p", ">", "{", "@inheritDoc", "}", "<", "/", "p", ">", "<p", ">", "According", "to", "the", "FAT", "file", "system", "specification", "leading", "and", "trailing", "spaces", "in", "the", "{", "@code", "name", "}", "are", "ignored", "by", "this", "meth...
train
https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java#L133-L153
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/StringUtil.java
StringUtil.suggest
public static String suggest(Filter<String> filter, String pattern, boolean tryEmptyVar){ if(!pattern.contains("${i}")) throw new IllegalArgumentException("pattern must have ${i}"); TemplateMatcher matcher = new TemplateMatcher("${", "}"); if(tryEmptyVar){ String value = matcher.replace(pattern, Collections.singletonMap("i", "")); if(filter.select(value)) return value; } int i = tryEmptyVar ? 2 : 1; while(true){ String value = matcher.replace(pattern, Collections.singletonMap("i", String.valueOf(i))); if(filter.select(value)) return value; i++; } }
java
public static String suggest(Filter<String> filter, String pattern, boolean tryEmptyVar){ if(!pattern.contains("${i}")) throw new IllegalArgumentException("pattern must have ${i}"); TemplateMatcher matcher = new TemplateMatcher("${", "}"); if(tryEmptyVar){ String value = matcher.replace(pattern, Collections.singletonMap("i", "")); if(filter.select(value)) return value; } int i = tryEmptyVar ? 2 : 1; while(true){ String value = matcher.replace(pattern, Collections.singletonMap("i", String.valueOf(i))); if(filter.select(value)) return value; i++; } }
[ "public", "static", "String", "suggest", "(", "Filter", "<", "String", ">", "filter", ",", "String", "pattern", ",", "boolean", "tryEmptyVar", ")", "{", "if", "(", "!", "pattern", ".", "contains", "(", "\"${i}\"", ")", ")", "throw", "new", "IllegalArgument...
the pattern specified must have variable part ${i} example: test${i}.txt it will find a string using pattern, which is accepted by the specified filter. if tryEmptyVar is true, it searches in order: test.txt, test2.txt, test3.txt and so on if tryEmptyVar is false, it searches in order: test1.txt, test2.txt, test3.txt and so on @see jlibs.core.io.FileUtil#findFreeFile(java.io.File dir, String pattern, boolean tryEmptyVar)
[ "the", "pattern", "specified", "must", "have", "variable", "part", "$", "{", "i", "}", "example", ":", "test$", "{", "i", "}", ".", "txt" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/StringUtil.java#L102-L121