repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java
CassandraSchemaManager.handleCreate
private void handleCreate(TableInfo tableInfo, KsDef ksDef) throws Exception { """ Handle create. @param tableInfo the table info @param ksDef the ks def @throws Exception the exception """ if (containsCompositeKey(tableInfo)) { validateCompoundKey(tableInfo); // First drop existing column family. dropTableUsingCql(tableInfo); } else { onDrop(tableInfo); } createOrUpdateColumnFamily(tableInfo, ksDef); }
java
private void handleCreate(TableInfo tableInfo, KsDef ksDef) throws Exception { if (containsCompositeKey(tableInfo)) { validateCompoundKey(tableInfo); // First drop existing column family. dropTableUsingCql(tableInfo); } else { onDrop(tableInfo); } createOrUpdateColumnFamily(tableInfo, ksDef); }
[ "private", "void", "handleCreate", "(", "TableInfo", "tableInfo", ",", "KsDef", "ksDef", ")", "throws", "Exception", "{", "if", "(", "containsCompositeKey", "(", "tableInfo", ")", ")", "{", "validateCompoundKey", "(", "tableInfo", ")", ";", "// First drop existing column family.", "dropTableUsingCql", "(", "tableInfo", ")", ";", "}", "else", "{", "onDrop", "(", "tableInfo", ")", ";", "}", "createOrUpdateColumnFamily", "(", "tableInfo", ",", "ksDef", ")", ";", "}" ]
Handle create. @param tableInfo the table info @param ksDef the ks def @throws Exception the exception
[ "Handle", "create", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L601-L614
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIFarmJobRunnable.java
GUIFarmJobRunnable.createAndShowGUI
private static void createAndShowGUI(GUIAlignmentProgressListener progressListener) { """ Create the GUI and show it. As with all GUI code, this must run on the event-dispatching thread. """ //Create and set up the window. JFrame frame = new JFrame("Monitor alignment process"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = progressListener; newContentPane.setOpaque(true); //content panes must be opaque newContentPane.setSize(new Dimension(400,400)); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
java
private static void createAndShowGUI(GUIAlignmentProgressListener progressListener) { //Create and set up the window. JFrame frame = new JFrame("Monitor alignment process"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = progressListener; newContentPane.setOpaque(true); //content panes must be opaque newContentPane.setSize(new Dimension(400,400)); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
[ "private", "static", "void", "createAndShowGUI", "(", "GUIAlignmentProgressListener", "progressListener", ")", "{", "//Create and set up the window.", "JFrame", "frame", "=", "new", "JFrame", "(", "\"Monitor alignment process\"", ")", ";", "frame", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "EXIT_ON_CLOSE", ")", ";", "//Create and set up the content pane.", "JComponent", "newContentPane", "=", "progressListener", ";", "newContentPane", ".", "setOpaque", "(", "true", ")", ";", "//content panes must be opaque", "newContentPane", ".", "setSize", "(", "new", "Dimension", "(", "400", ",", "400", ")", ")", ";", "frame", ".", "setContentPane", "(", "newContentPane", ")", ";", "//Display the window.", "frame", ".", "pack", "(", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "}" ]
Create the GUI and show it. As with all GUI code, this must run on the event-dispatching thread.
[ "Create", "the", "GUI", "and", "show", "it", ".", "As", "with", "all", "GUI", "code", "this", "must", "run", "on", "the", "event", "-", "dispatching", "thread", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIFarmJobRunnable.java#L42-L56
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/WrapperAdapter.java
WrapperAdapter.recordMethodInvocation
@SneakyThrows public final void recordMethodInvocation(final Class<?> targetClass, final String methodName, final Class<?>[] argumentTypes, final Object[] arguments) { """ record method invocation. @param targetClass target class @param methodName method name @param argumentTypes argument types @param arguments arguments """ jdbcMethodInvocations.add(new JdbcMethodInvocation(targetClass.getMethod(methodName, argumentTypes), arguments)); }
java
@SneakyThrows public final void recordMethodInvocation(final Class<?> targetClass, final String methodName, final Class<?>[] argumentTypes, final Object[] arguments) { jdbcMethodInvocations.add(new JdbcMethodInvocation(targetClass.getMethod(methodName, argumentTypes), arguments)); }
[ "@", "SneakyThrows", "public", "final", "void", "recordMethodInvocation", "(", "final", "Class", "<", "?", ">", "targetClass", ",", "final", "String", "methodName", ",", "final", "Class", "<", "?", ">", "[", "]", "argumentTypes", ",", "final", "Object", "[", "]", "arguments", ")", "{", "jdbcMethodInvocations", ".", "add", "(", "new", "JdbcMethodInvocation", "(", "targetClass", ".", "getMethod", "(", "methodName", ",", "argumentTypes", ")", ",", "arguments", ")", ")", ";", "}" ]
record method invocation. @param targetClass target class @param methodName method name @param argumentTypes argument types @param arguments arguments
[ "record", "method", "invocation", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/WrapperAdapter.java#L59-L62
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/spi/MediaSource.java
MediaSource.getMediaRefProperty
@Deprecated protected final @Nullable String getMediaRefProperty(@NotNull MediaRequest mediaRequest) { """ Get property name containing the media request path @param mediaRequest Media request @return Property name @deprecated Use {@link #getMediaRefProperty(MediaRequest, MediaHandlerConfig)} """ return getMediaRefProperty(mediaRequest, null); }
java
@Deprecated protected final @Nullable String getMediaRefProperty(@NotNull MediaRequest mediaRequest) { return getMediaRefProperty(mediaRequest, null); }
[ "@", "Deprecated", "protected", "final", "@", "Nullable", "String", "getMediaRefProperty", "(", "@", "NotNull", "MediaRequest", "mediaRequest", ")", "{", "return", "getMediaRefProperty", "(", "mediaRequest", ",", "null", ")", ";", "}" ]
Get property name containing the media request path @param mediaRequest Media request @return Property name @deprecated Use {@link #getMediaRefProperty(MediaRequest, MediaHandlerConfig)}
[ "Get", "property", "name", "containing", "the", "media", "request", "path" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/spi/MediaSource.java#L161-L164
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/NimbusServer.java
NimbusServer.initCleaner
@SuppressWarnings("rawtypes") private void initCleaner(Map conf) throws IOException { """ Right now, every 600 seconds, nimbus will clean jar under /LOCAL-DIR/nimbus/inbox, which is the uploading topology directory """ final ScheduledExecutorService scheduExec = data.getScheduExec(); if (!data.isLaunchedCleaner()) { // Schedule Nimbus inbox cleaner/nimbus/inbox jar String dir_location = StormConfig.masterInbox(conf); int inbox_jar_expiration_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_INBOX_JAR_EXPIRATION_SECS), 3600); CleanRunnable r2 = new CleanRunnable(dir_location, inbox_jar_expiration_secs); int cleanup_inbox_freq_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_CLEANUP_INBOX_FREQ_SECS), 600); scheduExec.scheduleAtFixedRate(r2, 0, cleanup_inbox_freq_secs, TimeUnit.SECONDS); data.setLaunchedCleaner(true); LOG.info("Successfully init " + dir_location + " cleaner"); } else { LOG.info("cleaner thread has been started already"); } }
java
@SuppressWarnings("rawtypes") private void initCleaner(Map conf) throws IOException { final ScheduledExecutorService scheduExec = data.getScheduExec(); if (!data.isLaunchedCleaner()) { // Schedule Nimbus inbox cleaner/nimbus/inbox jar String dir_location = StormConfig.masterInbox(conf); int inbox_jar_expiration_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_INBOX_JAR_EXPIRATION_SECS), 3600); CleanRunnable r2 = new CleanRunnable(dir_location, inbox_jar_expiration_secs); int cleanup_inbox_freq_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_CLEANUP_INBOX_FREQ_SECS), 600); scheduExec.scheduleAtFixedRate(r2, 0, cleanup_inbox_freq_secs, TimeUnit.SECONDS); data.setLaunchedCleaner(true); LOG.info("Successfully init " + dir_location + " cleaner"); } else { LOG.info("cleaner thread has been started already"); } }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "void", "initCleaner", "(", "Map", "conf", ")", "throws", "IOException", "{", "final", "ScheduledExecutorService", "scheduExec", "=", "data", ".", "getScheduExec", "(", ")", ";", "if", "(", "!", "data", ".", "isLaunchedCleaner", "(", ")", ")", "{", "// Schedule Nimbus inbox cleaner/nimbus/inbox jar", "String", "dir_location", "=", "StormConfig", ".", "masterInbox", "(", "conf", ")", ";", "int", "inbox_jar_expiration_secs", "=", "JStormUtils", ".", "parseInt", "(", "conf", ".", "get", "(", "Config", ".", "NIMBUS_INBOX_JAR_EXPIRATION_SECS", ")", ",", "3600", ")", ";", "CleanRunnable", "r2", "=", "new", "CleanRunnable", "(", "dir_location", ",", "inbox_jar_expiration_secs", ")", ";", "int", "cleanup_inbox_freq_secs", "=", "JStormUtils", ".", "parseInt", "(", "conf", ".", "get", "(", "Config", ".", "NIMBUS_CLEANUP_INBOX_FREQ_SECS", ")", ",", "600", ")", ";", "scheduExec", ".", "scheduleAtFixedRate", "(", "r2", ",", "0", ",", "cleanup_inbox_freq_secs", ",", "TimeUnit", ".", "SECONDS", ")", ";", "data", ".", "setLaunchedCleaner", "(", "true", ")", ";", "LOG", ".", "info", "(", "\"Successfully init \"", "+", "dir_location", "+", "\" cleaner\"", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"cleaner thread has been started already\"", ")", ";", "}", "}" ]
Right now, every 600 seconds, nimbus will clean jar under /LOCAL-DIR/nimbus/inbox, which is the uploading topology directory
[ "Right", "now", "every", "600", "seconds", "nimbus", "will", "clean", "jar", "under", "/", "LOCAL", "-", "DIR", "/", "nimbus", "/", "inbox", "which", "is", "the", "uploading", "topology", "directory" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/NimbusServer.java#L262-L280
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/features/ExampleAssociatePoints.java
ExampleAssociatePoints.describeImage
private void describeImage(T input, List<Point2D_F64> points, FastQueue<TD> descs ) { """ Detects features inside the two images and computes descriptions at those points. """ detDesc.detect(input); for( int i = 0; i < detDesc.getNumberOfFeatures(); i++ ) { points.add( detDesc.getLocation(i).copy() ); descs.grow().setTo(detDesc.getDescription(i)); } }
java
private void describeImage(T input, List<Point2D_F64> points, FastQueue<TD> descs ) { detDesc.detect(input); for( int i = 0; i < detDesc.getNumberOfFeatures(); i++ ) { points.add( detDesc.getLocation(i).copy() ); descs.grow().setTo(detDesc.getDescription(i)); } }
[ "private", "void", "describeImage", "(", "T", "input", ",", "List", "<", "Point2D_F64", ">", "points", ",", "FastQueue", "<", "TD", ">", "descs", ")", "{", "detDesc", ".", "detect", "(", "input", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "detDesc", ".", "getNumberOfFeatures", "(", ")", ";", "i", "++", ")", "{", "points", ".", "add", "(", "detDesc", ".", "getLocation", "(", "i", ")", ".", "copy", "(", ")", ")", ";", "descs", ".", "grow", "(", ")", ".", "setTo", "(", "detDesc", ".", "getDescription", "(", "i", ")", ")", ";", "}", "}" ]
Detects features inside the two images and computes descriptions at those points.
[ "Detects", "features", "inside", "the", "two", "images", "and", "computes", "descriptions", "at", "those", "points", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleAssociatePoints.java#L109-L117
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java
WaveformFinder.requestWaveformDetailFrom
public WaveformDetail requestWaveformDetailFrom(final DataReference dataReference) { """ Ask the specified player for the specified waveform detail from the specified media slot, first checking if we have a cached copy. @param dataReference uniquely identifies the desired waveform detail @return the waveform detail, if it was found, or {@code null} @throws IllegalStateException if the WaveformFinder is not running """ ensureRunning(); for (WaveformDetail cached : detailHotCache.values()) { if (cached.dataReference.equals(dataReference)) { // Found a hot cue hit, use it. return cached; } } return requestDetailInternal(dataReference, false); }
java
public WaveformDetail requestWaveformDetailFrom(final DataReference dataReference) { ensureRunning(); for (WaveformDetail cached : detailHotCache.values()) { if (cached.dataReference.equals(dataReference)) { // Found a hot cue hit, use it. return cached; } } return requestDetailInternal(dataReference, false); }
[ "public", "WaveformDetail", "requestWaveformDetailFrom", "(", "final", "DataReference", "dataReference", ")", "{", "ensureRunning", "(", ")", ";", "for", "(", "WaveformDetail", "cached", ":", "detailHotCache", ".", "values", "(", ")", ")", "{", "if", "(", "cached", ".", "dataReference", ".", "equals", "(", "dataReference", ")", ")", "{", "// Found a hot cue hit, use it.", "return", "cached", ";", "}", "}", "return", "requestDetailInternal", "(", "dataReference", ",", "false", ")", ";", "}" ]
Ask the specified player for the specified waveform detail from the specified media slot, first checking if we have a cached copy. @param dataReference uniquely identifies the desired waveform detail @return the waveform detail, if it was found, or {@code null} @throws IllegalStateException if the WaveformFinder is not running
[ "Ask", "the", "specified", "player", "for", "the", "specified", "waveform", "detail", "from", "the", "specified", "media", "slot", "first", "checking", "if", "we", "have", "a", "cached", "copy", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java#L563-L571
btaz/data-util
src/main/java/com/btaz/util/xml/model/Xml.java
Xml.deepCopy
private void deepCopy(Element origElement, Element copyElement) { """ Deep copy recursive helper method. @param origElement original element @param copyElement copy element """ List<Node> children = origElement.getChildElements(); for(Node node : children) { try { if(node instanceof Content) { Content content = (Content) ((Content) node).clone(); copyElement.addChildElement(content); } else { Element element = (Element) ((Element) node).clone(); copyElement.addChildElement(element); deepCopy((Element)node, element); } } catch (CloneNotSupportedException e) { throw new XmlModelException("Unable to clone object", e); } } }
java
private void deepCopy(Element origElement, Element copyElement) { List<Node> children = origElement.getChildElements(); for(Node node : children) { try { if(node instanceof Content) { Content content = (Content) ((Content) node).clone(); copyElement.addChildElement(content); } else { Element element = (Element) ((Element) node).clone(); copyElement.addChildElement(element); deepCopy((Element)node, element); } } catch (CloneNotSupportedException e) { throw new XmlModelException("Unable to clone object", e); } } }
[ "private", "void", "deepCopy", "(", "Element", "origElement", ",", "Element", "copyElement", ")", "{", "List", "<", "Node", ">", "children", "=", "origElement", ".", "getChildElements", "(", ")", ";", "for", "(", "Node", "node", ":", "children", ")", "{", "try", "{", "if", "(", "node", "instanceof", "Content", ")", "{", "Content", "content", "=", "(", "Content", ")", "(", "(", "Content", ")", "node", ")", ".", "clone", "(", ")", ";", "copyElement", ".", "addChildElement", "(", "content", ")", ";", "}", "else", "{", "Element", "element", "=", "(", "Element", ")", "(", "(", "Element", ")", "node", ")", ".", "clone", "(", ")", ";", "copyElement", ".", "addChildElement", "(", "element", ")", ";", "deepCopy", "(", "(", "Element", ")", "node", ",", "element", ")", ";", "}", "}", "catch", "(", "CloneNotSupportedException", "e", ")", "{", "throw", "new", "XmlModelException", "(", "\"Unable to clone object\"", ",", "e", ")", ";", "}", "}", "}" ]
Deep copy recursive helper method. @param origElement original element @param copyElement copy element
[ "Deep", "copy", "recursive", "helper", "method", "." ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/model/Xml.java#L310-L326
bwkimmel/jdcp
jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java
JobStatus.withStatus
public JobStatus withStatus(String newStatus) { """ Creates a copy of this <code>JobStatus</code> with the status string set to the specified value. @param newStatus A description of the current status of the job. @return A copy of this <code>JobStatus</code> with the status string set to the specified value. """ return new JobStatus(jobId, description, state, progress, newStatus, eventId); }
java
public JobStatus withStatus(String newStatus) { return new JobStatus(jobId, description, state, progress, newStatus, eventId); }
[ "public", "JobStatus", "withStatus", "(", "String", "newStatus", ")", "{", "return", "new", "JobStatus", "(", "jobId", ",", "description", ",", "state", ",", "progress", ",", "newStatus", ",", "eventId", ")", ";", "}" ]
Creates a copy of this <code>JobStatus</code> with the status string set to the specified value. @param newStatus A description of the current status of the job. @return A copy of this <code>JobStatus</code> with the status string set to the specified value.
[ "Creates", "a", "copy", "of", "this", "<code", ">", "JobStatus<", "/", "code", ">", "with", "the", "status", "string", "set", "to", "the", "specified", "value", "." ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java#L133-L135
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PropertyResolverFactory.java
PropertyResolverFactory.createPrefixedResolver
public static PropertyResolver createPrefixedResolver(final PropertyResolver resolver, String providerName, String pluginType) { """ @return Create a resolver from a set of retrievers, possibly null @param resolver resolver @param pluginType service type name @param providerName provider name """ final String projectPrefix = projectPropertyPrefix(pluginPropertyPrefix(pluginType, providerName)); final String frameworkPrefix = frameworkPropertyPrefix(pluginPropertyPrefix(pluginType, providerName)); return new PropertyResolver(){ public Object resolvePropertyValue(String name, PropertyScope scope) { String value = null; if (scope.isInstanceLevel()) { value = (String)resolver.resolvePropertyValue(name,scope); } if (null != value || scope == PropertyScope.InstanceOnly) { return value; } if (scope.isProjectLevel()) { value = (String) resolver.resolvePropertyValue(projectPrefix + name, scope); } if (null != value || scope == PropertyScope.ProjectOnly) { return value; } value = (String) resolver.resolvePropertyValue(frameworkPrefix + name, scope); return value; } }; }
java
public static PropertyResolver createPrefixedResolver(final PropertyResolver resolver, String providerName, String pluginType) { final String projectPrefix = projectPropertyPrefix(pluginPropertyPrefix(pluginType, providerName)); final String frameworkPrefix = frameworkPropertyPrefix(pluginPropertyPrefix(pluginType, providerName)); return new PropertyResolver(){ public Object resolvePropertyValue(String name, PropertyScope scope) { String value = null; if (scope.isInstanceLevel()) { value = (String)resolver.resolvePropertyValue(name,scope); } if (null != value || scope == PropertyScope.InstanceOnly) { return value; } if (scope.isProjectLevel()) { value = (String) resolver.resolvePropertyValue(projectPrefix + name, scope); } if (null != value || scope == PropertyScope.ProjectOnly) { return value; } value = (String) resolver.resolvePropertyValue(frameworkPrefix + name, scope); return value; } }; }
[ "public", "static", "PropertyResolver", "createPrefixedResolver", "(", "final", "PropertyResolver", "resolver", ",", "String", "providerName", ",", "String", "pluginType", ")", "{", "final", "String", "projectPrefix", "=", "projectPropertyPrefix", "(", "pluginPropertyPrefix", "(", "pluginType", ",", "providerName", ")", ")", ";", "final", "String", "frameworkPrefix", "=", "frameworkPropertyPrefix", "(", "pluginPropertyPrefix", "(", "pluginType", ",", "providerName", ")", ")", ";", "return", "new", "PropertyResolver", "(", ")", "{", "public", "Object", "resolvePropertyValue", "(", "String", "name", ",", "PropertyScope", "scope", ")", "{", "String", "value", "=", "null", ";", "if", "(", "scope", ".", "isInstanceLevel", "(", ")", ")", "{", "value", "=", "(", "String", ")", "resolver", ".", "resolvePropertyValue", "(", "name", ",", "scope", ")", ";", "}", "if", "(", "null", "!=", "value", "||", "scope", "==", "PropertyScope", ".", "InstanceOnly", ")", "{", "return", "value", ";", "}", "if", "(", "scope", ".", "isProjectLevel", "(", ")", ")", "{", "value", "=", "(", "String", ")", "resolver", ".", "resolvePropertyValue", "(", "projectPrefix", "+", "name", ",", "scope", ")", ";", "}", "if", "(", "null", "!=", "value", "||", "scope", "==", "PropertyScope", ".", "ProjectOnly", ")", "{", "return", "value", ";", "}", "value", "=", "(", "String", ")", "resolver", ".", "resolvePropertyValue", "(", "frameworkPrefix", "+", "name", ",", "scope", ")", ";", "return", "value", ";", "}", "}", ";", "}" ]
@return Create a resolver from a set of retrievers, possibly null @param resolver resolver @param pluginType service type name @param providerName provider name
[ "@return", "Create", "a", "resolver", "from", "a", "set", "of", "retrievers", "possibly", "null" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PropertyResolverFactory.java#L218-L243
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/values/JcElement.java
JcElement.booleanProperty
public JcBoolean booleanProperty(String name) { """ <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>access a named boolean property, return a <b>JcBoolean</b></i></div> <br/> """ JcBoolean ret = new JcBoolean(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS); QueryRecorder.recordInvocationConditional(this, "booleanProperty", ret, QueryRecorder.literal(name)); return ret; }
java
public JcBoolean booleanProperty(String name) { JcBoolean ret = new JcBoolean(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS); QueryRecorder.recordInvocationConditional(this, "booleanProperty", ret, QueryRecorder.literal(name)); return ret; }
[ "public", "JcBoolean", "booleanProperty", "(", "String", "name", ")", "{", "JcBoolean", "ret", "=", "new", "JcBoolean", "(", "name", ",", "this", ",", "OPERATOR", ".", "PropertyContainer", ".", "PROPERTY_ACCESS", ")", ";", "QueryRecorder", ".", "recordInvocationConditional", "(", "this", ",", "\"booleanProperty\"", ",", "ret", ",", "QueryRecorder", ".", "literal", "(", "name", ")", ")", ";", "return", "ret", ";", "}" ]
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>access a named boolean property, return a <b>JcBoolean</b></i></div> <br/>
[ "<div", "color", "=", "red", "style", "=", "font", "-", "size", ":", "24px", ";", "color", ":", "red", ">", "<b", ">", "<i", ">", "<u", ">", "JCYPHER<", "/", "u", ">", "<", "/", "i", ">", "<", "/", "b", ">", "<", "/", "div", ">", "<div", "color", "=", "red", "style", "=", "font", "-", "size", ":", "18px", ";", "color", ":", "red", ">", "<i", ">", "access", "a", "named", "boolean", "property", "return", "a", "<b", ">", "JcBoolean<", "/", "b", ">", "<", "/", "i", ">", "<", "/", "div", ">", "<br", "/", ">" ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcElement.java#L75-L79
killbill/killbill
profiles/killbill/src/main/java/org/killbill/billing/server/log/obfuscators/LuhnMaskingObfuscator.java
LuhnMaskingObfuscator.stripSeparators
@VisibleForTesting String stripSeparators(final String cardNumber) { """ Remove any ` ` and `-` characters from the given string. @param cardNumber the number to clean up @return if the given string contains no ` ` or `-` characters, the string itself is returned, otherwise a new string containing no ` ` or `-` characters is returned """ final int length = cardNumber.length(); final char[] result = new char[length]; int count = 0; char cur; for (int i = 0; i < length; i++) { cur = cardNumber.charAt(i); if (!(cur == ' ' || cur == '-')) { result[count++] = cur; } } if (count == length) { return cardNumber; } return new String(result, 0, count); }
java
@VisibleForTesting String stripSeparators(final String cardNumber) { final int length = cardNumber.length(); final char[] result = new char[length]; int count = 0; char cur; for (int i = 0; i < length; i++) { cur = cardNumber.charAt(i); if (!(cur == ' ' || cur == '-')) { result[count++] = cur; } } if (count == length) { return cardNumber; } return new String(result, 0, count); }
[ "@", "VisibleForTesting", "String", "stripSeparators", "(", "final", "String", "cardNumber", ")", "{", "final", "int", "length", "=", "cardNumber", ".", "length", "(", ")", ";", "final", "char", "[", "]", "result", "=", "new", "char", "[", "length", "]", ";", "int", "count", "=", "0", ";", "char", "cur", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "cur", "=", "cardNumber", ".", "charAt", "(", "i", ")", ";", "if", "(", "!", "(", "cur", "==", "'", "'", "||", "cur", "==", "'", "'", ")", ")", "{", "result", "[", "count", "++", "]", "=", "cur", ";", "}", "}", "if", "(", "count", "==", "length", ")", "{", "return", "cardNumber", ";", "}", "return", "new", "String", "(", "result", ",", "0", ",", "count", ")", ";", "}" ]
Remove any ` ` and `-` characters from the given string. @param cardNumber the number to clean up @return if the given string contains no ` ` or `-` characters, the string itself is returned, otherwise a new string containing no ` ` or `-` characters is returned
[ "Remove", "any", "and", "-", "characters", "from", "the", "given", "string", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/profiles/killbill/src/main/java/org/killbill/billing/server/log/obfuscators/LuhnMaskingObfuscator.java#L181-L197
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getRequstURIPath
public double getRequstURIPath(String prefix, double defvalue) { """ 获取请求URL分段中含prefix段的double值 <br> 例如请求URL /pipes/record/query/point:40.0 <br> 获取time参数: double point = request.getRequstURIPath("point:", 0.0); @param prefix prefix段前缀 @param defvalue 默认double值 @return double值 """ String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Double.parseDouble(val); } catch (NumberFormatException e) { return defvalue; } }
java
public double getRequstURIPath(String prefix, double defvalue) { String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Double.parseDouble(val); } catch (NumberFormatException e) { return defvalue; } }
[ "public", "double", "getRequstURIPath", "(", "String", "prefix", ",", "double", "defvalue", ")", "{", "String", "val", "=", "getRequstURIPath", "(", "prefix", ",", "null", ")", ";", "try", "{", "return", "val", "==", "null", "?", "defvalue", ":", "Double", ".", "parseDouble", "(", "val", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "defvalue", ";", "}", "}" ]
获取请求URL分段中含prefix段的double值 <br> 例如请求URL /pipes/record/query/point:40.0 <br> 获取time参数: double point = request.getRequstURIPath("point:", 0.0); @param prefix prefix段前缀 @param defvalue 默认double值 @return double值
[ "获取请求URL分段中含prefix段的double值", "<br", ">", "例如请求URL", "/", "pipes", "/", "record", "/", "query", "/", "point", ":", "40", ".", "0", "<br", ">", "获取time参数", ":", "double", "point", "=", "request", ".", "getRequstURIPath", "(", "point", ":", "0", ".", "0", ")", ";" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L955-L962
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.unsetItemAsFuture
public FutureAPIResponse unsetItemAsFuture(String iid, List<String> properties) throws IOException { """ Sends an unset item properties request. Same as {@link #unsetItemAsFuture(String, List, DateTime) unsetItemAsFuture(String, List&lt;String&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called. """ return unsetItemAsFuture(iid, properties, new DateTime()); }
java
public FutureAPIResponse unsetItemAsFuture(String iid, List<String> properties) throws IOException { return unsetItemAsFuture(iid, properties, new DateTime()); }
[ "public", "FutureAPIResponse", "unsetItemAsFuture", "(", "String", "iid", ",", "List", "<", "String", ">", "properties", ")", "throws", "IOException", "{", "return", "unsetItemAsFuture", "(", "iid", ",", "properties", ",", "new", "DateTime", "(", ")", ")", ";", "}" ]
Sends an unset item properties request. Same as {@link #unsetItemAsFuture(String, List, DateTime) unsetItemAsFuture(String, List&lt;String&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Sends", "an", "unset", "item", "properties", "request", ".", "Same", "as", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L528-L531
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java
WithoutSpecification.replaceWithMethod
public MemberSubstitution replaceWithMethod(ElementMatcher<? super MethodDescription> matcher, MethodGraph.Compiler methodGraphCompiler) { """ Replaces any interaction with a matched byte code element with a non-static method access on the first parameter of the matched element. When matching a non-static field access or method invocation, the substituted method is located on the same receiver type as the original access. For static access, the first argument is used as a receiver. @param matcher A matcher for locating a method on the original interaction's receiver type. @param methodGraphCompiler The method graph compiler to use for locating a method. @return A member substitution that replaces any matched byte code element with an access of the matched method. """ return replaceWith(new Substitution.ForMethodInvocation.OfMatchedMethod(matcher, methodGraphCompiler)); }
java
public MemberSubstitution replaceWithMethod(ElementMatcher<? super MethodDescription> matcher, MethodGraph.Compiler methodGraphCompiler) { return replaceWith(new Substitution.ForMethodInvocation.OfMatchedMethod(matcher, methodGraphCompiler)); }
[ "public", "MemberSubstitution", "replaceWithMethod", "(", "ElementMatcher", "<", "?", "super", "MethodDescription", ">", "matcher", ",", "MethodGraph", ".", "Compiler", "methodGraphCompiler", ")", "{", "return", "replaceWith", "(", "new", "Substitution", ".", "ForMethodInvocation", ".", "OfMatchedMethod", "(", "matcher", ",", "methodGraphCompiler", ")", ")", ";", "}" ]
Replaces any interaction with a matched byte code element with a non-static method access on the first parameter of the matched element. When matching a non-static field access or method invocation, the substituted method is located on the same receiver type as the original access. For static access, the first argument is used as a receiver. @param matcher A matcher for locating a method on the original interaction's receiver type. @param methodGraphCompiler The method graph compiler to use for locating a method. @return A member substitution that replaces any matched byte code element with an access of the matched method.
[ "Replaces", "any", "interaction", "with", "a", "matched", "byte", "code", "element", "with", "a", "non", "-", "static", "method", "access", "on", "the", "first", "parameter", "of", "the", "matched", "element", ".", "When", "matching", "a", "non", "-", "static", "field", "access", "or", "method", "invocation", "the", "substituted", "method", "is", "located", "on", "the", "same", "receiver", "type", "as", "the", "original", "access", ".", "For", "static", "access", "the", "first", "argument", "is", "used", "as", "a", "receiver", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java#L409-L411
box/box-java-sdk
src/main/java/com/box/sdk/BoxTrash.java
BoxTrash.getFileInfo
public BoxFile.Info getFileInfo(String fileID) { """ Gets information about a trashed file. @param fileID the ID of the trashed file. @return info about the trashed file. """ URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID); BoxAPIRequest request = new BoxAPIRequest(this.api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject jsonObject = JsonObject.readFrom(response.getJSON()); BoxFile file = new BoxFile(this.api, jsonObject.get("id").asString()); return file.new Info(response.getJSON()); }
java
public BoxFile.Info getFileInfo(String fileID) { URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID); BoxAPIRequest request = new BoxAPIRequest(this.api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject jsonObject = JsonObject.readFrom(response.getJSON()); BoxFile file = new BoxFile(this.api, jsonObject.get("id").asString()); return file.new Info(response.getJSON()); }
[ "public", "BoxFile", ".", "Info", "getFileInfo", "(", "String", "fileID", ")", "{", "URL", "url", "=", "FILE_INFO_URL_TEMPLATE", ".", "build", "(", "this", ".", "api", ".", "getBaseURL", "(", ")", ",", "fileID", ")", ";", "BoxAPIRequest", "request", "=", "new", "BoxAPIRequest", "(", "this", ".", "api", ",", "url", ",", "\"GET\"", ")", ";", "BoxJSONResponse", "response", "=", "(", "BoxJSONResponse", ")", "request", ".", "send", "(", ")", ";", "JsonObject", "jsonObject", "=", "JsonObject", ".", "readFrom", "(", "response", ".", "getJSON", "(", ")", ")", ";", "BoxFile", "file", "=", "new", "BoxFile", "(", "this", ".", "api", ",", "jsonObject", ".", "get", "(", "\"id\"", ")", ".", "asString", "(", ")", ")", ";", "return", "file", ".", "new", "Info", "(", "response", ".", "getJSON", "(", ")", ")", ";", "}" ]
Gets information about a trashed file. @param fileID the ID of the trashed file. @return info about the trashed file.
[ "Gets", "information", "about", "a", "trashed", "file", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTrash.java#L157-L165
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/process/PTBLexer.java
PTBLexer.getNext
private Object getNext(String txt, String originalText) { """ Make the next token. @param txt What the token should be @param originalText The original String that got transformed into txt """ if (invertible) { String str = prevWordAfter.toString(); prevWordAfter.setLength(0); CoreLabel word = (CoreLabel) tokenFactory.makeToken(txt, yychar, yylength()); word.set(OriginalTextAnnotation.class, originalText); word.set(BeforeAnnotation.class, str); prevWord.set(AfterAnnotation.class, str); prevWord = word; return word; } else { return tokenFactory.makeToken(txt, yychar, yylength()); } }
java
private Object getNext(String txt, String originalText) { if (invertible) { String str = prevWordAfter.toString(); prevWordAfter.setLength(0); CoreLabel word = (CoreLabel) tokenFactory.makeToken(txt, yychar, yylength()); word.set(OriginalTextAnnotation.class, originalText); word.set(BeforeAnnotation.class, str); prevWord.set(AfterAnnotation.class, str); prevWord = word; return word; } else { return tokenFactory.makeToken(txt, yychar, yylength()); } }
[ "private", "Object", "getNext", "(", "String", "txt", ",", "String", "originalText", ")", "{", "if", "(", "invertible", ")", "{", "String", "str", "=", "prevWordAfter", ".", "toString", "(", ")", ";", "prevWordAfter", ".", "setLength", "(", "0", ")", ";", "CoreLabel", "word", "=", "(", "CoreLabel", ")", "tokenFactory", ".", "makeToken", "(", "txt", ",", "yychar", ",", "yylength", "(", ")", ")", ";", "word", ".", "set", "(", "OriginalTextAnnotation", ".", "class", ",", "originalText", ")", ";", "word", ".", "set", "(", "BeforeAnnotation", ".", "class", ",", "str", ")", ";", "prevWord", ".", "set", "(", "AfterAnnotation", ".", "class", ",", "str", ")", ";", "prevWord", "=", "word", ";", "return", "word", ";", "}", "else", "{", "return", "tokenFactory", ".", "makeToken", "(", "txt", ",", "yychar", ",", "yylength", "(", ")", ")", ";", "}", "}" ]
Make the next token. @param txt What the token should be @param originalText The original String that got transformed into txt
[ "Make", "the", "next", "token", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/process/PTBLexer.java#L10618-L10631
Wikidata/Wikidata-Toolkit
wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/MwRevisionProcessorBroker.java
MwRevisionProcessorBroker.notifyMwRevisionProcessors
void notifyMwRevisionProcessors(MwRevision mwRevision, boolean isCurrent) { """ Notifies all interested subscribers of the given revision. @param mwRevision the given revision @param isCurrent true if this is guaranteed to be the most current revision """ if (mwRevision == null || mwRevision.getPageId() <= 0) { return; } for (MwRevisionProcessorBroker.RevisionSubscription rs : this.revisionSubscriptions) { if (rs.onlyCurrentRevisions == isCurrent && (rs.model == null || mwRevision.getModel().equals( rs.model))) { rs.mwRevisionProcessor.processRevision(mwRevision); } } }
java
void notifyMwRevisionProcessors(MwRevision mwRevision, boolean isCurrent) { if (mwRevision == null || mwRevision.getPageId() <= 0) { return; } for (MwRevisionProcessorBroker.RevisionSubscription rs : this.revisionSubscriptions) { if (rs.onlyCurrentRevisions == isCurrent && (rs.model == null || mwRevision.getModel().equals( rs.model))) { rs.mwRevisionProcessor.processRevision(mwRevision); } } }
[ "void", "notifyMwRevisionProcessors", "(", "MwRevision", "mwRevision", ",", "boolean", "isCurrent", ")", "{", "if", "(", "mwRevision", "==", "null", "||", "mwRevision", ".", "getPageId", "(", ")", "<=", "0", ")", "{", "return", ";", "}", "for", "(", "MwRevisionProcessorBroker", ".", "RevisionSubscription", "rs", ":", "this", ".", "revisionSubscriptions", ")", "{", "if", "(", "rs", ".", "onlyCurrentRevisions", "==", "isCurrent", "&&", "(", "rs", ".", "model", "==", "null", "||", "mwRevision", ".", "getModel", "(", ")", ".", "equals", "(", "rs", ".", "model", ")", ")", ")", "{", "rs", ".", "mwRevisionProcessor", ".", "processRevision", "(", "mwRevision", ")", ";", "}", "}", "}" ]
Notifies all interested subscribers of the given revision. @param mwRevision the given revision @param isCurrent true if this is guaranteed to be the most current revision
[ "Notifies", "all", "interested", "subscribers", "of", "the", "given", "revision", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/MwRevisionProcessorBroker.java#L175-L186
aoindustries/aocode-public
src/main/java/com/aoindustries/rmi/RegistryManager.java
RegistryManager.createRegistry
public static Registry createRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { """ Creates a registry or returns the registry that is already using the port. """ synchronized(registryCache) { Integer portObj = port; Registry registry = registryCache.get(portObj); if(registry==null) { registry = LocateRegistry.createRegistry(port, csf, ssf); registryCache.put(portObj, registry); } return registry; } }
java
public static Registry createRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { synchronized(registryCache) { Integer portObj = port; Registry registry = registryCache.get(portObj); if(registry==null) { registry = LocateRegistry.createRegistry(port, csf, ssf); registryCache.put(portObj, registry); } return registry; } }
[ "public", "static", "Registry", "createRegistry", "(", "int", "port", ",", "RMIClientSocketFactory", "csf", ",", "RMIServerSocketFactory", "ssf", ")", "throws", "RemoteException", "{", "synchronized", "(", "registryCache", ")", "{", "Integer", "portObj", "=", "port", ";", "Registry", "registry", "=", "registryCache", ".", "get", "(", "portObj", ")", ";", "if", "(", "registry", "==", "null", ")", "{", "registry", "=", "LocateRegistry", ".", "createRegistry", "(", "port", ",", "csf", ",", "ssf", ")", ";", "registryCache", ".", "put", "(", "portObj", ",", "registry", ")", ";", "}", "return", "registry", ";", "}", "}" ]
Creates a registry or returns the registry that is already using the port.
[ "Creates", "a", "registry", "or", "returns", "the", "registry", "that", "is", "already", "using", "the", "port", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/rmi/RegistryManager.java#L48-L58
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.backupSecretAsync
public ServiceFuture<BackupSecretResult> backupSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<BackupSecretResult> serviceCallback) { """ Backs up the specified secret. Requests that a backup of the specified secret be downloaded to the client. All versions of the secret will be downloaded. This operation requires the secrets/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(backupSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback); }
java
public ServiceFuture<BackupSecretResult> backupSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<BackupSecretResult> serviceCallback) { return ServiceFuture.fromResponse(backupSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback); }
[ "public", "ServiceFuture", "<", "BackupSecretResult", ">", "backupSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "final", "ServiceCallback", "<", "BackupSecretResult", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "backupSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ")", ",", "serviceCallback", ")", ";", "}" ]
Backs up the specified secret. Requests that a backup of the specified secret be downloaded to the client. All versions of the secret will be downloaded. This operation requires the secrets/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Backs", "up", "the", "specified", "secret", ".", "Requests", "that", "a", "backup", "of", "the", "specified", "secret", "be", "downloaded", "to", "the", "client", ".", "All", "versions", "of", "the", "secret", "will", "be", "downloaded", ".", "This", "operation", "requires", "the", "secrets", "/", "backup", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4920-L4922
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplaceMessages.java
CmsWorkplaceMessages.getResourceTypeDescription
public static String getResourceTypeDescription(CmsWorkplace wp, String name) { """ Returns the description of the given resource type name.<p> If this key is not found, the value of the name input will be returned.<p> @param wp an instance of a {@link CmsWorkplace} to resolve the key name with @param name the resource type name to generate the nice name for @return the description of the given resource type name """ // try to find the localized key String key = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name).getInfo(); return wp.keyDefault(key, name); }
java
public static String getResourceTypeDescription(CmsWorkplace wp, String name) { // try to find the localized key String key = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name).getInfo(); return wp.keyDefault(key, name); }
[ "public", "static", "String", "getResourceTypeDescription", "(", "CmsWorkplace", "wp", ",", "String", "name", ")", "{", "// try to find the localized key", "String", "key", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getExplorerTypeSetting", "(", "name", ")", ".", "getInfo", "(", ")", ";", "return", "wp", ".", "keyDefault", "(", "key", ",", "name", ")", ";", "}" ]
Returns the description of the given resource type name.<p> If this key is not found, the value of the name input will be returned.<p> @param wp an instance of a {@link CmsWorkplace} to resolve the key name with @param name the resource type name to generate the nice name for @return the description of the given resource type name
[ "Returns", "the", "description", "of", "the", "given", "resource", "type", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceMessages.java#L132-L137
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Ftp.java
Ftp.actionGetFile
private AFTPClient actionGetFile() throws PageException, IOException { """ gets a file from server and copy it local @return FTPCLient @throws PageException @throws IOException """ required("remotefile", remotefile); required("localfile", localfile); AFTPClient client = getClient(); Resource local = ResourceUtil.toResourceExistingParent(pageContext, localfile);// new File(localfile); pageContext.getConfig().getSecurityManager().checkFileLocation(local); if (failifexists && local.exists()) throw new ApplicationException("File [" + local + "] already exist, if you want to overwrite, set attribute failIfExists to false"); OutputStream fos = null; client.setFileType(getType(local)); boolean success = false; try { fos = IOUtil.toBufferedOutputStream(local.getOutputStream()); success = client.retrieveFile(remotefile, fos); } finally { IOUtil.closeEL(fos); if (!success) local.delete(); } writeCfftp(client); return client; }
java
private AFTPClient actionGetFile() throws PageException, IOException { required("remotefile", remotefile); required("localfile", localfile); AFTPClient client = getClient(); Resource local = ResourceUtil.toResourceExistingParent(pageContext, localfile);// new File(localfile); pageContext.getConfig().getSecurityManager().checkFileLocation(local); if (failifexists && local.exists()) throw new ApplicationException("File [" + local + "] already exist, if you want to overwrite, set attribute failIfExists to false"); OutputStream fos = null; client.setFileType(getType(local)); boolean success = false; try { fos = IOUtil.toBufferedOutputStream(local.getOutputStream()); success = client.retrieveFile(remotefile, fos); } finally { IOUtil.closeEL(fos); if (!success) local.delete(); } writeCfftp(client); return client; }
[ "private", "AFTPClient", "actionGetFile", "(", ")", "throws", "PageException", ",", "IOException", "{", "required", "(", "\"remotefile\"", ",", "remotefile", ")", ";", "required", "(", "\"localfile\"", ",", "localfile", ")", ";", "AFTPClient", "client", "=", "getClient", "(", ")", ";", "Resource", "local", "=", "ResourceUtil", ".", "toResourceExistingParent", "(", "pageContext", ",", "localfile", ")", ";", "// new File(localfile);", "pageContext", ".", "getConfig", "(", ")", ".", "getSecurityManager", "(", ")", ".", "checkFileLocation", "(", "local", ")", ";", "if", "(", "failifexists", "&&", "local", ".", "exists", "(", ")", ")", "throw", "new", "ApplicationException", "(", "\"File [\"", "+", "local", "+", "\"] already exist, if you want to overwrite, set attribute failIfExists to false\"", ")", ";", "OutputStream", "fos", "=", "null", ";", "client", ".", "setFileType", "(", "getType", "(", "local", ")", ")", ";", "boolean", "success", "=", "false", ";", "try", "{", "fos", "=", "IOUtil", ".", "toBufferedOutputStream", "(", "local", ".", "getOutputStream", "(", ")", ")", ";", "success", "=", "client", ".", "retrieveFile", "(", "remotefile", ",", "fos", ")", ";", "}", "finally", "{", "IOUtil", ".", "closeEL", "(", "fos", ")", ";", "if", "(", "!", "success", ")", "local", ".", "delete", "(", ")", ";", "}", "writeCfftp", "(", "client", ")", ";", "return", "client", ";", "}" ]
gets a file from server and copy it local @return FTPCLient @throws PageException @throws IOException
[ "gets", "a", "file", "from", "server", "and", "copy", "it", "local" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L424-L446
phax/ph-oton
ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/handler/AbstractWebPageActionHandlerMultiUndelete.java
AbstractWebPageActionHandlerMultiUndelete.createUndeleteToolbar
@Nonnull @OverrideOnDemand protected TOOLBAR_TYPE createUndeleteToolbar (@Nonnull final WPECTYPE aWPEC, @Nonnull final FORM_TYPE aForm, @Nonnull final ICommonsList <DATATYPE> aSelectedObjects) { """ Create toolbar for undeleting an existing object @param aWPEC The web page execution context @param aForm The handled form. Never <code>null</code>. @param aSelectedObjects Selected objects. Never <code>null</code>. @return Never <code>null</code>. """ final Locale aDisplayLocale = aWPEC.getDisplayLocale (); final TOOLBAR_TYPE aToolbar = getUIHandler ().createToolbar (aWPEC); aToolbar.addHiddenField (CPageParam.PARAM_ACTION, aWPEC.getAction ()); aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE); for (final DATATYPE aItem : aSelectedObjects) aToolbar.addHiddenField (getFieldName (), aItem.getID ()); // Yes button aToolbar.addSubmitButton (getUndeleteToolbarSubmitButtonText (aDisplayLocale), getUndeleteToolbarSubmitButtonIcon ()); // No button aToolbar.addButtonNo (aDisplayLocale); // Callback modifyUndeleteToolbar (aWPEC, aToolbar); return aToolbar; }
java
@Nonnull @OverrideOnDemand protected TOOLBAR_TYPE createUndeleteToolbar (@Nonnull final WPECTYPE aWPEC, @Nonnull final FORM_TYPE aForm, @Nonnull final ICommonsList <DATATYPE> aSelectedObjects) { final Locale aDisplayLocale = aWPEC.getDisplayLocale (); final TOOLBAR_TYPE aToolbar = getUIHandler ().createToolbar (aWPEC); aToolbar.addHiddenField (CPageParam.PARAM_ACTION, aWPEC.getAction ()); aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE); for (final DATATYPE aItem : aSelectedObjects) aToolbar.addHiddenField (getFieldName (), aItem.getID ()); // Yes button aToolbar.addSubmitButton (getUndeleteToolbarSubmitButtonText (aDisplayLocale), getUndeleteToolbarSubmitButtonIcon ()); // No button aToolbar.addButtonNo (aDisplayLocale); // Callback modifyUndeleteToolbar (aWPEC, aToolbar); return aToolbar; }
[ "@", "Nonnull", "@", "OverrideOnDemand", "protected", "TOOLBAR_TYPE", "createUndeleteToolbar", "(", "@", "Nonnull", "final", "WPECTYPE", "aWPEC", ",", "@", "Nonnull", "final", "FORM_TYPE", "aForm", ",", "@", "Nonnull", "final", "ICommonsList", "<", "DATATYPE", ">", "aSelectedObjects", ")", "{", "final", "Locale", "aDisplayLocale", "=", "aWPEC", ".", "getDisplayLocale", "(", ")", ";", "final", "TOOLBAR_TYPE", "aToolbar", "=", "getUIHandler", "(", ")", ".", "createToolbar", "(", "aWPEC", ")", ";", "aToolbar", ".", "addHiddenField", "(", "CPageParam", ".", "PARAM_ACTION", ",", "aWPEC", ".", "getAction", "(", ")", ")", ";", "aToolbar", ".", "addHiddenField", "(", "CPageParam", ".", "PARAM_SUBACTION", ",", "CPageParam", ".", "ACTION_SAVE", ")", ";", "for", "(", "final", "DATATYPE", "aItem", ":", "aSelectedObjects", ")", "aToolbar", ".", "addHiddenField", "(", "getFieldName", "(", ")", ",", "aItem", ".", "getID", "(", ")", ")", ";", "// Yes button", "aToolbar", ".", "addSubmitButton", "(", "getUndeleteToolbarSubmitButtonText", "(", "aDisplayLocale", ")", ",", "getUndeleteToolbarSubmitButtonIcon", "(", ")", ")", ";", "// No button", "aToolbar", ".", "addButtonNo", "(", "aDisplayLocale", ")", ";", "// Callback", "modifyUndeleteToolbar", "(", "aWPEC", ",", "aToolbar", ")", ";", "return", "aToolbar", ";", "}" ]
Create toolbar for undeleting an existing object @param aWPEC The web page execution context @param aForm The handled form. Never <code>null</code>. @param aSelectedObjects Selected objects. Never <code>null</code>. @return Never <code>null</code>.
[ "Create", "toolbar", "for", "undeleting", "an", "existing", "object" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/handler/AbstractWebPageActionHandlerMultiUndelete.java#L134-L157
alkacon/opencms-core
src-gwt/org/opencms/ade/upload/client/ui/A_CmsUploadDialog.java
A_CmsUploadDialog.addClickHandlerToCheckBox
private void addClickHandlerToCheckBox(final CmsCheckBox check, final Widget unzipWidget, final CmsFileInfo file) { """ Adds a click handler for the given check box.<p> @param check the check box @param unzipWidget the un-zip check box @param file the file """ check.addClickHandler(new ClickHandler() { /** * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent) */ public void onClick(ClickEvent event) { // add or remove the file from the list of files to upload if (check.isChecked()) { getFilesToUpload().put(file.getFileName(), file); if (unzipWidget != null) { enableUnzip(unzipWidget); } } else { getFilesToUpload().remove(file.getFileName()); if (unzipWidget != null) { disableUnzip(unzipWidget); } } // disable or enable the OK button if (getFilesToUpload().isEmpty()) { disableOKButton(Messages.get().key(Messages.GUI_UPLOAD_NOTIFICATION_NO_FILES_0)); } else { enableOKButton(); } // update summary updateSummary(); } /** * Disables the 'unzip' button * * @param unzip the unzip button */ private void disableUnzip(Widget unzip) { ((CmsToggleButton)unzip).setEnabled(false); } /** * Enables the 'unzip' button * * @param unzip the unzip button */ private void enableUnzip(Widget unzip) { ((CmsToggleButton)unzip).setEnabled(true); } }); }
java
private void addClickHandlerToCheckBox(final CmsCheckBox check, final Widget unzipWidget, final CmsFileInfo file) { check.addClickHandler(new ClickHandler() { /** * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent) */ public void onClick(ClickEvent event) { // add or remove the file from the list of files to upload if (check.isChecked()) { getFilesToUpload().put(file.getFileName(), file); if (unzipWidget != null) { enableUnzip(unzipWidget); } } else { getFilesToUpload().remove(file.getFileName()); if (unzipWidget != null) { disableUnzip(unzipWidget); } } // disable or enable the OK button if (getFilesToUpload().isEmpty()) { disableOKButton(Messages.get().key(Messages.GUI_UPLOAD_NOTIFICATION_NO_FILES_0)); } else { enableOKButton(); } // update summary updateSummary(); } /** * Disables the 'unzip' button * * @param unzip the unzip button */ private void disableUnzip(Widget unzip) { ((CmsToggleButton)unzip).setEnabled(false); } /** * Enables the 'unzip' button * * @param unzip the unzip button */ private void enableUnzip(Widget unzip) { ((CmsToggleButton)unzip).setEnabled(true); } }); }
[ "private", "void", "addClickHandlerToCheckBox", "(", "final", "CmsCheckBox", "check", ",", "final", "Widget", "unzipWidget", ",", "final", "CmsFileInfo", "file", ")", "{", "check", ".", "addClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "/**\n * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)\n */", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "// add or remove the file from the list of files to upload", "if", "(", "check", ".", "isChecked", "(", ")", ")", "{", "getFilesToUpload", "(", ")", ".", "put", "(", "file", ".", "getFileName", "(", ")", ",", "file", ")", ";", "if", "(", "unzipWidget", "!=", "null", ")", "{", "enableUnzip", "(", "unzipWidget", ")", ";", "}", "}", "else", "{", "getFilesToUpload", "(", ")", ".", "remove", "(", "file", ".", "getFileName", "(", ")", ")", ";", "if", "(", "unzipWidget", "!=", "null", ")", "{", "disableUnzip", "(", "unzipWidget", ")", ";", "}", "}", "// disable or enable the OK button", "if", "(", "getFilesToUpload", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "disableOKButton", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_UPLOAD_NOTIFICATION_NO_FILES_0", ")", ")", ";", "}", "else", "{", "enableOKButton", "(", ")", ";", "}", "// update summary", "updateSummary", "(", ")", ";", "}", "/**\n * Disables the 'unzip' button\n *\n * @param unzip the unzip button\n */", "private", "void", "disableUnzip", "(", "Widget", "unzip", ")", "{", "(", "(", "CmsToggleButton", ")", "unzip", ")", ".", "setEnabled", "(", "false", ")", ";", "}", "/**\n * Enables the 'unzip' button\n *\n * @param unzip the unzip button\n */", "private", "void", "enableUnzip", "(", "Widget", "unzip", ")", "{", "(", "(", "CmsToggleButton", ")", "unzip", ")", ".", "setEnabled", "(", "true", ")", ";", "}", "}", ")", ";", "}" ]
Adds a click handler for the given check box.<p> @param check the check box @param unzipWidget the un-zip check box @param file the file
[ "Adds", "a", "click", "handler", "for", "the", "given", "check", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/upload/client/ui/A_CmsUploadDialog.java#L992-L1046
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/utils/AnnotationProcessorUtilis.java
AnnotationProcessorUtilis.infoOnGeneratedFile
public static void infoOnGeneratedFile(Class<BindDataSource> annotation, File schemaCreateFile) { """ Info on generated file. @param annotation the annotation @param schemaCreateFile the schema create file """ String msg = String.format("file '%s' in directory '%s' is generated by '@%s' annotation processor", schemaCreateFile.getName(), schemaCreateFile.getParentFile(), annotation.getSimpleName()); printMessage(msg); }
java
public static void infoOnGeneratedFile(Class<BindDataSource> annotation, File schemaCreateFile) { String msg = String.format("file '%s' in directory '%s' is generated by '@%s' annotation processor", schemaCreateFile.getName(), schemaCreateFile.getParentFile(), annotation.getSimpleName()); printMessage(msg); }
[ "public", "static", "void", "infoOnGeneratedFile", "(", "Class", "<", "BindDataSource", ">", "annotation", ",", "File", "schemaCreateFile", ")", "{", "String", "msg", "=", "String", ".", "format", "(", "\"file '%s' in directory '%s' is generated by '@%s' annotation processor\"", ",", "schemaCreateFile", ".", "getName", "(", ")", ",", "schemaCreateFile", ".", "getParentFile", "(", ")", ",", "annotation", ".", "getSimpleName", "(", ")", ")", ";", "printMessage", "(", "msg", ")", ";", "}" ]
Info on generated file. @param annotation the annotation @param schemaCreateFile the schema create file
[ "Info", "on", "generated", "file", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/utils/AnnotationProcessorUtilis.java#L72-L76
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java
TernaryPatcher.pre
public static void pre(OpcodeStack stack, int opcode) { """ called before the execution of the parent OpcodeStack.sawOpcode() to save user values if the opcode is a GOTO or GOTO_W. @param stack the OpcodeStack with the items containing user values @param opcode the opcode currently seen """ if (sawGOTO) { return; } sawGOTO = (opcode == Const.GOTO) || (opcode == Const.GOTO_W); if (sawGOTO) { int depth = stack.getStackDepth(); if (depth > 0) { userValues.clear(); for (int i = 0; i < depth; i++) { OpcodeStack.Item item = stack.getStackItem(i); userValues.add(item.getUserValue()); } } } }
java
public static void pre(OpcodeStack stack, int opcode) { if (sawGOTO) { return; } sawGOTO = (opcode == Const.GOTO) || (opcode == Const.GOTO_W); if (sawGOTO) { int depth = stack.getStackDepth(); if (depth > 0) { userValues.clear(); for (int i = 0; i < depth; i++) { OpcodeStack.Item item = stack.getStackItem(i); userValues.add(item.getUserValue()); } } } }
[ "public", "static", "void", "pre", "(", "OpcodeStack", "stack", ",", "int", "opcode", ")", "{", "if", "(", "sawGOTO", ")", "{", "return", ";", "}", "sawGOTO", "=", "(", "opcode", "==", "Const", ".", "GOTO", ")", "||", "(", "opcode", "==", "Const", ".", "GOTO_W", ")", ";", "if", "(", "sawGOTO", ")", "{", "int", "depth", "=", "stack", ".", "getStackDepth", "(", ")", ";", "if", "(", "depth", ">", "0", ")", "{", "userValues", ".", "clear", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "depth", ";", "i", "++", ")", "{", "OpcodeStack", ".", "Item", "item", "=", "stack", ".", "getStackItem", "(", "i", ")", ";", "userValues", ".", "add", "(", "item", ".", "getUserValue", "(", ")", ")", ";", "}", "}", "}", "}" ]
called before the execution of the parent OpcodeStack.sawOpcode() to save user values if the opcode is a GOTO or GOTO_W. @param stack the OpcodeStack with the items containing user values @param opcode the opcode currently seen
[ "called", "before", "the", "execution", "of", "the", "parent", "OpcodeStack", ".", "sawOpcode", "()", "to", "save", "user", "values", "if", "the", "opcode", "is", "a", "GOTO", "or", "GOTO_W", "." ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java#L51-L66
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginGeneratevpnclientpackage
public String beginGeneratevpnclientpackage(String resourceGroupName, String virtualNetworkGatewayName, VpnClientParameters parameters) { """ Generates VPN client package for P2S client of the virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param parameters Parameters supplied to the generate virtual network gateway VPN client package operation. @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 String object if successful. """ return beginGeneratevpnclientpackageWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().single().body(); }
java
public String beginGeneratevpnclientpackage(String resourceGroupName, String virtualNetworkGatewayName, VpnClientParameters parameters) { return beginGeneratevpnclientpackageWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().single().body(); }
[ "public", "String", "beginGeneratevpnclientpackage", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "VpnClientParameters", "parameters", ")", "{", "return", "beginGeneratevpnclientpackageWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Generates VPN client package for P2S client of the virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param parameters Parameters supplied to the generate virtual network gateway VPN client package operation. @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 String object if successful.
[ "Generates", "VPN", "client", "package", "for", "P2S", "client", "of", "the", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1540-L1542
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/StoredServerChannel.java
StoredServerChannel.getOrCreateState
public synchronized PaymentChannelServerState getOrCreateState(Wallet wallet, TransactionBroadcaster broadcaster) throws VerificationException { """ Gets the canonical {@link PaymentChannelServerState} object for this channel, either by returning an existing one or by creating a new one. @param wallet The wallet which holds the {@link PaymentChannelServerState} in which this is saved and which will be used to complete transactions @param broadcaster The {@link TransactionBroadcaster} which will be used to broadcast contract/payment transactions. """ if (state == null) { switch (majorVersion) { case 1: state = new PaymentChannelV1ServerState(this, wallet, broadcaster); break; case 2: state = new PaymentChannelV2ServerState(this, wallet, broadcaster); break; default: throw new IllegalStateException("Invalid version number found"); } } checkArgument(wallet == state.wallet); return state; }
java
public synchronized PaymentChannelServerState getOrCreateState(Wallet wallet, TransactionBroadcaster broadcaster) throws VerificationException { if (state == null) { switch (majorVersion) { case 1: state = new PaymentChannelV1ServerState(this, wallet, broadcaster); break; case 2: state = new PaymentChannelV2ServerState(this, wallet, broadcaster); break; default: throw new IllegalStateException("Invalid version number found"); } } checkArgument(wallet == state.wallet); return state; }
[ "public", "synchronized", "PaymentChannelServerState", "getOrCreateState", "(", "Wallet", "wallet", ",", "TransactionBroadcaster", "broadcaster", ")", "throws", "VerificationException", "{", "if", "(", "state", "==", "null", ")", "{", "switch", "(", "majorVersion", ")", "{", "case", "1", ":", "state", "=", "new", "PaymentChannelV1ServerState", "(", "this", ",", "wallet", ",", "broadcaster", ")", ";", "break", ";", "case", "2", ":", "state", "=", "new", "PaymentChannelV2ServerState", "(", "this", ",", "wallet", ",", "broadcaster", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Invalid version number found\"", ")", ";", "}", "}", "checkArgument", "(", "wallet", "==", "state", ".", "wallet", ")", ";", "return", "state", ";", "}" ]
Gets the canonical {@link PaymentChannelServerState} object for this channel, either by returning an existing one or by creating a new one. @param wallet The wallet which holds the {@link PaymentChannelServerState} in which this is saved and which will be used to complete transactions @param broadcaster The {@link TransactionBroadcaster} which will be used to broadcast contract/payment transactions.
[ "Gets", "the", "canonical", "{", "@link", "PaymentChannelServerState", "}", "object", "for", "this", "channel", "either", "by", "returning", "an", "existing", "one", "or", "by", "creating", "a", "new", "one", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredServerChannel.java#L107-L122
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
AbstractSSTableSimpleWriter.addExpiringColumn
public void addExpiringColumn(ByteBuffer name, ByteBuffer value, long timestamp, int ttl, long expirationTimestampMS) throws IOException { """ Insert a new expiring column to the current row (and super column if applicable). @param name the column name @param value the column value @param timestamp the column timestamp @param ttl the column time to live in seconds @param expirationTimestampMS the local expiration timestamp in milliseconds. This is the server time timestamp used for actually expiring the column, and as a consequence should be synchronized with the cassandra servers time. If {@code timestamp} represents the insertion time in microseconds (which is not required), this should be {@code (timestamp / 1000) + (ttl * 1000)}. """ addColumn(new BufferExpiringCell(metadata.comparator.cellFromByteBuffer(name), value, timestamp, ttl, (int)(expirationTimestampMS / 1000))); }
java
public void addExpiringColumn(ByteBuffer name, ByteBuffer value, long timestamp, int ttl, long expirationTimestampMS) throws IOException { addColumn(new BufferExpiringCell(metadata.comparator.cellFromByteBuffer(name), value, timestamp, ttl, (int)(expirationTimestampMS / 1000))); }
[ "public", "void", "addExpiringColumn", "(", "ByteBuffer", "name", ",", "ByteBuffer", "value", ",", "long", "timestamp", ",", "int", "ttl", ",", "long", "expirationTimestampMS", ")", "throws", "IOException", "{", "addColumn", "(", "new", "BufferExpiringCell", "(", "metadata", ".", "comparator", ".", "cellFromByteBuffer", "(", "name", ")", ",", "value", ",", "timestamp", ",", "ttl", ",", "(", "int", ")", "(", "expirationTimestampMS", "/", "1000", ")", ")", ")", ";", "}" ]
Insert a new expiring column to the current row (and super column if applicable). @param name the column name @param value the column value @param timestamp the column timestamp @param ttl the column time to live in seconds @param expirationTimestampMS the local expiration timestamp in milliseconds. This is the server time timestamp used for actually expiring the column, and as a consequence should be synchronized with the cassandra servers time. If {@code timestamp} represents the insertion time in microseconds (which is not required), this should be {@code (timestamp / 1000) + (ttl * 1000)}.
[ "Insert", "a", "new", "expiring", "column", "to", "the", "current", "row", "(", "and", "super", "column", "if", "applicable", ")", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java#L156-L159
craftercms/core
src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/UrlPatternMergeStrategyResolver.java
UrlPatternMergeStrategyResolver.getStrategy
public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) { """ Returns a {@link DescriptorMergeStrategy} for a given descriptor, picked by matching the descriptor URL to a pattern associated to the strategy. @param descriptorUrl the URL that identifies the descriptor @param descriptorDom the XML DOM of the descriptor @return the {@link DescriptorMergeStrategy} for the descriptor, or null if the descriptor URL doesn't match any pattern. """ for (Map.Entry<String, DescriptorMergeStrategy> entry : urlPatternToStrategyMappings.entrySet()) { if (descriptorUrl.matches(entry.getKey())) { return entry.getValue(); } } return null; }
java
public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) { for (Map.Entry<String, DescriptorMergeStrategy> entry : urlPatternToStrategyMappings.entrySet()) { if (descriptorUrl.matches(entry.getKey())) { return entry.getValue(); } } return null; }
[ "public", "DescriptorMergeStrategy", "getStrategy", "(", "String", "descriptorUrl", ",", "Document", "descriptorDom", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "DescriptorMergeStrategy", ">", "entry", ":", "urlPatternToStrategyMappings", ".", "entrySet", "(", ")", ")", "{", "if", "(", "descriptorUrl", ".", "matches", "(", "entry", ".", "getKey", "(", ")", ")", ")", "{", "return", "entry", ".", "getValue", "(", ")", ";", "}", "}", "return", "null", ";", "}" ]
Returns a {@link DescriptorMergeStrategy} for a given descriptor, picked by matching the descriptor URL to a pattern associated to the strategy. @param descriptorUrl the URL that identifies the descriptor @param descriptorDom the XML DOM of the descriptor @return the {@link DescriptorMergeStrategy} for the descriptor, or null if the descriptor URL doesn't match any pattern.
[ "Returns", "a", "{", "@link", "DescriptorMergeStrategy", "}", "for", "a", "given", "descriptor", "picked", "by", "matching", "the", "descriptor", "URL", "to", "a", "pattern", "associated", "to", "the", "strategy", "." ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/UrlPatternMergeStrategyResolver.java#L51-L59
k0shk0sh/PermissionHelper
permission/src/main/java/com/fastaccess/permission/base/activity/BasePermissionActivity.java
BasePermissionActivity.requestPermission
protected void requestPermission(final PermissionModel model) { """ internal usage to show dialog with explanation you provided and a button to ask the user to request the permission """ new AlertDialog.Builder(this) .setTitle(model.getTitle()) .setMessage(model.getExplanationMessage()) .setPositiveButton("Request", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (model.getPermissionName().equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW)) { permissionHelper.requestSystemAlertPermission(); } else { permissionHelper.requestAfterExplanation(model.getPermissionName()); } } }).show(); }
java
protected void requestPermission(final PermissionModel model) { new AlertDialog.Builder(this) .setTitle(model.getTitle()) .setMessage(model.getExplanationMessage()) .setPositiveButton("Request", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (model.getPermissionName().equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW)) { permissionHelper.requestSystemAlertPermission(); } else { permissionHelper.requestAfterExplanation(model.getPermissionName()); } } }).show(); }
[ "protected", "void", "requestPermission", "(", "final", "PermissionModel", "model", ")", "{", "new", "AlertDialog", ".", "Builder", "(", "this", ")", ".", "setTitle", "(", "model", ".", "getTitle", "(", ")", ")", ".", "setMessage", "(", "model", ".", "getExplanationMessage", "(", ")", ")", ".", "setPositiveButton", "(", "\"Request\"", ",", "new", "DialogInterface", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "if", "(", "model", ".", "getPermissionName", "(", ")", ".", "equalsIgnoreCase", "(", "Manifest", ".", "permission", ".", "SYSTEM_ALERT_WINDOW", ")", ")", "{", "permissionHelper", ".", "requestSystemAlertPermission", "(", ")", ";", "}", "else", "{", "permissionHelper", ".", "requestAfterExplanation", "(", "model", ".", "getPermissionName", "(", ")", ")", ";", "}", "}", "}", ")", ".", "show", "(", ")", ";", "}" ]
internal usage to show dialog with explanation you provided and a button to ask the user to request the permission
[ "internal", "usage", "to", "show", "dialog", "with", "explanation", "you", "provided", "and", "a", "button", "to", "ask", "the", "user", "to", "request", "the", "permission" ]
train
https://github.com/k0shk0sh/PermissionHelper/blob/04edce2af49981d1dd321bcdfbe981a1000b29d7/permission/src/main/java/com/fastaccess/permission/base/activity/BasePermissionActivity.java#L257-L271
spring-projects/spring-flex
spring-flex-core/src/main/java/org/springframework/flex/core/AbstractServiceConfigProcessor.java
AbstractServiceConfigProcessor.addDefaultChannels
private void addDefaultChannels(MessageBroker broker, Service service) { """ Adds the default channels to the {@link Service} being configured. The <code>defaultChannels</code> will be validated to ensure they exist in the {@link MessageBroker} before they are set. @param broker the newly configured MessageBroker @param remotingService the newly created Service """ List<String> defaultChannelList = new ArrayList<String>(); for (String channelId : this.defaultChannels) { Assert.isTrue(broker.getChannelIds().contains(channelId), "The channel " + channelId + " is not known to the MessageBroker " + broker.getId() + " and cannot be set as a default channel" + " on the " + getServiceClassName()); defaultChannelList.add(channelId); } service.setDefaultChannels(defaultChannelList); }
java
private void addDefaultChannels(MessageBroker broker, Service service) { List<String> defaultChannelList = new ArrayList<String>(); for (String channelId : this.defaultChannels) { Assert.isTrue(broker.getChannelIds().contains(channelId), "The channel " + channelId + " is not known to the MessageBroker " + broker.getId() + " and cannot be set as a default channel" + " on the " + getServiceClassName()); defaultChannelList.add(channelId); } service.setDefaultChannels(defaultChannelList); }
[ "private", "void", "addDefaultChannels", "(", "MessageBroker", "broker", ",", "Service", "service", ")", "{", "List", "<", "String", ">", "defaultChannelList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "channelId", ":", "this", ".", "defaultChannels", ")", "{", "Assert", ".", "isTrue", "(", "broker", ".", "getChannelIds", "(", ")", ".", "contains", "(", "channelId", ")", ",", "\"The channel \"", "+", "channelId", "+", "\" is not known to the MessageBroker \"", "+", "broker", ".", "getId", "(", ")", "+", "\" and cannot be set as a default channel\"", "+", "\" on the \"", "+", "getServiceClassName", "(", ")", ")", ";", "defaultChannelList", ".", "add", "(", "channelId", ")", ";", "}", "service", ".", "setDefaultChannels", "(", "defaultChannelList", ")", ";", "}" ]
Adds the default channels to the {@link Service} being configured. The <code>defaultChannels</code> will be validated to ensure they exist in the {@link MessageBroker} before they are set. @param broker the newly configured MessageBroker @param remotingService the newly created Service
[ "Adds", "the", "default", "channels", "to", "the", "{", "@link", "Service", "}", "being", "configured", ".", "The", "<code", ">", "defaultChannels<", "/", "code", ">", "will", "be", "validated", "to", "ensure", "they", "exist", "in", "the", "{", "@link", "MessageBroker", "}", "before", "they", "are", "set", "." ]
train
https://github.com/spring-projects/spring-flex/blob/85f2bff300d74e2d77d565f97a09d12d18e19adc/spring-flex-core/src/main/java/org/springframework/flex/core/AbstractServiceConfigProcessor.java#L166-L174
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.setInternalStateFromContext
public static void setInternalStateFromContext(Object object, Object context, Object[] additionalContexts) { """ Set the values of multiple instance fields defined in a context using reflection. The values in the context will be assigned to values on the {@code instance}. This method will traverse the class hierarchy when searching for the fields. Example usage: Given: <pre> public class MyContext { private String myString = &quot;myString&quot;; protected int myInt = 9; } public class MyInstance { private String myInstanceString; private int myInstanceInt; } </pre> then <pre> Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext()); </pre> will set the instance variables of {@code myInstance} to the values specified in {@code MyContext}. @param object the object @param context The context where the fields are defined. @param additionalContexts Optionally more additional contexts. """ setInternalStateFromContext(object, context, FieldMatchingStrategy.MATCHING); if (additionalContexts != null && additionalContexts.length > 0) { for (Object additionContext : additionalContexts) { setInternalStateFromContext(object, additionContext, FieldMatchingStrategy.MATCHING); } } }
java
public static void setInternalStateFromContext(Object object, Object context, Object[] additionalContexts) { setInternalStateFromContext(object, context, FieldMatchingStrategy.MATCHING); if (additionalContexts != null && additionalContexts.length > 0) { for (Object additionContext : additionalContexts) { setInternalStateFromContext(object, additionContext, FieldMatchingStrategy.MATCHING); } } }
[ "public", "static", "void", "setInternalStateFromContext", "(", "Object", "object", ",", "Object", "context", ",", "Object", "[", "]", "additionalContexts", ")", "{", "setInternalStateFromContext", "(", "object", ",", "context", ",", "FieldMatchingStrategy", ".", "MATCHING", ")", ";", "if", "(", "additionalContexts", "!=", "null", "&&", "additionalContexts", ".", "length", ">", "0", ")", "{", "for", "(", "Object", "additionContext", ":", "additionalContexts", ")", "{", "setInternalStateFromContext", "(", "object", ",", "additionContext", ",", "FieldMatchingStrategy", ".", "MATCHING", ")", ";", "}", "}", "}" ]
Set the values of multiple instance fields defined in a context using reflection. The values in the context will be assigned to values on the {@code instance}. This method will traverse the class hierarchy when searching for the fields. Example usage: Given: <pre> public class MyContext { private String myString = &quot;myString&quot;; protected int myInt = 9; } public class MyInstance { private String myInstanceString; private int myInstanceInt; } </pre> then <pre> Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext()); </pre> will set the instance variables of {@code myInstance} to the values specified in {@code MyContext}. @param object the object @param context The context where the fields are defined. @param additionalContexts Optionally more additional contexts.
[ "Set", "the", "values", "of", "multiple", "instance", "fields", "defined", "in", "a", "context", "using", "reflection", ".", "The", "values", "in", "the", "context", "will", "be", "assigned", "to", "values", "on", "the", "{", "@code", "instance", "}", ".", "This", "method", "will", "traverse", "the", "class", "hierarchy", "when", "searching", "for", "the", "fields", ".", "Example", "usage", ":" ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2467-L2474
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendBetweenCriteria
private void appendBetweenCriteria(TableAlias alias, PathInfo pathInfo, BetweenCriteria c, StringBuffer buf) { """ Answer the SQL-Clause for a BetweenCriteria @param alias @param pathInfo @param c BetweenCriteria @param buf """ appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); appendParameter(c.getValue(), buf); buf.append(" AND "); appendParameter(c.getValue2(), buf); }
java
private void appendBetweenCriteria(TableAlias alias, PathInfo pathInfo, BetweenCriteria c, StringBuffer buf) { appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); appendParameter(c.getValue(), buf); buf.append(" AND "); appendParameter(c.getValue2(), buf); }
[ "private", "void", "appendBetweenCriteria", "(", "TableAlias", "alias", ",", "PathInfo", "pathInfo", ",", "BetweenCriteria", "c", ",", "StringBuffer", "buf", ")", "{", "appendColName", "(", "alias", ",", "pathInfo", ",", "c", ".", "isTranslateAttribute", "(", ")", ",", "buf", ")", ";", "buf", ".", "append", "(", "c", ".", "getClause", "(", ")", ")", ";", "appendParameter", "(", "c", ".", "getValue", "(", ")", ",", "buf", ")", ";", "buf", ".", "append", "(", "\" AND \"", ")", ";", "appendParameter", "(", "c", ".", "getValue2", "(", ")", ",", "buf", ")", ";", "}" ]
Answer the SQL-Clause for a BetweenCriteria @param alias @param pathInfo @param c BetweenCriteria @param buf
[ "Answer", "the", "SQL", "-", "Clause", "for", "a", "BetweenCriteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L698-L705
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.updateApiKey
public JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException { """ Update an api key @param acls the list of ACL for this key. Defined by an array of strings that can contains the following values: - search: allow to search (https and http) - addObject: allows to add/update an object in the index (https only) - deleteObject : allows to delete an existing object (https only) - deleteIndex : allows to delete index content (https only) - settings : allows to get index settings (https only) - editSettings : allows to change index settings (https only) @param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key) @param maxQueriesPerIPPerHour Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit). @param maxHitsPerQuery Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited) @param requestOptions Options to pass to this request """ try { JSONObject jsonObject = generateUpdateUser(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery); return updateApiKey(key, jsonObject, requestOptions); } catch (JSONException e) { throw new RuntimeException(e); } }
java
public JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException { try { JSONObject jsonObject = generateUpdateUser(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery); return updateApiKey(key, jsonObject, requestOptions); } catch (JSONException e) { throw new RuntimeException(e); } }
[ "public", "JSONObject", "updateApiKey", "(", "String", "key", ",", "List", "<", "String", ">", "acls", ",", "int", "validity", ",", "int", "maxQueriesPerIPPerHour", ",", "int", "maxHitsPerQuery", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "try", "{", "JSONObject", "jsonObject", "=", "generateUpdateUser", "(", "acls", ",", "validity", ",", "maxQueriesPerIPPerHour", ",", "maxHitsPerQuery", ")", ";", "return", "updateApiKey", "(", "key", ",", "jsonObject", ",", "requestOptions", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Update an api key @param acls the list of ACL for this key. Defined by an array of strings that can contains the following values: - search: allow to search (https and http) - addObject: allows to add/update an object in the index (https only) - deleteObject : allows to delete an existing object (https only) - deleteIndex : allows to delete index content (https only) - settings : allows to get index settings (https only) - editSettings : allows to change index settings (https only) @param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key) @param maxQueriesPerIPPerHour Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit). @param maxHitsPerQuery Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited) @param requestOptions Options to pass to this request
[ "Update", "an", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1263-L1270
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.setSiteMatcherSites
private void setSiteMatcherSites(Map<CmsSiteMatcher, CmsSite> siteMatcherSites) { """ Sets the class member variables {@link #m_siteMatcherSites} and {@link #m_siteMatchers} from the provided map of configured site matchers.<p> @param siteMatcherSites the site matches to set """ m_siteMatcherSites = Collections.unmodifiableMap(siteMatcherSites); m_siteMatchers = Collections.unmodifiableList(new ArrayList<CmsSiteMatcher>(m_siteMatcherSites.keySet())); }
java
private void setSiteMatcherSites(Map<CmsSiteMatcher, CmsSite> siteMatcherSites) { m_siteMatcherSites = Collections.unmodifiableMap(siteMatcherSites); m_siteMatchers = Collections.unmodifiableList(new ArrayList<CmsSiteMatcher>(m_siteMatcherSites.keySet())); }
[ "private", "void", "setSiteMatcherSites", "(", "Map", "<", "CmsSiteMatcher", ",", "CmsSite", ">", "siteMatcherSites", ")", "{", "m_siteMatcherSites", "=", "Collections", ".", "unmodifiableMap", "(", "siteMatcherSites", ")", ";", "m_siteMatchers", "=", "Collections", ".", "unmodifiableList", "(", "new", "ArrayList", "<", "CmsSiteMatcher", ">", "(", "m_siteMatcherSites", ".", "keySet", "(", ")", ")", ")", ";", "}" ]
Sets the class member variables {@link #m_siteMatcherSites} and {@link #m_siteMatchers} from the provided map of configured site matchers.<p> @param siteMatcherSites the site matches to set
[ "Sets", "the", "class", "member", "variables", "{", "@link", "#m_siteMatcherSites", "}", "and", "{", "@link", "#m_siteMatchers", "}", "from", "the", "provided", "map", "of", "configured", "site", "matchers", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1802-L1806
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.cMul
public static void cMul(double a, double b, double c, double d, double[] results) { """ Performs a complex multiplication @param a the real part of the first number @param b the imaginary part of the first number @param c the real part of the second number @param d the imaginary part of the second number @param results an array to store the real and imaginary results in. First index is the real, 2nd is the imaginary. """ results[0] = a*c-b*d; results[1] = b*c+a*d; }
java
public static void cMul(double a, double b, double c, double d, double[] results) { results[0] = a*c-b*d; results[1] = b*c+a*d; }
[ "public", "static", "void", "cMul", "(", "double", "a", ",", "double", "b", ",", "double", "c", ",", "double", "d", ",", "double", "[", "]", "results", ")", "{", "results", "[", "0", "]", "=", "a", "*", "c", "-", "b", "*", "d", ";", "results", "[", "1", "]", "=", "b", "*", "c", "+", "a", "*", "d", ";", "}" ]
Performs a complex multiplication @param a the real part of the first number @param b the imaginary part of the first number @param c the real part of the second number @param d the imaginary part of the second number @param results an array to store the real and imaginary results in. First index is the real, 2nd is the imaginary.
[ "Performs", "a", "complex", "multiplication" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L145-L149
Harium/keel
src/main/java/com/harium/keel/catalano/math/function/Bessel.java
Bessel.Y
public static double Y(int n, double x) { """ Bessel function of the second kind, of order n. @param n Order. @param x Value. @return Y value. """ double by, bym, byp, tox; if (n == 0) return Y0(x); if (n == 1) return Y(x); tox = 2.0 / x; by = Y(x); bym = Y0(x); for (int j = 1; j < n; j++) { byp = j * tox * by - bym; bym = by; by = byp; } return by; }
java
public static double Y(int n, double x) { double by, bym, byp, tox; if (n == 0) return Y0(x); if (n == 1) return Y(x); tox = 2.0 / x; by = Y(x); bym = Y0(x); for (int j = 1; j < n; j++) { byp = j * tox * by - bym; bym = by; by = byp; } return by; }
[ "public", "static", "double", "Y", "(", "int", "n", ",", "double", "x", ")", "{", "double", "by", ",", "bym", ",", "byp", ",", "tox", ";", "if", "(", "n", "==", "0", ")", "return", "Y0", "(", "x", ")", ";", "if", "(", "n", "==", "1", ")", "return", "Y", "(", "x", ")", ";", "tox", "=", "2.0", "/", "x", ";", "by", "=", "Y", "(", "x", ")", ";", "bym", "=", "Y0", "(", "x", ")", ";", "for", "(", "int", "j", "=", "1", ";", "j", "<", "n", ";", "j", "++", ")", "{", "byp", "=", "j", "*", "tox", "*", "by", "-", "bym", ";", "bym", "=", "by", ";", "by", "=", "byp", ";", "}", "return", "by", ";", "}" ]
Bessel function of the second kind, of order n. @param n Order. @param x Value. @return Y value.
[ "Bessel", "function", "of", "the", "second", "kind", "of", "order", "n", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Bessel.java#L253-L268
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationnegotiatepolicy_binding.java
authenticationnegotiatepolicy_binding.get
public static authenticationnegotiatepolicy_binding get(nitro_service service, String name) throws Exception { """ Use this API to fetch authenticationnegotiatepolicy_binding resource of given name . """ authenticationnegotiatepolicy_binding obj = new authenticationnegotiatepolicy_binding(); obj.set_name(name); authenticationnegotiatepolicy_binding response = (authenticationnegotiatepolicy_binding) obj.get_resource(service); return response; }
java
public static authenticationnegotiatepolicy_binding get(nitro_service service, String name) throws Exception{ authenticationnegotiatepolicy_binding obj = new authenticationnegotiatepolicy_binding(); obj.set_name(name); authenticationnegotiatepolicy_binding response = (authenticationnegotiatepolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "authenticationnegotiatepolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authenticationnegotiatepolicy_binding", "obj", "=", "new", "authenticationnegotiatepolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "authenticationnegotiatepolicy_binding", "response", "=", "(", "authenticationnegotiatepolicy_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch authenticationnegotiatepolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "authenticationnegotiatepolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationnegotiatepolicy_binding.java#L103-L108
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/io/socket/SocketUtils.java
SocketUtils.findAvailableTcpPort
public static int findAvailableTcpPort(int minPortRange, int maxPortRange) { """ Finds an available TCP port. @param minPortRange The minimum port range @param maxPortRange The maximum port range @return The available port """ ArgumentUtils.check(() -> minPortRange > MIN_PORT_RANGE) .orElseFail("Port minimum value must be greater than " + MIN_PORT_RANGE); ArgumentUtils.check(() -> maxPortRange >= minPortRange) .orElseFail("Max port range must be greater than minimum port range"); ArgumentUtils.check(() -> maxPortRange <= MAX_PORT_RANGE) .orElseFail("Port maximum value must be less than " + MAX_PORT_RANGE); int currentPort = nextPort(minPortRange, maxPortRange); while (!isTcpPortAvailable(currentPort)) { currentPort = nextPort(minPortRange, maxPortRange); } return currentPort; }
java
public static int findAvailableTcpPort(int minPortRange, int maxPortRange) { ArgumentUtils.check(() -> minPortRange > MIN_PORT_RANGE) .orElseFail("Port minimum value must be greater than " + MIN_PORT_RANGE); ArgumentUtils.check(() -> maxPortRange >= minPortRange) .orElseFail("Max port range must be greater than minimum port range"); ArgumentUtils.check(() -> maxPortRange <= MAX_PORT_RANGE) .orElseFail("Port maximum value must be less than " + MAX_PORT_RANGE); int currentPort = nextPort(minPortRange, maxPortRange); while (!isTcpPortAvailable(currentPort)) { currentPort = nextPort(minPortRange, maxPortRange); } return currentPort; }
[ "public", "static", "int", "findAvailableTcpPort", "(", "int", "minPortRange", ",", "int", "maxPortRange", ")", "{", "ArgumentUtils", ".", "check", "(", "(", ")", "->", "minPortRange", ">", "MIN_PORT_RANGE", ")", ".", "orElseFail", "(", "\"Port minimum value must be greater than \"", "+", "MIN_PORT_RANGE", ")", ";", "ArgumentUtils", ".", "check", "(", "(", ")", "->", "maxPortRange", ">=", "minPortRange", ")", ".", "orElseFail", "(", "\"Max port range must be greater than minimum port range\"", ")", ";", "ArgumentUtils", ".", "check", "(", "(", ")", "->", "maxPortRange", "<=", "MAX_PORT_RANGE", ")", ".", "orElseFail", "(", "\"Port maximum value must be less than \"", "+", "MAX_PORT_RANGE", ")", ";", "int", "currentPort", "=", "nextPort", "(", "minPortRange", ",", "maxPortRange", ")", ";", "while", "(", "!", "isTcpPortAvailable", "(", "currentPort", ")", ")", "{", "currentPort", "=", "nextPort", "(", "minPortRange", ",", "maxPortRange", ")", ";", "}", "return", "currentPort", ";", "}" ]
Finds an available TCP port. @param minPortRange The minimum port range @param maxPortRange The maximum port range @return The available port
[ "Finds", "an", "available", "TCP", "port", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/io/socket/SocketUtils.java#L67-L80
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/BundleWriter.java
BundleWriter.flushBuffer
private void flushBuffer(ByteBuffer buffer, WritableByteChannel output) throws IOException { """ Flush the current write buffer to disk. @param buffer Buffer to write @param output Output channel @throws IOException on IO errors """ buffer.flip(); output.write(buffer); buffer.flip(); buffer.limit(buffer.capacity()); }
java
private void flushBuffer(ByteBuffer buffer, WritableByteChannel output) throws IOException { buffer.flip(); output.write(buffer); buffer.flip(); buffer.limit(buffer.capacity()); }
[ "private", "void", "flushBuffer", "(", "ByteBuffer", "buffer", ",", "WritableByteChannel", "output", ")", "throws", "IOException", "{", "buffer", ".", "flip", "(", ")", ";", "output", ".", "write", "(", "buffer", ")", ";", "buffer", ".", "flip", "(", ")", ";", "buffer", ".", "limit", "(", "buffer", ".", "capacity", "(", ")", ")", ";", "}" ]
Flush the current write buffer to disk. @param buffer Buffer to write @param output Output channel @throws IOException on IO errors
[ "Flush", "the", "current", "write", "buffer", "to", "disk", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/BundleWriter.java#L126-L131
alkacon/opencms-core
src/org/opencms/ui/apps/CmsWorkplaceAppManager.java
CmsWorkplaceAppManager.getEditorForResource
public I_CmsEditor getEditorForResource(CmsResource resource, boolean plainText) { """ Returns the editor for the given resource.<p> @param resource the resource to edit @param plainText if plain text editing is required @return the editor """ List<I_CmsEditor> editors = new ArrayList<I_CmsEditor>(); for (int i = 0; i < EDITORS.length; i++) { if (EDITORS[i].matchesResource(resource, plainText)) { editors.add(EDITORS[i]); } } I_CmsEditor result = null; if (editors.size() == 1) { result = editors.get(0); } else if (editors.size() > 1) { Collections.sort(editors, new Comparator<I_CmsEditor>() { public int compare(I_CmsEditor o1, I_CmsEditor o2) { return o1.getPriority() > o2.getPriority() ? -1 : 1; } }); result = editors.get(0); } return result; }
java
public I_CmsEditor getEditorForResource(CmsResource resource, boolean plainText) { List<I_CmsEditor> editors = new ArrayList<I_CmsEditor>(); for (int i = 0; i < EDITORS.length; i++) { if (EDITORS[i].matchesResource(resource, plainText)) { editors.add(EDITORS[i]); } } I_CmsEditor result = null; if (editors.size() == 1) { result = editors.get(0); } else if (editors.size() > 1) { Collections.sort(editors, new Comparator<I_CmsEditor>() { public int compare(I_CmsEditor o1, I_CmsEditor o2) { return o1.getPriority() > o2.getPriority() ? -1 : 1; } }); result = editors.get(0); } return result; }
[ "public", "I_CmsEditor", "getEditorForResource", "(", "CmsResource", "resource", ",", "boolean", "plainText", ")", "{", "List", "<", "I_CmsEditor", ">", "editors", "=", "new", "ArrayList", "<", "I_CmsEditor", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "EDITORS", ".", "length", ";", "i", "++", ")", "{", "if", "(", "EDITORS", "[", "i", "]", ".", "matchesResource", "(", "resource", ",", "plainText", ")", ")", "{", "editors", ".", "add", "(", "EDITORS", "[", "i", "]", ")", ";", "}", "}", "I_CmsEditor", "result", "=", "null", ";", "if", "(", "editors", ".", "size", "(", ")", "==", "1", ")", "{", "result", "=", "editors", ".", "get", "(", "0", ")", ";", "}", "else", "if", "(", "editors", ".", "size", "(", ")", ">", "1", ")", "{", "Collections", ".", "sort", "(", "editors", ",", "new", "Comparator", "<", "I_CmsEditor", ">", "(", ")", "{", "public", "int", "compare", "(", "I_CmsEditor", "o1", ",", "I_CmsEditor", "o2", ")", "{", "return", "o1", ".", "getPriority", "(", ")", ">", "o2", ".", "getPriority", "(", ")", "?", "-", "1", ":", "1", ";", "}", "}", ")", ";", "result", "=", "editors", ".", "get", "(", "0", ")", ";", "}", "return", "result", ";", "}" ]
Returns the editor for the given resource.<p> @param resource the resource to edit @param plainText if plain text editing is required @return the editor
[ "Returns", "the", "editor", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsWorkplaceAppManager.java#L467-L489
super-csv/super-csv
super-csv/src/main/java/org/supercsv/exception/SuperCsvCellProcessorException.java
SuperCsvCellProcessorException.getUnexpectedTypeMessage
private static String getUnexpectedTypeMessage(final Class<?> expectedType, final Object actualValue) { """ Assembles the exception message when the value received by a CellProcessor isn't of the correct type. @param expectedType the expected type @param actualValue the value received by the CellProcessor @return the message @throws NullPointerException if expectedType is null """ if( expectedType == null ) { throw new NullPointerException("expectedType should not be null"); } String expectedClassName = expectedType.getName(); String actualClassName = (actualValue != null) ? actualValue.getClass().getName() : "null"; return String.format("the input value should be of type %s but is %s", expectedClassName, actualClassName); }
java
private static String getUnexpectedTypeMessage(final Class<?> expectedType, final Object actualValue) { if( expectedType == null ) { throw new NullPointerException("expectedType should not be null"); } String expectedClassName = expectedType.getName(); String actualClassName = (actualValue != null) ? actualValue.getClass().getName() : "null"; return String.format("the input value should be of type %s but is %s", expectedClassName, actualClassName); }
[ "private", "static", "String", "getUnexpectedTypeMessage", "(", "final", "Class", "<", "?", ">", "expectedType", ",", "final", "Object", "actualValue", ")", "{", "if", "(", "expectedType", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"expectedType should not be null\"", ")", ";", "}", "String", "expectedClassName", "=", "expectedType", ".", "getName", "(", ")", ";", "String", "actualClassName", "=", "(", "actualValue", "!=", "null", ")", "?", "actualValue", ".", "getClass", "(", ")", ".", "getName", "(", ")", ":", "\"null\"", ";", "return", "String", ".", "format", "(", "\"the input value should be of type %s but is %s\"", ",", "expectedClassName", ",", "actualClassName", ")", ";", "}" ]
Assembles the exception message when the value received by a CellProcessor isn't of the correct type. @param expectedType the expected type @param actualValue the value received by the CellProcessor @return the message @throws NullPointerException if expectedType is null
[ "Assembles", "the", "exception", "message", "when", "the", "value", "received", "by", "a", "CellProcessor", "isn", "t", "of", "the", "correct", "type", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/exception/SuperCsvCellProcessorException.java#L97-L104
apache/flink
flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java
AbstractCloseableRegistry.unregisterCloseable
public final boolean unregisterCloseable(C closeable) { """ Removes a {@link Closeable} from the registry. @param closeable instance to remove from the registry. @return true if the closeable was previously registered and became unregistered through this call. """ if (null == closeable) { return false; } synchronized (getSynchronizationLock()) { return doUnRegister(closeable, closeableToRef); } }
java
public final boolean unregisterCloseable(C closeable) { if (null == closeable) { return false; } synchronized (getSynchronizationLock()) { return doUnRegister(closeable, closeableToRef); } }
[ "public", "final", "boolean", "unregisterCloseable", "(", "C", "closeable", ")", "{", "if", "(", "null", "==", "closeable", ")", "{", "return", "false", ";", "}", "synchronized", "(", "getSynchronizationLock", "(", ")", ")", "{", "return", "doUnRegister", "(", "closeable", ",", "closeableToRef", ")", ";", "}", "}" ]
Removes a {@link Closeable} from the registry. @param closeable instance to remove from the registry. @return true if the closeable was previously registered and became unregistered through this call.
[ "Removes", "a", "{", "@link", "Closeable", "}", "from", "the", "registry", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java#L94-L103
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java
BoxApiBookmark.getRenameRequest
public BoxRequestsBookmark.UpdateBookmark getRenameRequest(String id, String newName) { """ Gets a request that renames a bookmark @param id id of bookmark to rename @param newName id of bookmark to retrieve info on @return request to rename a bookmark """ BoxRequestsBookmark.UpdateBookmark request = new BoxRequestsBookmark.UpdateBookmark(id, getBookmarkInfoUrl(id), mSession); request.setName(newName); return request; }
java
public BoxRequestsBookmark.UpdateBookmark getRenameRequest(String id, String newName) { BoxRequestsBookmark.UpdateBookmark request = new BoxRequestsBookmark.UpdateBookmark(id, getBookmarkInfoUrl(id), mSession); request.setName(newName); return request; }
[ "public", "BoxRequestsBookmark", ".", "UpdateBookmark", "getRenameRequest", "(", "String", "id", ",", "String", "newName", ")", "{", "BoxRequestsBookmark", ".", "UpdateBookmark", "request", "=", "new", "BoxRequestsBookmark", ".", "UpdateBookmark", "(", "id", ",", "getBookmarkInfoUrl", "(", "id", ")", ",", "mSession", ")", ";", "request", ".", "setName", "(", "newName", ")", ";", "return", "request", ";", "}" ]
Gets a request that renames a bookmark @param id id of bookmark to rename @param newName id of bookmark to retrieve info on @return request to rename a bookmark
[ "Gets", "a", "request", "that", "renames", "a", "bookmark" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L120-L124
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java
CassandraSchemaManager.onSetComment
private void onSetComment(CfDef cfDef, Properties cfProperties, StringBuilder builder) { """ On set comment. @param cfDef the cf def @param cfProperties the cf properties @param builder the builder """ String comment = cfProperties.getProperty(CassandraConstants.COMMENT); if (comment != null) { if (builder != null) { String comment_Str = CQLTranslator.getKeyword(CassandraConstants.COMMENT); builder.append(comment_Str); builder.append(CQLTranslator.EQ_CLAUSE); builder.append(CQLTranslator.QUOTE_STR); builder.append(comment); builder.append(CQLTranslator.QUOTE_STR); builder.append(CQLTranslator.AND_CLAUSE); } else { cfDef.setComment(comment); } } }
java
private void onSetComment(CfDef cfDef, Properties cfProperties, StringBuilder builder) { String comment = cfProperties.getProperty(CassandraConstants.COMMENT); if (comment != null) { if (builder != null) { String comment_Str = CQLTranslator.getKeyword(CassandraConstants.COMMENT); builder.append(comment_Str); builder.append(CQLTranslator.EQ_CLAUSE); builder.append(CQLTranslator.QUOTE_STR); builder.append(comment); builder.append(CQLTranslator.QUOTE_STR); builder.append(CQLTranslator.AND_CLAUSE); } else { cfDef.setComment(comment); } } }
[ "private", "void", "onSetComment", "(", "CfDef", "cfDef", ",", "Properties", "cfProperties", ",", "StringBuilder", "builder", ")", "{", "String", "comment", "=", "cfProperties", ".", "getProperty", "(", "CassandraConstants", ".", "COMMENT", ")", ";", "if", "(", "comment", "!=", "null", ")", "{", "if", "(", "builder", "!=", "null", ")", "{", "String", "comment_Str", "=", "CQLTranslator", ".", "getKeyword", "(", "CassandraConstants", ".", "COMMENT", ")", ";", "builder", ".", "append", "(", "comment_Str", ")", ";", "builder", ".", "append", "(", "CQLTranslator", ".", "EQ_CLAUSE", ")", ";", "builder", ".", "append", "(", "CQLTranslator", ".", "QUOTE_STR", ")", ";", "builder", ".", "append", "(", "comment", ")", ";", "builder", ".", "append", "(", "CQLTranslator", ".", "QUOTE_STR", ")", ";", "builder", ".", "append", "(", "CQLTranslator", ".", "AND_CLAUSE", ")", ";", "}", "else", "{", "cfDef", ".", "setComment", "(", "comment", ")", ";", "}", "}", "}" ]
On set comment. @param cfDef the cf def @param cfProperties the cf properties @param builder the builder
[ "On", "set", "comment", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2564-L2585
feroult/yawp
yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java
ResourceFinder.mapAvailableStrings
public Map<String, String> mapAvailableStrings(String uri) throws IOException { """ Reads the contents of all non-directory URLs immediately under the specified location and returns them in a map keyed by the file name. <p/> Individual URLs that cannot be read are skipped and added to the list of 'resourcesNotLoaded' <p/> Example classpath: <p/> META-INF/serializables/one META-INF/serializables/two # not readable META-INF/serializables/three META-INF/serializables/four/foo.txt <p/> ResourceFinder finder = new ResourceFinder("META-INF/"); Map map = finder.mapAvailableStrings("serializables"); map.contains("one"); // true map.contains("two"); // false map.contains("three"); // true map.contains("four"); // false @param uri @return a list of the content of each resource URL found @throws IOException if classLoader.getResources throws an exception """ resourcesNotLoaded.clear(); Map<String, String> strings = new HashMap<>(); Map<String, URL> resourcesMap = getResourcesMap(uri); for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String name = (String) entry.getKey(); URL url = (URL) entry.getValue(); try { String value = readContents(url); strings.put(name, value); } catch (IOException notAvailable) { resourcesNotLoaded.add(url.toExternalForm()); } } return strings; }
java
public Map<String, String> mapAvailableStrings(String uri) throws IOException { resourcesNotLoaded.clear(); Map<String, String> strings = new HashMap<>(); Map<String, URL> resourcesMap = getResourcesMap(uri); for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String name = (String) entry.getKey(); URL url = (URL) entry.getValue(); try { String value = readContents(url); strings.put(name, value); } catch (IOException notAvailable) { resourcesNotLoaded.add(url.toExternalForm()); } } return strings; }
[ "public", "Map", "<", "String", ",", "String", ">", "mapAvailableStrings", "(", "String", "uri", ")", "throws", "IOException", "{", "resourcesNotLoaded", ".", "clear", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "strings", "=", "new", "HashMap", "<>", "(", ")", ";", "Map", "<", "String", ",", "URL", ">", "resourcesMap", "=", "getResourcesMap", "(", "uri", ")", ";", "for", "(", "Iterator", "iterator", "=", "resourcesMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iterator", ".", "next", "(", ")", ";", "String", "name", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "URL", "url", "=", "(", "URL", ")", "entry", ".", "getValue", "(", ")", ";", "try", "{", "String", "value", "=", "readContents", "(", "url", ")", ";", "strings", ".", "put", "(", "name", ",", "value", ")", ";", "}", "catch", "(", "IOException", "notAvailable", ")", "{", "resourcesNotLoaded", ".", "add", "(", "url", ".", "toExternalForm", "(", ")", ")", ";", "}", "}", "return", "strings", ";", "}" ]
Reads the contents of all non-directory URLs immediately under the specified location and returns them in a map keyed by the file name. <p/> Individual URLs that cannot be read are skipped and added to the list of 'resourcesNotLoaded' <p/> Example classpath: <p/> META-INF/serializables/one META-INF/serializables/two # not readable META-INF/serializables/three META-INF/serializables/four/foo.txt <p/> ResourceFinder finder = new ResourceFinder("META-INF/"); Map map = finder.mapAvailableStrings("serializables"); map.contains("one"); // true map.contains("two"); // false map.contains("three"); // true map.contains("four"); // false @param uri @return a list of the content of each resource URL found @throws IOException if classLoader.getResources throws an exception
[ "Reads", "the", "contents", "of", "all", "non", "-", "directory", "URLs", "immediately", "under", "the", "specified", "location", "and", "returns", "them", "in", "a", "map", "keyed", "by", "the", "file", "name", ".", "<p", "/", ">", "Individual", "URLs", "that", "cannot", "be", "read", "are", "skipped", "and", "added", "to", "the", "list", "of", "resourcesNotLoaded", "<p", "/", ">", "Example", "classpath", ":", "<p", "/", ">", "META", "-", "INF", "/", "serializables", "/", "one", "META", "-", "INF", "/", "serializables", "/", "two", "#", "not", "readable", "META", "-", "INF", "/", "serializables", "/", "three", "META", "-", "INF", "/", "serializables", "/", "four", "/", "foo", ".", "txt", "<p", "/", ">", "ResourceFinder", "finder", "=", "new", "ResourceFinder", "(", "META", "-", "INF", "/", ")", ";", "Map", "map", "=", "finder", ".", "mapAvailableStrings", "(", "serializables", ")", ";", "map", ".", "contains", "(", "one", ")", ";", "//", "true", "map", ".", "contains", "(", "two", ")", ";", "//", "false", "map", ".", "contains", "(", "three", ")", ";", "//", "true", "map", ".", "contains", "(", "four", ")", ";", "//", "false" ]
train
https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java#L273-L289
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/grails/orm/HibernateCriteriaBuilder.java
HibernateCriteriaBuilder.createAlias
public Criteria createAlias(String associationPath, String alias, int joinType) { """ Join an association using the specified join-type, assigning an alias to the joined association. The joinType is expected to be one of CriteriaSpecification.INNER_JOIN (the default), CriteriaSpecificationFULL_JOIN, or CriteriaSpecificationLEFT_JOIN. @param associationPath A dot-seperated property path @param alias The alias to assign to the joined association (for later reference). @param joinType The type of join to use. @return this (for method chaining) @throws HibernateException Indicates a problem creating the sub criteria @see #createAlias(String, String) """ return criteria.createAlias(associationPath, alias, JoinType.parse(joinType)); }
java
public Criteria createAlias(String associationPath, String alias, int joinType) { return criteria.createAlias(associationPath, alias, JoinType.parse(joinType)); }
[ "public", "Criteria", "createAlias", "(", "String", "associationPath", ",", "String", "alias", ",", "int", "joinType", ")", "{", "return", "criteria", ".", "createAlias", "(", "associationPath", ",", "alias", ",", "JoinType", ".", "parse", "(", "joinType", ")", ")", ";", "}" ]
Join an association using the specified join-type, assigning an alias to the joined association. The joinType is expected to be one of CriteriaSpecification.INNER_JOIN (the default), CriteriaSpecificationFULL_JOIN, or CriteriaSpecificationLEFT_JOIN. @param associationPath A dot-seperated property path @param alias The alias to assign to the joined association (for later reference). @param joinType The type of join to use. @return this (for method chaining) @throws HibernateException Indicates a problem creating the sub criteria @see #createAlias(String, String)
[ "Join", "an", "association", "using", "the", "specified", "join", "-", "type", "assigning", "an", "alias", "to", "the", "joined", "association", ".", "The", "joinType", "is", "expected", "to", "be", "one", "of", "CriteriaSpecification", ".", "INNER_JOIN", "(", "the", "default", ")", "CriteriaSpecificationFULL_JOIN", "or", "CriteriaSpecificationLEFT_JOIN", "." ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/grails/orm/HibernateCriteriaBuilder.java#L139-L141
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/LonePairElectronChecker.java
LonePairElectronChecker.isSaturated
public boolean isSaturated(IAtom atom, IAtomContainer ac) throws CDKException { """ Checks if an Atom is saturated their lone pair electrons by comparing it with known AtomTypes. @return True, if it's right saturated """ createAtomTypeFactory(ac.getBuilder()); IAtomType atomType = factory.getAtomType(atom.getAtomTypeName()); int lpCount = (Integer) atomType.getProperty(CDKConstants.LONE_PAIR_COUNT); int foundLPCount = ac.getConnectedLonePairsCount(atom); return foundLPCount >= lpCount; }
java
public boolean isSaturated(IAtom atom, IAtomContainer ac) throws CDKException { createAtomTypeFactory(ac.getBuilder()); IAtomType atomType = factory.getAtomType(atom.getAtomTypeName()); int lpCount = (Integer) atomType.getProperty(CDKConstants.LONE_PAIR_COUNT); int foundLPCount = ac.getConnectedLonePairsCount(atom); return foundLPCount >= lpCount; }
[ "public", "boolean", "isSaturated", "(", "IAtom", "atom", ",", "IAtomContainer", "ac", ")", "throws", "CDKException", "{", "createAtomTypeFactory", "(", "ac", ".", "getBuilder", "(", ")", ")", ";", "IAtomType", "atomType", "=", "factory", ".", "getAtomType", "(", "atom", ".", "getAtomTypeName", "(", ")", ")", ";", "int", "lpCount", "=", "(", "Integer", ")", "atomType", ".", "getProperty", "(", "CDKConstants", ".", "LONE_PAIR_COUNT", ")", ";", "int", "foundLPCount", "=", "ac", ".", "getConnectedLonePairsCount", "(", "atom", ")", ";", "return", "foundLPCount", ">=", "lpCount", ";", "}" ]
Checks if an Atom is saturated their lone pair electrons by comparing it with known AtomTypes. @return True, if it's right saturated
[ "Checks", "if", "an", "Atom", "is", "saturated", "their", "lone", "pair", "electrons", "by", "comparing", "it", "with", "known", "AtomTypes", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/LonePairElectronChecker.java#L80-L86
samskivert/samskivert
src/main/java/com/samskivert/util/PropertiesUtil.java
PropertiesUtil.getSubProperties
public static Properties getSubProperties (Properties source, String prefix) { """ Extracts all properties from the supplied properties object with the specified prefix, removes the prefix from the key for those properties and inserts them into a new properties object which is then returned. This is useful for extracting properties from a global configuration object that must be passed to a service that expects it's own private properties (JDBC for example). The property file might look like so: <pre> my_happy_param=my_happy_value ... jdbc.driver=foo.bar.Driver jdbc.url=jdbc://blahblah jdbc.username=bob jdbc.password=is your uncle ... my_happy_other_param=my_happy_other_value </pre> This can be supplied to <code>getSubProperties()</code> with a prefix of <code>"jdbc"</code> and the following properties would be returned: <pre> driver=foo.bar.Driver url=jdbc://blahblah username=bob password=is your uncle </pre> """ Properties dest = new Properties(); extractSubProperties(source, dest, prefix); return dest; }
java
public static Properties getSubProperties (Properties source, String prefix) { Properties dest = new Properties(); extractSubProperties(source, dest, prefix); return dest; }
[ "public", "static", "Properties", "getSubProperties", "(", "Properties", "source", ",", "String", "prefix", ")", "{", "Properties", "dest", "=", "new", "Properties", "(", ")", ";", "extractSubProperties", "(", "source", ",", "dest", ",", "prefix", ")", ";", "return", "dest", ";", "}" ]
Extracts all properties from the supplied properties object with the specified prefix, removes the prefix from the key for those properties and inserts them into a new properties object which is then returned. This is useful for extracting properties from a global configuration object that must be passed to a service that expects it's own private properties (JDBC for example). The property file might look like so: <pre> my_happy_param=my_happy_value ... jdbc.driver=foo.bar.Driver jdbc.url=jdbc://blahblah jdbc.username=bob jdbc.password=is your uncle ... my_happy_other_param=my_happy_other_value </pre> This can be supplied to <code>getSubProperties()</code> with a prefix of <code>"jdbc"</code> and the following properties would be returned: <pre> driver=foo.bar.Driver url=jdbc://blahblah username=bob password=is your uncle </pre>
[ "Extracts", "all", "properties", "from", "the", "supplied", "properties", "object", "with", "the", "specified", "prefix", "removes", "the", "prefix", "from", "the", "key", "for", "those", "properties", "and", "inserts", "them", "into", "a", "new", "properties", "object", "which", "is", "then", "returned", ".", "This", "is", "useful", "for", "extracting", "properties", "from", "a", "global", "configuration", "object", "that", "must", "be", "passed", "to", "a", "service", "that", "expects", "it", "s", "own", "private", "properties", "(", "JDBC", "for", "example", ")", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PropertiesUtil.java#L53-L58
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/EntityDTO.java
EntityDTO.createDtoObject
public static <D extends EntityDTO, E extends JPAEntity> D createDtoObject(Class<D> clazz, E entity) { """ Creates BaseDto object and copies properties from entity object. @param <D> BaseDto object type. @param <E> Entity type. @param clazz BaseDto entity class. @param entity entity object. @return BaseDto object. @throws WebApplicationException The exception with 500 status will be thrown. """ D result = null; try { result = clazz.newInstance(); BeanUtils.copyProperties(result, entity); // Now set IDs of JPA entity result.setCreatedById(entity.getCreatedBy() != null ? entity.getCreatedBy().getId() : null); result.setModifiedById(entity.getModifiedBy() != null ? entity.getModifiedBy().getId() : null); } catch (Exception ex) { throw new WebApplicationException("DTO transformation failed.", Status.INTERNAL_SERVER_ERROR); } return result; }
java
public static <D extends EntityDTO, E extends JPAEntity> D createDtoObject(Class<D> clazz, E entity) { D result = null; try { result = clazz.newInstance(); BeanUtils.copyProperties(result, entity); // Now set IDs of JPA entity result.setCreatedById(entity.getCreatedBy() != null ? entity.getCreatedBy().getId() : null); result.setModifiedById(entity.getModifiedBy() != null ? entity.getModifiedBy().getId() : null); } catch (Exception ex) { throw new WebApplicationException("DTO transformation failed.", Status.INTERNAL_SERVER_ERROR); } return result; }
[ "public", "static", "<", "D", "extends", "EntityDTO", ",", "E", "extends", "JPAEntity", ">", "D", "createDtoObject", "(", "Class", "<", "D", ">", "clazz", ",", "E", "entity", ")", "{", "D", "result", "=", "null", ";", "try", "{", "result", "=", "clazz", ".", "newInstance", "(", ")", ";", "BeanUtils", ".", "copyProperties", "(", "result", ",", "entity", ")", ";", "// Now set IDs of JPA entity", "result", ".", "setCreatedById", "(", "entity", ".", "getCreatedBy", "(", ")", "!=", "null", "?", "entity", ".", "getCreatedBy", "(", ")", ".", "getId", "(", ")", ":", "null", ")", ";", "result", ".", "setModifiedById", "(", "entity", ".", "getModifiedBy", "(", ")", "!=", "null", "?", "entity", ".", "getModifiedBy", "(", ")", ".", "getId", "(", ")", ":", "null", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "WebApplicationException", "(", "\"DTO transformation failed.\"", ",", "Status", ".", "INTERNAL_SERVER_ERROR", ")", ";", "}", "return", "result", ";", "}" ]
Creates BaseDto object and copies properties from entity object. @param <D> BaseDto object type. @param <E> Entity type. @param clazz BaseDto entity class. @param entity entity object. @return BaseDto object. @throws WebApplicationException The exception with 500 status will be thrown.
[ "Creates", "BaseDto", "object", "and", "copies", "properties", "from", "entity", "object", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/EntityDTO.java#L72-L86
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_IsValidReason.java
ST_IsValidReason.isValidReason
public static String isValidReason(Geometry geometry, int flag) { """ Returns text stating whether a geometry is valid. If not, returns a reason why. @param geometry @param flag @return """ if (geometry != null) { if (flag == 0) { return validReason(geometry, false); } else if (flag == 1) { return validReason(geometry, true); } else { throw new IllegalArgumentException("Supported arguments are 0 or 1."); } } return "Null Geometry"; }
java
public static String isValidReason(Geometry geometry, int flag) { if (geometry != null) { if (flag == 0) { return validReason(geometry, false); } else if (flag == 1) { return validReason(geometry, true); } else { throw new IllegalArgumentException("Supported arguments are 0 or 1."); } } return "Null Geometry"; }
[ "public", "static", "String", "isValidReason", "(", "Geometry", "geometry", ",", "int", "flag", ")", "{", "if", "(", "geometry", "!=", "null", ")", "{", "if", "(", "flag", "==", "0", ")", "{", "return", "validReason", "(", "geometry", ",", "false", ")", ";", "}", "else", "if", "(", "flag", "==", "1", ")", "{", "return", "validReason", "(", "geometry", ",", "true", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Supported arguments are 0 or 1.\"", ")", ";", "}", "}", "return", "\"Null Geometry\"", ";", "}" ]
Returns text stating whether a geometry is valid. If not, returns a reason why. @param geometry @param flag @return
[ "Returns", "text", "stating", "whether", "a", "geometry", "is", "valid", ".", "If", "not", "returns", "a", "reason", "why", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_IsValidReason.java#L67-L78
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optBundle
@Nullable public static Bundle optBundle(@Nullable Bundle bundle, @Nullable String key) { """ Returns a optional {@link android.os.Bundle} value. In other words, returns the value mapped by key if it exists and is a {@link android.os.Bundle}. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @return a {@link android.os.Bundle} value if exists, null otherwise. @see android.os.Bundle#getBundle(String) """ return optBundle(bundle, key, new Bundle()); }
java
@Nullable public static Bundle optBundle(@Nullable Bundle bundle, @Nullable String key) { return optBundle(bundle, key, new Bundle()); }
[ "@", "Nullable", "public", "static", "Bundle", "optBundle", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optBundle", "(", "bundle", ",", "key", ",", "new", "Bundle", "(", ")", ")", ";", "}" ]
Returns a optional {@link android.os.Bundle} value. In other words, returns the value mapped by key if it exists and is a {@link android.os.Bundle}. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @return a {@link android.os.Bundle} value if exists, null otherwise. @see android.os.Bundle#getBundle(String)
[ "Returns", "a", "optional", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L183-L186
openbase/jul
pattern/default/src/main/java/org/openbase/jul/pattern/CompletableFutureLite.java
CompletableFutureLite.get
@Override public V get() throws InterruptedException, ExecutionException { """ Method blocks until the future is done. The method return the result if the future was normally completed. If the future was exceptionally completed or canceled an exception is thrown. @return the result of the task. @throws InterruptedException is thrown if the thread was externally interrupted. @throws ExecutionException is thrown if the task was canceled or exceptionally completed. """ synchronized (lock) { if (value != null) { return value; } lock.wait(); if (value != null) { return value; } if (throwable != null) { throw new ExecutionException(throwable); } throw new ExecutionException(new FatalImplementationErrorException("Not terminated after notification!", this)); } }
java
@Override public V get() throws InterruptedException, ExecutionException { synchronized (lock) { if (value != null) { return value; } lock.wait(); if (value != null) { return value; } if (throwable != null) { throw new ExecutionException(throwable); } throw new ExecutionException(new FatalImplementationErrorException("Not terminated after notification!", this)); } }
[ "@", "Override", "public", "V", "get", "(", ")", "throws", "InterruptedException", ",", "ExecutionException", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "lock", ".", "wait", "(", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "if", "(", "throwable", "!=", "null", ")", "{", "throw", "new", "ExecutionException", "(", "throwable", ")", ";", "}", "throw", "new", "ExecutionException", "(", "new", "FatalImplementationErrorException", "(", "\"Not terminated after notification!\"", ",", "this", ")", ")", ";", "}", "}" ]
Method blocks until the future is done. The method return the result if the future was normally completed. If the future was exceptionally completed or canceled an exception is thrown. @return the result of the task. @throws InterruptedException is thrown if the thread was externally interrupted. @throws ExecutionException is thrown if the task was canceled or exceptionally completed.
[ "Method", "blocks", "until", "the", "future", "is", "done", ".", "The", "method", "return", "the", "result", "if", "the", "future", "was", "normally", "completed", ".", "If", "the", "future", "was", "exceptionally", "completed", "or", "canceled", "an", "exception", "is", "thrown", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/pattern/default/src/main/java/org/openbase/jul/pattern/CompletableFutureLite.java#L150-L167
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.setMeta
public void setMeta(String photoId, String title, String description) throws FlickrException { """ Set the meta data for the photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param title The new title @param description The new description @throws FlickrException """ Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_META); parameters.put("photo_id", photoId); parameters.put("title", title); parameters.put("description", description); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setMeta(String photoId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_META); parameters.put("photo_id", photoId); parameters.put("title", title); parameters.put("description", description); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setMeta", "(", "String", "photoId", ",", "String", "title", ",", "String", "description", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_META", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"title\"", ",", "title", ")", ";", "parameters", ".", "put", "(", "\"description\"", ",", "description", ")", ";", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Set the meta data for the photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param title The new title @param description The new description @throws FlickrException
[ "Set", "the", "meta", "data", "for", "the", "photo", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1201-L1213
tcurdt/jdeb
src/main/java/org/vafer/jdeb/ControlBuilder.java
ControlBuilder.createPackageControlFile
public BinaryPackageControlFile createPackageControlFile(File file, BigInteger pDataSize) throws IOException, ParseException { """ Creates a package control file from the specified file and adds the <tt>Date</tt>, <tt>Distribution</tt> and <tt>Urgency</tt> fields if missing. The <tt>Installed-Size</tt> field is also initialized to the actual size of the package. The <tt>Maintainer</tt> field is overridden by the <tt>DEBEMAIL</tt> and <tt>DEBFULLNAME</tt> environment variables if defined. @param file the control file @param pDataSize the size of the installed package """ FilteredFile controlFile = new FilteredFile(new FileInputStream(file), resolver); BinaryPackageControlFile packageControlFile = new BinaryPackageControlFile(controlFile.toString()); if (packageControlFile.get("Distribution") == null) { packageControlFile.set("Distribution", "unknown"); } if (packageControlFile.get("Urgency") == null) { packageControlFile.set("Urgency", "low"); } packageControlFile.set("Installed-Size", pDataSize.divide(BigInteger.valueOf(1024)).toString()); // override the Version if the DEBVERSION environment variable is defined final String debVersion = System.getenv("DEBVERSION"); if (debVersion != null) { packageControlFile.set("Version", debVersion); console.debug("Using version'" + debVersion + "' from the environment variables."); } // override the Maintainer field if the DEBFULLNAME and DEBEMAIL environment variables are defined final String debFullName = System.getenv("DEBFULLNAME"); final String debEmail = System.getenv("DEBEMAIL"); if (debFullName != null && debEmail != null) { final String maintainer = debFullName + " <" + debEmail + ">"; packageControlFile.set("Maintainer", maintainer); console.debug("Using maintainer '" + maintainer + "' from the environment variables."); } return packageControlFile; }
java
public BinaryPackageControlFile createPackageControlFile(File file, BigInteger pDataSize) throws IOException, ParseException { FilteredFile controlFile = new FilteredFile(new FileInputStream(file), resolver); BinaryPackageControlFile packageControlFile = new BinaryPackageControlFile(controlFile.toString()); if (packageControlFile.get("Distribution") == null) { packageControlFile.set("Distribution", "unknown"); } if (packageControlFile.get("Urgency") == null) { packageControlFile.set("Urgency", "low"); } packageControlFile.set("Installed-Size", pDataSize.divide(BigInteger.valueOf(1024)).toString()); // override the Version if the DEBVERSION environment variable is defined final String debVersion = System.getenv("DEBVERSION"); if (debVersion != null) { packageControlFile.set("Version", debVersion); console.debug("Using version'" + debVersion + "' from the environment variables."); } // override the Maintainer field if the DEBFULLNAME and DEBEMAIL environment variables are defined final String debFullName = System.getenv("DEBFULLNAME"); final String debEmail = System.getenv("DEBEMAIL"); if (debFullName != null && debEmail != null) { final String maintainer = debFullName + " <" + debEmail + ">"; packageControlFile.set("Maintainer", maintainer); console.debug("Using maintainer '" + maintainer + "' from the environment variables."); } return packageControlFile; }
[ "public", "BinaryPackageControlFile", "createPackageControlFile", "(", "File", "file", ",", "BigInteger", "pDataSize", ")", "throws", "IOException", ",", "ParseException", "{", "FilteredFile", "controlFile", "=", "new", "FilteredFile", "(", "new", "FileInputStream", "(", "file", ")", ",", "resolver", ")", ";", "BinaryPackageControlFile", "packageControlFile", "=", "new", "BinaryPackageControlFile", "(", "controlFile", ".", "toString", "(", ")", ")", ";", "if", "(", "packageControlFile", ".", "get", "(", "\"Distribution\"", ")", "==", "null", ")", "{", "packageControlFile", ".", "set", "(", "\"Distribution\"", ",", "\"unknown\"", ")", ";", "}", "if", "(", "packageControlFile", ".", "get", "(", "\"Urgency\"", ")", "==", "null", ")", "{", "packageControlFile", ".", "set", "(", "\"Urgency\"", ",", "\"low\"", ")", ";", "}", "packageControlFile", ".", "set", "(", "\"Installed-Size\"", ",", "pDataSize", ".", "divide", "(", "BigInteger", ".", "valueOf", "(", "1024", ")", ")", ".", "toString", "(", ")", ")", ";", "// override the Version if the DEBVERSION environment variable is defined", "final", "String", "debVersion", "=", "System", ".", "getenv", "(", "\"DEBVERSION\"", ")", ";", "if", "(", "debVersion", "!=", "null", ")", "{", "packageControlFile", ".", "set", "(", "\"Version\"", ",", "debVersion", ")", ";", "console", ".", "debug", "(", "\"Using version'\"", "+", "debVersion", "+", "\"' from the environment variables.\"", ")", ";", "}", "// override the Maintainer field if the DEBFULLNAME and DEBEMAIL environment variables are defined", "final", "String", "debFullName", "=", "System", ".", "getenv", "(", "\"DEBFULLNAME\"", ")", ";", "final", "String", "debEmail", "=", "System", ".", "getenv", "(", "\"DEBEMAIL\"", ")", ";", "if", "(", "debFullName", "!=", "null", "&&", "debEmail", "!=", "null", ")", "{", "final", "String", "maintainer", "=", "debFullName", "+", "\" <\"", "+", "debEmail", "+", "\">\"", ";", "packageControlFile", ".", "set", "(", "\"Maintainer\"", ",", "maintainer", ")", ";", "console", ".", "debug", "(", "\"Using maintainer '\"", "+", "maintainer", "+", "\"' from the environment variables.\"", ")", ";", "}", "return", "packageControlFile", ";", "}" ]
Creates a package control file from the specified file and adds the <tt>Date</tt>, <tt>Distribution</tt> and <tt>Urgency</tt> fields if missing. The <tt>Installed-Size</tt> field is also initialized to the actual size of the package. The <tt>Maintainer</tt> field is overridden by the <tt>DEBEMAIL</tt> and <tt>DEBFULLNAME</tt> environment variables if defined. @param file the control file @param pDataSize the size of the installed package
[ "Creates", "a", "package", "control", "file", "from", "the", "specified", "file", "and", "adds", "the", "<tt", ">", "Date<", "/", "tt", ">", "<tt", ">", "Distribution<", "/", "tt", ">", "and", "<tt", ">", "Urgency<", "/", "tt", ">", "fields", "if", "missing", ".", "The", "<tt", ">", "Installed", "-", "Size<", "/", "tt", ">", "field", "is", "also", "initialized", "to", "the", "actual", "size", "of", "the", "package", ".", "The", "<tt", ">", "Maintainer<", "/", "tt", ">", "field", "is", "overridden", "by", "the", "<tt", ">", "DEBEMAIL<", "/", "tt", ">", "and", "<tt", ">", "DEBFULLNAME<", "/", "tt", ">", "environment", "variables", "if", "defined", "." ]
train
https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/ControlBuilder.java#L173-L206
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java
VMCommandLine.saveVMParameters
@Inline(value = "VMCommandLine.saveVMParameters((($1) != null) ? ($1).getCanonicalName() : null, ($2))", imported = { """ Save parameters that permit to relaunch a VM with {@link #relaunchVM()}. @param classToLaunch is the class which contains a <code>main</code>. @param parameters is the parameters to pass to the <code>main</code>. """VMCommandLine.class}, statementExpression = true) public static void saveVMParameters(Class<?> classToLaunch, String... parameters) { saveVMParameters( (classToLaunch != null) ? classToLaunch.getCanonicalName() : null, parameters); }
java
@Inline(value = "VMCommandLine.saveVMParameters((($1) != null) ? ($1).getCanonicalName() : null, ($2))", imported = {VMCommandLine.class}, statementExpression = true) public static void saveVMParameters(Class<?> classToLaunch, String... parameters) { saveVMParameters( (classToLaunch != null) ? classToLaunch.getCanonicalName() : null, parameters); }
[ "@", "Inline", "(", "value", "=", "\"VMCommandLine.saveVMParameters((($1) != null) ? ($1).getCanonicalName() : null, ($2))\"", ",", "imported", "=", "{", "VMCommandLine", ".", "class", "}", ",", "statementExpression", "=", "true", ")", "public", "static", "void", "saveVMParameters", "(", "Class", "<", "?", ">", "classToLaunch", ",", "String", "...", "parameters", ")", "{", "saveVMParameters", "(", "(", "classToLaunch", "!=", "null", ")", "?", "classToLaunch", ".", "getCanonicalName", "(", ")", ":", "null", ",", "parameters", ")", ";", "}" ]
Save parameters that permit to relaunch a VM with {@link #relaunchVM()}. @param classToLaunch is the class which contains a <code>main</code>. @param parameters is the parameters to pass to the <code>main</code>.
[ "Save", "parameters", "that", "permit", "to", "relaunch", "a", "VM", "with", "{", "@link", "#relaunchVM", "()", "}", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L309-L316
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.serviceName_pca_pcaServiceName_PUT
public void serviceName_pca_pcaServiceName_PUT(String serviceName, String pcaServiceName, OvhAccount body) throws IOException { """ Alter this object properties REST: PUT /cloud/{serviceName}/pca/{pcaServiceName} @param body [required] New object properties @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @deprecated """ String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}"; StringBuilder sb = path(qPath, serviceName, pcaServiceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_pca_pcaServiceName_PUT(String serviceName, String pcaServiceName, OvhAccount body) throws IOException { String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}"; StringBuilder sb = path(qPath, serviceName, pcaServiceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_pca_pcaServiceName_PUT", "(", "String", "serviceName", ",", "String", "pcaServiceName", ",", "OvhAccount", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/{serviceName}/pca/{pcaServiceName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "pcaServiceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /cloud/{serviceName}/pca/{pcaServiceName} @param body [required] New object properties @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @deprecated
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2633-L2637
Stratio/bdt
src/main/java/com/stratio/qa/specs/CommonG.java
CommonG.replaceJSONPathElement
public String replaceJSONPathElement(String jsonString, String key, String value) { """ The function searches over the array by certain field value, and replaces occurences with the parameter provided. @param jsonString Original json object @param key Key to search @param value Value to replace key with """ return JsonPath.parse(jsonString).set(key, value).jsonString(); }
java
public String replaceJSONPathElement(String jsonString, String key, String value) { return JsonPath.parse(jsonString).set(key, value).jsonString(); }
[ "public", "String", "replaceJSONPathElement", "(", "String", "jsonString", ",", "String", "key", ",", "String", "value", ")", "{", "return", "JsonPath", ".", "parse", "(", "jsonString", ")", ".", "set", "(", "key", ",", "value", ")", ".", "jsonString", "(", ")", ";", "}" ]
The function searches over the array by certain field value, and replaces occurences with the parameter provided. @param jsonString Original json object @param key Key to search @param value Value to replace key with
[ "The", "function", "searches", "over", "the", "array", "by", "certain", "field", "value", "and", "replaces", "occurences", "with", "the", "parameter", "provided", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1927-L1929
gotev/android-upload-service
uploadservice/src/main/java/net/gotev/uploadservice/MultipartUploadRequest.java
MultipartUploadRequest.addFileToUpload
public MultipartUploadRequest addFileToUpload(final String path, final String parameterName, final String fileName) throws FileNotFoundException, IllegalArgumentException { """ Adds a file to this upload request, without setting the content type, which will be automatically detected from the file extension. If you want to manually set the content type, use {@link #addFileToUpload(String, String, String, String)}. @param path Absolute path to the file that you want to upload @param parameterName Name of the form parameter that will contain file's data @param fileName File name seen by the server side script. If null, the original file name will be used @return {@link MultipartUploadRequest} @throws FileNotFoundException if the file does not exist at the specified path @throws IllegalArgumentException if one or more parameters are not valid """ return addFileToUpload(path, parameterName, fileName, null); }
java
public MultipartUploadRequest addFileToUpload(final String path, final String parameterName, final String fileName) throws FileNotFoundException, IllegalArgumentException { return addFileToUpload(path, parameterName, fileName, null); }
[ "public", "MultipartUploadRequest", "addFileToUpload", "(", "final", "String", "path", ",", "final", "String", "parameterName", ",", "final", "String", "fileName", ")", "throws", "FileNotFoundException", ",", "IllegalArgumentException", "{", "return", "addFileToUpload", "(", "path", ",", "parameterName", ",", "fileName", ",", "null", ")", ";", "}" ]
Adds a file to this upload request, without setting the content type, which will be automatically detected from the file extension. If you want to manually set the content type, use {@link #addFileToUpload(String, String, String, String)}. @param path Absolute path to the file that you want to upload @param parameterName Name of the form parameter that will contain file's data @param fileName File name seen by the server side script. If null, the original file name will be used @return {@link MultipartUploadRequest} @throws FileNotFoundException if the file does not exist at the specified path @throws IllegalArgumentException if one or more parameters are not valid
[ "Adds", "a", "file", "to", "this", "upload", "request", "without", "setting", "the", "content", "type", "which", "will", "be", "automatically", "detected", "from", "the", "file", "extension", ".", "If", "you", "want", "to", "manually", "set", "the", "content", "type", "use", "{" ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/MultipartUploadRequest.java#L135-L139
google/closure-compiler
src/com/google/javascript/jscomp/TypeInferencePass.java
TypeInferencePass.process
@Override public void process(Node externsRoot, Node jsRoot) { """ Main entry point for type inference when running over the whole tree. @param externsRoot The root of the externs parse tree. @param jsRoot The root of the input parse tree to be checked. """ Node externsAndJs = jsRoot.getParent(); checkState(externsAndJs != null); checkState(externsRoot == null || externsAndJs.hasChild(externsRoot)); inferAllScopes(externsAndJs); }
java
@Override public void process(Node externsRoot, Node jsRoot) { Node externsAndJs = jsRoot.getParent(); checkState(externsAndJs != null); checkState(externsRoot == null || externsAndJs.hasChild(externsRoot)); inferAllScopes(externsAndJs); }
[ "@", "Override", "public", "void", "process", "(", "Node", "externsRoot", ",", "Node", "jsRoot", ")", "{", "Node", "externsAndJs", "=", "jsRoot", ".", "getParent", "(", ")", ";", "checkState", "(", "externsAndJs", "!=", "null", ")", ";", "checkState", "(", "externsRoot", "==", "null", "||", "externsAndJs", ".", "hasChild", "(", "externsRoot", ")", ")", ";", "inferAllScopes", "(", "externsAndJs", ")", ";", "}" ]
Main entry point for type inference when running over the whole tree. @param externsRoot The root of the externs parse tree. @param jsRoot The root of the input parse tree to be checked.
[ "Main", "entry", "point", "for", "type", "inference", "when", "running", "over", "the", "whole", "tree", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInferencePass.java#L61-L68
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java
CopyableFile.resolveReplicatedOwnerAndPermission
public static OwnerAndPermission resolveReplicatedOwnerAndPermission(FileSystem fs, Path path, CopyConfiguration copyConfiguration) throws IOException { """ Computes the correct {@link OwnerAndPermission} obtained from replicating source owner and permissions and applying the {@link PreserveAttributes} rules in copyConfiguration. @throws IOException """ PreserveAttributes preserve = copyConfiguration.getPreserve(); Optional<FileStatus> originFileStatus = copyConfiguration.getCopyContext().getFileStatus(fs, path); if (!originFileStatus.isPresent()) { throw new IOException(String.format("Origin path %s does not exist.", path)); } String group = null; if (copyConfiguration.getTargetGroup().isPresent()) { group = copyConfiguration.getTargetGroup().get(); } else if (preserve.preserve(Option.GROUP)) { group = originFileStatus.get().getGroup(); } return new OwnerAndPermission(preserve.preserve(Option.OWNER) ? originFileStatus.get().getOwner() : null, group, preserve.preserve(Option.PERMISSION) ? originFileStatus.get().getPermission() : null); }
java
public static OwnerAndPermission resolveReplicatedOwnerAndPermission(FileSystem fs, Path path, CopyConfiguration copyConfiguration) throws IOException { PreserveAttributes preserve = copyConfiguration.getPreserve(); Optional<FileStatus> originFileStatus = copyConfiguration.getCopyContext().getFileStatus(fs, path); if (!originFileStatus.isPresent()) { throw new IOException(String.format("Origin path %s does not exist.", path)); } String group = null; if (copyConfiguration.getTargetGroup().isPresent()) { group = copyConfiguration.getTargetGroup().get(); } else if (preserve.preserve(Option.GROUP)) { group = originFileStatus.get().getGroup(); } return new OwnerAndPermission(preserve.preserve(Option.OWNER) ? originFileStatus.get().getOwner() : null, group, preserve.preserve(Option.PERMISSION) ? originFileStatus.get().getPermission() : null); }
[ "public", "static", "OwnerAndPermission", "resolveReplicatedOwnerAndPermission", "(", "FileSystem", "fs", ",", "Path", "path", ",", "CopyConfiguration", "copyConfiguration", ")", "throws", "IOException", "{", "PreserveAttributes", "preserve", "=", "copyConfiguration", ".", "getPreserve", "(", ")", ";", "Optional", "<", "FileStatus", ">", "originFileStatus", "=", "copyConfiguration", ".", "getCopyContext", "(", ")", ".", "getFileStatus", "(", "fs", ",", "path", ")", ";", "if", "(", "!", "originFileStatus", ".", "isPresent", "(", ")", ")", "{", "throw", "new", "IOException", "(", "String", ".", "format", "(", "\"Origin path %s does not exist.\"", ",", "path", ")", ")", ";", "}", "String", "group", "=", "null", ";", "if", "(", "copyConfiguration", ".", "getTargetGroup", "(", ")", ".", "isPresent", "(", ")", ")", "{", "group", "=", "copyConfiguration", ".", "getTargetGroup", "(", ")", ".", "get", "(", ")", ";", "}", "else", "if", "(", "preserve", ".", "preserve", "(", "Option", ".", "GROUP", ")", ")", "{", "group", "=", "originFileStatus", ".", "get", "(", ")", ".", "getGroup", "(", ")", ";", "}", "return", "new", "OwnerAndPermission", "(", "preserve", ".", "preserve", "(", "Option", ".", "OWNER", ")", "?", "originFileStatus", ".", "get", "(", ")", ".", "getOwner", "(", ")", ":", "null", ",", "group", ",", "preserve", ".", "preserve", "(", "Option", ".", "PERMISSION", ")", "?", "originFileStatus", ".", "get", "(", ")", ".", "getPermission", "(", ")", ":", "null", ")", ";", "}" ]
Computes the correct {@link OwnerAndPermission} obtained from replicating source owner and permissions and applying the {@link PreserveAttributes} rules in copyConfiguration. @throws IOException
[ "Computes", "the", "correct", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java#L307-L326
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java
CPMeasurementUnitPersistenceImpl.removeByG_P_T
@Override public void removeByG_P_T(long groupId, boolean primary, int type) { """ Removes all the cp measurement units where groupId = &#63; and primary = &#63; and type = &#63; from the database. @param groupId the group ID @param primary the primary @param type the type """ for (CPMeasurementUnit cpMeasurementUnit : findByG_P_T(groupId, primary, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpMeasurementUnit); } }
java
@Override public void removeByG_P_T(long groupId, boolean primary, int type) { for (CPMeasurementUnit cpMeasurementUnit : findByG_P_T(groupId, primary, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpMeasurementUnit); } }
[ "@", "Override", "public", "void", "removeByG_P_T", "(", "long", "groupId", ",", "boolean", "primary", ",", "int", "type", ")", "{", "for", "(", "CPMeasurementUnit", "cpMeasurementUnit", ":", "findByG_P_T", "(", "groupId", ",", "primary", ",", "type", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "cpMeasurementUnit", ")", ";", "}", "}" ]
Removes all the cp measurement units where groupId = &#63; and primary = &#63; and type = &#63; from the database. @param groupId the group ID @param primary the primary @param type the type
[ "Removes", "all", "the", "cp", "measurement", "units", "where", "groupId", "=", "&#63", ";", "and", "primary", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L3328-L3334
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.onBackpressureBuffer
@CheckReturnValue @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded, Action onOverflow) { """ Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will signal a {@code BufferOverflowException} via {@code onError} as soon as the buffer's capacity is exceeded, dropping all undelivered items, canceling the source, and notifying the producer with {@code onOverflow}. <p> <img width="640" height="300" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/bp.obp.buffer.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator honors backpressure from downstream and consumes the source {@code Publisher} in an unbounded manner (i.e., not applying backpressure to it).</dd> <dt><b>Scheduler:</b></dt> <dd>{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param capacity number of slots available in the buffer. @param delayError if true, an exception from the current Flowable is delayed until all buffered elements have been consumed by the downstream; if false, an exception is immediately signaled to the downstream, skipping any buffered element @param unbounded if true, the capacity value is interpreted as the internal "island" size of the unbounded buffer @param onOverflow action to execute if an item needs to be buffered, but there are no available slots. Null is allowed. @return the source {@code Publisher} modified to buffer items up to the given capacity @see <a href="http://reactivex.io/documentation/operators/backpressure.html">ReactiveX operators documentation: backpressure operators</a> @since 1.1.0 """ ObjectHelper.requireNonNull(onOverflow, "onOverflow is null"); ObjectHelper.verifyPositive(capacity, "capacity"); return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<T>(this, capacity, unbounded, delayError, onOverflow)); }
java
@CheckReturnValue @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded, Action onOverflow) { ObjectHelper.requireNonNull(onOverflow, "onOverflow is null"); ObjectHelper.verifyPositive(capacity, "capacity"); return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<T>(this, capacity, unbounded, delayError, onOverflow)); }
[ "@", "CheckReturnValue", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "SPECIAL", ")", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "Flowable", "<", "T", ">", "onBackpressureBuffer", "(", "int", "capacity", ",", "boolean", "delayError", ",", "boolean", "unbounded", ",", "Action", "onOverflow", ")", "{", "ObjectHelper", ".", "requireNonNull", "(", "onOverflow", ",", "\"onOverflow is null\"", ")", ";", "ObjectHelper", ".", "verifyPositive", "(", "capacity", ",", "\"capacity\"", ")", ";", "return", "RxJavaPlugins", ".", "onAssembly", "(", "new", "FlowableOnBackpressureBuffer", "<", "T", ">", "(", "this", ",", "capacity", ",", "unbounded", ",", "delayError", ",", "onOverflow", ")", ")", ";", "}" ]
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will signal a {@code BufferOverflowException} via {@code onError} as soon as the buffer's capacity is exceeded, dropping all undelivered items, canceling the source, and notifying the producer with {@code onOverflow}. <p> <img width="640" height="300" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/bp.obp.buffer.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator honors backpressure from downstream and consumes the source {@code Publisher} in an unbounded manner (i.e., not applying backpressure to it).</dd> <dt><b>Scheduler:</b></dt> <dd>{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param capacity number of slots available in the buffer. @param delayError if true, an exception from the current Flowable is delayed until all buffered elements have been consumed by the downstream; if false, an exception is immediately signaled to the downstream, skipping any buffered element @param unbounded if true, the capacity value is interpreted as the internal "island" size of the unbounded buffer @param onOverflow action to execute if an item needs to be buffered, but there are no available slots. Null is allowed. @return the source {@code Publisher} modified to buffer items up to the given capacity @see <a href="http://reactivex.io/documentation/operators/backpressure.html">ReactiveX operators documentation: backpressure operators</a> @since 1.1.0
[ "Instructs", "a", "Publisher", "that", "is", "emitting", "items", "faster", "than", "its", "Subscriber", "can", "consume", "them", "to", "buffer", "up", "to", "a", "given", "amount", "of", "items", "until", "they", "can", "be", "emitted", ".", "The", "resulting", "Publisher", "will", "signal", "a", "{", "@code", "BufferOverflowException", "}", "via", "{", "@code", "onError", "}", "as", "soon", "as", "the", "buffer", "s", "capacity", "is", "exceeded", "dropping", "all", "undelivered", "items", "canceling", "the", "source", "and", "notifying", "the", "producer", "with", "{", "@code", "onOverflow", "}", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "300", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", "/", "ReactiveX", "/", "RxJava", "/", "images", "/", "rx", "-", "operators", "/", "bp", ".", "obp", ".", "buffer", ".", "png", "alt", "=", ">", "<dl", ">", "<dt", ">", "<b", ">", "Backpressure", ":", "<", "/", "b", ">", "<", "/", "dt", ">", "<dd", ">", "The", "operator", "honors", "backpressure", "from", "downstream", "and", "consumes", "the", "source", "{", "@code", "Publisher", "}", "in", "an", "unbounded", "manner", "(", "i", ".", "e", ".", "not", "applying", "backpressure", "to", "it", ")", ".", "<", "/", "dd", ">", "<dt", ">", "<b", ">", "Scheduler", ":", "<", "/", "b", ">", "<", "/", "dt", ">", "<dd", ">", "{", "@code", "onBackpressureBuffer", "}", "does", "not", "operate", "by", "default", "on", "a", "particular", "{", "@link", "Scheduler", "}", ".", "<", "/", "dd", ">", "<", "/", "dl", ">" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L11496-L11504
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/NetUtils.java
NetUtils.getInputStream
public static InputStream getInputStream(Socket socket, long timeout) throws IOException { """ Returns InputStream for the socket. If the socket has an associated SocketChannel then it returns a {@link SocketInputStream} with the given timeout. If the socket does not have a channel, {@link Socket#getInputStream()} is returned. In the later case, the timeout argument is ignored and the timeout set with {@link Socket#setSoTimeout(int)} applies for reads.<br><br> Any socket created using socket factories returned by {@link #NetUtils}, must use this interface instead of {@link Socket#getInputStream()}. @see Socket#getChannel() @param socket @param timeout timeout in milliseconds. This may not always apply. zero for waiting as long as necessary. @return InputStream for reading from the socket. @throws IOException """ return (socket.getChannel() == null) ? socket.getInputStream() : new SocketInputStream(socket, timeout); }
java
public static InputStream getInputStream(Socket socket, long timeout) throws IOException { return (socket.getChannel() == null) ? socket.getInputStream() : new SocketInputStream(socket, timeout); }
[ "public", "static", "InputStream", "getInputStream", "(", "Socket", "socket", ",", "long", "timeout", ")", "throws", "IOException", "{", "return", "(", "socket", ".", "getChannel", "(", ")", "==", "null", ")", "?", "socket", ".", "getInputStream", "(", ")", ":", "new", "SocketInputStream", "(", "socket", ",", "timeout", ")", ";", "}" ]
Returns InputStream for the socket. If the socket has an associated SocketChannel then it returns a {@link SocketInputStream} with the given timeout. If the socket does not have a channel, {@link Socket#getInputStream()} is returned. In the later case, the timeout argument is ignored and the timeout set with {@link Socket#setSoTimeout(int)} applies for reads.<br><br> Any socket created using socket factories returned by {@link #NetUtils}, must use this interface instead of {@link Socket#getInputStream()}. @see Socket#getChannel() @param socket @param timeout timeout in milliseconds. This may not always apply. zero for waiting as long as necessary. @return InputStream for reading from the socket. @throws IOException
[ "Returns", "InputStream", "for", "the", "socket", ".", "If", "the", "socket", "has", "an", "associated", "SocketChannel", "then", "it", "returns", "a", "{", "@link", "SocketInputStream", "}", "with", "the", "given", "timeout", ".", "If", "the", "socket", "does", "not", "have", "a", "channel", "{", "@link", "Socket#getInputStream", "()", "}", "is", "returned", ".", "In", "the", "later", "case", "the", "timeout", "argument", "is", "ignored", "and", "the", "timeout", "set", "with", "{", "@link", "Socket#setSoTimeout", "(", "int", ")", "}", "applies", "for", "reads", ".", "<br", ">", "<br", ">" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L339-L343
katjahahn/PortEx
src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java
Visualizer.createEntropyImage
public BufferedImage createEntropyImage(File file) throws IOException { """ Creates an image of the local entropies of this file. @param file the PE file @return image of local entropies @throws IOException if file can not be read """ resetAvailabilityFlags(); this.data = new PEData(null, null, null, null, null, file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); final int MIN_WINDOW_SIZE = 100; // bytes to be read at once to calculate local entropy final int windowSize = Math.max(MIN_WINDOW_SIZE, pixelSize); final int windowHalfSize = (int) Math.round(windowSize / (double) 2); final long minLength = withMinLength(0); try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { // read until EOF with windowSized steps for (long address = 0; address <= file.length(); address += minLength) { // the start of the window (windowHalf to the left) long start = (address - windowHalfSize < 0) ? 0 : address - windowHalfSize; raf.seek(start); // cut byte number if EOF reached, otherwise read full window int bytesToRead = (int) Math.min(file.length() - start, windowSize); byte[] bytes = new byte[bytesToRead]; raf.readFully(bytes); /* calculate and draw entropy square pixel for this window */ double entropy = ShannonEntropy.entropy(bytes); Color color = getColorForEntropy(entropy); drawPixels(color, address, minLength); } } drawVisOverlay(true); return image; }
java
public BufferedImage createEntropyImage(File file) throws IOException { resetAvailabilityFlags(); this.data = new PEData(null, null, null, null, null, file); image = new BufferedImage(fileWidth, height, IMAGE_TYPE); final int MIN_WINDOW_SIZE = 100; // bytes to be read at once to calculate local entropy final int windowSize = Math.max(MIN_WINDOW_SIZE, pixelSize); final int windowHalfSize = (int) Math.round(windowSize / (double) 2); final long minLength = withMinLength(0); try (RandomAccessFile raf = new RandomAccessFile(file, "r")) { // read until EOF with windowSized steps for (long address = 0; address <= file.length(); address += minLength) { // the start of the window (windowHalf to the left) long start = (address - windowHalfSize < 0) ? 0 : address - windowHalfSize; raf.seek(start); // cut byte number if EOF reached, otherwise read full window int bytesToRead = (int) Math.min(file.length() - start, windowSize); byte[] bytes = new byte[bytesToRead]; raf.readFully(bytes); /* calculate and draw entropy square pixel for this window */ double entropy = ShannonEntropy.entropy(bytes); Color color = getColorForEntropy(entropy); drawPixels(color, address, minLength); } } drawVisOverlay(true); return image; }
[ "public", "BufferedImage", "createEntropyImage", "(", "File", "file", ")", "throws", "IOException", "{", "resetAvailabilityFlags", "(", ")", ";", "this", ".", "data", "=", "new", "PEData", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "file", ")", ";", "image", "=", "new", "BufferedImage", "(", "fileWidth", ",", "height", ",", "IMAGE_TYPE", ")", ";", "final", "int", "MIN_WINDOW_SIZE", "=", "100", ";", "// bytes to be read at once to calculate local entropy", "final", "int", "windowSize", "=", "Math", ".", "max", "(", "MIN_WINDOW_SIZE", ",", "pixelSize", ")", ";", "final", "int", "windowHalfSize", "=", "(", "int", ")", "Math", ".", "round", "(", "windowSize", "/", "(", "double", ")", "2", ")", ";", "final", "long", "minLength", "=", "withMinLength", "(", "0", ")", ";", "try", "(", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ")", "{", "// read until EOF with windowSized steps", "for", "(", "long", "address", "=", "0", ";", "address", "<=", "file", ".", "length", "(", ")", ";", "address", "+=", "minLength", ")", "{", "// the start of the window (windowHalf to the left)", "long", "start", "=", "(", "address", "-", "windowHalfSize", "<", "0", ")", "?", "0", ":", "address", "-", "windowHalfSize", ";", "raf", ".", "seek", "(", "start", ")", ";", "// cut byte number if EOF reached, otherwise read full window", "int", "bytesToRead", "=", "(", "int", ")", "Math", ".", "min", "(", "file", ".", "length", "(", ")", "-", "start", ",", "windowSize", ")", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "bytesToRead", "]", ";", "raf", ".", "readFully", "(", "bytes", ")", ";", "/* calculate and draw entropy square pixel for this window */", "double", "entropy", "=", "ShannonEntropy", ".", "entropy", "(", "bytes", ")", ";", "Color", "color", "=", "getColorForEntropy", "(", "entropy", ")", ";", "drawPixels", "(", "color", ",", "address", ",", "minLength", ")", ";", "}", "}", "drawVisOverlay", "(", "true", ")", ";", "return", "image", ";", "}" ]
Creates an image of the local entropies of this file. @param file the PE file @return image of local entropies @throws IOException if file can not be read
[ "Creates", "an", "image", "of", "the", "local", "entropies", "of", "this", "file", "." ]
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L245-L274
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.hasArgumentWithValue
public static Matcher<AnnotationTree> hasArgumentWithValue( String argumentName, Matcher<ExpressionTree> valueMatcher) { """ Matches an Annotation AST node if the argument to the annotation with the given name has a value which matches the given matcher. For example, {@code hasArgumentWithValue("value", stringLiteral("one"))} matches {@code @Thing("one")} or {@code @Thing({"one", "two"})} or {@code @Thing(value = "one")} """ return new AnnotationHasArgumentWithValue(argumentName, valueMatcher); }
java
public static Matcher<AnnotationTree> hasArgumentWithValue( String argumentName, Matcher<ExpressionTree> valueMatcher) { return new AnnotationHasArgumentWithValue(argumentName, valueMatcher); }
[ "public", "static", "Matcher", "<", "AnnotationTree", ">", "hasArgumentWithValue", "(", "String", "argumentName", ",", "Matcher", "<", "ExpressionTree", ">", "valueMatcher", ")", "{", "return", "new", "AnnotationHasArgumentWithValue", "(", "argumentName", ",", "valueMatcher", ")", ";", "}" ]
Matches an Annotation AST node if the argument to the annotation with the given name has a value which matches the given matcher. For example, {@code hasArgumentWithValue("value", stringLiteral("one"))} matches {@code @Thing("one")} or {@code @Thing({"one", "two"})} or {@code @Thing(value = "one")}
[ "Matches", "an", "Annotation", "AST", "node", "if", "the", "argument", "to", "the", "annotation", "with", "the", "given", "name", "has", "a", "value", "which", "matches", "the", "given", "matcher", ".", "For", "example", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L717-L720
jayantk/jklol
src/com/jayantkrish/jklol/ccg/CcgCategory.java
CcgCategory.fromSyntaxLf
public static CcgCategory fromSyntaxLf(HeadedSyntacticCategory cat, Expression2 lf) { """ Generates a CCG category with head and dependency information automatically populated from the syntactic category and logical form. The logical form itself is used as the semantic head of the returned category. @param cat @param logicalForm @return """ String head = lf.toString(); head = head.replaceAll(" ", "_"); List<String> subjects = Lists.newArrayList(); List<Integer> argumentNums = Lists.newArrayList(); List<Integer> objects = Lists.newArrayList(); List<HeadedSyntacticCategory> argumentCats = Lists.newArrayList(cat.getArgumentTypes()); Collections.reverse(argumentCats); for (int i = 0; i < argumentCats.size(); i++) { subjects.add(head); argumentNums.add(i + 1); objects.add(argumentCats.get(i).getHeadVariable()); } List<Set<String>> assignments = Lists.newArrayList(); for (int i = 0; i < cat.getUniqueVariables().length; i++) { assignments.add(Collections.<String>emptySet()); } int headVar = cat.getHeadVariable(); assignments.set(headVar, Sets.newHashSet(head)); return new CcgCategory(cat, lf, subjects, argumentNums, objects, assignments); }
java
public static CcgCategory fromSyntaxLf(HeadedSyntacticCategory cat, Expression2 lf) { String head = lf.toString(); head = head.replaceAll(" ", "_"); List<String> subjects = Lists.newArrayList(); List<Integer> argumentNums = Lists.newArrayList(); List<Integer> objects = Lists.newArrayList(); List<HeadedSyntacticCategory> argumentCats = Lists.newArrayList(cat.getArgumentTypes()); Collections.reverse(argumentCats); for (int i = 0; i < argumentCats.size(); i++) { subjects.add(head); argumentNums.add(i + 1); objects.add(argumentCats.get(i).getHeadVariable()); } List<Set<String>> assignments = Lists.newArrayList(); for (int i = 0; i < cat.getUniqueVariables().length; i++) { assignments.add(Collections.<String>emptySet()); } int headVar = cat.getHeadVariable(); assignments.set(headVar, Sets.newHashSet(head)); return new CcgCategory(cat, lf, subjects, argumentNums, objects, assignments); }
[ "public", "static", "CcgCategory", "fromSyntaxLf", "(", "HeadedSyntacticCategory", "cat", ",", "Expression2", "lf", ")", "{", "String", "head", "=", "lf", ".", "toString", "(", ")", ";", "head", "=", "head", ".", "replaceAll", "(", "\" \"", ",", "\"_\"", ")", ";", "List", "<", "String", ">", "subjects", "=", "Lists", ".", "newArrayList", "(", ")", ";", "List", "<", "Integer", ">", "argumentNums", "=", "Lists", ".", "newArrayList", "(", ")", ";", "List", "<", "Integer", ">", "objects", "=", "Lists", ".", "newArrayList", "(", ")", ";", "List", "<", "HeadedSyntacticCategory", ">", "argumentCats", "=", "Lists", ".", "newArrayList", "(", "cat", ".", "getArgumentTypes", "(", ")", ")", ";", "Collections", ".", "reverse", "(", "argumentCats", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argumentCats", ".", "size", "(", ")", ";", "i", "++", ")", "{", "subjects", ".", "add", "(", "head", ")", ";", "argumentNums", ".", "add", "(", "i", "+", "1", ")", ";", "objects", ".", "add", "(", "argumentCats", ".", "get", "(", "i", ")", ".", "getHeadVariable", "(", ")", ")", ";", "}", "List", "<", "Set", "<", "String", ">", ">", "assignments", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cat", ".", "getUniqueVariables", "(", ")", ".", "length", ";", "i", "++", ")", "{", "assignments", ".", "add", "(", "Collections", ".", "<", "String", ">", "emptySet", "(", ")", ")", ";", "}", "int", "headVar", "=", "cat", ".", "getHeadVariable", "(", ")", ";", "assignments", ".", "set", "(", "headVar", ",", "Sets", ".", "newHashSet", "(", "head", ")", ")", ";", "return", "new", "CcgCategory", "(", "cat", ",", "lf", ",", "subjects", ",", "argumentNums", ",", "objects", ",", "assignments", ")", ";", "}" ]
Generates a CCG category with head and dependency information automatically populated from the syntactic category and logical form. The logical form itself is used as the semantic head of the returned category. @param cat @param logicalForm @return
[ "Generates", "a", "CCG", "category", "with", "head", "and", "dependency", "information", "automatically", "populated", "from", "the", "syntactic", "category", "and", "logical", "form", ".", "The", "logical", "form", "itself", "is", "used", "as", "the", "semantic", "head", "of", "the", "returned", "category", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/CcgCategory.java#L250-L273
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_serviceMonitoring_POST
public OvhServiceMonitoring serviceName_serviceMonitoring_POST(String serviceName, String challengeText, Boolean enabled, OvhMonitoringIntervalEnum interval, String ip, Long port, OvhMonitoringProtocolEnum protocol, String url) throws IOException { """ Add a new service monitoring REST: POST /dedicated/server/{serviceName}/serviceMonitoring @param challengeText [required] The expected return @param port [required] The service port to monitor @param enabled [required] Is this service monitoring is enabled @param protocol [required] The protocol to use @param interval [required] The test interval @param url [required] The URL to test @param ip [required] The IP to monitor @param serviceName [required] The internal name of your dedicated server """ String qPath = "/dedicated/server/{serviceName}/serviceMonitoring"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "challengeText", challengeText); addBody(o, "enabled", enabled); addBody(o, "interval", interval); addBody(o, "ip", ip); addBody(o, "port", port); addBody(o, "protocol", protocol); addBody(o, "url", url); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhServiceMonitoring.class); }
java
public OvhServiceMonitoring serviceName_serviceMonitoring_POST(String serviceName, String challengeText, Boolean enabled, OvhMonitoringIntervalEnum interval, String ip, Long port, OvhMonitoringProtocolEnum protocol, String url) throws IOException { String qPath = "/dedicated/server/{serviceName}/serviceMonitoring"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "challengeText", challengeText); addBody(o, "enabled", enabled); addBody(o, "interval", interval); addBody(o, "ip", ip); addBody(o, "port", port); addBody(o, "protocol", protocol); addBody(o, "url", url); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhServiceMonitoring.class); }
[ "public", "OvhServiceMonitoring", "serviceName_serviceMonitoring_POST", "(", "String", "serviceName", ",", "String", "challengeText", ",", "Boolean", "enabled", ",", "OvhMonitoringIntervalEnum", "interval", ",", "String", "ip", ",", "Long", "port", ",", "OvhMonitoringProtocolEnum", "protocol", ",", "String", "url", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/serviceMonitoring\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"challengeText\"", ",", "challengeText", ")", ";", "addBody", "(", "o", ",", "\"enabled\"", ",", "enabled", ")", ";", "addBody", "(", "o", ",", "\"interval\"", ",", "interval", ")", ";", "addBody", "(", "o", ",", "\"ip\"", ",", "ip", ")", ";", "addBody", "(", "o", ",", "\"port\"", ",", "port", ")", ";", "addBody", "(", "o", ",", "\"protocol\"", ",", "protocol", ")", ";", "addBody", "(", "o", ",", "\"url\"", ",", "url", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhServiceMonitoring", ".", "class", ")", ";", "}" ]
Add a new service monitoring REST: POST /dedicated/server/{serviceName}/serviceMonitoring @param challengeText [required] The expected return @param port [required] The service port to monitor @param enabled [required] Is this service monitoring is enabled @param protocol [required] The protocol to use @param interval [required] The test interval @param url [required] The URL to test @param ip [required] The IP to monitor @param serviceName [required] The internal name of your dedicated server
[ "Add", "a", "new", "service", "monitoring" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2086-L2099
p6spy/p6spy
src/main/java/com/p6spy/engine/spy/appender/MultiLineFormat.java
MultiLineFormat.formatMessage
@Override public String formatMessage(final int connectionId, final String now, final long elapsed, final String category, final String prepared, final String sql, final String url) { """ Formats a log message for the logging module @param connectionId the id of the connection @param now the current ime expressing in milliseconds @param elapsed the time in milliseconds that the operation took to complete @param category the category of the operation @param prepared the SQL statement with all bind variables replaced with actual values @param sql the sql statement executed @param url the database url where the sql statement executed @return the formatted log message """ return "#" + now + " | took " + elapsed + "ms | " + category + " | connection " + connectionId + "| url " + url + "\n" + prepared + "\n" + sql +";"; }
java
@Override public String formatMessage(final int connectionId, final String now, final long elapsed, final String category, final String prepared, final String sql, final String url) { return "#" + now + " | took " + elapsed + "ms | " + category + " | connection " + connectionId + "| url " + url + "\n" + prepared + "\n" + sql +";"; }
[ "@", "Override", "public", "String", "formatMessage", "(", "final", "int", "connectionId", ",", "final", "String", "now", ",", "final", "long", "elapsed", ",", "final", "String", "category", ",", "final", "String", "prepared", ",", "final", "String", "sql", ",", "final", "String", "url", ")", "{", "return", "\"#\"", "+", "now", "+", "\" | took \"", "+", "elapsed", "+", "\"ms | \"", "+", "category", "+", "\" | connection \"", "+", "connectionId", "+", "\"| url \"", "+", "url", "+", "\"\\n\"", "+", "prepared", "+", "\"\\n\"", "+", "sql", "+", "\";\"", ";", "}" ]
Formats a log message for the logging module @param connectionId the id of the connection @param now the current ime expressing in milliseconds @param elapsed the time in milliseconds that the operation took to complete @param category the category of the operation @param prepared the SQL statement with all bind variables replaced with actual values @param sql the sql statement executed @param url the database url where the sql statement executed @return the formatted log message
[ "Formats", "a", "log", "message", "for", "the", "logging", "module" ]
train
https://github.com/p6spy/p6spy/blob/c3c0fecd6e26156eecf90a90901c3c1c8a7dbdf2/src/main/java/com/p6spy/engine/spy/appender/MultiLineFormat.java#L38-L41
GerdHolz/TOVAL
src/de/invation/code/toval/validate/Validate.java
Validate.notNull
public static <O extends Object> void notNull(O o, String message) { """ Checks if the given object is <code>null</code> @param o The object to validate. @param message The error message to include in the Exception in case the validation fails. @throws ParameterException if the given object is <code>null</code>. """ if(!validation) return; notNull(message); if(o == null) throw new ParameterException(ErrorCode.NULLPOINTER, message); }
java
public static <O extends Object> void notNull(O o, String message) { if(!validation) return; notNull(message); if(o == null) throw new ParameterException(ErrorCode.NULLPOINTER, message); }
[ "public", "static", "<", "O", "extends", "Object", ">", "void", "notNull", "(", "O", "o", ",", "String", "message", ")", "{", "if", "(", "!", "validation", ")", "return", ";", "notNull", "(", "message", ")", ";", "if", "(", "o", "==", "null", ")", "throw", "new", "ParameterException", "(", "ErrorCode", ".", "NULLPOINTER", ",", "message", ")", ";", "}" ]
Checks if the given object is <code>null</code> @param o The object to validate. @param message The error message to include in the Exception in case the validation fails. @throws ParameterException if the given object is <code>null</code>.
[ "Checks", "if", "the", "given", "object", "is", "<code", ">", "null<", "/", "code", ">" ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L42-L47
misha/iroh
src/main/java/com/github/msoliter/iroh/container/services/Injector.java
Injector.eagerlyInject
public void eagerlyInject(Object target, Field field) { """ Eagerly injects the target object's target field. Note that if the field is marked for lazy injection, we still inject it, but with a "null" reference. This reference is never seen by user code, and is used internally by Iroh to detect when eager injection has delegated the injection process to lazy injection, thus preventing multiple injection. @param target The target object containing the field to be injected. @param field The target field to be injected in the target object. """ /** * We only ever inject fields marked with the correct annotation. */ if (field.getAnnotation(Autowired.class) != null) { field.setAccessible(true); Autowired autowired = field.getAnnotation(Autowired.class); /** * If the field isn't marked for lazy injection, go ahead and inject * it immediately. Otherwise, nullify it with a local "null" * reference of the field's required type. */ if (autowired.lazy() == false) { inject(target, field); } else { nullify(target, field); } } }
java
public void eagerlyInject(Object target, Field field) { /** * We only ever inject fields marked with the correct annotation. */ if (field.getAnnotation(Autowired.class) != null) { field.setAccessible(true); Autowired autowired = field.getAnnotation(Autowired.class); /** * If the field isn't marked for lazy injection, go ahead and inject * it immediately. Otherwise, nullify it with a local "null" * reference of the field's required type. */ if (autowired.lazy() == false) { inject(target, field); } else { nullify(target, field); } } }
[ "public", "void", "eagerlyInject", "(", "Object", "target", ",", "Field", "field", ")", "{", "/**\n * We only ever inject fields marked with the correct annotation.\n */", "if", "(", "field", ".", "getAnnotation", "(", "Autowired", ".", "class", ")", "!=", "null", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "Autowired", "autowired", "=", "field", ".", "getAnnotation", "(", "Autowired", ".", "class", ")", ";", "/**\n * If the field isn't marked for lazy injection, go ahead and inject\n * it immediately. Otherwise, nullify it with a local \"null\"\n * reference of the field's required type.\n */", "if", "(", "autowired", ".", "lazy", "(", ")", "==", "false", ")", "{", "inject", "(", "target", ",", "field", ")", ";", "}", "else", "{", "nullify", "(", "target", ",", "field", ")", ";", "}", "}", "}" ]
Eagerly injects the target object's target field. Note that if the field is marked for lazy injection, we still inject it, but with a "null" reference. This reference is never seen by user code, and is used internally by Iroh to detect when eager injection has delegated the injection process to lazy injection, thus preventing multiple injection. @param target The target object containing the field to be injected. @param field The target field to be injected in the target object.
[ "Eagerly", "injects", "the", "target", "object", "s", "target", "field", ".", "Note", "that", "if", "the", "field", "is", "marked", "for", "lazy", "injection", "we", "still", "inject", "it", "but", "with", "a", "null", "reference", ".", "This", "reference", "is", "never", "seen", "by", "user", "code", "and", "is", "used", "internally", "by", "Iroh", "to", "detect", "when", "eager", "injection", "has", "delegated", "the", "injection", "process", "to", "lazy", "injection", "thus", "preventing", "multiple", "injection", "." ]
train
https://github.com/misha/iroh/blob/5dc92a01d3b2f3ba63e8ad1bf9b5fe342d0b679a/src/main/java/com/github/msoliter/iroh/container/services/Injector.java#L75-L96
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/CommonUtils.java
CommonUtils.dateReservedYear
public static Date dateReservedYear(int year, boolean is000) { """ 将某一年对应的日期的月,日,时,分,秒,毫秒调整为最大值或者最小值 @param year 年份 @param is000 true则调整为最小值,反之最大值 @return 被转化后的日期 @see #dateReservedYear000(Date) @see #dateReservedYear000(Calendar) @see #dateReservedYear999(Date) @see #dateReservedYear999(Calendar) """ Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); return is000 ? dateReservedYear000(calendar) : dateReservedYear999(calendar); }
java
public static Date dateReservedYear(int year, boolean is000) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); return is000 ? dateReservedYear000(calendar) : dateReservedYear999(calendar); }
[ "public", "static", "Date", "dateReservedYear", "(", "int", "year", ",", "boolean", "is000", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "YEAR", ",", "year", ")", ";", "return", "is000", "?", "dateReservedYear000", "(", "calendar", ")", ":", "dateReservedYear999", "(", "calendar", ")", ";", "}" ]
将某一年对应的日期的月,日,时,分,秒,毫秒调整为最大值或者最小值 @param year 年份 @param is000 true则调整为最小值,反之最大值 @return 被转化后的日期 @see #dateReservedYear000(Date) @see #dateReservedYear000(Calendar) @see #dateReservedYear999(Date) @see #dateReservedYear999(Calendar)
[ "将某一年对应的日期的月", "日", "时", "分", "秒", "毫秒调整为最大值或者最小值" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/CommonUtils.java#L574-L579
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsModelPageHelper.java
CmsModelPageHelper.createPageInModelFolder
public CmsResource createPageInModelFolder(String name, String description, CmsUUID copyId) throws CmsException { """ Creates a new potential model page in the default folder for new model pages.<p> @param name the title for the model page @param description the description for the model page @param copyId structure id of the resource to use as a model for the model page, if any (may be null) @return the created resource @throws CmsException if something goes wrong """ CmsResource modelFolder = ensureModelFolder(m_rootResource); String pattern = "templatemodel_%(number).html"; String newFilePath = OpenCms.getResourceManager().getNameGenerator().getNewFileName( m_cms, CmsStringUtil.joinPaths(modelFolder.getRootPath(), pattern), 4); CmsProperty titleProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, name, null); CmsProperty descriptionProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_DESCRIPTION, description, null); CmsResource newPage = null; if (copyId == null) { newPage = m_cms.createResource( newFilePath, getType(CmsResourceTypeXmlContainerPage.getStaticTypeName()), null, Arrays.asList(titleProp, descriptionProp)); } else { CmsResource copyResource = m_cms.readResource(copyId); m_cms.copyResource(copyResource.getRootPath(), newFilePath); m_cms.writePropertyObject(newFilePath, titleProp); m_cms.writePropertyObject(newFilePath, descriptionProp); newPage = m_cms.readResource(newFilePath); } tryUnlock(newPage); return newPage; }
java
public CmsResource createPageInModelFolder(String name, String description, CmsUUID copyId) throws CmsException { CmsResource modelFolder = ensureModelFolder(m_rootResource); String pattern = "templatemodel_%(number).html"; String newFilePath = OpenCms.getResourceManager().getNameGenerator().getNewFileName( m_cms, CmsStringUtil.joinPaths(modelFolder.getRootPath(), pattern), 4); CmsProperty titleProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, name, null); CmsProperty descriptionProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_DESCRIPTION, description, null); CmsResource newPage = null; if (copyId == null) { newPage = m_cms.createResource( newFilePath, getType(CmsResourceTypeXmlContainerPage.getStaticTypeName()), null, Arrays.asList(titleProp, descriptionProp)); } else { CmsResource copyResource = m_cms.readResource(copyId); m_cms.copyResource(copyResource.getRootPath(), newFilePath); m_cms.writePropertyObject(newFilePath, titleProp); m_cms.writePropertyObject(newFilePath, descriptionProp); newPage = m_cms.readResource(newFilePath); } tryUnlock(newPage); return newPage; }
[ "public", "CmsResource", "createPageInModelFolder", "(", "String", "name", ",", "String", "description", ",", "CmsUUID", "copyId", ")", "throws", "CmsException", "{", "CmsResource", "modelFolder", "=", "ensureModelFolder", "(", "m_rootResource", ")", ";", "String", "pattern", "=", "\"templatemodel_%(number).html\"", ";", "String", "newFilePath", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getNameGenerator", "(", ")", ".", "getNewFileName", "(", "m_cms", ",", "CmsStringUtil", ".", "joinPaths", "(", "modelFolder", ".", "getRootPath", "(", ")", ",", "pattern", ")", ",", "4", ")", ";", "CmsProperty", "titleProp", "=", "new", "CmsProperty", "(", "CmsPropertyDefinition", ".", "PROPERTY_TITLE", ",", "name", ",", "null", ")", ";", "CmsProperty", "descriptionProp", "=", "new", "CmsProperty", "(", "CmsPropertyDefinition", ".", "PROPERTY_DESCRIPTION", ",", "description", ",", "null", ")", ";", "CmsResource", "newPage", "=", "null", ";", "if", "(", "copyId", "==", "null", ")", "{", "newPage", "=", "m_cms", ".", "createResource", "(", "newFilePath", ",", "getType", "(", "CmsResourceTypeXmlContainerPage", ".", "getStaticTypeName", "(", ")", ")", ",", "null", ",", "Arrays", ".", "asList", "(", "titleProp", ",", "descriptionProp", ")", ")", ";", "}", "else", "{", "CmsResource", "copyResource", "=", "m_cms", ".", "readResource", "(", "copyId", ")", ";", "m_cms", ".", "copyResource", "(", "copyResource", ".", "getRootPath", "(", ")", ",", "newFilePath", ")", ";", "m_cms", ".", "writePropertyObject", "(", "newFilePath", ",", "titleProp", ")", ";", "m_cms", ".", "writePropertyObject", "(", "newFilePath", ",", "descriptionProp", ")", ";", "newPage", "=", "m_cms", ".", "readResource", "(", "newFilePath", ")", ";", "}", "tryUnlock", "(", "newPage", ")", ";", "return", "newPage", ";", "}" ]
Creates a new potential model page in the default folder for new model pages.<p> @param name the title for the model page @param description the description for the model page @param copyId structure id of the resource to use as a model for the model page, if any (may be null) @return the created resource @throws CmsException if something goes wrong
[ "Creates", "a", "new", "potential", "model", "page", "in", "the", "default", "folder", "for", "new", "model", "pages", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsModelPageHelper.java#L207-L234
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java
SqlStatement.doBatchUpdate
private void doBatchUpdate(PreparedStatement ps, Object[] args, Calendar cal) throws SQLException { """ Build a prepared statement for a batch update. @param ps The PreparedStatement object. @param args The parameter list of the jdbccontrol method. @param cal A Calendar instance used to resolve date/time values. @throws SQLException If a batch update cannot be performed. """ final int[] sqlTypes = new int[args.length]; final Object[] objArrays = new Object[args.length]; // build an array of type values and object arrays for (int i = 0; i < args.length; i++) { sqlTypes[i] = _tmf.getSqlType(args[i].getClass().getComponentType()); objArrays[i] = TypeMappingsFactory.toObjectArray(args[i]); } final int rowCount = ((Object[]) objArrays[0]).length; for (int i = 0; i < rowCount; i++) { for (int j = 0; j < args.length; j++) { setPreparedStatementParameter(ps, j + 1, ((Object[]) objArrays[j])[i], sqlTypes[j], cal); } ps.addBatch(); } }
java
private void doBatchUpdate(PreparedStatement ps, Object[] args, Calendar cal) throws SQLException { final int[] sqlTypes = new int[args.length]; final Object[] objArrays = new Object[args.length]; // build an array of type values and object arrays for (int i = 0; i < args.length; i++) { sqlTypes[i] = _tmf.getSqlType(args[i].getClass().getComponentType()); objArrays[i] = TypeMappingsFactory.toObjectArray(args[i]); } final int rowCount = ((Object[]) objArrays[0]).length; for (int i = 0; i < rowCount; i++) { for (int j = 0; j < args.length; j++) { setPreparedStatementParameter(ps, j + 1, ((Object[]) objArrays[j])[i], sqlTypes[j], cal); } ps.addBatch(); } }
[ "private", "void", "doBatchUpdate", "(", "PreparedStatement", "ps", ",", "Object", "[", "]", "args", ",", "Calendar", "cal", ")", "throws", "SQLException", "{", "final", "int", "[", "]", "sqlTypes", "=", "new", "int", "[", "args", ".", "length", "]", ";", "final", "Object", "[", "]", "objArrays", "=", "new", "Object", "[", "args", ".", "length", "]", ";", "// build an array of type values and object arrays", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "sqlTypes", "[", "i", "]", "=", "_tmf", ".", "getSqlType", "(", "args", "[", "i", "]", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ")", ";", "objArrays", "[", "i", "]", "=", "TypeMappingsFactory", ".", "toObjectArray", "(", "args", "[", "i", "]", ")", ";", "}", "final", "int", "rowCount", "=", "(", "(", "Object", "[", "]", ")", "objArrays", "[", "0", "]", ")", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rowCount", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "args", ".", "length", ";", "j", "++", ")", "{", "setPreparedStatementParameter", "(", "ps", ",", "j", "+", "1", ",", "(", "(", "Object", "[", "]", ")", "objArrays", "[", "j", "]", ")", "[", "i", "]", ",", "sqlTypes", "[", "j", "]", ",", "cal", ")", ";", "}", "ps", ".", "addBatch", "(", ")", ";", "}", "}" ]
Build a prepared statement for a batch update. @param ps The PreparedStatement object. @param args The parameter list of the jdbccontrol method. @param cal A Calendar instance used to resolve date/time values. @throws SQLException If a batch update cannot be performed.
[ "Build", "a", "prepared", "statement", "for", "a", "batch", "update", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java#L429-L447
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeUtf8Map
public static File writeUtf8Map(Map<?, ?> map, File file, String kvSeparator, boolean isAppend) throws IORuntimeException { """ 将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔 @param map Map @param file 文件 @param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = " @param isAppend 是否追加 @return 目标文件 @throws IORuntimeException IO异常 @since 4.0.5 """ return FileWriter.create(file, CharsetUtil.CHARSET_UTF_8).writeMap(map, kvSeparator, isAppend); }
java
public static File writeUtf8Map(Map<?, ?> map, File file, String kvSeparator, boolean isAppend) throws IORuntimeException { return FileWriter.create(file, CharsetUtil.CHARSET_UTF_8).writeMap(map, kvSeparator, isAppend); }
[ "public", "static", "File", "writeUtf8Map", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "File", "file", ",", "String", "kvSeparator", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "return", "FileWriter", ".", "create", "(", "file", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ")", ".", "writeMap", "(", "map", ",", "kvSeparator", ",", "isAppend", ")", ";", "}" ]
将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔 @param map Map @param file 文件 @param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = " @param isAppend 是否追加 @return 目标文件 @throws IORuntimeException IO异常 @since 4.0.5
[ "将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3086-L3088
Ardesco/selenium-standalone-server-plugin
src/main/java/com/lazerycode/selenium/download/DownloadHandler.java
DownloadHandler.downloadFile
protected File downloadFile(DriverDetails driverDetails, boolean shouldWeCheckFileHash) throws MojoExecutionException, IOException, URISyntaxException { """ Perform the file download @param driverDetails Driver details extracted from Repositorymap.xml @param shouldWeCheckFileHash true if file hash should be checked @return File @throws MojoExecutionException Unable to download file @throws IOException Error writing to file system @throws URISyntaxException Invalid URI """ URL remoteFileLocation = driverDetails.fileLocation; final String filename = FilenameUtils.getName(remoteFileLocation.getFile()); for (int retryAttempts = 1; retryAttempts <= this.fileDownloadRetryAttempts; retryAttempts++) { File downloadedFile = fileDownloader.attemptToDownload(remoteFileLocation); if (null != downloadedFile) { if (!shouldWeCheckFileHash || checkFileHash(downloadedFile, driverDetails.hash, driverDetails.hashType)) { LOG.info("Archive file '" + downloadedFile.getName() + "' is valid : true"); return downloadedFile; } else { LOG.info("Archive file '" + downloadedFile.getName() + "' is valid : false"); } } LOG.info("Problem downloading '" + filename + "'... "); if (retryAttempts < this.fileDownloadRetryAttempts) { LOG.info("Retry attempt " + (retryAttempts) + " for '" + filename + "'"); } } throw new MojoExecutionException("Unable to successfully download '" + filename + "'!"); }
java
protected File downloadFile(DriverDetails driverDetails, boolean shouldWeCheckFileHash) throws MojoExecutionException, IOException, URISyntaxException { URL remoteFileLocation = driverDetails.fileLocation; final String filename = FilenameUtils.getName(remoteFileLocation.getFile()); for (int retryAttempts = 1; retryAttempts <= this.fileDownloadRetryAttempts; retryAttempts++) { File downloadedFile = fileDownloader.attemptToDownload(remoteFileLocation); if (null != downloadedFile) { if (!shouldWeCheckFileHash || checkFileHash(downloadedFile, driverDetails.hash, driverDetails.hashType)) { LOG.info("Archive file '" + downloadedFile.getName() + "' is valid : true"); return downloadedFile; } else { LOG.info("Archive file '" + downloadedFile.getName() + "' is valid : false"); } } LOG.info("Problem downloading '" + filename + "'... "); if (retryAttempts < this.fileDownloadRetryAttempts) { LOG.info("Retry attempt " + (retryAttempts) + " for '" + filename + "'"); } } throw new MojoExecutionException("Unable to successfully download '" + filename + "'!"); }
[ "protected", "File", "downloadFile", "(", "DriverDetails", "driverDetails", ",", "boolean", "shouldWeCheckFileHash", ")", "throws", "MojoExecutionException", ",", "IOException", ",", "URISyntaxException", "{", "URL", "remoteFileLocation", "=", "driverDetails", ".", "fileLocation", ";", "final", "String", "filename", "=", "FilenameUtils", ".", "getName", "(", "remoteFileLocation", ".", "getFile", "(", ")", ")", ";", "for", "(", "int", "retryAttempts", "=", "1", ";", "retryAttempts", "<=", "this", ".", "fileDownloadRetryAttempts", ";", "retryAttempts", "++", ")", "{", "File", "downloadedFile", "=", "fileDownloader", ".", "attemptToDownload", "(", "remoteFileLocation", ")", ";", "if", "(", "null", "!=", "downloadedFile", ")", "{", "if", "(", "!", "shouldWeCheckFileHash", "||", "checkFileHash", "(", "downloadedFile", ",", "driverDetails", ".", "hash", ",", "driverDetails", ".", "hashType", ")", ")", "{", "LOG", ".", "info", "(", "\"Archive file '\"", "+", "downloadedFile", ".", "getName", "(", ")", "+", "\"' is valid : true\"", ")", ";", "return", "downloadedFile", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"Archive file '\"", "+", "downloadedFile", ".", "getName", "(", ")", "+", "\"' is valid : false\"", ")", ";", "}", "}", "LOG", ".", "info", "(", "\"Problem downloading '\"", "+", "filename", "+", "\"'... \"", ")", ";", "if", "(", "retryAttempts", "<", "this", ".", "fileDownloadRetryAttempts", ")", "{", "LOG", ".", "info", "(", "\"Retry attempt \"", "+", "(", "retryAttempts", ")", "+", "\" for '\"", "+", "filename", "+", "\"'\"", ")", ";", "}", "}", "throw", "new", "MojoExecutionException", "(", "\"Unable to successfully download '\"", "+", "filename", "+", "\"'!\"", ")", ";", "}" ]
Perform the file download @param driverDetails Driver details extracted from Repositorymap.xml @param shouldWeCheckFileHash true if file hash should be checked @return File @throws MojoExecutionException Unable to download file @throws IOException Error writing to file system @throws URISyntaxException Invalid URI
[ "Perform", "the", "file", "download" ]
train
https://github.com/Ardesco/selenium-standalone-server-plugin/blob/e0ecfad426c1a28115cab60def84731d7a4d7e6f/src/main/java/com/lazerycode/selenium/download/DownloadHandler.java#L61-L83
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRulePersistenceImpl.java
CPRulePersistenceImpl.findByGroupId
@Override public List<CPRule> findByGroupId(long groupId, int start, int end) { """ Returns a range of all the cp rules where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPRuleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of cp rules @param end the upper bound of the range of cp rules (not inclusive) @return the range of matching cp rules """ return findByGroupId(groupId, start, end, null); }
java
@Override public List<CPRule> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPRule", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp rules where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPRuleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of cp rules @param end the upper bound of the range of cp rules (not inclusive) @return the range of matching cp rules
[ "Returns", "a", "range", "of", "all", "the", "cp", "rules", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRulePersistenceImpl.java#L139-L142
liferay/com-liferay-commerce
commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java
CommerceVirtualOrderItemPersistenceImpl.fetchByUUID_G
@Override public CommerceVirtualOrderItem fetchByUUID_G(String uuid, long groupId) { """ Returns the commerce virtual order item where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching commerce virtual order item, or <code>null</code> if a matching commerce virtual order item could not be found """ return fetchByUUID_G(uuid, groupId, true); }
java
@Override public CommerceVirtualOrderItem fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
[ "@", "Override", "public", "CommerceVirtualOrderItem", "fetchByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "return", "fetchByUUID_G", "(", "uuid", ",", "groupId", ",", "true", ")", ";", "}" ]
Returns the commerce virtual order item where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching commerce virtual order item, or <code>null</code> if a matching commerce virtual order item could not be found
[ "Returns", "the", "commerce", "virtual", "order", "item", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java#L706-L709
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java
CmsForm.updateModelValidationStatus
protected void updateModelValidationStatus(String modelId, CmsValidationResult result) { """ Updates the model validation status.<p> @param modelId the model id @param result the validation result """ Collection<I_CmsFormField> fields = getFieldsByModelId(modelId); for (I_CmsFormField field : fields) { updateFieldValidationStatus(field, result); } }
java
protected void updateModelValidationStatus(String modelId, CmsValidationResult result) { Collection<I_CmsFormField> fields = getFieldsByModelId(modelId); for (I_CmsFormField field : fields) { updateFieldValidationStatus(field, result); } }
[ "protected", "void", "updateModelValidationStatus", "(", "String", "modelId", ",", "CmsValidationResult", "result", ")", "{", "Collection", "<", "I_CmsFormField", ">", "fields", "=", "getFieldsByModelId", "(", "modelId", ")", ";", "for", "(", "I_CmsFormField", "field", ":", "fields", ")", "{", "updateFieldValidationStatus", "(", "field", ",", "result", ")", ";", "}", "}" ]
Updates the model validation status.<p> @param modelId the model id @param result the validation result
[ "Updates", "the", "model", "validation", "status", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L532-L539
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineSeparators
private void defineSeparators(UIDefaults d) { """ Initialize the separator settings. @param d the UI defaults map. """ String c = PAINTER_PREFIX + "SeparatorPainter"; d.put("Separator.contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put("Separator[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED)); }
java
private void defineSeparators(UIDefaults d) { String c = PAINTER_PREFIX + "SeparatorPainter"; d.put("Separator.contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put("Separator[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED)); }
[ "private", "void", "defineSeparators", "(", "UIDefaults", "d", ")", "{", "String", "c", "=", "PAINTER_PREFIX", "+", "\"SeparatorPainter\"", ";", "d", ".", "put", "(", "\"Separator.contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "\"Separator[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SeparatorPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "}" ]
Initialize the separator settings. @param d the UI defaults map.
[ "Initialize", "the", "separator", "settings", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1771-L1775
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java
QueryRunner.runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition
public Result runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) { """ for a single partition. If the index is global it won't be asked """ MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName()); PartitionIdSet partitions = singletonPartitionIdSet(partitionCount, partitionId); // first we optimize the query Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId)); Collection<QueryableEntry> entries = null; Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes != null && !indexes.isGlobal()) { entries = indexes.query(predicate); } Result result; if (entries == null) { result = createResult(query, partitions); partitionScanExecutor.execute(query.getMapName(), predicate, partitions, result); result.completeConstruction(partitions); } else { result = populateNonEmptyResult(query, entries, partitions); } return result; }
java
public Result runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) { MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName()); PartitionIdSet partitions = singletonPartitionIdSet(partitionCount, partitionId); // first we optimize the query Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId)); Collection<QueryableEntry> entries = null; Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes != null && !indexes.isGlobal()) { entries = indexes.query(predicate); } Result result; if (entries == null) { result = createResult(query, partitions); partitionScanExecutor.execute(query.getMapName(), predicate, partitions, result); result.completeConstruction(partitions); } else { result = populateNonEmptyResult(query, entries, partitions); } return result; }
[ "public", "Result", "runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition", "(", "Query", "query", ",", "int", "partitionId", ")", "{", "MapContainer", "mapContainer", "=", "mapServiceContext", ".", "getMapContainer", "(", "query", ".", "getMapName", "(", ")", ")", ";", "PartitionIdSet", "partitions", "=", "singletonPartitionIdSet", "(", "partitionCount", ",", "partitionId", ")", ";", "// first we optimize the query", "Predicate", "predicate", "=", "queryOptimizer", ".", "optimize", "(", "query", ".", "getPredicate", "(", ")", ",", "mapContainer", ".", "getIndexes", "(", "partitionId", ")", ")", ";", "Collection", "<", "QueryableEntry", ">", "entries", "=", "null", ";", "Indexes", "indexes", "=", "mapContainer", ".", "getIndexes", "(", "partitionId", ")", ";", "if", "(", "indexes", "!=", "null", "&&", "!", "indexes", ".", "isGlobal", "(", ")", ")", "{", "entries", "=", "indexes", ".", "query", "(", "predicate", ")", ";", "}", "Result", "result", ";", "if", "(", "entries", "==", "null", ")", "{", "result", "=", "createResult", "(", "query", ",", "partitions", ")", ";", "partitionScanExecutor", ".", "execute", "(", "query", ".", "getMapName", "(", ")", ",", "predicate", ",", "partitions", ",", "result", ")", ";", "result", ".", "completeConstruction", "(", "partitions", ")", ";", "}", "else", "{", "result", "=", "populateNonEmptyResult", "(", "query", ",", "entries", ",", "partitions", ")", ";", "}", "return", "result", ";", "}" ]
for a single partition. If the index is global it won't be asked
[ "for", "a", "single", "partition", ".", "If", "the", "index", "is", "global", "it", "won", "t", "be", "asked" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java#L180-L203
tdomzal/junit-docker-rule
src/main/java/pl/domzal/junit/docker/rule/DockerRule.java
DockerRule.waitForLogMessage
public void waitForLogMessage(final String logSearchString, int waitTime) throws TimeoutException { """ Stop and wait till given string will show in container output. @param logSearchString String to wait for in container output. @param waitTime Wait time. @throws TimeoutException On wait timeout. """ WaitForContainer.waitForCondition(new LogChecker(this, logSearchString), waitTime, describe()); }
java
public void waitForLogMessage(final String logSearchString, int waitTime) throws TimeoutException { WaitForContainer.waitForCondition(new LogChecker(this, logSearchString), waitTime, describe()); }
[ "public", "void", "waitForLogMessage", "(", "final", "String", "logSearchString", ",", "int", "waitTime", ")", "throws", "TimeoutException", "{", "WaitForContainer", ".", "waitForCondition", "(", "new", "LogChecker", "(", "this", ",", "logSearchString", ")", ",", "waitTime", ",", "describe", "(", ")", ")", ";", "}" ]
Stop and wait till given string will show in container output. @param logSearchString String to wait for in container output. @param waitTime Wait time. @throws TimeoutException On wait timeout.
[ "Stop", "and", "wait", "till", "given", "string", "will", "show", "in", "container", "output", "." ]
train
https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRule.java#L361-L363
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRCursorController.java
GVRCursorController.setPosition
public void setPosition(float x, float y, float z) { """ This call sets the position of the {@link GVRCursorController}. Use this call to also set an initial position for the Cursor when a new {@link GVRCursorController} is selected. @param x the x value of the position. @param y the y value of the position. @param z the z value of the position. """ if (isEnabled()) { position.set(x, y, z); } }
java
public void setPosition(float x, float y, float z) { if (isEnabled()) { position.set(x, y, z); } }
[ "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "{", "position", ".", "set", "(", "x", ",", "y", ",", "z", ")", ";", "}", "}" ]
This call sets the position of the {@link GVRCursorController}. Use this call to also set an initial position for the Cursor when a new {@link GVRCursorController} is selected. @param x the x value of the position. @param y the y value of the position. @param z the z value of the position.
[ "This", "call", "sets", "the", "position", "of", "the", "{", "@link", "GVRCursorController", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRCursorController.java#L639-L645
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/FileIoUtil.java
FileIoUtil.getTextfileFromUrl
public static List<String> getTextfileFromUrl(String _url, Charset _charset) { """ Retrives a text file from an given URL and reads the content with the given charset. Url could be remote (like http://) or local (file://) If protocol is not specified by "protocol://" (like "http://" or "file://"), "file://" is assumed. @param _url @param _charset @return fileContent as List or null if file is empty or an error occurred. """ return getTextfileFromUrl(_url, _charset, false); }
java
public static List<String> getTextfileFromUrl(String _url, Charset _charset) { return getTextfileFromUrl(_url, _charset, false); }
[ "public", "static", "List", "<", "String", ">", "getTextfileFromUrl", "(", "String", "_url", ",", "Charset", "_charset", ")", "{", "return", "getTextfileFromUrl", "(", "_url", ",", "_charset", ",", "false", ")", ";", "}" ]
Retrives a text file from an given URL and reads the content with the given charset. Url could be remote (like http://) or local (file://) If protocol is not specified by "protocol://" (like "http://" or "file://"), "file://" is assumed. @param _url @param _charset @return fileContent as List or null if file is empty or an error occurred.
[ "Retrives", "a", "text", "file", "from", "an", "given", "URL", "and", "reads", "the", "content", "with", "the", "given", "charset", ".", "Url", "could", "be", "remote", "(", "like", "http", ":", "//", ")", "or", "local", "(", "file", ":", "//", ")" ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/FileIoUtil.java#L161-L163
anotheria/moskito
moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java
AbstractInterceptor.getStats
protected final T getStats(OnDemandStatsProducer producer, String name) { """ Returns stats for producer. @param producer {@link OnDemandStatsProducer} @param name stats name @return stats for producer """ try { return getStatsClass().cast(producer.getStats(name)); } catch (ClassCastException e) { LOGGER.error("getStats(): Unexpected stats type", e); } catch (OnDemandStatsProducerException e) { LOGGER.error("getStats(): Failed to get stats for name=" + name, e); } return null; }
java
protected final T getStats(OnDemandStatsProducer producer, String name) { try { return getStatsClass().cast(producer.getStats(name)); } catch (ClassCastException e) { LOGGER.error("getStats(): Unexpected stats type", e); } catch (OnDemandStatsProducerException e) { LOGGER.error("getStats(): Failed to get stats for name=" + name, e); } return null; }
[ "protected", "final", "T", "getStats", "(", "OnDemandStatsProducer", "producer", ",", "String", "name", ")", "{", "try", "{", "return", "getStatsClass", "(", ")", ".", "cast", "(", "producer", ".", "getStats", "(", "name", ")", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"getStats(): Unexpected stats type\"", ",", "e", ")", ";", "}", "catch", "(", "OnDemandStatsProducerException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"getStats(): Failed to get stats for name=\"", "+", "name", ",", "e", ")", ";", "}", "return", "null", ";", "}" ]
Returns stats for producer. @param producer {@link OnDemandStatsProducer} @param name stats name @return stats for producer
[ "Returns", "stats", "for", "producer", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java#L104-L114
dlemmermann/CalendarFX
CalendarFXRecurrence/src/main/java/com/google/ical/util/DTBuilder.java
DTBuilder.toDateTime
public DateTimeValue toDateTime() { """ produces a normalized date time, using zero for the time fields if none were provided. @return not null """ normalize(); return new DateTimeValueImpl(year, month, day, hour, minute, second); }
java
public DateTimeValue toDateTime() { normalize(); return new DateTimeValueImpl(year, month, day, hour, minute, second); }
[ "public", "DateTimeValue", "toDateTime", "(", ")", "{", "normalize", "(", ")", ";", "return", "new", "DateTimeValueImpl", "(", "year", ",", "month", ",", "day", ",", "hour", ",", "minute", ",", "second", ")", ";", "}" ]
produces a normalized date time, using zero for the time fields if none were provided. @return not null
[ "produces", "a", "normalized", "date", "time", "using", "zero", "for", "the", "time", "fields", "if", "none", "were", "provided", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/util/DTBuilder.java#L83-L86
kiegroup/drools
drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java
PhreakBranchNode.getBranchTuples
private BranchTuples getBranchTuples(LeftTupleSink sink, LeftTuple leftTuple) { """ A branch has two potential sinks. rtnSink is for the sink if the contained logic returns true. mainSink is for propagations after the branch node, if they are allowed. it may have one or the other or both. there is no state that indicates whether one or the other or both are present, so all tuple children must be inspected and references coalesced from that. when handling updates and deletes it must search the child tuples to colasce the references. This is done by checking the tuple sink with the known main or rtn sink. """ BranchTuples branchTuples = new BranchTuples(); LeftTuple child = leftTuple.getFirstChild(); if ( child != null ) { // assigns the correct main or rtn LeftTuple based on the identified sink if ( child.getTupleSink() == sink ) { branchTuples.mainLeftTuple = child; } else { branchTuples.rtnLeftTuple = child; } child = child.getHandleNext(); if ( child != null ) { if ( child.getTupleSink() == sink ) { branchTuples.mainLeftTuple = child; } else { branchTuples.rtnLeftTuple = child; } } } return branchTuples; }
java
private BranchTuples getBranchTuples(LeftTupleSink sink, LeftTuple leftTuple) { BranchTuples branchTuples = new BranchTuples(); LeftTuple child = leftTuple.getFirstChild(); if ( child != null ) { // assigns the correct main or rtn LeftTuple based on the identified sink if ( child.getTupleSink() == sink ) { branchTuples.mainLeftTuple = child; } else { branchTuples.rtnLeftTuple = child; } child = child.getHandleNext(); if ( child != null ) { if ( child.getTupleSink() == sink ) { branchTuples.mainLeftTuple = child; } else { branchTuples.rtnLeftTuple = child; } } } return branchTuples; }
[ "private", "BranchTuples", "getBranchTuples", "(", "LeftTupleSink", "sink", ",", "LeftTuple", "leftTuple", ")", "{", "BranchTuples", "branchTuples", "=", "new", "BranchTuples", "(", ")", ";", "LeftTuple", "child", "=", "leftTuple", ".", "getFirstChild", "(", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "// assigns the correct main or rtn LeftTuple based on the identified sink", "if", "(", "child", ".", "getTupleSink", "(", ")", "==", "sink", ")", "{", "branchTuples", ".", "mainLeftTuple", "=", "child", ";", "}", "else", "{", "branchTuples", ".", "rtnLeftTuple", "=", "child", ";", "}", "child", "=", "child", ".", "getHandleNext", "(", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "if", "(", "child", ".", "getTupleSink", "(", ")", "==", "sink", ")", "{", "branchTuples", ".", "mainLeftTuple", "=", "child", ";", "}", "else", "{", "branchTuples", ".", "rtnLeftTuple", "=", "child", ";", "}", "}", "}", "return", "branchTuples", ";", "}" ]
A branch has two potential sinks. rtnSink is for the sink if the contained logic returns true. mainSink is for propagations after the branch node, if they are allowed. it may have one or the other or both. there is no state that indicates whether one or the other or both are present, so all tuple children must be inspected and references coalesced from that. when handling updates and deletes it must search the child tuples to colasce the references. This is done by checking the tuple sink with the known main or rtn sink.
[ "A", "branch", "has", "two", "potential", "sinks", ".", "rtnSink", "is", "for", "the", "sink", "if", "the", "contained", "logic", "returns", "true", ".", "mainSink", "is", "for", "propagations", "after", "the", "branch", "node", "if", "they", "are", "allowed", ".", "it", "may", "have", "one", "or", "the", "other", "or", "both", ".", "there", "is", "no", "state", "that", "indicates", "whether", "one", "or", "the", "other", "or", "both", "are", "present", "so", "all", "tuple", "children", "must", "be", "inspected", "and", "references", "coalesced", "from", "that", ".", "when", "handling", "updates", "and", "deletes", "it", "must", "search", "the", "child", "tuples", "to", "colasce", "the", "references", ".", "This", "is", "done", "by", "checking", "the", "tuple", "sink", "with", "the", "known", "main", "or", "rtn", "sink", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java#L220-L240
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toSqlDate
public static java.sql.Date toSqlDate(Object value) { """ Expects a <code>java.sql.Date</code>, <code>java.sql.Timestamp</code>, <code>java.sql.Time</code>, <code>java.util.Date</code>, <code>Long</code> or any object whose toString method has this format: <code>yyyy-mm-dd</code>. @param value argument that is possible to convert to <code>java.sql.Date</code>. @return <code>java.sql.Date</code> instance representing input value. """ if (value == null) { return null; } else if (value instanceof java.sql.Date) { return (java.sql.Date) value; } else if (value instanceof java.util.Date) { return new java.sql.Date(((java.util.Date) value).getTime()); } else if (value instanceof Number) { return new java.sql.Date(((Number) value).longValue()); } else { try { return java.sql.Date.valueOf(value.toString().trim()); } catch (IllegalArgumentException e) { throw new ConversionException("failed to convert: '" + value + "' to java.sql.Date", e); } } }
java
public static java.sql.Date toSqlDate(Object value){ if (value == null) { return null; } else if (value instanceof java.sql.Date) { return (java.sql.Date) value; } else if (value instanceof java.util.Date) { return new java.sql.Date(((java.util.Date) value).getTime()); } else if (value instanceof Number) { return new java.sql.Date(((Number) value).longValue()); } else { try { return java.sql.Date.valueOf(value.toString().trim()); } catch (IllegalArgumentException e) { throw new ConversionException("failed to convert: '" + value + "' to java.sql.Date", e); } } }
[ "public", "static", "java", ".", "sql", ".", "Date", "toSqlDate", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "java", ".", "sql", ".", "Date", ")", "{", "return", "(", "java", ".", "sql", ".", "Date", ")", "value", ";", "}", "else", "if", "(", "value", "instanceof", "java", ".", "util", ".", "Date", ")", "{", "return", "new", "java", ".", "sql", ".", "Date", "(", "(", "(", "java", ".", "util", ".", "Date", ")", "value", ")", ".", "getTime", "(", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "Number", ")", "{", "return", "new", "java", ".", "sql", ".", "Date", "(", "(", "(", "Number", ")", "value", ")", ".", "longValue", "(", ")", ")", ";", "}", "else", "{", "try", "{", "return", "java", ".", "sql", ".", "Date", ".", "valueOf", "(", "value", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "ConversionException", "(", "\"failed to convert: '\"", "+", "value", "+", "\"' to java.sql.Date\"", ",", "e", ")", ";", "}", "}", "}" ]
Expects a <code>java.sql.Date</code>, <code>java.sql.Timestamp</code>, <code>java.sql.Time</code>, <code>java.util.Date</code>, <code>Long</code> or any object whose toString method has this format: <code>yyyy-mm-dd</code>. @param value argument that is possible to convert to <code>java.sql.Date</code>. @return <code>java.sql.Date</code> instance representing input value.
[ "Expects", "a", "<code", ">", "java", ".", "sql", ".", "Date<", "/", "code", ">", "<code", ">", "java", ".", "sql", ".", "Timestamp<", "/", "code", ">", "<code", ">", "java", ".", "sql", ".", "Time<", "/", "code", ">", "<code", ">", "java", ".", "util", ".", "Date<", "/", "code", ">", "<code", ">", "Long<", "/", "code", ">", "or", "any", "object", "whose", "toString", "method", "has", "this", "format", ":", "<code", ">", "yyyy", "-", "mm", "-", "dd<", "/", "code", ">", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L138-L154
banq/jdonframework
src/main/java/com/jdon/container/pico/JdonPicoContainer.java
JdonPicoContainer.registerComponentInstance
public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance) throws PicoRegistrationException { """ {@inheritDoc} The returned ComponentAdapter will be an {@link InstanceComponentAdapter}. """ if (componentInstance instanceof MutablePicoContainer) { MutablePicoContainer pc = (MutablePicoContainer) componentInstance; Object contrivedKey = new Object(); String contrivedComp = ""; pc.registerComponentInstance(contrivedKey, contrivedComp); try { if (this.getComponentInstance(contrivedKey) != null) { throw new PicoRegistrationException("Cannot register a container to itself. The container is already implicitly registered."); } } finally { pc.unregisterComponent(contrivedKey); } } ComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance); registerComponent(componentAdapter); return componentAdapter; }
java
public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance) throws PicoRegistrationException { if (componentInstance instanceof MutablePicoContainer) { MutablePicoContainer pc = (MutablePicoContainer) componentInstance; Object contrivedKey = new Object(); String contrivedComp = ""; pc.registerComponentInstance(contrivedKey, contrivedComp); try { if (this.getComponentInstance(contrivedKey) != null) { throw new PicoRegistrationException("Cannot register a container to itself. The container is already implicitly registered."); } } finally { pc.unregisterComponent(contrivedKey); } } ComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance); registerComponent(componentAdapter); return componentAdapter; }
[ "public", "ComponentAdapter", "registerComponentInstance", "(", "Object", "componentKey", ",", "Object", "componentInstance", ")", "throws", "PicoRegistrationException", "{", "if", "(", "componentInstance", "instanceof", "MutablePicoContainer", ")", "{", "MutablePicoContainer", "pc", "=", "(", "MutablePicoContainer", ")", "componentInstance", ";", "Object", "contrivedKey", "=", "new", "Object", "(", ")", ";", "String", "contrivedComp", "=", "\"\"", ";", "pc", ".", "registerComponentInstance", "(", "contrivedKey", ",", "contrivedComp", ")", ";", "try", "{", "if", "(", "this", ".", "getComponentInstance", "(", "contrivedKey", ")", "!=", "null", ")", "{", "throw", "new", "PicoRegistrationException", "(", "\"Cannot register a container to itself. The container is already implicitly registered.\"", ")", ";", "}", "}", "finally", "{", "pc", ".", "unregisterComponent", "(", "contrivedKey", ")", ";", "}", "}", "ComponentAdapter", "componentAdapter", "=", "new", "InstanceComponentAdapter", "(", "componentKey", ",", "componentInstance", ")", ";", "registerComponent", "(", "componentAdapter", ")", ";", "return", "componentAdapter", ";", "}" ]
{@inheritDoc} The returned ComponentAdapter will be an {@link InstanceComponentAdapter}.
[ "{" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/pico/JdonPicoContainer.java#L226-L244
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java
ClustersInner.beginCreateOrUpdateAsync
public Observable<ClusterInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { """ Create or update a Kusto cluster. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
java
public Observable<ClusterInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ClusterInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ClusterInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ClusterInner", ">", ",", "ClusterInner", ">", "(", ")", "{", "@", "Override", "public", "ClusterInner", "call", "(", "ServiceResponse", "<", "ClusterInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update a Kusto cluster. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object
[ "Create", "or", "update", "a", "Kusto", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L335-L342
looly/hutool
hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java
MapUtil.getBool
public static Boolean getBool(Map<?, ?> map, Object key) { """ 获取Map指定key的值,并转换为Bool @param map Map @param key 键 @return 值 @since 4.0.6 """ return get(map, key, Boolean.class); }
java
public static Boolean getBool(Map<?, ?> map, Object key) { return get(map, key, Boolean.class); }
[ "public", "static", "Boolean", "getBool", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "Object", "key", ")", "{", "return", "get", "(", "map", ",", "key", ",", "Boolean", ".", "class", ")", ";", "}" ]
获取Map指定key的值,并转换为Bool @param map Map @param key 键 @return 值 @since 4.0.6
[ "获取Map指定key的值,并转换为Bool" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L816-L818
linkedin/dexmaker
dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/extended/ExtendedMockito.java
ExtendedMockito.doThrow
@SafeVarargs public static StaticCapableStubber doThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... toBeThrownNext) { """ Same as {@link Mockito#doThrow(Class, Class...)} but adds the ability to stub static method calls via {@link StaticCapableStubber#when(MockedMethod)} and {@link StaticCapableStubber#when(MockedVoidMethod)}. """ return new StaticCapableStubber(Mockito.doThrow(toBeThrown, toBeThrownNext)); }
java
@SafeVarargs public static StaticCapableStubber doThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... toBeThrownNext) { return new StaticCapableStubber(Mockito.doThrow(toBeThrown, toBeThrownNext)); }
[ "@", "SafeVarargs", "public", "static", "StaticCapableStubber", "doThrow", "(", "Class", "<", "?", "extends", "Throwable", ">", "toBeThrown", ",", "Class", "<", "?", "extends", "Throwable", ">", "...", "toBeThrownNext", ")", "{", "return", "new", "StaticCapableStubber", "(", "Mockito", ".", "doThrow", "(", "toBeThrown", ",", "toBeThrownNext", ")", ")", ";", "}" ]
Same as {@link Mockito#doThrow(Class, Class...)} but adds the ability to stub static method calls via {@link StaticCapableStubber#when(MockedMethod)} and {@link StaticCapableStubber#when(MockedVoidMethod)}.
[ "Same", "as", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/extended/ExtendedMockito.java#L131-L135
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/scheduler/CmsEditScheduledJobInfoDialog.java
CmsEditScheduledJobInfoDialog.getComboCronExpressions
protected List<CmsSelectWidgetOption> getComboCronExpressions() { """ Returns the example cron expressions to show in the combo box.<p> The result list elements are of type <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code>.<p> @return the example cron expressions to show in the combo box """ List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); // 0 0 3 * * ? (daily at 3 am) result.add(new CmsSelectWidgetOption("0 0 3 * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE1_0))); // 0 0/30 * * * ? (daily every thirty minutes) result.add( new CmsSelectWidgetOption("0 0/30 * * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE2_0))); // 0 30 8 ? * 4 (every Wednesday at 8:30 am) result.add(new CmsSelectWidgetOption("0 30 8 ? * 4", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE3_0))); // 0 15 18 15 * ? (on the 20th day of the month at 6:15 pm) result.add( new CmsSelectWidgetOption("0 15 18 20 * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE4_0))); // 0 45 15 ? * 1 2007-2009 (every Sunday from the year 2007 to 2009 at 3:45 pm) result.add( new CmsSelectWidgetOption( "0 45 15 ? * 1 2007-2009", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE5_0))); return result; }
java
protected List<CmsSelectWidgetOption> getComboCronExpressions() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); // 0 0 3 * * ? (daily at 3 am) result.add(new CmsSelectWidgetOption("0 0 3 * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE1_0))); // 0 0/30 * * * ? (daily every thirty minutes) result.add( new CmsSelectWidgetOption("0 0/30 * * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE2_0))); // 0 30 8 ? * 4 (every Wednesday at 8:30 am) result.add(new CmsSelectWidgetOption("0 30 8 ? * 4", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE3_0))); // 0 15 18 15 * ? (on the 20th day of the month at 6:15 pm) result.add( new CmsSelectWidgetOption("0 15 18 20 * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE4_0))); // 0 45 15 ? * 1 2007-2009 (every Sunday from the year 2007 to 2009 at 3:45 pm) result.add( new CmsSelectWidgetOption( "0 45 15 ? * 1 2007-2009", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE5_0))); return result; }
[ "protected", "List", "<", "CmsSelectWidgetOption", ">", "getComboCronExpressions", "(", ")", "{", "List", "<", "CmsSelectWidgetOption", ">", "result", "=", "new", "ArrayList", "<", "CmsSelectWidgetOption", ">", "(", ")", ";", "// 0 0 3 * * ? (daily at 3 am)", "result", ".", "add", "(", "new", "CmsSelectWidgetOption", "(", "\"0 0 3 * * ?\"", ",", "false", ",", "null", ",", "key", "(", "Messages", ".", "GUI_EDITOR_CRONJOB_EXAMPLE1_0", ")", ")", ")", ";", "// 0 0/30 * * * ? (daily every thirty minutes)", "result", ".", "add", "(", "new", "CmsSelectWidgetOption", "(", "\"0 0/30 * * * ?\"", ",", "false", ",", "null", ",", "key", "(", "Messages", ".", "GUI_EDITOR_CRONJOB_EXAMPLE2_0", ")", ")", ")", ";", "// 0 30 8 ? * 4 (every Wednesday at 8:30 am)", "result", ".", "add", "(", "new", "CmsSelectWidgetOption", "(", "\"0 30 8 ? * 4\"", ",", "false", ",", "null", ",", "key", "(", "Messages", ".", "GUI_EDITOR_CRONJOB_EXAMPLE3_0", ")", ")", ")", ";", "// 0 15 18 15 * ? (on the 20th day of the month at 6:15 pm)", "result", ".", "add", "(", "new", "CmsSelectWidgetOption", "(", "\"0 15 18 20 * ?\"", ",", "false", ",", "null", ",", "key", "(", "Messages", ".", "GUI_EDITOR_CRONJOB_EXAMPLE4_0", ")", ")", ")", ";", "// 0 45 15 ? * 1 2007-2009 (every Sunday from the year 2007 to 2009 at 3:45 pm)", "result", ".", "add", "(", "new", "CmsSelectWidgetOption", "(", "\"0 45 15 ? * 1 2007-2009\"", ",", "false", ",", "null", ",", "key", "(", "Messages", ".", "GUI_EDITOR_CRONJOB_EXAMPLE5_0", ")", ")", ")", ";", "return", "result", ";", "}" ]
Returns the example cron expressions to show in the combo box.<p> The result list elements are of type <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code>.<p> @return the example cron expressions to show in the combo box
[ "Returns", "the", "example", "cron", "expressions", "to", "show", "in", "the", "combo", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/scheduler/CmsEditScheduledJobInfoDialog.java#L400-L422
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listCustomPrebuiltModelsAsync
public Observable<List<CustomPrebuiltModel>> listCustomPrebuiltModelsAsync(UUID appId, String versionId) { """ Gets all custom prebuilt models information of this application. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;CustomPrebuiltModel&gt; object """ return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<CustomPrebuiltModel>>, List<CustomPrebuiltModel>>() { @Override public List<CustomPrebuiltModel> call(ServiceResponse<List<CustomPrebuiltModel>> response) { return response.body(); } }); }
java
public Observable<List<CustomPrebuiltModel>> listCustomPrebuiltModelsAsync(UUID appId, String versionId) { return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<CustomPrebuiltModel>>, List<CustomPrebuiltModel>>() { @Override public List<CustomPrebuiltModel> call(ServiceResponse<List<CustomPrebuiltModel>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "CustomPrebuiltModel", ">", ">", "listCustomPrebuiltModelsAsync", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "listCustomPrebuiltModelsWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "CustomPrebuiltModel", ">", ">", ",", "List", "<", "CustomPrebuiltModel", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "CustomPrebuiltModel", ">", "call", "(", "ServiceResponse", "<", "List", "<", "CustomPrebuiltModel", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets all custom prebuilt models information of this application. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;CustomPrebuiltModel&gt; object
[ "Gets", "all", "custom", "prebuilt", "models", "information", "of", "this", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6089-L6096
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java
ArrayUtil.indexOf
public static int indexOf(String ele, String[] arr) { """ check and search the specified element in the Array @param ele @param arr @return int """ if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].equals(ele) ) { return i; } } return -1; }
java
public static int indexOf(String ele, String[] arr) { if ( arr == null ) { return -1; } for ( int i = 0; i < arr.length; i++ ) { if ( arr[i].equals(ele) ) { return i; } } return -1; }
[ "public", "static", "int", "indexOf", "(", "String", "ele", ",", "String", "[", "]", "arr", ")", "{", "if", "(", "arr", "==", "null", ")", "{", "return", "-", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "if", "(", "arr", "[", "i", "]", ".", "equals", "(", "ele", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
check and search the specified element in the Array @param ele @param arr @return int
[ "check", "and", "search", "the", "specified", "element", "in", "the", "Array" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L42-L55
lisicnu/droidUtil
src/main/java/com/github/lisicnu/libDroid/helper/BitmapCacheLoader.java
BitmapCacheLoader.loadFile
public Bitmap loadFile(String fileName, String tmpDirectory, ImageCallBack imageCallBack, boolean canRemove) { """ Load Steps:<br/> 1. load from caches. <br/> 2. if file not exist in caches, then load it from local storage.<br/> 3. if local storage not exist, then load it from temporary directory.<br/> 4. if file not exist in temporary directory. then download it.<br/> 5. after download, then callback will be added.<br/> @param fileName file name , local or URL 可以是带路径名, 也可以不带路径名. 当带路径名时, 先去查找指定目录.. 然后再找傳入的臨時目錄. @param tmpDirectory 临时目录, 下载之后的保存目录. 默认路径: mnt/sdcard/cache @param imageCallBack 下载完成时的毁掉 @param canRemove 是否可以移除. 当等待的个数超过最大下载数目时, 当前条目是否可以清除. @return the bitmap loaded. if from network, this will return null, return the result from callback """ return loadFile(fileName, tmpDirectory, imageCallBack, canRemove, -1, -1); }
java
public Bitmap loadFile(String fileName, String tmpDirectory, ImageCallBack imageCallBack, boolean canRemove) { return loadFile(fileName, tmpDirectory, imageCallBack, canRemove, -1, -1); }
[ "public", "Bitmap", "loadFile", "(", "String", "fileName", ",", "String", "tmpDirectory", ",", "ImageCallBack", "imageCallBack", ",", "boolean", "canRemove", ")", "{", "return", "loadFile", "(", "fileName", ",", "tmpDirectory", ",", "imageCallBack", ",", "canRemove", ",", "-", "1", ",", "-", "1", ")", ";", "}" ]
Load Steps:<br/> 1. load from caches. <br/> 2. if file not exist in caches, then load it from local storage.<br/> 3. if local storage not exist, then load it from temporary directory.<br/> 4. if file not exist in temporary directory. then download it.<br/> 5. after download, then callback will be added.<br/> @param fileName file name , local or URL 可以是带路径名, 也可以不带路径名. 当带路径名时, 先去查找指定目录.. 然后再找傳入的臨時目錄. @param tmpDirectory 临时目录, 下载之后的保存目录. 默认路径: mnt/sdcard/cache @param imageCallBack 下载完成时的毁掉 @param canRemove 是否可以移除. 当等待的个数超过最大下载数目时, 当前条目是否可以清除. @return the bitmap loaded. if from network, this will return null, return the result from callback
[ "Load", "Steps", ":", "<br", "/", ">", "1", ".", "load", "from", "caches", ".", "<br", "/", ">", "2", ".", "if", "file", "not", "exist", "in", "caches", "then", "load", "it", "from", "local", "storage", ".", "<br", "/", ">", "3", ".", "if", "local", "storage", "not", "exist", "then", "load", "it", "from", "temporary", "directory", ".", "<br", "/", ">", "4", ".", "if", "file", "not", "exist", "in", "temporary", "directory", ".", "then", "download", "it", ".", "<br", "/", ">", "5", ".", "after", "download", "then", "callback", "will", "be", "added", ".", "<br", "/", ">" ]
train
https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/helper/BitmapCacheLoader.java#L162-L166
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginCreateOrUpdate
public VirtualMachineInner beginCreateOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner parameters) { """ The operation to create or update a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Create Virtual Machine operation. @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 VirtualMachineInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body(); }
java
public VirtualMachineInner beginCreateOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body(); }
[ "public", "VirtualMachineInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "VirtualMachineInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
The operation to create or update a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Create Virtual Machine operation. @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 VirtualMachineInner object if successful.
[ "The", "operation", "to", "create", "or", "update", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L627-L629
denisneuling/apitrary.jar
apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java
ClassUtil.getFieldAnnotationValue
@SuppressWarnings("unchecked") public static <T> T getFieldAnnotationValue(String annotationProperty, Field field, Class<? extends Annotation> annotationClass, Class<T> ofType) { """ <p> getFieldAnnotationValue. </p> @param annotationProperty a {@link java.lang.String} object. @param field a {@link java.lang.reflect.Field} object. @param annotationClass a {@link java.lang.Class} object. @param ofType a {@link java.lang.Class} object. @param <T> a T object. @return a T object. """ Object annotation = field.getAnnotation(annotationClass); T result = null; if (annotation != null) { try { Method method = annotationClass.getMethod(annotationProperty, new Class[] {}); result = (T) method.invoke(annotation, new Object[] {}); } catch (Exception e) { throw new RuntimeException(e); } } return result; }
java
@SuppressWarnings("unchecked") public static <T> T getFieldAnnotationValue(String annotationProperty, Field field, Class<? extends Annotation> annotationClass, Class<T> ofType) { Object annotation = field.getAnnotation(annotationClass); T result = null; if (annotation != null) { try { Method method = annotationClass.getMethod(annotationProperty, new Class[] {}); result = (T) method.invoke(annotation, new Object[] {}); } catch (Exception e) { throw new RuntimeException(e); } } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getFieldAnnotationValue", "(", "String", "annotationProperty", ",", "Field", "field", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "Class", "<", "T", ">", "ofType", ")", "{", "Object", "annotation", "=", "field", ".", "getAnnotation", "(", "annotationClass", ")", ";", "T", "result", "=", "null", ";", "if", "(", "annotation", "!=", "null", ")", "{", "try", "{", "Method", "method", "=", "annotationClass", ".", "getMethod", "(", "annotationProperty", ",", "new", "Class", "[", "]", "{", "}", ")", ";", "result", "=", "(", "T", ")", "method", ".", "invoke", "(", "annotation", ",", "new", "Object", "[", "]", "{", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "return", "result", ";", "}" ]
<p> getFieldAnnotationValue. </p> @param annotationProperty a {@link java.lang.String} object. @param field a {@link java.lang.reflect.Field} object. @param annotationClass a {@link java.lang.Class} object. @param ofType a {@link java.lang.Class} object. @param <T> a T object. @return a T object.
[ "<p", ">", "getFieldAnnotationValue", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L394-L408
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.findByGroupId
@Override public List<CPInstance> findByGroupId(long groupId) { """ Returns all the cp instances where groupId = &#63;. @param groupId the group ID @return the matching cp instances """ return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPInstance> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPInstance", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp instances where groupId = &#63;. @param groupId the group ID @return the matching cp instances
[ "Returns", "all", "the", "cp", "instances", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L1507-L1510