repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
twilio/twilio-java
src/main/java/com/twilio/rest/fax/v1/fax/FaxMediaReader.java
FaxMediaReader.nextPage
@Override public Page<FaxMedia> nextPage(final Page<FaxMedia> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.FAX.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<FaxMedia> nextPage(final Page<FaxMedia> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.FAX.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "FaxMedia", ">", "nextPage", "(", "final", "Page", "<", "FaxMedia", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", ...
Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page
[ "Retrieve", "the", "next", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/fax/v1/fax/FaxMediaReader.java#L94-L105
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1Instance.java
V1Instance.executeOperation
<T extends Entity> T executeOperation(Class<T> clazz, Entity subject, String operationName) throws UnsupportedOperationException { Oid operationResult = executeOperation(subject, operationName); AssetID id = new AssetID(operationResult.getToken()); return createWrapper(clazz, id, false); }
java
<T extends Entity> T executeOperation(Class<T> clazz, Entity subject, String operationName) throws UnsupportedOperationException { Oid operationResult = executeOperation(subject, operationName); AssetID id = new AssetID(operationResult.getToken()); return createWrapper(clazz, id, false); }
[ "<", "T", "extends", "Entity", ">", "T", "executeOperation", "(", "Class", "<", "T", ">", "clazz", ",", "Entity", "subject", ",", "String", "operationName", ")", "throws", "UnsupportedOperationException", "{", "Oid", "operationResult", "=", "executeOperation", "...
Executes an Operation on an Entity, assuming it is safe to do so. @param clazz Class of expected Entity to return. @param subject asset will be found for. @param operationName operator name. @return object identifier. @throws UnsupportedOperationException in case invalid state for the Operation.
[ "Executes", "an", "Operation", "on", "an", "Entity", "assuming", "it", "is", "safe", "to", "do", "so", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1Instance.java#L486-L492
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
OmemoService.buildFreshSessionWithDevice
void buildFreshSessionWithDevice(XMPPConnection connection, OmemoDevice userDevice, OmemoDevice contactsDevice) throws CannotEstablishOmemoSessionException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, CorruptedOmemoKeyException { if (contactsDevice.equals(userDevice)) { // Do not build a session with yourself. return; } OmemoBundleElement bundleElement; try { bundleElement = fetchBundle(connection, contactsDevice); } catch (XMPPException.XMPPErrorException | PubSubException.NotALeafNodeException | PubSubException.NotAPubSubNodeException e) { throw new CannotEstablishOmemoSessionException(contactsDevice, e); } // Select random Bundle HashMap<Integer, T_Bundle> bundlesList = getOmemoStoreBackend().keyUtil().BUNDLE.bundles(bundleElement, contactsDevice); int randomIndex = new Random().nextInt(bundlesList.size()); T_Bundle randomPreKeyBundle = new ArrayList<>(bundlesList.values()).get(randomIndex); // build the session OmemoManager omemoManager = OmemoManager.getInstanceFor(connection, userDevice.getDeviceId()); processBundle(omemoManager, randomPreKeyBundle, contactsDevice); }
java
void buildFreshSessionWithDevice(XMPPConnection connection, OmemoDevice userDevice, OmemoDevice contactsDevice) throws CannotEstablishOmemoSessionException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, CorruptedOmemoKeyException { if (contactsDevice.equals(userDevice)) { // Do not build a session with yourself. return; } OmemoBundleElement bundleElement; try { bundleElement = fetchBundle(connection, contactsDevice); } catch (XMPPException.XMPPErrorException | PubSubException.NotALeafNodeException | PubSubException.NotAPubSubNodeException e) { throw new CannotEstablishOmemoSessionException(contactsDevice, e); } // Select random Bundle HashMap<Integer, T_Bundle> bundlesList = getOmemoStoreBackend().keyUtil().BUNDLE.bundles(bundleElement, contactsDevice); int randomIndex = new Random().nextInt(bundlesList.size()); T_Bundle randomPreKeyBundle = new ArrayList<>(bundlesList.values()).get(randomIndex); // build the session OmemoManager omemoManager = OmemoManager.getInstanceFor(connection, userDevice.getDeviceId()); processBundle(omemoManager, randomPreKeyBundle, contactsDevice); }
[ "void", "buildFreshSessionWithDevice", "(", "XMPPConnection", "connection", ",", "OmemoDevice", "userDevice", ",", "OmemoDevice", "contactsDevice", ")", "throws", "CannotEstablishOmemoSessionException", ",", "SmackException", ".", "NotConnectedException", ",", "InterruptedExcep...
Fetch the bundle of a contact and build a fresh OMEMO session with the contacts device. Note that this builds a fresh session, regardless if we have had a session before or not. @param connection authenticated XMPP connection @param userDevice our OmemoDevice @param contactsDevice OmemoDevice of a contact. @throws CannotEstablishOmemoSessionException if we cannot establish a session (because of missing bundle etc.) @throws SmackException.NotConnectedException @throws InterruptedException @throws SmackException.NoResponseException @throws CorruptedOmemoKeyException if our IdentityKeyPair is corrupted.
[ "Fetch", "the", "bundle", "of", "a", "contact", "and", "build", "a", "fresh", "OMEMO", "session", "with", "the", "contacts", "device", ".", "Note", "that", "this", "builds", "a", "fresh", "session", "regardless", "if", "we", "have", "had", "a", "session", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L761-L786
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/SIMPUtils.java
SIMPUtils.getRemoteGetKey
public static String getRemoteGetKey(SIBUuid8 remoteUuid, SIBUuid12 gatheringTargetDestUuid) { String key = null; if (gatheringTargetDestUuid!=null) key = remoteUuid.toString()+gatheringTargetDestUuid.toString(); else key = remoteUuid.toString()+SIMPConstants.DEFAULT_CONSUMER_SET; return key; }
java
public static String getRemoteGetKey(SIBUuid8 remoteUuid, SIBUuid12 gatheringTargetDestUuid) { String key = null; if (gatheringTargetDestUuid!=null) key = remoteUuid.toString()+gatheringTargetDestUuid.toString(); else key = remoteUuid.toString()+SIMPConstants.DEFAULT_CONSUMER_SET; return key; }
[ "public", "static", "String", "getRemoteGetKey", "(", "SIBUuid8", "remoteUuid", ",", "SIBUuid12", "gatheringTargetDestUuid", ")", "{", "String", "key", "=", "null", ";", "if", "(", "gatheringTargetDestUuid", "!=", "null", ")", "key", "=", "remoteUuid", ".", "toS...
The key we use to lookup/insert a streamInfo object is based off the remoteMEuuid + the gatheringTargetDestUuid. This second value is null for standard consumer and set to a destinationUuid (which could be an alias) for gathering consumers. In this way we have seperate streams per consumer type.
[ "The", "key", "we", "use", "to", "lookup", "/", "insert", "a", "streamInfo", "object", "is", "based", "off", "the", "remoteMEuuid", "+", "the", "gatheringTargetDestUuid", ".", "This", "second", "value", "is", "null", "for", "standard", "consumer", "and", "se...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/SIMPUtils.java#L317-L325
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/BackupService.java
BackupService.getConnectorStrings
private ArrayList<String> getConnectorStrings(String name) { ArrayList<String> connectorStrings = new ArrayList<String>(); try { MBeanServer mbeanServer = getServerForName(name); Set<ObjectName> objs = mbeanServer.queryNames(new ObjectName("*:type=Connector,*"), null); String hostname = InetAddress.getLocalHost().getHostName(); InetAddress[] addresses = InetAddress.getAllByName(hostname); for (Iterator<ObjectName> i = objs.iterator(); i.hasNext(); ) { ObjectName obj = i.next(); String scheme = mbeanServer.getAttribute(obj, "scheme").toString(); String port = obj.getKeyProperty("port"); connectorStrings.add(scheme + "://localhost:" + port); logger.info("Adding: {}", scheme + "://localhost:" + port); } } catch (Exception e) { } return connectorStrings; }
java
private ArrayList<String> getConnectorStrings(String name) { ArrayList<String> connectorStrings = new ArrayList<String>(); try { MBeanServer mbeanServer = getServerForName(name); Set<ObjectName> objs = mbeanServer.queryNames(new ObjectName("*:type=Connector,*"), null); String hostname = InetAddress.getLocalHost().getHostName(); InetAddress[] addresses = InetAddress.getAllByName(hostname); for (Iterator<ObjectName> i = objs.iterator(); i.hasNext(); ) { ObjectName obj = i.next(); String scheme = mbeanServer.getAttribute(obj, "scheme").toString(); String port = obj.getKeyProperty("port"); connectorStrings.add(scheme + "://localhost:" + port); logger.info("Adding: {}", scheme + "://localhost:" + port); } } catch (Exception e) { } return connectorStrings; }
[ "private", "ArrayList", "<", "String", ">", "getConnectorStrings", "(", "String", "name", ")", "{", "ArrayList", "<", "String", ">", "connectorStrings", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "try", "{", "MBeanServer", "mbeanServer", "="...
Get a list of strings(scheme + host + port) that the specified connector is running on @param name @return
[ "Get", "a", "list", "of", "strings", "(", "scheme", "+", "host", "+", "port", ")", "that", "the", "specified", "connector", "is", "running", "on" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/BackupService.java#L422-L442
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.selectCheckbox
protected void selectCheckbox(PageElement element, String valueKeyOrKey, Map<String, Boolean> values) throws TechnicalException, FailureException { final String valueKey = Context.getValue(valueKeyOrKey) != null ? Context.getValue(valueKeyOrKey) : valueKeyOrKey; try { final WebElement webElement = Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(element))); Boolean checkboxValue = values.get(valueKey); if (checkboxValue == null) { checkboxValue = values.get("Default"); } if (webElement.isSelected() != checkboxValue.booleanValue()) { webElement.click(); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_CHECK_ELEMENT), element, element.getPage().getApplication()), true, element.getPage().getCallBack()); } }
java
protected void selectCheckbox(PageElement element, String valueKeyOrKey, Map<String, Boolean> values) throws TechnicalException, FailureException { final String valueKey = Context.getValue(valueKeyOrKey) != null ? Context.getValue(valueKeyOrKey) : valueKeyOrKey; try { final WebElement webElement = Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(element))); Boolean checkboxValue = values.get(valueKey); if (checkboxValue == null) { checkboxValue = values.get("Default"); } if (webElement.isSelected() != checkboxValue.booleanValue()) { webElement.click(); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_CHECK_ELEMENT), element, element.getPage().getApplication()), true, element.getPage().getCallBack()); } }
[ "protected", "void", "selectCheckbox", "(", "PageElement", "element", ",", "String", "valueKeyOrKey", ",", "Map", "<", "String", ",", "Boolean", ">", "values", ")", "throws", "TechnicalException", ",", "FailureException", "{", "final", "String", "valueKey", "=", ...
Checks a checkbox type element (value corresponding to key "valueKey"). @param element Target page element @param valueKeyOrKey is valueKey (valueKey or key in context (after a save)) to match in values map @param values Values map @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Failure with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_CHECK_ELEMENT} message (with screenshot) @throws FailureException if the scenario encounters a functional error
[ "Checks", "a", "checkbox", "type", "element", "(", "value", "corresponding", "to", "key", "valueKey", ")", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L739-L754
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/common/GeospatialUtils.java
GeospatialUtils.checkLatitude
public static Double checkLatitude(String name, Double latitude) { if (latitude == null) { throw new IndexException("{} required", name); } else if (latitude < MIN_LATITUDE || latitude > MAX_LATITUDE) { throw new IndexException("{} must be in range [{}, {}], but found {}", name, MIN_LATITUDE, MAX_LATITUDE, latitude); } return latitude; }
java
public static Double checkLatitude(String name, Double latitude) { if (latitude == null) { throw new IndexException("{} required", name); } else if (latitude < MIN_LATITUDE || latitude > MAX_LATITUDE) { throw new IndexException("{} must be in range [{}, {}], but found {}", name, MIN_LATITUDE, MAX_LATITUDE, latitude); } return latitude; }
[ "public", "static", "Double", "checkLatitude", "(", "String", "name", ",", "Double", "latitude", ")", "{", "if", "(", "latitude", "==", "null", ")", "{", "throw", "new", "IndexException", "(", "\"{} required\"", ",", "name", ")", ";", "}", "else", "if", ...
Checks if the specified latitude is correct. @param name the name of the latitude field @param latitude the value of the latitude field @return the latitude
[ "Checks", "if", "the", "specified", "latitude", "is", "correct", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/common/GeospatialUtils.java#L68-L79
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.popupMatches
private double popupMatches(double seconds, String expectedPopupPattern) { double end = System.currentTimeMillis() + (seconds * 1000); while (!app.get().alert().matches(expectedPopupPattern) && System.currentTimeMillis() < end) ; return Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; }
java
private double popupMatches(double seconds, String expectedPopupPattern) { double end = System.currentTimeMillis() + (seconds * 1000); while (!app.get().alert().matches(expectedPopupPattern) && System.currentTimeMillis() < end) ; return Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; }
[ "private", "double", "popupMatches", "(", "double", "seconds", ",", "String", "expectedPopupPattern", ")", "{", "double", "end", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "seconds", "*", "1000", ")", ";", "while", "(", "!", "app", ".", ...
Wait for a popup to have the expected text, and then returns the amount of time that was waited @param seconds - maximum amount of time to wait in seconds @param expectedPopupPattern - the expected pattern to wait for @return double: the total time waited
[ "Wait", "for", "a", "popup", "to", "have", "the", "expected", "text", "and", "then", "returns", "the", "amount", "of", "time", "that", "was", "waited" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L432-L436
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/utils/SerializationUtilities.java
SerializationUtilities.serializeToDisk
public static void serializeToDisk( File file, Object obj ) throws IOException { byte[] serializedObj = serialize(obj); try (RandomAccessFile raFile = new RandomAccessFile(file, "rw")) { raFile.write(serializedObj); } }
java
public static void serializeToDisk( File file, Object obj ) throws IOException { byte[] serializedObj = serialize(obj); try (RandomAccessFile raFile = new RandomAccessFile(file, "rw")) { raFile.write(serializedObj); } }
[ "public", "static", "void", "serializeToDisk", "(", "File", "file", ",", "Object", "obj", ")", "throws", "IOException", "{", "byte", "[", "]", "serializedObj", "=", "serialize", "(", "obj", ")", ";", "try", "(", "RandomAccessFile", "raFile", "=", "new", "R...
Serialize an object to disk. @param file the file to write to. @param obj the object to write. @throws IOException
[ "Serialize", "an", "object", "to", "disk", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/utils/SerializationUtilities.java#L58-L63
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.invoke
@SuppressWarnings("unchecked") public static <T> T invoke(Object obj, Method method, Object... args) throws UtilException { if (false == method.isAccessible()) { method.setAccessible(true); } try { return (T) method.invoke(ClassUtil.isStatic(method) ? null : obj, args); } catch (Exception e) { throw new UtilException(e); } }
java
@SuppressWarnings("unchecked") public static <T> T invoke(Object obj, Method method, Object... args) throws UtilException { if (false == method.isAccessible()) { method.setAccessible(true); } try { return (T) method.invoke(ClassUtil.isStatic(method) ? null : obj, args); } catch (Exception e) { throw new UtilException(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "invoke", "(", "Object", "obj", ",", "Method", "method", ",", "Object", "...", "args", ")", "throws", "UtilException", "{", "if", "(", "false", "==", "method", "....
执行方法 @param <T> 返回对象类型 @param obj 对象,如果执行静态方法,此值为<code>null</code> @param method 方法(对象方法或static方法都可) @param args 参数对象 @return 结果 @throws UtilException 一些列异常的包装
[ "执行方法" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L782-L793
ops4j/org.ops4j.pax.web
pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/internal/ResourceHandlerUtils.java
ResourceHandlerUtils.pipeBytes
public static int pipeBytes(InputStream in, OutputStream out, byte[] buffer) throws IOException { int count = 0; int length; while ((length = (in.read(buffer))) >= 0) { out.write(buffer, 0, length); count += length; } return count; }
java
public static int pipeBytes(InputStream in, OutputStream out, byte[] buffer) throws IOException { int count = 0; int length; while ((length = (in.read(buffer))) >= 0) { out.write(buffer, 0, length); count += length; } return count; }
[ "public", "static", "int", "pipeBytes", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "int", "count", "=", "0", ";", "int", "length", ";", "while", "(", "(", "length", "=", "("...
Reads the specified input stream into the provided byte array storage and writes it to the output stream.
[ "Reads", "the", "specified", "input", "stream", "into", "the", "provided", "byte", "array", "storage", "and", "writes", "it", "to", "the", "output", "stream", "." ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/internal/ResourceHandlerUtils.java#L203-L212
lucee/Lucee
core/src/main/java/lucee/transformer/interpreter/op/OpBool.java
OpBool.toExprBoolean
public static ExprBoolean toExprBoolean(Expression left, Expression right, int operation) { if (left instanceof Literal && right instanceof Literal) { Boolean l = ((Literal) left).getBoolean(null); Boolean r = ((Literal) right).getBoolean(null); if (l != null && r != null) { switch (operation) { case Factory.OP_BOOL_AND: return left.getFactory().createLitBoolean(l.booleanValue() && r.booleanValue(), left.getStart(), right.getEnd()); case Factory.OP_BOOL_OR: return left.getFactory().createLitBoolean(l.booleanValue() || r.booleanValue(), left.getStart(), right.getEnd()); case Factory.OP_BOOL_XOR: return left.getFactory().createLitBoolean(l.booleanValue() ^ r.booleanValue(), left.getStart(), right.getEnd()); } } } return new OpBool(left, right, operation); }
java
public static ExprBoolean toExprBoolean(Expression left, Expression right, int operation) { if (left instanceof Literal && right instanceof Literal) { Boolean l = ((Literal) left).getBoolean(null); Boolean r = ((Literal) right).getBoolean(null); if (l != null && r != null) { switch (operation) { case Factory.OP_BOOL_AND: return left.getFactory().createLitBoolean(l.booleanValue() && r.booleanValue(), left.getStart(), right.getEnd()); case Factory.OP_BOOL_OR: return left.getFactory().createLitBoolean(l.booleanValue() || r.booleanValue(), left.getStart(), right.getEnd()); case Factory.OP_BOOL_XOR: return left.getFactory().createLitBoolean(l.booleanValue() ^ r.booleanValue(), left.getStart(), right.getEnd()); } } } return new OpBool(left, right, operation); }
[ "public", "static", "ExprBoolean", "toExprBoolean", "(", "Expression", "left", ",", "Expression", "right", ",", "int", "operation", ")", "{", "if", "(", "left", "instanceof", "Literal", "&&", "right", "instanceof", "Literal", ")", "{", "Boolean", "l", "=", "...
Create a String expression from a Expression @param left @param right @return String expression @throws TemplateException
[ "Create", "a", "String", "expression", "from", "a", "Expression" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/interpreter/op/OpBool.java#L74-L91
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.codePointCount
public static int codePointCount(char[] a, int offset, int count) { if (count > a.length - offset || offset < 0 || count < 0) { throw new IndexOutOfBoundsException(); } return codePointCountImpl(a, offset, count); }
java
public static int codePointCount(char[] a, int offset, int count) { if (count > a.length - offset || offset < 0 || count < 0) { throw new IndexOutOfBoundsException(); } return codePointCountImpl(a, offset, count); }
[ "public", "static", "int", "codePointCount", "(", "char", "[", "]", "a", ",", "int", "offset", ",", "int", "count", ")", "{", "if", "(", "count", ">", "a", ".", "length", "-", "offset", "||", "offset", "<", "0", "||", "count", "<", "0", ")", "{",...
Returns the number of Unicode code points in a subarray of the {@code char} array argument. The {@code offset} argument is the index of the first {@code char} of the subarray and the {@code count} argument specifies the length of the subarray in {@code char}s. Unpaired surrogates within the subarray count as one code point each. @param a the {@code char} array @param offset the index of the first {@code char} in the given {@code char} array @param count the length of the subarray in {@code char}s @return the number of Unicode code points in the specified subarray @exception NullPointerException if {@code a} is null. @exception IndexOutOfBoundsException if {@code offset} or {@code count} is negative, or if {@code offset + count} is larger than the length of the given array. @since 1.5
[ "Returns", "the", "number", "of", "Unicode", "code", "points", "in", "a", "subarray", "of", "the", "{", "@code", "char", "}", "array", "argument", ".", "The", "{", "@code", "offset", "}", "argument", "is", "the", "index", "of", "the", "first", "{", "@c...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5301-L5306
casbin/jcasbin
src/main/java/org/casbin/jcasbin/util/BuiltInFunctions.java
BuiltInFunctions.generateGFunction
public static AviatorFunction generateGFunction(String name, RoleManager rm) { return new AbstractFunction() { public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) { String name1 = FunctionUtils.getStringValue(arg1, env); String name2 = FunctionUtils.getStringValue(arg2, env); if (rm == null) { return AviatorBoolean.valueOf(name1.equals(name2)); } else { boolean res = rm.hasLink(name1, name2); return AviatorBoolean.valueOf(res); } } public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3) { String name1 = FunctionUtils.getStringValue(arg1, env); String name2 = FunctionUtils.getStringValue(arg2, env); if (rm == null) { return AviatorBoolean.valueOf(name1.equals(name2)); } else { String domain = FunctionUtils.getStringValue(arg3, env); boolean res = rm.hasLink(name1, name2, domain); return AviatorBoolean.valueOf(res); } } public String getName() { return name; } }; }
java
public static AviatorFunction generateGFunction(String name, RoleManager rm) { return new AbstractFunction() { public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) { String name1 = FunctionUtils.getStringValue(arg1, env); String name2 = FunctionUtils.getStringValue(arg2, env); if (rm == null) { return AviatorBoolean.valueOf(name1.equals(name2)); } else { boolean res = rm.hasLink(name1, name2); return AviatorBoolean.valueOf(res); } } public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3) { String name1 = FunctionUtils.getStringValue(arg1, env); String name2 = FunctionUtils.getStringValue(arg2, env); if (rm == null) { return AviatorBoolean.valueOf(name1.equals(name2)); } else { String domain = FunctionUtils.getStringValue(arg3, env); boolean res = rm.hasLink(name1, name2, domain); return AviatorBoolean.valueOf(res); } } public String getName() { return name; } }; }
[ "public", "static", "AviatorFunction", "generateGFunction", "(", "String", "name", ",", "RoleManager", "rm", ")", "{", "return", "new", "AbstractFunction", "(", ")", "{", "public", "AviatorObject", "call", "(", "Map", "<", "String", ",", "Object", ">", "env", ...
generateGFunction is the factory method of the g(_, _) function. @param name the name of the g(_, _) function, can be "g", "g2", .. @param rm the role manager used by the function. @return the function.
[ "generateGFunction", "is", "the", "factory", "method", "of", "the", "g", "(", "_", "_", ")", "function", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/util/BuiltInFunctions.java#L159-L190
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.getTimestamp
@Override public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "Timestamp", "getTimestamp", "(", "int", "parameterIndex", ",", "Calendar", "cal", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Retrieves the value of the designated JDBC TIMESTAMP parameter as a java.sql.Timestamp object, using the given Calendar object to construct the Timestamp object.
[ "Retrieves", "the", "value", "of", "the", "designated", "JDBC", "TIMESTAMP", "parameter", "as", "a", "java", ".", "sql", ".", "Timestamp", "object", "using", "the", "given", "Calendar", "object", "to", "construct", "the", "Timestamp", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L479-L484
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/MultiLongWatermark.java
MultiLongWatermark.calculatePercentCompletion
@Override public short calculatePercentCompletion(Watermark lowWatermark, Watermark highWatermark) { Preconditions.checkArgument( lowWatermark instanceof MultiLongWatermark && highWatermark instanceof MultiLongWatermark, String.format("Arguments of %s.%s must be of type %s", MultiLongWatermark.class.getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName(), MultiLongWatermark.class.getSimpleName())); long pulled = ((MultiLongWatermark) lowWatermark).getGap(this); long all = ((MultiLongWatermark) lowWatermark).getGap((MultiLongWatermark) highWatermark); Preconditions.checkState(all > 0); long percent = Math.min(100, LongMath.divide(pulled * 100, all, RoundingMode.HALF_UP)); return (short) percent; }
java
@Override public short calculatePercentCompletion(Watermark lowWatermark, Watermark highWatermark) { Preconditions.checkArgument( lowWatermark instanceof MultiLongWatermark && highWatermark instanceof MultiLongWatermark, String.format("Arguments of %s.%s must be of type %s", MultiLongWatermark.class.getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName(), MultiLongWatermark.class.getSimpleName())); long pulled = ((MultiLongWatermark) lowWatermark).getGap(this); long all = ((MultiLongWatermark) lowWatermark).getGap((MultiLongWatermark) highWatermark); Preconditions.checkState(all > 0); long percent = Math.min(100, LongMath.divide(pulled * 100, all, RoundingMode.HALF_UP)); return (short) percent; }
[ "@", "Override", "public", "short", "calculatePercentCompletion", "(", "Watermark", "lowWatermark", ",", "Watermark", "highWatermark", ")", "{", "Preconditions", ".", "checkArgument", "(", "lowWatermark", "instanceof", "MultiLongWatermark", "&&", "highWatermark", "instanc...
Given a low watermark (starting point) and a high watermark (target), returns the percentage of events pulled. @return a percentage value between 0 and 100.
[ "Given", "a", "low", "watermark", "(", "starting", "point", ")", "and", "a", "high", "watermark", "(", "target", ")", "returns", "the", "percentage", "of", "events", "pulled", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/MultiLongWatermark.java#L77-L89
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/recognition/ExampleColorHistogramLookup.java
ExampleColorHistogramLookup.histogramGray
public static List<double[]> histogramGray( List<File> images ) { List<double[]> points = new ArrayList<>(); GrayU8 gray = new GrayU8(1,1); for( File f : images ) { BufferedImage buffered = UtilImageIO.loadImage(f.getPath()); if( buffered == null ) throw new RuntimeException("Can't load image!"); gray.reshape(buffered.getWidth(), buffered.getHeight()); ConvertBufferedImage.convertFrom(buffered, gray, true); TupleDesc_F64 imageHist = new TupleDesc_F64(150); HistogramFeatureOps.histogram(gray, 255, imageHist); UtilFeature.normalizeL2(imageHist); // normalize so that image size doesn't matter points.add(imageHist.value); } return points; }
java
public static List<double[]> histogramGray( List<File> images ) { List<double[]> points = new ArrayList<>(); GrayU8 gray = new GrayU8(1,1); for( File f : images ) { BufferedImage buffered = UtilImageIO.loadImage(f.getPath()); if( buffered == null ) throw new RuntimeException("Can't load image!"); gray.reshape(buffered.getWidth(), buffered.getHeight()); ConvertBufferedImage.convertFrom(buffered, gray, true); TupleDesc_F64 imageHist = new TupleDesc_F64(150); HistogramFeatureOps.histogram(gray, 255, imageHist); UtilFeature.normalizeL2(imageHist); // normalize so that image size doesn't matter points.add(imageHist.value); } return points; }
[ "public", "static", "List", "<", "double", "[", "]", ">", "histogramGray", "(", "List", "<", "File", ">", "images", ")", "{", "List", "<", "double", "[", "]", ">", "points", "=", "new", "ArrayList", "<>", "(", ")", ";", "GrayU8", "gray", "=", "new"...
Computes a histogram from the gray scale intensity image alone. Probably the least effective at looking up similar images.
[ "Computes", "a", "histogram", "from", "the", "gray", "scale", "intensity", "image", "alone", ".", "Probably", "the", "least", "effective", "at", "looking", "up", "similar", "images", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/recognition/ExampleColorHistogramLookup.java#L180-L200
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BusHandler.java
BusHandler.updateSendAllowed
public void updateSendAllowed(boolean oldSendAllowed, boolean newSendAllowed) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "updateSendAllowed", new Object[] {Boolean.valueOf(oldSendAllowed), Boolean.valueOf(newSendAllowed)}); if(oldSendAllowed && !newSendAllowed) setForeignBusSendAllowed(false); else if(!oldSendAllowed && newSendAllowed) setForeignBusSendAllowed(true); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "updateSendAllowed"); }
java
public void updateSendAllowed(boolean oldSendAllowed, boolean newSendAllowed) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "updateSendAllowed", new Object[] {Boolean.valueOf(oldSendAllowed), Boolean.valueOf(newSendAllowed)}); if(oldSendAllowed && !newSendAllowed) setForeignBusSendAllowed(false); else if(!oldSendAllowed && newSendAllowed) setForeignBusSendAllowed(true); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "updateSendAllowed"); }
[ "public", "void", "updateSendAllowed", "(", "boolean", "oldSendAllowed", ",", "boolean", "newSendAllowed", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "("...
Update sendAllowed setting for this bus and any targetting Handlers. @param foreignBusDefinition
[ "Update", "sendAllowed", "setting", "for", "this", "bus", "and", "any", "targetting", "Handlers", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/BusHandler.java#L240-L255
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java
ServerLogReaderUtil.shouldSkipOp
static boolean shouldSkipOp(long currentTransactionId, FSEditLogOp op) { if (currentTransactionId == -1 || op.getTransactionId() > currentTransactionId) { return false; } return true; }
java
static boolean shouldSkipOp(long currentTransactionId, FSEditLogOp op) { if (currentTransactionId == -1 || op.getTransactionId() > currentTransactionId) { return false; } return true; }
[ "static", "boolean", "shouldSkipOp", "(", "long", "currentTransactionId", ",", "FSEditLogOp", "op", ")", "{", "if", "(", "currentTransactionId", "==", "-", "1", "||", "op", ".", "getTransactionId", "(", ")", ">", "currentTransactionId", ")", "{", "return", "fa...
We would skip the transaction if its id is less than or equal to current transaction id.
[ "We", "would", "skip", "the", "transaction", "if", "its", "id", "is", "less", "than", "or", "equal", "to", "current", "transaction", "id", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderUtil.java#L70-L77
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/RelatedControl.java
RelatedControl.generate
@Override public Collection<BioPAXElement> generate(Match match, int... ind) { PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]); Conversion conv = (Conversion) match.get(ind[1]); if (!((peType == RelType.INPUT && getConvParticipants(conv, RelType.INPUT).contains(pe)) || (peType == RelType.OUTPUT && getConvParticipants(conv, RelType.OUTPUT).contains(pe)))) throw new IllegalArgumentException("peType = " + peType + ", and related participant set does not contain this PE. Conv dir = " + getDirection(conv) + " conv.id=" + conv.getUri() + " pe.id=" +pe.getUri()); boolean rightContains = conv.getRight().contains(pe); boolean leftContains = conv.getLeft().contains(pe); assert rightContains || leftContains : "PE is not a participant."; Set<BioPAXElement> result = new HashSet<BioPAXElement>(); ConversionDirectionType avoidDir = (leftContains && rightContains) ? null : peType == RelType.OUTPUT ? (leftContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT) : (rightContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT); for (Object o : controlledOf.getValueFromBean(conv)) { Control ctrl = (Control) o; ConversionDirectionType dir = getDirection(conv, ctrl); if (avoidDir != null && dir == avoidDir) continue; // don't collect this if the pe is ubique in the context of this control if (blacklist != null && blacklist.isUbique(pe, conv, dir, peType)) continue; result.add(ctrl); } return result; }
java
@Override public Collection<BioPAXElement> generate(Match match, int... ind) { PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]); Conversion conv = (Conversion) match.get(ind[1]); if (!((peType == RelType.INPUT && getConvParticipants(conv, RelType.INPUT).contains(pe)) || (peType == RelType.OUTPUT && getConvParticipants(conv, RelType.OUTPUT).contains(pe)))) throw new IllegalArgumentException("peType = " + peType + ", and related participant set does not contain this PE. Conv dir = " + getDirection(conv) + " conv.id=" + conv.getUri() + " pe.id=" +pe.getUri()); boolean rightContains = conv.getRight().contains(pe); boolean leftContains = conv.getLeft().contains(pe); assert rightContains || leftContains : "PE is not a participant."; Set<BioPAXElement> result = new HashSet<BioPAXElement>(); ConversionDirectionType avoidDir = (leftContains && rightContains) ? null : peType == RelType.OUTPUT ? (leftContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT) : (rightContains ? ConversionDirectionType.LEFT_TO_RIGHT : ConversionDirectionType.RIGHT_TO_LEFT); for (Object o : controlledOf.getValueFromBean(conv)) { Control ctrl = (Control) o; ConversionDirectionType dir = getDirection(conv, ctrl); if (avoidDir != null && dir == avoidDir) continue; // don't collect this if the pe is ubique in the context of this control if (blacklist != null && blacklist.isUbique(pe, conv, dir, peType)) continue; result.add(ctrl); } return result; }
[ "@", "Override", "public", "Collection", "<", "BioPAXElement", ">", "generate", "(", "Match", "match", ",", "int", "...", "ind", ")", "{", "PhysicalEntity", "pe", "=", "(", "PhysicalEntity", ")", "match", ".", "get", "(", "ind", "[", "0", "]", ")", ";"...
According to the relation between PhysicalEntity and the Conversion, checks of the Control is relevant. If relevant it is retrieved. @param match current pattern match @param ind mapped indices @return related controls
[ "According", "to", "the", "relation", "between", "PhysicalEntity", "and", "the", "Conversion", "checks", "of", "the", "Control", "is", "relevant", ".", "If", "relevant", "it", "is", "retrieved", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/RelatedControl.java#L74-L110
alkacon/opencms-core
src/org/opencms/jsp/util/CmsFunctionRenderer.java
CmsFunctionRenderer.getDefaultResource
private static CmsResource getDefaultResource(CmsObject cms, String path) { CmsResource resource = (CmsResource)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject( cms, path); if (resource == null) { try { resource = cms.readResource(path); CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(cms, path, resource); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } } return resource; }
java
private static CmsResource getDefaultResource(CmsObject cms, String path) { CmsResource resource = (CmsResource)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject( cms, path); if (resource == null) { try { resource = cms.readResource(path); CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(cms, path, resource); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } } return resource; }
[ "private", "static", "CmsResource", "getDefaultResource", "(", "CmsObject", "cms", ",", "String", "path", ")", "{", "CmsResource", "resource", "=", "(", "CmsResource", ")", "CmsVfsMemoryObjectCache", ".", "getVfsMemoryObjectCache", "(", ")", ".", "getCachedObject", ...
Helper method for cached reading of resources under specific, fixed paths.<p> @param cms the current CMS context @param path the path to read @return the resource which has been read
[ "Helper", "method", "for", "cached", "reading", "of", "resources", "under", "specific", "fixed", "paths", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsFunctionRenderer.java#L162-L176
trustathsh/ironcommon
src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java
Properties.set
public void set(String propertyPath, Object propertyValue) throws PropertyException { // check propertyPath ObjectChecks .checkForNullReference(propertyPath, "propertyPath is null"); // check propertyValue if (!(propertyValue instanceof String) && !(propertyValue instanceof Integer) && !(propertyValue instanceof Double) && !(propertyValue instanceof Boolean) && !(propertyValue instanceof Map) && !(propertyValue instanceof List)) { throw new PropertyException( "Only String, int, double, boolean, Map and List are supported."); } // add the mPreFixPropertyPath if this Property is a copy with a deeper // level String fullPropertyPath = addPath(mPropertyPathPrefix, propertyPath); // add propertyValue with the fullPropertyPath addToRootMap(fullPropertyPath, propertyValue); mLogger.debug("Set the property value: " + propertyValue + " on key: " + fullPropertyPath); }
java
public void set(String propertyPath, Object propertyValue) throws PropertyException { // check propertyPath ObjectChecks .checkForNullReference(propertyPath, "propertyPath is null"); // check propertyValue if (!(propertyValue instanceof String) && !(propertyValue instanceof Integer) && !(propertyValue instanceof Double) && !(propertyValue instanceof Boolean) && !(propertyValue instanceof Map) && !(propertyValue instanceof List)) { throw new PropertyException( "Only String, int, double, boolean, Map and List are supported."); } // add the mPreFixPropertyPath if this Property is a copy with a deeper // level String fullPropertyPath = addPath(mPropertyPathPrefix, propertyPath); // add propertyValue with the fullPropertyPath addToRootMap(fullPropertyPath, propertyValue); mLogger.debug("Set the property value: " + propertyValue + " on key: " + fullPropertyPath); }
[ "public", "void", "set", "(", "String", "propertyPath", ",", "Object", "propertyValue", ")", "throws", "PropertyException", "{", "// check propertyPath", "ObjectChecks", ".", "checkForNullReference", "(", "propertyPath", ",", "\"propertyPath is null\"", ")", ";", "// ch...
Save the value with a given key. {@link Map} and {@link List} can only contain simple data-types. @param propertyPath Example: foo.bar.key @param propertyValue only {@link String}, {@link Integer}, {@link Double}, {@link Boolean}, {@link Map} and {@link List} are supported @throws PropertyException If the propertyKey-Path is not a property key or is not part of a property path.
[ "Save", "the", "value", "with", "a", "given", "key", ".", "{", "@link", "Map", "}", "and", "{", "@link", "List", "}", "can", "only", "contain", "simple", "data", "-", "types", "." ]
train
https://github.com/trustathsh/ironcommon/blob/fee589a9300ab16744ca12fafae4357dd18c9fcb/src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java#L539-L565
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/DiscordApiBuilder.java
DiscordApiBuilder.loginShards
public Collection<CompletableFuture<DiscordApi>> loginShards(IntPredicate shardsCondition) { return loginShards(IntStream.range(0, delegate.getTotalShards()).filter(shardsCondition).toArray()); }
java
public Collection<CompletableFuture<DiscordApi>> loginShards(IntPredicate shardsCondition) { return loginShards(IntStream.range(0, delegate.getTotalShards()).filter(shardsCondition).toArray()); }
[ "public", "Collection", "<", "CompletableFuture", "<", "DiscordApi", ">", ">", "loginShards", "(", "IntPredicate", "shardsCondition", ")", "{", "return", "loginShards", "(", "IntStream", ".", "range", "(", "0", ",", "delegate", ".", "getTotalShards", "(", ")", ...
Login shards adhering to the given predicate to the account with the given token. It is invalid to call {@link #setCurrentShard(int)} with anything but {@code 0} before calling this method. @param shardsCondition The predicate for identifying shards to connect, starting with {@code 0}! @return A collection of {@link CompletableFuture}s which contain the {@code DiscordApi}s for the shards.
[ "Login", "shards", "adhering", "to", "the", "given", "predicate", "to", "the", "account", "with", "the", "given", "token", ".", "It", "is", "invalid", "to", "call", "{", "@link", "#setCurrentShard", "(", "int", ")", "}", "with", "anything", "but", "{", "...
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/DiscordApiBuilder.java#L58-L60
google/closure-templates
java/src/com/google/template/soy/jssrc/internal/JsType.java
JsType.getValueCoercion
@Nullable final Expression getValueCoercion(Expression value, Generator codeGenerator) { boolean needsProtoCoercion = coercionStrategies.contains(ValueCoercionStrategy.PROTO); if (!needsProtoCoercion) { return null; } Expression coercion = value.castAs("?").dotAccess("$jspbMessageInstance").or(value, codeGenerator); return coercionStrategies.contains(ValueCoercionStrategy.NULL) ? value.and(coercion, codeGenerator) : coercion; }
java
@Nullable final Expression getValueCoercion(Expression value, Generator codeGenerator) { boolean needsProtoCoercion = coercionStrategies.contains(ValueCoercionStrategy.PROTO); if (!needsProtoCoercion) { return null; } Expression coercion = value.castAs("?").dotAccess("$jspbMessageInstance").or(value, codeGenerator); return coercionStrategies.contains(ValueCoercionStrategy.NULL) ? value.and(coercion, codeGenerator) : coercion; }
[ "@", "Nullable", "final", "Expression", "getValueCoercion", "(", "Expression", "value", ",", "Generator", "codeGenerator", ")", "{", "boolean", "needsProtoCoercion", "=", "coercionStrategies", ".", "contains", "(", "ValueCoercionStrategy", ".", "PROTO", ")", ";", "i...
Generates code to coerce the value, returns {@code null} if no coercion is necessary.
[ "Generates", "code", "to", "coerce", "the", "value", "returns", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsType.java#L548-L559
lightblueseas/vintage-time
src/main/java/de/alpharogroup/date/CreateDateExtensions.java
CreateDateExtensions.newDate
public static Date newDate(final int year, final int month, final int day, final int hour, final int minute, final int seconds, final int milliSecond) { return newDate(year, month, day, hour, minute, seconds, milliSecond, TimeZone.getDefault(), Locale.getDefault()); }
java
public static Date newDate(final int year, final int month, final int day, final int hour, final int minute, final int seconds, final int milliSecond) { return newDate(year, month, day, hour, minute, seconds, milliSecond, TimeZone.getDefault(), Locale.getDefault()); }
[ "public", "static", "Date", "newDate", "(", "final", "int", "year", ",", "final", "int", "month", ",", "final", "int", "day", ",", "final", "int", "hour", ",", "final", "int", "minute", ",", "final", "int", "seconds", ",", "final", "int", "milliSecond", ...
Creates a new Date object from the given values. @param year The year. @param month The month. @param day The day. @param hour The hour. @param minute The minute. @param seconds The second. @param milliSecond The millisecond. @return Returns the created Date object.
[ "Creates", "a", "new", "Date", "object", "from", "the", "given", "values", "." ]
train
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CreateDateExtensions.java#L117-L122
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java
JdbcCpoAdapter.processUpdateGroup
protected <T> long processUpdateGroup(Collection<T> coll, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con) throws CpoException { long updateCount = 0; if (!coll.isEmpty()) { T[] arr = (T[]) coll.toArray(); T obj1 = arr[0]; boolean allEqual = true; for (int i = 1; i < arr.length; i++) { if (!obj1.getClass().getName().equals(arr[i].getClass().getName())) { allEqual = false; break; } } if (allEqual && batchUpdatesSupported_ && !JdbcCpoAdapter.PERSIST_GROUP.equals(groupType)) { updateCount = processBatchUpdateGroup(arr, groupType, groupName, wheres, orderBy, nativeExpressions, con); } else { for (T obj : arr) { updateCount += processUpdateGroup(obj, groupType, groupName, wheres, orderBy, nativeExpressions, con); } } } return updateCount; }
java
protected <T> long processUpdateGroup(Collection<T> coll, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con) throws CpoException { long updateCount = 0; if (!coll.isEmpty()) { T[] arr = (T[]) coll.toArray(); T obj1 = arr[0]; boolean allEqual = true; for (int i = 1; i < arr.length; i++) { if (!obj1.getClass().getName().equals(arr[i].getClass().getName())) { allEqual = false; break; } } if (allEqual && batchUpdatesSupported_ && !JdbcCpoAdapter.PERSIST_GROUP.equals(groupType)) { updateCount = processBatchUpdateGroup(arr, groupType, groupName, wheres, orderBy, nativeExpressions, con); } else { for (T obj : arr) { updateCount += processUpdateGroup(obj, groupType, groupName, wheres, orderBy, nativeExpressions, con); } } } return updateCount; }
[ "protected", "<", "T", ">", "long", "processUpdateGroup", "(", "Collection", "<", "T", ">", "coll", ",", "String", "groupType", ",", "String", "groupName", ",", "Collection", "<", "CpoWhere", ">", "wheres", ",", "Collection", "<", "CpoOrderBy", ">", "orderBy...
DOCUMENT ME! @param coll DOCUMENT ME! @param groupType DOCUMENT ME! @param groupName DOCUMENT ME! @param wheres DOCUMENT ME! @param orderBy DOCUMENT ME! @param nativeExpressions DOCUMENT ME! @param con DOCUMENT ME! @return DOCUMENT ME! @throws CpoException DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2778-L2803
reactor/reactor-netty
src/main/java/reactor/netty/ByteBufFlux.java
ByteBufFlux.asInputStream
public Flux<InputStream> asInputStream() { return handle((bb, sink) -> { try { sink.next(new ByteBufMono.ReleasingInputStream(bb)); } catch (IllegalReferenceCountException e) { sink.complete(); } }); }
java
public Flux<InputStream> asInputStream() { return handle((bb, sink) -> { try { sink.next(new ByteBufMono.ReleasingInputStream(bb)); } catch (IllegalReferenceCountException e) { sink.complete(); } }); }
[ "public", "Flux", "<", "InputStream", ">", "asInputStream", "(", ")", "{", "return", "handle", "(", "(", "bb", ",", "sink", ")", "->", "{", "try", "{", "sink", ".", "next", "(", "new", "ByteBufMono", ".", "ReleasingInputStream", "(", "bb", ")", ")", ...
Convert to a {@link InputStream} inbound {@link Flux} @return a {@link InputStream} inbound {@link Flux}
[ "Convert", "to", "a", "{", "@link", "InputStream", "}", "inbound", "{", "@link", "Flux", "}" ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufFlux.java#L214-L223
netty/netty
buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java
CompositeByteBuf.addComponents
public CompositeByteBuf addComponents(boolean increaseWriterIndex, Iterable<ByteBuf> buffers) { return addComponents(increaseWriterIndex, componentCount, buffers); }
java
public CompositeByteBuf addComponents(boolean increaseWriterIndex, Iterable<ByteBuf> buffers) { return addComponents(increaseWriterIndex, componentCount, buffers); }
[ "public", "CompositeByteBuf", "addComponents", "(", "boolean", "increaseWriterIndex", ",", "Iterable", "<", "ByteBuf", ">", "buffers", ")", "{", "return", "addComponents", "(", "increaseWriterIndex", ",", "componentCount", ",", "buffers", ")", ";", "}" ]
Add the given {@link ByteBuf}s and increase the {@code writerIndex} if {@code increaseWriterIndex} is {@code true}. {@link ByteBuf#release()} ownership of all {@link ByteBuf} objects in {@code buffers} is transferred to this {@link CompositeByteBuf}. @param buffers the {@link ByteBuf}s to add. {@link ByteBuf#release()} ownership of all {@link ByteBuf#release()} ownership of all {@link ByteBuf} objects is transferred to this {@link CompositeByteBuf}.
[ "Add", "the", "given", "{", "@link", "ByteBuf", "}", "s", "and", "increase", "the", "{", "@code", "writerIndex", "}", "if", "{", "@code", "increaseWriterIndex", "}", "is", "{", "@code", "true", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L250-L252
looly/hutool
hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java
Scheduler.schedule
public Scheduler schedule(String id, String pattern, Runnable task) { return schedule(id, new CronPattern(pattern), new RunnableTask(task)); }
java
public Scheduler schedule(String id, String pattern, Runnable task) { return schedule(id, new CronPattern(pattern), new RunnableTask(task)); }
[ "public", "Scheduler", "schedule", "(", "String", "id", ",", "String", "pattern", ",", "Runnable", "task", ")", "{", "return", "schedule", "(", "id", ",", "new", "CronPattern", "(", "pattern", ")", ",", "new", "RunnableTask", "(", "task", ")", ")", ";", ...
新增Task @param id ID,为每一个Task定义一个ID @param pattern {@link CronPattern}对应的String表达式 @param task {@link Runnable} @return this
[ "新增Task" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L231-L233
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/compaction/CompactionManager.java
CompactionManager.interruptCompactionFor
public void interruptCompactionFor(Iterable<CFMetaData> columnFamilies, boolean interruptValidation) { assert columnFamilies != null; // interrupt in-progress compactions for (Holder compactionHolder : CompactionMetrics.getCompactions()) { CompactionInfo info = compactionHolder.getCompactionInfo(); if ((info.getTaskType() == OperationType.VALIDATION) && !interruptValidation) continue; if (Iterables.contains(columnFamilies, info.getCFMetaData())) compactionHolder.stop(); // signal compaction to stop } }
java
public void interruptCompactionFor(Iterable<CFMetaData> columnFamilies, boolean interruptValidation) { assert columnFamilies != null; // interrupt in-progress compactions for (Holder compactionHolder : CompactionMetrics.getCompactions()) { CompactionInfo info = compactionHolder.getCompactionInfo(); if ((info.getTaskType() == OperationType.VALIDATION) && !interruptValidation) continue; if (Iterables.contains(columnFamilies, info.getCFMetaData())) compactionHolder.stop(); // signal compaction to stop } }
[ "public", "void", "interruptCompactionFor", "(", "Iterable", "<", "CFMetaData", ">", "columnFamilies", ",", "boolean", "interruptValidation", ")", "{", "assert", "columnFamilies", "!=", "null", ";", "// interrupt in-progress compactions", "for", "(", "Holder", "compacti...
Try to stop all of the compactions for given ColumnFamilies. Note that this method does not wait for all compactions to finish; you'll need to loop against isCompacting if you want that behavior. @param columnFamilies The ColumnFamilies to try to stop compaction upon. @param interruptValidation true if validation operations for repair should also be interrupted
[ "Try", "to", "stop", "all", "of", "the", "compactions", "for", "given", "ColumnFamilies", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/compaction/CompactionManager.java#L1454-L1468
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/views/GestureFrameLayout.java
GestureFrameLayout.invalidateChildInParent
@SuppressWarnings("deprecation") @Override public ViewParent invalidateChildInParent(int[] location, @NonNull Rect dirty) { // Invalidating correct rectangle applyMatrix(dirty, matrix); return super.invalidateChildInParent(location, dirty); }
java
@SuppressWarnings("deprecation") @Override public ViewParent invalidateChildInParent(int[] location, @NonNull Rect dirty) { // Invalidating correct rectangle applyMatrix(dirty, matrix); return super.invalidateChildInParent(location, dirty); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "@", "Override", "public", "ViewParent", "invalidateChildInParent", "(", "int", "[", "]", "location", ",", "@", "NonNull", "Rect", "dirty", ")", "{", "// Invalidating correct rectangle", "applyMatrix", "(", "dirt...
It seems to be fine to use this method instead of suggested onDescendantInvalidated(...)
[ "It", "seems", "to", "be", "fine", "to", "use", "this", "method", "instead", "of", "suggested", "onDescendantInvalidated", "(", "...", ")" ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/views/GestureFrameLayout.java#L109-L115
Erudika/para
para-server/src/main/java/com/erudika/para/rest/RestUtils.java
RestUtils.getVotingResponse
public static Response getVotingResponse(ParaObject object, Map<String, Object> entity) { boolean voteSuccess = false; if (object != null && entity != null) { String upvoterId = (String) entity.get("_voteup"); String downvoterId = (String) entity.get("_votedown"); if (!StringUtils.isBlank(upvoterId)) { voteSuccess = object.voteUp(upvoterId); } else if (!StringUtils.isBlank(downvoterId)) { voteSuccess = object.voteDown(downvoterId); } if (voteSuccess) { object.update(); } } return Response.ok(voteSuccess).build(); }
java
public static Response getVotingResponse(ParaObject object, Map<String, Object> entity) { boolean voteSuccess = false; if (object != null && entity != null) { String upvoterId = (String) entity.get("_voteup"); String downvoterId = (String) entity.get("_votedown"); if (!StringUtils.isBlank(upvoterId)) { voteSuccess = object.voteUp(upvoterId); } else if (!StringUtils.isBlank(downvoterId)) { voteSuccess = object.voteDown(downvoterId); } if (voteSuccess) { object.update(); } } return Response.ok(voteSuccess).build(); }
[ "public", "static", "Response", "getVotingResponse", "(", "ParaObject", "object", ",", "Map", "<", "String", ",", "Object", ">", "entity", ")", "{", "boolean", "voteSuccess", "=", "false", ";", "if", "(", "object", "!=", "null", "&&", "entity", "!=", "null...
Process voting request and create vote object. @param object the object to cast vote on @param entity request entity data @return status codetrue if vote was successful
[ "Process", "voting", "request", "and", "create", "vote", "object", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L269-L284
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.findInheritedMemberType
Symbol findInheritedMemberType(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { Symbol bestSoFar = typeNotFound; Symbol sym; Type st = types.supertype(c.type); if (st != null && st.hasTag(CLASS)) { sym = findMemberType(env, site, name, st.tsym); bestSoFar = bestOf(bestSoFar, sym); } for (List<Type> l = types.interfaces(c.type); bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); l = l.tail) { sym = findMemberType(env, site, name, l.head.tsym); if (!bestSoFar.kind.isResolutionError() && !sym.kind.isResolutionError() && sym.owner != bestSoFar.owner) bestSoFar = new AmbiguityError(bestSoFar, sym); else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
java
Symbol findInheritedMemberType(Env<AttrContext> env, Type site, Name name, TypeSymbol c) { Symbol bestSoFar = typeNotFound; Symbol sym; Type st = types.supertype(c.type); if (st != null && st.hasTag(CLASS)) { sym = findMemberType(env, site, name, st.tsym); bestSoFar = bestOf(bestSoFar, sym); } for (List<Type> l = types.interfaces(c.type); bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); l = l.tail) { sym = findMemberType(env, site, name, l.head.tsym); if (!bestSoFar.kind.isResolutionError() && !sym.kind.isResolutionError() && sym.owner != bestSoFar.owner) bestSoFar = new AmbiguityError(bestSoFar, sym); else bestSoFar = bestOf(bestSoFar, sym); } return bestSoFar; }
[ "Symbol", "findInheritedMemberType", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ",", "TypeSymbol", "c", ")", "{", "Symbol", "bestSoFar", "=", "typeNotFound", ";", "Symbol", "sym", ";", "Type", "st", "=", "types", ...
Find a member type inherited from a superclass or interface. @param env The current environment. @param site The original type from where the selection takes place. @param name The type's name. @param c The class to search for the member type. This is always a superclass or implemented interface of site's class.
[ "Find", "a", "member", "type", "inherited", "from", "a", "superclass", "or", "interface", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2187-L2210
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.appendDocumentElementIndication
protected void appendDocumentElementIndication(StringBuilder sb, Document doc) { sb.append("<"); sb.append(doc.getDocumentElement().getNodeName()); sb.append("...>"); }
java
protected void appendDocumentElementIndication(StringBuilder sb, Document doc) { sb.append("<"); sb.append(doc.getDocumentElement().getNodeName()); sb.append("...>"); }
[ "protected", "void", "appendDocumentElementIndication", "(", "StringBuilder", "sb", ",", "Document", "doc", ")", "{", "sb", ".", "append", "(", "\"<\"", ")", ";", "sb", ".", "append", "(", "doc", ".", "getDocumentElement", "(", ")", ".", "getNodeName", "(", ...
Appends a short indication of the document's root element like "&lt;ElementName...&gt;" for {@link #getShortString}. @param sb the builder to append to @param doc the XML document node @since XMLUnit 2.4.0
[ "Appends", "a", "short", "indication", "of", "the", "document", "s", "root", "element", "like", "&lt", ";", "ElementName", "...", "&gt", ";", "for", "{", "@link", "#getShortString", "}", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L205-L209
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/DefaultTextListener.java
DefaultTextListener.getText
@Deprecated public static String getText (TextBoxBase target, String defaultText) { String text = target.getText().trim(); return text.equals(defaultText.trim()) ? "" : text; }
java
@Deprecated public static String getText (TextBoxBase target, String defaultText) { String text = target.getText().trim(); return text.equals(defaultText.trim()) ? "" : text; }
[ "@", "Deprecated", "public", "static", "String", "getText", "(", "TextBoxBase", "target", ",", "String", "defaultText", ")", "{", "String", "text", "=", "target", ".", "getText", "(", ")", ".", "trim", "(", ")", ";", "return", "text", ".", "equals", "(",...
Returns the contents of the supplied text box, accounting for the supplied default text. @deprecated use Widgets.getText(TextBoxBase, String)
[ "Returns", "the", "contents", "of", "the", "supplied", "text", "box", "accounting", "for", "the", "supplied", "default", "text", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/DefaultTextListener.java#L54-L59
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/ComponentEnhancer.java
ComponentEnhancer.manageLifecycleAnnotation
private static void manageLifecycleAnnotation(final Component<?> component, final MultiMap<String, Method> lifecycleMethod, final Class<? extends Annotation> annotationClass) { for (final Method method : ClassUtility.getAnnotatedMethods(component.getClass(), annotationClass)) { // Add a method to the multimap entry // TODO sort lifecycleMethod.add(annotationClass.getName(), method); } }
java
private static void manageLifecycleAnnotation(final Component<?> component, final MultiMap<String, Method> lifecycleMethod, final Class<? extends Annotation> annotationClass) { for (final Method method : ClassUtility.getAnnotatedMethods(component.getClass(), annotationClass)) { // Add a method to the multimap entry // TODO sort lifecycleMethod.add(annotationClass.getName(), method); } }
[ "private", "static", "void", "manageLifecycleAnnotation", "(", "final", "Component", "<", "?", ">", "component", ",", "final", "MultiMap", "<", "String", ",", "Method", ">", "lifecycleMethod", ",", "final", "Class", "<", "?", "extends", "Annotation", ">", "ann...
Store annotated method related to a lifecycle phase. @param component the JRebirth component to manage @param lifecycleMethod the map that store methods @param annotationClass the annotation related to lifecycle phase
[ "Store", "annotated", "method", "related", "to", "a", "lifecycle", "phase", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/ComponentEnhancer.java#L212-L219
FINRAOS/DataGenerator
dg-core/src/main/java/org/finra/datagenerator/consumer/DataConsumer.java
DataConsumer.transformAndReturn
public List<Map<String, String>> transformAndReturn(Map<String, String> initialVars) { this.dataPipe = new DataPipe(this); // Set initial variables for (Map.Entry<String, String> ent : initialVars.entrySet()) { dataPipe.getDataMap().put(ent.getKey(), ent.getValue()); } // Call transformers for (DataTransformer dc : dataTransformers) { dc.transform(dataPipe); } List<Map<String, String>> result = new LinkedList<>(); result.add(dataPipe.getDataMap()); return result; }
java
public List<Map<String, String>> transformAndReturn(Map<String, String> initialVars) { this.dataPipe = new DataPipe(this); // Set initial variables for (Map.Entry<String, String> ent : initialVars.entrySet()) { dataPipe.getDataMap().put(ent.getKey(), ent.getValue()); } // Call transformers for (DataTransformer dc : dataTransformers) { dc.transform(dataPipe); } List<Map<String, String>> result = new LinkedList<>(); result.add(dataPipe.getDataMap()); return result; }
[ "public", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "transformAndReturn", "(", "Map", "<", "String", ",", "String", ">", "initialVars", ")", "{", "this", ".", "dataPipe", "=", "new", "DataPipe", "(", "this", ")", ";", "// Set initial va...
Consumes a produced result. Calls every transformer in sequence, then returns the produced result(s) back to the caller Children may override this class to produce more than one consumed result @param initialVars a map containing the initial variables assignments @return the produced output map
[ "Consumes", "a", "produced", "result", ".", "Calls", "every", "transformer", "in", "sequence", "then", "returns", "the", "produced", "result", "(", "s", ")", "back", "to", "the", "caller" ]
train
https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/consumer/DataConsumer.java#L172-L188
nmdp-bioinformatics/ngs
feature/src/main/java/org/nmdp/ngs/feature/Allele.java
Allele.leftHardClip
public Allele leftHardClip(final String pattern) throws IllegalAlphabetException, AlleleException, IllegalSymbolException { int start = this.getStart(); SymbolList copy = DNATools.createDNA(sequence.seqString()); while (copy.seqString().startsWith(pattern)) { copy.edit(new Edit(1, pattern.length(), SymbolList.EMPTY_LIST)); start += pattern.length(); } return builder() .withContig(this.getContig()) .withStart(start) .withEnd(this.getEnd()) .withSequence(copy) .withLesion(this.lesion) .build(); }
java
public Allele leftHardClip(final String pattern) throws IllegalAlphabetException, AlleleException, IllegalSymbolException { int start = this.getStart(); SymbolList copy = DNATools.createDNA(sequence.seqString()); while (copy.seqString().startsWith(pattern)) { copy.edit(new Edit(1, pattern.length(), SymbolList.EMPTY_LIST)); start += pattern.length(); } return builder() .withContig(this.getContig()) .withStart(start) .withEnd(this.getEnd()) .withSequence(copy) .withLesion(this.lesion) .build(); }
[ "public", "Allele", "leftHardClip", "(", "final", "String", "pattern", ")", "throws", "IllegalAlphabetException", ",", "AlleleException", ",", "IllegalSymbolException", "{", "int", "start", "=", "this", ".", "getStart", "(", ")", ";", "SymbolList", "copy", "=", ...
A method to simulate hard clipping (removal) of leftmost sequence, for example synthesized sequence representing molecular barcodes or target capture probes (primers) @param pattern sequence (will be strictly matched, no regular expressions) @return new Allele with clipped sequence @throws IllegalAlphabetException @throws AlleleException @throws IllegalSymbolException
[ "A", "method", "to", "simulate", "hard", "clipping", "(", "removal", ")", "of", "leftmost", "sequence", "for", "example", "synthesized", "sequence", "representing", "molecular", "barcodes", "or", "target", "capture", "probes", "(", "primers", ")" ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/feature/src/main/java/org/nmdp/ngs/feature/Allele.java#L376-L392
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java
MapComposedElement.setPointAt
public final boolean setPointAt(int groupIndex, int indexInGroup, double x, double y) { return setPointAt(groupIndex, indexInGroup, x, y, false); }
java
public final boolean setPointAt(int groupIndex, int indexInGroup, double x, double y) { return setPointAt(groupIndex, indexInGroup, x, y, false); }
[ "public", "final", "boolean", "setPointAt", "(", "int", "groupIndex", ",", "int", "indexInGroup", ",", "double", "x", ",", "double", "y", ")", "{", "return", "setPointAt", "(", "groupIndex", ",", "indexInGroup", ",", "x", ",", "y", ",", "false", ")", ";"...
Set the specified point at the given index in the specified group. @param groupIndex is the index of the group @param indexInGroup is the index of the ponit in the group (0 for the first point of the group...). @param x is the new value. @param y is the new value. @return <code>true</code> if the point was set, <code>false</code> if the specified coordinates correspond to the already existing point. @throws IndexOutOfBoundsException in case of error
[ "Set", "the", "specified", "point", "at", "the", "given", "index", "in", "the", "specified", "group", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L1009-L1011
zamrokk/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/MemberServicesImpl.java
MemberServicesImpl.processTCertBatch
private List<TCert> processTCertBatch(GetTCertBatchRequest req, TCertCreateSetResp resp) throws NoSuchPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, CryptoException, IOException { String enrollKey = req.getEnrollment().getKey(); byte[] tCertOwnerKDFKey = resp.getCerts().getKey().toByteArray(); List<Ca.TCert> tCerts = resp.getCerts().getCertsList(); byte[] byte1 = new byte[]{1}; byte[] byte2 = new byte[]{2}; byte[] tCertOwnerEncryptKey = Arrays.copyOfRange(cryptoPrimitives.calculateMac(tCertOwnerKDFKey, byte1), 0, 32); byte[] expansionKey = cryptoPrimitives.calculateMac(tCertOwnerKDFKey, byte2); List<TCert> tCertBatch = new ArrayList<>(tCerts.size()); // Loop through certs and extract private keys for (Ca.TCert tCert : tCerts) { X509Certificate x509Certificate; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); x509Certificate = (X509Certificate)cf.generateCertificate(tCert.getCert().newInput()); } catch (Exception ex) { logger.debug("Warning: problem parsing certificate bytes; retrying ... ", ex); continue; } // extract the encrypted bytes from extension attribute byte[] tCertIndexCT = fromDer(x509Certificate.getExtensionValue(TCERT_ENC_TCERT_INDEX)); byte[] tCertIndex = cryptoPrimitives.aesCBCPKCS7Decrypt(tCertOwnerEncryptKey, tCertIndexCT); byte[] expansionValue = cryptoPrimitives.calculateMac(expansionKey, tCertIndex); // compute the private key BigInteger k = new BigInteger(1, expansionValue); BigInteger n = ((ECPrivateKey)cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(enrollKey))) .getParameters().getN().subtract(BigInteger.ONE); k = k.mod(n).add(BigInteger.ONE); BigInteger D = ((ECPrivateKey) cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(enrollKey))).getD().add(k); D = D.mod(((ECPrivateKey)cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(enrollKey))).getParameters().getN()); // Put private and public key in returned tcert TCert tcert = new TCert(tCert.getCert().toByteArray(), cryptoPrimitives.ecdsaKeyFromBigInt(D)); tCertBatch.add(tcert); } if (tCertBatch.size() == 0) { throw new RuntimeException("Failed fetching TCertBatch. No valid TCert received."); } return tCertBatch; }
java
private List<TCert> processTCertBatch(GetTCertBatchRequest req, TCertCreateSetResp resp) throws NoSuchPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, CryptoException, IOException { String enrollKey = req.getEnrollment().getKey(); byte[] tCertOwnerKDFKey = resp.getCerts().getKey().toByteArray(); List<Ca.TCert> tCerts = resp.getCerts().getCertsList(); byte[] byte1 = new byte[]{1}; byte[] byte2 = new byte[]{2}; byte[] tCertOwnerEncryptKey = Arrays.copyOfRange(cryptoPrimitives.calculateMac(tCertOwnerKDFKey, byte1), 0, 32); byte[] expansionKey = cryptoPrimitives.calculateMac(tCertOwnerKDFKey, byte2); List<TCert> tCertBatch = new ArrayList<>(tCerts.size()); // Loop through certs and extract private keys for (Ca.TCert tCert : tCerts) { X509Certificate x509Certificate; try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); x509Certificate = (X509Certificate)cf.generateCertificate(tCert.getCert().newInput()); } catch (Exception ex) { logger.debug("Warning: problem parsing certificate bytes; retrying ... ", ex); continue; } // extract the encrypted bytes from extension attribute byte[] tCertIndexCT = fromDer(x509Certificate.getExtensionValue(TCERT_ENC_TCERT_INDEX)); byte[] tCertIndex = cryptoPrimitives.aesCBCPKCS7Decrypt(tCertOwnerEncryptKey, tCertIndexCT); byte[] expansionValue = cryptoPrimitives.calculateMac(expansionKey, tCertIndex); // compute the private key BigInteger k = new BigInteger(1, expansionValue); BigInteger n = ((ECPrivateKey)cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(enrollKey))) .getParameters().getN().subtract(BigInteger.ONE); k = k.mod(n).add(BigInteger.ONE); BigInteger D = ((ECPrivateKey) cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(enrollKey))).getD().add(k); D = D.mod(((ECPrivateKey)cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(enrollKey))).getParameters().getN()); // Put private and public key in returned tcert TCert tcert = new TCert(tCert.getCert().toByteArray(), cryptoPrimitives.ecdsaKeyFromBigInt(D)); tCertBatch.add(tcert); } if (tCertBatch.size() == 0) { throw new RuntimeException("Failed fetching TCertBatch. No valid TCert received."); } return tCertBatch; }
[ "private", "List", "<", "TCert", ">", "processTCertBatch", "(", "GetTCertBatchRequest", "req", ",", "TCertCreateSetResp", "resp", ")", "throws", "NoSuchPaddingException", ",", "InvalidKeyException", ",", "NoSuchAlgorithmException", ",", "IllegalBlockSizeException", ",", "...
Process a batch of tcerts after having retrieved them from the TCA.
[ "Process", "a", "batch", "of", "tcerts", "after", "having", "retrieved", "them", "from", "the", "TCA", "." ]
train
https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/MemberServicesImpl.java#L281-L333
arquillian/arquillian-algeron
common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java
GitOperations.pullFromRepository
public PullResult pullFromRepository(Git git, String remote, String remoteBranch) { try { return git.pull() .setRemote(remote) .setRemoteBranchName(remoteBranch) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
java
public PullResult pullFromRepository(Git git, String remote, String remoteBranch) { try { return git.pull() .setRemote(remote) .setRemoteBranchName(remoteBranch) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
[ "public", "PullResult", "pullFromRepository", "(", "Git", "git", ",", "String", "remote", ",", "String", "remoteBranch", ")", "{", "try", "{", "return", "git", ".", "pull", "(", ")", ".", "setRemote", "(", "remote", ")", ".", "setRemoteBranchName", "(", "r...
Pull repository from current branch and remote branch with same name as current @param git instance. @param remote to be used. @param remoteBranch to use.
[ "Pull", "repository", "from", "current", "branch", "and", "remote", "branch", "with", "same", "name", "as", "current" ]
train
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L259-L268
paymill/paymill-java
src/main/java/com/paymill/services/SubscriptionService.java
SubscriptionService.endTrialAt
public Subscription endTrialAt( String subscription, Date date ) { return this.endTrialAt( new Subscription( subscription ), date ); }
java
public Subscription endTrialAt( String subscription, Date date ) { return this.endTrialAt( new Subscription( subscription ), date ); }
[ "public", "Subscription", "endTrialAt", "(", "String", "subscription", ",", "Date", "date", ")", "{", "return", "this", ".", "endTrialAt", "(", "new", "Subscription", "(", "subscription", ")", ",", "date", ")", ";", "}" ]
Stop the trial period of a subscription on a specific date. @param subscription the subscription. @param date the date, on which the subscription should end. @return the updated subscription.
[ "Stop", "the", "trial", "period", "of", "a", "subscription", "on", "a", "specific", "date", "." ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L540-L542
google/closure-compiler
src/com/google/javascript/jscomp/ConstParamCheck.java
ConstParamCheck.isSafeValue
private boolean isSafeValue(Scope scope, Node argument) { if (NodeUtil.isSomeCompileTimeConstStringValue(argument)) { return true; } else if (argument.isAdd()) { Node left = argument.getFirstChild(); Node right = argument.getLastChild(); return isSafeValue(scope, left) && isSafeValue(scope, right); } else if (argument.isName()) { String name = argument.getString(); Var var = scope.getVar(name); if (var == null || !var.isInferredConst()) { return false; } Node initialValue = var.getInitialValue(); if (initialValue == null) { return false; } return isSafeValue(var.getScope(), initialValue); } return false; }
java
private boolean isSafeValue(Scope scope, Node argument) { if (NodeUtil.isSomeCompileTimeConstStringValue(argument)) { return true; } else if (argument.isAdd()) { Node left = argument.getFirstChild(); Node right = argument.getLastChild(); return isSafeValue(scope, left) && isSafeValue(scope, right); } else if (argument.isName()) { String name = argument.getString(); Var var = scope.getVar(name); if (var == null || !var.isInferredConst()) { return false; } Node initialValue = var.getInitialValue(); if (initialValue == null) { return false; } return isSafeValue(var.getScope(), initialValue); } return false; }
[ "private", "boolean", "isSafeValue", "(", "Scope", "scope", ",", "Node", "argument", ")", "{", "if", "(", "NodeUtil", ".", "isSomeCompileTimeConstStringValue", "(", "argument", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "argument", ".", ...
Checks if the method call argument is made of constant string literals. <p>This function argument checker will return true if: <ol> <li>The argument is a constant variable assigned from a string literal, or <li>The argument is an expression that is a string literal, or <li>The argument is a ternary expression choosing between string literals, or <li>The argument is a concatenation of the above. </ol> @param scope The scope chain to use in name lookups. @param argument The node of function argument to check.
[ "Checks", "if", "the", "method", "call", "argument", "is", "made", "of", "constant", "string", "literals", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ConstParamCheck.java#L118-L138
authlete/authlete-java-common
src/main/java/com/authlete/common/api/AuthleteApiException.java
AuthleteApiException.setResponse
private void setResponse(int statusCode, String statusMessage, String responseBody, Map<String, List<String>> responseHeaders) { mStatusCode = statusCode; mStatusMessage = statusMessage; mResponseBody = responseBody; mResponseHeaders = responseHeaders; }
java
private void setResponse(int statusCode, String statusMessage, String responseBody, Map<String, List<String>> responseHeaders) { mStatusCode = statusCode; mStatusMessage = statusMessage; mResponseBody = responseBody; mResponseHeaders = responseHeaders; }
[ "private", "void", "setResponse", "(", "int", "statusCode", ",", "String", "statusMessage", ",", "String", "responseBody", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "responseHeaders", ")", "{", "mStatusCode", "=", "statusCode", ";", "m...
Set the data fields related to HTTP response information. @param statusCode HTTP status code. @param statusMessage HTTP status message. @param responseBody HTTP response body.
[ "Set", "the", "data", "fields", "related", "to", "HTTP", "response", "information", "." ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiException.java#L293-L299
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java
ContainerServicesInner.beginCreateOrUpdateAsync
public Observable<ContainerServiceInner> beginCreateOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).map(new Func1<ServiceResponse<ContainerServiceInner>, ContainerServiceInner>() { @Override public ContainerServiceInner call(ServiceResponse<ContainerServiceInner> response) { return response.body(); } }); }
java
public Observable<ContainerServiceInner> beginCreateOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).map(new Func1<ServiceResponse<ContainerServiceInner>, ContainerServiceInner>() { @Override public ContainerServiceInner call(ServiceResponse<ContainerServiceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContainerServiceInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "containerServiceName", ",", "ContainerServiceInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", ...
Creates or updates a container service. Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. @param resourceGroupName The name of the resource group. @param containerServiceName The name of the container service in the specified subscription and resource group. @param parameters Parameters supplied to the Create or Update a Container Service operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContainerServiceInner object
[ "Creates", "or", "updates", "a", "container", "service", ".", "Creates", "or", "updates", "a", "container", "service", "with", "the", "specified", "configuration", "of", "orchestrator", "masters", "and", "agents", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java#L339-L346
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceGetter.java
V1InstanceGetter.messageReceipts
Collection<MessageReceipt> messageReceipts(MessageReceiptFilter filter) { return get(MessageReceipt.class, (filter != null) ? filter : new MessageReceiptFilter()); }
java
Collection<MessageReceipt> messageReceipts(MessageReceiptFilter filter) { return get(MessageReceipt.class, (filter != null) ? filter : new MessageReceiptFilter()); }
[ "Collection", "<", "MessageReceipt", ">", "messageReceipts", "(", "MessageReceiptFilter", "filter", ")", "{", "return", "get", "(", "MessageReceipt", ".", "class", ",", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "MessageReceiptFilter", "(", "...
/* public Collection<Conversation> conversations(ConversationFilter filter) { return get(Conversation.class, (filter != null) ? filter : new ConversationFilter()); }
[ "/", "*", "public", "Collection<Conversation", ">", "conversations", "(", "ConversationFilter", "filter", ")", "{", "return", "get", "(", "Conversation", ".", "class", "(", "filter", "!", "=", "null", ")", "?", "filter", ":", "new", "ConversationFilter", "()",...
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L360-L362
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java
ArgumentAttr.attribArg
Type attribArg(JCTree tree, Env<AttrContext> env) { Env<AttrContext> prevEnv = this.env; try { this.env = env; tree.accept(this); return result; } finally { this.env = prevEnv; } }
java
Type attribArg(JCTree tree, Env<AttrContext> env) { Env<AttrContext> prevEnv = this.env; try { this.env = env; tree.accept(this); return result; } finally { this.env = prevEnv; } }
[ "Type", "attribArg", "(", "JCTree", "tree", ",", "Env", "<", "AttrContext", ">", "env", ")", "{", "Env", "<", "AttrContext", ">", "prevEnv", "=", "this", ".", "env", ";", "try", "{", "this", ".", "env", "=", "env", ";", "tree", ".", "accept", "(", ...
Main entry point for attributing an argument with given tree and attribution environment.
[ "Main", "entry", "point", "for", "attributing", "an", "argument", "with", "given", "tree", "and", "attribution", "environment", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java#L189-L198
bushidowallet/bushido-java-service
bushido-wallet-service/src/main/java/com/authy/api/Users.java
Users.createUser
public com.authy.api.User createUser(String email, String phone, String countryCode) { User user = new User(email, phone, countryCode); String content = this.post(NEW_USER_PATH, user); return userFromXml(this.getStatus(), content); }
java
public com.authy.api.User createUser(String email, String phone, String countryCode) { User user = new User(email, phone, countryCode); String content = this.post(NEW_USER_PATH, user); return userFromXml(this.getStatus(), content); }
[ "public", "com", ".", "authy", ".", "api", ".", "User", "createUser", "(", "String", "email", ",", "String", "phone", ",", "String", "countryCode", ")", "{", "User", "user", "=", "new", "User", "(", "email", ",", "phone", ",", "countryCode", ")", ";", ...
Create a new user using his e-mail, phone and country code. @param email @param phone @param countryCode @return a User instance
[ "Create", "a", "new", "user", "using", "his", "e", "-", "mail", "phone", "and", "country", "code", "." ]
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-wallet-service/src/main/java/com/authy/api/Users.java#L43-L49
cchantep/acolyte
jdbc-java8/src/main/java/acolyte/jdbc/Java8CompositeHandler.java
Java8CompositeHandler.withUpdateHandler1
public Java8CompositeHandler withUpdateHandler1(CountUpdateHandler h) { final UpdateHandler uh = new UpdateHandler() { public UpdateResult apply(String sql, List<Parameter> ps) { return new UpdateResult(h.apply(sql, ps)); } }; return withUpdateHandler(uh); }
java
public Java8CompositeHandler withUpdateHandler1(CountUpdateHandler h) { final UpdateHandler uh = new UpdateHandler() { public UpdateResult apply(String sql, List<Parameter> ps) { return new UpdateResult(h.apply(sql, ps)); } }; return withUpdateHandler(uh); }
[ "public", "Java8CompositeHandler", "withUpdateHandler1", "(", "CountUpdateHandler", "h", ")", "{", "final", "UpdateHandler", "uh", "=", "new", "UpdateHandler", "(", ")", "{", "public", "UpdateResult", "apply", "(", "String", "sql", ",", "List", "<", "Parameter", ...
Returns handler that delegates update execution to |h| function. Given function will be used only if executed statement is not detected as a query by withQueryDetection. @param h the new update handler <pre> {@code import acolyte.jdbc.UpdateResult; import acolyte.jdbc.StatementHandler.Parameter; import static acolyte.jdbc.AcolyteDSL.handleStatement; handleStatement.withUpdateHandler1((String sql, List<Parameter> ps) -> { if (sql == "INSERT INTO Country (code, name) VALUES (?, ?)") { return 1; // update count } else return 0; }); } </pre>
[ "Returns", "handler", "that", "delegates", "update", "execution", "to", "|h|", "function", ".", "Given", "function", "will", "be", "used", "only", "if", "executed", "statement", "is", "not", "detected", "as", "a", "query", "by", "withQueryDetection", "." ]
train
https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-java8/src/main/java/acolyte/jdbc/Java8CompositeHandler.java#L199-L207
stratosphere/stratosphere
stratosphere-addons/hbase/src/main/java/eu/stratosphere/addons/hbase/TableInputFormat.java
TableInputFormat.mapResultToRecord
public void mapResultToRecord(Record record, HBaseKey key, HBaseResult result) { record.setField(0, key); record.setField(1, result); }
java
public void mapResultToRecord(Record record, HBaseKey key, HBaseResult result) { record.setField(0, key); record.setField(1, result); }
[ "public", "void", "mapResultToRecord", "(", "Record", "record", ",", "HBaseKey", "key", ",", "HBaseResult", "result", ")", "{", "record", ".", "setField", "(", "0", ",", "key", ")", ";", "record", ".", "setField", "(", "1", ",", "result", ")", ";", "}"...
Maps the current HBase Result into a Record. This implementation simply stores the HBaseKey at position 0, and the HBase Result object at position 1. @param record @param key @param result
[ "Maps", "the", "current", "HBase", "Result", "into", "a", "Record", ".", "This", "implementation", "simply", "stores", "the", "HBaseKey", "at", "position", "0", "and", "the", "HBase", "Result", "object", "at", "position", "1", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/hbase/src/main/java/eu/stratosphere/addons/hbase/TableInputFormat.java#L257-L260
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DevicesManagementApi.java
DevicesManagementApi.getStatusesHistory
public TaskStatusesHistoryEnvelope getStatusesHistory(String tid, String did) throws ApiException { ApiResponse<TaskStatusesHistoryEnvelope> resp = getStatusesHistoryWithHttpInfo(tid, did); return resp.getData(); }
java
public TaskStatusesHistoryEnvelope getStatusesHistory(String tid, String did) throws ApiException { ApiResponse<TaskStatusesHistoryEnvelope> resp = getStatusesHistoryWithHttpInfo(tid, did); return resp.getData(); }
[ "public", "TaskStatusesHistoryEnvelope", "getStatusesHistory", "(", "String", "tid", ",", "String", "did", ")", "throws", "ApiException", "{", "ApiResponse", "<", "TaskStatusesHistoryEnvelope", ">", "resp", "=", "getStatusesHistoryWithHttpInfo", "(", "tid", ",", "did", ...
Returns the history of the status changes for a specific task id, or for a specific device id in that task. Returns the history of the status changes for a specific task id, or for a specific device id in that task. @param tid Task ID. (required) @param did Device ID. Optional. (optional) @return TaskStatusesHistoryEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Returns", "the", "history", "of", "the", "status", "changes", "for", "a", "specific", "task", "id", "or", "for", "a", "specific", "device", "id", "in", "that", "task", ".", "Returns", "the", "history", "of", "the", "status", "changes", "for", "a", "spec...
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L1023-L1026
kite-sdk/kite
kite-minicluster/src/main/java/org/apache/flume/sink/kite/KerberosUtil.java
KerberosUtil.runPrivileged
public static <T> T runPrivileged(UserGroupInformation login, PrivilegedExceptionAction<T> action) { try { if (login == null) { return action.run(); } else { return login.doAs(action); } } catch (IOException ex) { throw new DatasetIOException("Privileged action failed", ex); } catch (InterruptedException ex) { Thread.interrupted(); throw new DatasetException(ex); } catch (Exception ex) { throw Throwables.propagate(ex); } }
java
public static <T> T runPrivileged(UserGroupInformation login, PrivilegedExceptionAction<T> action) { try { if (login == null) { return action.run(); } else { return login.doAs(action); } } catch (IOException ex) { throw new DatasetIOException("Privileged action failed", ex); } catch (InterruptedException ex) { Thread.interrupted(); throw new DatasetException(ex); } catch (Exception ex) { throw Throwables.propagate(ex); } }
[ "public", "static", "<", "T", ">", "T", "runPrivileged", "(", "UserGroupInformation", "login", ",", "PrivilegedExceptionAction", "<", "T", ">", "action", ")", "{", "try", "{", "if", "(", "login", "==", "null", ")", "{", "return", "action", ".", "run", "(...
Allow methods to act with the privileges of a login. If the login is null, the current privileges will be used. @param <T> The return type of the action @param login UserGroupInformation credentials to use for action @param action A PrivilegedExceptionAction to perform as another user @return the T value returned by action.run()
[ "Allow", "methods", "to", "act", "with", "the", "privileges", "of", "a", "login", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-minicluster/src/main/java/org/apache/flume/sink/kite/KerberosUtil.java#L159-L175
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/SslTlsUtil.java
SslTlsUtil.initializeTrustManagers
public static TrustManager[] initializeTrustManagers(File _trustStoreFile, String _trustStorePassword) throws IOException { if (_trustStoreFile == null) { return null; } String storeType = getStoreTypeByFileName(_trustStoreFile); boolean derEncoded = storeType == STORETYPE_DER_ENCODED; if (derEncoded) { storeType = STORETYPE_JKS; } String trustStorePwd = StringUtil.defaultIfBlank(_trustStorePassword, System.getProperty("javax.net.ssl.trustStorePassword")); LOGGER.debug("Creating trust store of type '" + storeType + "' from " + (derEncoded ? "DER-encoded" : "") + " file '" + _trustStoreFile + "'"); try { TrustManagerFactory trustMgrFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); KeyStore trustStore = KeyStore.getInstance(storeType); if (derEncoded) { FileInputStream fis = new FileInputStream(_trustStoreFile); X509Certificate certificate = (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(fis); trustStore.load(null, null); trustStore.setCertificateEntry("[der_cert_alias]", certificate); } else { trustStore.load(new FileInputStream(_trustStoreFile), trustStorePwd != null ? trustStorePwd.toCharArray() : null); } trustMgrFactory.init(trustStore); return trustMgrFactory.getTrustManagers(); } catch (GeneralSecurityException _ex) { throw new IOException("Error while setting up trustStore", _ex); } }
java
public static TrustManager[] initializeTrustManagers(File _trustStoreFile, String _trustStorePassword) throws IOException { if (_trustStoreFile == null) { return null; } String storeType = getStoreTypeByFileName(_trustStoreFile); boolean derEncoded = storeType == STORETYPE_DER_ENCODED; if (derEncoded) { storeType = STORETYPE_JKS; } String trustStorePwd = StringUtil.defaultIfBlank(_trustStorePassword, System.getProperty("javax.net.ssl.trustStorePassword")); LOGGER.debug("Creating trust store of type '" + storeType + "' from " + (derEncoded ? "DER-encoded" : "") + " file '" + _trustStoreFile + "'"); try { TrustManagerFactory trustMgrFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); KeyStore trustStore = KeyStore.getInstance(storeType); if (derEncoded) { FileInputStream fis = new FileInputStream(_trustStoreFile); X509Certificate certificate = (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(fis); trustStore.load(null, null); trustStore.setCertificateEntry("[der_cert_alias]", certificate); } else { trustStore.load(new FileInputStream(_trustStoreFile), trustStorePwd != null ? trustStorePwd.toCharArray() : null); } trustMgrFactory.init(trustStore); return trustMgrFactory.getTrustManagers(); } catch (GeneralSecurityException _ex) { throw new IOException("Error while setting up trustStore", _ex); } }
[ "public", "static", "TrustManager", "[", "]", "initializeTrustManagers", "(", "File", "_trustStoreFile", ",", "String", "_trustStorePassword", ")", "throws", "IOException", "{", "if", "(", "_trustStoreFile", "==", "null", ")", "{", "return", "null", ";", "}", "S...
Initialization of trustStoreManager used to provide access to the configured trustStore. @param _trustStoreFile trust store file @param _trustStorePassword trust store password @return TrustManager array or null @throws IOException on error
[ "Initialization", "of", "trustStoreManager", "used", "to", "provide", "access", "to", "the", "configured", "trustStore", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/SslTlsUtil.java#L47-L80
netty/netty
transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java
AbstractKQueueStreamChannel.writeBytes
private int writeBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception { int readableBytes = buf.readableBytes(); if (readableBytes == 0) { in.remove(); return 0; } if (buf.hasMemoryAddress() || buf.nioBufferCount() == 1) { return doWriteBytes(in, buf); } else { ByteBuffer[] nioBuffers = buf.nioBuffers(); return writeBytesMultiple(in, nioBuffers, nioBuffers.length, readableBytes, config().getMaxBytesPerGatheringWrite()); } }
java
private int writeBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception { int readableBytes = buf.readableBytes(); if (readableBytes == 0) { in.remove(); return 0; } if (buf.hasMemoryAddress() || buf.nioBufferCount() == 1) { return doWriteBytes(in, buf); } else { ByteBuffer[] nioBuffers = buf.nioBuffers(); return writeBytesMultiple(in, nioBuffers, nioBuffers.length, readableBytes, config().getMaxBytesPerGatheringWrite()); } }
[ "private", "int", "writeBytes", "(", "ChannelOutboundBuffer", "in", ",", "ByteBuf", "buf", ")", "throws", "Exception", "{", "int", "readableBytes", "=", "buf", ".", "readableBytes", "(", ")", ";", "if", "(", "readableBytes", "==", "0", ")", "{", "in", ".",...
Write bytes form the given {@link ByteBuf} to the underlying {@link java.nio.channels.Channel}. @param in the collection which contains objects to write. @param buf the {@link ByteBuf} from which the bytes should be written @return The value that should be decremented from the write quantum which starts at {@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows: <ul> <li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content) is encountered</li> <li>1 - if a single call to write data was made to the OS</li> <li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no data was accepted</li> </ul>
[ "Write", "bytes", "form", "the", "given", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java#L103-L117
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/util/JobStateToJsonConverter.java
JobStateToJsonConverter.writeJobStates
private void writeJobStates(JsonWriter jsonWriter, List<? extends JobState> jobStates) throws IOException { jsonWriter.beginArray(); for (JobState jobState : jobStates) { writeJobState(jsonWriter, jobState); } jsonWriter.endArray(); }
java
private void writeJobStates(JsonWriter jsonWriter, List<? extends JobState> jobStates) throws IOException { jsonWriter.beginArray(); for (JobState jobState : jobStates) { writeJobState(jsonWriter, jobState); } jsonWriter.endArray(); }
[ "private", "void", "writeJobStates", "(", "JsonWriter", "jsonWriter", ",", "List", "<", "?", "extends", "JobState", ">", "jobStates", ")", "throws", "IOException", "{", "jsonWriter", ".", "beginArray", "(", ")", ";", "for", "(", "JobState", "jobState", ":", ...
Write a list of {@link JobState}s to json document. @param jsonWriter {@link com.google.gson.stream.JsonWriter} @param jobStates list of {@link JobState}s to write to json document @throws IOException
[ "Write", "a", "list", "of", "{", "@link", "JobState", "}", "s", "to", "json", "document", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/util/JobStateToJsonConverter.java#L148-L154
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java
CommerceNotificationAttachmentPersistenceImpl.findByUuid_C
@Override public List<CommerceNotificationAttachment> findByUuid_C(String uuid, long companyId, int start, int end) { return findByUuid_C(uuid, companyId, start, end, null); }
java
@Override public List<CommerceNotificationAttachment> findByUuid_C(String uuid, long companyId, int start, int end) { return findByUuid_C(uuid, companyId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceNotificationAttachment", ">", "findByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "s...
Returns a range of all the commerce notification attachments where uuid = &#63; and companyId = &#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 CommerceNotificationAttachmentModelImpl}. 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 uuid the uuid @param companyId the company ID @param start the lower bound of the range of commerce notification attachments @param end the upper bound of the range of commerce notification attachments (not inclusive) @return the range of matching commerce notification attachments
[ "Returns", "a", "range", "of", "all", "the", "commerce", "notification", "attachments", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L964-L968
tango-controls/JTango
server/src/main/java/org/tango/server/admin/AdminDevice.java
AdminDevice.getPollStatus
@Command(name = "DevPollStatus", inTypeDesc = DEVICE_NAME, outTypeDesc = "Device polling status") public String[] getPollStatus(final String deviceName) throws DevFailed { xlogger.entry(deviceName); String[] ret = new PollStatusCommand(deviceName, classList).call(); xlogger.exit(ret); return ret; }
java
@Command(name = "DevPollStatus", inTypeDesc = DEVICE_NAME, outTypeDesc = "Device polling status") public String[] getPollStatus(final String deviceName) throws DevFailed { xlogger.entry(deviceName); String[] ret = new PollStatusCommand(deviceName, classList).call(); xlogger.exit(ret); return ret; }
[ "@", "Command", "(", "name", "=", "\"DevPollStatus\"", ",", "inTypeDesc", "=", "DEVICE_NAME", ",", "outTypeDesc", "=", "\"Device polling status\"", ")", "public", "String", "[", "]", "getPollStatus", "(", "final", "String", "deviceName", ")", "throws", "DevFailed"...
get the polling status @param deviceName Device name @return Device polling status @throws DevFailed
[ "get", "the", "polling", "status" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L149-L156
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.createSingle
public static IDLProxyObject createSingle(InputStream is, boolean debug) throws IOException { return createSingle(is, debug, null, true); }
java
public static IDLProxyObject createSingle(InputStream is, boolean debug) throws IOException { return createSingle(is, debug, null, true); }
[ "public", "static", "IDLProxyObject", "createSingle", "(", "InputStream", "is", ",", "boolean", "debug", ")", "throws", "IOException", "{", "return", "createSingle", "(", "is", ",", "debug", ",", "null", ",", "true", ")", ";", "}" ]
Creates the single. @param is the is @param debug the debug @return the IDL proxy object @throws IOException Signals that an I/O exception has occurred.
[ "Creates", "the", "single", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L976-L978
hyunjun19/axu4j
axu4j-tag/src/main/java/com/axisj/axu4j/tags/TagUtils.java
TagUtils.getElValue
public static Object getElValue(JspContext context, String elName) { VariableResolver variableResolver = context.getVariableResolver(); Object var = null; try { elName = TagUtils.getElName(elName); var = variableResolver.resolveVariable(elName); logger.debug("ExpressionLanguage variable {} is [{}]", elName, var); } catch (ELException e) { logger.error("ExpressionLanguage Error", e); } return var; }
java
public static Object getElValue(JspContext context, String elName) { VariableResolver variableResolver = context.getVariableResolver(); Object var = null; try { elName = TagUtils.getElName(elName); var = variableResolver.resolveVariable(elName); logger.debug("ExpressionLanguage variable {} is [{}]", elName, var); } catch (ELException e) { logger.error("ExpressionLanguage Error", e); } return var; }
[ "public", "static", "Object", "getElValue", "(", "JspContext", "context", ",", "String", "elName", ")", "{", "VariableResolver", "variableResolver", "=", "context", ".", "getVariableResolver", "(", ")", ";", "Object", "var", "=", "null", ";", "try", "{", "elNa...
"${...}" EL 명을 Object 값으로 변환한다. @param context @param elName @return
[ "$", "{", "...", "}", "EL", "명을", "Object", "값으로", "변환한다", "." ]
train
https://github.com/hyunjun19/axu4j/blob/a7eaf698a4ebe160b4ba22789fc543cdc50b3d64/axu4j-tag/src/main/java/com/axisj/axu4j/tags/TagUtils.java#L86-L98
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/io/UrlIO.java
UrlIO.evalXPath
@Override @Scope(DocScope.IO) public XPathEvaluator evalXPath(final String xpath) { return new DefaultXPathEvaluator(projector, new DocumentResolver() { @Override public Document resolve(final Class<?>... resourceAwareClasses) throws IOException { return IOHelper.getDocumentFromURL(projector.config().createDocumentBuilder(), url, requestProperties, resourceAwareClasses); } }, xpath); }
java
@Override @Scope(DocScope.IO) public XPathEvaluator evalXPath(final String xpath) { return new DefaultXPathEvaluator(projector, new DocumentResolver() { @Override public Document resolve(final Class<?>... resourceAwareClasses) throws IOException { return IOHelper.getDocumentFromURL(projector.config().createDocumentBuilder(), url, requestProperties, resourceAwareClasses); } }, xpath); }
[ "@", "Override", "@", "Scope", "(", "DocScope", ".", "IO", ")", "public", "XPathEvaluator", "evalXPath", "(", "final", "String", "xpath", ")", "{", "return", "new", "DefaultXPathEvaluator", "(", "projector", ",", "new", "DocumentResolver", "(", ")", "{", "@"...
Evaluate XPath on the url document. @param xpath @return xpath evaluator @see org.xmlbeam.evaluation.CanEvaluate#evalXPath(java.lang.String)
[ "Evaluate", "XPath", "on", "the", "url", "document", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/io/UrlIO.java#L124-L133
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java
ESigList.fireEvent
private void fireEvent(String action, ESigItem item) { if (eventManager != null) { eventManager.fireLocalEvent("ESIG." + action, item); } }
java
private void fireEvent(String action, ESigItem item) { if (eventManager != null) { eventManager.fireLocalEvent("ESIG." + action, item); } }
[ "private", "void", "fireEvent", "(", "String", "action", ",", "ESigItem", "item", ")", "{", "if", "(", "eventManager", "!=", "null", ")", "{", "eventManager", ".", "fireLocalEvent", "(", "\"ESIG.\"", "+", "action", ",", "item", ")", ";", "}", "}" ]
Notifies subscribers of changes to the list by firing an ESIG.[action] event. @param action Name of the action. This becomes a subtype of the ESIG event. @param item The item for which the action occurred.
[ "Notifies", "subscribers", "of", "changes", "to", "the", "list", "by", "firing", "an", "ESIG", ".", "[", "action", "]", "event", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java#L212-L216
m-m-m/util
collection/src/main/java/net/sf/mmm/util/collection/base/RankMap.java
RankMap.addRank
public int addRank(E element, int gain) { Ranking ranking = this.map.get(element); if (ranking == null) { if (gain == 0) { return 0; } ranking = new Ranking(); this.map.put(element, ranking); } ranking.addRank(gain); return ranking.rank; }
java
public int addRank(E element, int gain) { Ranking ranking = this.map.get(element); if (ranking == null) { if (gain == 0) { return 0; } ranking = new Ranking(); this.map.put(element, ranking); } ranking.addRank(gain); return ranking.rank; }
[ "public", "int", "addRank", "(", "E", "element", ",", "int", "gain", ")", "{", "Ranking", "ranking", "=", "this", ".", "map", ".", "get", "(", "element", ")", ";", "if", "(", "ranking", "==", "null", ")", "{", "if", "(", "gain", "==", "0", ")", ...
This method adds the given {@code gain} to the current {@link #getRank(Object) rank} of the given {@code element}. If the {@code element} is {@link #setUnacceptable(Object) unacceptable}, this method will have no effect. This method guarantees that there will be no overflow of the {@link #getRank(Object) rank}. @param element is the element to rank. @param gain is the value to add to the current rank. It may be negative to reduce the rank. A value of {@code 0} will have no effect. @return the new rank.
[ "This", "method", "adds", "the", "given", "{", "@code", "gain", "}", "to", "the", "current", "{", "@link", "#getRank", "(", "Object", ")", "rank", "}", "of", "the", "given", "{", "@code", "element", "}", ".", "If", "the", "{", "@code", "element", "}"...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/collection/src/main/java/net/sf/mmm/util/collection/base/RankMap.java#L124-L136
h2oai/h2o-3
h2o-core/src/main/java/water/api/AlgoAbstractRegister.java
AlgoAbstractRegister.registerModelBuilder
protected final void registerModelBuilder(RestApiContext context, ModelBuilder mbProto, int version) { Class<? extends water.api.Handler> handlerClass = water.api.ModelBuilderHandler.class; if (H2O.ARGS.features_level.compareTo(mbProto.builderVisibility()) > 0) { return; // Skip endpoint registration } String base = mbProto.getClass().getSimpleName(); String lbase = base.toLowerCase(); // This is common model builder handler context.registerEndpoint( "train_" + lbase, "POST /" + version + "/ModelBuilders/" + lbase, handlerClass, "train", "Train a " + base + " model." ); context.registerEndpoint( "validate_" + lbase, "POST /" + version + "/ModelBuilders/" + lbase + "/parameters", handlerClass, "validate_parameters", "Validate a set of " + base + " model builder parameters." ); // Grid search is experimental feature context.registerEndpoint( "grid_search_" + lbase, "POST /99/Grid/" + lbase, GridSearchHandler.class, "train", "Run grid search for " + base + " model." ); }
java
protected final void registerModelBuilder(RestApiContext context, ModelBuilder mbProto, int version) { Class<? extends water.api.Handler> handlerClass = water.api.ModelBuilderHandler.class; if (H2O.ARGS.features_level.compareTo(mbProto.builderVisibility()) > 0) { return; // Skip endpoint registration } String base = mbProto.getClass().getSimpleName(); String lbase = base.toLowerCase(); // This is common model builder handler context.registerEndpoint( "train_" + lbase, "POST /" + version + "/ModelBuilders/" + lbase, handlerClass, "train", "Train a " + base + " model." ); context.registerEndpoint( "validate_" + lbase, "POST /" + version + "/ModelBuilders/" + lbase + "/parameters", handlerClass, "validate_parameters", "Validate a set of " + base + " model builder parameters." ); // Grid search is experimental feature context.registerEndpoint( "grid_search_" + lbase, "POST /99/Grid/" + lbase, GridSearchHandler.class, "train", "Run grid search for " + base + " model." ); }
[ "protected", "final", "void", "registerModelBuilder", "(", "RestApiContext", "context", ",", "ModelBuilder", "mbProto", ",", "int", "version", ")", "{", "Class", "<", "?", "extends", "water", ".", "api", ".", "Handler", ">", "handlerClass", "=", "water", ".", ...
Register algorithm common REST interface. @param mbProto prototype instance of algorithm model builder @param version registration version
[ "Register", "algorithm", "common", "REST", "interface", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/AlgoAbstractRegister.java#L17-L50
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/values/ReplaceWith.java
ReplaceWith.with
public JcString with(JcString with) { JcString ret = new JcString(with, this, new FunctionInstance(FUNCTION.String.REPLACE, 3)); QueryRecorder.recordInvocationConditional(this, "with", ret, QueryRecorder.placeHolder(with)); return ret; }
java
public JcString with(JcString with) { JcString ret = new JcString(with, this, new FunctionInstance(FUNCTION.String.REPLACE, 3)); QueryRecorder.recordInvocationConditional(this, "with", ret, QueryRecorder.placeHolder(with)); return ret; }
[ "public", "JcString", "with", "(", "JcString", "with", ")", "{", "JcString", "ret", "=", "new", "JcString", "(", "with", ",", "this", ",", "new", "FunctionInstance", "(", "FUNCTION", ".", "String", ".", "REPLACE", ",", "3", ")", ")", ";", "QueryRecorder"...
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>specify the replacement for a part of a string</i></div> <br/>
[ "<div", "color", "=", "red", "style", "=", "font", "-", "size", ":", "24px", ";", "color", ":", "red", ">", "<b", ">", "<i", ">", "<u", ">", "JCYPHER<", "/", "u", ">", "<", "/", "i", ">", "<", "/", "b", ">", "<", "/", "div", ">", "<div", ...
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/ReplaceWith.java#L53-L58
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.getReferenceCollection
public <T, K> JacksonDBCollection<T, K> getReferenceCollection(String collectionName, JavaType type, JavaType keyType) { return getReferenceCollection(new JacksonCollectionKey(collectionName, type, keyType)); }
java
public <T, K> JacksonDBCollection<T, K> getReferenceCollection(String collectionName, JavaType type, JavaType keyType) { return getReferenceCollection(new JacksonCollectionKey(collectionName, type, keyType)); }
[ "public", "<", "T", ",", "K", ">", "JacksonDBCollection", "<", "T", ",", "K", ">", "getReferenceCollection", "(", "String", "collectionName", ",", "JavaType", "type", ",", "JavaType", "keyType", ")", "{", "return", "getReferenceCollection", "(", "new", "Jackso...
Get a collection for loading a reference of the given type @param collectionName The name of the collection @param type The type of the object @param keyType the type of the id @return The collection
[ "Get", "a", "collection", "for", "loading", "a", "reference", "of", "the", "given", "type" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L1519-L1521
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java
UniversalTimeScale.bigDecimalFrom
public static BigDecimal bigDecimalFrom(double otherTime, int timeScale) { TimeScaleData data = getTimeScaleData(timeScale); BigDecimal other = new BigDecimal(String.valueOf(otherTime)); BigDecimal units = new BigDecimal(data.units); BigDecimal epochOffset = new BigDecimal(data.epochOffset); return other.add(epochOffset).multiply(units); }
java
public static BigDecimal bigDecimalFrom(double otherTime, int timeScale) { TimeScaleData data = getTimeScaleData(timeScale); BigDecimal other = new BigDecimal(String.valueOf(otherTime)); BigDecimal units = new BigDecimal(data.units); BigDecimal epochOffset = new BigDecimal(data.epochOffset); return other.add(epochOffset).multiply(units); }
[ "public", "static", "BigDecimal", "bigDecimalFrom", "(", "double", "otherTime", ",", "int", "timeScale", ")", "{", "TimeScaleData", "data", "=", "getTimeScaleData", "(", "timeScale", ")", ";", "BigDecimal", "other", "=", "new", "BigDecimal", "(", "String", ".", ...
Convert a <code>double</code> datetime from the given time scale to the universal time scale. All calculations are done using <code>BigDecimal</code> to guarantee that the value does not go out of range. @param otherTime The <code>double</code> datetime @param timeScale The time scale to convert from @return The datetime converted to the universal time scale
[ "Convert", "a", "<code", ">", "double<", "/", "code", ">", "datetime", "from", "the", "given", "time", "scale", "to", "the", "universal", "time", "scale", ".", "All", "calculations", "are", "done", "using", "<code", ">", "BigDecimal<", "/", "code", ">", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java#L352-L360
OpenSextant/SolrTextTagger
src/main/java/org/opensextant/solrtexttagger/TaggerRequestHandler.java
TaggerRequestHandler.computeDocCorpus
private Bits computeDocCorpus(SolrQueryRequest req) throws SyntaxError, IOException { final String[] corpusFilterQueries = req.getParams().getParams("fq"); final SolrIndexSearcher searcher = req.getSearcher(); final Bits docBits; if (corpusFilterQueries != null && corpusFilterQueries.length > 0) { List<Query> filterQueries = new ArrayList<Query>(corpusFilterQueries.length); for (String corpusFilterQuery : corpusFilterQueries) { QParser qParser = QParser.getParser(corpusFilterQuery, null, req); try { filterQueries.add(qParser.parse()); } catch (SyntaxError e) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e); } } final DocSet docSet = searcher.getDocSet(filterQueries);//hopefully in the cache //note: before Solr 4.7 we could call docSet.getBits() but no longer. if (docSet instanceof BitDocSet) { docBits = ((BitDocSet)docSet).getBits(); } else { docBits = new Bits() { @Override public boolean get(int index) { return docSet.exists(index); } @Override public int length() { return searcher.maxDoc(); } }; } } else { docBits = searcher.getSlowAtomicReader().getLiveDocs(); } return docBits; }
java
private Bits computeDocCorpus(SolrQueryRequest req) throws SyntaxError, IOException { final String[] corpusFilterQueries = req.getParams().getParams("fq"); final SolrIndexSearcher searcher = req.getSearcher(); final Bits docBits; if (corpusFilterQueries != null && corpusFilterQueries.length > 0) { List<Query> filterQueries = new ArrayList<Query>(corpusFilterQueries.length); for (String corpusFilterQuery : corpusFilterQueries) { QParser qParser = QParser.getParser(corpusFilterQuery, null, req); try { filterQueries.add(qParser.parse()); } catch (SyntaxError e) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e); } } final DocSet docSet = searcher.getDocSet(filterQueries);//hopefully in the cache //note: before Solr 4.7 we could call docSet.getBits() but no longer. if (docSet instanceof BitDocSet) { docBits = ((BitDocSet)docSet).getBits(); } else { docBits = new Bits() { @Override public boolean get(int index) { return docSet.exists(index); } @Override public int length() { return searcher.maxDoc(); } }; } } else { docBits = searcher.getSlowAtomicReader().getLiveDocs(); } return docBits; }
[ "private", "Bits", "computeDocCorpus", "(", "SolrQueryRequest", "req", ")", "throws", "SyntaxError", ",", "IOException", "{", "final", "String", "[", "]", "corpusFilterQueries", "=", "req", ".", "getParams", "(", ")", ".", "getParams", "(", "\"fq\"", ")", ";",...
The set of documents matching the provided 'fq' (filter query). Don't include deleted docs either. If null is returned, then all docs are available.
[ "The", "set", "of", "documents", "matching", "the", "provided", "fq", "(", "filter", "query", ")", ".", "Don", "t", "include", "deleted", "docs", "either", ".", "If", "null", "is", "returned", "then", "all", "docs", "are", "available", "." ]
train
https://github.com/OpenSextant/SolrTextTagger/blob/e7ae82b94f1490fa1b7882ada09b57071094b0a5/src/main/java/org/opensextant/solrtexttagger/TaggerRequestHandler.java#L314-L351
alkacon/opencms-core
src/org/opencms/site/CmsSite.java
CmsSite.getServerPrefix
public String getServerPrefix(CmsObject cms, String resourceName) { if (resourceName.startsWith(cms.getRequestContext().getSiteRoot())) { // make sure this can also be used with a resource root path resourceName = resourceName.substring(cms.getRequestContext().getSiteRoot().length()); } boolean secure = OpenCms.getStaticExportManager().isSecureLink( cms, resourceName, cms.getRequestContext().isSecureRequest()); return (secure ? getSecureUrl() : getUrl()); }
java
public String getServerPrefix(CmsObject cms, String resourceName) { if (resourceName.startsWith(cms.getRequestContext().getSiteRoot())) { // make sure this can also be used with a resource root path resourceName = resourceName.substring(cms.getRequestContext().getSiteRoot().length()); } boolean secure = OpenCms.getStaticExportManager().isSecureLink( cms, resourceName, cms.getRequestContext().isSecureRequest()); return (secure ? getSecureUrl() : getUrl()); }
[ "public", "String", "getServerPrefix", "(", "CmsObject", "cms", ",", "String", "resourceName", ")", "{", "if", "(", "resourceName", ".", "startsWith", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ")", ")", "{", "// make sure ...
Returns the server prefix for the given resource in this site, used to distinguish between secure (https) and non-secure (http) sites.<p> This is required since a resource may have an individual "secure" setting using the property {@link org.opencms.file.CmsPropertyDefinition#PROPERTY_SECURE}, which means this resource must be delivered only using a secure protocol.<p> The result will look like <code>http://site.enterprise.com:8080/</code> or <code>https://site.enterprise.com/</code>.<p> @param cms the current users OpenCms context @param resourceName the resource name @return the server prefix for the given resource in this site @see #getSecureUrl() @see #getUrl()
[ "Returns", "the", "server", "prefix", "for", "the", "given", "resource", "in", "this", "site", "used", "to", "distinguish", "between", "secure", "(", "https", ")", "and", "non", "-", "secure", "(", "http", ")", "sites", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSite.java#L514-L526
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ProtectedItemOperationResultsInner.java
ProtectedItemOperationResultsInner.getAsync
public Observable<ProtectedItemResourceInner> getAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String operationId) { return getWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationId).map(new Func1<ServiceResponse<ProtectedItemResourceInner>, ProtectedItemResourceInner>() { @Override public ProtectedItemResourceInner call(ServiceResponse<ProtectedItemResourceInner> response) { return response.body(); } }); }
java
public Observable<ProtectedItemResourceInner> getAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String operationId) { return getWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationId).map(new Func1<ServiceResponse<ProtectedItemResourceInner>, ProtectedItemResourceInner>() { @Override public ProtectedItemResourceInner call(ServiceResponse<ProtectedItemResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProtectedItemResourceInner", ">", "getAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "fabricName", ",", "String", "containerName", ",", "String", "protectedItemName", ",", "String", "operationId", "...
Gets the result of any operation on the backup item. @param vaultName The name of the Recovery Services vault. @param resourceGroupName The name of the resource group associated with the Recovery Services vault. @param fabricName The fabric name associated with the backup item. @param containerName The container name associated with the backup item. @param protectedItemName The name of backup item used in this GET operation. @param operationId The OperationID used in this GET operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProtectedItemResourceInner object
[ "Gets", "the", "result", "of", "any", "operation", "on", "the", "backup", "item", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ProtectedItemOperationResultsInner.java#L107-L114
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/SFTrustManager.java
SFTrustManager.calculateTolerableVadility
private static long calculateTolerableVadility(Date thisUpdate, Date nextUpdate) { return maxLong((long) ((float) (nextUpdate.getTime() - thisUpdate.getTime()) * TOLERABLE_VALIDITY_RANGE_RATIO), MIN_CACHE_WARMUP_TIME_IN_MILLISECONDS); }
java
private static long calculateTolerableVadility(Date thisUpdate, Date nextUpdate) { return maxLong((long) ((float) (nextUpdate.getTime() - thisUpdate.getTime()) * TOLERABLE_VALIDITY_RANGE_RATIO), MIN_CACHE_WARMUP_TIME_IN_MILLISECONDS); }
[ "private", "static", "long", "calculateTolerableVadility", "(", "Date", "thisUpdate", ",", "Date", "nextUpdate", ")", "{", "return", "maxLong", "(", "(", "long", ")", "(", "(", "float", ")", "(", "nextUpdate", ".", "getTime", "(", ")", "-", "thisUpdate", "...
Calculates the tolerable validity time beyond the next update. <p> Sometimes CA's OCSP response update is delayed beyond the clock skew as the update is not populated to all OCSP servers for certain period. @param thisUpdate the last update @param nextUpdate the next update @return the tolerable validity beyond the next update.
[ "Calculates", "the", "tolerable", "validity", "time", "beyond", "the", "next", "update", ".", "<p", ">", "Sometimes", "CA", "s", "OCSP", "response", "update", "is", "delayed", "beyond", "the", "clock", "skew", "as", "the", "update", "is", "not", "populated",...
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L1578-L1582
groovy/groovy-core
src/main/org/codehaus/groovy/classgen/asm/OperandStack.java
OperandStack.primitive2b
private void primitive2b(MethodVisitor mv, ClassNode type) { Label trueLabel = new Label(); Label falseLabel = new Label(); // for the various types we make first a // kind of conversion to int using a compare // operation and then handle the result common // for all cases. In case of long that is LCMP, // for int nothing is to be done if (type==ClassHelper.double_TYPE) { mv.visitInsn(DCONST_0); mv.visitInsn(DCMPL); } else if (type==ClassHelper.long_TYPE) { mv.visitInsn(LCONST_0); mv.visitInsn(LCMP); } else if (type==ClassHelper.float_TYPE) { mv.visitInsn(FCONST_0); mv.visitInsn(FCMPL); } else if (type==ClassHelper.int_TYPE) { // nothing, see comment above } mv.visitJumpInsn(IFEQ, falseLabel); mv.visitInsn(ICONST_1); mv.visitJumpInsn(GOTO, trueLabel); mv.visitLabel(falseLabel); mv.visitInsn(ICONST_0); mv.visitLabel(trueLabel); // other cases can be used directly }
java
private void primitive2b(MethodVisitor mv, ClassNode type) { Label trueLabel = new Label(); Label falseLabel = new Label(); // for the various types we make first a // kind of conversion to int using a compare // operation and then handle the result common // for all cases. In case of long that is LCMP, // for int nothing is to be done if (type==ClassHelper.double_TYPE) { mv.visitInsn(DCONST_0); mv.visitInsn(DCMPL); } else if (type==ClassHelper.long_TYPE) { mv.visitInsn(LCONST_0); mv.visitInsn(LCMP); } else if (type==ClassHelper.float_TYPE) { mv.visitInsn(FCONST_0); mv.visitInsn(FCMPL); } else if (type==ClassHelper.int_TYPE) { // nothing, see comment above } mv.visitJumpInsn(IFEQ, falseLabel); mv.visitInsn(ICONST_1); mv.visitJumpInsn(GOTO, trueLabel); mv.visitLabel(falseLabel); mv.visitInsn(ICONST_0); mv.visitLabel(trueLabel); // other cases can be used directly }
[ "private", "void", "primitive2b", "(", "MethodVisitor", "mv", ",", "ClassNode", "type", ")", "{", "Label", "trueLabel", "=", "new", "Label", "(", ")", ";", "Label", "falseLabel", "=", "new", "Label", "(", ")", ";", "// for the various types we make first a ", ...
convert primitive (not boolean) to boolean or byte. type needs to be a primitive type (not checked)
[ "convert", "primitive", "(", "not", "boolean", ")", "to", "boolean", "or", "byte", ".", "type", "needs", "to", "be", "a", "primitive", "type", "(", "not", "checked", ")" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/classgen/asm/OperandStack.java#L125-L152
BrunoEberhard/minimal-j
src/main/java/org/minimalj/frontend/form/Form.java
Form.addDependecy
public void addDependecy(Object from, Object... to) { PropertyInterface fromProperty = Keys.getProperty(from); if (!dependencies.containsKey(fromProperty.getPath())) { dependencies.put(fromProperty.getPath(), new ArrayList<PropertyInterface>()); } List<PropertyInterface> list = dependencies.get(fromProperty.getPath()); for (Object key : to) { list.add(Keys.getProperty(key)); } }
java
public void addDependecy(Object from, Object... to) { PropertyInterface fromProperty = Keys.getProperty(from); if (!dependencies.containsKey(fromProperty.getPath())) { dependencies.put(fromProperty.getPath(), new ArrayList<PropertyInterface>()); } List<PropertyInterface> list = dependencies.get(fromProperty.getPath()); for (Object key : to) { list.add(Keys.getProperty(key)); } }
[ "public", "void", "addDependecy", "(", "Object", "from", ",", "Object", "...", "to", ")", "{", "PropertyInterface", "fromProperty", "=", "Keys", ".", "getProperty", "(", "from", ")", ";", "if", "(", "!", "dependencies", ".", "containsKey", "(", "fromProperty...
Declares that if the <i>from</i> property changes all the properties with <i>to</i> could change. This is normally used if the to <i>to</i> property is a getter that calculates something that depends on the <i>from</i> in some way. @param from the key or property of the field triggering the update @param to the field possible changed its value implicitly
[ "Declares", "that", "if", "the", "<i", ">", "from<", "/", "i", ">", "property", "changes", "all", "the", "properties", "with", "<i", ">", "to<", "/", "i", ">", "could", "change", ".", "This", "is", "normally", "used", "if", "the", "to", "<i", ">", ...
train
https://github.com/BrunoEberhard/minimal-j/blob/f7c5461b2b47a10b383aee1e2f1f150f6773703b/src/main/java/org/minimalj/frontend/form/Form.java#L240-L249
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java
PaymentProtocol.createPaymentRequest
public static Protos.PaymentRequest.Builder createPaymentRequest(NetworkParameters params, @Nullable Coin amount, Address toAddress, @Nullable String memo, @Nullable String paymentUrl, @Nullable byte[] merchantData) { return createPaymentRequest(params, ImmutableList.of(createPayToAddressOutput(amount, toAddress)), memo, paymentUrl, merchantData); }
java
public static Protos.PaymentRequest.Builder createPaymentRequest(NetworkParameters params, @Nullable Coin amount, Address toAddress, @Nullable String memo, @Nullable String paymentUrl, @Nullable byte[] merchantData) { return createPaymentRequest(params, ImmutableList.of(createPayToAddressOutput(amount, toAddress)), memo, paymentUrl, merchantData); }
[ "public", "static", "Protos", ".", "PaymentRequest", ".", "Builder", "createPaymentRequest", "(", "NetworkParameters", "params", ",", "@", "Nullable", "Coin", "amount", ",", "Address", "toAddress", ",", "@", "Nullable", "String", "memo", ",", "@", "Nullable", "S...
Create a payment request with one standard pay to address output. You may want to sign the request using {@link #signPaymentRequest}. Use {@link Protos.PaymentRequest.Builder#build} to get the actual payment request. @param params network parameters @param amount amount of coins to request, or null @param toAddress address to request coins to @param memo arbitrary, user readable memo, or null if none @param paymentUrl URL to send payment message to, or null if none @param merchantData arbitrary merchant data, or null if none @return created payment request, in its builder form
[ "Create", "a", "payment", "request", "with", "one", "standard", "pay", "to", "address", "output", ".", "You", "may", "want", "to", "sign", "the", "request", "using", "{", "@link", "#signPaymentRequest", "}", ".", "Use", "{", "@link", "Protos", ".", "Paymen...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L68-L73
diirt/util
src/main/java/org/epics/util/time/Timestamp.java
Timestamp.of
public static Timestamp of(Date date) { if (date == null) return null; long time = date.getTime(); int nanoSec = (int) (time % 1000) * 1000000; long epochSec = (time / 1000); return createWithCarry(epochSec, nanoSec); }
java
public static Timestamp of(Date date) { if (date == null) return null; long time = date.getTime(); int nanoSec = (int) (time % 1000) * 1000000; long epochSec = (time / 1000); return createWithCarry(epochSec, nanoSec); }
[ "public", "static", "Timestamp", "of", "(", "Date", "date", ")", "{", "if", "(", "date", "==", "null", ")", "return", "null", ";", "long", "time", "=", "date", ".", "getTime", "(", ")", ";", "int", "nanoSec", "=", "(", "int", ")", "(", "time", "%...
Converts a {@link java.util.Date} to a timestamp. Date is accurate to milliseconds, so the last 6 digits are always going to be zeros. @param date the date to convert @return a new timestamp
[ "Converts", "a", "{", "@link", "java", ".", "util", ".", "Date", "}", "to", "a", "timestamp", ".", "Date", "is", "accurate", "to", "milliseconds", "so", "the", "last", "6", "digits", "are", "always", "going", "to", "be", "zeros", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/time/Timestamp.java#L89-L96
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/simple/SimpleBase.java
SimpleBase.set
public void set( int row , int col , double value ) { ops.set(mat, row, col, value); }
java
public void set( int row , int col , double value ) { ops.set(mat, row, col, value); }
[ "public", "void", "set", "(", "int", "row", ",", "int", "col", ",", "double", "value", ")", "{", "ops", ".", "set", "(", "mat", ",", "row", ",", "col", ",", "value", ")", ";", "}" ]
Assigns the element in the Matrix to the specified value. Performs a bounds check to make sure the requested element is part of the matrix. @param row The row of the element. @param col The column of the element. @param value The element's new value.
[ "Assigns", "the", "element", "in", "the", "Matrix", "to", "the", "specified", "value", ".", "Performs", "a", "bounds", "check", "to", "make", "sure", "the", "requested", "element", "is", "part", "of", "the", "matrix", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L615-L617
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/GeometryCollection.java
GeometryCollection.fromGeometries
public static GeometryCollection fromGeometries(@NonNull List<Geometry> geometries, @Nullable BoundingBox bbox) { return new GeometryCollection(TYPE, bbox, geometries); }
java
public static GeometryCollection fromGeometries(@NonNull List<Geometry> geometries, @Nullable BoundingBox bbox) { return new GeometryCollection(TYPE, bbox, geometries); }
[ "public", "static", "GeometryCollection", "fromGeometries", "(", "@", "NonNull", "List", "<", "Geometry", ">", "geometries", ",", "@", "Nullable", "BoundingBox", "bbox", ")", "{", "return", "new", "GeometryCollection", "(", "TYPE", ",", "bbox", ",", "geometries"...
Create a new instance of this class by giving the collection a list of {@link Geometry}. @param geometries a non-null list of geometry which makes up this collection @param bbox optionally include a bbox definition as a double array @return a new instance of this class defined by the values passed inside this static factory method @since 1.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "giving", "the", "collection", "a", "list", "of", "{", "@link", "Geometry", "}", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/GeometryCollection.java#L113-L116
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/PackedSpriteSheet.java
PackedSpriteSheet.loadDefinition
private void loadDefinition(String def, Color trans) throws SlickException { BufferedReader reader = new BufferedReader(new InputStreamReader(ResourceLoader.getResourceAsStream(def))); try { image = new Image(basePath+reader.readLine(), false, filter, trans); while (reader.ready()) { if (reader.readLine() == null) { break; } Section sect = new Section(reader); sections.put(sect.name, sect); if (reader.readLine() == null) { break; } } } catch (Exception e) { Log.error(e); throw new SlickException("Failed to process definitions file - invalid format?", e); } }
java
private void loadDefinition(String def, Color trans) throws SlickException { BufferedReader reader = new BufferedReader(new InputStreamReader(ResourceLoader.getResourceAsStream(def))); try { image = new Image(basePath+reader.readLine(), false, filter, trans); while (reader.ready()) { if (reader.readLine() == null) { break; } Section sect = new Section(reader); sections.put(sect.name, sect); if (reader.readLine() == null) { break; } } } catch (Exception e) { Log.error(e); throw new SlickException("Failed to process definitions file - invalid format?", e); } }
[ "private", "void", "loadDefinition", "(", "String", "def", ",", "Color", "trans", ")", "throws", "SlickException", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "ResourceLoader", ".", "getResourceAsStream", "(",...
Load the definition file and parse each of the sections @param def The location of the definitions file @param trans The color to be treated as transparent @throws SlickException Indicates a failure to read or parse the definitions file or referenced image.
[ "Load", "the", "definition", "file", "and", "parse", "each", "of", "the", "sections" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/PackedSpriteSheet.java#L127-L148
skjolber/3d-bin-container-packing
src/main/java/com/github/skjolberg/packing/Packager.java
Packager.packList
public List<Container> packList(List<BoxItem> boxes, int limit, long deadline, AtomicBoolean interrupt) { return packList(boxes, limit, () -> deadlineReached(deadline) || interrupt.get()); }
java
public List<Container> packList(List<BoxItem> boxes, int limit, long deadline, AtomicBoolean interrupt) { return packList(boxes, limit, () -> deadlineReached(deadline) || interrupt.get()); }
[ "public", "List", "<", "Container", ">", "packList", "(", "List", "<", "BoxItem", ">", "boxes", ",", "int", "limit", ",", "long", "deadline", ",", "AtomicBoolean", "interrupt", ")", "{", "return", "packList", "(", "boxes", ",", "limit", ",", "(", ")", ...
Return a list of containers which holds all the boxes in the argument @param boxes list of boxes to fit in a container @param limit maximum number of containers @param deadline the system time in milliseconds at which the search should be aborted @param interrupt When true, the computation is interrupted as soon as possible. @return index of container if match, -1 if not
[ "Return", "a", "list", "of", "containers", "which", "holds", "all", "the", "boxes", "in", "the", "argument" ]
train
https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/Packager.java#L249-L251
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/borland/BorlandLibrarian.java
BorlandLibrarian.quoteFilename
@Override protected String quoteFilename(final StringBuffer buf, final String filename) { buf.setLength(0); BorlandProcessor.quoteFile(buf, filename); return buf.toString(); }
java
@Override protected String quoteFilename(final StringBuffer buf, final String filename) { buf.setLength(0); BorlandProcessor.quoteFile(buf, filename); return buf.toString(); }
[ "@", "Override", "protected", "String", "quoteFilename", "(", "final", "StringBuffer", "buf", ",", "final", "String", "filename", ")", "{", "buf", ".", "setLength", "(", "0", ")", ";", "BorlandProcessor", ".", "quoteFile", "(", "buf", ",", "filename", ")", ...
Encloses problematic file names within quotes. @param buf string buffer @param filename source file name @return filename potentially enclosed in quotes.
[ "Encloses", "problematic", "file", "names", "within", "quotes", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/borland/BorlandLibrarian.java#L218-L223
cdk/cdk
tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/ModelBuilder3D.java
ModelBuilder3D.getRingSetOfAtom
private IRingSet getRingSetOfAtom(List ringSystems, IAtom atom) { IRingSet ringSetOfAtom = null; for (int i = 0; i < ringSystems.size(); i++) { if (((IRingSet) ringSystems.get(i)).contains(atom)) { return (IRingSet) ringSystems.get(i); } } return ringSetOfAtom; }
java
private IRingSet getRingSetOfAtom(List ringSystems, IAtom atom) { IRingSet ringSetOfAtom = null; for (int i = 0; i < ringSystems.size(); i++) { if (((IRingSet) ringSystems.get(i)).contains(atom)) { return (IRingSet) ringSystems.get(i); } } return ringSetOfAtom; }
[ "private", "IRingSet", "getRingSetOfAtom", "(", "List", "ringSystems", ",", "IAtom", "atom", ")", "{", "IRingSet", "ringSetOfAtom", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ringSystems", ".", "size", "(", ")", ";", "i", "++",...
Gets the ringSetOfAtom attribute of the ModelBuilder3D object. @return The ringSetOfAtom value
[ "Gets", "the", "ringSetOfAtom", "attribute", "of", "the", "ModelBuilder3D", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/ModelBuilder3D.java#L250-L258
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setFinish
public void setFinish(int index, Date value) { set(selectField(TaskFieldLists.CUSTOM_FINISH, index), value); }
java
public void setFinish(int index, Date value) { set(selectField(TaskFieldLists.CUSTOM_FINISH, index), value); }
[ "public", "void", "setFinish", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "CUSTOM_FINISH", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a finish value. @param index finish index (1-10) @param value finish value
[ "Set", "a", "finish", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L2067-L2070
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.setSelectedValue
public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) { if (value == null) { list.setSelectedIndex(0); return false; } else { int index = findValueInListBox(list, value); if (index >= 0) { list.setSelectedIndex(index); return true; } if (addMissingValues) { list.addItem(value, value); // now that it's there, search again index = findValueInListBox(list, value); list.setSelectedIndex(index); return true; } return false; } }
java
public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) { if (value == null) { list.setSelectedIndex(0); return false; } else { int index = findValueInListBox(list, value); if (index >= 0) { list.setSelectedIndex(index); return true; } if (addMissingValues) { list.addItem(value, value); // now that it's there, search again index = findValueInListBox(list, value); list.setSelectedIndex(index); return true; } return false; } }
[ "public", "static", "final", "boolean", "setSelectedValue", "(", "ListBox", "list", ",", "String", "value", ",", "boolean", "addMissingValues", ")", "{", "if", "(", "value", "==", "null", ")", "{", "list", ".", "setSelectedIndex", "(", "0", ")", ";", "retu...
Utility function to set the current value in a ListBox. @return returns true if the option corresponding to the value was successfully selected in the ListBox
[ "Utility", "function", "to", "set", "the", "current", "value", "in", "a", "ListBox", "." ]
train
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L178-L201
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_ip_GET
public ArrayList<String> dedicated_server_serviceName_ip_GET(String serviceName, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); query(sb, "blockSize", blockSize); query(sb, "country", country); query(sb, "organisationId", organisationId); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> dedicated_server_serviceName_ip_GET(String serviceName, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); query(sb, "blockSize", blockSize); query(sb, "country", country); query(sb, "organisationId", organisationId); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "dedicated_server_serviceName_ip_GET", "(", "String", "serviceName", ",", "OvhIpBlockSizeEnum", "blockSize", ",", "OvhIpCountryEnum", "country", ",", "String", "organisationId", ",", "OvhIpTypeOrderableEnum", "type", ")", "throws...
Get allowed durations for 'ip' option REST: GET /order/dedicated/server/{serviceName}/ip @param blockSize [required] IP block size @param organisationId [required] Your organisation id to add on block informations @param country [required] IP localization @param type [required] The type of IP @param serviceName [required] The internal name of your dedicated server
[ "Get", "allowed", "durations", "for", "ip", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2388-L2397
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebProviderAuthenticatorProxy.java
WebProviderAuthenticatorProxy.attemptToRemoveLtpaToken
private void attemptToRemoveLtpaToken(WebRequest webRequest, HashMap<String, Object> props) { SSOCookieHelper ssoCh = webAppSecurityConfig.createSSOCookieHelper(); if (!isFormLogin(props)) { HttpServletResponse res = webRequest.getHttpServletResponse(); if (!res.isCommitted()) { ssoCh.removeSSOCookieFromResponse(res); } } }
java
private void attemptToRemoveLtpaToken(WebRequest webRequest, HashMap<String, Object> props) { SSOCookieHelper ssoCh = webAppSecurityConfig.createSSOCookieHelper(); if (!isFormLogin(props)) { HttpServletResponse res = webRequest.getHttpServletResponse(); if (!res.isCommitted()) { ssoCh.removeSSOCookieFromResponse(res); } } }
[ "private", "void", "attemptToRemoveLtpaToken", "(", "WebRequest", "webRequest", ",", "HashMap", "<", "String", ",", "Object", ">", "props", ")", "{", "SSOCookieHelper", "ssoCh", "=", "webAppSecurityConfig", ".", "createSSOCookieHelper", "(", ")", ";", "if", "(", ...
/* Remove LTPA token if this is not a FORM login and the JASPI provider has not committed the response.
[ "/", "*", "Remove", "LTPA", "token", "if", "this", "is", "not", "a", "FORM", "login", "and", "the", "JASPI", "provider", "has", "not", "committed", "the", "response", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebProviderAuthenticatorProxy.java#L302-L310
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy.java
vpntrafficpolicy.get
public static vpntrafficpolicy get(nitro_service service, String name) throws Exception{ vpntrafficpolicy obj = new vpntrafficpolicy(); obj.set_name(name); vpntrafficpolicy response = (vpntrafficpolicy) obj.get_resource(service); return response; }
java
public static vpntrafficpolicy get(nitro_service service, String name) throws Exception{ vpntrafficpolicy obj = new vpntrafficpolicy(); obj.set_name(name); vpntrafficpolicy response = (vpntrafficpolicy) obj.get_resource(service); return response; }
[ "public", "static", "vpntrafficpolicy", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "vpntrafficpolicy", "obj", "=", "new", "vpntrafficpolicy", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "...
Use this API to fetch vpntrafficpolicy resource of given name .
[ "Use", "this", "API", "to", "fetch", "vpntrafficpolicy", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy.java#L317-L322
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/taglib/ImageTagUtils.java
ImageTagUtils.getImageUrl
public static String getImageUrl(String imgSrc, PageContext pageContext) { BinaryResourcesHandler imgRsHandler = (BinaryResourcesHandler) pageContext.getServletContext() .getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE); if (null == imgRsHandler) throw new JawrLinkRenderingException( "You are using a Jawr image tag while the Jawr Image servlet has not been initialized. Initialization of Jawr Image servlet either failed or never occurred."); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); return getImageUrl(imgSrc, imgRsHandler, request, response); }
java
public static String getImageUrl(String imgSrc, PageContext pageContext) { BinaryResourcesHandler imgRsHandler = (BinaryResourcesHandler) pageContext.getServletContext() .getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE); if (null == imgRsHandler) throw new JawrLinkRenderingException( "You are using a Jawr image tag while the Jawr Image servlet has not been initialized. Initialization of Jawr Image servlet either failed or never occurred."); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); return getImageUrl(imgSrc, imgRsHandler, request, response); }
[ "public", "static", "String", "getImageUrl", "(", "String", "imgSrc", ",", "PageContext", "pageContext", ")", "{", "BinaryResourcesHandler", "imgRsHandler", "=", "(", "BinaryResourcesHandler", ")", "pageContext", ".", "getServletContext", "(", ")", ".", "getAttribute"...
Sames as its counterpart, only meant to be used as a JSP EL function. @param imgSrc the image path @param pageContext the page context @return the image URL
[ "Sames", "as", "its", "counterpart", "only", "meant", "to", "be", "used", "as", "a", "JSP", "EL", "function", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/taglib/ImageTagUtils.java#L180-L193
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java
ProjectTreeController.addCalendarException
private void addCalendarException(MpxjTreeNode parentNode, final ProjectCalendarException exception) { MpxjTreeNode exceptionNode = new MpxjTreeNode(exception, CALENDAR_EXCEPTION_EXCLUDED_METHODS) { @Override public String toString() { return m_dateFormat.format(exception.getFromDate()); } }; parentNode.add(exceptionNode); addHours(exceptionNode, exception); }
java
private void addCalendarException(MpxjTreeNode parentNode, final ProjectCalendarException exception) { MpxjTreeNode exceptionNode = new MpxjTreeNode(exception, CALENDAR_EXCEPTION_EXCLUDED_METHODS) { @Override public String toString() { return m_dateFormat.format(exception.getFromDate()); } }; parentNode.add(exceptionNode); addHours(exceptionNode, exception); }
[ "private", "void", "addCalendarException", "(", "MpxjTreeNode", "parentNode", ",", "final", "ProjectCalendarException", "exception", ")", "{", "MpxjTreeNode", "exceptionNode", "=", "new", "MpxjTreeNode", "(", "exception", ",", "CALENDAR_EXCEPTION_EXCLUDED_METHODS", ")", "...
Add an exception to a calendar. @param parentNode parent node @param exception calendar exceptions
[ "Add", "an", "exception", "to", "a", "calendar", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L333-L344
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/defuzzifier/Centroid.java
Centroid.defuzzify
@Override public double defuzzify(Term term, double minimum, double maximum) { if (!Op.isFinite(minimum + maximum)) { return Double.NaN; } final int resolution = getResolution(); final double dx = (maximum - minimum) / resolution; double x, y; double area = 0; double xcentroid = 0; //double ycentroid = 0; for (int i = 0; i < resolution; ++i) { x = minimum + (i + 0.5) * dx; y = term.membership(x); xcentroid += y * x; //ycentroid += y * y; area += y; } //Final results not computed for efficiency //xcentroid /= area; //ycentroid /= 2 * area; //area *= dx; return xcentroid / area; }
java
@Override public double defuzzify(Term term, double minimum, double maximum) { if (!Op.isFinite(minimum + maximum)) { return Double.NaN; } final int resolution = getResolution(); final double dx = (maximum - minimum) / resolution; double x, y; double area = 0; double xcentroid = 0; //double ycentroid = 0; for (int i = 0; i < resolution; ++i) { x = minimum + (i + 0.5) * dx; y = term.membership(x); xcentroid += y * x; //ycentroid += y * y; area += y; } //Final results not computed for efficiency //xcentroid /= area; //ycentroid /= 2 * area; //area *= dx; return xcentroid / area; }
[ "@", "Override", "public", "double", "defuzzify", "(", "Term", "term", ",", "double", "minimum", ",", "double", "maximum", ")", "{", "if", "(", "!", "Op", ".", "isFinite", "(", "minimum", "+", "maximum", ")", ")", "{", "return", "Double", ".", "NaN", ...
Computes the centroid of a fuzzy set. The defuzzification process integrates over the fuzzy set utilizing the boundaries given as parameters. The integration algorithm is the midpoint rectangle method (https://en.wikipedia.org/wiki/Rectangle_method). @param term is the fuzzy set @param minimum is the minimum value of the fuzzy set @param maximum is the maximum value of the fuzzy set @return the `x`-coordinate of the centroid of the fuzzy set
[ "Computes", "the", "centroid", "of", "a", "fuzzy", "set", ".", "The", "defuzzification", "process", "integrates", "over", "the", "fuzzy", "set", "utilizing", "the", "boundaries", "given", "as", "parameters", ".", "The", "integration", "algorithm", "is", "the", ...
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/defuzzifier/Centroid.java#L53-L79
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java
DifferentialFunctionFactory.matchCondition
public SDVariable matchCondition(SDVariable in, Condition condition) { return new MatchConditionTransform(sameDiff(), in, condition).outputVariable(); }
java
public SDVariable matchCondition(SDVariable in, Condition condition) { return new MatchConditionTransform(sameDiff(), in, condition).outputVariable(); }
[ "public", "SDVariable", "matchCondition", "(", "SDVariable", "in", ",", "Condition", "condition", ")", "{", "return", "new", "MatchConditionTransform", "(", "sameDiff", "(", ")", ",", "in", ",", "condition", ")", ".", "outputVariable", "(", ")", ";", "}" ]
Returns a boolean mask of equal shape to the input, where the condition is satisfied @param in Input @param condition Condition @return Boolean mask
[ "Returns", "a", "boolean", "mask", "of", "equal", "shape", "to", "the", "input", "where", "the", "condition", "is", "satisfied" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L723-L725
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java
MemorizeTransactionProxy.memorize
protected static Statement memorize(final Statement target, final ConnectionHandle connectionHandle) { return (Statement) Proxy.newProxyInstance( StatementProxy.class.getClassLoader(), new Class[] {StatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
java
protected static Statement memorize(final Statement target, final ConnectionHandle connectionHandle) { return (Statement) Proxy.newProxyInstance( StatementProxy.class.getClassLoader(), new Class[] {StatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
[ "protected", "static", "Statement", "memorize", "(", "final", "Statement", "target", ",", "final", "ConnectionHandle", "connectionHandle", ")", "{", "return", "(", "Statement", ")", "Proxy", ".", "newProxyInstance", "(", "StatementProxy", ".", "class", ".", "getCl...
Wrap Statement with a proxy. @param target statement handle @param connectionHandle originating bonecp connection @return Proxy to a statement.
[ "Wrap", "Statement", "with", "a", "proxy", "." ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java#L92-L97
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.initTimeWarp
protected void initTimeWarp(CmsUserSettings settings, HttpSession session) { long timeWarpConf = settings.getTimeWarp(); Long timeWarpSetLong = (Long)session.getAttribute(CmsContextInfo.ATTRIBUTE_REQUEST_TIME); long timeWarpSet = (timeWarpSetLong != null) ? timeWarpSetLong.longValue() : CmsContextInfo.CURRENT_TIME; if (timeWarpConf == CmsContextInfo.CURRENT_TIME) { // delete: if (timeWarpSetLong != null) { // we may come from direct_edit.jsp: don't remove attribute, this is session.removeAttribute(CmsContextInfo.ATTRIBUTE_REQUEST_TIME); } } else { // this is dominant: if configured we will use it if (timeWarpSet != timeWarpConf) { session.setAttribute(CmsContextInfo.ATTRIBUTE_REQUEST_TIME, new Long(timeWarpConf)); } } }
java
protected void initTimeWarp(CmsUserSettings settings, HttpSession session) { long timeWarpConf = settings.getTimeWarp(); Long timeWarpSetLong = (Long)session.getAttribute(CmsContextInfo.ATTRIBUTE_REQUEST_TIME); long timeWarpSet = (timeWarpSetLong != null) ? timeWarpSetLong.longValue() : CmsContextInfo.CURRENT_TIME; if (timeWarpConf == CmsContextInfo.CURRENT_TIME) { // delete: if (timeWarpSetLong != null) { // we may come from direct_edit.jsp: don't remove attribute, this is session.removeAttribute(CmsContextInfo.ATTRIBUTE_REQUEST_TIME); } } else { // this is dominant: if configured we will use it if (timeWarpSet != timeWarpConf) { session.setAttribute(CmsContextInfo.ATTRIBUTE_REQUEST_TIME, new Long(timeWarpConf)); } } }
[ "protected", "void", "initTimeWarp", "(", "CmsUserSettings", "settings", ",", "HttpSession", "session", ")", "{", "long", "timeWarpConf", "=", "settings", ".", "getTimeWarp", "(", ")", ";", "Long", "timeWarpSetLong", "=", "(", "Long", ")", "session", ".", "get...
Sets the users time warp if configured and if the current timewarp setting is different or clears the current time warp setting if the user has no configured timewarp.<p> Timwarping is controlled by the session attribute {@link CmsContextInfo#ATTRIBUTE_REQUEST_TIME} with a value of type <code>Long</code>.<p> @param settings the user settings which are configured via the preferences dialog @param session the session of the user
[ "Sets", "the", "users", "time", "warp", "if", "configured", "and", "if", "the", "current", "timewarp", "setting", "is", "different", "or", "clears", "the", "current", "time", "warp", "setting", "if", "the", "user", "has", "no", "configured", "timewarp", ".",...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L2298-L2316
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java
MapPolyline.getDistance
@Override @Pure public final double getDistance(Point2D<?, ?> point) { if (isWidePolyline()) { return distance(point, getWidth()); } return distance(point, 0); }
java
@Override @Pure public final double getDistance(Point2D<?, ?> point) { if (isWidePolyline()) { return distance(point, getWidth()); } return distance(point, 0); }
[ "@", "Override", "@", "Pure", "public", "final", "double", "getDistance", "(", "Point2D", "<", "?", ",", "?", ">", "point", ")", "{", "if", "(", "isWidePolyline", "(", ")", ")", "{", "return", "distance", "(", "point", ",", "getWidth", "(", ")", ")",...
Replies the distance between this MapElement and point. @return the distance. Should be negative depending of the MapElement type.
[ "Replies", "the", "distance", "between", "this", "MapElement", "and", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L133-L140
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBDeleteExpression.java
DynamoDBDeleteExpression.withExpectedEntry
public DynamoDBDeleteExpression withExpectedEntry(String attributeName, ExpectedAttributeValue expected) { if (expectedAttributes == null) { expectedAttributes = new HashMap<String,ExpectedAttributeValue>(); } expectedAttributes.put(attributeName, expected); return this; }
java
public DynamoDBDeleteExpression withExpectedEntry(String attributeName, ExpectedAttributeValue expected) { if (expectedAttributes == null) { expectedAttributes = new HashMap<String,ExpectedAttributeValue>(); } expectedAttributes.put(attributeName, expected); return this; }
[ "public", "DynamoDBDeleteExpression", "withExpectedEntry", "(", "String", "attributeName", ",", "ExpectedAttributeValue", "expected", ")", "{", "if", "(", "expectedAttributes", "==", "null", ")", "{", "expectedAttributes", "=", "new", "HashMap", "<", "String", ",", ...
Adds one entry to the expected conditions and returns a pointer to this object for method-chaining. @param attributeName The name of the attribute. @param expected The expected attribute value.
[ "Adds", "one", "entry", "to", "the", "expected", "conditions", "and", "returns", "a", "pointer", "to", "this", "object", "for", "method", "-", "chaining", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBDeleteExpression.java#L98-L104
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.eraseValue
private void eraseValue(HeaderElement elem) { // wipe out the removed value if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Erasing existing header: " + elem.getName()); } int next_index = this.lastCRLFBufferIndex; int next_pos = this.lastCRLFPosition; if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) { next_index = elem.nextSequence.getLastCRLFBufferIndex(); next_pos = elem.nextSequence.getLastCRLFPosition(); } int start = elem.getLastCRLFPosition(); // if it's only in one buffer, this for loop does nothing for (int x = elem.getLastCRLFBufferIndex(); x < next_index; x++) { // wiping out this buffer from start to limit this.parseBuffers[x].position(start); this.parseBuffers[x].limit(start); start = 0; } // last buffer, scribble from start until next_pos scribbleWhiteSpace(this.parseBuffers[next_index], start, next_pos); }
java
private void eraseValue(HeaderElement elem) { // wipe out the removed value if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Erasing existing header: " + elem.getName()); } int next_index = this.lastCRLFBufferIndex; int next_pos = this.lastCRLFPosition; if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) { next_index = elem.nextSequence.getLastCRLFBufferIndex(); next_pos = elem.nextSequence.getLastCRLFPosition(); } int start = elem.getLastCRLFPosition(); // if it's only in one buffer, this for loop does nothing for (int x = elem.getLastCRLFBufferIndex(); x < next_index; x++) { // wiping out this buffer from start to limit this.parseBuffers[x].position(start); this.parseBuffers[x].limit(start); start = 0; } // last buffer, scribble from start until next_pos scribbleWhiteSpace(this.parseBuffers[next_index], start, next_pos); }
[ "private", "void", "eraseValue", "(", "HeaderElement", "elem", ")", "{", "// wipe out the removed value", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ...
Method to completely erase the input header from the parse buffers. @param elem
[ "Method", "to", "completely", "erase", "the", "input", "header", "from", "the", "parse", "buffers", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L1234-L1255
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/SubscriptionsApi.java
SubscriptionsApi.getMessagesAsync
public com.squareup.okhttp.Call getMessagesAsync(String notifId, Integer offset, Integer count, String order, final ApiCallback<NotifMessagesResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getMessagesValidateBeforeCall(notifId, offset, count, order, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<NotifMessagesResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getMessagesAsync(String notifId, Integer offset, Integer count, String order, final ApiCallback<NotifMessagesResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getMessagesValidateBeforeCall(notifId, offset, count, order, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<NotifMessagesResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getMessagesAsync", "(", "String", "notifId", ",", "Integer", "offset", ",", "Integer", "count", ",", "String", "order", ",", "final", "ApiCallback", "<", "NotifMessagesResponse", ">", "callback", "...
Get Messages (asynchronously) Get Messages @param notifId Notification ID. (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set. (optional) @param order Sort order of results by ts. Either &#39;asc&#39; or &#39;desc&#39;. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "Messages", "(", "asynchronously", ")", "Get", "Messages" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/SubscriptionsApi.java#L531-L556
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java
JMapperAPI.localAttribute
public static LocalAttribute localAttribute(String name, String customGet, String customSet){ return new LocalAttribute(name, customGet, customSet); }
java
public static LocalAttribute localAttribute(String name, String customGet, String customSet){ return new LocalAttribute(name, customGet, customSet); }
[ "public", "static", "LocalAttribute", "localAttribute", "(", "String", "name", ",", "String", "customGet", ",", "String", "customSet", ")", "{", "return", "new", "LocalAttribute", "(", "name", ",", "customGet", ",", "customSet", ")", ";", "}" ]
Permits to define a local attribute. @param name local attribute name @param customGet custom get method @param customSet custom set method @return an instance of LocalAttribute
[ "Permits", "to", "define", "a", "local", "attribute", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java#L127-L129
google/closure-compiler
src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
ProcessClosurePrimitives.verifyLastArgumentIsString
private boolean verifyLastArgumentIsString(Node methodName, Node arg) { return verifyNotNull(methodName, arg) && verifyOfType(methodName, arg, Token.STRING) && verifyIsLast(methodName, arg); }
java
private boolean verifyLastArgumentIsString(Node methodName, Node arg) { return verifyNotNull(methodName, arg) && verifyOfType(methodName, arg, Token.STRING) && verifyIsLast(methodName, arg); }
[ "private", "boolean", "verifyLastArgumentIsString", "(", "Node", "methodName", ",", "Node", "arg", ")", "{", "return", "verifyNotNull", "(", "methodName", ",", "arg", ")", "&&", "verifyOfType", "(", "methodName", ",", "arg", ",", "Token", ".", "STRING", ")", ...
Verifies that a method call has exactly one argument, and that it's a string literal. Reports a compile error if it doesn't. @return Whether the argument checked out okay
[ "Verifies", "that", "a", "method", "call", "has", "exactly", "one", "argument", "and", "that", "it", "s", "a", "string", "literal", ".", "Reports", "a", "compile", "error", "if", "it", "doesn", "t", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java#L956-L960
rubenlagus/TelegramBots
telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/InputMedia.java
InputMedia.setMedia
public T setMedia(InputStream mediaStream, String fileName) { this.newMediaStream = mediaStream; this.isNewMedia = true; this.mediaName = fileName; this.media = "attach://" + fileName; return (T) this; }
java
public T setMedia(InputStream mediaStream, String fileName) { this.newMediaStream = mediaStream; this.isNewMedia = true; this.mediaName = fileName; this.media = "attach://" + fileName; return (T) this; }
[ "public", "T", "setMedia", "(", "InputStream", "mediaStream", ",", "String", "fileName", ")", "{", "this", ".", "newMediaStream", "=", "mediaStream", ";", "this", ".", "isNewMedia", "=", "true", ";", "this", ".", "mediaName", "=", "fileName", ";", "this", ...
Use this setter to send new file as stream. @param mediaStream File to send @return This object
[ "Use", "this", "setter", "to", "send", "new", "file", "as", "stream", "." ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/InputMedia.java#L104-L110
keenon/loglinear
src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java
GraphicalModel.addFactor
public VectorFactor addFactor(int[] neighborIndices, int[] neighborDimensions, Function<int[], ConcatVector> assignmentFeaturizer) { ConcatVectorTable features = new ConcatVectorTable(neighborDimensions); for (int[] assignment : features) { features.setAssignmentValue(assignment, () -> assignmentFeaturizer.apply(assignment)); } return addFactor(features, neighborIndices); }
java
public VectorFactor addFactor(int[] neighborIndices, int[] neighborDimensions, Function<int[], ConcatVector> assignmentFeaturizer) { ConcatVectorTable features = new ConcatVectorTable(neighborDimensions); for (int[] assignment : features) { features.setAssignmentValue(assignment, () -> assignmentFeaturizer.apply(assignment)); } return addFactor(features, neighborIndices); }
[ "public", "VectorFactor", "addFactor", "(", "int", "[", "]", "neighborIndices", ",", "int", "[", "]", "neighborDimensions", ",", "Function", "<", "int", "[", "]", ",", "ConcatVector", ">", "assignmentFeaturizer", ")", "{", "ConcatVectorTable", "features", "=", ...
This is the preferred way to add factors to a graphical model. Specify the neighbors, their dimensions, and a function that maps from variable assignments to ConcatVector's of features, and this function will handle the data flow of constructing and populating a factor matching those specifications. <p> IMPORTANT: assignmentFeaturizer must be REPEATABLE and NOT HAVE SIDE EFFECTS This is because it is actually stored as a lazy closure until the full featurized vector is needed, and then it is created, used, and discarded. It CAN BE CALLED MULTIPLE TIMES, and must always return the same value in order for behavior of downstream systems to be defined. @param neighborIndices the names of the variables, as indices @param neighborDimensions the sizes of the neighbor variables, corresponding to the order in neighborIndices @param assignmentFeaturizer a function that maps from an assignment to the variables, represented as an array of assignments in the same order as presented in neighborIndices, to a ConcatVector of features for that assignment. @return a reference to the created factor. This can be safely ignored, as the factor is already saved in the model
[ "This", "is", "the", "preferred", "way", "to", "add", "factors", "to", "a", "graphical", "model", ".", "Specify", "the", "neighbors", "their", "dimensions", "and", "a", "function", "that", "maps", "from", "variable", "assignments", "to", "ConcatVector", "s", ...
train
https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L419-L426
rhuss/jolokia
agent/core/src/main/java/org/jolokia/discovery/MulticastUtil.java
MulticastUtil.sendDiscoveryRequests
private static List<Future<List<DiscoveryIncomingMessage>>> sendDiscoveryRequests(DiscoveryOutgoingMessage pOutMsg, int pTimeout, LogHandler pLogHandler) throws SocketException, UnknownHostException { // Note for Ipv6 support: If there are two local addresses, one with IpV6 and one with IpV4 then two discovery request // should be sent, on each interface respectively. Currently, only IpV4 is supported. List<InetAddress> addresses = getMulticastAddresses(); ExecutorService executor = Executors.newFixedThreadPool(addresses.size()); final List<Future<List<DiscoveryIncomingMessage>>> futures = new ArrayList<Future<List<DiscoveryIncomingMessage>>>(addresses.size()); for (InetAddress address : addresses) { // Discover UDP packet send to multicast address DatagramPacket out = pOutMsg.createDatagramPacket(InetAddress.getByName(JOLOKIA_MULTICAST_GROUP), JOLOKIA_MULTICAST_PORT); Callable<List<DiscoveryIncomingMessage>> findAgentsCallable = new FindAgentsCallable(address, out, pTimeout, pLogHandler); futures.add(executor.submit(findAgentsCallable)); } executor.shutdownNow(); return futures; }
java
private static List<Future<List<DiscoveryIncomingMessage>>> sendDiscoveryRequests(DiscoveryOutgoingMessage pOutMsg, int pTimeout, LogHandler pLogHandler) throws SocketException, UnknownHostException { // Note for Ipv6 support: If there are two local addresses, one with IpV6 and one with IpV4 then two discovery request // should be sent, on each interface respectively. Currently, only IpV4 is supported. List<InetAddress> addresses = getMulticastAddresses(); ExecutorService executor = Executors.newFixedThreadPool(addresses.size()); final List<Future<List<DiscoveryIncomingMessage>>> futures = new ArrayList<Future<List<DiscoveryIncomingMessage>>>(addresses.size()); for (InetAddress address : addresses) { // Discover UDP packet send to multicast address DatagramPacket out = pOutMsg.createDatagramPacket(InetAddress.getByName(JOLOKIA_MULTICAST_GROUP), JOLOKIA_MULTICAST_PORT); Callable<List<DiscoveryIncomingMessage>> findAgentsCallable = new FindAgentsCallable(address, out, pTimeout, pLogHandler); futures.add(executor.submit(findAgentsCallable)); } executor.shutdownNow(); return futures; }
[ "private", "static", "List", "<", "Future", "<", "List", "<", "DiscoveryIncomingMessage", ">", ">", ">", "sendDiscoveryRequests", "(", "DiscoveryOutgoingMessage", "pOutMsg", ",", "int", "pTimeout", ",", "LogHandler", "pLogHandler", ")", "throws", "SocketException", ...
Send requests in parallel threads, return the futures for getting the result
[ "Send", "requests", "in", "parallel", "threads", "return", "the", "futures", "for", "getting", "the", "result" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/discovery/MulticastUtil.java#L76-L92