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
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java
GroovyScript2RestLoader.getScriptMetadata
@POST @Produces({MediaType.APPLICATION_JSON}) @Path("meta/{repository}/{workspace}/{path:.*}") public Response getScriptMetadata(@PathParam("repository") String repository, @PathParam("workspace") String workspace, @PathParam("path") String path) { Session ses = null; try { ses = sessionProviderService.getSessionProvider(null).getSession(workspace, repositoryService.getRepository(repository)); Node script = ((Node)ses.getItem("/" + path)).getNode("jcr:content"); ResourceId key = new NodeScriptKey(repository, workspace, script); ScriptMetadata meta = new ScriptMetadata(script.getProperty("exo:autoload").getBoolean(), // groovyPublisher.isPublished(key), // script.getProperty("jcr:mimeType").getString(), // script.getProperty("jcr:lastModified").getDate().getTimeInMillis()); return Response.status(Response.Status.OK).entity(meta).type(MediaType.APPLICATION_JSON).build(); } catch (PathNotFoundException e) { String msg = "Path " + path + " does not exists"; LOG.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build(); } catch (Exception e) { LOG.error(e.getMessage(), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()) .type(MediaType.TEXT_PLAIN).build(); } finally { if (ses != null) { ses.logout(); } } }
java
@POST @Produces({MediaType.APPLICATION_JSON}) @Path("meta/{repository}/{workspace}/{path:.*}") public Response getScriptMetadata(@PathParam("repository") String repository, @PathParam("workspace") String workspace, @PathParam("path") String path) { Session ses = null; try { ses = sessionProviderService.getSessionProvider(null).getSession(workspace, repositoryService.getRepository(repository)); Node script = ((Node)ses.getItem("/" + path)).getNode("jcr:content"); ResourceId key = new NodeScriptKey(repository, workspace, script); ScriptMetadata meta = new ScriptMetadata(script.getProperty("exo:autoload").getBoolean(), // groovyPublisher.isPublished(key), // script.getProperty("jcr:mimeType").getString(), // script.getProperty("jcr:lastModified").getDate().getTimeInMillis()); return Response.status(Response.Status.OK).entity(meta).type(MediaType.APPLICATION_JSON).build(); } catch (PathNotFoundException e) { String msg = "Path " + path + " does not exists"; LOG.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build(); } catch (Exception e) { LOG.error(e.getMessage(), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()) .type(MediaType.TEXT_PLAIN).build(); } finally { if (ses != null) { ses.logout(); } } }
[ "@", "POST", "@", "Produces", "(", "{", "MediaType", ".", "APPLICATION_JSON", "}", ")", "@", "Path", "(", "\"meta/{repository}/{workspace}/{path:.*}\"", ")", "public", "Response", "getScriptMetadata", "(", "@", "PathParam", "(", "\"repository\"", ")", "String", "r...
Get groovy script's meta-information. @param repository repository name @param workspace workspace name @param path JCR path to node that contains script @return groovy script's meta-information @response {code:json} "scriptList" : the groovy script's meta-information {code} @LevelAPI Provisional
[ "Get", "groovy", "script", "s", "meta", "-", "information", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1410-L1450
drewnoakes/metadata-extractor
Source/com/drew/metadata/TagDescriptor.java
TagDescriptor.convertBytesToVersionString
@Nullable public static String convertBytesToVersionString(@Nullable int[] components, final int majorDigits) { if (components == null) return null; StringBuilder version = new StringBuilder(); for (int i = 0; i < 4 && i < components.length; i++) { if (i == majorDigits) version.append('.'); char c = (char)components[i]; if (c < '0') c += '0'; if (i == 0 && c == '0') continue; version.append(c); } return version.toString(); }
java
@Nullable public static String convertBytesToVersionString(@Nullable int[] components, final int majorDigits) { if (components == null) return null; StringBuilder version = new StringBuilder(); for (int i = 0; i < 4 && i < components.length; i++) { if (i == majorDigits) version.append('.'); char c = (char)components[i]; if (c < '0') c += '0'; if (i == 0 && c == '0') continue; version.append(c); } return version.toString(); }
[ "@", "Nullable", "public", "static", "String", "convertBytesToVersionString", "(", "@", "Nullable", "int", "[", "]", "components", ",", "final", "int", "majorDigits", ")", "{", "if", "(", "components", "==", "null", ")", "return", "null", ";", "StringBuilder",...
Takes a series of 4 bytes from the specified offset, and converts these to a well-known version number, where possible. <p> Two different formats are processed: <ul> <li>[30 32 31 30] -&gt; 2.10</li> <li>[0 1 0 0] -&gt; 1.00</li> </ul> @param components the four version values @param majorDigits the number of components to be @return the version as a string of form "2.10" or null if the argument cannot be converted
[ "Takes", "a", "series", "of", "4", "bytes", "from", "the", "specified", "offset", "and", "converts", "these", "to", "a", "well", "-", "known", "version", "number", "where", "possible", ".", "<p", ">", "Two", "different", "formats", "are", "processed", ":",...
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/TagDescriptor.java#L108-L125
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ClassHelper.java
ClassHelper.getMethod
public static Method getMethod(Class clazz, String methodName, Class[] params) { try { return clazz.getMethod(methodName, params); } catch (Exception ignored) {} return null; }
java
public static Method getMethod(Class clazz, String methodName, Class[] params) { try { return clazz.getMethod(methodName, params); } catch (Exception ignored) {} return null; }
[ "public", "static", "Method", "getMethod", "(", "Class", "clazz", ",", "String", "methodName", ",", "Class", "[", "]", "params", ")", "{", "try", "{", "return", "clazz", ".", "getMethod", "(", "methodName", ",", "params", ")", ";", "}", "catch", "(", "...
Determines the method with the specified signature via reflection look-up. @param clazz The java class to search in @param methodName The method's name @param params The parameter types @return The method object or <code>null</code> if no matching method was found
[ "Determines", "the", "method", "with", "the", "specified", "signature", "via", "reflection", "look", "-", "up", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L233-L242
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/Grid.java
Grid.getInstance
public static Grid getInstance(URL configFile, Properties properties) throws InterruptedException { return getInstance(new UrlResource(configFile), properties); }
java
public static Grid getInstance(URL configFile, Properties properties) throws InterruptedException { return getInstance(new UrlResource(configFile), properties); }
[ "public", "static", "Grid", "getInstance", "(", "URL", "configFile", ",", "Properties", "properties", ")", "throws", "InterruptedException", "{", "return", "getInstance", "(", "new", "UrlResource", "(", "configFile", ")", ",", "properties", ")", ";", "}" ]
Retrieves the grid instance, as defined in the given configuration file. @param configFile The name of the configuration file containing the grid definition. @param properties A {@link Properties Properties} object containing the grid's properties to be injected into placeholders in the configuration file. This parameter is helpful when you want to use the same xml configuration with different properties for different instances. @return The grid instance.
[ "Retrieves", "the", "grid", "instance", "as", "defined", "in", "the", "given", "configuration", "file", "." ]
train
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/Grid.java#L100-L102
box/box-java-sdk
src/main/java/com/box/sdk/BoxMetadataFilter.java
BoxMetadataFilter.addNumberRangeFilter
public void addNumberRangeFilter(String key, SizeRange sizeRange) { JsonObject opObj = new JsonObject(); if (sizeRange.getLowerBoundBytes() != 0) { opObj.add("gt", sizeRange.getLowerBoundBytes()); } if (sizeRange.getUpperBoundBytes() != 0) { opObj.add("lt", sizeRange.getUpperBoundBytes()); } this.filtersList.add(key, opObj); }
java
public void addNumberRangeFilter(String key, SizeRange sizeRange) { JsonObject opObj = new JsonObject(); if (sizeRange.getLowerBoundBytes() != 0) { opObj.add("gt", sizeRange.getLowerBoundBytes()); } if (sizeRange.getUpperBoundBytes() != 0) { opObj.add("lt", sizeRange.getUpperBoundBytes()); } this.filtersList.add(key, opObj); }
[ "public", "void", "addNumberRangeFilter", "(", "String", "key", ",", "SizeRange", "sizeRange", ")", "{", "JsonObject", "opObj", "=", "new", "JsonObject", "(", ")", ";", "if", "(", "sizeRange", ".", "getLowerBoundBytes", "(", ")", "!=", "0", ")", "{", "opOb...
Set a NumberRanger filter to the filter numbers, example: key=documentNumber, lt : 20, gt : 5. @param key the key that the filter should be looking for. @param sizeRange the specific value that corresponds to the key.
[ "Set", "a", "NumberRanger", "filter", "to", "the", "filter", "numbers", "example", ":", "key", "=", "documentNumber", "lt", ":", "20", "gt", ":", "5", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxMetadataFilter.java#L56-L67
apereo/cas
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/support/RegisteredServiceRegexAttributeFilter.java
RegisteredServiceRegexAttributeFilter.filterAttributes
private List filterAttributes(final List<Object> valuesToFilter, final String attributeName) { return valuesToFilter .stream() .filter(this::patternMatchesAttributeValue) .peek(attributeValue -> logReleasedAttributeEntry(attributeName, attributeValue)) .collect(Collectors.toList()); }
java
private List filterAttributes(final List<Object> valuesToFilter, final String attributeName) { return valuesToFilter .stream() .filter(this::patternMatchesAttributeValue) .peek(attributeValue -> logReleasedAttributeEntry(attributeName, attributeValue)) .collect(Collectors.toList()); }
[ "private", "List", "filterAttributes", "(", "final", "List", "<", "Object", ">", "valuesToFilter", ",", "final", "String", "attributeName", ")", "{", "return", "valuesToFilter", ".", "stream", "(", ")", ".", "filter", "(", "this", "::", "patternMatchesAttributeV...
Filter array attributes. @param valuesToFilter the values to filter @param attributeName the attribute name @return the string[]
[ "Filter", "array", "attributes", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/support/RegisteredServiceRegexAttributeFilter.java#L107-L113
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/model/query/JdbcUtil.java
JdbcUtil.setQueryParams
public void setQueryParams(Collection queryParams, PreparedStatement ps) throws Exception { if ((queryParams == null) || (queryParams.size() == 0)) return; int i = 1; Object key = null; Iterator iter = queryParams.iterator(); while (iter.hasNext()) { key = iter.next(); if (key != null) { convertType(i, key, ps); Debug.logVerbose("[JdonFramework] parameter " + i + " = " + key.toString(), module); } else { Debug.logWarning("[JdonFramework] parameter " + i + " is null", module); ps.setString(i, ""); } i++; } }
java
public void setQueryParams(Collection queryParams, PreparedStatement ps) throws Exception { if ((queryParams == null) || (queryParams.size() == 0)) return; int i = 1; Object key = null; Iterator iter = queryParams.iterator(); while (iter.hasNext()) { key = iter.next(); if (key != null) { convertType(i, key, ps); Debug.logVerbose("[JdonFramework] parameter " + i + " = " + key.toString(), module); } else { Debug.logWarning("[JdonFramework] parameter " + i + " is null", module); ps.setString(i, ""); } i++; } }
[ "public", "void", "setQueryParams", "(", "Collection", "queryParams", ",", "PreparedStatement", "ps", ")", "throws", "Exception", "{", "if", "(", "(", "queryParams", "==", "null", ")", "||", "(", "queryParams", ".", "size", "(", ")", "==", "0", ")", ")", ...
queryParam type only support String Integer Float or Long Double Bye Short if you need operate other types, you must use JDBC directly!
[ "queryParam", "type", "only", "support", "String", "Integer", "Float", "or", "Long", "Double", "Bye", "Short", "if", "you", "need", "operate", "other", "types", "you", "must", "use", "JDBC", "directly!" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/model/query/JdbcUtil.java#L43-L62
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsDestinationImpl.java
JmsDestinationImpl.setDestName
void setDestName(String destName) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDestName", destName); if ((null == destName) || ("".equals(destName))) { // d238447 FFDC review. More likely to be an external rather than internal error, // so no FFDC. throw (JMSException) JmsErrorUtils.newThrowable( InvalidDestinationException.class, "INVALID_VALUE_CWSIA0281", new Object[] { "destName", destName }, tc ); } // Store the property updateProperty(DEST_NAME, destName); // Clear the cached destinationAddresses, as they may now be incorrect clearCachedProducerDestinationAddress(); clearCachedConsumerDestinationAddress(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDestName"); }
java
void setDestName(String destName) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDestName", destName); if ((null == destName) || ("".equals(destName))) { // d238447 FFDC review. More likely to be an external rather than internal error, // so no FFDC. throw (JMSException) JmsErrorUtils.newThrowable( InvalidDestinationException.class, "INVALID_VALUE_CWSIA0281", new Object[] { "destName", destName }, tc ); } // Store the property updateProperty(DEST_NAME, destName); // Clear the cached destinationAddresses, as they may now be incorrect clearCachedProducerDestinationAddress(); clearCachedConsumerDestinationAddress(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDestName"); }
[ "void", "setDestName", "(", "String", "destName", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", ...
setDestName Set the destName for this Destination. @param destName The value for the destName @exception JMSException Thrown if the destName is null or blank
[ "setDestName", "Set", "the", "destName", "for", "this", "Destination", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsDestinationImpl.java#L215-L238
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/PhoneIntents.java
PhoneIntents.newSmsIntent
public static Intent newSmsIntent(Context context, String body, String phoneNumber) { return newSmsIntent(context, body, new String[]{phoneNumber}); }
java
public static Intent newSmsIntent(Context context, String body, String phoneNumber) { return newSmsIntent(context, body, new String[]{phoneNumber}); }
[ "public", "static", "Intent", "newSmsIntent", "(", "Context", "context", ",", "String", "body", ",", "String", "phoneNumber", ")", "{", "return", "newSmsIntent", "(", "context", ",", "body", ",", "new", "String", "[", "]", "{", "phoneNumber", "}", ")", ";"...
Creates an intent that will allow to send an SMS without specifying the phone number @param body The text to send @param phoneNumber The phone number to send the SMS to @return the intent
[ "Creates", "an", "intent", "that", "will", "allow", "to", "send", "an", "SMS", "without", "specifying", "the", "phone", "number" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L82-L84
roboconf/roboconf-platform
core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java
DockerUtils.findContainerByIdOrByName
public static Container findContainerByIdOrByName( String name, DockerClient dockerClient ) { Container result = null; List<Container> containers = dockerClient.listContainersCmd().withShowAll( true ).exec(); for( Container container : containers ) { List<String> names = Arrays.asList( container.getNames()); // Docker containers are prefixed with '/'. // At least, those we created, since their parent is the Docker daemon. if( container.getId().equals( name ) || names.contains( "/" + name )) { result = container; break; } } return result; }
java
public static Container findContainerByIdOrByName( String name, DockerClient dockerClient ) { Container result = null; List<Container> containers = dockerClient.listContainersCmd().withShowAll( true ).exec(); for( Container container : containers ) { List<String> names = Arrays.asList( container.getNames()); // Docker containers are prefixed with '/'. // At least, those we created, since their parent is the Docker daemon. if( container.getId().equals( name ) || names.contains( "/" + name )) { result = container; break; } } return result; }
[ "public", "static", "Container", "findContainerByIdOrByName", "(", "String", "name", ",", "DockerClient", "dockerClient", ")", "{", "Container", "result", "=", "null", ";", "List", "<", "Container", ">", "containers", "=", "dockerClient", ".", "listContainersCmd", ...
Finds a container by ID or by name. @param name the container ID or name (not null) @param dockerClient a Docker client @return a container, or null if none was found
[ "Finds", "a", "container", "by", "ID", "or", "by", "name", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L187-L204
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java
PreconditionUtil.assertTrue
public static void assertTrue(boolean condition, String message, Object... args) { verify(condition, message, args); }
java
public static void assertTrue(boolean condition, String message, Object... args) { verify(condition, message, args); }
[ "public", "static", "void", "assertTrue", "(", "boolean", "condition", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "verify", "(", "condition", ",", "message", ",", "args", ")", ";", "}" ]
Asserts that a condition is true. If it isn't it throws an {@link AssertionError} with the given message. @param message the identifying message for the {@link AssertionError} ( <code>null</code> okay) @param condition condition to be checked
[ "Asserts", "that", "a", "condition", "is", "true", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "with", "the", "given", "message", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java#L86-L88
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java
RDBMEntityGroupStore.findParentGroupsForEntity
private java.util.Iterator findParentGroupsForEntity(String memberKey, int type) throws GroupsException { Connection conn = null; Collection groups = new ArrayList(); IEntityGroup eg = null; try { conn = RDBMServices.getConnection(); String sql = getFindParentGroupsForEntitySql(); PreparedStatement ps = conn.prepareStatement(sql); try { ps.setString(1, memberKey); ps.setInt(2, type); if (LOG.isDebugEnabled()) LOG.debug( "RDBMEntityGroupStore.findParentGroupsForEntity(): " + ps + " (" + memberKey + ", " + type + ", memberIsGroup = F)"); ResultSet rs = ps.executeQuery(); try { while (rs.next()) { eg = instanceFromResultSet(rs); groups.add(eg); } } finally { rs.close(); } } finally { ps.close(); } } catch (Exception e) { LOG.error("RDBMEntityGroupStore.findParentGroupsForEntity(): " + e); throw new GroupsException("Problem retrieving containing groups: " + e); } finally { RDBMServices.releaseConnection(conn); } return groups.iterator(); }
java
private java.util.Iterator findParentGroupsForEntity(String memberKey, int type) throws GroupsException { Connection conn = null; Collection groups = new ArrayList(); IEntityGroup eg = null; try { conn = RDBMServices.getConnection(); String sql = getFindParentGroupsForEntitySql(); PreparedStatement ps = conn.prepareStatement(sql); try { ps.setString(1, memberKey); ps.setInt(2, type); if (LOG.isDebugEnabled()) LOG.debug( "RDBMEntityGroupStore.findParentGroupsForEntity(): " + ps + " (" + memberKey + ", " + type + ", memberIsGroup = F)"); ResultSet rs = ps.executeQuery(); try { while (rs.next()) { eg = instanceFromResultSet(rs); groups.add(eg); } } finally { rs.close(); } } finally { ps.close(); } } catch (Exception e) { LOG.error("RDBMEntityGroupStore.findParentGroupsForEntity(): " + e); throw new GroupsException("Problem retrieving containing groups: " + e); } finally { RDBMServices.releaseConnection(conn); } return groups.iterator(); }
[ "private", "java", ".", "util", ".", "Iterator", "findParentGroupsForEntity", "(", "String", "memberKey", ",", "int", "type", ")", "throws", "GroupsException", "{", "Connection", "conn", "=", "null", ";", "Collection", "groups", "=", "new", "ArrayList", "(", "...
Find the groups associated with this member key. @param memberKey @param type @return java.util.Iterator
[ "Find", "the", "groups", "associated", "with", "this", "member", "key", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java#L341-L383
metamx/java-util
src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java
ScheduledExecutors.scheduleWithFixedDelay
public static void scheduleWithFixedDelay(ScheduledExecutorService exec, Duration delay, Runnable runnable) { scheduleWithFixedDelay(exec, delay, delay, runnable); }
java
public static void scheduleWithFixedDelay(ScheduledExecutorService exec, Duration delay, Runnable runnable) { scheduleWithFixedDelay(exec, delay, delay, runnable); }
[ "public", "static", "void", "scheduleWithFixedDelay", "(", "ScheduledExecutorService", "exec", ",", "Duration", "delay", ",", "Runnable", "runnable", ")", "{", "scheduleWithFixedDelay", "(", "exec", ",", "delay", ",", "delay", ",", "runnable", ")", ";", "}" ]
Run runnable repeatedly with the given delay between calls. Exceptions are caught and logged as errors.
[ "Run", "runnable", "repeatedly", "with", "the", "given", "delay", "between", "calls", ".", "Exceptions", "are", "caught", "and", "logged", "as", "errors", "." ]
train
https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java#L37-L40
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java
AbstractLinear.create_BACKGROUND_Image
protected BufferedImage create_BACKGROUND_Image(final int WIDTH, final int HEIGHT, BufferedImage image) { if (WIDTH <= 0 || HEIGHT <= 0) { return UTIL.createImage(1, 1, Transparency.TRANSLUCENT); } if (image == null) { image = UTIL.createImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT); } final Graphics2D G2 = image.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); final int IMAGE_WIDTH = image.getWidth(); final int IMAGE_HEIGHT = image.getHeight(); // Draw the background image BACKGROUND_FACTORY.createLinearBackground(WIDTH, HEIGHT, getBackgroundColor(), getModel().getCustomBackground(), getModel().getTextureColor(), image); // Draw the custom layer if selected if (isCustomLayerVisible()) { G2.drawImage(UTIL.getScaledInstance(getCustomLayer(), IMAGE_WIDTH, IMAGE_HEIGHT, RenderingHints.VALUE_INTERPOLATION_BICUBIC), 0, 0, null); } G2.dispose(); return image; }
java
protected BufferedImage create_BACKGROUND_Image(final int WIDTH, final int HEIGHT, BufferedImage image) { if (WIDTH <= 0 || HEIGHT <= 0) { return UTIL.createImage(1, 1, Transparency.TRANSLUCENT); } if (image == null) { image = UTIL.createImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT); } final Graphics2D G2 = image.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); final int IMAGE_WIDTH = image.getWidth(); final int IMAGE_HEIGHT = image.getHeight(); // Draw the background image BACKGROUND_FACTORY.createLinearBackground(WIDTH, HEIGHT, getBackgroundColor(), getModel().getCustomBackground(), getModel().getTextureColor(), image); // Draw the custom layer if selected if (isCustomLayerVisible()) { G2.drawImage(UTIL.getScaledInstance(getCustomLayer(), IMAGE_WIDTH, IMAGE_HEIGHT, RenderingHints.VALUE_INTERPOLATION_BICUBIC), 0, 0, null); } G2.dispose(); return image; }
[ "protected", "BufferedImage", "create_BACKGROUND_Image", "(", "final", "int", "WIDTH", ",", "final", "int", "HEIGHT", ",", "BufferedImage", "image", ")", "{", "if", "(", "WIDTH", "<=", "0", "||", "HEIGHT", "<=", "0", ")", "{", "return", "UTIL", ".", "creat...
Returns the background image with the currently active backgroundcolor with the given width and height. @param WIDTH @param HEIGHT @param image @return buffered image containing the background with the selected background design
[ "Returns", "the", "background", "image", "with", "the", "currently", "active", "backgroundcolor", "with", "the", "given", "width", "and", "height", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java#L917-L943
jdereg/java-util
src/main/java/com/cedarsoftware/util/StringUtilities.java
StringUtilities.createString
public static String createString(byte[] bytes, String encoding) { try { return bytes == null ? null : new String(bytes, encoding); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(String.format("Encoding (%s) is not supported by your JVM", encoding), e); } }
java
public static String createString(byte[] bytes, String encoding) { try { return bytes == null ? null : new String(bytes, encoding); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(String.format("Encoding (%s) is not supported by your JVM", encoding), e); } }
[ "public", "static", "String", "createString", "(", "byte", "[", "]", "bytes", ",", "String", "encoding", ")", "{", "try", "{", "return", "bytes", "==", "null", "?", "null", ":", "new", "String", "(", "bytes", ",", "encoding", ")", ";", "}", "catch", ...
Convert a byte[] into a String with a particular encoding. Preferable used when the encoding is one of the guaranteed Java types and you don't want to have to catch the UnsupportedEncodingException required by Java @param bytes bytes to encode into a string @param encoding encoding to use
[ "Convert", "a", "byte", "[]", "into", "a", "String", "with", "a", "particular", "encoding", ".", "Preferable", "used", "when", "the", "encoding", "is", "one", "of", "the", "guaranteed", "Java", "types", "and", "you", "don", "t", "want", "to", "have", "to...
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/StringUtilities.java#L461-L471
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainTopicsInner.java
DomainTopicsInner.listByDomainAsync
public Observable<List<DomainTopicInner>> listByDomainAsync(String resourceGroupName, String domainName) { return listByDomainWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<List<DomainTopicInner>>, List<DomainTopicInner>>() { @Override public List<DomainTopicInner> call(ServiceResponse<List<DomainTopicInner>> response) { return response.body(); } }); }
java
public Observable<List<DomainTopicInner>> listByDomainAsync(String resourceGroupName, String domainName) { return listByDomainWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<List<DomainTopicInner>>, List<DomainTopicInner>>() { @Override public List<DomainTopicInner> call(ServiceResponse<List<DomainTopicInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "DomainTopicInner", ">", ">", "listByDomainAsync", "(", "String", "resourceGroupName", ",", "String", "domainName", ")", "{", "return", "listByDomainWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ")", ...
List domain topics. List all the topics in a domain. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Domain name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;DomainTopicInner&gt; object
[ "List", "domain", "topics", ".", "List", "all", "the", "topics", "in", "a", "domain", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainTopicsInner.java#L200-L207
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java
NameUtils.getLogicalName
public static String getLogicalName(String name, String trailingName) { if (isBlank(trailingName)) { return name; } String shortName = getShortName(name); if (shortName.indexOf(trailingName) == -1) { return name; } return shortName.substring(0, shortName.length() - trailingName.length()); }
java
public static String getLogicalName(String name, String trailingName) { if (isBlank(trailingName)) { return name; } String shortName = getShortName(name); if (shortName.indexOf(trailingName) == -1) { return name; } return shortName.substring(0, shortName.length() - trailingName.length()); }
[ "public", "static", "String", "getLogicalName", "(", "String", "name", ",", "String", "trailingName", ")", "{", "if", "(", "isBlank", "(", "trailingName", ")", ")", "{", "return", "name", ";", "}", "String", "shortName", "=", "getShortName", "(", "name", "...
Retrieves the logical name of the class without the trailing name. @param name The name of the class @param trailingName The trailing name @return The logical name
[ "Retrieves", "the", "logical", "name", "of", "the", "class", "without", "the", "trailing", "name", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java#L214-L225
usc/wechat-mp-sdk
wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/ReplyUtil.java
ReplyUtil.getDummyNewsReplyDetailWarpper
public static ReplyDetailWarpper getDummyNewsReplyDetailWarpper() { ReplyDetail replyDetail1 = new ReplyDetail(); replyDetail1.setTitle("fork me"); replyDetail1.setMediaUrl("http://c.hiphotos.baidu.com/baike/c%3DbaikeA4%2C10%2C95/sign=c1767bbf4b36acaf4de0c1ad15b2e851/29381f30e924b899a39841be6e061d950b7b02087af4d6b3.jpg"); replyDetail1.setUrl("https://github.com/usc/wechat-mp-sdk"); replyDetail1.setDescription("hello world, wechat mp sdk is coming"); ReplyDetail replyDetail2 = new ReplyDetail(); replyDetail2.setTitle("star me"); replyDetail2.setMediaUrl("http://e.hiphotos.baidu.com/baike/pic/item/96dda144ad345982665e49810df431adcaef84c9.jpg"); replyDetail2.setUrl("https://github.com/usc/wechat-mp-web"); replyDetail2.setDescription("wechat mp web demo"); return new ReplyDetailWarpper("news", Arrays.asList(replyDetail1, replyDetail2)); }
java
public static ReplyDetailWarpper getDummyNewsReplyDetailWarpper() { ReplyDetail replyDetail1 = new ReplyDetail(); replyDetail1.setTitle("fork me"); replyDetail1.setMediaUrl("http://c.hiphotos.baidu.com/baike/c%3DbaikeA4%2C10%2C95/sign=c1767bbf4b36acaf4de0c1ad15b2e851/29381f30e924b899a39841be6e061d950b7b02087af4d6b3.jpg"); replyDetail1.setUrl("https://github.com/usc/wechat-mp-sdk"); replyDetail1.setDescription("hello world, wechat mp sdk is coming"); ReplyDetail replyDetail2 = new ReplyDetail(); replyDetail2.setTitle("star me"); replyDetail2.setMediaUrl("http://e.hiphotos.baidu.com/baike/pic/item/96dda144ad345982665e49810df431adcaef84c9.jpg"); replyDetail2.setUrl("https://github.com/usc/wechat-mp-web"); replyDetail2.setDescription("wechat mp web demo"); return new ReplyDetailWarpper("news", Arrays.asList(replyDetail1, replyDetail2)); }
[ "public", "static", "ReplyDetailWarpper", "getDummyNewsReplyDetailWarpper", "(", ")", "{", "ReplyDetail", "replyDetail1", "=", "new", "ReplyDetail", "(", ")", ";", "replyDetail1", ".", "setTitle", "(", "\"fork me\"", ")", ";", "replyDetail1", ".", "setMediaUrl", "("...
dummy reply. please according to your own situation to build ReplyDetailWarpper, and remove those code in production.
[ "dummy", "reply", ".", "please", "according", "to", "your", "own", "situation", "to", "build", "ReplyDetailWarpper", "and", "remove", "those", "code", "in", "production", "." ]
train
https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/ReplyUtil.java#L76-L90
paypal/SeLion
client/src/main/java/com/paypal/selion/reports/runtime/SeLionReporter.java
SeLionReporter.generateLog
protected void generateLog(boolean takeScreenshot, boolean saveSrc) { logger.entering(new Object[] { takeScreenshot, saveSrc }); try { BaseLog log = createLog(saveSrc); String screenshotPath = null; log.setScreen(null); if (takeScreenshot) { // screenshot PageContents screen = new PageContents(Gatherer.takeScreenshot(Grid.driver()), getBaseFileName()); screenshotPath = saver.saveScreenshot(screen); log.setScreen(screenshotPath); } // creating a string from all the info for the report to deserialize Reporter.log(log.toString()); } catch (Exception e) { logger.log(Level.SEVERE, "error in the logging feature of SeLion " + e.getMessage(), e); } logger.exiting(); }
java
protected void generateLog(boolean takeScreenshot, boolean saveSrc) { logger.entering(new Object[] { takeScreenshot, saveSrc }); try { BaseLog log = createLog(saveSrc); String screenshotPath = null; log.setScreen(null); if (takeScreenshot) { // screenshot PageContents screen = new PageContents(Gatherer.takeScreenshot(Grid.driver()), getBaseFileName()); screenshotPath = saver.saveScreenshot(screen); log.setScreen(screenshotPath); } // creating a string from all the info for the report to deserialize Reporter.log(log.toString()); } catch (Exception e) { logger.log(Level.SEVERE, "error in the logging feature of SeLion " + e.getMessage(), e); } logger.exiting(); }
[ "protected", "void", "generateLog", "(", "boolean", "takeScreenshot", ",", "boolean", "saveSrc", ")", "{", "logger", ".", "entering", "(", "new", "Object", "[", "]", "{", "takeScreenshot", ",", "saveSrc", "}", ")", ";", "try", "{", "BaseLog", "log", "=", ...
Generate a log message and send it to the TestNG {@link Reporter} @param takeScreenshot Take a screenshot <code>true/false</code>. Requires an active {@link Grid} session. @param saveSrc Save the current page source <code>true/false</code>. Requires an active {@link Grid} session.
[ "Generate", "a", "log", "message", "and", "send", "it", "to", "the", "TestNG", "{", "@link", "Reporter", "}" ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/reports/runtime/SeLionReporter.java#L122-L142
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/core/image/InterleavedImageOps.java
InterleavedImageOps.split2
public static void split2(InterleavedF32 interleaved , GrayF32 band0 , GrayF32 band1 ) { if( interleaved.numBands != 2 ) throw new IllegalArgumentException("Input interleaved image must have 2 bands"); InputSanityCheck.checkSameShape(band0, interleaved); InputSanityCheck.checkSameShape(band1, interleaved); for( int y = 0; y < interleaved.height; y++ ) { int indexTran = interleaved.startIndex + y*interleaved.stride; int indexReal = band0.startIndex + y*band0.stride; int indexImg = band1.startIndex + y*band1.stride; for( int x = 0; x < interleaved.width; x++, indexTran += 2 ) { band0.data[indexReal++] = interleaved.data[indexTran]; band1.data[indexImg++] = interleaved.data[indexTran+1]; } } }
java
public static void split2(InterleavedF32 interleaved , GrayF32 band0 , GrayF32 band1 ) { if( interleaved.numBands != 2 ) throw new IllegalArgumentException("Input interleaved image must have 2 bands"); InputSanityCheck.checkSameShape(band0, interleaved); InputSanityCheck.checkSameShape(band1, interleaved); for( int y = 0; y < interleaved.height; y++ ) { int indexTran = interleaved.startIndex + y*interleaved.stride; int indexReal = band0.startIndex + y*band0.stride; int indexImg = band1.startIndex + y*band1.stride; for( int x = 0; x < interleaved.width; x++, indexTran += 2 ) { band0.data[indexReal++] = interleaved.data[indexTran]; band1.data[indexImg++] = interleaved.data[indexTran+1]; } } }
[ "public", "static", "void", "split2", "(", "InterleavedF32", "interleaved", ",", "GrayF32", "band0", ",", "GrayF32", "band1", ")", "{", "if", "(", "interleaved", ".", "numBands", "!=", "2", ")", "throw", "new", "IllegalArgumentException", "(", "\"Input interleav...
Splits the 2-band interleaved into into two {@link ImageGray}. @param interleaved (Input) Interleaved image with 2 bands @param band0 (Output) band 0 @param band1 (Output) band 1
[ "Splits", "the", "2", "-", "band", "interleaved", "into", "into", "two", "{", "@link", "ImageGray", "}", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/image/InterleavedImageOps.java#L40-L58
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java
TurboProjectReader.readTask
private Task readTask(ChildTaskContainer parent, Integer id) { Table a0 = getTable("A0TAB"); Table a1 = getTable("A1TAB"); Table a2 = getTable("A2TAB"); Table a3 = getTable("A3TAB"); Table a4 = getTable("A4TAB"); Task task = parent.addTask(); MapRow a1Row = a1.find(id); MapRow a2Row = a2.find(id); setFields(A0TAB_FIELDS, a0.find(id), task); setFields(A1TAB_FIELDS, a1Row, task); setFields(A2TAB_FIELDS, a2Row, task); setFields(A3TAB_FIELDS, a3.find(id), task); setFields(A5TAB_FIELDS, a4.find(id), task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); if (task.getName() == null) { task.setName(task.getText(1)); } m_eventManager.fireTaskReadEvent(task); return task; }
java
private Task readTask(ChildTaskContainer parent, Integer id) { Table a0 = getTable("A0TAB"); Table a1 = getTable("A1TAB"); Table a2 = getTable("A2TAB"); Table a3 = getTable("A3TAB"); Table a4 = getTable("A4TAB"); Task task = parent.addTask(); MapRow a1Row = a1.find(id); MapRow a2Row = a2.find(id); setFields(A0TAB_FIELDS, a0.find(id), task); setFields(A1TAB_FIELDS, a1Row, task); setFields(A2TAB_FIELDS, a2Row, task); setFields(A3TAB_FIELDS, a3.find(id), task); setFields(A5TAB_FIELDS, a4.find(id), task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); if (task.getName() == null) { task.setName(task.getText(1)); } m_eventManager.fireTaskReadEvent(task); return task; }
[ "private", "Task", "readTask", "(", "ChildTaskContainer", "parent", ",", "Integer", "id", ")", "{", "Table", "a0", "=", "getTable", "(", "\"A0TAB\"", ")", ";", "Table", "a1", "=", "getTable", "(", "\"A1TAB\"", ")", ";", "Table", "a2", "=", "getTable", "(...
Read data for an individual task from the tables in a PEP file. @param parent parent task @param id task ID @return task instance
[ "Read", "data", "for", "an", "individual", "task", "from", "the", "tables", "in", "a", "PEP", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L370-L398
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GraphEditorWindow.java
GraphEditorWindow.main
public static void main(String[] argv) { JFrame frame = new JFrame("Whiskas Gradient Editor"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); main.setBackground(Color.CYAN); frame.getContentPane().add(main); // GraphEditorWindow bottom = new GraphEditorWindow(); ArrayList curve = new ArrayList(); curve.add(new Vector2f(0.0f, 0.0f)); curve.add(new Vector2f(1.0f, 255.0f)); LinearInterpolator test = new ConfigurableEmitter("bla").new LinearInterpolator( curve, 0, 255); bottom.registerValue(test, "Test"); curve = new ArrayList(); curve.add(new Vector2f(0.0f, 255.0f)); curve.add(new Vector2f(1.0f, 0.0f)); test = new ConfigurableEmitter("bla").new LinearInterpolator(curve, 0, 255); bottom.registerValue(test, "Test 2"); main.add(bottom); frame.pack(); frame.setVisible(true); frame.setSize(600, 300); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); }
java
public static void main(String[] argv) { JFrame frame = new JFrame("Whiskas Gradient Editor"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); main.setBackground(Color.CYAN); frame.getContentPane().add(main); // GraphEditorWindow bottom = new GraphEditorWindow(); ArrayList curve = new ArrayList(); curve.add(new Vector2f(0.0f, 0.0f)); curve.add(new Vector2f(1.0f, 255.0f)); LinearInterpolator test = new ConfigurableEmitter("bla").new LinearInterpolator( curve, 0, 255); bottom.registerValue(test, "Test"); curve = new ArrayList(); curve.add(new Vector2f(0.0f, 255.0f)); curve.add(new Vector2f(1.0f, 0.0f)); test = new ConfigurableEmitter("bla").new LinearInterpolator(curve, 0, 255); bottom.registerValue(test, "Test 2"); main.add(bottom); frame.pack(); frame.setVisible(true); frame.setSize(600, 300); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "argv", ")", "{", "JFrame", "frame", "=", "new", "JFrame", "(", "\"Whiskas Gradient Editor\"", ")", ";", "frame", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "EXIT_ON_CLOSE", ")", ";", "JP...
Simple test case for the gradient painter @param argv The arguments supplied at the command line
[ "Simple", "test", "case", "for", "the", "gradient", "painter" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GraphEditorWindow.java#L1094-L1132
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java
Metric.setDatapoints
public void setDatapoints(Map<Long, Double> datapoints) { _datapoints.clear(); if (datapoints != null) { _datapoints.putAll(datapoints); } }
java
public void setDatapoints(Map<Long, Double> datapoints) { _datapoints.clear(); if (datapoints != null) { _datapoints.putAll(datapoints); } }
[ "public", "void", "setDatapoints", "(", "Map", "<", "Long", ",", "Double", ">", "datapoints", ")", "{", "_datapoints", ".", "clear", "(", ")", ";", "if", "(", "datapoints", "!=", "null", ")", "{", "_datapoints", ".", "putAll", "(", "datapoints", ")", "...
Deletes the current set of data points and replaces them with a new set. @param datapoints The new set of data points. If null or empty, only the deletion of the current set of data points is performed.
[ "Deletes", "the", "current", "set", "of", "data", "points", "and", "replaces", "them", "with", "a", "new", "set", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L157-L162
Twitter4J/Twitter4J
twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java
TwitterObjectFactory.registerJSONObject
static <T> T registerJSONObject(T key, Object json) { registeredAtleastOnce = true; rawJsonMap.get().put(key, json); return key; }
java
static <T> T registerJSONObject(T key, Object json) { registeredAtleastOnce = true; rawJsonMap.get().put(key, json); return key; }
[ "static", "<", "T", ">", "T", "registerJSONObject", "(", "T", "key", ",", "Object", "json", ")", "{", "registeredAtleastOnce", "=", "true", ";", "rawJsonMap", ".", "get", "(", ")", ".", "put", "(", "key", ",", "json", ")", ";", "return", "key", ";", ...
associate a raw JSON form to the current thread<br> @since Twitter4J 2.1.7
[ "associate", "a", "raw", "JSON", "form", "to", "the", "current", "thread<br", ">" ]
train
https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L340-L344
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java
SchedulingSupport.calculateOffsetInMs
public static long calculateOffsetInMs(int intervalInMinutes, int offsetInMinutes) { while (offsetInMinutes < 0) { offsetInMinutes = intervalInMinutes + offsetInMinutes; } while (offsetInMinutes > intervalInMinutes) { offsetInMinutes -= intervalInMinutes; } return offsetInMinutes * MINUTE_IN_MS; }
java
public static long calculateOffsetInMs(int intervalInMinutes, int offsetInMinutes) { while (offsetInMinutes < 0) { offsetInMinutes = intervalInMinutes + offsetInMinutes; } while (offsetInMinutes > intervalInMinutes) { offsetInMinutes -= intervalInMinutes; } return offsetInMinutes * MINUTE_IN_MS; }
[ "public", "static", "long", "calculateOffsetInMs", "(", "int", "intervalInMinutes", ",", "int", "offsetInMinutes", ")", "{", "while", "(", "offsetInMinutes", "<", "0", ")", "{", "offsetInMinutes", "=", "intervalInMinutes", "+", "offsetInMinutes", ";", "}", "while"...
Reformulates negative offsets or offsets larger than interval. @param intervalInMinutes @param offsetInMinutes @return offset in milliseconds
[ "Reformulates", "negative", "offsets", "or", "offsets", "larger", "than", "interval", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java#L68-L76
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java
ConstructState.addConstructState
public void addConstructState(Constructs construct, ConstructState constructState) { addConstructState(construct, constructState, Optional.<String>absent()); }
java
public void addConstructState(Constructs construct, ConstructState constructState) { addConstructState(construct, constructState, Optional.<String>absent()); }
[ "public", "void", "addConstructState", "(", "Constructs", "construct", ",", "ConstructState", "constructState", ")", "{", "addConstructState", "(", "construct", ",", "constructState", ",", "Optional", ".", "<", "String", ">", "absent", "(", ")", ")", ";", "}" ]
See {@link #addConstructState(Constructs, ConstructState, Optional)}. This method uses no infix.
[ "See", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java#L82-L84
andriusvelykis/reflow-maven-skin
reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java
HtmlTool.generateUniqueId
private static String generateUniqueId(Set<String> ids, String idBase) { String id = idBase; int counter = 1; while (ids.contains(id)) { id = idBase + String.valueOf(counter++); } // put the newly generated one into the set ids.add(id); return id; }
java
private static String generateUniqueId(Set<String> ids, String idBase) { String id = idBase; int counter = 1; while (ids.contains(id)) { id = idBase + String.valueOf(counter++); } // put the newly generated one into the set ids.add(id); return id; }
[ "private", "static", "String", "generateUniqueId", "(", "Set", "<", "String", ">", "ids", ",", "String", "idBase", ")", "{", "String", "id", "=", "idBase", ";", "int", "counter", "=", "1", ";", "while", "(", "ids", ".", "contains", "(", "id", ")", ")...
Generated a unique ID within the given set of IDs. Appends an incrementing number for duplicates. @param ids @param idBase @return
[ "Generated", "a", "unique", "ID", "within", "the", "given", "set", "of", "IDs", ".", "Appends", "an", "incrementing", "number", "for", "duplicates", "." ]
train
https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L1065-L1075
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc_fat_postgresql/fat/src/com/ibm/ws/jdbc/fat/postgresql/CustomPostgreSQLContainer.java
CustomPostgreSQLContainer.withConfigOption
public SELF withConfigOption(String key, String value) { if (key == null) { throw new java.lang.NullPointerException("key marked @NonNull but is null"); } if (value == null) { throw new java.lang.NullPointerException("value marked @NonNull but is null"); } options.put(key, value); return self(); }
java
public SELF withConfigOption(String key, String value) { if (key == null) { throw new java.lang.NullPointerException("key marked @NonNull but is null"); } if (value == null) { throw new java.lang.NullPointerException("value marked @NonNull but is null"); } options.put(key, value); return self(); }
[ "public", "SELF", "withConfigOption", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "java", ".", "lang", ".", "NullPointerException", "(", "\"key marked @NonNull but is null\"", ")", ";", "}...
Add additional configuration options that should be used for this container. @param key The PostgreSQL configuration option key. For example: "max_connections" @param value The PostgreSQL configuration option value. For example: "200" @return this
[ "Add", "additional", "configuration", "options", "that", "should", "be", "used", "for", "this", "container", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc_fat_postgresql/fat/src/com/ibm/ws/jdbc/fat/postgresql/CustomPostgreSQLContainer.java#L26-L35
LearnLib/automatalib
util/src/main/java/net/automatalib/util/graphs/scc/SCCs.java
SCCs.findSCCs
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> listener) { TarjanSCCVisitor<N, E> vis = new TarjanSCCVisitor<>(graph, listener); for (N node : graph) { if (!vis.hasVisited(node)) { GraphTraversal.depthFirst(graph, node, vis); } } }
java
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> listener) { TarjanSCCVisitor<N, E> vis = new TarjanSCCVisitor<>(graph, listener); for (N node : graph) { if (!vis.hasVisited(node)) { GraphTraversal.depthFirst(graph, node, vis); } } }
[ "public", "static", "<", "N", ",", "E", ">", "void", "findSCCs", "(", "Graph", "<", "N", ",", "E", ">", "graph", ",", "SCCListener", "<", "N", ">", "listener", ")", "{", "TarjanSCCVisitor", "<", "N", ",", "E", ">", "vis", "=", "new", "TarjanSCCVisi...
Find all strongly-connected components in a graph. When a new SCC is found, the {@link SCCListener#foundSCC(java.util.Collection)} method is invoked. The listener object may hence not be null. <p> Tarjan's algorithm is used for realizing the SCC search. @param graph the graph @param listener the SCC listener @see TarjanSCCVisitor
[ "Find", "all", "strongly", "-", "connected", "components", "in", "a", "graph", ".", "When", "a", "new", "SCC", "is", "found", "the", "{", "@link", "SCCListener#foundSCC", "(", "java", ".", "util", ".", "Collection", ")", "}", "method", "is", "invoked", "...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/graphs/scc/SCCs.java#L69-L76
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/operators/OperatorForEachFuture.java
OperatorForEachFuture.forEachFuture
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext, Action1<? super Throwable> onError) { return forEachFuture(source, onNext, onError, Functionals.empty()); }
java
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext, Action1<? super Throwable> onError) { return forEachFuture(source, onNext, onError, Functionals.empty()); }
[ "public", "static", "<", "T", ">", "FutureTask", "<", "Void", ">", "forEachFuture", "(", "Observable", "<", "?", "extends", "T", ">", "source", ",", "Action1", "<", "?", "super", "T", ">", "onNext", ",", "Action1", "<", "?", "super", "Throwable", ">", ...
Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future. @param <T> the element type of the Observable @param source the source Observable @param onNext the action to call with each emitted element @param onError the action to call when an exception is emitted @return the Future representing the entire for-each operation
[ "Subscribes", "to", "the", "given", "source", "and", "calls", "the", "callback", "for", "each", "emitted", "item", "and", "surfaces", "the", "completion", "or", "error", "through", "a", "Future", "." ]
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/OperatorForEachFuture.java#L59-L64
loldevs/riotapi
spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java
MappedDataCache.await
public void await(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { if (!acquireLock(k).await(timeout, unit)) { throw new TimeoutException("Wait time for retrieving value for key " + k + " exceeded " + timeout + " " + unit); } }
java
public void await(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { if (!acquireLock(k).await(timeout, unit)) { throw new TimeoutException("Wait time for retrieving value for key " + k + " exceeded " + timeout + " " + unit); } }
[ "public", "void", "await", "(", "K", "k", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "if", "(", "!", "acquireLock", "(", "k", ")", ".", "await", "(", "timeout", ",", "unit", ")", ...
Waits until the key has been assigned a value, up to the specified maximum. @param k THe key to wait for. @param timeout The maximum time to wait. @param unit The time unit of the timeout. @throws InterruptedException @throws TimeoutException
[ "Waits", "until", "the", "key", "has", "been", "assigned", "a", "value", "up", "to", "the", "specified", "maximum", "." ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java#L104-L108
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/TransactionManager.java
TransactionManager.rollbackPartial
void rollbackPartial(Session session, int start, long timestamp) { Object[] list = session.rowActionList.getArray(); int limit = session.rowActionList.size(); if (start == limit) { return; } for (int i = start; i < limit; i++) { RowAction action = (RowAction) list[i]; if (action != null) { action.rollback(session, timestamp); } else { System.out.println("null action in rollback " + start); } } // rolled back transactions can always be merged as they have never been // seen by other sessions mergeRolledBackTransaction(session.rowActionList.getArray(), start, limit); rowActionMapRemoveTransaction(session.rowActionList.getArray(), start, limit, false); session.rowActionList.setSize(start); }
java
void rollbackPartial(Session session, int start, long timestamp) { Object[] list = session.rowActionList.getArray(); int limit = session.rowActionList.size(); if (start == limit) { return; } for (int i = start; i < limit; i++) { RowAction action = (RowAction) list[i]; if (action != null) { action.rollback(session, timestamp); } else { System.out.println("null action in rollback " + start); } } // rolled back transactions can always be merged as they have never been // seen by other sessions mergeRolledBackTransaction(session.rowActionList.getArray(), start, limit); rowActionMapRemoveTransaction(session.rowActionList.getArray(), start, limit, false); session.rowActionList.setSize(start); }
[ "void", "rollbackPartial", "(", "Session", "session", ",", "int", "start", ",", "long", "timestamp", ")", "{", "Object", "[", "]", "list", "=", "session", ".", "rowActionList", ".", "getArray", "(", ")", ";", "int", "limit", "=", "session", ".", "rowActi...
rollback the row actions from start index in list and the given timestamp
[ "rollback", "the", "row", "actions", "from", "start", "index", "in", "list", "and", "the", "given", "timestamp" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TransactionManager.java#L436-L462
fabric8io/mockwebserver
src/main/java/io/fabric8/mockwebserver/crud/CrudDispatcher.java
CrudDispatcher.handleCreate
public MockResponse handleCreate(String path, String s) { MockResponse response = new MockResponse(); AttributeSet features = AttributeSet.merge(attributeExtractor.fromPath(path), attributeExtractor.fromResource(s)); map.put(features, s); response.setBody(s); response.setResponseCode(202); return response; }
java
public MockResponse handleCreate(String path, String s) { MockResponse response = new MockResponse(); AttributeSet features = AttributeSet.merge(attributeExtractor.fromPath(path), attributeExtractor.fromResource(s)); map.put(features, s); response.setBody(s); response.setResponseCode(202); return response; }
[ "public", "MockResponse", "handleCreate", "(", "String", "path", ",", "String", "s", ")", "{", "MockResponse", "response", "=", "new", "MockResponse", "(", ")", ";", "AttributeSet", "features", "=", "AttributeSet", ".", "merge", "(", "attributeExtractor", ".", ...
Adds the specified object to the in-memory db. @param path @param s @return
[ "Adds", "the", "specified", "object", "to", "the", "in", "-", "memory", "db", "." ]
train
https://github.com/fabric8io/mockwebserver/blob/ca14c6dd2ec8e2425585a548d5c0d993332b9d2f/src/main/java/io/fabric8/mockwebserver/crud/CrudDispatcher.java#L62-L69
Kurento/kurento-module-creator
src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java
ExpressionParser.versionOf
private Version versionOf(int major, int minor, int patch) { return Version.forIntegers(major, minor, patch); }
java
private Version versionOf(int major, int minor, int patch) { return Version.forIntegers(major, minor, patch); }
[ "private", "Version", "versionOf", "(", "int", "major", ",", "int", "minor", ",", "int", "patch", ")", "{", "return", "Version", ".", "forIntegers", "(", "major", ",", "minor", ",", "patch", ")", ";", "}" ]
Creates a {@code Version} instance for the specified integers. @param major the major version number @param minor the minor version number @param patch the patch version number @return the version for the specified integers
[ "Creates", "a", "{", "@code", "Version", "}", "instance", "for", "the", "specified", "integers", "." ]
train
https://github.com/Kurento/kurento-module-creator/blob/c371516c665b902b5476433496a5aefcbca86d64/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L397-L399
Azure/autorest-clientruntime-for-java
azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java
Utils.removeFromList
public static void removeFromList(List<String> list, String value) { int foundIndex = -1; int i = 0; for (String id : list) { if (id.equalsIgnoreCase(value)) { foundIndex = i; break; } i++; } if (foundIndex != -1) { list.remove(foundIndex); } }
java
public static void removeFromList(List<String> list, String value) { int foundIndex = -1; int i = 0; for (String id : list) { if (id.equalsIgnoreCase(value)) { foundIndex = i; break; } i++; } if (foundIndex != -1) { list.remove(foundIndex); } }
[ "public", "static", "void", "removeFromList", "(", "List", "<", "String", ">", "list", ",", "String", "value", ")", "{", "int", "foundIndex", "=", "-", "1", ";", "int", "i", "=", "0", ";", "for", "(", "String", "id", ":", "list", ")", "{", "if", ...
Removes a value from the list. @param list the list @param value value to remove
[ "Removes", "a", "value", "from", "the", "list", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L192-L205
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java
LocaleData.getExemplarSet
public static UnicodeSet getExemplarSet(ULocale locale, int options) { return LocaleData.getInstance(locale).getExemplarSet(options, ES_STANDARD); }
java
public static UnicodeSet getExemplarSet(ULocale locale, int options) { return LocaleData.getInstance(locale).getExemplarSet(options, ES_STANDARD); }
[ "public", "static", "UnicodeSet", "getExemplarSet", "(", "ULocale", "locale", ",", "int", "options", ")", "{", "return", "LocaleData", ".", "getInstance", "(", "locale", ")", ".", "getExemplarSet", "(", "options", ",", "ES_STANDARD", ")", ";", "}" ]
Returns the set of exemplar characters for a locale. Equivalent to calling {@link #getExemplarSet(ULocale, int, int)} with the extype == {@link #ES_STANDARD}. @param locale Locale for which the exemplar character set is to be retrieved. @param options Bitmask for options to apply to the exemplar pattern. Specify zero to retrieve the exemplar set as it is defined in the locale data. Specify UnicodeSet.CASE to retrieve a case-folded exemplar set. See {@link UnicodeSet#applyPattern(String, int)} for a complete list of valid options. The IGNORE_SPACE bit is always set, regardless of the value of 'options'. @return The set of exemplar characters for the given locale.
[ "Returns", "the", "set", "of", "exemplar", "characters", "for", "a", "locale", ".", "Equivalent", "to", "calling", "{", "@link", "#getExemplarSet", "(", "ULocale", "int", "int", ")", "}", "with", "the", "extype", "==", "{", "@link", "#ES_STANDARD", "}", "....
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L134-L136
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.applyPattern
@Deprecated public UnicodeSet applyPattern(String pattern, ParsePosition pos, SymbolTable symbols, int options) { // Need to build the pattern in a temporary string because // _applyPattern calls add() etc., which set pat to empty. boolean parsePositionWasNull = pos == null; if (parsePositionWasNull) { pos = new ParsePosition(0); } StringBuilder rebuiltPat = new StringBuilder(); RuleCharacterIterator chars = new RuleCharacterIterator(pattern, symbols, pos); applyPattern(chars, symbols, rebuiltPat, options); if (chars.inVariable()) { syntaxError(chars, "Extra chars in variable value"); } pat = rebuiltPat.toString(); if (parsePositionWasNull) { int i = pos.getIndex(); // Skip over trailing whitespace if ((options & IGNORE_SPACE) != 0) { i = PatternProps.skipWhiteSpace(pattern, i); } if (i != pattern.length()) { throw new IllegalArgumentException("Parse of \"" + pattern + "\" failed at " + i); } } return this; }
java
@Deprecated public UnicodeSet applyPattern(String pattern, ParsePosition pos, SymbolTable symbols, int options) { // Need to build the pattern in a temporary string because // _applyPattern calls add() etc., which set pat to empty. boolean parsePositionWasNull = pos == null; if (parsePositionWasNull) { pos = new ParsePosition(0); } StringBuilder rebuiltPat = new StringBuilder(); RuleCharacterIterator chars = new RuleCharacterIterator(pattern, symbols, pos); applyPattern(chars, symbols, rebuiltPat, options); if (chars.inVariable()) { syntaxError(chars, "Extra chars in variable value"); } pat = rebuiltPat.toString(); if (parsePositionWasNull) { int i = pos.getIndex(); // Skip over trailing whitespace if ((options & IGNORE_SPACE) != 0) { i = PatternProps.skipWhiteSpace(pattern, i); } if (i != pattern.length()) { throw new IllegalArgumentException("Parse of \"" + pattern + "\" failed at " + i); } } return this; }
[ "@", "Deprecated", "public", "UnicodeSet", "applyPattern", "(", "String", "pattern", ",", "ParsePosition", "pos", ",", "SymbolTable", "symbols", ",", "int", "options", ")", "{", "// Need to build the pattern in a temporary string because", "// _applyPattern calls add() etc., ...
Parses the given pattern, starting at the given position. The character at pattern.charAt(pos.getIndex()) must be '[', or the parse fails. Parsing continues until the corresponding closing ']'. If a syntax error is encountered between the opening and closing brace, the parse fails. Upon return from a successful parse, the ParsePosition is updated to point to the character following the closing ']', and an inversion list for the parsed pattern is returned. This method calls itself recursively to parse embedded subpatterns. @param pattern the string containing the pattern to be parsed. The portion of the string from pos.getIndex(), which must be a '[', to the corresponding closing ']', is parsed. @param pos upon entry, the position at which to being parsing. The character at pattern.charAt(pos.getIndex()) must be a '['. Upon return from a successful parse, pos.getIndex() is either the character after the closing ']' of the parsed pattern, or pattern.length() if the closing ']' is the last character of the pattern string. @return an inversion list for the parsed substring of <code>pattern</code> @exception java.lang.IllegalArgumentException if the parse fails. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Parses", "the", "given", "pattern", "starting", "at", "the", "given", "position", ".", "The", "character", "at", "pattern", ".", "charAt", "(", "pos", ".", "getIndex", "()", ")", "must", "be", "[", "or", "the", "parse", "fails", ".", "Parsing", "continu...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L2339-L2374
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addSuccessJobStarted
public FessMessages addSuccessJobStarted(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_started, arg0)); return this; }
java
public FessMessages addSuccessJobStarted(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_started, arg0)); return this; }
[ "public", "FessMessages", "addSuccessJobStarted", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "SUCCESS_job_started", ",", "arg0", ")", ")"...
Add the created action message for the key 'success.job_started' with parameters. <pre> message: Started job {0}. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "success", ".", "job_started", "with", "parameters", ".", "<pre", ">", "message", ":", "Started", "job", "{", "0", "}", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2405-L2409
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.listCertificateVersions
public PagedList<CertificateItem> listCertificateVersions(final String vaultBaseUrl, final String certificateName, final Integer maxresults) { return getCertificateVersions(vaultBaseUrl, certificateName, maxresults); }
java
public PagedList<CertificateItem> listCertificateVersions(final String vaultBaseUrl, final String certificateName, final Integer maxresults) { return getCertificateVersions(vaultBaseUrl, certificateName, maxresults); }
[ "public", "PagedList", "<", "CertificateItem", ">", "listCertificateVersions", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "certificateName", ",", "final", "Integer", "maxresults", ")", "{", "return", "getCertificateVersions", "(", "vaultBaseUrl", ...
List the versions of a certificate. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param certificateName The name of the certificate @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @return the PagedList&lt;CertificateItem&gt; if successful.
[ "List", "the", "versions", "of", "a", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1578-L1581
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
SqlValidatorImpl.validateOrderList
protected void validateOrderList(SqlSelect select) { // ORDER BY is validated in a scope where aliases in the SELECT clause // are visible. For example, "SELECT empno AS x FROM emp ORDER BY x" // is valid. SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Objects.requireNonNull(orderScope); List<SqlNode> expandList = new ArrayList<>(); for (SqlNode orderItem : orderList) { SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem); } SqlNodeList expandedOrderList = new SqlNodeList( expandList, orderList.getParserPosition()); select.setOrderBy(expandedOrderList); for (SqlNode orderItem : expandedOrderList) { validateOrderItem(select, orderItem); } }
java
protected void validateOrderList(SqlSelect select) { // ORDER BY is validated in a scope where aliases in the SELECT clause // are visible. For example, "SELECT empno AS x FROM emp ORDER BY x" // is valid. SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Objects.requireNonNull(orderScope); List<SqlNode> expandList = new ArrayList<>(); for (SqlNode orderItem : orderList) { SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem); } SqlNodeList expandedOrderList = new SqlNodeList( expandList, orderList.getParserPosition()); select.setOrderBy(expandedOrderList); for (SqlNode orderItem : expandedOrderList) { validateOrderItem(select, orderItem); } }
[ "protected", "void", "validateOrderList", "(", "SqlSelect", "select", ")", "{", "// ORDER BY is validated in a scope where aliases in the SELECT clause", "// are visible. For example, \"SELECT empno AS x FROM emp ORDER BY x\"", "// is valid.", "SqlNodeList", "orderList", "=", "select", ...
Validates the ORDER BY clause of a SELECT statement. @param select Select statement
[ "Validates", "the", "ORDER", "BY", "clause", "of", "a", "SELECT", "statement", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3812-L3842
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatter.java
PeriodFormatter.printTo
public void printTo(StringBuffer buf, ReadablePeriod period) { checkPrinter(); checkPeriod(period); getPrinter().printTo(buf, period, iLocale); }
java
public void printTo(StringBuffer buf, ReadablePeriod period) { checkPrinter(); checkPeriod(period); getPrinter().printTo(buf, period, iLocale); }
[ "public", "void", "printTo", "(", "StringBuffer", "buf", ",", "ReadablePeriod", "period", ")", "{", "checkPrinter", "(", ")", ";", "checkPeriod", "(", "period", ")", ";", "getPrinter", "(", ")", ".", "printTo", "(", "buf", ",", "period", ",", "iLocale", ...
Prints a ReadablePeriod to a StringBuffer. @param buf the formatted period is appended to this buffer @param period the period to format, not null
[ "Prints", "a", "ReadablePeriod", "to", "a", "StringBuffer", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatter.java#L213-L218
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.ofMinor
public static Money ofMinor(CurrencyUnit currency, long amountMinor) { return new Money(BigMoney.ofMinor(currency, amountMinor)); }
java
public static Money ofMinor(CurrencyUnit currency, long amountMinor) { return new Money(BigMoney.ofMinor(currency, amountMinor)); }
[ "public", "static", "Money", "ofMinor", "(", "CurrencyUnit", "currency", ",", "long", "amountMinor", ")", "{", "return", "new", "Money", "(", "BigMoney", ".", "ofMinor", "(", "currency", ",", "amountMinor", ")", ")", ";", "}" ]
Obtains an instance of {@code Money} from an amount in minor units. <p> This allows you to create an instance with a specific currency and amount expressed in terms of the minor unit. For example, if constructing US Dollars, the input to this method represents cents. Note that when a currency has zero decimal places, the major and minor units are the same. For example, {@code ofMinor(USD, 2595)} creates the instance {@code USD 25.95}. @param currency the currency, not null @param amountMinor the amount of money in the minor division of the currency @return the new instance, never null
[ "Obtains", "an", "instance", "of", "{", "@code", "Money", "}", "from", "an", "amount", "in", "minor", "units", ".", "<p", ">", "This", "allows", "you", "to", "create", "an", "instance", "with", "a", "specific", "currency", "and", "amount", "expressed", "...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L179-L181
Harium/keel
src/main/java/com/harium/keel/effect/normal/SobelNormalMap.java
SobelNormalMap.apply
@Override public ImageSource apply(ImageSource input) { int w = input.getWidth(); int h = input.getHeight(); MatrixSource output = new MatrixSource(input); Vector3 n = new Vector3(0, 0, 1); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (x < border || x == w - border || y < border || y == h - border) { output.setRGB(x, y, VectorHelper.Z_NORMAL); continue; } float s0 = input.getR(x - 1, y + 1); float s1 = input.getR(x, y + 1); float s2 = input.getR(x + 1, y + 1); float s3 = input.getR(x - 1, y); float s5 = input.getR(x + 1, y); float s6 = input.getR(x - 1, y - 1); float s7 = input.getR(x, y - 1); float s8 = input.getR(x + 1, y - 1); float nx = -(s2 - s0 + 2 * (s5 - s3) + s8 - s6); float ny = -(s6 - s0 + 2 * (s7 - s1) + s8 - s2); n.set(nx, ny, scale); n.nor(); int rgb = VectorHelper.vectorToColor(n); output.setRGB(x, y, rgb); } } return new MatrixSource(output); }
java
@Override public ImageSource apply(ImageSource input) { int w = input.getWidth(); int h = input.getHeight(); MatrixSource output = new MatrixSource(input); Vector3 n = new Vector3(0, 0, 1); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (x < border || x == w - border || y < border || y == h - border) { output.setRGB(x, y, VectorHelper.Z_NORMAL); continue; } float s0 = input.getR(x - 1, y + 1); float s1 = input.getR(x, y + 1); float s2 = input.getR(x + 1, y + 1); float s3 = input.getR(x - 1, y); float s5 = input.getR(x + 1, y); float s6 = input.getR(x - 1, y - 1); float s7 = input.getR(x, y - 1); float s8 = input.getR(x + 1, y - 1); float nx = -(s2 - s0 + 2 * (s5 - s3) + s8 - s6); float ny = -(s6 - s0 + 2 * (s7 - s1) + s8 - s2); n.set(nx, ny, scale); n.nor(); int rgb = VectorHelper.vectorToColor(n); output.setRGB(x, y, rgb); } } return new MatrixSource(output); }
[ "@", "Override", "public", "ImageSource", "apply", "(", "ImageSource", "input", ")", "{", "int", "w", "=", "input", ".", "getWidth", "(", ")", ";", "int", "h", "=", "input", ".", "getHeight", "(", ")", ";", "MatrixSource", "output", "=", "new", "Matrix...
Sobel method to generate bump map from a height map @param input - A height map @return bump map
[ "Sobel", "method", "to", "generate", "bump", "map", "from", "a", "height", "map" ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/normal/SobelNormalMap.java#L19-L57
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java
ExternalTrxMessage.moveHeaderParams
public void moveHeaderParams(Map<String,Object> mapMessage, Map<String,Object> mapHeader) { for (int i = 0; i < m_rgstrHeaderParams.length; i++) { if (mapMessage.get(m_rgstrHeaderParams[i]) != null) if (mapHeader.get(m_rgstrHeaderParams[i]) == null) { Object objValue = mapMessage.get(m_rgstrHeaderParams[i]); mapMessage.remove(m_rgstrHeaderParams[i]); mapHeader.put(m_rgstrHeaderParams[i], objValue); } } }
java
public void moveHeaderParams(Map<String,Object> mapMessage, Map<String,Object> mapHeader) { for (int i = 0; i < m_rgstrHeaderParams.length; i++) { if (mapMessage.get(m_rgstrHeaderParams[i]) != null) if (mapHeader.get(m_rgstrHeaderParams[i]) == null) { Object objValue = mapMessage.get(m_rgstrHeaderParams[i]); mapMessage.remove(m_rgstrHeaderParams[i]); mapHeader.put(m_rgstrHeaderParams[i], objValue); } } }
[ "public", "void", "moveHeaderParams", "(", "Map", "<", "String", ",", "Object", ">", "mapMessage", ",", "Map", "<", "String", ",", "Object", ">", "mapHeader", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_rgstrHeaderParams", ".", "lengt...
Move the header params from the message map to the header map.
[ "Move", "the", "header", "params", "from", "the", "message", "map", "to", "the", "header", "map", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java#L225-L237
virgo47/javasimon
core/src/main/java/org/javasimon/source/CachedMonitorSource.java
CachedMonitorSource.getMonitorInformation
private MonitorInformation getMonitorInformation(L location) { final K monitorKey = getLocationKey(location); MonitorInformation monitorInformation = monitorInformations.get(monitorKey); if (monitorInformation == null) { // Not found, let's call delegate if (delegate.isMonitored(location)) { monitorInformation = new MonitorInformation(true, delegate.getMonitor(location)); } else { monitorInformation = NULL_MONITOR_INFORMATION; } monitorInformations.put(monitorKey, monitorInformation); } return monitorInformation; }
java
private MonitorInformation getMonitorInformation(L location) { final K monitorKey = getLocationKey(location); MonitorInformation monitorInformation = monitorInformations.get(monitorKey); if (monitorInformation == null) { // Not found, let's call delegate if (delegate.isMonitored(location)) { monitorInformation = new MonitorInformation(true, delegate.getMonitor(location)); } else { monitorInformation = NULL_MONITOR_INFORMATION; } monitorInformations.put(monitorKey, monitorInformation); } return monitorInformation; }
[ "private", "MonitorInformation", "getMonitorInformation", "(", "L", "location", ")", "{", "final", "K", "monitorKey", "=", "getLocationKey", "(", "location", ")", ";", "MonitorInformation", "monitorInformation", "=", "monitorInformations", ".", "get", "(", "monitorKey...
Get monitor information for given location. First monitor information is looked up in cache. Then, when not found, delegate is called. @param location Location @return Monitor information
[ "Get", "monitor", "information", "for", "given", "location", ".", "First", "monitor", "information", "is", "looked", "up", "in", "cache", ".", "Then", "when", "not", "found", "delegate", "is", "called", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/source/CachedMonitorSource.java#L79-L92
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.writeAscii
public static ByteBuf writeAscii(ByteBufAllocator alloc, CharSequence seq) { // ASCII uses 1 byte per char ByteBuf buf = alloc.buffer(seq.length()); writeAscii(buf, seq); return buf; }
java
public static ByteBuf writeAscii(ByteBufAllocator alloc, CharSequence seq) { // ASCII uses 1 byte per char ByteBuf buf = alloc.buffer(seq.length()); writeAscii(buf, seq); return buf; }
[ "public", "static", "ByteBuf", "writeAscii", "(", "ByteBufAllocator", "alloc", ",", "CharSequence", "seq", ")", "{", "// ASCII uses 1 byte per char", "ByteBuf", "buf", "=", "alloc", ".", "buffer", "(", "seq", ".", "length", "(", ")", ")", ";", "writeAscii", "(...
Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> and write it to a {@link ByteBuf} allocated with {@code alloc}. @param alloc The allocator used to allocate a new {@link ByteBuf}. @param seq The characters to write into a buffer. @return The {@link ByteBuf} which contains the <a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> encoded result.
[ "Encode", "a", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L668-L673
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.updateConnectAddr
public InetSocketAddress updateConnectAddr( String hostProperty, String addressProperty, String defaultAddressValue, InetSocketAddress addr) { final String host = get(hostProperty); final String connectHostPort = getTrimmed(addressProperty, defaultAddressValue); if (host == null || host.isEmpty() || connectHostPort == null || connectHostPort.isEmpty()) { //not our case, fall back to original logic return updateConnectAddr(addressProperty, addr); } final String connectHost = connectHostPort.split(":")[0]; // Create connect address using client address hostname and server port. return updateConnectAddr(addressProperty, NetUtils.createSocketAddrForHost( connectHost, addr.getPort())); }
java
public InetSocketAddress updateConnectAddr( String hostProperty, String addressProperty, String defaultAddressValue, InetSocketAddress addr) { final String host = get(hostProperty); final String connectHostPort = getTrimmed(addressProperty, defaultAddressValue); if (host == null || host.isEmpty() || connectHostPort == null || connectHostPort.isEmpty()) { //not our case, fall back to original logic return updateConnectAddr(addressProperty, addr); } final String connectHost = connectHostPort.split(":")[0]; // Create connect address using client address hostname and server port. return updateConnectAddr(addressProperty, NetUtils.createSocketAddrForHost( connectHost, addr.getPort())); }
[ "public", "InetSocketAddress", "updateConnectAddr", "(", "String", "hostProperty", ",", "String", "addressProperty", ",", "String", "defaultAddressValue", ",", "InetSocketAddress", "addr", ")", "{", "final", "String", "host", "=", "get", "(", "hostProperty", ")", ";...
Set the socket address a client can use to connect for the <code>name</code> property as a <code>host:port</code>. The wildcard address is replaced with the local host's address. If the host and address properties are configured the host component of the address will be combined with the port component of the addr to generate the address. This is to allow optional control over which host name is used in multi-home bind-host cases where a host can have multiple names @param hostProperty the bind-host configuration name @param addressProperty the service address configuration name @param defaultAddressValue the service default address configuration value @param addr InetSocketAddress of the service listener @return InetSocketAddress for clients to connect
[ "Set", "the", "socket", "address", "a", "client", "can", "use", "to", "connect", "for", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "<code", ">", "host", ":", "port<", "/", "code", ">", ".", "The", "wildcard", "address", "i...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2330-L2348
bmwcarit/joynr
java/core/libjoynr/src/main/java/io/joynr/runtime/JoynrRuntimeImpl.java
JoynrRuntimeImpl.registerProvider
@Override public Future<Void> registerProvider(String domain, Object provider, ProviderQos providerQos) { final boolean awaitGlobalRegistration = false; return registerProvider(domain, provider, providerQos, awaitGlobalRegistration); }
java
@Override public Future<Void> registerProvider(String domain, Object provider, ProviderQos providerQos) { final boolean awaitGlobalRegistration = false; return registerProvider(domain, provider, providerQos, awaitGlobalRegistration); }
[ "@", "Override", "public", "Future", "<", "Void", ">", "registerProvider", "(", "String", "domain", ",", "Object", "provider", ",", "ProviderQos", "providerQos", ")", "{", "final", "boolean", "awaitGlobalRegistration", "=", "false", ";", "return", "registerProvide...
Registers a provider in the joynr framework @param domain The domain the provider should be registered for. Has to be identical at the client to be able to find the provider. @param provider Instance of the provider implementation (has to extend a generated ...AbstractProvider). @param providerQos the provider's quality of service settings @return Returns a Future which can be used to check the registration status.
[ "Registers", "a", "provider", "in", "the", "joynr", "framework" ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/runtime/JoynrRuntimeImpl.java#L160-L164
uoa-group-applications/morc
src/main/java/nz/ac/auckland/morc/MorcBuilder.java
MorcBuilder.processorMultiplier
public Builder processorMultiplier(int count, Processor... processors) { for (int i = 0; i < count; i++) { addProcessors(processors); } return self(); }
java
public Builder processorMultiplier(int count, Processor... processors) { for (int i = 0; i < count; i++) { addProcessors(processors); } return self(); }
[ "public", "Builder", "processorMultiplier", "(", "int", "count", ",", "Processor", "...", "processors", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "addProcessors", "(", "processors", ")", ";", "}", "...
Replay the same processor for the specified number of times (requests or inputs) @param count The number of times to repeat these processors (separate requests) @param processors A collection of processors that will be applied to an exchange before it is sent
[ "Replay", "the", "same", "processor", "for", "the", "specified", "number", "of", "times", "(", "requests", "or", "inputs", ")" ]
train
https://github.com/uoa-group-applications/morc/blob/3add6308b1fbfc98187364ac73007c83012ea8ba/src/main/java/nz/ac/auckland/morc/MorcBuilder.java#L94-L99
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/WhiskasPanel.java
WhiskasPanel.addEnableControl
private void addEnableControl(String text, ItemListener listener) { JCheckBox enableControl = new JCheckBox("Enable " + text); enableControl.setBounds(10, offset, 200, 20); enableControl.addItemListener(listener); add(enableControl); controlToValueName.put(enableControl, text); valueNameToControl.put(text, enableControl); offset += 25; }
java
private void addEnableControl(String text, ItemListener listener) { JCheckBox enableControl = new JCheckBox("Enable " + text); enableControl.setBounds(10, offset, 200, 20); enableControl.addItemListener(listener); add(enableControl); controlToValueName.put(enableControl, text); valueNameToControl.put(text, enableControl); offset += 25; }
[ "private", "void", "addEnableControl", "(", "String", "text", ",", "ItemListener", "listener", ")", "{", "JCheckBox", "enableControl", "=", "new", "JCheckBox", "(", "\"Enable \"", "+", "text", ")", ";", "enableControl", ".", "setBounds", "(", "10", ",", "offse...
Add a control for enablement @param text The label to be associated with the check box @param listener The listener to be notified of updates to the new control
[ "Add", "a", "control", "for", "enablement" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/WhiskasPanel.java#L79-L88
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java
ReidSolomonCodes.findErrorLocatorPolynomialBM
void findErrorLocatorPolynomialBM(GrowQueue_I8 syndromes , GrowQueue_I8 errorLocator ) { GrowQueue_I8 C = errorLocator; // error polynomial GrowQueue_I8 B = new GrowQueue_I8(); // previous error polynomial // TODO remove new from this function initToOne(C,syndromes.size+1); initToOne(B,syndromes.size+1); GrowQueue_I8 tmp = new GrowQueue_I8(syndromes.size); // int L = 0; // int m = 1; // stores how much B is 'shifted' by int b = 1; for (int n = 0; n < syndromes.size; n++) { // Compute discrepancy delta int delta = syndromes.data[n]&0xFF; for (int j = 1; j < C.size; j++) { delta ^= math.multiply(C.data[C.size-j-1]&0xFF, syndromes.data[n-j]&0xFF); } // B = D^m * B B.data[B.size++] = 0; // Step 3 is implicitly handled // m = m + 1 if( delta != 0 ) { int scale = math.multiply(delta, math.inverse(b)); math.polyAddScaleB(C, B, scale, tmp); if (B.size <= C.size) { // if 2*L > N ---- Step 4 // m += 1; } else { // if 2*L <= N --- Step 5 B.setTo(C); // L = n+1-L; b = delta; // m = 1; } C.setTo(tmp); } } removeLeadingZeros(C); }
java
void findErrorLocatorPolynomialBM(GrowQueue_I8 syndromes , GrowQueue_I8 errorLocator ) { GrowQueue_I8 C = errorLocator; // error polynomial GrowQueue_I8 B = new GrowQueue_I8(); // previous error polynomial // TODO remove new from this function initToOne(C,syndromes.size+1); initToOne(B,syndromes.size+1); GrowQueue_I8 tmp = new GrowQueue_I8(syndromes.size); // int L = 0; // int m = 1; // stores how much B is 'shifted' by int b = 1; for (int n = 0; n < syndromes.size; n++) { // Compute discrepancy delta int delta = syndromes.data[n]&0xFF; for (int j = 1; j < C.size; j++) { delta ^= math.multiply(C.data[C.size-j-1]&0xFF, syndromes.data[n-j]&0xFF); } // B = D^m * B B.data[B.size++] = 0; // Step 3 is implicitly handled // m = m + 1 if( delta != 0 ) { int scale = math.multiply(delta, math.inverse(b)); math.polyAddScaleB(C, B, scale, tmp); if (B.size <= C.size) { // if 2*L > N ---- Step 4 // m += 1; } else { // if 2*L <= N --- Step 5 B.setTo(C); // L = n+1-L; b = delta; // m = 1; } C.setTo(tmp); } } removeLeadingZeros(C); }
[ "void", "findErrorLocatorPolynomialBM", "(", "GrowQueue_I8", "syndromes", ",", "GrowQueue_I8", "errorLocator", ")", "{", "GrowQueue_I8", "C", "=", "errorLocator", ";", "// error polynomial", "GrowQueue_I8", "B", "=", "new", "GrowQueue_I8", "(", ")", ";", "// previous ...
Computes the error locator polynomial using Berlekamp-Massey algorithm [1] <p>[1] Massey, J. L. (1969), "Shift-register synthesis and BCH decoding" (PDF), IEEE Trans. Information Theory, IT-15 (1): 122–127</p> @param syndromes (Input) The syndromes @param errorLocator (Output) Error locator polynomial. Coefficients are large to small.
[ "Computes", "the", "error", "locator", "polynomial", "using", "Berlekamp", "-", "Massey", "algorithm", "[", "1", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java#L117-L165
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.translationRotate
public Matrix4d translationRotate(double tx, double ty, double tz, Quaterniondc quat) { return translationRotate(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w()); }
java
public Matrix4d translationRotate(double tx, double ty, double tz, Quaterniondc quat) { return translationRotate(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w()); }
[ "public", "Matrix4d", "translationRotate", "(", "double", "tx", ",", "double", "ty", ",", "double", "tz", ",", "Quaterniondc", "quat", ")", "{", "return", "translationRotate", "(", "tx", ",", "ty", ",", "tz", ",", "quat", ".", "x", "(", ")", ",", "quat...
Set <code>this</code> matrix to <code>T * R</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code> and <code>R</code> is a rotation - and possibly scaling - transformation specified by the given quaternion. <p> When transforming a vector by the resulting matrix the rotation - and possibly scaling - transformation will be applied first and then the translation. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> This method is equivalent to calling: <code>translation(tx, ty, tz).rotate(quat)</code> @see #translation(double, double, double) @see #rotate(Quaterniondc) @param tx the number of units by which to translate the x-component @param ty the number of units by which to translate the y-component @param tz the number of units by which to translate the z-component @param quat the quaternion representing a rotation @return this
[ "Set", "<code", ">", "this<", "/", "code", ">", "matrix", "to", "<code", ">", "T", "*", "R<", "/", "code", ">", "where", "<code", ">", "T<", "/", "code", ">", "is", "a", "translation", "by", "the", "given", "<code", ">", "(", "tx", "ty", "tz", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L7547-L7549
rometools/rome-certiorem
src/main/java/com/rometools/certiorem/hub/notify/standard/AbstractNotifier.java
AbstractNotifier.notifySubscribers
@Override public void notifySubscribers(final List<? extends Subscriber> subscribers, final SyndFeed value, final SubscriptionSummaryCallback callback) { String mimeType = null; if (value.getFeedType().startsWith("rss")) { mimeType = "application/rss+xml"; } else { mimeType = "application/atom+xml"; } final SyndFeedOutput output = new SyndFeedOutput(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { output.output(value, new OutputStreamWriter(baos)); baos.close(); } catch (final IOException ex) { LOG.error("Unable to output the feed", ex); throw new RuntimeException("Unable to output the feed.", ex); } catch (final FeedException ex) { LOG.error("Unable to output the feed", ex); throw new RuntimeException("Unable to output the feed.", ex); } final byte[] payload = baos.toByteArray(); for (final Subscriber s : subscribers) { final Notification not = new Notification(); not.callback = callback; not.lastRun = 0; not.mimeType = mimeType; not.payload = payload; not.retryCount = 0; not.subscriber = s; enqueueNotification(not); } }
java
@Override public void notifySubscribers(final List<? extends Subscriber> subscribers, final SyndFeed value, final SubscriptionSummaryCallback callback) { String mimeType = null; if (value.getFeedType().startsWith("rss")) { mimeType = "application/rss+xml"; } else { mimeType = "application/atom+xml"; } final SyndFeedOutput output = new SyndFeedOutput(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { output.output(value, new OutputStreamWriter(baos)); baos.close(); } catch (final IOException ex) { LOG.error("Unable to output the feed", ex); throw new RuntimeException("Unable to output the feed.", ex); } catch (final FeedException ex) { LOG.error("Unable to output the feed", ex); throw new RuntimeException("Unable to output the feed.", ex); } final byte[] payload = baos.toByteArray(); for (final Subscriber s : subscribers) { final Notification not = new Notification(); not.callback = callback; not.lastRun = 0; not.mimeType = mimeType; not.payload = payload; not.retryCount = 0; not.subscriber = s; enqueueNotification(not); } }
[ "@", "Override", "public", "void", "notifySubscribers", "(", "final", "List", "<", "?", "extends", "Subscriber", ">", "subscribers", ",", "final", "SyndFeed", "value", ",", "final", "SubscriptionSummaryCallback", "callback", ")", "{", "String", "mimeType", "=", ...
This method will serialize the synd feed and build Notifications for the implementation class to handle. @see enqueueNotification @param subscribers List of subscribers to notify @param value The SyndFeed object to send @param callback A callback that will be invoked each time a subscriber is notified.
[ "This", "method", "will", "serialize", "the", "synd", "feed", "and", "build", "Notifications", "for", "the", "implementation", "class", "to", "handle", "." ]
train
https://github.com/rometools/rome-certiorem/blob/e5a003193dd2abd748e77961c0f216a7f5690712/src/main/java/com/rometools/certiorem/hub/notify/standard/AbstractNotifier.java#L59-L96
logic-ng/LogicNG
src/main/java/org/logicng/solvers/CleaneLing.java
CleaneLing.createAssignment
private Assignment createAssignment(final LNGBooleanVector vec, final Collection<Variable> variables) { final Assignment model = new Assignment(); for (int i = 1; i < vec.size(); i++) { final Variable var = this.f.variable(this.idx2name.get(i)); if (vec.get(i)) { if (variables == null || variables.contains(var)) { model.addLiteral(var); } } else if (variables == null || variables.contains(var)) { model.addLiteral(var.negate()); } } return model; }
java
private Assignment createAssignment(final LNGBooleanVector vec, final Collection<Variable> variables) { final Assignment model = new Assignment(); for (int i = 1; i < vec.size(); i++) { final Variable var = this.f.variable(this.idx2name.get(i)); if (vec.get(i)) { if (variables == null || variables.contains(var)) { model.addLiteral(var); } } else if (variables == null || variables.contains(var)) { model.addLiteral(var.negate()); } } return model; }
[ "private", "Assignment", "createAssignment", "(", "final", "LNGBooleanVector", "vec", ",", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "final", "Assignment", "model", "=", "new", "Assignment", "(", ")", ";", "for", "(", "int", "i", "=...
Creates an assignment from a Boolean vector of the solver. @param vec the vector of the solver @param variables the variables which should appear in the model or {@code null} if all variables should appear @return the assignment
[ "Creates", "an", "assignment", "from", "a", "Boolean", "vector", "of", "the", "solver", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L322-L331
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/GeometryEngine.java
GeometryEngine.geoJsonToGeometry
public static MapGeometry geoJsonToGeometry(String json, int importFlags, Geometry.Type type) { MapGeometry geom = OperatorImportFromGeoJson.local().execute(importFlags, type, json, null); return geom; }
java
public static MapGeometry geoJsonToGeometry(String json, int importFlags, Geometry.Type type) { MapGeometry geom = OperatorImportFromGeoJson.local().execute(importFlags, type, json, null); return geom; }
[ "public", "static", "MapGeometry", "geoJsonToGeometry", "(", "String", "json", ",", "int", "importFlags", ",", "Geometry", ".", "Type", "type", ")", "{", "MapGeometry", "geom", "=", "OperatorImportFromGeoJson", ".", "local", "(", ")", ".", "execute", "(", "imp...
Imports the MapGeometry from its JSON representation. M and Z values are not imported from JSON representation. See OperatorImportFromJson. @param json The JSON representation of the geometry (with spatial reference). @return The MapGeometry instance containing the imported geometry and its spatial reference.
[ "Imports", "the", "MapGeometry", "from", "its", "JSON", "representation", ".", "M", "and", "Z", "values", "are", "not", "imported", "from", "JSON", "representation", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/GeometryEngine.java#L155-L158
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.isSameDay
public static boolean isSameDay(final Date date1, final Date date2) { if (date1 == null || date2 == null) { throw new IllegalArgumentException("The date must not be null"); } final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return isSameDay(cal1, cal2); }
java
public static boolean isSameDay(final Date date1, final Date date2) { if (date1 == null || date2 == null) { throw new IllegalArgumentException("The date must not be null"); } final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return isSameDay(cal1, cal2); }
[ "public", "static", "boolean", "isSameDay", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "if", "(", "date1", "==", "null", "||", "date2", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The date must not...
<p>Checks if two date objects are on the same day ignoring time.</p> <p>28 Mar 2002 13:45 and 28 Mar 2002 06:01 would return true. 28 Mar 2002 13:45 and 12 Mar 2002 13:45 would return false. </p> @param date1 the first date, not altered, not null @param date2 the second date, not altered, not null @return true if they represent the same day @throws IllegalArgumentException if either date is <code>null</code> @since 2.1
[ "<p", ">", "Checks", "if", "two", "date", "objects", "are", "on", "the", "same", "day", "ignoring", "time", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L168-L177
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/monitor/DropinMonitor.java
DropinMonitor.refresh
public synchronized void refresh(ApplicationMonitorConfig config) { if (config != null && config.isDropinsMonitored()) { //ApplicationMonitorConfig prevConfig = _config.getAndSet(config); _config.set(config); // keep track of the old monitored directory to see if we need to uninstall apps File previousMonitoredDirectory = null; boolean createdPreviousDirectory = createdMonitoredDir.get(); String newMonitoredFolder = config.getLocation(); //if the user set the monitored folder location to be empty or it is somehow null if ((newMonitoredFolder != null) && (!newMonitoredFolder.equals(""))) { previousMonitoredDirectory = updateMonitoredDirectory(newMonitoredFolder); } if (!!!_coreMonitor.isRegistered()) { stopRemovedApplications(); // The service has not been started yet. // load the pids for applications already setup before starting the service fully configureCoreMonitor(config); _coreMonitor.register(_ctx, FileMonitor.class, new FileMonitorImpl()); Tr.audit(_tc, "APPLICATION_MONITOR_STARTED", newMonitoredFolder); } else if (!!!monitoredDirectory.get().equals(previousMonitoredDirectory)) { // The directory has changed so stop the old applications stopAllStartedApplications(); // Need to re-register because file monitor doesn't appear to work from modified events. _coreMonitor.unregister(); // Update the registration with new config before registering the service again configureCoreMonitor(config); _coreMonitor.register(_ctx, FileMonitor.class, new FileMonitorImpl()); // Tidy up old location if we built it tidyUpMonitoredDirectory(createdPreviousDirectory, previousMonitoredDirectory); } } else { // the monitoring service has been disabled: stop/deregister the service stopAllStartedApplications(); stop(); } }
java
public synchronized void refresh(ApplicationMonitorConfig config) { if (config != null && config.isDropinsMonitored()) { //ApplicationMonitorConfig prevConfig = _config.getAndSet(config); _config.set(config); // keep track of the old monitored directory to see if we need to uninstall apps File previousMonitoredDirectory = null; boolean createdPreviousDirectory = createdMonitoredDir.get(); String newMonitoredFolder = config.getLocation(); //if the user set the monitored folder location to be empty or it is somehow null if ((newMonitoredFolder != null) && (!newMonitoredFolder.equals(""))) { previousMonitoredDirectory = updateMonitoredDirectory(newMonitoredFolder); } if (!!!_coreMonitor.isRegistered()) { stopRemovedApplications(); // The service has not been started yet. // load the pids for applications already setup before starting the service fully configureCoreMonitor(config); _coreMonitor.register(_ctx, FileMonitor.class, new FileMonitorImpl()); Tr.audit(_tc, "APPLICATION_MONITOR_STARTED", newMonitoredFolder); } else if (!!!monitoredDirectory.get().equals(previousMonitoredDirectory)) { // The directory has changed so stop the old applications stopAllStartedApplications(); // Need to re-register because file monitor doesn't appear to work from modified events. _coreMonitor.unregister(); // Update the registration with new config before registering the service again configureCoreMonitor(config); _coreMonitor.register(_ctx, FileMonitor.class, new FileMonitorImpl()); // Tidy up old location if we built it tidyUpMonitoredDirectory(createdPreviousDirectory, previousMonitoredDirectory); } } else { // the monitoring service has been disabled: stop/deregister the service stopAllStartedApplications(); stop(); } }
[ "public", "synchronized", "void", "refresh", "(", "ApplicationMonitorConfig", "config", ")", "{", "if", "(", "config", "!=", "null", "&&", "config", ".", "isDropinsMonitored", "(", ")", ")", "{", "//ApplicationMonitorConfig prevConfig = _config.getAndSet(config);", "_co...
Initialize the dropins manager based on configured properties @param properties @return
[ "Initialize", "the", "dropins", "manager", "based", "on", "configured", "properties" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager/src/com/ibm/ws/app/manager/internal/monitor/DropinMonitor.java#L206-L249
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/ForwardOnlyFactorsModule.java
ForwardOnlyFactorsModule.getFactorsModule
public static Module<Factors> getFactorsModule(FactorGraph fg, Algebra s) { ForwardOnlyFactorsModule fm = new ForwardOnlyFactorsModule(null, fg, s); fm.forward(); return fm; }
java
public static Module<Factors> getFactorsModule(FactorGraph fg, Algebra s) { ForwardOnlyFactorsModule fm = new ForwardOnlyFactorsModule(null, fg, s); fm.forward(); return fm; }
[ "public", "static", "Module", "<", "Factors", ">", "getFactorsModule", "(", "FactorGraph", "fg", ",", "Algebra", "s", ")", "{", "ForwardOnlyFactorsModule", "fm", "=", "new", "ForwardOnlyFactorsModule", "(", "null", ",", "fg", ",", "s", ")", ";", "fm", ".", ...
Constructs a factors module and runs the forward computation.
[ "Constructs", "a", "factors", "module", "and", "runs", "the", "forward", "computation", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/ForwardOnlyFactorsModule.java#L103-L107
selendroid/selendroid
selendroid-server/src/main/java/io/selendroid/server/extension/ExtensionLoader.java
ExtensionLoader.runBeforeApplicationCreateBootstrap
public void runBeforeApplicationCreateBootstrap( Instrumentation instrumentation, String[] bootstrapClasses) { if (!isWithExtension) { SelendroidLogger.error("Cannot run bootstrap. Must load an extension first."); return; } for (String bootstrapClassName : bootstrapClasses) { try { SelendroidLogger.info("Running beforeApplicationCreate bootstrap: " + bootstrapClassName); loadBootstrap(bootstrapClassName).runBeforeApplicationCreate(instrumentation); SelendroidLogger.info("\"Running beforeApplicationCreate bootstrap: " + bootstrapClassName); } catch (Exception e) { throw new SelendroidException("Cannot run bootstrap " + bootstrapClassName, e); } } }
java
public void runBeforeApplicationCreateBootstrap( Instrumentation instrumentation, String[] bootstrapClasses) { if (!isWithExtension) { SelendroidLogger.error("Cannot run bootstrap. Must load an extension first."); return; } for (String bootstrapClassName : bootstrapClasses) { try { SelendroidLogger.info("Running beforeApplicationCreate bootstrap: " + bootstrapClassName); loadBootstrap(bootstrapClassName).runBeforeApplicationCreate(instrumentation); SelendroidLogger.info("\"Running beforeApplicationCreate bootstrap: " + bootstrapClassName); } catch (Exception e) { throw new SelendroidException("Cannot run bootstrap " + bootstrapClassName, e); } } }
[ "public", "void", "runBeforeApplicationCreateBootstrap", "(", "Instrumentation", "instrumentation", ",", "String", "[", "]", "bootstrapClasses", ")", "{", "if", "(", "!", "isWithExtension", ")", "{", "SelendroidLogger", ".", "error", "(", "\"Cannot run bootstrap. Must l...
Run bootstrap all BootstrapHandler#runBeforeApplicationCreate classes provided in order.
[ "Run", "bootstrap", "all", "BootstrapHandler#runBeforeApplicationCreate", "classes", "provided", "in", "order", "." ]
train
https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/extension/ExtensionLoader.java#L59-L75
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseLimitNumberHeaders
private void parseLimitNumberHeaders(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_NUMHEADERS); if (null != value) { try { this.limitNumHeaders = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_LIMIT_NUMHEADERS, HttpConfigConstants.MAX_LIMIT_NUMHEADERS); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Num hdrs limit is " + getLimitOnNumberOfHeaders()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitNumberHeaders", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid number of headers limit; " + value); } } } }
java
private void parseLimitNumberHeaders(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_NUMHEADERS); if (null != value) { try { this.limitNumHeaders = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_LIMIT_NUMHEADERS, HttpConfigConstants.MAX_LIMIT_NUMHEADERS); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Num hdrs limit is " + getLimitOnNumberOfHeaders()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitNumberHeaders", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid number of headers limit; " + value); } } } }
[ "private", "void", "parseLimitNumberHeaders", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_LIMIT_NUMHEADERS", ")", ";", "if", "(", "null", "!=", "val...
Check the input configuration for a maximum limit on the number of headers allowed per message. @param props
[ "Check", "the", "input", "configuration", "for", "a", "maximum", "limit", "on", "the", "number", "of", "headers", "allowed", "per", "message", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L835-L850
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.generateSecuredApiKey
@Deprecated public String generateSecuredApiKey(String privateApiKey, String tagFilters, String userToken) throws NoSuchAlgorithmException, InvalidKeyException, AlgoliaException { if (!tagFilters.contains("=")) return generateSecuredApiKey(privateApiKey, new Query().setTagFilters(tagFilters), userToken); else { if (userToken != null && userToken.length() > 0) { try { tagFilters = String.format("%s%s%s", tagFilters, "&userToken=", URLEncoder.encode(userToken, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(e.getMessage()); } } return Base64.encodeBase64String(String.format("%s%s", hmac(privateApiKey, tagFilters), tagFilters).getBytes(Charset.forName("UTF8"))); } }
java
@Deprecated public String generateSecuredApiKey(String privateApiKey, String tagFilters, String userToken) throws NoSuchAlgorithmException, InvalidKeyException, AlgoliaException { if (!tagFilters.contains("=")) return generateSecuredApiKey(privateApiKey, new Query().setTagFilters(tagFilters), userToken); else { if (userToken != null && userToken.length() > 0) { try { tagFilters = String.format("%s%s%s", tagFilters, "&userToken=", URLEncoder.encode(userToken, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(e.getMessage()); } } return Base64.encodeBase64String(String.format("%s%s", hmac(privateApiKey, tagFilters), tagFilters).getBytes(Charset.forName("UTF8"))); } }
[ "@", "Deprecated", "public", "String", "generateSecuredApiKey", "(", "String", "privateApiKey", ",", "String", "tagFilters", ",", "String", "userToken", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", ",", "AlgoliaException", "{", "if", "(", "!"...
Generate a secured and public API Key from a list of tagFilters and an optional user token identifying the current user @param privateApiKey your private API Key @param tagFilters the list of tags applied to the query (used as security) @param userToken an optional token identifying the current user @deprecated Use `generateSecuredApiKey(String privateApiKey, Query query, String userToken)` version
[ "Generate", "a", "secured", "and", "public", "API", "Key", "from", "a", "list", "of", "tagFilters", "and", "an", "optional", "user", "token", "identifying", "the", "current", "user" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L1006-L1020
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java
ChatController.handleParticipantsAdded
public Observable<ChatResult> handleParticipantsAdded(final String conversationId) { return persistenceController.getConversation(conversationId).flatMap(conversation -> { if (conversation == null) { return handleNoLocalConversation(conversationId); } else { return Observable.fromCallable(() -> new ChatResult(true, null)); } }); }
java
public Observable<ChatResult> handleParticipantsAdded(final String conversationId) { return persistenceController.getConversation(conversationId).flatMap(conversation -> { if (conversation == null) { return handleNoLocalConversation(conversationId); } else { return Observable.fromCallable(() -> new ChatResult(true, null)); } }); }
[ "public", "Observable", "<", "ChatResult", ">", "handleParticipantsAdded", "(", "final", "String", "conversationId", ")", "{", "return", "persistenceController", ".", "getConversation", "(", "conversationId", ")", ".", "flatMap", "(", "conversation", "->", "{", "if"...
Handle participant added to a conversation Foundation SDK event. @param conversationId Unique conversation id. @return Observable with Chat SDK result.
[ "Handle", "participant", "added", "to", "a", "conversation", "Foundation", "SDK", "event", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L202-L210
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/documents/FileColumn.java
FileColumn.convertDecimal
private String convertDecimal(double d, String format) { String ret = ""; if(format.length() > 0) { DecimalFormat f = new DecimalFormat(format); ret = f.format(d); } else { ret = Double.toString(d); } return ret; }
java
private String convertDecimal(double d, String format) { String ret = ""; if(format.length() > 0) { DecimalFormat f = new DecimalFormat(format); ret = f.format(d); } else { ret = Double.toString(d); } return ret; }
[ "private", "String", "convertDecimal", "(", "double", "d", ",", "String", "format", ")", "{", "String", "ret", "=", "\"\"", ";", "if", "(", "format", ".", "length", "(", ")", ">", "0", ")", "{", "DecimalFormat", "f", "=", "new", "DecimalFormat", "(", ...
Converts the given numeric value to the output date format. @param d The value to be converted @param format The format to use for the value @return The formatted value
[ "Converts", "the", "given", "numeric", "value", "to", "the", "output", "date", "format", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/FileColumn.java#L714-L729
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java
PredictionsImpl.predictImageUrl
public ImagePrediction predictImageUrl(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).toBlocking().single().body(); }
java
public ImagePrediction predictImageUrl(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).toBlocking().single().body(); }
[ "public", "ImagePrediction", "predictImageUrl", "(", "UUID", "projectId", ",", "PredictImageUrlOptionalParameter", "predictImageUrlOptionalParameter", ")", "{", "return", "predictImageUrlWithServiceResponseAsync", "(", "projectId", ",", "predictImageUrlOptionalParameter", ")", "....
Predict an image url and saves the result. @param projectId The project id @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API @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 ImagePrediction object if successful.
[ "Predict", "an", "image", "url", "and", "saves", "the", "result", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L625-L627
paypal/SeLion
client/src/main/java/com/paypal/selion/configuration/LocalConfig.java
LocalConfig.setConfigProperty
public synchronized void setConfigProperty(Config.ConfigProperty configProperty, Object configPropertyValue) { checkArgument(configProperty != null, "Config property cannot be null"); checkArgument(checkNotInGlobalScope(configProperty), String.format("The configuration property (%s) is not supported in local config.", configProperty)); // NOSONAR checkArgument(configPropertyValue != null, "Config property value cannot be null"); baseConfig.setProperty(configProperty.getName(), configPropertyValue); }
java
public synchronized void setConfigProperty(Config.ConfigProperty configProperty, Object configPropertyValue) { checkArgument(configProperty != null, "Config property cannot be null"); checkArgument(checkNotInGlobalScope(configProperty), String.format("The configuration property (%s) is not supported in local config.", configProperty)); // NOSONAR checkArgument(configPropertyValue != null, "Config property value cannot be null"); baseConfig.setProperty(configProperty.getName(), configPropertyValue); }
[ "public", "synchronized", "void", "setConfigProperty", "(", "Config", ".", "ConfigProperty", "configProperty", ",", "Object", "configPropertyValue", ")", "{", "checkArgument", "(", "configProperty", "!=", "null", ",", "\"Config property cannot be null\"", ")", ";", "che...
Sets the SeLion configuration property value. @param configProperty The configuration property to set. @param configPropertyValue The configuration property value to set.
[ "Sets", "the", "SeLion", "configuration", "property", "value", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/configuration/LocalConfig.java#L178-L185
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/utils/BuilderUtils.java
BuilderUtils.methodHasArgument
public static boolean methodHasArgument(Method method, Property property) { for (Property candidate : method.getArguments()) { if (candidate.equals(property)) { return true; } } return false; }
java
public static boolean methodHasArgument(Method method, Property property) { for (Property candidate : method.getArguments()) { if (candidate.equals(property)) { return true; } } return false; }
[ "public", "static", "boolean", "methodHasArgument", "(", "Method", "method", ",", "Property", "property", ")", "{", "for", "(", "Property", "candidate", ":", "method", ".", "getArguments", "(", ")", ")", "{", "if", "(", "candidate", ".", "equals", "(", "pr...
Checks if method has a specific argument. @param method The method. @param property The argument. @return True if matching argument if found.
[ "Checks", "if", "method", "has", "a", "specific", "argument", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/utils/BuilderUtils.java#L195-L202
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ReflectionUtil.java
ReflectionUtil.invokeNoArgMethod
public static Object invokeNoArgMethod(Object obj, String methodName) { try { return obj.getClass().getMethod(methodName).invoke(obj); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new RateLimiterReflectionException( "Failed to reflect method \"" + methodName + "\" on object: " + obj, e); } catch (InvocationTargetException e) { throw new RateLimiterException( "Failed to invoke method \"" + methodName + "\" on object: " + obj, e); } }
java
public static Object invokeNoArgMethod(Object obj, String methodName) { try { return obj.getClass().getMethod(methodName).invoke(obj); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new RateLimiterReflectionException( "Failed to reflect method \"" + methodName + "\" on object: " + obj, e); } catch (InvocationTargetException e) { throw new RateLimiterException( "Failed to invoke method \"" + methodName + "\" on object: " + obj, e); } }
[ "public", "static", "Object", "invokeNoArgMethod", "(", "Object", "obj", ",", "String", "methodName", ")", "{", "try", "{", "return", "obj", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ")", ".", "invoke", "(", "obj", ")", ";", "}", ...
Invoke the specified method (with no argument) on the object. @param obj the object to call. @param methodName the name of the method (with no argument) @return the returned object from the invocation. @throws RateLimiterException that wraps any exception during reflection
[ "Invoke", "the", "specified", "method", "(", "with", "no", "argument", ")", "on", "the", "object", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ReflectionUtil.java#L54-L67
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.pressImage
public Img pressImage(Image pressImg, Rectangle rectangle, float alpha) { final BufferedImage targetImg = getValidSrcImg(); rectangle = fixRectangle(rectangle, targetImg.getWidth(), targetImg.getHeight()); draw(targetImg, pressImg, rectangle, alpha); this.targetImage = targetImg; return this; }
java
public Img pressImage(Image pressImg, Rectangle rectangle, float alpha) { final BufferedImage targetImg = getValidSrcImg(); rectangle = fixRectangle(rectangle, targetImg.getWidth(), targetImg.getHeight()); draw(targetImg, pressImg, rectangle, alpha); this.targetImage = targetImg; return this; }
[ "public", "Img", "pressImage", "(", "Image", "pressImg", ",", "Rectangle", "rectangle", ",", "float", "alpha", ")", "{", "final", "BufferedImage", "targetImg", "=", "getValidSrcImg", "(", ")", ";", "rectangle", "=", "fixRectangle", "(", "rectangle", ",", "targ...
给图片添加图片水印 @param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件 @param rectangle 矩形对象,表示矩形区域的x,y,width,height,x,y从背景图片中心计算 @param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 @return this @since 4.1.14
[ "给图片添加图片水印" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L449-L456
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java
ConverterRegistry.putCustom
public ConverterRegistry putCustom(Type type, Converter<?> converter) { if (null == customConverterMap) { synchronized (this) { if (null == customConverterMap) { customConverterMap = new ConcurrentHashMap<>(); } } } customConverterMap.put(type, converter); return this; }
java
public ConverterRegistry putCustom(Type type, Converter<?> converter) { if (null == customConverterMap) { synchronized (this) { if (null == customConverterMap) { customConverterMap = new ConcurrentHashMap<>(); } } } customConverterMap.put(type, converter); return this; }
[ "public", "ConverterRegistry", "putCustom", "(", "Type", "type", ",", "Converter", "<", "?", ">", "converter", ")", "{", "if", "(", "null", "==", "customConverterMap", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "null", "==", "customConvert...
登记自定义转换器 @param type 转换的目标类型 @param converter 转换器 @return {@link ConverterRegistry}
[ "登记自定义转换器" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java#L114-L124
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/TargetsApi.java
TargetsApi.getTarget
public TargetsResponse getTarget(BigDecimal id, String type) throws ApiException { ApiResponse<TargetsResponse> resp = getTargetWithHttpInfo(id, type); return resp.getData(); }
java
public TargetsResponse getTarget(BigDecimal id, String type) throws ApiException { ApiResponse<TargetsResponse> resp = getTargetWithHttpInfo(id, type); return resp.getData(); }
[ "public", "TargetsResponse", "getTarget", "(", "BigDecimal", "id", ",", "String", "type", ")", "throws", "ApiException", "{", "ApiResponse", "<", "TargetsResponse", ">", "resp", "=", "getTargetWithHttpInfo", "(", "id", ",", "type", ")", ";", "return", "resp", ...
Get a target Get a specific target by type and ID. Targets can be agents, agent groups, queues, route points, skills, and custom contacts. @param id The ID of the target. (required) @param type The type of target to retrieve. (required) @return TargetsResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "a", "target", "Get", "a", "specific", "target", "by", "type", "and", "ID", ".", "Targets", "can", "be", "agents", "agent", "groups", "queues", "route", "points", "skills", "and", "custom", "contacts", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/TargetsApi.java#L747-L750
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java
GeoJsonToAssembler.createPointSequence
private PointSequence createPointSequence(double[][] coordinates, CrsId crsId) { if (coordinates == null) { return null; } else if (coordinates.length == 0) { return PointCollectionFactory.createEmpty(); } DimensionalFlag df = coordinates[0].length == 4 ? DimensionalFlag.d3DM : coordinates[0].length == 3 ? DimensionalFlag.d3D : DimensionalFlag.d2D; PointSequenceBuilder psb = PointSequenceBuilders.variableSized(df, crsId); for (double[] point : coordinates) { psb.add(point); } return psb.toPointSequence(); }
java
private PointSequence createPointSequence(double[][] coordinates, CrsId crsId) { if (coordinates == null) { return null; } else if (coordinates.length == 0) { return PointCollectionFactory.createEmpty(); } DimensionalFlag df = coordinates[0].length == 4 ? DimensionalFlag.d3DM : coordinates[0].length == 3 ? DimensionalFlag.d3D : DimensionalFlag.d2D; PointSequenceBuilder psb = PointSequenceBuilders.variableSized(df, crsId); for (double[] point : coordinates) { psb.add(point); } return psb.toPointSequence(); }
[ "private", "PointSequence", "createPointSequence", "(", "double", "[", "]", "[", "]", "coordinates", ",", "CrsId", "crsId", ")", "{", "if", "(", "coordinates", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "coordinates", ".", "le...
Helpermethod that creates a geolatte pointsequence starting from an array containing coordinate arrays @param coordinates an array containing coordinate arrays @return a geolatte pointsequence or null if the coordinatesequence was null
[ "Helpermethod", "that", "creates", "a", "geolatte", "pointsequence", "starting", "from", "an", "array", "containing", "coordinate", "arrays" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L460-L473
geomajas/geomajas-project-client-gwt2
common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java
StyleUtil.createRule
public static RuleInfo createRule(LayerType type, FeatureStyleInfo featureStyle) { SymbolizerTypeInfo symbolizer = createSymbolizer(type, featureStyle); RuleInfo rule = createRule(featureStyle.getName(), featureStyle.getName(), symbolizer); return rule; }
java
public static RuleInfo createRule(LayerType type, FeatureStyleInfo featureStyle) { SymbolizerTypeInfo symbolizer = createSymbolizer(type, featureStyle); RuleInfo rule = createRule(featureStyle.getName(), featureStyle.getName(), symbolizer); return rule; }
[ "public", "static", "RuleInfo", "createRule", "(", "LayerType", "type", ",", "FeatureStyleInfo", "featureStyle", ")", "{", "SymbolizerTypeInfo", "symbolizer", "=", "createSymbolizer", "(", "type", ",", "featureStyle", ")", ";", "RuleInfo", "rule", "=", "createRule",...
Create a non-filtered rule from a feature style. @param type the layer type @param featureStyle the style @return the rule
[ "Create", "a", "non", "-", "filtered", "rule", "from", "a", "feature", "style", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L75-L79
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java
PatternUtils.error
static IllegalArgumentException error(String message, String str, int pos) { return new IllegalArgumentException(message + "\n" + context(str, pos)); }
java
static IllegalArgumentException error(String message, String str, int pos) { return new IllegalArgumentException(message + "\n" + context(str, pos)); }
[ "static", "IllegalArgumentException", "error", "(", "String", "message", ",", "String", "str", ",", "int", "pos", ")", "{", "return", "new", "IllegalArgumentException", "(", "message", "+", "\"\\n\"", "+", "context", "(", "str", ",", "pos", ")", ")", ";", ...
Create an IllegalArgumentException with a message including context based on the position.
[ "Create", "an", "IllegalArgumentException", "with", "a", "message", "including", "context", "based", "on", "the", "position", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java#L65-L67
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.sendQueryOfType
@When("^I execute a query over fields '(.+?)' with schema '(.+?)' of type '(json|string)' with magic_column '(.+?)' from table: '(.+?)' using keyspace: '(.+?)' with:$") public void sendQueryOfType(String fields, String schema, String type, String magic_column, String table, String keyspace, DataTable modifications) { try { commonspec.setResultsType("cassandra"); commonspec.getCassandraClient().useKeyspace(keyspace); commonspec.getLogger().debug("Starting a query of type " + commonspec.getResultsType()); String query = ""; if (schema.equals("empty") && magic_column.equals("empty")) { query = "SELECT " + fields + " FROM " + table + ";"; } else if (!schema.equals("empty") && magic_column.equals("empty")) { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + modifiedData + ";"; } else { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + magic_column + " = '" + modifiedData + "';"; } commonspec.getLogger().debug("query: {}", query); com.datastax.driver.core.ResultSet results = commonspec.getCassandraClient().executeQuery(query); commonspec.setCassandraResults(results); } catch (Exception e) { commonspec.getLogger().debug("Exception captured"); commonspec.getLogger().debug(e.toString()); commonspec.getExceptions().add(e); } }
java
@When("^I execute a query over fields '(.+?)' with schema '(.+?)' of type '(json|string)' with magic_column '(.+?)' from table: '(.+?)' using keyspace: '(.+?)' with:$") public void sendQueryOfType(String fields, String schema, String type, String magic_column, String table, String keyspace, DataTable modifications) { try { commonspec.setResultsType("cassandra"); commonspec.getCassandraClient().useKeyspace(keyspace); commonspec.getLogger().debug("Starting a query of type " + commonspec.getResultsType()); String query = ""; if (schema.equals("empty") && magic_column.equals("empty")) { query = "SELECT " + fields + " FROM " + table + ";"; } else if (!schema.equals("empty") && magic_column.equals("empty")) { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + modifiedData + ";"; } else { String retrievedData = commonspec.retrieveData(schema, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); query = "SELECT " + fields + " FROM " + table + " WHERE " + magic_column + " = '" + modifiedData + "';"; } commonspec.getLogger().debug("query: {}", query); com.datastax.driver.core.ResultSet results = commonspec.getCassandraClient().executeQuery(query); commonspec.setCassandraResults(results); } catch (Exception e) { commonspec.getLogger().debug("Exception captured"); commonspec.getLogger().debug(e.toString()); commonspec.getExceptions().add(e); } }
[ "@", "When", "(", "\"^I execute a query over fields '(.+?)' with schema '(.+?)' of type '(json|string)' with magic_column '(.+?)' from table: '(.+?)' using keyspace: '(.+?)' with:$\"", ")", "public", "void", "sendQueryOfType", "(", "String", "fields", ",", "String", "schema", ",", "Str...
Execute a query with schema over a cluster @param fields columns on which the query is executed. Example: "latitude,longitude" or "*" or "count(*)" @param schema the file of configuration (.conf) with the options of mappin. If schema is the word "empty", method will not add a where clause. @param type type of the changes in schema (string or json) @param table table for create the index @param magic_column magic column where index will be saved. If you don't need index, you can add the word "empty" @param keyspace keyspace used @param modifications all data in "where" clause. Where schema is "empty", query has not a where clause. So it is necessary to provide an empty table. Example: ||.
[ "Execute", "a", "query", "with", "schema", "over", "a", "cluster" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L389-L424
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_filter_name_DELETE
public ArrayList<OvhTaskFilter> domain_account_accountName_filter_name_DELETE(String domain, String accountName, String name) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}"; StringBuilder sb = path(qPath, domain, accountName, name); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<OvhTaskFilter> domain_account_accountName_filter_name_DELETE(String domain, String accountName, String name) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}"; StringBuilder sb = path(qPath, domain, accountName, name); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhTaskFilter", ">", "domain_account_accountName_filter_name_DELETE", "(", "String", "domain", ",", "String", "accountName", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/account/{a...
Delete an existing filter REST: DELETE /email/domain/{domain}/account/{accountName}/filter/{name} @param domain [required] Name of your domain name @param accountName [required] Name of account @param name [required] Filter name
[ "Delete", "an", "existing", "filter" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L769-L774
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.foldRow
public double foldRow(int i, VectorAccumulator accumulator) { eachInRow(i, Vectors.asAccumulatorProcedure(accumulator)); return accumulator.accumulate(); }
java
public double foldRow(int i, VectorAccumulator accumulator) { eachInRow(i, Vectors.asAccumulatorProcedure(accumulator)); return accumulator.accumulate(); }
[ "public", "double", "foldRow", "(", "int", "i", ",", "VectorAccumulator", "accumulator", ")", "{", "eachInRow", "(", "i", ",", "Vectors", ".", "asAccumulatorProcedure", "(", "accumulator", ")", ")", ";", "return", "accumulator", ".", "accumulate", "(", ")", ...
Folds all elements of specified row in this matrix with given {@code accumulator}. @param i the row index @param accumulator the vector accumulator @return the accumulated value
[ "Folds", "all", "elements", "of", "specified", "row", "in", "this", "matrix", "with", "given", "{", "@code", "accumulator", "}", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1616-L1619
line/armeria
core/src/main/java/com/linecorp/armeria/server/healthcheck/ManagedHttpHealthCheckService.java
ManagedHttpHealthCheckService.updateHealthStatus
private CompletionStage<AggregatedHttpMessage> updateHealthStatus( ServiceRequestContext ctx, HttpRequest req) { return mode(ctx, req).thenApply(mode -> { if (!mode.isPresent()) { return BAD_REQUEST_RES; } final boolean isHealthy = mode.get(); serverHealth.setHealthy(isHealthy); return isHealthy ? TURN_ON_RES : TURN_OFF_RES; }); }
java
private CompletionStage<AggregatedHttpMessage> updateHealthStatus( ServiceRequestContext ctx, HttpRequest req) { return mode(ctx, req).thenApply(mode -> { if (!mode.isPresent()) { return BAD_REQUEST_RES; } final boolean isHealthy = mode.get(); serverHealth.setHealthy(isHealthy); return isHealthy ? TURN_ON_RES : TURN_OFF_RES; }); }
[ "private", "CompletionStage", "<", "AggregatedHttpMessage", ">", "updateHealthStatus", "(", "ServiceRequestContext", "ctx", ",", "HttpRequest", "req", ")", "{", "return", "mode", "(", "ctx", ",", "req", ")", ".", "thenApply", "(", "mode", "->", "{", "if", "(",...
Updates health status using the specified {@link HttpRequest}.
[ "Updates", "health", "status", "using", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/healthcheck/ManagedHttpHealthCheckService.java#L69-L82
azkaban/azkaban
azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java
HadoopSecurityManager_H_2_0.assignPermissions
private void assignPermissions(final String user, final File tokenFile, final Logger logger) throws IOException { final List<String> changePermissionsCommand = Arrays.asList( CHMOD, TOKEN_FILE_PERMISSIONS, tokenFile.getAbsolutePath() ); int result = this.executeAsUser .execute(System.getProperty("user.name"), changePermissionsCommand); if (result != 0) { throw new IOException("Unable to modify permissions. User: " + user); } final List<String> changeOwnershipCommand = Arrays.asList( CHOWN, user + ":" + GROUP_NAME, tokenFile.getAbsolutePath() ); result = this.executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { throw new IOException("Unable to set ownership. User: " + user); } }
java
private void assignPermissions(final String user, final File tokenFile, final Logger logger) throws IOException { final List<String> changePermissionsCommand = Arrays.asList( CHMOD, TOKEN_FILE_PERMISSIONS, tokenFile.getAbsolutePath() ); int result = this.executeAsUser .execute(System.getProperty("user.name"), changePermissionsCommand); if (result != 0) { throw new IOException("Unable to modify permissions. User: " + user); } final List<String> changeOwnershipCommand = Arrays.asList( CHOWN, user + ":" + GROUP_NAME, tokenFile.getAbsolutePath() ); result = this.executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { throw new IOException("Unable to set ownership. User: " + user); } }
[ "private", "void", "assignPermissions", "(", "final", "String", "user", ",", "final", "File", "tokenFile", ",", "final", "Logger", "logger", ")", "throws", "IOException", "{", "final", "List", "<", "String", ">", "changePermissionsCommand", "=", "Arrays", ".", ...
Uses execute-as-user binary to reassign file permissions to be readable only by that user. Step 1. Set file permissions to 460. Readable to self and readable / writable azkaban group Step 2. Set user as owner of file. @param user user to be proxied @param tokenFile file to be written @param logger logger to use
[ "Uses", "execute", "-", "as", "-", "user", "binary", "to", "reassign", "file", "permissions", "to", "be", "readable", "only", "by", "that", "user", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java#L741-L759
RuedigerMoeller/kontraktor
examples/REST/src/main/java/examples/rest/RESTActor.java
RESTActor.putUser
@ContentType("application/json") public IPromise putUser(String name, @FromQuery("age") int age, JsonObject body, Map<String,Deque<String>> queryparms) { Log.Info(this,"name:"+name+" age:"+age); queryparms.forEach( (k,v) -> { Log.Info(this,""+k+"=>"); v.forEach( s -> { Log.Info(this," "+s); }); }); return resolve(body); }
java
@ContentType("application/json") public IPromise putUser(String name, @FromQuery("age") int age, JsonObject body, Map<String,Deque<String>> queryparms) { Log.Info(this,"name:"+name+" age:"+age); queryparms.forEach( (k,v) -> { Log.Info(this,""+k+"=>"); v.forEach( s -> { Log.Info(this," "+s); }); }); return resolve(body); }
[ "@", "ContentType", "(", "\"application/json\"", ")", "public", "IPromise", "putUser", "(", "String", "name", ",", "@", "FromQuery", "(", "\"age\"", ")", "int", "age", ",", "JsonObject", "body", ",", "Map", "<", "String", ",", "Deque", "<", "String", ">", ...
curl -i -X PUT --data "{ \"name\": \"satoshi\", \"nkey\": 13345 }" 'http://localhost:8080/api/user/nakamoto/?x=simple&something=pokpokpok&x=13&age=111'
[ "curl", "-", "i", "-", "X", "PUT", "--", "data", "{", "\\", "name", "\\", ":", "\\", "satoshi", "\\", "\\", "nkey", "\\", ":", "13345", "}", "http", ":", "//", "localhost", ":", "8080", "/", "api", "/", "user", "/", "nakamoto", "/", "?x", "=", ...
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/examples/REST/src/main/java/examples/rest/RESTActor.java#L47-L57
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.getContent
protected String getContent(String fileName, MessageMgr mm){ StringFileLoader sfl = new StringFileLoader(fileName); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } String content = sfl.load(); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } if(content==null){ mm.report(MessageMgr.createErrorMessage("run: unexpected problem with run script, content was null")); return null; } return content; }
java
protected String getContent(String fileName, MessageMgr mm){ StringFileLoader sfl = new StringFileLoader(fileName); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } String content = sfl.load(); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } if(content==null){ mm.report(MessageMgr.createErrorMessage("run: unexpected problem with run script, content was null")); return null; } return content; }
[ "protected", "String", "getContent", "(", "String", "fileName", ",", "MessageMgr", "mm", ")", "{", "StringFileLoader", "sfl", "=", "new", "StringFileLoader", "(", "fileName", ")", ";", "if", "(", "sfl", ".", "getLoadErrors", "(", ")", ".", "hasErrors", "(", ...
Returns the content of a string read from a file. @param fileName name of file to read from @param mm the message manager to use for reporting errors, warnings, and infos @return null if no content could be found (error), content in string otherwise
[ "Returns", "the", "content", "of", "a", "string", "read", "from", "a", "file", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L233-L250
tonilopezmr/Android-EasySQLite
easysqlite/src/main/java/com/tonilopezmr/easysqlite/SQLiteHelper.java
SQLiteHelper.onUpgrade
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { try { if (builder.tableNames == null) { throw new SQLiteHelperException("The array of String tableNames can't be null!!"); } builder.onUpgradeCallback.onUpgrade(db, oldVersion, newVersion); } catch (SQLiteHelperException e) { Log.e(this.getClass().toString(), Log.getStackTraceString(e), e); } }
java
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { try { if (builder.tableNames == null) { throw new SQLiteHelperException("The array of String tableNames can't be null!!"); } builder.onUpgradeCallback.onUpgrade(db, oldVersion, newVersion); } catch (SQLiteHelperException e) { Log.e(this.getClass().toString(), Log.getStackTraceString(e), e); } }
[ "@", "Override", "public", "void", "onUpgrade", "(", "SQLiteDatabase", "db", ",", "int", "oldVersion", ",", "int", "newVersion", ")", "{", "try", "{", "if", "(", "builder", ".", "tableNames", "==", "null", ")", "{", "throw", "new", "SQLiteHelperException", ...
Called when the database needs to be upgraded. The implementation should use this method to drop tables, add tables, or do anything else it needs to upgrade to the new schema version. @param db The database. @param oldVersion The old database version. @param newVersion The new database version.
[ "Called", "when", "the", "database", "needs", "to", "be", "upgraded", ".", "The", "implementation", "should", "use", "this", "method", "to", "drop", "tables", "add", "tables", "or", "do", "anything", "else", "it", "needs", "to", "upgrade", "to", "the", "ne...
train
https://github.com/tonilopezmr/Android-EasySQLite/blob/bb991a43c9fa11522e5367570ee2335b99bca7c0/easysqlite/src/main/java/com/tonilopezmr/easysqlite/SQLiteHelper.java#L101-L112
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllBySql
public List< T> getAllBySql(String fullSql, Object paramValue1, Type paramType1, Object paramValue2, Type paramType2, Object paramValue3, Type paramType3) { return getAllBySql(fullSql, new Object[]{paramValue1, paramValue2, paramValue3}, new Type[]{paramType1, paramType2, paramType3}, null, null); }
java
public List< T> getAllBySql(String fullSql, Object paramValue1, Type paramType1, Object paramValue2, Type paramType2, Object paramValue3, Type paramType3) { return getAllBySql(fullSql, new Object[]{paramValue1, paramValue2, paramValue3}, new Type[]{paramType1, paramType2, paramType3}, null, null); }
[ "public", "List", "<", "T", ">", "getAllBySql", "(", "String", "fullSql", ",", "Object", "paramValue1", ",", "Type", "paramType1", ",", "Object", "paramValue2", ",", "Type", "paramType2", ",", "Object", "paramValue3", ",", "Type", "paramType3", ")", "{", "re...
Get all by SQL with three pairs of parameterType-value @param fullSql @param paramValue1 @param paramType1 @param paramValue2 @param paramType2 @param paramValue3 @param paramType3 @return the query result
[ "Get", "all", "by", "SQL", "with", "three", "pairs", "of", "parameterType", "-", "value" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L282-L284
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/rpc/Xdr.java
Xdr.putBytes
public void putBytes(byte[] b, int boff, int len) { System.arraycopy(b, boff, _buffer, _offset, len); skip(len); }
java
public void putBytes(byte[] b, int boff, int len) { System.arraycopy(b, boff, _buffer, _offset, len); skip(len); }
[ "public", "void", "putBytes", "(", "byte", "[", "]", "b", ",", "int", "boff", ",", "int", "len", ")", "{", "System", ".", "arraycopy", "(", "b", ",", "boff", ",", "_buffer", ",", "_offset", ",", "len", ")", ";", "skip", "(", "len", ")", ";", "}...
Put a counted array of bytes into the buffer. The length is not encoded. @param b byte array @param boff offset into byte array @param len number of bytes to encode
[ "Put", "a", "counted", "array", "of", "bytes", "into", "the", "buffer", ".", "The", "length", "is", "not", "encoded", "." ]
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/rpc/Xdr.java#L375-L378
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.eachFileRecurse
public static void eachFileRecurse(final File self, final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkDir(self); final File[] files = self.listFiles(); // null check because of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4803836 if (files == null) return; for (File file : files) { if (file.isDirectory()) { if (fileType != FileType.FILES) closure.call(file); eachFileRecurse(file, fileType, closure); } else if (fileType != FileType.DIRECTORIES) { closure.call(file); } } }
java
public static void eachFileRecurse(final File self, final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkDir(self); final File[] files = self.listFiles(); // null check because of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4803836 if (files == null) return; for (File file : files) { if (file.isDirectory()) { if (fileType != FileType.FILES) closure.call(file); eachFileRecurse(file, fileType, closure); } else if (fileType != FileType.DIRECTORIES) { closure.call(file); } } }
[ "public", "static", "void", "eachFileRecurse", "(", "final", "File", "self", ",", "final", "FileType", "fileType", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.File\"", ")", "final", "Closure", "clos...
Processes each descendant file in this directory and any sub-directories. Processing consists of potentially calling <code>closure</code> passing it the current file (which may be a normal file or subdirectory) and then if a subdirectory was encountered, recursively processing the subdirectory. Whether the closure is called is determined by whether the file was a normal file or subdirectory and the value of fileType. @param self a File (that happens to be a folder/directory) @param fileType if normal files or directories or both should be processed @param closure the closure to invoke on each file @throws FileNotFoundException if the given directory does not exist @throws IllegalArgumentException if the provided File object does not represent a directory @since 1.7.1
[ "Processes", "each", "descendant", "file", "in", "this", "directory", "and", "any", "sub", "-", "directories", ".", "Processing", "consists", "of", "potentially", "calling", "<code", ">", "closure<", "/", "code", ">", "passing", "it", "the", "current", "file",...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1238-L1252
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.listSecrets
public PagedList<SecretItem> listSecrets(final String vaultBaseUrl, final Integer maxresults) { return getSecrets(vaultBaseUrl, maxresults); }
java
public PagedList<SecretItem> listSecrets(final String vaultBaseUrl, final Integer maxresults) { return getSecrets(vaultBaseUrl, maxresults); }
[ "public", "PagedList", "<", "SecretItem", ">", "listSecrets", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getSecrets", "(", "vaultBaseUrl", ",", "maxresults", ")", ";", "}" ]
List secrets in the specified vault. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @return the PagedList&lt;SecretItem&gt; if successful.
[ "List", "secrets", "in", "the", "specified", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1198-L1200
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/filemgr/FileManagerImpl.java
FileManagerImpl.storeUserData
public boolean storeUserData(long instanceid, long data) throws IOException, FileManagerException { if ( instanceid == 0 ) { return false; } for ( int i = 0; i < NUM_USER_WORDS; i++ ) { if ( userData[i][0] == instanceid ) { userData[i][1] = data; writeUserData(i); return true; } } // // If we fall through then this is the first time. Now search for an // opening. // for ( int i = 0; i < NUM_USER_WORDS; i++ ) { if ( userData[i][0] == 0 ) { userData[i][0] = instanceid; userData[i][1] = data; writeUserData(i); return true; } } // // If we fall through then all userdata slots are filled. Throw an // exception so caller knows why he's hosed. // throw new FileManagerException("storeUserdata: No remaining slots"); }
java
public boolean storeUserData(long instanceid, long data) throws IOException, FileManagerException { if ( instanceid == 0 ) { return false; } for ( int i = 0; i < NUM_USER_WORDS; i++ ) { if ( userData[i][0] == instanceid ) { userData[i][1] = data; writeUserData(i); return true; } } // // If we fall through then this is the first time. Now search for an // opening. // for ( int i = 0; i < NUM_USER_WORDS; i++ ) { if ( userData[i][0] == 0 ) { userData[i][0] = instanceid; userData[i][1] = data; writeUserData(i); return true; } } // // If we fall through then all userdata slots are filled. Throw an // exception so caller knows why he's hosed. // throw new FileManagerException("storeUserdata: No remaining slots"); }
[ "public", "boolean", "storeUserData", "(", "long", "instanceid", ",", "long", "data", ")", "throws", "IOException", ",", "FileManagerException", "{", "if", "(", "instanceid", "==", "0", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", ...
************************************************************************ Save userdata in parm 1 under unique serial number from parm2. @param instanceid This is the unique identifier for this userdata @param data This is the data associated with the instanceid @return true if the data is stored, false if the serial number is 0 @throws IOException if disk write fails. @throws FileManagerException if there are no slots available for the userdata. ***********************************************************************
[ "************************************************************************", "Save", "userdata", "in", "parm", "1", "under", "unique", "serial", "number", "from", "parm2", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/filemgr/FileManagerImpl.java#L272-L305
Stratio/stratio-cassandra
src/java/org/apache/cassandra/repair/RepairJob.java
RepairJob.addTree
public synchronized int addTree(InetAddress endpoint, MerkleTree tree) { // Wait for all request to have been performed (see #3400) try { requestsSent.await(); } catch (InterruptedException e) { throw new AssertionError("Interrupted while waiting for requests to be sent"); } if (tree == null) failed = true; else trees.add(new TreeResponse(endpoint, tree)); return treeRequests.completed(endpoint); }
java
public synchronized int addTree(InetAddress endpoint, MerkleTree tree) { // Wait for all request to have been performed (see #3400) try { requestsSent.await(); } catch (InterruptedException e) { throw new AssertionError("Interrupted while waiting for requests to be sent"); } if (tree == null) failed = true; else trees.add(new TreeResponse(endpoint, tree)); return treeRequests.completed(endpoint); }
[ "public", "synchronized", "int", "addTree", "(", "InetAddress", "endpoint", ",", "MerkleTree", "tree", ")", "{", "// Wait for all request to have been performed (see #3400)", "try", "{", "requestsSent", ".", "await", "(", ")", ";", "}", "catch", "(", "InterruptedExcep...
Add a new received tree and return the number of remaining tree to be received for the job to be complete. Callers may assume exactly one addTree call will result in zero remaining endpoints. @param endpoint address of the endpoint that sent response @param tree sent Merkle tree or null if validation failed on endpoint @return the number of responses waiting to receive
[ "Add", "a", "new", "received", "tree", "and", "return", "the", "number", "of", "remaining", "tree", "to", "be", "received", "for", "the", "job", "to", "be", "complete", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/repair/RepairJob.java#L178-L195
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.getReferencedObjectIdentity
private Identity getReferencedObjectIdentity(Object obj, ObjectReferenceDescriptor rds, ClassDescriptor cld) { Object[] fkValues = rds.getForeignKeyValues(obj, cld); FieldDescriptor[] fkFieldDescriptors = rds.getForeignKeyFieldDescriptors(cld); boolean hasNullifiedFKValue = hasNullifiedFK(fkFieldDescriptors, fkValues); /* BRJ: if all fk values are null there's no referenced object arminw: Supposed the given object has nullified FK values but the referenced object still exists. This could happend after serialization of the main object. In this case all anonymous field (AK) information is lost, because AnonymousPersistentField class use the object identity to cache the AK values. But we can build Identity anyway from the reference */ if (hasNullifiedFKValue) { if(BrokerHelper.hasAnonymousKeyReference(cld, rds)) { Object referencedObject = rds.getPersistentField().get(obj); if(referencedObject != null) { return pb.serviceIdentity().buildIdentity(referencedObject); } } } else { // ensure that top-level extents are used for Identities return pb.serviceIdentity().buildIdentity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()), fkValues); } return null; }
java
private Identity getReferencedObjectIdentity(Object obj, ObjectReferenceDescriptor rds, ClassDescriptor cld) { Object[] fkValues = rds.getForeignKeyValues(obj, cld); FieldDescriptor[] fkFieldDescriptors = rds.getForeignKeyFieldDescriptors(cld); boolean hasNullifiedFKValue = hasNullifiedFK(fkFieldDescriptors, fkValues); /* BRJ: if all fk values are null there's no referenced object arminw: Supposed the given object has nullified FK values but the referenced object still exists. This could happend after serialization of the main object. In this case all anonymous field (AK) information is lost, because AnonymousPersistentField class use the object identity to cache the AK values. But we can build Identity anyway from the reference */ if (hasNullifiedFKValue) { if(BrokerHelper.hasAnonymousKeyReference(cld, rds)) { Object referencedObject = rds.getPersistentField().get(obj); if(referencedObject != null) { return pb.serviceIdentity().buildIdentity(referencedObject); } } } else { // ensure that top-level extents are used for Identities return pb.serviceIdentity().buildIdentity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()), fkValues); } return null; }
[ "private", "Identity", "getReferencedObjectIdentity", "(", "Object", "obj", ",", "ObjectReferenceDescriptor", "rds", ",", "ClassDescriptor", "cld", ")", "{", "Object", "[", "]", "fkValues", "=", "rds", ".", "getForeignKeyValues", "(", "obj", ",", "cld", ")", ";"...
retrieves an Object reference's Identity. <br> Null is returned if all foreign keys are null
[ "retrieves", "an", "Object", "reference", "s", "Identity", ".", "<br", ">", "Null", "is", "returned", "if", "all", "foreign", "keys", "are", "null" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L596-L626
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/provisioning/UsersApi.java
UsersApi.getUsers
public List<User> getUsers(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ProvisioningApiException { List<User> out = new ArrayList(); try { GetUsersSuccessResponse resp = usersApi.getUsers(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error getting users. Code: " + resp.getStatus().getCode()); } for(Object i:resp.getData().getUsers()) { out.add(new User((Map<String, Object>)i)); } } catch(ApiException e) { throw new ProvisioningApiException("Error getting users", e); } return out; }
java
public List<User> getUsers(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ProvisioningApiException { List<User> out = new ArrayList(); try { GetUsersSuccessResponse resp = usersApi.getUsers(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid); if (!resp.getStatus().getCode().equals(0)) { throw new ProvisioningApiException("Error getting users. Code: " + resp.getStatus().getCode()); } for(Object i:resp.getData().getUsers()) { out.add(new User((Map<String, Object>)i)); } } catch(ApiException e) { throw new ProvisioningApiException("Error getting users", e); } return out; }
[ "public", "List", "<", "User", ">", "getUsers", "(", "Integer", "limit", ",", "Integer", "offset", ",", "String", "order", ",", "String", "sortBy", ",", "String", "filterName", ",", "String", "filterParameters", ",", "String", "roles", ",", "String", "skills...
Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param limit Limit the number of users the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned users. (optional) @param order The sort order. (optional) @param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional) @param filterName The name of a filter to use on the results. (optional) @param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional) @param roles Return only users who have the Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional) @param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional) @param userEnabled Return only enabled or disabled users. (optional) @param userValid Return only valid or invalid users. (optional) @return The list of users found for the given parameters. @throws ProvisioningApiException if the call is unsuccessful.
[ "Get", "users", ".", "Get", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", ")", "objects", "based", "on", "the", "specified", ...
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/UsersApi.java#L98-L117
zaproxy/zaproxy
src/org/zaproxy/zap/control/AddOn.java
AddOn.calculateExtensionRunRequirements
public AddOnRunRequirements calculateExtensionRunRequirements(Extension extension, Collection<AddOn> availableAddOns) { return calculateExtensionRunRequirements(extension.getClass().getCanonicalName(), availableAddOns); }
java
public AddOnRunRequirements calculateExtensionRunRequirements(Extension extension, Collection<AddOn> availableAddOns) { return calculateExtensionRunRequirements(extension.getClass().getCanonicalName(), availableAddOns); }
[ "public", "AddOnRunRequirements", "calculateExtensionRunRequirements", "(", "Extension", "extension", ",", "Collection", "<", "AddOn", ">", "availableAddOns", ")", "{", "return", "calculateExtensionRunRequirements", "(", "extension", ".", "getClass", "(", ")", ".", "get...
Calculates the requirements to run the given {@code extension}, in the current ZAP and Java versions and with the given {@code availableAddOns}. <p> If the extension depends on other add-ons, those add-ons are checked if are also runnable. <p> <strong>Note:</strong> All the given {@code availableAddOns} are expected to be loadable in the currently running ZAP version, that is, the method {@code AddOn.canLoadInCurrentVersion()}, returns {@code true}. @param extension the extension that will be checked @param availableAddOns the add-ons available @return the requirements to run the extension, and if not runnable the reason why it's not. @since 2.4.0 @see AddOnRunRequirements#getExtensionRequirements()
[ "Calculates", "the", "requirements", "to", "run", "the", "given", "{", "@code", "extension", "}", "in", "the", "current", "ZAP", "and", "Java", "versions", "and", "with", "the", "given", "{", "@code", "availableAddOns", "}", ".", "<p", ">", "If", "the", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/control/AddOn.java#L1353-L1355
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyDirectLinearTransform.java
HomographyDirectLinearTransform.process
public boolean process( List<AssociatedPair> points , DMatrixRMaj foundH ) { return process(points,null,null,foundH); }
java
public boolean process( List<AssociatedPair> points , DMatrixRMaj foundH ) { return process(points,null,null,foundH); }
[ "public", "boolean", "process", "(", "List", "<", "AssociatedPair", ">", "points", ",", "DMatrixRMaj", "foundH", ")", "{", "return", "process", "(", "points", ",", "null", ",", "null", ",", "foundH", ")", ";", "}" ]
<p> Computes the homography matrix given a set of observed points in two images. A set of {@link AssociatedPair} is passed in. The computed homography 'H' is found such that the attributes 'p1' and 'p2' in {@link AssociatedPair} refers to x1 and x2, respectively, in the equation below:<br> x<sub>2</sub> = H*x<sub>1</sub> </p> @param points A set of observed image points that are generated from a planar object. Minimum of 4 pairs required. @param foundH Output: Storage for the found solution. 3x3 matrix. @return True if successful. False if it failed.
[ "<p", ">", "Computes", "the", "homography", "matrix", "given", "a", "set", "of", "observed", "points", "in", "two", "images", ".", "A", "set", "of", "{", "@link", "AssociatedPair", "}", "is", "passed", "in", ".", "The", "computed", "homography", "H", "is...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyDirectLinearTransform.java#L125-L127
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java
BigDecimalMath.tanh
public static BigDecimal tanh(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = sinh(x, mc).divide(cosh(x, mc), mc); return round(result, mathContext); }
java
public static BigDecimal tanh(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = sinh(x, mc).divide(cosh(x, mc), mc); return round(result, mathContext); }
[ "public", "static", "BigDecimal", "tanh", "(", "BigDecimal", "x", ",", "MathContext", "mathContext", ")", "{", "checkMathContext", "(", "mathContext", ")", ";", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", ...
Calculates the hyperbolic tangens of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the hyperbolic tangens for @param mathContext the {@link MathContext} used for the result @return the calculated hyperbolic tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision
[ "Calculates", "the", "hyperbolic", "tangens", "of", "{", "@link", "BigDecimal", "}", "x", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1567-L1572
google/closure-templates
java/src/com/google/template/soy/shared/SoyAstCache.java
SoyAstCache.get
public synchronized VersionedFile get(String fileName, Version version) { VersionedFile entry = cache.get(fileName); if (entry != null) { if (entry.version().equals(version)) { // Make a defensive copy since the caller might run further passes on it. return entry.copy(); } else { // Aggressively purge to save memory. cache.remove(fileName); } } return null; }
java
public synchronized VersionedFile get(String fileName, Version version) { VersionedFile entry = cache.get(fileName); if (entry != null) { if (entry.version().equals(version)) { // Make a defensive copy since the caller might run further passes on it. return entry.copy(); } else { // Aggressively purge to save memory. cache.remove(fileName); } } return null; }
[ "public", "synchronized", "VersionedFile", "get", "(", "String", "fileName", ",", "Version", "version", ")", "{", "VersionedFile", "entry", "=", "cache", ".", "get", "(", "fileName", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "if", "(", "entry...
Retrieves a cached version of this file supplier AST, if any. <p>Please treat this as superpackage-private for Soy internals. @param fileName The name of the file @param version The current file version. @return A fresh copy of the tree that may be modified by the caller, or null if no entry was found in the cache.
[ "Retrieves", "a", "cached", "version", "of", "this", "file", "supplier", "AST", "if", "any", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyAstCache.java#L94-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java
JaxWsUtils.getWSDLLocation
public static String getWSDLLocation(ClassInfo classInfo, String seiClassName, InfoStore infoStore) { return getStringAttributeFromAnnotation(classInfo, seiClassName, infoStore, JaxWsConstants.WSDLLOCATION_ATTRIBUTE, "", ""); }
java
public static String getWSDLLocation(ClassInfo classInfo, String seiClassName, InfoStore infoStore) { return getStringAttributeFromAnnotation(classInfo, seiClassName, infoStore, JaxWsConstants.WSDLLOCATION_ATTRIBUTE, "", ""); }
[ "public", "static", "String", "getWSDLLocation", "(", "ClassInfo", "classInfo", ",", "String", "seiClassName", ",", "InfoStore", "infoStore", ")", "{", "return", "getStringAttributeFromAnnotation", "(", "classInfo", ",", "seiClassName", ",", "infoStore", ",", "JaxWsCo...
First, get the WSDL Location. @param classInfo @param seiClassName @param infoStore @return
[ "First", "get", "the", "WSDL", "Location", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java#L273-L275
TGIO/RNCryptorNative
jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java
StreamUtils.readAllBytesOrFail
static void readAllBytesOrFail(InputStream in, byte[] buffer) throws IOException { int read = readAllBytes(in, buffer); if (read != buffer.length) { throw new EOFException(String.format( "Expected %d bytes but read %d bytes.", buffer.length, read)); } }
java
static void readAllBytesOrFail(InputStream in, byte[] buffer) throws IOException { int read = readAllBytes(in, buffer); if (read != buffer.length) { throw new EOFException(String.format( "Expected %d bytes but read %d bytes.", buffer.length, read)); } }
[ "static", "void", "readAllBytesOrFail", "(", "InputStream", "in", ",", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "int", "read", "=", "readAllBytes", "(", "in", ",", "buffer", ")", ";", "if", "(", "read", "!=", "buffer", ".", "length"...
Fills the buffer from the input stream. Throws exception if EOF occurs before buffer is filled. @param in the input stream @param buffer the buffer to fill @throws IOException
[ "Fills", "the", "buffer", "from", "the", "input", "stream", ".", "Throws", "exception", "if", "EOF", "occurs", "before", "buffer", "is", "filled", "." ]
train
https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java#L62-L69
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.populateRecurringException
private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException) { RecurringData data = mpxjException.getRecurring(); xmlException.setEnteredByOccurrences(Boolean.TRUE); xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences())); switch (data.getRecurrenceType()) { case DAILY: { xmlException.setType(BigInteger.valueOf(7)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); break; } case WEEKLY: { xmlException.setType(BigInteger.valueOf(6)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); xmlException.setDaysOfWeek(getDaysOfTheWeek(data)); break; } case MONTHLY: { xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(5)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(4)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } break; } case YEARLY: { xmlException.setMonth(BigInteger.valueOf(NumberHelper.getInt(data.getMonthNumber()) - 1)); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(3)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(2)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } } } }
java
private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException) { RecurringData data = mpxjException.getRecurring(); xmlException.setEnteredByOccurrences(Boolean.TRUE); xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences())); switch (data.getRecurrenceType()) { case DAILY: { xmlException.setType(BigInteger.valueOf(7)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); break; } case WEEKLY: { xmlException.setType(BigInteger.valueOf(6)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); xmlException.setDaysOfWeek(getDaysOfTheWeek(data)); break; } case MONTHLY: { xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(5)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(4)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } break; } case YEARLY: { xmlException.setMonth(BigInteger.valueOf(NumberHelper.getInt(data.getMonthNumber()) - 1)); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(3)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(2)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } } } }
[ "private", "void", "populateRecurringException", "(", "ProjectCalendarException", "mpxjException", ",", "Exceptions", ".", "Exception", "xmlException", ")", "{", "RecurringData", "data", "=", "mpxjException", ".", "getRecurring", "(", ")", ";", "xmlException", ".", "s...
Writes the details of a recurring exception. @param mpxjException source MPXJ calendar exception @param xmlException target MSPDI exception
[ "Writes", "the", "details", "of", "a", "recurring", "exception", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L584-L640
apereo/cas
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java
DefaultRegisteredServiceAccessStrategy.doRejectedAttributesRefusePrincipalAccess
protected boolean doRejectedAttributesRefusePrincipalAccess(final Map<String, Object> principalAttributes) { LOGGER.debug("These rejected attributes [{}] are examined against [{}] before service can proceed.", rejectedAttributes, principalAttributes); if (rejectedAttributes.isEmpty()) { return false; } return requiredAttributesFoundInMap(principalAttributes, rejectedAttributes); }
java
protected boolean doRejectedAttributesRefusePrincipalAccess(final Map<String, Object> principalAttributes) { LOGGER.debug("These rejected attributes [{}] are examined against [{}] before service can proceed.", rejectedAttributes, principalAttributes); if (rejectedAttributes.isEmpty()) { return false; } return requiredAttributesFoundInMap(principalAttributes, rejectedAttributes); }
[ "protected", "boolean", "doRejectedAttributesRefusePrincipalAccess", "(", "final", "Map", "<", "String", ",", "Object", ">", "principalAttributes", ")", "{", "LOGGER", ".", "debug", "(", "\"These rejected attributes [{}] are examined against [{}] before service can proceed.\"", ...
Do rejected attributes refuse principal access boolean. @param principalAttributes the principal attributes @return the boolean
[ "Do", "rejected", "attributes", "refuse", "principal", "access", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java#L206-L212
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java
AccountsImpl.listPoolNodeCountsAsync
public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final ListOperationCallback<PoolNodeCounts> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listPoolNodeCountsSinglePageAsync(), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
java
public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final ListOperationCallback<PoolNodeCounts> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listPoolNodeCountsSinglePageAsync(), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "PoolNodeCounts", ">", ">", "listPoolNodeCountsAsync", "(", "final", "ListOperationCallback", "<", "PoolNodeCounts", ">", "serviceCallback", ")", "{", "return", "AzureServiceFuture", ".", "fromHeaderPageResponse", "(", "listP...
Gets the number of nodes in each state, grouped by pool. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Gets", "the", "number", "of", "nodes", "in", "each", "state", "grouped", "by", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L387-L397
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.addRelationshipToProcessTopic
public void addRelationshipToProcessTopic(final SpecTopic topic, final RelationshipType type) { final ProcessRelationship relationship = new ProcessRelationship(this, topic, type); topicTargetRelationships.add(relationship); relationships.add(relationship); }
java
public void addRelationshipToProcessTopic(final SpecTopic topic, final RelationshipType type) { final ProcessRelationship relationship = new ProcessRelationship(this, topic, type); topicTargetRelationships.add(relationship); relationships.add(relationship); }
[ "public", "void", "addRelationshipToProcessTopic", "(", "final", "SpecTopic", "topic", ",", "final", "RelationshipType", "type", ")", "{", "final", "ProcessRelationship", "relationship", "=", "new", "ProcessRelationship", "(", "this", ",", "topic", ",", "type", ")",...
Add a relationship to the topic. @param topic The topic that is to be related to. @param type The type of the relationship.
[ "Add", "a", "relationship", "to", "the", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L208-L212
alibaba/canal
client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java
ESSyncService.singleTableSimpleFiledInsert
private void singleTableSimpleFiledInsert(ESSyncConfig config, Dml dml, Map<String, Object> data) { ESMapping mapping = config.getEsMapping(); Map<String, Object> esFieldData = new LinkedHashMap<>(); Object idVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData); if (logger.isTraceEnabled()) { logger.trace("Single table insert to es index, destination:{}, table: {}, index: {}, id: {}", config.getDestination(), dml.getTable(), mapping.get_index(), idVal); } esTemplate.insert(mapping, idVal, esFieldData); }
java
private void singleTableSimpleFiledInsert(ESSyncConfig config, Dml dml, Map<String, Object> data) { ESMapping mapping = config.getEsMapping(); Map<String, Object> esFieldData = new LinkedHashMap<>(); Object idVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData); if (logger.isTraceEnabled()) { logger.trace("Single table insert to es index, destination:{}, table: {}, index: {}, id: {}", config.getDestination(), dml.getTable(), mapping.get_index(), idVal); } esTemplate.insert(mapping, idVal, esFieldData); }
[ "private", "void", "singleTableSimpleFiledInsert", "(", "ESSyncConfig", "config", ",", "Dml", "dml", ",", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "ESMapping", "mapping", "=", "config", ".", "getEsMapping", "(", ")", ";", "Map", "<", "St...
单表简单字段insert @param config es配置 @param dml dml信息 @param data 单行dml数据
[ "单表简单字段insert" ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java#L433-L446