repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
lightblueseas/net-extensions
src/main/java/de/alpharogroup/net/IPResolver.java
IPResolver.getLocalIPFromServerSocket
public static InetAddress getLocalIPFromServerSocket(final int port, final int backlog) throws UnknownHostException, IOException { InetAddress inetAddress = null; ServerSocket socket = null; try { socket = new ServerSocket(port, backlog, InetAddress.getLocalHost()); inetAddress = socket.getInetAddress(); socket.close(); } finally { SocketExtensions.closeServerSocket(socket); } return inetAddress; }
java
public static InetAddress getLocalIPFromServerSocket(final int port, final int backlog) throws UnknownHostException, IOException { InetAddress inetAddress = null; ServerSocket socket = null; try { socket = new ServerSocket(port, backlog, InetAddress.getLocalHost()); inetAddress = socket.getInetAddress(); socket.close(); } finally { SocketExtensions.closeServerSocket(socket); } return inetAddress; }
[ "public", "static", "InetAddress", "getLocalIPFromServerSocket", "(", "final", "int", "port", ",", "final", "int", "backlog", ")", "throws", "UnknownHostException", ",", "IOException", "{", "InetAddress", "inetAddress", "=", "null", ";", "ServerSocket", "socket", "=...
Gets the InetAddress object from the local host from a ServerSocket object. @param port the local TCP port @param backlog the listen backlog @return Returns the InetAddress object from the local host from a ServerSocket object. @throws IOException Signals that an I/O exception has occurred. @throws UnknownHostException is thrown if the local host name could not be resolved into an address.
[ "Gets", "the", "InetAddress", "object", "from", "the", "local", "host", "from", "a", "ServerSocket", "object", "." ]
train
https://github.com/lightblueseas/net-extensions/blob/771757a93fa9ad13ce0fe061c158e5cba43344cb/src/main/java/de/alpharogroup/net/IPResolver.java#L118-L134
ManfredTremmel/gwt-commons-lang3
src/main/resources/org/apache/commons/jre/java/util/BitSet.java
BitSet.setInternal
private static void setInternal(int[] array, int fromIndex, int toIndex) { int first = wordIndex(fromIndex); int last = wordIndex(toIndex); maybeGrowArrayToIndex(array, last); int startBit = bitOffset(fromIndex); int endBit = bitOffset(toIndex); if (first == last) { // Set the bits in between first and last. maskInWord(array, first, startBit, endBit); } else { // Set the bits from fromIndex to the next 31 bit boundary. maskInWord(array, first, startBit, BITS_PER_WORD); // Set the bits from the last 31 bit boundary to toIndex. maskInWord(array, last, 0, endBit); // Set everything in between. for (int i = first + 1; i < last; i++) { array[i] = WORD_MASK; } } }
java
private static void setInternal(int[] array, int fromIndex, int toIndex) { int first = wordIndex(fromIndex); int last = wordIndex(toIndex); maybeGrowArrayToIndex(array, last); int startBit = bitOffset(fromIndex); int endBit = bitOffset(toIndex); if (first == last) { // Set the bits in between first and last. maskInWord(array, first, startBit, endBit); } else { // Set the bits from fromIndex to the next 31 bit boundary. maskInWord(array, first, startBit, BITS_PER_WORD); // Set the bits from the last 31 bit boundary to toIndex. maskInWord(array, last, 0, endBit); // Set everything in between. for (int i = first + 1; i < last; i++) { array[i] = WORD_MASK; } } }
[ "private", "static", "void", "setInternal", "(", "int", "[", "]", "array", ",", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "int", "first", "=", "wordIndex", "(", "fromIndex", ")", ";", "int", "last", "=", "wordIndex", "(", "toIndex", ")", ";"...
Sets all bits to true within the given range. @param fromIndex The lower bit index. @param toIndex The upper bit index.
[ "Sets", "all", "bits", "to", "true", "within", "the", "given", "range", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/BitSet.java#L99-L123
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassSpinnerUI.java
SeaGlassSpinnerUI.replaceEditor
@Override protected void replaceEditor(JComponent oldEditor, JComponent newEditor) { spinner.remove(oldEditor); spinner.add(newEditor, "Editor"); if (oldEditor instanceof JSpinner.DefaultEditor) { JTextField tf = ((JSpinner.DefaultEditor)oldEditor).getTextField(); if (tf != null) { tf.removeFocusListener(editorFocusHandler); } } if (newEditor instanceof JSpinner.DefaultEditor) { JTextField tf = ((JSpinner.DefaultEditor)newEditor).getTextField(); if (tf != null) { tf.addFocusListener(editorFocusHandler); } } }
java
@Override protected void replaceEditor(JComponent oldEditor, JComponent newEditor) { spinner.remove(oldEditor); spinner.add(newEditor, "Editor"); if (oldEditor instanceof JSpinner.DefaultEditor) { JTextField tf = ((JSpinner.DefaultEditor)oldEditor).getTextField(); if (tf != null) { tf.removeFocusListener(editorFocusHandler); } } if (newEditor instanceof JSpinner.DefaultEditor) { JTextField tf = ((JSpinner.DefaultEditor)newEditor).getTextField(); if (tf != null) { tf.addFocusListener(editorFocusHandler); } } }
[ "@", "Override", "protected", "void", "replaceEditor", "(", "JComponent", "oldEditor", ",", "JComponent", "newEditor", ")", "{", "spinner", ".", "remove", "(", "oldEditor", ")", ";", "spinner", ".", "add", "(", "newEditor", ",", "\"Editor\"", ")", ";", "if",...
Called by the <code>PropertyChangeListener</code> when the <code>JSpinner</code> editor property changes. It's the responsibility of this method to remove the old editor and add the new one. By default this operation is just: <pre> spinner.remove(oldEditor); spinner.add(newEditor, "Editor"); </pre> The implementation of <code>replaceEditor</code> should be coordinated with the <code>createEditor</code> method. @see #createEditor @see #createPropertyChangeListener
[ "Called", "by", "the", "<code", ">", "PropertyChangeListener<", "/", "code", ">", "when", "the", "<code", ">", "JSpinner<", "/", "code", ">", "editor", "property", "changes", ".", "It", "s", "the", "responsibility", "of", "this", "method", "to", "remove", ...
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassSpinnerUI.java#L242-L258
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/Common.java
Common.readToList
public static List<String> readToList(File f) throws IOException { try (final Reader reader = asReaderUTF8Lenient(new FileInputStream(f))) { return readToList(reader); } catch (IOException ioe) { throw new IllegalStateException(String.format("Failed to read %s: %s", f.getAbsolutePath(), ioe), ioe); } }
java
public static List<String> readToList(File f) throws IOException { try (final Reader reader = asReaderUTF8Lenient(new FileInputStream(f))) { return readToList(reader); } catch (IOException ioe) { throw new IllegalStateException(String.format("Failed to read %s: %s", f.getAbsolutePath(), ioe), ioe); } }
[ "public", "static", "List", "<", "String", ">", "readToList", "(", "File", "f", ")", "throws", "IOException", "{", "try", "(", "final", "Reader", "reader", "=", "asReaderUTF8Lenient", "(", "new", "FileInputStream", "(", "f", ")", ")", ")", "{", "return", ...
Read the file line for line and return the result in a list @throws IOException upon failure in reading, note that we wrap the underlying IOException with the file name
[ "Read", "the", "file", "line", "for", "line", "and", "return", "the", "result", "in", "a", "list" ]
train
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/Common.java#L59-L65
albfernandez/itext2
src/main/java/com/lowagie/text/Table.java
Table.addCell
public void addCell(Phrase content, Point location) throws BadElementException { Cell cell = new Cell(content); cell.setBorder(defaultCell.getBorder()); cell.setBorderWidth(defaultCell.getBorderWidth()); cell.setBorderColor(defaultCell.getBorderColor()); cell.setBackgroundColor(defaultCell.getBackgroundColor()); cell.setHorizontalAlignment(defaultCell.getHorizontalAlignment()); cell.setVerticalAlignment(defaultCell.getVerticalAlignment()); cell.setColspan(defaultCell.getColspan()); cell.setRowspan(defaultCell.getRowspan()); addCell(cell, location); }
java
public void addCell(Phrase content, Point location) throws BadElementException { Cell cell = new Cell(content); cell.setBorder(defaultCell.getBorder()); cell.setBorderWidth(defaultCell.getBorderWidth()); cell.setBorderColor(defaultCell.getBorderColor()); cell.setBackgroundColor(defaultCell.getBackgroundColor()); cell.setHorizontalAlignment(defaultCell.getHorizontalAlignment()); cell.setVerticalAlignment(defaultCell.getVerticalAlignment()); cell.setColspan(defaultCell.getColspan()); cell.setRowspan(defaultCell.getRowspan()); addCell(cell, location); }
[ "public", "void", "addCell", "(", "Phrase", "content", ",", "Point", "location", ")", "throws", "BadElementException", "{", "Cell", "cell", "=", "new", "Cell", "(", "content", ")", ";", "cell", ".", "setBorder", "(", "defaultCell", ".", "getBorder", "(", "...
Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE>. <P> This is a shortcut for <CODE>addCell(Cell cell, Point location)</CODE>. The <CODE>Phrase</CODE> will be converted to a <CODE>Cell</CODE>. @param content a <CODE>Phrase</CODE> @param location a <CODE>Point</CODE> @throws BadElementException this should never happen
[ "Adds", "a", "<CODE", ">", "Cell<", "/", "CODE", ">", "to", "the", "<CODE", ">", "Table<", "/", "CODE", ">", ".", "<P", ">", "This", "is", "a", "shortcut", "for", "<CODE", ">", "addCell", "(", "Cell", "cell", "Point", "location", ")", "<", "/", "...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Table.java#L748-L759
Netflix/dyno
dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/HostStatusTracker.java
HostStatusTracker.computeNewHostStatus
public HostStatusTracker computeNewHostStatus(Collection<Host> hostsUp, Collection<Host> hostsDown) { verifyMutuallyExclusive(hostsUp, hostsDown); Set<Host> nextActiveHosts = new HashSet<Host>(hostsUp); // Get the hosts that are currently down Set<Host> nextInactiveHosts = new HashSet<Host>(hostsDown); // add any previous hosts that were currently down iff they are still reported by the HostSupplier Set<Host> union = new HashSet<>(hostsUp); union.addAll(hostsDown); if (!union.containsAll(inactiveHosts)) { logger.info("REMOVING at least one inactive host from {} b/c it is no longer reported by HostSupplier", inactiveHosts); inactiveHosts.retainAll(union); } nextInactiveHosts.addAll(inactiveHosts); // Now remove from the total set of inactive hosts any host that is currently up. // This typically happens when a host moves from the inactive state to the active state. // And hence it will be there in the prev inactive set, and will also be there in the new active set // for this round. for (Host host : nextActiveHosts) { nextInactiveHosts.remove(host); } // Now add any host that is not in the new active hosts set and that was in the previous active set Set<Host> prevActiveHosts = new HashSet<Host>(activeHosts); prevActiveHosts.removeAll(hostsUp); // If anyone is remaining in the prev set then add it to the inactive set, since it has gone away nextInactiveHosts.addAll(prevActiveHosts); for (Host host : nextActiveHosts) { host.setStatus(Status.Up); } for (Host host : nextInactiveHosts) { host.setStatus(Status.Down); } return new HostStatusTracker(nextActiveHosts, nextInactiveHosts); }
java
public HostStatusTracker computeNewHostStatus(Collection<Host> hostsUp, Collection<Host> hostsDown) { verifyMutuallyExclusive(hostsUp, hostsDown); Set<Host> nextActiveHosts = new HashSet<Host>(hostsUp); // Get the hosts that are currently down Set<Host> nextInactiveHosts = new HashSet<Host>(hostsDown); // add any previous hosts that were currently down iff they are still reported by the HostSupplier Set<Host> union = new HashSet<>(hostsUp); union.addAll(hostsDown); if (!union.containsAll(inactiveHosts)) { logger.info("REMOVING at least one inactive host from {} b/c it is no longer reported by HostSupplier", inactiveHosts); inactiveHosts.retainAll(union); } nextInactiveHosts.addAll(inactiveHosts); // Now remove from the total set of inactive hosts any host that is currently up. // This typically happens when a host moves from the inactive state to the active state. // And hence it will be there in the prev inactive set, and will also be there in the new active set // for this round. for (Host host : nextActiveHosts) { nextInactiveHosts.remove(host); } // Now add any host that is not in the new active hosts set and that was in the previous active set Set<Host> prevActiveHosts = new HashSet<Host>(activeHosts); prevActiveHosts.removeAll(hostsUp); // If anyone is remaining in the prev set then add it to the inactive set, since it has gone away nextInactiveHosts.addAll(prevActiveHosts); for (Host host : nextActiveHosts) { host.setStatus(Status.Up); } for (Host host : nextInactiveHosts) { host.setStatus(Status.Down); } return new HostStatusTracker(nextActiveHosts, nextInactiveHosts); }
[ "public", "HostStatusTracker", "computeNewHostStatus", "(", "Collection", "<", "Host", ">", "hostsUp", ",", "Collection", "<", "Host", ">", "hostsDown", ")", "{", "verifyMutuallyExclusive", "(", "hostsUp", ",", "hostsDown", ")", ";", "Set", "<", "Host", ">", "...
Helper method that actually changes the state of the class to reflect the new set of hosts up and down Note that the new HostStatusTracker is returned that holds onto the new state. Calling classes must update their references to use the new HostStatusTracker @param hostsUp @param hostsDown @return
[ "Helper", "method", "that", "actually", "changes", "the", "state", "of", "the", "class", "to", "reflect", "the", "new", "set", "of", "hosts", "up", "and", "down", "Note", "that", "the", "new", "HostStatusTracker", "is", "returned", "that", "holds", "onto", ...
train
https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/HostStatusTracker.java#L154-L195
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.withOutputStream
public static Object withOutputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.OutputStream") Closure closure) throws IOException { return IOGroovyMethods.withStream(newOutputStream(self), closure); }
java
public static Object withOutputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.OutputStream") Closure closure) throws IOException { return IOGroovyMethods.withStream(newOutputStream(self), closure); }
[ "public", "static", "Object", "withOutputStream", "(", "Path", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.OutputStream\"", ")", "Closure", "closure", ")", "throws", "IOException", "{", "retur...
Creates a new OutputStream for this file and passes it into the closure. This method ensures the stream is closed after the closure returns. @param self a Path @param closure a closure @return the value returned by the closure @throws java.io.IOException if an IOException occurs. @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure) @since 2.3.0
[ "Creates", "a", "new", "OutputStream", "for", "this", "file", "and", "passes", "it", "into", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1485-L1487
denisneuling/apitrary.jar
apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java
ClassUtil.getDeclaredFieldSilent
public static Field getDeclaredFieldSilent(Class<?> target, String fieldName) { try { return target.getDeclaredField(fieldName); } catch (Exception e) { return null; } }
java
public static Field getDeclaredFieldSilent(Class<?> target, String fieldName) { try { return target.getDeclaredField(fieldName); } catch (Exception e) { return null; } }
[ "public", "static", "Field", "getDeclaredFieldSilent", "(", "Class", "<", "?", ">", "target", ",", "String", "fieldName", ")", "{", "try", "{", "return", "target", ".", "getDeclaredField", "(", "fieldName", ")", ";", "}", "catch", "(", "Exception", "e", ")...
<p> getDeclaredFieldSilent. </p> @param target a {@link java.lang.Class} object. @param fieldName a {@link java.lang.String} object. @return a {@link java.lang.reflect.Field} object.
[ "<p", ">", "getDeclaredFieldSilent", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L369-L375
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
JsonService.getCharValue
public static Character getCharValue(JSONObject jsonObject, String key) throws JSONException { String stringValue = getStringValue(jsonObject, key); if (stringValue != null) { return stringValue.charAt(0); } return null; }
java
public static Character getCharValue(JSONObject jsonObject, String key) throws JSONException { String stringValue = getStringValue(jsonObject, key); if (stringValue != null) { return stringValue.charAt(0); } return null; }
[ "public", "static", "Character", "getCharValue", "(", "JSONObject", "jsonObject", ",", "String", "key", ")", "throws", "JSONException", "{", "String", "stringValue", "=", "getStringValue", "(", "jsonObject", ",", "key", ")", ";", "if", "(", "stringValue", "!=", ...
Get a character value from a {@link JSONObject}. @param jsonObject The object to get the key value from. @param key The name of the key to search the value for. @return Returns the value for the key in the object or null. @throws JSONException Thrown in case the key could not be found in the JSON object.
[ "Get", "a", "character", "value", "from", "a", "{", "@link", "JSONObject", "}", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L165-L171
the-fascinator/plugin-indexer-solr
src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java
SolrIndexer.initCore
private SolrServer initCore(String coreName) { try { String uri = config.getString(null, "indexer", coreName, "uri"); if (uri == null) { log.error("No URI provided for core: '{}'", coreName); return null; } URI solrUri = new URI(uri); CommonsHttpSolrServer thisCore = new CommonsHttpSolrServer(solrUri.toURL()); String username = config.getString(null, "indexer", coreName, "username"); String password = config.getString(null, "indexer", coreName, "password"); usernameMap.put(coreName, username); passwordMap.put(coreName, password); if (username != null && password != null) { UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); HttpClient hc = (thisCore).getHttpClient(); hc.getParams().setAuthenticationPreemptive(true); hc.getState().setCredentials(AuthScope.ANY, credentials); } return thisCore; } catch (MalformedURLException mue) { log.error(coreName + " : Malformed URL", mue); } catch (URISyntaxException urise) { log.error(coreName + " : Invalid URI", urise); } return null; }
java
private SolrServer initCore(String coreName) { try { String uri = config.getString(null, "indexer", coreName, "uri"); if (uri == null) { log.error("No URI provided for core: '{}'", coreName); return null; } URI solrUri = new URI(uri); CommonsHttpSolrServer thisCore = new CommonsHttpSolrServer(solrUri.toURL()); String username = config.getString(null, "indexer", coreName, "username"); String password = config.getString(null, "indexer", coreName, "password"); usernameMap.put(coreName, username); passwordMap.put(coreName, password); if (username != null && password != null) { UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); HttpClient hc = (thisCore).getHttpClient(); hc.getParams().setAuthenticationPreemptive(true); hc.getState().setCredentials(AuthScope.ANY, credentials); } return thisCore; } catch (MalformedURLException mue) { log.error(coreName + " : Malformed URL", mue); } catch (URISyntaxException urise) { log.error(coreName + " : Invalid URI", urise); } return null; }
[ "private", "SolrServer", "initCore", "(", "String", "coreName", ")", "{", "try", "{", "String", "uri", "=", "config", ".", "getString", "(", "null", ",", "\"indexer\"", ",", "coreName", ",", "\"uri\"", ")", ";", "if", "(", "uri", "==", "null", ")", "{"...
Initialize a Solr core object. @param coreName : The core to initialize @return SolrServer : The initialized core
[ "Initialize", "a", "Solr", "core", "object", "." ]
train
https://github.com/the-fascinator/plugin-indexer-solr/blob/001159b18b78a87daa5d8b2a17ced28694bae156/src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java#L395-L421
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/animation/NavigationAnimationFactory.java
NavigationAnimationFactory.createZoomIn
public static NavigationAnimation createZoomIn(MapPresenter mapPresenter, View endView) { return new NavigationAnimationImpl(mapPresenter.getViewPort(), mapPresenter.getEventBus(), new LinearTrajectory(mapPresenter.getViewPort().getView(), endView), getMillis(mapPresenter)); }
java
public static NavigationAnimation createZoomIn(MapPresenter mapPresenter, View endView) { return new NavigationAnimationImpl(mapPresenter.getViewPort(), mapPresenter.getEventBus(), new LinearTrajectory(mapPresenter.getViewPort().getView(), endView), getMillis(mapPresenter)); }
[ "public", "static", "NavigationAnimation", "createZoomIn", "(", "MapPresenter", "mapPresenter", ",", "View", "endView", ")", "{", "return", "new", "NavigationAnimationImpl", "(", "mapPresenter", ".", "getViewPort", "(", ")", ",", "mapPresenter", ".", "getEventBus", ...
Create a new zoom in {@link NavigationAnimation} that zooms in to the provided end view. @param mapPresenter The map onto which you want the zoom in animation to run. @param endView The final view to arrive at when the animation finishes. @return The animation. Just call "run" to have it animate the map.
[ "Create", "a", "new", "zoom", "in", "{", "@link", "NavigationAnimation", "}", "that", "zooms", "in", "to", "the", "provided", "end", "view", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/animation/NavigationAnimationFactory.java#L69-L72
apache/groovy
src/main/groovy/groovy/lang/MetaClassImpl.java
MetaClassImpl.setProperties
public void setProperties(Object bean, Map map) { checkInitalised(); for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String key = entry.getKey().toString(); Object value = entry.getValue(); setProperty(bean, key, value); } }
java
public void setProperties(Object bean, Map map) { checkInitalised(); for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String key = entry.getKey().toString(); Object value = entry.getValue(); setProperty(bean, key, value); } }
[ "public", "void", "setProperties", "(", "Object", "bean", ",", "Map", "map", ")", "{", "checkInitalised", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(...
Sets a number of bean properties from the given Map where the keys are the String names of properties and the values are the values of the properties to set
[ "Sets", "a", "number", "of", "bean", "properties", "from", "the", "given", "Map", "where", "the", "keys", "are", "the", "String", "names", "of", "properties", "and", "the", "values", "are", "the", "values", "of", "the", "properties", "to", "set" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L1818-L1827
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/FutureOperation.java
FutureOperation.waitForCompletion
public void waitForCompletion(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { doneLatch.await(timeout, unit); }
java
public void waitForCompletion(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { doneLatch.await(timeout, unit); }
[ "public", "void", "waitForCompletion", "(", "final", "long", "timeout", ",", "final", "TimeUnit", "unit", ")", "throws", "InterruptedException", ",", "ExecutionException", ",", "TimeoutException", "{", "doneLatch", ".", "await", "(", "timeout", ",", "unit", ")", ...
Wait for the completion of the operation (timed version) @param timeout @param unit @throws InterruptedException @throws ExecutionException @throws TimeoutException
[ "Wait", "for", "the", "completion", "of", "the", "operation", "(", "timed", "version", ")" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/FutureOperation.java#L85-L88
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
Settings.getString
public String getString(@NotNull final String key, @Nullable final String defaultValue) { return System.getProperty(key, props.getProperty(key, defaultValue)); }
java
public String getString(@NotNull final String key, @Nullable final String defaultValue) { return System.getProperty(key, props.getProperty(key, defaultValue)); }
[ "public", "String", "getString", "(", "@", "NotNull", "final", "String", "key", ",", "@", "Nullable", "final", "String", "defaultValue", ")", "{", "return", "System", ".", "getProperty", "(", "key", ",", "props", ".", "getProperty", "(", "key", ",", "defau...
Returns a value from the properties file. If the value was specified as a system property or passed in via the -Dprop=value argument - this method will return the value from the system properties before the values in the contained configuration file. @param key the key to lookup within the properties file @param defaultValue the default value for the requested property @return the property from the properties file
[ "Returns", "a", "value", "from", "the", "properties", "file", ".", "If", "the", "value", "was", "specified", "as", "a", "system", "property", "or", "passed", "in", "via", "the", "-", "Dprop", "=", "value", "argument", "-", "this", "method", "will", "retu...
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L902-L904
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.scale
public Img scale(int width, int height, Color fixedColor) { final BufferedImage srcImage = getValidSrcImg(); int srcHeight = srcImage.getHeight(null); int srcWidth = srcImage.getWidth(null); double heightRatio = NumberUtil.div(height, srcHeight); double widthRatio = NumberUtil.div(width, srcWidth); if (heightRatio == widthRatio) { // 长宽都按照相同比例缩放时,返回缩放后的图片 return scale(width, height); } // 宽缩放比例小就按照宽缩放,否则按照高缩放 if (widthRatio < heightRatio) { scale(width, (int) (srcHeight * widthRatio)); } else { scale((int) (srcWidth * heightRatio), height); } if (null == fixedColor) {// 补白 fixedColor = Color.WHITE; } final BufferedImage image = new BufferedImage(width, height, getTypeInt()); Graphics2D g = image.createGraphics(); // 设置背景 g.setBackground(fixedColor); g.clearRect(0, 0, width, height); final BufferedImage itemp = this.targetImage; final int itempHeight = itemp.getHeight(); final int itempWidth = itemp.getWidth(); // 在中间贴图 g.drawImage(itemp, (width - itempWidth) / 2, (height - itempHeight) / 2, itempWidth, itempHeight, fixedColor, null); g.dispose(); this.targetImage = image; return this; }
java
public Img scale(int width, int height, Color fixedColor) { final BufferedImage srcImage = getValidSrcImg(); int srcHeight = srcImage.getHeight(null); int srcWidth = srcImage.getWidth(null); double heightRatio = NumberUtil.div(height, srcHeight); double widthRatio = NumberUtil.div(width, srcWidth); if (heightRatio == widthRatio) { // 长宽都按照相同比例缩放时,返回缩放后的图片 return scale(width, height); } // 宽缩放比例小就按照宽缩放,否则按照高缩放 if (widthRatio < heightRatio) { scale(width, (int) (srcHeight * widthRatio)); } else { scale((int) (srcWidth * heightRatio), height); } if (null == fixedColor) {// 补白 fixedColor = Color.WHITE; } final BufferedImage image = new BufferedImage(width, height, getTypeInt()); Graphics2D g = image.createGraphics(); // 设置背景 g.setBackground(fixedColor); g.clearRect(0, 0, width, height); final BufferedImage itemp = this.targetImage; final int itempHeight = itemp.getHeight(); final int itempWidth = itemp.getWidth(); // 在中间贴图 g.drawImage(itemp, (width - itempWidth) / 2, (height - itempHeight) / 2, itempWidth, itempHeight, fixedColor, null); g.dispose(); this.targetImage = image; return this; }
[ "public", "Img", "scale", "(", "int", "width", ",", "int", "height", ",", "Color", "fixedColor", ")", "{", "final", "BufferedImage", "srcImage", "=", "getValidSrcImg", "(", ")", ";", "int", "srcHeight", "=", "srcImage", ".", "getHeight", "(", "null", ")", ...
缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @return this
[ "缩放图像(按高度和宽度缩放)<br", ">", "缩放后默认为jpeg格式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L240-L277
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java
DistributionBarHelper.getTooltip
public static String getTooltip(final Map<Status, Long> statusCountMap) { final Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper .getStatusMapWithNonZeroValues(statusCountMap); final StringBuilder tooltip = new StringBuilder(); for (final Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) { tooltip.append(entry.getKey().toString().toLowerCase()).append(" : ").append(entry.getValue()) .append("<br>"); } return tooltip.toString(); }
java
public static String getTooltip(final Map<Status, Long> statusCountMap) { final Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper .getStatusMapWithNonZeroValues(statusCountMap); final StringBuilder tooltip = new StringBuilder(); for (final Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) { tooltip.append(entry.getKey().toString().toLowerCase()).append(" : ").append(entry.getValue()) .append("<br>"); } return tooltip.toString(); }
[ "public", "static", "String", "getTooltip", "(", "final", "Map", "<", "Status", ",", "Long", ">", "statusCountMap", ")", "{", "final", "Map", "<", "Status", ",", "Long", ">", "nonZeroStatusCountMap", "=", "DistributionBarHelper", ".", "getStatusMapWithNonZeroValue...
Returns tool tip for progress bar. @param statusCountMap map with status and count details @return tool tip
[ "Returns", "tool", "tip", "for", "progress", "bar", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java#L82-L91
alkacon/opencms-core
src/org/opencms/ade/publish/CmsPublishService.java
CmsPublishService.wrapProjectName
public static String wrapProjectName(CmsObject cms, String name) { return Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.GUI_NORMAL_PROJECT_1, name); }
java
public static String wrapProjectName(CmsObject cms, String name) { return Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.GUI_NORMAL_PROJECT_1, name); }
[ "public", "static", "String", "wrapProjectName", "(", "CmsObject", "cms", ",", "String", "name", ")", "{", "return", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getWorkplaceLocale", "(", "cm...
Wraps the project name in a message string.<p> @param cms the CMS context @param name the project name @return the message for the given project name
[ "Wraps", "the", "project", "name", "in", "a", "message", "string", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/CmsPublishService.java#L138-L143
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/Client.java
Client.recoverOrInitializeState
public Completable recoverOrInitializeState(final StateFormat format, final byte[] persistedState, final StreamFrom from, final StreamTo to) { if (persistedState == null || persistedState.length == 0) { return initializeState(from, to); } else { return recoverState(format, persistedState); } }
java
public Completable recoverOrInitializeState(final StateFormat format, final byte[] persistedState, final StreamFrom from, final StreamTo to) { if (persistedState == null || persistedState.length == 0) { return initializeState(from, to); } else { return recoverState(format, persistedState); } }
[ "public", "Completable", "recoverOrInitializeState", "(", "final", "StateFormat", "format", ",", "final", "byte", "[", "]", "persistedState", ",", "final", "StreamFrom", "from", ",", "final", "StreamTo", "to", ")", "{", "if", "(", "persistedState", "==", "null",...
Recovers or initializes the {@link SessionState}. <p> This method is a convience wrapper around initialization and recovery. It combines both methods and checks if the persisted state byte array is null or empty and if so it starts with the params given. If it is not empty it recovers from there. This acknowledges the fact that ideally the state is persisted somewhere but if its not there you want to start at a specific point in time. @param format the persistence format used. @param persistedState the state, may be null or empty. @param from from where to start streaming if persisted state is null or empty. @param to to where to stream if persisted state is null or empty. @return A {@link Completable} indicating the success or failure of the state recovery or init.
[ "Recovers", "or", "initializes", "the", "{", "@link", "SessionState", "}", ".", "<p", ">", "This", "method", "is", "a", "convience", "wrapper", "around", "initialization", "and", "recovery", ".", "It", "combines", "both", "methods", "and", "checks", "if", "t...
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/Client.java#L636-L643
looly/hutool
hutool-core/src/main/java/cn/hutool/core/codec/Base64Encoder.java
Base64Encoder.encodeUrlSafe
public static String encodeUrlSafe(byte[] source, String charset) { return StrUtil.str(encodeUrlSafe(source, false), charset); }
java
public static String encodeUrlSafe(byte[] source, String charset) { return StrUtil.str(encodeUrlSafe(source, false), charset); }
[ "public", "static", "String", "encodeUrlSafe", "(", "byte", "[", "]", "source", ",", "String", "charset", ")", "{", "return", "StrUtil", ".", "str", "(", "encodeUrlSafe", "(", "source", ",", "false", ")", ",", "charset", ")", ";", "}" ]
base64编码,URL安全的 @param source 被编码的base64字符串 @param charset 字符集 @return 被加密后的字符串 @since 3.0.6
[ "base64编码,URL安全的" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Base64Encoder.java#L154-L156
haifengl/smile
core/src/main/java/smile/association/TotalSupportTree.java
TotalSupportTree.getSupport
public int getSupport(int[] itemset) { if (root.children != null) { return getSupport(itemset, itemset.length - 1, root); } else { return 0; } }
java
public int getSupport(int[] itemset) { if (root.children != null) { return getSupport(itemset, itemset.length - 1, root); } else { return 0; } }
[ "public", "int", "getSupport", "(", "int", "[", "]", "itemset", ")", "{", "if", "(", "root", ".", "children", "!=", "null", ")", "{", "return", "getSupport", "(", "itemset", ",", "itemset", ".", "length", "-", "1", ",", "root", ")", ";", "}", "else...
Returns the support value for the given item set. @param itemset the given item set. The items in the set has to be in the descending order according to their frequency. @return the support value (0 if not found)
[ "Returns", "the", "support", "value", "for", "the", "given", "item", "set", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L131-L137
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/AbstractCommandBuilder.java
AbstractCommandBuilder.setBindAddressHint
public T setBindAddressHint(final String interfaceName, final String address) { if (interfaceName == null) { throw LauncherMessages.MESSAGES.nullParam("interfaceName"); } setSingleServerArg("-b" + interfaceName, address); return getThis(); }
java
public T setBindAddressHint(final String interfaceName, final String address) { if (interfaceName == null) { throw LauncherMessages.MESSAGES.nullParam("interfaceName"); } setSingleServerArg("-b" + interfaceName, address); return getThis(); }
[ "public", "T", "setBindAddressHint", "(", "final", "String", "interfaceName", ",", "final", "String", "address", ")", "{", "if", "(", "interfaceName", "==", "null", ")", "{", "throw", "LauncherMessages", ".", "MESSAGES", ".", "nullParam", "(", "\"interfaceName\"...
Sets the system property {@code jboss.bind.address.$INTERFACE} to the address given where {@code $INTERFACE} is the {@code interfaceName} parameter. For example in the default configuration passing {@code management} for the {@code interfaceName} parameter would result in the system property {@code jboss.bind.address.management} being set to the address provided. <p/> This will override any previous value set via {@link #addServerArgument(String)}. <p/> <b>Note:</b> This option only works if the standard system property has not been removed from the interface. If the system property was removed the address provided has no effect. @param interfaceName the name of the interface of the binding address @param address the address to bind the management interface to @return the builder
[ "Sets", "the", "system", "property", "{", "@code", "jboss", ".", "bind", ".", "address", ".", "$INTERFACE", "}", "to", "the", "address", "given", "where", "{", "@code", "$INTERFACE", "}", "is", "the", "{", "@code", "interfaceName", "}", "parameter", ".", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/AbstractCommandBuilder.java#L390-L396
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java
ZoneRules.findOffsetInfo
private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) { LocalDateTime localTransition = trans.getDateTimeBefore(); if (trans.isGap()) { if (dt.isBefore(localTransition)) { return trans.getOffsetBefore(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans; } else { return trans.getOffsetAfter(); } } else { if (dt.isBefore(localTransition) == false) { return trans.getOffsetAfter(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans.getOffsetBefore(); } else { return trans; } } }
java
private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) { LocalDateTime localTransition = trans.getDateTimeBefore(); if (trans.isGap()) { if (dt.isBefore(localTransition)) { return trans.getOffsetBefore(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans; } else { return trans.getOffsetAfter(); } } else { if (dt.isBefore(localTransition) == false) { return trans.getOffsetAfter(); } if (dt.isBefore(trans.getDateTimeAfter())) { return trans.getOffsetBefore(); } else { return trans; } } }
[ "private", "Object", "findOffsetInfo", "(", "LocalDateTime", "dt", ",", "ZoneOffsetTransition", "trans", ")", "{", "LocalDateTime", "localTransition", "=", "trans", ".", "getDateTimeBefore", "(", ")", ";", "if", "(", "trans", ".", "isGap", "(", ")", ")", "{", ...
Finds the offset info for a local date-time and transition. @param dt the date-time, not null @param trans the transition, not null @return the offset info, not null
[ "Finds", "the", "offset", "info", "for", "a", "local", "date", "-", "time", "and", "transition", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java#L692-L713
bwkimmel/java-util
src/main/java/ca/eandb/util/args/ArgumentProcessor.java
ArgumentProcessor.processOptionField
private void processOptionField(Field field, String key, char shortKey) { String name = field.getName(); Class<?> type = field.getType(); if (key.equals("")) { key = name; } if (shortKey == '\0') { shortKey = key.charAt(0); } Command<? super T> option = createOption(name, type); addOption(key, shortKey, option); }
java
private void processOptionField(Field field, String key, char shortKey) { String name = field.getName(); Class<?> type = field.getType(); if (key.equals("")) { key = name; } if (shortKey == '\0') { shortKey = key.charAt(0); } Command<? super T> option = createOption(name, type); addOption(key, shortKey, option); }
[ "private", "void", "processOptionField", "(", "Field", "field", ",", "String", "key", ",", "char", "shortKey", ")", "{", "String", "name", "=", "field", ".", "getName", "(", ")", ";", "Class", "<", "?", ">", "type", "=", "field", ".", "getType", "(", ...
Adds an option for the specified field having the given {@link OptionArgument} annotation. @param field The <code>Field</code> to add the option for. @param key The key that triggers the option. @param shortKey the shorthand alternative key that triggers the option.
[ "Adds", "an", "option", "for", "the", "specified", "field", "having", "the", "given", "{" ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/args/ArgumentProcessor.java#L254-L268
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/transfer/exporter/DefaultPropertyExtractor.java
DefaultPropertyExtractor.getPropertyIn
public String getPropertyIn(Collection<?> collection, String property) throws Exception { StringBuilder sb = new StringBuilder(); if (null != collection) { for (Iterator<?> iter = collection.iterator(); iter.hasNext();) { Object one = iter.next(); sb.append(extract(one, property)).append(","); } } // 删除逗号 if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
java
public String getPropertyIn(Collection<?> collection, String property) throws Exception { StringBuilder sb = new StringBuilder(); if (null != collection) { for (Iterator<?> iter = collection.iterator(); iter.hasNext();) { Object one = iter.next(); sb.append(extract(one, property)).append(","); } } // 删除逗号 if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
[ "public", "String", "getPropertyIn", "(", "Collection", "<", "?", ">", "collection", ",", "String", "property", ")", "throws", "Exception", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "null", "!=", "collection", ")", ...
<p> getPropertyIn. </p> @param collection a {@link java.util.Collection} object. @param property a {@link java.lang.String} object. @return a {@link java.lang.String} object. @throws java.lang.Exception if any.
[ "<p", ">", "getPropertyIn", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/transfer/exporter/DefaultPropertyExtractor.java#L102-L115
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyObject.java
RubyObject.send
public static <E> E send(Object o, String methodName, Short arg) { return send(o, methodName, (Object) arg); }
java
public static <E> E send(Object o, String methodName, Short arg) { return send(o, methodName, (Object) arg); }
[ "public", "static", "<", "E", ">", "E", "send", "(", "Object", "o", ",", "String", "methodName", ",", "Short", "arg", ")", "{", "return", "send", "(", "o", ",", "methodName", ",", "(", "Object", ")", "arg", ")", ";", "}" ]
Executes a method of any Object by Java reflection. @param o an Object @param methodName name of the method @param arg a Short @return the result of the method called
[ "Executes", "a", "method", "of", "any", "Object", "by", "Java", "reflection", "." ]
train
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyObject.java#L147-L149
fuinorg/objects4j
src/main/java/org/fuin/objects4j/ui/AnnotationAnalyzer.java
AnnotationAnalyzer.getText
private String getText(@NotNull final ResourceBundle bundle, @NotNull final Annotation annotation, @NotNull final String defaultKey) { Contract.requireArgNotNull("bundle", bundle); Contract.requireArgNotNull("annotation", annotation); Contract.requireArgNotNull("defaultKey", defaultKey); final String key; if (getKey(annotation).equals("")) { key = defaultKey; } else { key = getKey(annotation); } try { return bundle.getString(key); } catch (final MissingResourceException ex) { return toNullableString(getValue(annotation)); } }
java
private String getText(@NotNull final ResourceBundle bundle, @NotNull final Annotation annotation, @NotNull final String defaultKey) { Contract.requireArgNotNull("bundle", bundle); Contract.requireArgNotNull("annotation", annotation); Contract.requireArgNotNull("defaultKey", defaultKey); final String key; if (getKey(annotation).equals("")) { key = defaultKey; } else { key = getKey(annotation); } try { return bundle.getString(key); } catch (final MissingResourceException ex) { return toNullableString(getValue(annotation)); } }
[ "private", "String", "getText", "(", "@", "NotNull", "final", "ResourceBundle", "bundle", ",", "@", "NotNull", "final", "Annotation", "annotation", ",", "@", "NotNull", "final", "String", "defaultKey", ")", "{", "Contract", ".", "requireArgNotNull", "(", "\"bund...
Returns the text for the annotation. If no entry is found in the resource bundle for <code>Annotation#key()</code> then <code>Annotation#value()</code> will be returned instead. If <code>Annotation#value()</code> is also empty then <code>null</code> is returned. If <code>Annotation#key()</code> is empty <code>defaultKey</code> will be used as key in the properties file. @param bundle Resource bundle to use. @param annotation Annotation wrapper for the field. @param defaultKey Default key if <code>Annotation#key()</code> is empty. @return Text or <code>null</code>.
[ "Returns", "the", "text", "for", "the", "annotation", ".", "If", "no", "entry", "is", "found", "in", "the", "resource", "bundle", "for", "<code", ">", "Annotation#key", "()", "<", "/", "code", ">", "then", "<code", ">", "Annotation#value", "()", "<", "/"...
train
https://github.com/fuinorg/objects4j/blob/e7f278b5bae073ebb6a76053650571c718f36246/src/main/java/org/fuin/objects4j/ui/AnnotationAnalyzer.java#L188-L207
dita-ot/dita-ot
src/main/java/org/dita/dost/module/GenMapAndTopicListModule.java
GenMapAndTopicListModule.addFlagImagesSetToProperties
private void addFlagImagesSetToProperties(final Job prop, final Set<URI> set) { final Set<URI> newSet = new LinkedHashSet<>(128); for (final URI file: set) { // assert file.isAbsolute(); if (file.isAbsolute()) { // no need to append relative path before absolute paths newSet.add(file.normalize()); } else { // In ant, all the file separator should be slash, so we need to // replace all the back slash with slash. newSet.add(file.normalize()); } } // write list attribute to file final String fileKey = org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.substring(0, org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.lastIndexOf("list")) + "file"; prop.setProperty(fileKey, org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.substring(0, org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.lastIndexOf("list")) + ".list"); final File list = new File(job.tempDir, prop.getProperty(fileKey)); try (Writer bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(list)))) { final Iterator<URI> it = newSet.iterator(); while (it.hasNext()) { bufferedWriter.write(it.next().getPath()); if (it.hasNext()) { bufferedWriter.write("\n"); } } bufferedWriter.flush(); } catch (final IOException e) { logger.error(e.getMessage(), e) ; } prop.setProperty(org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST, StringUtils.join(newSet, COMMA)); }
java
private void addFlagImagesSetToProperties(final Job prop, final Set<URI> set) { final Set<URI> newSet = new LinkedHashSet<>(128); for (final URI file: set) { // assert file.isAbsolute(); if (file.isAbsolute()) { // no need to append relative path before absolute paths newSet.add(file.normalize()); } else { // In ant, all the file separator should be slash, so we need to // replace all the back slash with slash. newSet.add(file.normalize()); } } // write list attribute to file final String fileKey = org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.substring(0, org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.lastIndexOf("list")) + "file"; prop.setProperty(fileKey, org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.substring(0, org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST.lastIndexOf("list")) + ".list"); final File list = new File(job.tempDir, prop.getProperty(fileKey)); try (Writer bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(list)))) { final Iterator<URI> it = newSet.iterator(); while (it.hasNext()) { bufferedWriter.write(it.next().getPath()); if (it.hasNext()) { bufferedWriter.write("\n"); } } bufferedWriter.flush(); } catch (final IOException e) { logger.error(e.getMessage(), e) ; } prop.setProperty(org.dita.dost.util.Constants.REL_FLAGIMAGE_LIST, StringUtils.join(newSet, COMMA)); }
[ "private", "void", "addFlagImagesSetToProperties", "(", "final", "Job", "prop", ",", "final", "Set", "<", "URI", ">", "set", ")", "{", "final", "Set", "<", "URI", ">", "newSet", "=", "new", "LinkedHashSet", "<>", "(", "128", ")", ";", "for", "(", "fina...
add FlagImangesSet to Properties, which needn't to change the dir level, just ouput to the ouput dir. @param prop job configuration @param set absolute flag image files
[ "add", "FlagImangesSet", "to", "Properties", "which", "needn", "t", "to", "change", "the", "dir", "level", "just", "ouput", "to", "the", "ouput", "dir", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/GenMapAndTopicListModule.java#L954-L986
lessthanoptimal/ddogleg
src/org/ddogleg/fitting/modelset/ransac/Ransac.java
Ransac.selectMatchSet
@SuppressWarnings({"ForLoopReplaceableByForEach"}) protected void selectMatchSet(List<Point> dataSet, double threshold, Model param) { candidatePoints.clear(); modelDistance.setModel(param); for (int i = 0; i < dataSet.size(); i++) { Point point = dataSet.get(i); double distance = modelDistance.computeDistance(point); if (distance < threshold) { matchToInput[candidatePoints.size()] = i; candidatePoints.add(point); } } }
java
@SuppressWarnings({"ForLoopReplaceableByForEach"}) protected void selectMatchSet(List<Point> dataSet, double threshold, Model param) { candidatePoints.clear(); modelDistance.setModel(param); for (int i = 0; i < dataSet.size(); i++) { Point point = dataSet.get(i); double distance = modelDistance.computeDistance(point); if (distance < threshold) { matchToInput[candidatePoints.size()] = i; candidatePoints.add(point); } } }
[ "@", "SuppressWarnings", "(", "{", "\"ForLoopReplaceableByForEach\"", "}", ")", "protected", "void", "selectMatchSet", "(", "List", "<", "Point", ">", "dataSet", ",", "double", "threshold", ",", "Model", "param", ")", "{", "candidatePoints", ".", "clear", "(", ...
Looks for points in the data set which closely match the current best fit model in the optimizer. @param dataSet The points being considered
[ "Looks", "for", "points", "in", "the", "data", "set", "which", "closely", "match", "the", "current", "best", "fit", "model", "in", "the", "optimizer", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/fitting/modelset/ransac/Ransac.java#L195-L209
oasp/oasp4j
modules/security/src/main/java/io/oasp/module/security/common/impl/accesscontrol/AccessControlSchemaXmlMapper.java
AccessControlSchemaXmlMapper.writeXsd
public void writeXsd(File outFile) { File folder = outFile.getParentFile(); if (!folder.isDirectory()) { boolean success = folder.mkdirs(); if (!success) { throw new IllegalStateException("Failed to create folder " + folder); } } try (FileOutputStream fos = new FileOutputStream(outFile)) { writeXsd(fos); } catch (Exception e) { throw new IllegalStateException("Failed to generate and write the XSD schema to " + outFile + "!", e); } }
java
public void writeXsd(File outFile) { File folder = outFile.getParentFile(); if (!folder.isDirectory()) { boolean success = folder.mkdirs(); if (!success) { throw new IllegalStateException("Failed to create folder " + folder); } } try (FileOutputStream fos = new FileOutputStream(outFile)) { writeXsd(fos); } catch (Exception e) { throw new IllegalStateException("Failed to generate and write the XSD schema to " + outFile + "!", e); } }
[ "public", "void", "writeXsd", "(", "File", "outFile", ")", "{", "File", "folder", "=", "outFile", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "folder", ".", "isDirectory", "(", ")", ")", "{", "boolean", "success", "=", "folder", ".", "mkdirs",...
Generates the XSD (XML Schema Definition) to the given {@link File}. @param outFile is the {@link File} to write to.
[ "Generates", "the", "XSD", "(", "XML", "Schema", "Definition", ")", "to", "the", "given", "{", "@link", "File", "}", "." ]
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/security/src/main/java/io/oasp/module/security/common/impl/accesscontrol/AccessControlSchemaXmlMapper.java#L79-L93
hal/core
gui/src/main/java/org/jboss/as/console/client/tools/ModelBrowserView.java
ModelBrowserView.updateChildrenTypes
public void updateChildrenTypes(ModelNode address, List<ModelNode> modelNodes) { TreeItem rootItem = findTreeItem(tree, address); addChildrenTypes((ModelTreeItem) rootItem, modelNodes); }
java
public void updateChildrenTypes(ModelNode address, List<ModelNode> modelNodes) { TreeItem rootItem = findTreeItem(tree, address); addChildrenTypes((ModelTreeItem) rootItem, modelNodes); }
[ "public", "void", "updateChildrenTypes", "(", "ModelNode", "address", ",", "List", "<", "ModelNode", ">", "modelNodes", ")", "{", "TreeItem", "rootItem", "=", "findTreeItem", "(", "tree", ",", "address", ")", ";", "addChildrenTypes", "(", "(", "ModelTreeItem", ...
Update sub parts of the tree @param address @param modelNodes
[ "Update", "sub", "parts", "of", "the", "tree" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/tools/ModelBrowserView.java#L471-L476
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IterableExtensions.java
IterableExtensions.findFirst
public static <T> T findFirst(Iterable<T> iterable, Function1<? super T, Boolean> predicate) { return IteratorExtensions.findFirst(iterable.iterator(), predicate); }
java
public static <T> T findFirst(Iterable<T> iterable, Function1<? super T, Boolean> predicate) { return IteratorExtensions.findFirst(iterable.iterator(), predicate); }
[ "public", "static", "<", "T", ">", "T", "findFirst", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function1", "<", "?", "super", "T", ",", "Boolean", ">", "predicate", ")", "{", "return", "IteratorExtensions", ".", "findFirst", "(", "iterable", ".",...
Finds the first element in the given iterable that fulfills the predicate. If none is found or the iterable is empty, <code>null</code> is returned. @param iterable the iterable. May not be <code>null</code>. @param predicate the predicate. May not be <code>null</code>. @return the first element in the iterable for which the given predicate returns <code>true</code>, returns <code>null</code> if no element matches the predicate or the iterable is empty.
[ "Finds", "the", "first", "element", "in", "the", "given", "iterable", "that", "fulfills", "the", "predicate", ".", "If", "none", "is", "found", "or", "the", "iterable", "is", "empty", "<code", ">", "null<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IterableExtensions.java#L79-L81
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXAnnotation.java
MMAXAnnotation.setAttributeList
public void setAttributeList(int i, MMAXAttribute v) { if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_attributeList == null) jcasType.jcas.throwFeatMissing("attributeList", "de.julielab.jules.types.mmax.MMAXAnnotation"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_attributeList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_attributeList), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setAttributeList(int i, MMAXAttribute v) { if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_attributeList == null) jcasType.jcas.throwFeatMissing("attributeList", "de.julielab.jules.types.mmax.MMAXAnnotation"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_attributeList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_attributeList), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setAttributeList", "(", "int", "i", ",", "MMAXAttribute", "v", ")", "{", "if", "(", "MMAXAnnotation_Type", ".", "featOkTst", "&&", "(", "(", "MMAXAnnotation_Type", ")", "jcasType", ")", ".", "casFeat_attributeList", "==", "null", ")", "jcasT...
indexed setter for attributeList - sets an indexed value - List of attributes of the MMAX annotation. @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "attributeList", "-", "sets", "an", "indexed", "value", "-", "List", "of", "attributes", "of", "the", "MMAX", "annotation", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXAnnotation.java#L207-L211
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
JavaTokenizer.processWhiteSpace
protected void processWhiteSpace(int pos, int endPos) { if (scannerDebug) System.out.println("processWhitespace(" + pos + "," + endPos + ")=|" + new String(reader.getRawCharacters(pos, endPos)) + "|"); }
java
protected void processWhiteSpace(int pos, int endPos) { if (scannerDebug) System.out.println("processWhitespace(" + pos + "," + endPos + ")=|" + new String(reader.getRawCharacters(pos, endPos)) + "|"); }
[ "protected", "void", "processWhiteSpace", "(", "int", "pos", ",", "int", "endPos", ")", "{", "if", "(", "scannerDebug", ")", "System", ".", "out", ".", "println", "(", "\"processWhitespace(\"", "+", "pos", "+", "\",\"", "+", "endPos", "+", "\")=|\"", "+", ...
Called when a complete whitespace run has been scanned. pos and endPos will mark the whitespace boundary.
[ "Called", "when", "a", "complete", "whitespace", "run", "has", "been", "scanned", ".", "pos", "and", "endPos", "will", "mark", "the", "whitespace", "boundary", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java#L741-L747
mangstadt/biweekly
src/main/java/biweekly/component/ICalComponent.java
ICalComponent.removeProperties
public <T extends ICalProperty> List<T> removeProperties(Class<T> clazz) { List<ICalProperty> removed = properties.removeAll(clazz); return castList(removed, clazz); }
java
public <T extends ICalProperty> List<T> removeProperties(Class<T> clazz) { List<ICalProperty> removed = properties.removeAll(clazz); return castList(removed, clazz); }
[ "public", "<", "T", "extends", "ICalProperty", ">", "List", "<", "T", ">", "removeProperties", "(", "Class", "<", "T", ">", "clazz", ")", "{", "List", "<", "ICalProperty", ">", "removed", "=", "properties", ".", "removeAll", "(", "clazz", ")", ";", "re...
Removes all properties of a given class from this component. @param clazz the class of the properties to remove (e.g. "DateStart.class") @param <T> the property class @return the removed properties (this list is immutable)
[ "Removes", "all", "properties", "of", "a", "given", "class", "from", "this", "component", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L154-L157
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java
EsStorage.indexEntity
private void indexEntity(String type, String id, XContentBuilder sourceEntity) throws StorageException { indexEntity(type, id, sourceEntity, false); }
java
private void indexEntity(String type, String id, XContentBuilder sourceEntity) throws StorageException { indexEntity(type, id, sourceEntity, false); }
[ "private", "void", "indexEntity", "(", "String", "type", ",", "String", "id", ",", "XContentBuilder", "sourceEntity", ")", "throws", "StorageException", "{", "indexEntity", "(", "type", ",", "id", ",", "sourceEntity", ",", "false", ")", ";", "}" ]
Indexes an entity. @param type @param id @param sourceEntity @throws StorageException
[ "Indexes", "an", "entity", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java#L1988-L1990
line/armeria
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerHttpClient.java
CircuitBreakerHttpClient.newDecorator
public static Function<Client<HttpRequest, HttpResponse>, CircuitBreakerHttpClient> newDecorator(CircuitBreaker circuitBreaker, CircuitBreakerStrategy strategy) { return newDecorator((ctx, req) -> circuitBreaker, strategy); }
java
public static Function<Client<HttpRequest, HttpResponse>, CircuitBreakerHttpClient> newDecorator(CircuitBreaker circuitBreaker, CircuitBreakerStrategy strategy) { return newDecorator((ctx, req) -> circuitBreaker, strategy); }
[ "public", "static", "Function", "<", "Client", "<", "HttpRequest", ",", "HttpResponse", ">", ",", "CircuitBreakerHttpClient", ">", "newDecorator", "(", "CircuitBreaker", "circuitBreaker", ",", "CircuitBreakerStrategy", "strategy", ")", "{", "return", "newDecorator", "...
Creates a new decorator using the specified {@link CircuitBreaker} instance and {@link CircuitBreakerStrategy}. <p>Since {@link CircuitBreaker} is a unit of failure detection, don't reuse the same instance for unrelated services.
[ "Creates", "a", "new", "decorator", "using", "the", "specified", "{", "@link", "CircuitBreaker", "}", "instance", "and", "{", "@link", "CircuitBreakerStrategy", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/circuitbreaker/CircuitBreakerHttpClient.java#L41-L44
biezhi/anima
src/main/java/io/github/biezhi/anima/core/AnimaQuery.java
AnimaQuery.buildPageSQL
private String buildPageSQL(String sql, PageRow pageRow) { SQLParams sqlParams = SQLParams.builder() .modelClass(this.modelClass) .selectColumns(this.selectColumns) .tableName(this.tableName) .pkName(this.primaryKeyColumn) .conditionSQL(this.conditionSQL) .excludedColumns(this.excludedColumns) .customSQL(sql) .orderBy(this.orderBySQL.toString()) .pageRow(pageRow) .build(); return Anima.of().dialect().paginate(sqlParams); }
java
private String buildPageSQL(String sql, PageRow pageRow) { SQLParams sqlParams = SQLParams.builder() .modelClass(this.modelClass) .selectColumns(this.selectColumns) .tableName(this.tableName) .pkName(this.primaryKeyColumn) .conditionSQL(this.conditionSQL) .excludedColumns(this.excludedColumns) .customSQL(sql) .orderBy(this.orderBySQL.toString()) .pageRow(pageRow) .build(); return Anima.of().dialect().paginate(sqlParams); }
[ "private", "String", "buildPageSQL", "(", "String", "sql", ",", "PageRow", "pageRow", ")", "{", "SQLParams", "sqlParams", "=", "SQLParams", ".", "builder", "(", ")", ".", "modelClass", "(", "this", ".", "modelClass", ")", ".", "selectColumns", "(", "this", ...
Build a paging statement @param pageRow page param @return paging sql
[ "Build", "a", "paging", "statement" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaQuery.java#L1404-L1417
JakeWharton/NineOldAndroids
library/src/com/nineoldandroids/view/ViewPropertyAnimatorHC.java
ViewPropertyAnimatorHC.setValue
private void setValue(int propertyConstant, float value) { //final View.TransformationInfo info = mView.mTransformationInfo; View v = mView.get(); if (v != null) { switch (propertyConstant) { case TRANSLATION_X: //info.mTranslationX = value; v.setTranslationX(value); break; case TRANSLATION_Y: //info.mTranslationY = value; v.setTranslationY(value); break; case ROTATION: //info.mRotation = value; v.setRotation(value); break; case ROTATION_X: //info.mRotationX = value; v.setRotationX(value); break; case ROTATION_Y: //info.mRotationY = value; v.setRotationY(value); break; case SCALE_X: //info.mScaleX = value; v.setScaleX(value); break; case SCALE_Y: //info.mScaleY = value; v.setScaleY(value); break; case X: //info.mTranslationX = value - v.mLeft; v.setX(value); break; case Y: //info.mTranslationY = value - v.mTop; v.setY(value); break; case ALPHA: //info.mAlpha = value; v.setAlpha(value); break; } } }
java
private void setValue(int propertyConstant, float value) { //final View.TransformationInfo info = mView.mTransformationInfo; View v = mView.get(); if (v != null) { switch (propertyConstant) { case TRANSLATION_X: //info.mTranslationX = value; v.setTranslationX(value); break; case TRANSLATION_Y: //info.mTranslationY = value; v.setTranslationY(value); break; case ROTATION: //info.mRotation = value; v.setRotation(value); break; case ROTATION_X: //info.mRotationX = value; v.setRotationX(value); break; case ROTATION_Y: //info.mRotationY = value; v.setRotationY(value); break; case SCALE_X: //info.mScaleX = value; v.setScaleX(value); break; case SCALE_Y: //info.mScaleY = value; v.setScaleY(value); break; case X: //info.mTranslationX = value - v.mLeft; v.setX(value); break; case Y: //info.mTranslationY = value - v.mTop; v.setY(value); break; case ALPHA: //info.mAlpha = value; v.setAlpha(value); break; } } }
[ "private", "void", "setValue", "(", "int", "propertyConstant", ",", "float", "value", ")", "{", "//final View.TransformationInfo info = mView.mTransformationInfo;", "View", "v", "=", "mView", ".", "get", "(", ")", ";", "if", "(", "v", "!=", "null", ")", "{", "...
This method handles setting the property values directly in the View object's fields. propertyConstant tells it which property should be set, value is the value to set the property to. @param propertyConstant The property to be set @param value The value to set the property to
[ "This", "method", "handles", "setting", "the", "property", "values", "directly", "in", "the", "View", "object", "s", "fields", ".", "propertyConstant", "tells", "it", "which", "property", "should", "be", "set", "value", "is", "the", "value", "to", "set", "th...
train
https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/view/ViewPropertyAnimatorHC.java#L534-L581
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getDistanceFast
public static double getDistanceFast(Atom a, Atom b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); double z = a.getZ() - b.getZ(); return x * x + y * y + z * z; }
java
public static double getDistanceFast(Atom a, Atom b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); double z = a.getZ() - b.getZ(); return x * x + y * y + z * z; }
[ "public", "static", "double", "getDistanceFast", "(", "Atom", "a", ",", "Atom", "b", ")", "{", "double", "x", "=", "a", ".", "getX", "(", ")", "-", "b", ".", "getX", "(", ")", ";", "double", "y", "=", "a", ".", "getY", "(", ")", "-", "b", "."...
Will calculate the square of distances between two atoms. This will be faster as it will not perform the final square root to get the actual distance. Use this if doing large numbers of distance comparisons - it is marginally faster than getDistance(). @param a an Atom object @param b an Atom object @return a double
[ "Will", "calculate", "the", "square", "of", "distances", "between", "two", "atoms", ".", "This", "will", "be", "faster", "as", "it", "will", "not", "perform", "the", "final", "square", "root", "to", "get", "the", "actual", "distance", ".", "Use", "this", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L90-L96
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
Enter.classEnter
Type classEnter(JCTree tree, Env<AttrContext> env) { Env<AttrContext> prevEnv = this.env; try { this.env = env; annotate.blockAnnotations(); tree.accept(this); return result; } catch (CompletionFailure ex) { return chk.completionError(tree.pos(), ex); } finally { annotate.unblockAnnotations(); this.env = prevEnv; } }
java
Type classEnter(JCTree tree, Env<AttrContext> env) { Env<AttrContext> prevEnv = this.env; try { this.env = env; annotate.blockAnnotations(); tree.accept(this); return result; } catch (CompletionFailure ex) { return chk.completionError(tree.pos(), ex); } finally { annotate.unblockAnnotations(); this.env = prevEnv; } }
[ "Type", "classEnter", "(", "JCTree", "tree", ",", "Env", "<", "AttrContext", ">", "env", ")", "{", "Env", "<", "AttrContext", ">", "prevEnv", "=", "this", ".", "env", ";", "try", "{", "this", ".", "env", "=", "env", ";", "annotate", ".", "blockAnnota...
Visitor method: enter all classes in given tree, catching any completion failure exceptions. Return the tree's type. @param tree The tree to be visited. @param env The environment visitor argument.
[ "Visitor", "method", ":", "enter", "all", "classes", "in", "given", "tree", "catching", "any", "completion", "failure", "exceptions", ".", "Return", "the", "tree", "s", "type", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java#L280-L293
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java
PlanNode.findAtOrBelow
public PlanNode findAtOrBelow( Traversal order, Type firstTypeToFind, Type... additionalTypesToFind ) { return findAtOrBelow(order, EnumSet.of(firstTypeToFind, additionalTypesToFind)); }
java
public PlanNode findAtOrBelow( Traversal order, Type firstTypeToFind, Type... additionalTypesToFind ) { return findAtOrBelow(order, EnumSet.of(firstTypeToFind, additionalTypesToFind)); }
[ "public", "PlanNode", "findAtOrBelow", "(", "Traversal", "order", ",", "Type", "firstTypeToFind", ",", "Type", "...", "additionalTypesToFind", ")", "{", "return", "findAtOrBelow", "(", "order", ",", "EnumSet", ".", "of", "(", "firstTypeToFind", ",", "additionalTyp...
Find the first node with one of the specified types that are at or below this node. @param order the order to traverse; may not be null @param firstTypeToFind the first type of node to find; may not be null @param additionalTypesToFind the additional types of node to find; may not be null @return the first node that is at or below this node that has one of the supplied types; or null if there is no such node
[ "Find", "the", "first", "node", "with", "one", "of", "the", "specified", "types", "that", "are", "at", "or", "below", "this", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1497-L1501
foundation-runtime/logging
logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java
TransactionLogger.addAsyncProperty
public static void addAsyncProperty(String key, String value, TransactionLogger transactionLogger) { FlowContextFactory.deserializeNativeFlowContext(transactionLogger.getFlowContextAsync(transactionLogger)); transactionLogger.properties.put(key, value); }
java
public static void addAsyncProperty(String key, String value, TransactionLogger transactionLogger) { FlowContextFactory.deserializeNativeFlowContext(transactionLogger.getFlowContextAsync(transactionLogger)); transactionLogger.properties.put(key, value); }
[ "public", "static", "void", "addAsyncProperty", "(", "String", "key", ",", "String", "value", ",", "TransactionLogger", "transactionLogger", ")", "{", "FlowContextFactory", ".", "deserializeNativeFlowContext", "(", "transactionLogger", ".", "getFlowContextAsync", "(", "...
Add property to 'properties' map on transaction @param key - of property @param value - of property @param transactionLogger
[ "Add", "property", "to", "properties", "map", "on", "transaction" ]
train
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java#L219-L224
ops4j/org.ops4j.base
ops4j-base-net/src/main/java/org/ops4j/net/URLUtils.java
URLUtils.prepareInputStream
public static InputStream prepareInputStream( final URL url, final boolean acceptAnyCertificate ) throws IOException { final URLConnection conn = url.openConnection(); prepareForAuthentication( conn ); prepareHttpHeaders( conn ); if( acceptAnyCertificate ) { prepareForSSL( conn ); } return conn.getInputStream(); }
java
public static InputStream prepareInputStream( final URL url, final boolean acceptAnyCertificate ) throws IOException { final URLConnection conn = url.openConnection(); prepareForAuthentication( conn ); prepareHttpHeaders( conn ); if( acceptAnyCertificate ) { prepareForSSL( conn ); } return conn.getInputStream(); }
[ "public", "static", "InputStream", "prepareInputStream", "(", "final", "URL", "url", ",", "final", "boolean", "acceptAnyCertificate", ")", "throws", "IOException", "{", "final", "URLConnection", "conn", "=", "url", ".", "openConnection", "(", ")", ";", "prepareFor...
Prepare url for authentication and ssl if necessary and returns the input stream from the url. @param url url to prepare @param acceptAnyCertificate true if the certicate check should be skipped @return input stream from url @throws IOException re-thrown
[ "Prepare", "url", "for", "authentication", "and", "ssl", "if", "necessary", "and", "returns", "the", "input", "stream", "from", "the", "url", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/URLUtils.java#L170-L181
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/BitSieve.java
BitSieve.retrieve
BigInteger retrieve(BigInteger initValue, int certainty, java.util.Random random) { // Examine the sieve one long at a time to find possible primes int offset = 1; for (int i=0; i<bits.length; i++) { long nextLong = ~bits[i]; for (int j=0; j<64; j++) { if ((nextLong & 1) == 1) { BigInteger candidate = initValue.add( BigInteger.valueOf(offset)); if (candidate.primeToCertainty(certainty, random)) return candidate; } nextLong >>>= 1; offset+=2; } } return null; }
java
BigInteger retrieve(BigInteger initValue, int certainty, java.util.Random random) { // Examine the sieve one long at a time to find possible primes int offset = 1; for (int i=0; i<bits.length; i++) { long nextLong = ~bits[i]; for (int j=0; j<64; j++) { if ((nextLong & 1) == 1) { BigInteger candidate = initValue.add( BigInteger.valueOf(offset)); if (candidate.primeToCertainty(certainty, random)) return candidate; } nextLong >>>= 1; offset+=2; } } return null; }
[ "BigInteger", "retrieve", "(", "BigInteger", "initValue", ",", "int", "certainty", ",", "java", ".", "util", ".", "Random", "random", ")", "{", "// Examine the sieve one long at a time to find possible primes", "int", "offset", "=", "1", ";", "for", "(", "int", "i...
Test probable primes in the sieve and return successful candidates.
[ "Test", "probable", "primes", "in", "the", "sieve", "and", "return", "successful", "candidates", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BitSieve.java#L194-L211
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java
AbstractRadial.create_POINTER_Image
protected BufferedImage create_POINTER_Image(final int WIDTH, final PointerType POINTER_TYPE) { if (getPointerColor() != ColorDef.CUSTOM) { return POINTER_FACTORY.createStandardPointer(WIDTH, POINTER_TYPE, getPointerColor(), getBackgroundColor()); } else { return POINTER_FACTORY.createStandardPointer(WIDTH, POINTER_TYPE, getPointerColor(), getModel().getCustomPointerColorObject(), getBackgroundColor()); } }
java
protected BufferedImage create_POINTER_Image(final int WIDTH, final PointerType POINTER_TYPE) { if (getPointerColor() != ColorDef.CUSTOM) { return POINTER_FACTORY.createStandardPointer(WIDTH, POINTER_TYPE, getPointerColor(), getBackgroundColor()); } else { return POINTER_FACTORY.createStandardPointer(WIDTH, POINTER_TYPE, getPointerColor(), getModel().getCustomPointerColorObject(), getBackgroundColor()); } }
[ "protected", "BufferedImage", "create_POINTER_Image", "(", "final", "int", "WIDTH", ",", "final", "PointerType", "POINTER_TYPE", ")", "{", "if", "(", "getPointerColor", "(", ")", "!=", "ColorDef", ".", "CUSTOM", ")", "{", "return", "POINTER_FACTORY", ".", "creat...
Returns the image of the pointer. This pointer is centered in the gauge. @param WIDTH @param POINTER_TYPE @return the pointer image that is used in all gauges that have a centered pointer
[ "Returns", "the", "image", "of", "the", "pointer", ".", "This", "pointer", "is", "centered", "in", "the", "gauge", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L2968-L2974
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java
ClassUtils.findMethodWith
public static Method findMethodWith(Class<?> searchClass, Class<? extends Annotation> annotationClass) { Method foundMethod = null; methodFinder: while (searchClass != null && searchClass != Object.class) { for (Method method : searchClass.getDeclaredMethods()) { if (method.isAnnotationPresent(annotationClass)) { foundMethod = method; break methodFinder; } } searchClass = searchClass.getSuperclass(); } return foundMethod; }
java
public static Method findMethodWith(Class<?> searchClass, Class<? extends Annotation> annotationClass) { Method foundMethod = null; methodFinder: while (searchClass != null && searchClass != Object.class) { for (Method method : searchClass.getDeclaredMethods()) { if (method.isAnnotationPresent(annotationClass)) { foundMethod = method; break methodFinder; } } searchClass = searchClass.getSuperclass(); } return foundMethod; }
[ "public", "static", "Method", "findMethodWith", "(", "Class", "<", "?", ">", "searchClass", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ")", "{", "Method", "foundMethod", "=", "null", ";", "methodFinder", ":", "while", "(", "sear...
Return a first occurrence of a method annotated with specified annotation @param searchClass class to be searched @param annotationClass annotation class @return annotated method or null
[ "Return", "a", "first", "occurrence", "of", "a", "method", "annotated", "with", "specified", "annotation" ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java#L194-L207
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_ipLoadbalancing_id_GET
public OvhIPLoadbalancing project_serviceName_ipLoadbalancing_id_GET(String serviceName, String id) throws IOException { String qPath = "/cloud/project/{serviceName}/ipLoadbalancing/{id}"; StringBuilder sb = path(qPath, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIPLoadbalancing.class); }
java
public OvhIPLoadbalancing project_serviceName_ipLoadbalancing_id_GET(String serviceName, String id) throws IOException { String qPath = "/cloud/project/{serviceName}/ipLoadbalancing/{id}"; StringBuilder sb = path(qPath, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIPLoadbalancing.class); }
[ "public", "OvhIPLoadbalancing", "project_serviceName_ipLoadbalancing_id_GET", "(", "String", "serviceName", ",", "String", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/ipLoadbalancing/{id}\"", ";", "StringBuilder", "sb", "="...
Get this object properties REST: GET /cloud/project/{serviceName}/ipLoadbalancing/{id} @param serviceName [required] The project id @param id [required] ID of your load balancing ip import API beta
[ "Get", "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#L1626-L1631
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/table/RtfBorderGroup.java
RtfBorderGroup.addBorder
public void addBorder(int bordersToAdd, int borderStyle, float borderWidth, Color borderColor) { if((bordersToAdd & Rectangle.LEFT) == Rectangle.LEFT) { setBorder(RtfBorder.LEFT_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.TOP) == Rectangle.TOP) { setBorder(RtfBorder.TOP_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.RIGHT) == Rectangle.RIGHT) { setBorder(RtfBorder.RIGHT_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.BOTTOM) == Rectangle.BOTTOM) { setBorder(RtfBorder.BOTTOM_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.BOX) == Rectangle.BOX && this.borderType == RtfBorder.ROW_BORDER) { setBorder(RtfBorder.VERTICAL_BORDER, borderStyle, borderWidth, borderColor); setBorder(RtfBorder.HORIZONTAL_BORDER, borderStyle, borderWidth, borderColor); } }
java
public void addBorder(int bordersToAdd, int borderStyle, float borderWidth, Color borderColor) { if((bordersToAdd & Rectangle.LEFT) == Rectangle.LEFT) { setBorder(RtfBorder.LEFT_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.TOP) == Rectangle.TOP) { setBorder(RtfBorder.TOP_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.RIGHT) == Rectangle.RIGHT) { setBorder(RtfBorder.RIGHT_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.BOTTOM) == Rectangle.BOTTOM) { setBorder(RtfBorder.BOTTOM_BORDER, borderStyle, borderWidth, borderColor); } if((bordersToAdd & Rectangle.BOX) == Rectangle.BOX && this.borderType == RtfBorder.ROW_BORDER) { setBorder(RtfBorder.VERTICAL_BORDER, borderStyle, borderWidth, borderColor); setBorder(RtfBorder.HORIZONTAL_BORDER, borderStyle, borderWidth, borderColor); } }
[ "public", "void", "addBorder", "(", "int", "bordersToAdd", ",", "int", "borderStyle", ",", "float", "borderWidth", ",", "Color", "borderColor", ")", "{", "if", "(", "(", "bordersToAdd", "&", "Rectangle", ".", "LEFT", ")", "==", "Rectangle", ".", "LEFT", ")...
Adds borders to the RtfBorderGroup @param bordersToAdd The borders to add (Rectangle.LEFT, Rectangle.RIGHT, Rectangle.TOP, Rectangle.BOTTOM, Rectangle.BOX) @param borderStyle The style of border to add (from RtfBorder) @param borderWidth The border width to use @param borderColor The border color to use
[ "Adds", "borders", "to", "the", "RtfBorderGroup" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/table/RtfBorderGroup.java#L162-L179
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageReceiver.java
BaseMessageReceiver.createDefaultFilter
public BaseMessageFilter createDefaultFilter(JMessageListener listener) { BaseMessageFilter messageFilter = null; String strQueueName = MessageConstants.RECORD_QUEUE_NAME; // Default queue name= String strQueueType = MessageConstants.INTRANET_QUEUE; // Default queue type if (m_baseMessageQueue != null) { strQueueName = m_baseMessageQueue.getQueueName(); strQueueType = m_baseMessageQueue.getQueueType(); } messageFilter = new BaseMessageFilter(strQueueName, strQueueType, null, null); // Take all messages messageFilter.addMessageListener(listener); //xif (bAddToReceiver) // Already added at previous line. //x this.addMessageFilter(messageFilter); return messageFilter; }
java
public BaseMessageFilter createDefaultFilter(JMessageListener listener) { BaseMessageFilter messageFilter = null; String strQueueName = MessageConstants.RECORD_QUEUE_NAME; // Default queue name= String strQueueType = MessageConstants.INTRANET_QUEUE; // Default queue type if (m_baseMessageQueue != null) { strQueueName = m_baseMessageQueue.getQueueName(); strQueueType = m_baseMessageQueue.getQueueType(); } messageFilter = new BaseMessageFilter(strQueueName, strQueueType, null, null); // Take all messages messageFilter.addMessageListener(listener); //xif (bAddToReceiver) // Already added at previous line. //x this.addMessageFilter(messageFilter); return messageFilter; }
[ "public", "BaseMessageFilter", "createDefaultFilter", "(", "JMessageListener", "listener", ")", "{", "BaseMessageFilter", "messageFilter", "=", "null", ";", "String", "strQueueName", "=", "MessageConstants", ".", "RECORD_QUEUE_NAME", ";", "// Default queue name=", "String",...
Create a message filter that will send all messages to this listener. @param listener The listener to create a filter for. @return The new filter for this listener.
[ "Create", "a", "message", "filter", "that", "will", "send", "all", "messages", "to", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageReceiver.java#L201-L216
apache/reef
lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/evaluator/VortexWorker.java
VortexWorker.call
@Override public byte[] call(final byte[] memento) throws Exception { final ExecutorService schedulerThread = Executors.newSingleThreadExecutor(); final ExecutorService commandExecutor = Executors.newFixedThreadPool(numOfThreads); final ConcurrentMap<Integer, Future> futures = new ConcurrentHashMap<>(); // Scheduling thread starts schedulerThread.execute(new Runnable() { @SuppressWarnings("InfiniteLoopStatement") // Scheduler is supposed to run forever. @Override public void run() { while (true) { // Scheduler Thread: Pick a command to execute (For now, simple FIFO order) final byte[] message; try { message = pendingRequests.takeFirst(); } catch (InterruptedException e) { throw new RuntimeException(e); } // Command Executor: Deserialize the command final MasterToWorkerRequest masterToWorkerRequest = (MasterToWorkerRequest)kryoUtils.deserialize(message); switch (masterToWorkerRequest.getType()) { case AggregateTasklets: final TaskletAggregationRequest taskletAggregationRequest = (TaskletAggregationRequest) masterToWorkerRequest; aggregates.put(taskletAggregationRequest.getAggregateFunctionId(), new AggregateContainer(heartBeatTriggerManager, kryoUtils, workerReports, taskletAggregationRequest)); break; case ExecuteAggregateTasklet: executeAggregateTasklet(commandExecutor, masterToWorkerRequest); break; case ExecuteTasklet: executeTasklet(commandExecutor, futures, masterToWorkerRequest); break; case CancelTasklet: final TaskletCancellationRequest cancellationRequest = (TaskletCancellationRequest) masterToWorkerRequest; LOG.log(Level.FINE, "Cancelling Tasklet with ID {0}.", cancellationRequest.getTaskletId()); final Future future = futures.get(cancellationRequest.getTaskletId()); if (future != null) { future.cancel(true); } break; default: throw new RuntimeException("Unknown Command"); } } } }); terminated.await(); return null; }
java
@Override public byte[] call(final byte[] memento) throws Exception { final ExecutorService schedulerThread = Executors.newSingleThreadExecutor(); final ExecutorService commandExecutor = Executors.newFixedThreadPool(numOfThreads); final ConcurrentMap<Integer, Future> futures = new ConcurrentHashMap<>(); // Scheduling thread starts schedulerThread.execute(new Runnable() { @SuppressWarnings("InfiniteLoopStatement") // Scheduler is supposed to run forever. @Override public void run() { while (true) { // Scheduler Thread: Pick a command to execute (For now, simple FIFO order) final byte[] message; try { message = pendingRequests.takeFirst(); } catch (InterruptedException e) { throw new RuntimeException(e); } // Command Executor: Deserialize the command final MasterToWorkerRequest masterToWorkerRequest = (MasterToWorkerRequest)kryoUtils.deserialize(message); switch (masterToWorkerRequest.getType()) { case AggregateTasklets: final TaskletAggregationRequest taskletAggregationRequest = (TaskletAggregationRequest) masterToWorkerRequest; aggregates.put(taskletAggregationRequest.getAggregateFunctionId(), new AggregateContainer(heartBeatTriggerManager, kryoUtils, workerReports, taskletAggregationRequest)); break; case ExecuteAggregateTasklet: executeAggregateTasklet(commandExecutor, masterToWorkerRequest); break; case ExecuteTasklet: executeTasklet(commandExecutor, futures, masterToWorkerRequest); break; case CancelTasklet: final TaskletCancellationRequest cancellationRequest = (TaskletCancellationRequest) masterToWorkerRequest; LOG.log(Level.FINE, "Cancelling Tasklet with ID {0}.", cancellationRequest.getTaskletId()); final Future future = futures.get(cancellationRequest.getTaskletId()); if (future != null) { future.cancel(true); } break; default: throw new RuntimeException("Unknown Command"); } } } }); terminated.await(); return null; }
[ "@", "Override", "public", "byte", "[", "]", "call", "(", "final", "byte", "[", "]", "memento", ")", "throws", "Exception", "{", "final", "ExecutorService", "schedulerThread", "=", "Executors", ".", "newSingleThreadExecutor", "(", ")", ";", "final", "ExecutorS...
Starts the scheduler and executor and waits until termination.
[ "Starts", "the", "scheduler", "and", "executor", "and", "waits", "until", "termination", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/evaluator/VortexWorker.java#L77-L131
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.waitForView
public boolean waitForView(Object tag, int minimumNumberOfMatches, int timeout){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+tag+", "+minimumNumberOfMatches+", "+timeout+")"); } return waitForView(tag, minimumNumberOfMatches, timeout, true); }
java
public boolean waitForView(Object tag, int minimumNumberOfMatches, int timeout){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+tag+", "+minimumNumberOfMatches+", "+timeout+")"); } return waitForView(tag, minimumNumberOfMatches, timeout, true); }
[ "public", "boolean", "waitForView", "(", "Object", "tag", ",", "int", "minimumNumberOfMatches", ",", "int", "timeout", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"waitForVi...
Waits for a View matching the specified tag. @param tag the {@link View#getTag() tag} of the {@link View} to wait for @param minimumNumberOfMatches the minimum number of matches that are expected to be found. {@code 0} means any number of matches @param timeout the amount of time in milliseconds to wait @return {@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout
[ "Waits", "for", "a", "View", "matching", "the", "specified", "tag", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L523-L529
tuenti/ButtonMenu
sample/src/main/java/com/tuenti/buttonmenu/sample/ui/activity/MainActivity.java
MainActivity.initializeScrollAnimator
private void initializeScrollAnimator() { ScrollAnimator scrollAnimator = new ScrollAnimator(button_menu, new ObjectAnimatorFactory()); scrollAnimator.configureListView(lv_contacts); scrollAnimator.setDurationInMillis(300); }
java
private void initializeScrollAnimator() { ScrollAnimator scrollAnimator = new ScrollAnimator(button_menu, new ObjectAnimatorFactory()); scrollAnimator.configureListView(lv_contacts); scrollAnimator.setDurationInMillis(300); }
[ "private", "void", "initializeScrollAnimator", "(", ")", "{", "ScrollAnimator", "scrollAnimator", "=", "new", "ScrollAnimator", "(", "button_menu", ",", "new", "ObjectAnimatorFactory", "(", ")", ")", ";", "scrollAnimator", ".", "configureListView", "(", "lv_contacts",...
Initialize ScrollAnimator to work with ButtonMenu custom view, the ListView used in this sample and an animation duration of 200 milliseconds.
[ "Initialize", "ScrollAnimator", "to", "work", "with", "ButtonMenu", "custom", "view", "the", "ListView", "used", "in", "this", "sample", "and", "an", "animation", "duration", "of", "200", "milliseconds", "." ]
train
https://github.com/tuenti/ButtonMenu/blob/95791383f6f976933496542b54e8c6dbdd73e669/sample/src/main/java/com/tuenti/buttonmenu/sample/ui/activity/MainActivity.java#L105-L109
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.startUploadFileSingle
public Uploader startUploadFileSingle(String targetPath, DbxWriteMode writeMode, long numBytes) throws DbxException { DbxPathV1.checkArg("targetPath", targetPath); if (numBytes < 0) throw new IllegalArgumentException("numBytes must be zero or greater"); String host = this.host.getContent(); String apiPath = "1/files_put/auto" + targetPath; ArrayList<HttpRequestor.Header> headers = new ArrayList<HttpRequestor.Header>(); headers.add(new HttpRequestor.Header("Content-Type", "application/octet-stream")); headers.add(new HttpRequestor.Header("Content-Length", Long.toString(numBytes))); HttpRequestor.Uploader uploader = DbxRequestUtil.startPut(requestConfig, accessToken, USER_AGENT_ID, host, apiPath, writeMode.params, headers); return new SingleUploader(uploader, numBytes); }
java
public Uploader startUploadFileSingle(String targetPath, DbxWriteMode writeMode, long numBytes) throws DbxException { DbxPathV1.checkArg("targetPath", targetPath); if (numBytes < 0) throw new IllegalArgumentException("numBytes must be zero or greater"); String host = this.host.getContent(); String apiPath = "1/files_put/auto" + targetPath; ArrayList<HttpRequestor.Header> headers = new ArrayList<HttpRequestor.Header>(); headers.add(new HttpRequestor.Header("Content-Type", "application/octet-stream")); headers.add(new HttpRequestor.Header("Content-Length", Long.toString(numBytes))); HttpRequestor.Uploader uploader = DbxRequestUtil.startPut(requestConfig, accessToken, USER_AGENT_ID, host, apiPath, writeMode.params, headers); return new SingleUploader(uploader, numBytes); }
[ "public", "Uploader", "startUploadFileSingle", "(", "String", "targetPath", ",", "DbxWriteMode", "writeMode", ",", "long", "numBytes", ")", "throws", "DbxException", "{", "DbxPathV1", ".", "checkArg", "(", "\"targetPath\"", ",", "targetPath", ")", ";", "if", "(", ...
Similar to {@link #uploadFile}, except always uses the /files_put API call. One difference is that {@code numBytes} must not be negative.
[ "Similar", "to", "{" ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L736-L752
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java
CountMin4.incrementAt
boolean incrementAt(int i, int j, long step) { int offset = j << 2; long mask = (0xfL << offset); if ((table[i] & mask) != mask) { long current = (table[i] & mask) >>> offset; long update = Math.min(current + step, 15); table[i] = (table[i] & ~mask) | (update << offset); return true; } return false; }
java
boolean incrementAt(int i, int j, long step) { int offset = j << 2; long mask = (0xfL << offset); if ((table[i] & mask) != mask) { long current = (table[i] & mask) >>> offset; long update = Math.min(current + step, 15); table[i] = (table[i] & ~mask) | (update << offset); return true; } return false; }
[ "boolean", "incrementAt", "(", "int", "i", ",", "int", "j", ",", "long", "step", ")", "{", "int", "offset", "=", "j", "<<", "2", ";", "long", "mask", "=", "(", "0xf", "L", "<<", "offset", ")", ";", "if", "(", "(", "table", "[", "i", "]", "&",...
Increments the specified counter by 1 if it is not already at the maximum value (15). @param i the table index (16 counters) @param j the counter to increment @param step the increase amount @return if incremented
[ "Increments", "the", "specified", "counter", "by", "1", "if", "it", "is", "not", "already", "at", "the", "maximum", "value", "(", "15", ")", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java#L166-L176
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java
PersonGroupsImpl.createAsync
public Observable<Void> createAsync(String personGroupId, CreatePersonGroupsOptionalParameter createOptionalParameter) { return createWithServiceResponseAsync(personGroupId, createOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> createAsync(String personGroupId, CreatePersonGroupsOptionalParameter createOptionalParameter) { return createWithServiceResponseAsync(personGroupId, createOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "createAsync", "(", "String", "personGroupId", ",", "CreatePersonGroupsOptionalParameter", "createOptionalParameter", ")", "{", "return", "createWithServiceResponseAsync", "(", "personGroupId", ",", "createOptionalParameter", ")", "...
Create a new person group with specified personGroupId, name and user-provided userData. @param personGroupId Id referencing a particular person group. @param createOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Create", "a", "new", "person", "group", "with", "specified", "personGroupId", "name", "and", "user", "-", "provided", "userData", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java#L133-L140
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/decorators/DecoratorRegistryImpl.java
DecoratorRegistryImpl.configure
private void configure(){ addDecorator(ServiceStats.class, new ServiceStatsDecorator()); addDecorator(ActionStats.class, new ActionStatsDecorator()); addDecorator(ServletStats.class, new ServletStatsDecorator()); addDecorator(FilterStats.class, new FilterStatsDecorator()); addDecorator(CacheStats.class, new CacheStatsDecorator()); addDecorator(StorageStats.class, new StorageStatsDecorator()); addDecorator(MemoryStats.class, new MemoryStatsDecorator()); addDecorator(MemoryPoolStats.class, new MemoryPoolStatsDecorator()); addDecorator(VirtualMemoryPoolStats.class, new MemoryPoolStatsDecorator("VirtualMemoryPool")); addDecorator(ThreadCountStats.class, new ThreadCountDecorator()); addDecorator(ThreadStateStats.class, new ThreadStatesDecorator()); addDecorator(OSStats.class, new OSStatsDecorator()); addDecorator(RuntimeStats.class, new RuntimeStatsDecorator()); addDecorator(PageInBrowserStats.class, new PageInBrowserStatsDecorator()); addDecorator(ErrorStats.class, new ErrorStatsDecorator()); addDecorator(GCStats.class, new GCStatsDecorator()); //counters addDecorator(CounterStats.class, new CounterStatsDecorator()); addDecorator(MaleFemaleStats.class, new MaleFemaleStatsDecorator()); addDecorator(GuestBasicPremiumStats.class, new GuestBasicPremiumStatsDecorator()); //session addDecorator(SessionCountStats.class, new SessionCountDecorator()); }
java
private void configure(){ addDecorator(ServiceStats.class, new ServiceStatsDecorator()); addDecorator(ActionStats.class, new ActionStatsDecorator()); addDecorator(ServletStats.class, new ServletStatsDecorator()); addDecorator(FilterStats.class, new FilterStatsDecorator()); addDecorator(CacheStats.class, new CacheStatsDecorator()); addDecorator(StorageStats.class, new StorageStatsDecorator()); addDecorator(MemoryStats.class, new MemoryStatsDecorator()); addDecorator(MemoryPoolStats.class, new MemoryPoolStatsDecorator()); addDecorator(VirtualMemoryPoolStats.class, new MemoryPoolStatsDecorator("VirtualMemoryPool")); addDecorator(ThreadCountStats.class, new ThreadCountDecorator()); addDecorator(ThreadStateStats.class, new ThreadStatesDecorator()); addDecorator(OSStats.class, new OSStatsDecorator()); addDecorator(RuntimeStats.class, new RuntimeStatsDecorator()); addDecorator(PageInBrowserStats.class, new PageInBrowserStatsDecorator()); addDecorator(ErrorStats.class, new ErrorStatsDecorator()); addDecorator(GCStats.class, new GCStatsDecorator()); //counters addDecorator(CounterStats.class, new CounterStatsDecorator()); addDecorator(MaleFemaleStats.class, new MaleFemaleStatsDecorator()); addDecorator(GuestBasicPremiumStats.class, new GuestBasicPremiumStatsDecorator()); //session addDecorator(SessionCountStats.class, new SessionCountDecorator()); }
[ "private", "void", "configure", "(", ")", "{", "addDecorator", "(", "ServiceStats", ".", "class", ",", "new", "ServiceStatsDecorator", "(", ")", ")", ";", "addDecorator", "(", "ActionStats", ".", "class", ",", "new", "ActionStatsDecorator", "(", ")", ")", ";...
leon: replace this hard-wired-method with a property or xml config one day
[ "leon", ":", "replace", "this", "hard", "-", "wired", "-", "method", "with", "a", "property", "or", "xml", "config", "one", "day" ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/decorators/DecoratorRegistryImpl.java#L156-L181
upwork/java-upwork
src/com/Upwork/api/Routers/Hr/Jobs.java
Jobs.postJob
public JSONObject postJob(HashMap<String, String> params) throws JSONException { return oClient.post("/hr/v2/jobs", params); }
java
public JSONObject postJob(HashMap<String, String> params) throws JSONException { return oClient.post("/hr/v2/jobs", params); }
[ "public", "JSONObject", "postJob", "(", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "post", "(", "\"/hr/v2/jobs\"", ",", "params", ")", ";", "}" ]
Post a new job @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Post", "a", "new", "job" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Jobs.java#L75-L77
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java
DataSetUtils.sampleWithSize
public static <T> DataSet<T> sampleWithSize( DataSet <T> input, final boolean withReplacement, final int numSamples) { return sampleWithSize(input, withReplacement, numSamples, Utils.RNG.nextLong()); }
java
public static <T> DataSet<T> sampleWithSize( DataSet <T> input, final boolean withReplacement, final int numSamples) { return sampleWithSize(input, withReplacement, numSamples, Utils.RNG.nextLong()); }
[ "public", "static", "<", "T", ">", "DataSet", "<", "T", ">", "sampleWithSize", "(", "DataSet", "<", "T", ">", "input", ",", "final", "boolean", "withReplacement", ",", "final", "int", "numSamples", ")", "{", "return", "sampleWithSize", "(", "input", ",", ...
Generate a sample of DataSet which contains fixed size elements. <p><strong>NOTE:</strong> Sample with fixed size is not as efficient as sample with fraction, use sample with fraction unless you need exact precision. @param withReplacement Whether element can be selected more than once. @param numSamples The expected sample size. @return The sampled DataSet
[ "Generate", "a", "sample", "of", "DataSet", "which", "contains", "fixed", "size", "elements", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java#L232-L238
cternes/openkeepass
src/main/java/de/slackspace/openkeepass/KeePassDatabase.java
KeePassDatabase.getInstance
public static KeePassDatabase getInstance(File keePassDatabaseFile) { if (keePassDatabaseFile == null) { throw new IllegalArgumentException("You must provide a valid KeePass database file."); } InputStream keePassDatabaseStream = null; try { keePassDatabaseStream = new FileInputStream(keePassDatabaseFile); return getInstance(keePassDatabaseStream); } catch (FileNotFoundException e) { throw new IllegalArgumentException("The KeePass database file could not be found. You must provide a valid KeePass database file.", e); } finally { if (keePassDatabaseStream != null) { try { keePassDatabaseStream.close(); } catch (IOException e) { // Ignore } } } }
java
public static KeePassDatabase getInstance(File keePassDatabaseFile) { if (keePassDatabaseFile == null) { throw new IllegalArgumentException("You must provide a valid KeePass database file."); } InputStream keePassDatabaseStream = null; try { keePassDatabaseStream = new FileInputStream(keePassDatabaseFile); return getInstance(keePassDatabaseStream); } catch (FileNotFoundException e) { throw new IllegalArgumentException("The KeePass database file could not be found. You must provide a valid KeePass database file.", e); } finally { if (keePassDatabaseStream != null) { try { keePassDatabaseStream.close(); } catch (IOException e) { // Ignore } } } }
[ "public", "static", "KeePassDatabase", "getInstance", "(", "File", "keePassDatabaseFile", ")", "{", "if", "(", "keePassDatabaseFile", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"You must provide a valid KeePass database file.\"", ")", ";", ...
Retrieves a KeePassDatabase instance. The instance returned is based on the given database file and tries to parse the database header of it. @param keePassDatabaseFile a KeePass database file, must not be NULL @return a KeePassDatabase
[ "Retrieves", "a", "KeePassDatabase", "instance", ".", "The", "instance", "returned", "is", "based", "on", "the", "given", "database", "file", "and", "tries", "to", "parse", "the", "database", "header", "of", "it", "." ]
train
https://github.com/cternes/openkeepass/blob/4a354aecaea38af3c0dce5eb81b533f297e8d94f/src/main/java/de/slackspace/openkeepass/KeePassDatabase.java#L106-L126
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.findCodePointOffset
public static int findCodePointOffset(String source, int offset16) { if (offset16 < 0 || offset16 > source.length()) { throw new StringIndexOutOfBoundsException(offset16); } int result = 0; char ch; boolean hadLeadSurrogate = false; for (int i = 0; i < offset16; ++i) { ch = source.charAt(i); if (hadLeadSurrogate && isTrailSurrogate(ch)) { hadLeadSurrogate = false; // count valid trail as zero } else { hadLeadSurrogate = isLeadSurrogate(ch); ++result; // count others as 1 } } if (offset16 == source.length()) { return result; } // end of source being the less significant surrogate character // shift result back to the start of the supplementary character if (hadLeadSurrogate && (isTrailSurrogate(source.charAt(offset16)))) { result--; } return result; }
java
public static int findCodePointOffset(String source, int offset16) { if (offset16 < 0 || offset16 > source.length()) { throw new StringIndexOutOfBoundsException(offset16); } int result = 0; char ch; boolean hadLeadSurrogate = false; for (int i = 0; i < offset16; ++i) { ch = source.charAt(i); if (hadLeadSurrogate && isTrailSurrogate(ch)) { hadLeadSurrogate = false; // count valid trail as zero } else { hadLeadSurrogate = isLeadSurrogate(ch); ++result; // count others as 1 } } if (offset16 == source.length()) { return result; } // end of source being the less significant surrogate character // shift result back to the start of the supplementary character if (hadLeadSurrogate && (isTrailSurrogate(source.charAt(offset16)))) { result--; } return result; }
[ "public", "static", "int", "findCodePointOffset", "(", "String", "source", ",", "int", "offset16", ")", "{", "if", "(", "offset16", "<", "0", "||", "offset16", ">", "source", ".", "length", "(", ")", ")", "{", "throw", "new", "StringIndexOutOfBoundsException...
Returns the UTF-32 offset corresponding to the first UTF-32 boundary at or after the given UTF-16 offset. Used for random access. See the {@link UTF16 class description} for notes on roundtripping.<br> <i>Note: If the UTF-16 offset is into the middle of a surrogate pair, then the UTF-32 offset of the <strong>lead</strong> of the pair is returned. </i> <p> To find the UTF-32 length of a string, use: <pre> len32 = countCodePoint(source, source.length()); </pre> @param source Text to analyse @param offset16 UTF-16 offset &lt; source text length. @return UTF-32 offset @exception IndexOutOfBoundsException If offset16 is out of bounds.
[ "Returns", "the", "UTF", "-", "32", "offset", "corresponding", "to", "the", "first", "UTF", "-", "32", "boundary", "at", "or", "after", "the", "given", "UTF", "-", "16", "offset", ".", "Used", "for", "random", "access", ".", "See", "the", "{", "@link",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L833-L863
stormpath/stormpath-shiro
core/src/main/java/com/stormpath/shiro/realm/ApplicationRealm.java
ApplicationRealm.ensureApplicationReference
protected final Application ensureApplicationReference() { if (this.application == null) { assertState(); Application tmpApp = applicationResolver.getApplication(client, applicationRestUrl); if (tmpApp == null) { throw new IllegalStateException("ApplicationResolver returned 'null' Application, this is likely a configuration error."); } this.application = tmpApp; } return this.application; }
java
protected final Application ensureApplicationReference() { if (this.application == null) { assertState(); Application tmpApp = applicationResolver.getApplication(client, applicationRestUrl); if (tmpApp == null) { throw new IllegalStateException("ApplicationResolver returned 'null' Application, this is likely a configuration error."); } this.application = tmpApp; } return this.application; }
[ "protected", "final", "Application", "ensureApplicationReference", "(", ")", "{", "if", "(", "this", ".", "application", "==", "null", ")", "{", "assertState", "(", ")", ";", "Application", "tmpApp", "=", "applicationResolver", ".", "getApplication", "(", "clien...
acquisition, so it is negligible if this executes a few times instead of just once.
[ "acquisition", "so", "it", "is", "negligible", "if", "this", "executes", "a", "few", "times", "instead", "of", "just", "once", "." ]
train
https://github.com/stormpath/stormpath-shiro/blob/7a3c4fd3bd0ed9bb4546932495c79e6ad6fa1a92/core/src/main/java/com/stormpath/shiro/realm/ApplicationRealm.java#L337-L347
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java
TarHeader.getCheckSumOctalBytes
public static int getCheckSumOctalBytes(long value, byte[] buf, int offset, int length) { TarHeader.getOctalBytes(value, buf, offset, length); buf[offset + length - 1] = (byte) ' '; buf[offset + length - 2] = 0; return offset + length; }
java
public static int getCheckSumOctalBytes(long value, byte[] buf, int offset, int length) { TarHeader.getOctalBytes(value, buf, offset, length); buf[offset + length - 1] = (byte) ' '; buf[offset + length - 2] = 0; return offset + length; }
[ "public", "static", "int", "getCheckSumOctalBytes", "(", "long", "value", ",", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "{", "TarHeader", ".", "getOctalBytes", "(", "value", ",", "buf", ",", "offset", ",", "length", ")", ...
Parse the checksum octal integer from a header buffer. @param header The header buffer from which to parse. @param offset The offset into the buffer from which to parse. @param length The number of header bytes to parse. @return The integer value of the entry's checksum.
[ "Parse", "the", "checksum", "octal", "integer", "from", "a", "header", "buffer", "." ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L479-L484
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/im/v2/AVIMMessageInterval.java
AVIMMessageInterval.createBound
public static AVIMMessageIntervalBound createBound(String messageId, long timestamp, boolean closed) { return new AVIMMessageIntervalBound(messageId, timestamp, closed); }
java
public static AVIMMessageIntervalBound createBound(String messageId, long timestamp, boolean closed) { return new AVIMMessageIntervalBound(messageId, timestamp, closed); }
[ "public", "static", "AVIMMessageIntervalBound", "createBound", "(", "String", "messageId", ",", "long", "timestamp", ",", "boolean", "closed", ")", "{", "return", "new", "AVIMMessageIntervalBound", "(", "messageId", ",", "timestamp", ",", "closed", ")", ";", "}" ]
create query bound @param messageId - message id @param timestamp - message timestamp @param closed - included specified message flag. true: include false: not include. @return query interval bound instance
[ "create", "query", "bound" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMMessageInterval.java#L32-L34
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java
Segment3ifx.x1Property
@Pure public IntegerProperty x1Property() { if (this.p1.x == null) { this.p1.x = new SimpleIntegerProperty(this, MathFXAttributeNames.X1); } return this.p1.x; }
java
@Pure public IntegerProperty x1Property() { if (this.p1.x == null) { this.p1.x = new SimpleIntegerProperty(this, MathFXAttributeNames.X1); } return this.p1.x; }
[ "@", "Pure", "public", "IntegerProperty", "x1Property", "(", ")", "{", "if", "(", "this", ".", "p1", ".", "x", "==", "null", ")", "{", "this", ".", "p1", ".", "x", "=", "new", "SimpleIntegerProperty", "(", "this", ",", "MathFXAttributeNames", ".", "X1"...
Replies the property that is the x coordinate of the first segment point. @return the x1 property.
[ "Replies", "the", "property", "that", "is", "the", "x", "coordinate", "of", "the", "first", "segment", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java#L204-L210
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.doResolve
private void doResolve(final CLClause c, final int pivot, final CLClause d) { assert !c.dumped() && !c.satisfied(); assert !d.dumped() && !d.satisfied(); assert this.addedlits.empty(); this.stats.steps++; for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit != pivot) { this.addedlits.push(lit); } } this.stats.steps++; for (int i = 0; i < d.lits().size(); i++) { final int lit = d.lits().get(i); if (lit != -pivot) { this.addedlits.push(lit); } } if (!trivialClause()) { newPushConnectClause(); } this.addedlits.clear(); }
java
private void doResolve(final CLClause c, final int pivot, final CLClause d) { assert !c.dumped() && !c.satisfied(); assert !d.dumped() && !d.satisfied(); assert this.addedlits.empty(); this.stats.steps++; for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit != pivot) { this.addedlits.push(lit); } } this.stats.steps++; for (int i = 0; i < d.lits().size(); i++) { final int lit = d.lits().get(i); if (lit != -pivot) { this.addedlits.push(lit); } } if (!trivialClause()) { newPushConnectClause(); } this.addedlits.clear(); }
[ "private", "void", "doResolve", "(", "final", "CLClause", "c", ",", "final", "int", "pivot", ",", "final", "CLClause", "d", ")", "{", "assert", "!", "c", ".", "dumped", "(", ")", "&&", "!", "c", ".", "satisfied", "(", ")", ";", "assert", "!", "d", ...
Performs resolution on two given clauses and a pivot literal. @param c the first clause @param pivot the pivot literal @param d the second clause
[ "Performs", "resolution", "on", "two", "given", "clauses", "and", "a", "pivot", "literal", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1013-L1029
hawkular/hawkular-apm
client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java
APMSpan.initFromExtractedTraceState
protected void initFromExtractedTraceState(APMSpanBuilder builder, TraceRecorder recorder, Reference ref, ContextSampler sampler) { APMSpanBuilder parentBuilder = (APMSpanBuilder) ref.getReferredTo(); initTopLevelState(this, recorder, sampler); // Check for passed state if (parentBuilder.state().containsKey(Constants.HAWKULAR_APM_ID)) { setInteractionId(parentBuilder.state().get(Constants.HAWKULAR_APM_ID).toString()); traceContext.initTraceState(parentBuilder.state()); } // Assume top level consumer, even if no state was provided, as span context // as passed using a 'child of' relationship getNodeBuilder().setNodeType(NodeType.Consumer); processRemainingReferences(builder, ref); }
java
protected void initFromExtractedTraceState(APMSpanBuilder builder, TraceRecorder recorder, Reference ref, ContextSampler sampler) { APMSpanBuilder parentBuilder = (APMSpanBuilder) ref.getReferredTo(); initTopLevelState(this, recorder, sampler); // Check for passed state if (parentBuilder.state().containsKey(Constants.HAWKULAR_APM_ID)) { setInteractionId(parentBuilder.state().get(Constants.HAWKULAR_APM_ID).toString()); traceContext.initTraceState(parentBuilder.state()); } // Assume top level consumer, even if no state was provided, as span context // as passed using a 'child of' relationship getNodeBuilder().setNodeType(NodeType.Consumer); processRemainingReferences(builder, ref); }
[ "protected", "void", "initFromExtractedTraceState", "(", "APMSpanBuilder", "builder", ",", "TraceRecorder", "recorder", ",", "Reference", "ref", ",", "ContextSampler", "sampler", ")", "{", "APMSpanBuilder", "parentBuilder", "=", "(", "APMSpanBuilder", ")", "ref", ".",...
This method initialises the span based on extracted trace state. @param builder The span builder @param recorder The trace recorder @param ref The reference @param sampler The sampler
[ "This", "method", "initialises", "the", "span", "based", "on", "extracted", "trace", "state", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java#L179-L196
Waikato/moa
moa/src/main/java/moa/clusterers/clustream/WithKmeans.java
WithKmeans.kMeans_gta
public static Clustering kMeans_gta(int k, Clustering clustering, Clustering gtClustering) { ArrayList<CFCluster> microclusters = new ArrayList<CFCluster>(); for (int i = 0; i < clustering.size(); i++) { if (clustering.get(i) instanceof CFCluster) { microclusters.add((CFCluster)clustering.get(i)); } else { System.out.println("Unsupported Cluster Type:" + clustering.get(i).getClass() + ". Cluster needs to extend moa.cluster.CFCluster"); } } int n = microclusters.size(); assert (k <= n); /* k-means */ Random random = new Random(0); Cluster[] centers = new Cluster[k]; int K = gtClustering.size(); for (int i = 0; i < k; i++) { if (i < K) { // GT-aided centers[i] = new SphereCluster(gtClustering.get(i).getCenter(), 0); } else { // Randomized int rid = random.nextInt(n); centers[i] = new SphereCluster(microclusters.get(rid).getCenter(), 0); } } return cleanUpKMeans(kMeans(k, centers, microclusters), microclusters); }
java
public static Clustering kMeans_gta(int k, Clustering clustering, Clustering gtClustering) { ArrayList<CFCluster> microclusters = new ArrayList<CFCluster>(); for (int i = 0; i < clustering.size(); i++) { if (clustering.get(i) instanceof CFCluster) { microclusters.add((CFCluster)clustering.get(i)); } else { System.out.println("Unsupported Cluster Type:" + clustering.get(i).getClass() + ". Cluster needs to extend moa.cluster.CFCluster"); } } int n = microclusters.size(); assert (k <= n); /* k-means */ Random random = new Random(0); Cluster[] centers = new Cluster[k]; int K = gtClustering.size(); for (int i = 0; i < k; i++) { if (i < K) { // GT-aided centers[i] = new SphereCluster(gtClustering.get(i).getCenter(), 0); } else { // Randomized int rid = random.nextInt(n); centers[i] = new SphereCluster(microclusters.get(rid).getCenter(), 0); } } return cleanUpKMeans(kMeans(k, centers, microclusters), microclusters); }
[ "public", "static", "Clustering", "kMeans_gta", "(", "int", "k", ",", "Clustering", "clustering", ",", "Clustering", "gtClustering", ")", "{", "ArrayList", "<", "CFCluster", ">", "microclusters", "=", "new", "ArrayList", "<", "CFCluster", ">", "(", ")", ";", ...
k-means of (micro)clusters, with ground-truth-aided initialization. (to produce best results) @param k @param data @return (macro)clustering - CFClusters
[ "k", "-", "means", "of", "(", "micro", ")", "clusters", "with", "ground", "-", "truth", "-", "aided", "initialization", ".", "(", "to", "produce", "best", "results", ")" ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustream/WithKmeans.java#L233-L262
Wikidata/Wikidata-Toolkit
wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/StatementUpdate.java
StatementUpdate.mergeStatements
private Statement mergeStatements(Statement statement1, Statement statement2) { if (!equivalentClaims(statement1.getClaim(), statement2.getClaim())) { return null; } StatementRank newRank = statement1.getRank(); if (newRank == StatementRank.NORMAL) { newRank = statement2.getRank(); } else if (statement2.getRank() != StatementRank.NORMAL && newRank != statement2.getRank()) { return null; } String newStatementId = statement1.getStatementId(); if ("".equals(newStatementId)) { newStatementId = statement2.getStatementId(); } List<Reference> newReferences = mergeReferences( statement1.getReferences(), statement2.getReferences()); return Datamodel.makeStatement(statement1.getClaim(), newReferences, newRank, newStatementId); }
java
private Statement mergeStatements(Statement statement1, Statement statement2) { if (!equivalentClaims(statement1.getClaim(), statement2.getClaim())) { return null; } StatementRank newRank = statement1.getRank(); if (newRank == StatementRank.NORMAL) { newRank = statement2.getRank(); } else if (statement2.getRank() != StatementRank.NORMAL && newRank != statement2.getRank()) { return null; } String newStatementId = statement1.getStatementId(); if ("".equals(newStatementId)) { newStatementId = statement2.getStatementId(); } List<Reference> newReferences = mergeReferences( statement1.getReferences(), statement2.getReferences()); return Datamodel.makeStatement(statement1.getClaim(), newReferences, newRank, newStatementId); }
[ "private", "Statement", "mergeStatements", "(", "Statement", "statement1", ",", "Statement", "statement2", ")", "{", "if", "(", "!", "equivalentClaims", "(", "statement1", ".", "getClaim", "(", ")", ",", "statement2", ".", "getClaim", "(", ")", ")", ")", "{"...
Returns a statement obtained by merging two given statements, if possible, or null if the statements cannot be merged. Statements are merged if they contain the same claim, but possibly with qualifiers in a different order. The statements may have different ids, ranks, and references. References will be merged. Different ranks are supported if one of the statement uses {@link StatementRank#NORMAL}, and the rank of the other (non-normal) statement is used in this case; otherwise the statements will not merge. The first statement takes precedence for determining inessential details of the merger, such as the order of qualifiers. @param statement1 first statement @param statement2 second statement @return merged statement or null if merging is not possible
[ "Returns", "a", "statement", "obtained", "by", "merging", "two", "given", "statements", "if", "possible", "or", "null", "if", "the", "statements", "cannot", "be", "merged", ".", "Statements", "are", "merged", "if", "they", "contain", "the", "same", "claim", ...
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/StatementUpdate.java#L471-L494
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/TypeHandler.java
TypeHandler.createValue
public static Object createValue(String str, Object obj) throws ParseException { return createValue(str, (Class<?>) obj); }
java
public static Object createValue(String str, Object obj) throws ParseException { return createValue(str, (Class<?>) obj); }
[ "public", "static", "Object", "createValue", "(", "String", "str", ",", "Object", "obj", ")", "throws", "ParseException", "{", "return", "createValue", "(", "str", ",", "(", "Class", "<", "?", ">", ")", "obj", ")", ";", "}" ]
Returns the <code>Object</code> of type <code>obj</code> with the value of <code>str</code>. @param str the command line value @param obj the type of argument @return The instance of <code>obj</code> initialised with the value of <code>str</code>. @throws ParseException if the value creation for the given object type failed
[ "Returns", "the", "<code", ">", "Object<", "/", "code", ">", "of", "type", "<code", ">", "obj<", "/", "code", ">", "with", "the", "value", "of", "<code", ">", "str<", "/", "code", ">", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/TypeHandler.java#L47-L50
r0adkll/PostOffice
library/src/main/java/com/r0adkll/postoffice/PostOffice.java
PostOffice.newEditTextMail
public static Delivery newEditTextMail(@NotNull Context ctx, CharSequence title, CharSequence hint, int inputType, EditTextStyle.OnTextAcceptedListener listener){ // Create the delivery Delivery.Builder builder = newMail(ctx) .setTitle(title) .setStyle(new EditTextStyle.Builder(ctx) .setHint(hint) .setInputType(inputType) .setOnTextAcceptedListener(listener) .build()); // Return the delivery return builder.build(); }
java
public static Delivery newEditTextMail(@NotNull Context ctx, CharSequence title, CharSequence hint, int inputType, EditTextStyle.OnTextAcceptedListener listener){ // Create the delivery Delivery.Builder builder = newMail(ctx) .setTitle(title) .setStyle(new EditTextStyle.Builder(ctx) .setHint(hint) .setInputType(inputType) .setOnTextAcceptedListener(listener) .build()); // Return the delivery return builder.build(); }
[ "public", "static", "Delivery", "newEditTextMail", "(", "@", "NotNull", "Context", "ctx", ",", "CharSequence", "title", ",", "CharSequence", "hint", ",", "int", "inputType", ",", "EditTextStyle", ".", "OnTextAcceptedListener", "listener", ")", "{", "// Create the de...
Create a new EditText Dialog 'Mail' Delivery to display - This creates a dialog with 2 buttons and an EditText field for the content and retrieves text input from your user @param ctx the application context @param title the dialog title @param hint the EditText hint text @param inputType the EditText input type @param listener the text acceptance listener @return the new delivery
[ "Create", "a", "new", "EditText", "Dialog", "Mail", "Delivery", "to", "display", "-", "This", "creates", "a", "dialog", "with", "2", "buttons", "and", "an", "EditText", "field", "for", "the", "content", "and", "retrieves", "text", "input", "from", "your", ...
train
https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/PostOffice.java#L317-L329
lightblue-platform/lightblue-migrator
migrator/src/main/java/com/redhat/lightblue/migrator/Migrator.java
Migrator.beforeSaveToDestination
protected void beforeSaveToDestination(Map<Identity, JsonNode> sourceDocs, Map<Identity, JsonNode> destDocs, Set<Identity> insertDocs, Set<Identity> rewriteDocs, List<JsonNode> saveDocsList) { // do nothing by default // override this in child classes to get access to docs before they are saved }
java
protected void beforeSaveToDestination(Map<Identity, JsonNode> sourceDocs, Map<Identity, JsonNode> destDocs, Set<Identity> insertDocs, Set<Identity> rewriteDocs, List<JsonNode> saveDocsList) { // do nothing by default // override this in child classes to get access to docs before they are saved }
[ "protected", "void", "beforeSaveToDestination", "(", "Map", "<", "Identity", ",", "JsonNode", ">", "sourceDocs", ",", "Map", "<", "Identity", ",", "JsonNode", ">", "destDocs", ",", "Set", "<", "Identity", ">", "insertDocs", ",", "Set", "<", "Identity", ">", ...
Execute this method before docs are saved to destination (Lightblue). Modifying saveDocsList will affect what gets actually saved. Implementation of this method is responsible for exception handling. @param sourceDocs docs read from source @param destDocs corresponding docs read from destination @param insertDocs docs which exist in source but not in destination @param rewriteDocs docs which existing in both source and destination, but are different @param saveDocsList list of docs to save
[ "Execute", "this", "method", "before", "docs", "are", "saved", "to", "destination", "(", "Lightblue", ")", ".", "Modifying", "saveDocsList", "will", "affect", "what", "gets", "actually", "saved", ".", "Implementation", "of", "this", "method", "is", "responsible"...
train
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/migrator/src/main/java/com/redhat/lightblue/migrator/Migrator.java#L117-L120
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addIntervalPattern
private void addIntervalPattern(MethodSpec.Builder method, List<Node> pattern, String which) { for (Node node : pattern) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; method.addStatement("formatField($L, '$L', $L, b)", which, field.ch(), field.width()); } } }
java
private void addIntervalPattern(MethodSpec.Builder method, List<Node> pattern, String which) { for (Node node : pattern) { if (node instanceof Text) { method.addStatement("b.append($S)", ((Text)node).text()); } else if (node instanceof Field) { Field field = (Field)node; method.addStatement("formatField($L, '$L', $L, b)", which, field.ch(), field.width()); } } }
[ "private", "void", "addIntervalPattern", "(", "MethodSpec", ".", "Builder", "method", ",", "List", "<", "Node", ">", "pattern", ",", "String", "which", ")", "{", "for", "(", "Node", "node", ":", "pattern", ")", "{", "if", "(", "node", "instanceof", "Text...
Adds code to format a date time interval pattern, which may be the start or end date time, signified by the 'which' parameter.
[ "Adds", "code", "to", "format", "a", "date", "time", "interval", "pattern", "which", "may", "be", "the", "start", "or", "end", "date", "time", "signified", "by", "the", "which", "parameter", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L480-L489
paypal/SeLion
client/src/main/java/com/paypal/selion/configuration/Config.java
Config.setConfigProperty
public static synchronized void setConfigProperty(ConfigProperty configProperty, Object configPropertyValue) { checkArgument(configProperty != null, "Config property cannot be null."); checkArgument(configPropertyValue != null, "Config property value cannot be null."); getConfig().setProperty(configProperty.getName(), configPropertyValue); }
java
public static synchronized void setConfigProperty(ConfigProperty configProperty, Object configPropertyValue) { checkArgument(configProperty != null, "Config property cannot be null."); checkArgument(configPropertyValue != null, "Config property value cannot be null."); getConfig().setProperty(configProperty.getName(), configPropertyValue); }
[ "public", "static", "synchronized", "void", "setConfigProperty", "(", "ConfigProperty", "configProperty", ",", "Object", "configPropertyValue", ")", "{", "checkArgument", "(", "configProperty", "!=", "null", ",", "\"Config property cannot be null.\"", ")", ";", "checkArgu...
Sets a SeLion configuration value. This is useful when you want to override or set a setting. @param configProperty The configuration element to set @param configPropertyValue The value of the configuration element @throws IllegalArgumentException If problems occur during the set
[ "Sets", "a", "SeLion", "configuration", "value", ".", "This", "is", "useful", "when", "you", "want", "to", "override", "or", "set", "a", "setting", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/configuration/Config.java#L376-L380
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/crf/crfpp/Node.java
Node.calcExpectation
public void calcExpectation(double[] expected, double Z, int size) { double c = Math.exp(alpha + beta - cost - Z); for (int i = 0; fVector.get(i) != -1; i++) { int idx = fVector.get(i) + y; expected[idx] += c; } for (Path p : lpath) { p.calcExpectation(expected, Z, size); } }
java
public void calcExpectation(double[] expected, double Z, int size) { double c = Math.exp(alpha + beta - cost - Z); for (int i = 0; fVector.get(i) != -1; i++) { int idx = fVector.get(i) + y; expected[idx] += c; } for (Path p : lpath) { p.calcExpectation(expected, Z, size); } }
[ "public", "void", "calcExpectation", "(", "double", "[", "]", "expected", ",", "double", "Z", ",", "int", "size", ")", "{", "double", "c", "=", "Math", ".", "exp", "(", "alpha", "+", "beta", "-", "cost", "-", "Z", ")", ";", "for", "(", "int", "i"...
计算节点期望 @param expected 输出期望 @param Z 规范化因子 @param size 标签个数
[ "计算节点期望" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/crfpp/Node.java#L80-L92
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/DocumentObjectMapper.java
DocumentObjectMapper.extractFieldValue
static void extractFieldValue(Object entity, DBObject dbObj, Attribute column) throws PropertyAccessException { try { Object valueObject = PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember()); if (valueObject != null) { Class javaType = column.getJavaType(); switch (AttributeType.getType(javaType)) { case MAP: Map mapObj = (Map) valueObject; // BasicDBObjectBuilder builder = // BasicDBObjectBuilder.start(mapObj); BasicDBObjectBuilder b = new BasicDBObjectBuilder(); Iterator i = mapObj.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); b.add(entry.getKey().toString(), MongoDBUtils.populateValue(entry.getValue(), entry.getValue().getClass())); } dbObj.put(((AbstractAttribute) column).getJPAColumnName(), b.get()); break; case SET: case LIST: Collection collection = (Collection) valueObject; BasicDBList basicDBList = new BasicDBList(); for (Object o : collection) { basicDBList.add(o); } dbObj.put(((AbstractAttribute) column).getJPAColumnName(), basicDBList); break; case POINT: Point p = (Point) valueObject; double[] coordinate = new double[] { p.getX(), p.getY() }; dbObj.put(((AbstractAttribute) column).getJPAColumnName(), coordinate); break; case ENUM: case PRIMITIVE: dbObj.put(((AbstractAttribute) column).getJPAColumnName(), MongoDBUtils.populateValue(valueObject, javaType)); break; } } } catch (PropertyAccessException paex) { log.error("Error while getting column {} value, caused by : .", ((AbstractAttribute) column).getJPAColumnName(), paex); throw new PersistenceException(paex); } }
java
static void extractFieldValue(Object entity, DBObject dbObj, Attribute column) throws PropertyAccessException { try { Object valueObject = PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember()); if (valueObject != null) { Class javaType = column.getJavaType(); switch (AttributeType.getType(javaType)) { case MAP: Map mapObj = (Map) valueObject; // BasicDBObjectBuilder builder = // BasicDBObjectBuilder.start(mapObj); BasicDBObjectBuilder b = new BasicDBObjectBuilder(); Iterator i = mapObj.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); b.add(entry.getKey().toString(), MongoDBUtils.populateValue(entry.getValue(), entry.getValue().getClass())); } dbObj.put(((AbstractAttribute) column).getJPAColumnName(), b.get()); break; case SET: case LIST: Collection collection = (Collection) valueObject; BasicDBList basicDBList = new BasicDBList(); for (Object o : collection) { basicDBList.add(o); } dbObj.put(((AbstractAttribute) column).getJPAColumnName(), basicDBList); break; case POINT: Point p = (Point) valueObject; double[] coordinate = new double[] { p.getX(), p.getY() }; dbObj.put(((AbstractAttribute) column).getJPAColumnName(), coordinate); break; case ENUM: case PRIMITIVE: dbObj.put(((AbstractAttribute) column).getJPAColumnName(), MongoDBUtils.populateValue(valueObject, javaType)); break; } } } catch (PropertyAccessException paex) { log.error("Error while getting column {} value, caused by : .", ((AbstractAttribute) column).getJPAColumnName(), paex); throw new PersistenceException(paex); } }
[ "static", "void", "extractFieldValue", "(", "Object", "entity", ",", "DBObject", "dbObj", ",", "Attribute", "column", ")", "throws", "PropertyAccessException", "{", "try", "{", "Object", "valueObject", "=", "PropertyAccessorHelper", ".", "getObject", "(", "entity", ...
Extract entity field. @param entity the entity @param dbObj the db obj @param column the column @throws PropertyAccessException the property access exception
[ "Extract", "entity", "field", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/DocumentObjectMapper.java#L278-L333
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.decompileScript
public final String decompileScript(Script script, int indent) { NativeFunction scriptImpl = (NativeFunction) script; return scriptImpl.decompile(indent, 0); }
java
public final String decompileScript(Script script, int indent) { NativeFunction scriptImpl = (NativeFunction) script; return scriptImpl.decompile(indent, 0); }
[ "public", "final", "String", "decompileScript", "(", "Script", "script", ",", "int", "indent", ")", "{", "NativeFunction", "scriptImpl", "=", "(", "NativeFunction", ")", "script", ";", "return", "scriptImpl", ".", "decompile", "(", "indent", ",", "0", ")", "...
Decompile the script. <p> The canonical source of the script is returned. @param script the script to decompile @param indent the number of spaces to indent the result @return a string representing the script source
[ "Decompile", "the", "script", ".", "<p", ">", "The", "canonical", "source", "of", "the", "script", "is", "returned", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1580-L1584
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VersionInfo.java
VersionInfo.getVersionString
@Deprecated public String getVersionString(int minDigits, int maxDigits) { if (minDigits < 1 || maxDigits < 1 || minDigits > 4 || maxDigits > 4 || minDigits > maxDigits) { throw new IllegalArgumentException("Invalid min/maxDigits range"); } int[] digits = new int[4]; digits[0] = getMajor(); digits[1] = getMinor(); digits[2] = getMilli(); digits[3] = getMicro(); int numDigits = maxDigits; while (numDigits > minDigits) { if (digits[numDigits - 1] != 0) { break; } numDigits--; } StringBuilder verStr = new StringBuilder(7); verStr.append(digits[0]); for (int i = 1; i < numDigits; i++) { verStr.append("."); verStr.append(digits[i]); } return verStr.toString(); }
java
@Deprecated public String getVersionString(int minDigits, int maxDigits) { if (minDigits < 1 || maxDigits < 1 || minDigits > 4 || maxDigits > 4 || minDigits > maxDigits) { throw new IllegalArgumentException("Invalid min/maxDigits range"); } int[] digits = new int[4]; digits[0] = getMajor(); digits[1] = getMinor(); digits[2] = getMilli(); digits[3] = getMicro(); int numDigits = maxDigits; while (numDigits > minDigits) { if (digits[numDigits - 1] != 0) { break; } numDigits--; } StringBuilder verStr = new StringBuilder(7); verStr.append(digits[0]); for (int i = 1; i < numDigits; i++) { verStr.append("."); verStr.append(digits[i]); } return verStr.toString(); }
[ "@", "Deprecated", "public", "String", "getVersionString", "(", "int", "minDigits", ",", "int", "maxDigits", ")", "{", "if", "(", "minDigits", "<", "1", "||", "maxDigits", "<", "1", "||", "minDigits", ">", "4", "||", "maxDigits", ">", "4", "||", "minDigi...
Generate version string separated by dots with the specified digit width. Version digit 0 after <code>minDigits</code> will be trimmed off. @param minDigits Minimum number of version digits @param maxDigits Maximum number of version digits @return A tailored version string @deprecated This API is ICU internal only. (For use in CLDR, etc.) @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Generate", "version", "string", "separated", "by", "dots", "with", "the", "specified", "digit", "width", ".", "Version", "digit", "0", "after", "<code", ">", "minDigits<", "/", "code", ">", "will", "be", "trimmed", "off", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VersionInfo.java#L608-L637
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java
GVRPeriodicEngine.runEvery
public PeriodicEvent runEvery(Runnable task, float delay, float period) { return runEvery(task, delay, period, null); }
java
public PeriodicEvent runEvery(Runnable task, float delay, float period) { return runEvery(task, delay, period, null); }
[ "public", "PeriodicEvent", "runEvery", "(", "Runnable", "task", ",", "float", "delay", ",", "float", "period", ")", "{", "return", "runEvery", "(", "task", ",", "delay", ",", "period", ",", "null", ")", ";", "}" ]
Run a task periodically and indefinitely. @param task Task to run. @param delay The first execution will happen in {@code delay} seconds. @param period Subsequent executions will happen every {@code period} seconds after the first. @return An interface that lets you query the status; cancel; or reschedule the event.
[ "Run", "a", "task", "periodically", "and", "indefinitely", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/periodic/GVRPeriodicEngine.java#L138-L140
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.scalarSet
public SDVariable scalarSet(SDVariable in, Number set) { return scalarSet(null, in, set); }
java
public SDVariable scalarSet(SDVariable in, Number set) { return scalarSet(null, in, set); }
[ "public", "SDVariable", "scalarSet", "(", "SDVariable", "in", ",", "Number", "set", ")", "{", "return", "scalarSet", "(", "null", ",", "in", ",", "set", ")", ";", "}" ]
Return an array with equal shape to the input, but all elements set to value 'set' @param in Input variable @param set Value to set @return Output variable
[ "Return", "an", "array", "with", "equal", "shape", "to", "the", "input", "but", "all", "elements", "set", "to", "value", "set" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1993-L1995
sporniket/p3
src/main/java/com/sporniket/libre/p3/builtins/WrappedObjectMapperProcessor.java
WrappedObjectMapperProcessor.findSetterTarget
private SetterTarget findSetterTarget(String path) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { String[] _accessStack = path.split(REGEXP__CHAR_DOT); if (0 == _accessStack.length) { throw new IllegalArgumentException(path); } int _setterIndex = _accessStack.length - 1; Object _toChange = getObject(); for (int _index = 0; _index < _setterIndex; _index++) { String _getterName = computeGetterName(_accessStack[_index]); Method _getter = _toChange.getClass().getMethod(_getterName, (Class<?>[]) null); _toChange = _getter.invoke(_toChange, (Object[]) null); } String _setterName = computeSetterName(_accessStack[_setterIndex]); SetterTarget _target = new SetterTarget(_toChange, _setterName); return _target; }
java
private SetterTarget findSetterTarget(String path) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { String[] _accessStack = path.split(REGEXP__CHAR_DOT); if (0 == _accessStack.length) { throw new IllegalArgumentException(path); } int _setterIndex = _accessStack.length - 1; Object _toChange = getObject(); for (int _index = 0; _index < _setterIndex; _index++) { String _getterName = computeGetterName(_accessStack[_index]); Method _getter = _toChange.getClass().getMethod(_getterName, (Class<?>[]) null); _toChange = _getter.invoke(_toChange, (Object[]) null); } String _setterName = computeSetterName(_accessStack[_setterIndex]); SetterTarget _target = new SetterTarget(_toChange, _setterName); return _target; }
[ "private", "SetterTarget", "findSetterTarget", "(", "String", "path", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "String", "[", "]", "_accessStack", "=", "path", ".", "split", "(", "REGEXP__CHAR_DOT", ...
Find the object to change and the setter method name. @param path the path to the object and setter. @return a {@link SetterTarget} storing the object to change and the setter name. @throws NoSuchMethodException when a getter does not exists. @throws IllegalAccessException when there is a problem. @throws InvocationTargetException when there is a problem.
[ "Find", "the", "object", "to", "change", "and", "the", "setter", "method", "name", "." ]
train
https://github.com/sporniket/p3/blob/fc20b3066dc4a9cd759090adae0a6b02508df135/src/main/java/com/sporniket/libre/p3/builtins/WrappedObjectMapperProcessor.java#L208-L227
structr/structr
structr-core/src/main/java/org/structr/common/ValidationHelper.java
ValidationHelper.isValidPropertyNotNull
public static boolean isValidPropertyNotNull(final GraphObject node, final PropertyKey key, final ErrorBuffer errorBuffer) { final String type = node.getType(); if (key == null) { errorBuffer.add(new EmptyPropertyToken(type, UnknownType)); return false; } final Object value = node.getProperty(key); if (value != null) { if (value instanceof Iterable) { if (((Iterable) value).iterator().hasNext()) { return true; } } else { return true; } } errorBuffer.add(new EmptyPropertyToken(type, key)); return false; }
java
public static boolean isValidPropertyNotNull(final GraphObject node, final PropertyKey key, final ErrorBuffer errorBuffer) { final String type = node.getType(); if (key == null) { errorBuffer.add(new EmptyPropertyToken(type, UnknownType)); return false; } final Object value = node.getProperty(key); if (value != null) { if (value instanceof Iterable) { if (((Iterable) value).iterator().hasNext()) { return true; } } else { return true; } } errorBuffer.add(new EmptyPropertyToken(type, key)); return false; }
[ "public", "static", "boolean", "isValidPropertyNotNull", "(", "final", "GraphObject", "node", ",", "final", "PropertyKey", "key", ",", "final", "ErrorBuffer", "errorBuffer", ")", "{", "final", "String", "type", "=", "node", ".", "getType", "(", ")", ";", "if",...
Checks whether the value for the given property key of the given node is a non-empty string. @param node the node @param key the property key @param errorBuffer the error buffer @return true if the condition is valid
[ "Checks", "whether", "the", "value", "for", "the", "given", "property", "key", "of", "the", "given", "node", "is", "a", "non", "-", "empty", "string", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/ValidationHelper.java#L124-L153
threerings/nenya
core/src/main/java/com/threerings/media/util/BobblePath.java
BobblePath.updatePositionTo
protected boolean updatePositionTo (Pathable pable, int x, int y) { if ((pable.getX() == x) && (pable.getY() == y)) { return false; } else { pable.setLocation(x, y); return true; } }
java
protected boolean updatePositionTo (Pathable pable, int x, int y) { if ((pable.getX() == x) && (pable.getY() == y)) { return false; } else { pable.setLocation(x, y); return true; } }
[ "protected", "boolean", "updatePositionTo", "(", "Pathable", "pable", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "(", "pable", ".", "getX", "(", ")", "==", "x", ")", "&&", "(", "pable", ".", "getY", "(", ")", "==", "y", ")", ")", "{...
Update the position of the pathable or return false if it's already there.
[ "Update", "the", "position", "of", "the", "pathable", "or", "return", "false", "if", "it", "s", "already", "there", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/BobblePath.java#L156-L164
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarOutputStream.java
JarOutputStream.set16
private static void set16(byte[] b, int off, int value) { b[off+0] = (byte)value; b[off+1] = (byte)(value >> 8); }
java
private static void set16(byte[] b, int off, int value) { b[off+0] = (byte)value; b[off+1] = (byte)(value >> 8); }
[ "private", "static", "void", "set16", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "value", ")", "{", "b", "[", "off", "+", "0", "]", "=", "(", "byte", ")", "value", ";", "b", "[", "off", "+", "1", "]", "=", "(", "byte", ")", ...
/* Sets 16-bit value at specified offset. The bytes are assumed to be in Intel (little-endian) byte order.
[ "/", "*", "Sets", "16", "-", "bit", "value", "at", "specified", "offset", ".", "The", "bytes", "are", "assumed", "to", "be", "in", "Intel", "(", "little", "-", "endian", ")", "byte", "order", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarOutputStream.java#L145-L148
ocpsoft/common
api/src/main/java/org/ocpsoft/common/util/Strings.java
Strings.areEqualTrimmed
public static boolean areEqualTrimmed(final String left, final String right) { if ((left != null) && (right != null)) { return left.trim().equals(right.trim()); } return areEqual(left, right); }
java
public static boolean areEqualTrimmed(final String left, final String right) { if ((left != null) && (right != null)) { return left.trim().equals(right.trim()); } return areEqual(left, right); }
[ "public", "static", "boolean", "areEqualTrimmed", "(", "final", "String", "left", ",", "final", "String", "right", ")", "{", "if", "(", "(", "left", "!=", "null", ")", "&&", "(", "right", "!=", "null", ")", ")", "{", "return", "left", ".", "trim", "(...
Return true if the given {@link String} instances are equal when outer whitespace is removed, or if both {@link String} instances are null. (E.g.: " hello world " is equal to "hello world ")
[ "Return", "true", "if", "the", "given", "{" ]
train
https://github.com/ocpsoft/common/blob/ae926dfd6f9af278786520faee7ee3c2f1f52ca1/api/src/main/java/org/ocpsoft/common/util/Strings.java#L51-L58
walkmod/walkmod-core
src/main/java/org/walkmod/OptionsBuilder.java
OptionsBuilder.dynamicArgs
public OptionsBuilder dynamicArgs(Map<String, ?> dynamicArgs){ final Map<String, Object> m = dynamicArgs != null ? Collections.unmodifiableMap(new HashMap<String, Object>(dynamicArgs)) : Collections.<String, Object>emptyMap(); options.put(Options.DYNAMIC_ARGS, m); return this; }
java
public OptionsBuilder dynamicArgs(Map<String, ?> dynamicArgs){ final Map<String, Object> m = dynamicArgs != null ? Collections.unmodifiableMap(new HashMap<String, Object>(dynamicArgs)) : Collections.<String, Object>emptyMap(); options.put(Options.DYNAMIC_ARGS, m); return this; }
[ "public", "OptionsBuilder", "dynamicArgs", "(", "Map", "<", "String", ",", "?", ">", "dynamicArgs", ")", "{", "final", "Map", "<", "String", ",", "Object", ">", "m", "=", "dynamicArgs", "!=", "null", "?", "Collections", ".", "unmodifiableMap", "(", "new", ...
Seths the dynamic arguments @param dynamicArgs Map of dynamic arguments @return Options#DYNAMIC_ARGS
[ "Seths", "the", "dynamic", "arguments" ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/OptionsBuilder.java#L273-L279
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpURLConnection.java
HttpURLConnection.getPermission
public Permission getPermission() throws IOException { int port = url.getPort(); port = port < 0 ? 80 : port; String host = url.getHost() + ":" + port; Permission permission = new SocketPermission(host, "connect"); return permission; }
java
public Permission getPermission() throws IOException { int port = url.getPort(); port = port < 0 ? 80 : port; String host = url.getHost() + ":" + port; Permission permission = new SocketPermission(host, "connect"); return permission; }
[ "public", "Permission", "getPermission", "(", ")", "throws", "IOException", "{", "int", "port", "=", "url", ".", "getPort", "(", ")", ";", "port", "=", "port", "<", "0", "?", "80", ":", "port", ";", "String", "host", "=", "url", ".", "getHost", "(", ...
Returns a {@link SocketPermission} object representing the permission necessary to connect to the destination host and port. @exception IOException if an error occurs while computing the permission. @return a {@code SocketPermission} object representing the permission necessary to connect to the destination host and port.
[ "Returns", "a", "{", "@link", "SocketPermission", "}", "object", "representing", "the", "permission", "necessary", "to", "connect", "to", "the", "destination", "host", "and", "port", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpURLConnection.java#L796-L802
mangstadt/biweekly
src/main/java/biweekly/io/xml/XCalElement.java
XCalElement.firstValue
public XCalValue firstValue() { for (Element child : children()) { String childNamespace = child.getNamespaceURI(); if (XCAL_NS.equals(childNamespace)) { ICalDataType dataType = toDataType(child.getLocalName()); String value = child.getTextContent(); return new XCalValue(dataType, value); } } return new XCalValue(null, element.getTextContent()); }
java
public XCalValue firstValue() { for (Element child : children()) { String childNamespace = child.getNamespaceURI(); if (XCAL_NS.equals(childNamespace)) { ICalDataType dataType = toDataType(child.getLocalName()); String value = child.getTextContent(); return new XCalValue(dataType, value); } } return new XCalValue(null, element.getTextContent()); }
[ "public", "XCalValue", "firstValue", "(", ")", "{", "for", "(", "Element", "child", ":", "children", "(", ")", ")", "{", "String", "childNamespace", "=", "child", ".", "getNamespaceURI", "(", ")", ";", "if", "(", "XCAL_NS", ".", "equals", "(", "childName...
Finds the first child element that has the xCard namespace and returns its data type and value. If no such element is found, the parent {@link XCalElement}'s text content, along with a null data type, is returned. @return the value and data type
[ "Finds", "the", "first", "child", "element", "that", "has", "the", "xCard", "namespace", "and", "returns", "its", "data", "type", "and", "value", ".", "If", "no", "such", "element", "is", "found", "the", "parent", "{" ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/xml/XCalElement.java#L227-L238
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectComplementOfImpl_CustomFieldSerializer.java
OWLObjectComplementOfImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectComplementOfImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectComplementOfImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectComplementOfImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectComplementOfImpl_CustomFieldSerializer.java#L89-L92
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/DefaultParser.java
DefaultParser.handleLongOptionWithoutEqual
private void handleLongOptionWithoutEqual(String token) throws ParseException { List<String> matchingOpts = options.getMatchingOptions(token); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1) { throw new AmbiguousOptionException(token, matchingOpts); } else { handleOption(options.getOption(matchingOpts.get(0))); } }
java
private void handleLongOptionWithoutEqual(String token) throws ParseException { List<String> matchingOpts = options.getMatchingOptions(token); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1) { throw new AmbiguousOptionException(token, matchingOpts); } else { handleOption(options.getOption(matchingOpts.get(0))); } }
[ "private", "void", "handleLongOptionWithoutEqual", "(", "String", "token", ")", "throws", "ParseException", "{", "List", "<", "String", ">", "matchingOpts", "=", "options", ".", "getMatchingOptions", "(", "token", ")", ";", "if", "(", "matchingOpts", ".", "isEmp...
Handles the following tokens: --L -L --l -l @param token the command line token to handle
[ "Handles", "the", "following", "tokens", ":" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/DefaultParser.java#L389-L404
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java
ChatRoomClient.updateUserSpeakStatus
public ResponseWrapper updateUserSpeakStatus(long roomId, String username, int flag) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(roomId > 0, "room id is invalid"); StringUtils.checkUsername(username); Preconditions.checkArgument(flag == 0 || flag == 1, "flag should be 0 or 1"); return _httpClient.sendPut(_baseUrl + mChatRoomPath + "/" + roomId + "/forbidden/" + username + "?status=" + flag, null); }
java
public ResponseWrapper updateUserSpeakStatus(long roomId, String username, int flag) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(roomId > 0, "room id is invalid"); StringUtils.checkUsername(username); Preconditions.checkArgument(flag == 0 || flag == 1, "flag should be 0 or 1"); return _httpClient.sendPut(_baseUrl + mChatRoomPath + "/" + roomId + "/forbidden/" + username + "?status=" + flag, null); }
[ "public", "ResponseWrapper", "updateUserSpeakStatus", "(", "long", "roomId", ",", "String", "username", ",", "int", "flag", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "Preconditions", ".", "checkArgument", "(", "roomId", ">", "0", ",",...
Update user speak status @param roomId chat room id @param username user to be modified @param flag 0 means allow to speak, 1 means forbid to speak in chat room @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Update", "user", "speak", "status" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java#L154-L160
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.addCustomDeviceData
public static void addCustomDeviceData(final String key, final String value) { dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { conversation.getDevice().getCustomData().put(key, trim(value)); return true; } }, "add custom device data"); }
java
public static void addCustomDeviceData(final String key, final String value) { dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { conversation.getDevice().getCustomData().put(key, trim(value)); return true; } }, "add custom device data"); }
[ "public", "static", "void", "addCustomDeviceData", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "dispatchConversationTask", "(", "new", "ConversationDispatchTask", "(", ")", "{", "@", "Override", "protected", "boolean", "execute", "(",...
Add a custom data String to the Device. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent. @param key The key to store the data under. @param value A String value.
[ "Add", "a", "custom", "data", "String", "to", "the", "Device", ".", "Custom", "data", "will", "be", "sent", "to", "the", "server", "is", "displayed", "in", "the", "Conversation", "view", "and", "can", "be", "used", "in", "Interaction", "targeting", ".", ...
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L234-L242
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/json/JSONDeserializer.java
JSONDeserializer.deserializeObject
public static <T> T deserializeObject(final Class<T> expectedType, final String json) throws IllegalArgumentException { final ClassFieldCache classFieldCache = new ClassFieldCache(/* resolveTypes = */ true, /* onlySerializePublicFields = */ false); return deserializeObject(expectedType, json, classFieldCache); }
java
public static <T> T deserializeObject(final Class<T> expectedType, final String json) throws IllegalArgumentException { final ClassFieldCache classFieldCache = new ClassFieldCache(/* resolveTypes = */ true, /* onlySerializePublicFields = */ false); return deserializeObject(expectedType, json, classFieldCache); }
[ "public", "static", "<", "T", ">", "T", "deserializeObject", "(", "final", "Class", "<", "T", ">", "expectedType", ",", "final", "String", "json", ")", "throws", "IllegalArgumentException", "{", "final", "ClassFieldCache", "classFieldCache", "=", "new", "ClassFi...
Deserialize JSON to a new object graph, with the root object of the specified expected type. Does not work for generic types, since it is not possible to obtain the generic type of a Class reference. @param <T> The type that the JSON should conform to. @param expectedType The class reference for the type that the JSON should conform to. @param json the JSON string to deserialize. @return The object graph after deserialization. @throws IllegalArgumentException If anything goes wrong during deserialization.
[ "Deserialize", "JSON", "to", "a", "new", "object", "graph", "with", "the", "root", "object", "of", "the", "specified", "expected", "type", ".", "Does", "not", "work", "for", "generic", "types", "since", "it", "is", "not", "possible", "to", "obtain", "the",...
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/json/JSONDeserializer.java#L688-L693
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/AbstractXmlReader.java
AbstractXmlReader.isEndTagEvent
protected boolean isEndTagEvent(XMLEvent event, QName tagName) { return event.isEndElement() && event.asEndElement().getName().equals(tagName); }
java
protected boolean isEndTagEvent(XMLEvent event, QName tagName) { return event.isEndElement() && event.asEndElement().getName().equals(tagName); }
[ "protected", "boolean", "isEndTagEvent", "(", "XMLEvent", "event", ",", "QName", "tagName", ")", "{", "return", "event", ".", "isEndElement", "(", ")", "&&", "event", ".", "asEndElement", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "tagName", ...
Test an event to see whether it is an end tag with the expected name.
[ "Test", "an", "event", "to", "see", "whether", "it", "is", "an", "end", "tag", "with", "the", "expected", "name", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/AbstractXmlReader.java#L64-L67
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java
AttributeConstraintRule.validateMinDecimal
private boolean validateMinDecimal(Object validationObject, Annotation annotate) { if (validationObject != null) { try { if (checkvalidDeciDigitTypes(validationObject.getClass())) { BigDecimal minValue = NumberUtils.createBigDecimal(((DecimalMin) annotate).value()); BigDecimal actualValue = NumberUtils.createBigDecimal(toString(validationObject)); int res = actualValue.compareTo(minValue); if (res < 0) { throwValidationException(((DecimalMin) annotate).message()); } } } catch (NumberFormatException nfe) { throw new RuleValidationException(nfe.getMessage()); } } return true; }
java
private boolean validateMinDecimal(Object validationObject, Annotation annotate) { if (validationObject != null) { try { if (checkvalidDeciDigitTypes(validationObject.getClass())) { BigDecimal minValue = NumberUtils.createBigDecimal(((DecimalMin) annotate).value()); BigDecimal actualValue = NumberUtils.createBigDecimal(toString(validationObject)); int res = actualValue.compareTo(minValue); if (res < 0) { throwValidationException(((DecimalMin) annotate).message()); } } } catch (NumberFormatException nfe) { throw new RuleValidationException(nfe.getMessage()); } } return true; }
[ "private", "boolean", "validateMinDecimal", "(", "Object", "validationObject", ",", "Annotation", "annotate", ")", "{", "if", "(", "validationObject", "!=", "null", ")", "{", "try", "{", "if", "(", "checkvalidDeciDigitTypes", "(", "validationObject", ".", "getClas...
Checks whether a given value is a valid minimum decimal digit when compared to given value or not @param validationObject @param annotate @return
[ "Checks", "whether", "a", "given", "value", "is", "a", "valid", "minimum", "decimal", "digit", "when", "compared", "to", "given", "value", "or", "not" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java#L483-L510
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java
CharsetHelper.getCharsetFromName
@Nonnull public static Charset getCharsetFromName (@Nonnull @Nonempty final String sCharsetName) { ValueEnforcer.notNull (sCharsetName, "CharsetName"); try { return Charset.forName (sCharsetName); } catch (final IllegalCharsetNameException ex) { // Not supported in any version throw new IllegalArgumentException ("Charset '" + sCharsetName + "' unsupported in Java", ex); } catch (final UnsupportedCharsetException ex) { // Unsupported on this platform throw new IllegalArgumentException ("Charset '" + sCharsetName + "' unsupported on this platform", ex); } }
java
@Nonnull public static Charset getCharsetFromName (@Nonnull @Nonempty final String sCharsetName) { ValueEnforcer.notNull (sCharsetName, "CharsetName"); try { return Charset.forName (sCharsetName); } catch (final IllegalCharsetNameException ex) { // Not supported in any version throw new IllegalArgumentException ("Charset '" + sCharsetName + "' unsupported in Java", ex); } catch (final UnsupportedCharsetException ex) { // Unsupported on this platform throw new IllegalArgumentException ("Charset '" + sCharsetName + "' unsupported on this platform", ex); } }
[ "@", "Nonnull", "public", "static", "Charset", "getCharsetFromName", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sCharsetName", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sCharsetName", ",", "\"CharsetName\"", ")", ";", "try", "{", "return", ...
Resolve the charset by the specified name. The difference to {@link Charset#forName(String)} is, that this method has no checked exceptions but only unchecked exceptions. @param sCharsetName The charset to be resolved. May neither be <code>null</code> nor empty. @return The Charset object @throws IllegalArgumentException If the charset could not be resolved.
[ "Resolve", "the", "charset", "by", "the", "specified", "name", ".", "The", "difference", "to", "{", "@link", "Charset#forName", "(", "String", ")", "}", "is", "that", "this", "method", "has", "no", "checked", "exceptions", "but", "only", "unchecked", "except...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java#L87-L105
facebookarchive/hadoop-20
src/tools/org/apache/hadoop/tools/DistCp.java
DistCp.makeRelative
static String makeRelative(Path root, Path absPath) { if (!absPath.isAbsolute()) { throw new IllegalArgumentException("!absPath.isAbsolute(), absPath=" + absPath); } String p = absPath.toUri().getPath(); StringTokenizer pathTokens = new StringTokenizer(p, "/"); for(StringTokenizer rootTokens = new StringTokenizer( root.toUri().getPath(), "/"); rootTokens.hasMoreTokens(); ) { if (!rootTokens.nextToken().equals(pathTokens.nextToken())) { return null; } } StringBuilder sb = new StringBuilder(); for(; pathTokens.hasMoreTokens(); ) { sb.append(pathTokens.nextToken()); if (pathTokens.hasMoreTokens()) { sb.append(Path.SEPARATOR); } } return sb.length() == 0? ".": sb.toString(); }
java
static String makeRelative(Path root, Path absPath) { if (!absPath.isAbsolute()) { throw new IllegalArgumentException("!absPath.isAbsolute(), absPath=" + absPath); } String p = absPath.toUri().getPath(); StringTokenizer pathTokens = new StringTokenizer(p, "/"); for(StringTokenizer rootTokens = new StringTokenizer( root.toUri().getPath(), "/"); rootTokens.hasMoreTokens(); ) { if (!rootTokens.nextToken().equals(pathTokens.nextToken())) { return null; } } StringBuilder sb = new StringBuilder(); for(; pathTokens.hasMoreTokens(); ) { sb.append(pathTokens.nextToken()); if (pathTokens.hasMoreTokens()) { sb.append(Path.SEPARATOR); } } return sb.length() == 0? ".": sb.toString(); }
[ "static", "String", "makeRelative", "(", "Path", "root", ",", "Path", "absPath", ")", "{", "if", "(", "!", "absPath", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"!absPath.isAbsolute(), absPath=\"", "+", "absPath", ...
Make a path relative with respect to a root path. absPath is always assumed to descend from root. Otherwise returned path is null.
[ "Make", "a", "path", "relative", "with", "respect", "to", "a", "root", "path", ".", "absPath", "is", "always", "assumed", "to", "descend", "from", "root", ".", "Otherwise", "returned", "path", "is", "null", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/DistCp.java#L2083-L2103
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.loadPublicJSONFile
public static JSONObject loadPublicJSONFile(final String publicDirectory, final String file) { final File dir = Environment.getExternalStoragePublicDirectory(publicDirectory); return loadJSONFile(dir, file); }
java
public static JSONObject loadPublicJSONFile(final String publicDirectory, final String file) { final File dir = Environment.getExternalStoragePublicDirectory(publicDirectory); return loadJSONFile(dir, file); }
[ "public", "static", "JSONObject", "loadPublicJSONFile", "(", "final", "String", "publicDirectory", ",", "final", "String", "file", ")", "{", "final", "File", "dir", "=", "Environment", ".", "getExternalStoragePublicDirectory", "(", "publicDirectory", ")", ";", "retu...
Load a JSON file from one of the public directories defined by {@link Environment}. @param publicDirectory One of the {@code DIRECTORY_*} constants defined by {@code Environment}. @param file Relative path to file in the public directory. @return New instance of {@link JSONObject}
[ "Load", "a", "JSON", "file", "from", "one", "of", "the", "public", "directories", "defined", "by", "{", "@link", "Environment", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1152-L1155
liferay/com-liferay-commerce
commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUsageEntryPersistenceImpl.java
CommerceDiscountUsageEntryPersistenceImpl.findByGroupId
@Override public List<CommerceDiscountUsageEntry> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceDiscountUsageEntry> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceDiscountUsageEntry", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";"...
Returns a range of all the commerce discount usage entries 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 CommerceDiscountUsageEntryModelImpl}. 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 commerce discount usage entries @param end the upper bound of the range of commerce discount usage entries (not inclusive) @return the range of matching commerce discount usage entries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "discount", "usage", "entries", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUsageEntryPersistenceImpl.java#L141-L145
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ChangeTitleOnChangeHandler.java
ChangeTitleOnChangeHandler.syncClonedListener
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) ((ChangeTitleOnChangeHandler)listener).init(null, m_bSetTitleToThisString); return super.syncClonedListener(field, listener, true); }
java
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) ((ChangeTitleOnChangeHandler)listener).init(null, m_bSetTitleToThisString); return super.syncClonedListener(field, listener, true); }
[ "public", "boolean", "syncClonedListener", "(", "BaseField", "field", ",", "FieldListener", "listener", ",", "boolean", "bInitCalled", ")", "{", "if", "(", "!", "bInitCalled", ")", "(", "(", "ChangeTitleOnChangeHandler", ")", "listener", ")", ".", "init", "(", ...
Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init.
[ "Set", "this", "cloned", "listener", "to", "the", "same", "state", "at", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeTitleOnChangeHandler.java#L98-L103
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/RGroupQuery.java
RGroupQuery.findDistributions
private void findDistributions(int occur, Integer[] candidate, List<Integer[]> distributions, int level) { if (level != candidate.length) { for (int i = 0; i < 2; i++) { candidate[level] = i; int sum = 0; for (int x = 0; x < candidate.length; x++) sum += candidate[x]; if (sum == occur) { distributions.add(candidate.clone()); } else { findDistributions(occur, candidate, distributions, level + 1); } } } }
java
private void findDistributions(int occur, Integer[] candidate, List<Integer[]> distributions, int level) { if (level != candidate.length) { for (int i = 0; i < 2; i++) { candidate[level] = i; int sum = 0; for (int x = 0; x < candidate.length; x++) sum += candidate[x]; if (sum == occur) { distributions.add(candidate.clone()); } else { findDistributions(occur, candidate, distributions, level + 1); } } } }
[ "private", "void", "findDistributions", "(", "int", "occur", ",", "Integer", "[", "]", "candidate", ",", "List", "<", "Integer", "[", "]", ">", "distributions", ",", "int", "level", ")", "{", "if", "(", "level", "!=", "candidate", ".", "length", ")", "...
Finds valid distributions for a given R# group and it occurrence condition taken from the LOG line.<br> For example: if we have three Rn group atoms, and ">2" for the occurrence, then there are fours possible ways to make a distribution: 3 ways to put in two atoms, and one way to put in all 3 atoms. Etc. @param occur @param candidate @param distributions @param level
[ "Finds", "valid", "distributions", "for", "a", "given", "R#", "group", "and", "it", "occurrence", "condition", "taken", "from", "the", "LOG", "line", ".", "<br", ">", "For", "example", ":", "if", "we", "have", "three", "Rn", "group", "atoms", "and", ">",...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/RGroupQuery.java#L428-L444