repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
mangstadt/biweekly
src/main/java/biweekly/util/com/google/ical/util/TimeUtils.java
TimeUtils.timetMillisFromEpochSecs
private static long timetMillisFromEpochSecs(long epochSecs, TimeZone zone) { """ Get a "time_t" in milliseconds given a number of seconds since the Dershowitz/Reingold epoch relative to a given timezone. @param epochSecs the number of seconds since the Dershowitz/Reingold epoch relative to the given timezone @param zone timezone against which epochSecs applies @return the number of milliseconds since 00:00:00 Jan 1, 1970 GMT """ DateTimeValue date = timeFromSecsSinceEpoch(epochSecs); Calendar cal = new GregorianCalendar(zone); cal.clear(); cal.set(date.year(), date.month() - 1, date.day(), date.hour(), date.minute(), date.second()); return cal.getTimeInMillis(); }
java
private static long timetMillisFromEpochSecs(long epochSecs, TimeZone zone) { DateTimeValue date = timeFromSecsSinceEpoch(epochSecs); Calendar cal = new GregorianCalendar(zone); cal.clear(); cal.set(date.year(), date.month() - 1, date.day(), date.hour(), date.minute(), date.second()); return cal.getTimeInMillis(); }
[ "private", "static", "long", "timetMillisFromEpochSecs", "(", "long", "epochSecs", ",", "TimeZone", "zone", ")", "{", "DateTimeValue", "date", "=", "timeFromSecsSinceEpoch", "(", "epochSecs", ")", ";", "Calendar", "cal", "=", "new", "GregorianCalendar", "(", "zone", ")", ";", "cal", ".", "clear", "(", ")", ";", "cal", ".", "set", "(", "date", ".", "year", "(", ")", ",", "date", ".", "month", "(", ")", "-", "1", ",", "date", ".", "day", "(", ")", ",", "date", ".", "hour", "(", ")", ",", "date", ".", "minute", "(", ")", ",", "date", ".", "second", "(", ")", ")", ";", "return", "cal", ".", "getTimeInMillis", "(", ")", ";", "}" ]
Get a "time_t" in milliseconds given a number of seconds since the Dershowitz/Reingold epoch relative to a given timezone. @param epochSecs the number of seconds since the Dershowitz/Reingold epoch relative to the given timezone @param zone timezone against which epochSecs applies @return the number of milliseconds since 00:00:00 Jan 1, 1970 GMT
[ "Get", "a", "time_t", "in", "milliseconds", "given", "a", "number", "of", "seconds", "since", "the", "Dershowitz", "/", "Reingold", "epoch", "relative", "to", "a", "given", "timezone", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/util/TimeUtils.java#L83-L89
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java
PebbleDictionary.addInt8
public void addInt8(final int key, final byte b) { """ Associate the specified signed byte with the provided key in the dictionary. If another key-value pair with the same key is already present in the dictionary, it will be replaced. @param key key with which the specified value is associated @param b value to be associated with the specified key """ PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.BYTE, b); addTuple(t); }
java
public void addInt8(final int key, final byte b) { PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.BYTE, b); addTuple(t); }
[ "public", "void", "addInt8", "(", "final", "int", "key", ",", "final", "byte", "b", ")", "{", "PebbleTuple", "t", "=", "PebbleTuple", ".", "create", "(", "key", ",", "PebbleTuple", ".", "TupleType", ".", "INT", ",", "PebbleTuple", ".", "Width", ".", "BYTE", ",", "b", ")", ";", "addTuple", "(", "t", ")", ";", "}" ]
Associate the specified signed byte with the provided key in the dictionary. If another key-value pair with the same key is already present in the dictionary, it will be replaced. @param key key with which the specified value is associated @param b value to be associated with the specified key
[ "Associate", "the", "specified", "signed", "byte", "with", "the", "provided", "key", "in", "the", "dictionary", ".", "If", "another", "key", "-", "value", "pair", "with", "the", "same", "key", "is", "already", "present", "in", "the", "dictionary", "it", "will", "be", "replaced", "." ]
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java#L107-L110
operasoftware/operaprestodriver
src/com/opera/core/systems/scope/WaitState.java
WaitState.pollResultItem
private ResultItem pollResultItem(long timeout, boolean idle) { """ Checks for a result item. <p/> If no result item is available this method will wait for timeout milliseconds and try again. If still no result if available then a ResponseNotReceivedException is thrown. @param timeout time in milliseconds to wait before retrying. @param idle whether you are waiting for an Idle event. Changes error message. @return the result """ ResultItem result = getResult(); if (result != null) { result.remainingIdleTimeout = timeout; } if (result == null && timeout > 0) { long start = System.currentTimeMillis(); internalWait(timeout); long end = System.currentTimeMillis(); result = getResult(); if (result != null) { result.remainingIdleTimeout = timeout - (end - start); logger.finest("Remaining timeout: " + result.remainingIdleTimeout); } } if (result == null) { if (idle) { throw new ResponseNotReceivedException("No idle response in a timely fashion"); } else { throw new ResponseNotReceivedException("No response in a timely fashion"); } } return result; }
java
private ResultItem pollResultItem(long timeout, boolean idle) { ResultItem result = getResult(); if (result != null) { result.remainingIdleTimeout = timeout; } if (result == null && timeout > 0) { long start = System.currentTimeMillis(); internalWait(timeout); long end = System.currentTimeMillis(); result = getResult(); if (result != null) { result.remainingIdleTimeout = timeout - (end - start); logger.finest("Remaining timeout: " + result.remainingIdleTimeout); } } if (result == null) { if (idle) { throw new ResponseNotReceivedException("No idle response in a timely fashion"); } else { throw new ResponseNotReceivedException("No response in a timely fashion"); } } return result; }
[ "private", "ResultItem", "pollResultItem", "(", "long", "timeout", ",", "boolean", "idle", ")", "{", "ResultItem", "result", "=", "getResult", "(", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "result", ".", "remainingIdleTimeout", "=", "timeout", ";", "}", "if", "(", "result", "==", "null", "&&", "timeout", ">", "0", ")", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "internalWait", "(", "timeout", ")", ";", "long", "end", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "result", "=", "getResult", "(", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "result", ".", "remainingIdleTimeout", "=", "timeout", "-", "(", "end", "-", "start", ")", ";", "logger", ".", "finest", "(", "\"Remaining timeout: \"", "+", "result", ".", "remainingIdleTimeout", ")", ";", "}", "}", "if", "(", "result", "==", "null", ")", "{", "if", "(", "idle", ")", "{", "throw", "new", "ResponseNotReceivedException", "(", "\"No idle response in a timely fashion\"", ")", ";", "}", "else", "{", "throw", "new", "ResponseNotReceivedException", "(", "\"No response in a timely fashion\"", ")", ";", "}", "}", "return", "result", ";", "}" ]
Checks for a result item. <p/> If no result item is available this method will wait for timeout milliseconds and try again. If still no result if available then a ResponseNotReceivedException is thrown. @param timeout time in milliseconds to wait before retrying. @param idle whether you are waiting for an Idle event. Changes error message. @return the result
[ "Checks", "for", "a", "result", "item", ".", "<p", "/", ">", "If", "no", "result", "item", "is", "available", "this", "method", "will", "wait", "for", "timeout", "milliseconds", "and", "try", "again", ".", "If", "still", "no", "result", "if", "available", "then", "a", "ResponseNotReceivedException", "is", "thrown", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/scope/WaitState.java#L428-L454
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java
SqlGeneratorDefaultImpl.getPreparedDeleteStatement
public SqlStatement getPreparedDeleteStatement(Query query, ClassDescriptor cld) { """ generate a prepared DELETE-Statement according to query @param query the Query @param cld the ClassDescriptor """ return new SqlDeleteByQuery(m_platform, cld, query, logger); }
java
public SqlStatement getPreparedDeleteStatement(Query query, ClassDescriptor cld) { return new SqlDeleteByQuery(m_platform, cld, query, logger); }
[ "public", "SqlStatement", "getPreparedDeleteStatement", "(", "Query", "query", ",", "ClassDescriptor", "cld", ")", "{", "return", "new", "SqlDeleteByQuery", "(", "m_platform", ",", "cld", ",", "query", ",", "logger", ")", ";", "}" ]
generate a prepared DELETE-Statement according to query @param query the Query @param cld the ClassDescriptor
[ "generate", "a", "prepared", "DELETE", "-", "Statement", "according", "to", "query" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L557-L560
arturmkrtchyan/iban4j
src/main/java/org/iban4j/Iban.java
Iban.valueOf
public static Iban valueOf(final String iban, final IbanFormat format) throws IbanFormatException, InvalidCheckDigitException, UnsupportedCountryException { """ Returns an Iban object holding the value of the specified String. @param iban the String to be parsed. @param format the format of the Iban. @return an Iban object holding the value represented by the string argument. @throws IbanFormatException if the String doesn't contain parsable Iban InvalidCheckDigitException if Iban has invalid check digit UnsupportedCountryException if Iban's Country is not supported. """ switch (format) { case Default: final String ibanWithoutSpaces = iban.replace(" ", ""); final Iban ibanObj = valueOf(ibanWithoutSpaces); if(ibanObj.toFormattedString().equals(iban)) { return ibanObj; } throw new IbanFormatException(IBAN_FORMATTING, String.format("Iban must be formatted using 4 characters and space combination. " + "Instead of [%s]", iban)); default: return valueOf(iban); } }
java
public static Iban valueOf(final String iban, final IbanFormat format) throws IbanFormatException, InvalidCheckDigitException, UnsupportedCountryException { switch (format) { case Default: final String ibanWithoutSpaces = iban.replace(" ", ""); final Iban ibanObj = valueOf(ibanWithoutSpaces); if(ibanObj.toFormattedString().equals(iban)) { return ibanObj; } throw new IbanFormatException(IBAN_FORMATTING, String.format("Iban must be formatted using 4 characters and space combination. " + "Instead of [%s]", iban)); default: return valueOf(iban); } }
[ "public", "static", "Iban", "valueOf", "(", "final", "String", "iban", ",", "final", "IbanFormat", "format", ")", "throws", "IbanFormatException", ",", "InvalidCheckDigitException", ",", "UnsupportedCountryException", "{", "switch", "(", "format", ")", "{", "case", "Default", ":", "final", "String", "ibanWithoutSpaces", "=", "iban", ".", "replace", "(", "\" \"", ",", "\"\"", ")", ";", "final", "Iban", "ibanObj", "=", "valueOf", "(", "ibanWithoutSpaces", ")", ";", "if", "(", "ibanObj", ".", "toFormattedString", "(", ")", ".", "equals", "(", "iban", ")", ")", "{", "return", "ibanObj", ";", "}", "throw", "new", "IbanFormatException", "(", "IBAN_FORMATTING", ",", "String", ".", "format", "(", "\"Iban must be formatted using 4 characters and space combination. \"", "+", "\"Instead of [%s]\"", ",", "iban", ")", ")", ";", "default", ":", "return", "valueOf", "(", "iban", ")", ";", "}", "}" ]
Returns an Iban object holding the value of the specified String. @param iban the String to be parsed. @param format the format of the Iban. @return an Iban object holding the value represented by the string argument. @throws IbanFormatException if the String doesn't contain parsable Iban InvalidCheckDigitException if Iban has invalid check digit UnsupportedCountryException if Iban's Country is not supported.
[ "Returns", "an", "Iban", "object", "holding", "the", "value", "of", "the", "specified", "String", "." ]
train
https://github.com/arturmkrtchyan/iban4j/blob/9889e8873c4ba5c34fc61d17594af935d2ca28a3/src/main/java/org/iban4j/Iban.java#L165-L180
liferay/com-liferay-commerce
commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java
CommerceTaxFixedRateAddressRelPersistenceImpl.findAll
@Override public List<CommerceTaxFixedRateAddressRel> findAll(int start, int end) { """ Returns a range of all the commerce tax fixed rate address rels. <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 CommerceTaxFixedRateAddressRelModelImpl}. 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 start the lower bound of the range of commerce tax fixed rate address rels @param end the upper bound of the range of commerce tax fixed rate address rels (not inclusive) @return the range of commerce tax fixed rate address rels """ return findAll(start, end, null); }
java
@Override public List<CommerceTaxFixedRateAddressRel> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceTaxFixedRateAddressRel", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce tax fixed rate address rels. <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 CommerceTaxFixedRateAddressRelModelImpl}. 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 start the lower bound of the range of commerce tax fixed rate address rels @param end the upper bound of the range of commerce tax fixed rate address rels (not inclusive) @return the range of commerce tax fixed rate address rels
[ "Returns", "a", "range", "of", "all", "the", "commerce", "tax", "fixed", "rate", "address", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java#L1737-L1740
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java
MaterialComboBox.setValues
public void setValues(List<T> values, boolean fireEvents) { """ Set directly all the values that will be stored into combobox and build options into it. """ String[] stringValues = new String[values.size()]; for (int i = 0; i < values.size(); i++) { stringValues[i] = keyFactory.generateKey(values.get(i)); } suppressChangeEvent = !fireEvents; $(listbox.getElement()).val(stringValues).trigger("change", selectedIndex); suppressChangeEvent = false; }
java
public void setValues(List<T> values, boolean fireEvents) { String[] stringValues = new String[values.size()]; for (int i = 0; i < values.size(); i++) { stringValues[i] = keyFactory.generateKey(values.get(i)); } suppressChangeEvent = !fireEvents; $(listbox.getElement()).val(stringValues).trigger("change", selectedIndex); suppressChangeEvent = false; }
[ "public", "void", "setValues", "(", "List", "<", "T", ">", "values", ",", "boolean", "fireEvents", ")", "{", "String", "[", "]", "stringValues", "=", "new", "String", "[", "values", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "size", "(", ")", ";", "i", "++", ")", "{", "stringValues", "[", "i", "]", "=", "keyFactory", ".", "generateKey", "(", "values", ".", "get", "(", "i", ")", ")", ";", "}", "suppressChangeEvent", "=", "!", "fireEvents", ";", "$", "(", "listbox", ".", "getElement", "(", ")", ")", ".", "val", "(", "stringValues", ")", ".", "trigger", "(", "\"change\"", ",", "selectedIndex", ")", ";", "suppressChangeEvent", "=", "false", ";", "}" ]
Set directly all the values that will be stored into combobox and build options into it.
[ "Set", "directly", "all", "the", "values", "that", "will", "be", "stored", "into", "combobox", "and", "build", "options", "into", "it", "." ]
train
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java#L584-L592
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java
Modifiers.setProtected
public static int setProtected(int modifier, boolean b) { """ When set protected, the modifier is cleared from being public or private. """ if (b) { return (modifier | PROTECTED) & (~PUBLIC & ~PRIVATE); } else { return modifier & ~PROTECTED; } }
java
public static int setProtected(int modifier, boolean b) { if (b) { return (modifier | PROTECTED) & (~PUBLIC & ~PRIVATE); } else { return modifier & ~PROTECTED; } }
[ "public", "static", "int", "setProtected", "(", "int", "modifier", ",", "boolean", "b", ")", "{", "if", "(", "b", ")", "{", "return", "(", "modifier", "|", "PROTECTED", ")", "&", "(", "~", "PUBLIC", "&", "~", "PRIVATE", ")", ";", "}", "else", "{", "return", "modifier", "&", "~", "PROTECTED", ";", "}", "}" ]
When set protected, the modifier is cleared from being public or private.
[ "When", "set", "protected", "the", "modifier", "is", "cleared", "from", "being", "public", "or", "private", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java#L60-L67
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugAccumulator.java
BugAccumulator.accumulateBug
public void accumulateBug(BugInstance bug, BytecodeScanningDetector visitor) { """ Accumulate a warning at source location currently being visited by given BytecodeScanningDetector. @param bug the warning @param visitor the BytecodeScanningDetector """ SourceLineAnnotation source = SourceLineAnnotation.fromVisitedInstruction(visitor); accumulateBug(bug, source); }
java
public void accumulateBug(BugInstance bug, BytecodeScanningDetector visitor) { SourceLineAnnotation source = SourceLineAnnotation.fromVisitedInstruction(visitor); accumulateBug(bug, source); }
[ "public", "void", "accumulateBug", "(", "BugInstance", "bug", ",", "BytecodeScanningDetector", "visitor", ")", "{", "SourceLineAnnotation", "source", "=", "SourceLineAnnotation", ".", "fromVisitedInstruction", "(", "visitor", ")", ";", "accumulateBug", "(", "bug", ",", "source", ")", ";", "}" ]
Accumulate a warning at source location currently being visited by given BytecodeScanningDetector. @param bug the warning @param visitor the BytecodeScanningDetector
[ "Accumulate", "a", "warning", "at", "source", "location", "currently", "being", "visited", "by", "given", "BytecodeScanningDetector", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugAccumulator.java#L159-L162
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/logging/WebContainerLogger.java
WebContainerLogger.logp
public void logp(Level level, String sourceClass, String sourceMethod,String msg) { """ Override every method from Logger to be called on the delegateLogger. """ delegateLogger.logp(level,sourceClass,sourceMethod,msg); }
java
public void logp(Level level, String sourceClass, String sourceMethod,String msg) { delegateLogger.logp(level,sourceClass,sourceMethod,msg); }
[ "public", "void", "logp", "(", "Level", "level", ",", "String", "sourceClass", ",", "String", "sourceMethod", ",", "String", "msg", ")", "{", "delegateLogger", ".", "logp", "(", "level", ",", "sourceClass", ",", "sourceMethod", ",", "msg", ")", ";", "}" ]
Override every method from Logger to be called on the delegateLogger.
[ "Override", "every", "method", "from", "Logger", "to", "be", "called", "on", "the", "delegateLogger", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/logging/WebContainerLogger.java#L69-L71
RuedigerMoeller/kontraktor
modules/kontraktor-bare/src/main/java/org/nustaq/kontraktor/barebone/RemoteActorConnection.java
RemoteActorConnection.sendRequests
protected void sendRequests() { """ sends pending requests async. needs be executed inside lock (see calls of this) """ if ( ! requestUnderway ) { requestUnderway = true; delayed( new Runnable() { @Override public void run() { synchronized (requests) { Object req[]; if ( openFutureRequests.get() > 0 && requests.size() == 0 ) { req = new Object[] { "SP", lastSeenSeq }; } else { req = new Object[requests.size() + 1]; for (int i = 0; i < requests.size(); i++) { req[i] = requests.get(i); } req[req.length - 1] = lastSeenSeq; requests.clear(); } sendCallArray(req).then(new Callback<Integer>() { @Override public void receive(Integer result, Object error) { synchronized (requests ) { requestUnderway = false; if ( requests.size() > 0 || (result != null && result > 0 && openFutureRequests.get() > 0 ) ) { myExec.execute(new Runnable() { @Override public void run() { sendRequests(); } }); } } } }); } } }, 1); } }
java
protected void sendRequests() { if ( ! requestUnderway ) { requestUnderway = true; delayed( new Runnable() { @Override public void run() { synchronized (requests) { Object req[]; if ( openFutureRequests.get() > 0 && requests.size() == 0 ) { req = new Object[] { "SP", lastSeenSeq }; } else { req = new Object[requests.size() + 1]; for (int i = 0; i < requests.size(); i++) { req[i] = requests.get(i); } req[req.length - 1] = lastSeenSeq; requests.clear(); } sendCallArray(req).then(new Callback<Integer>() { @Override public void receive(Integer result, Object error) { synchronized (requests ) { requestUnderway = false; if ( requests.size() > 0 || (result != null && result > 0 && openFutureRequests.get() > 0 ) ) { myExec.execute(new Runnable() { @Override public void run() { sendRequests(); } }); } } } }); } } }, 1); } }
[ "protected", "void", "sendRequests", "(", ")", "{", "if", "(", "!", "requestUnderway", ")", "{", "requestUnderway", "=", "true", ";", "delayed", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "synchronized", "(", "requests", ")", "{", "Object", "req", "[", "]", ";", "if", "(", "openFutureRequests", ".", "get", "(", ")", ">", "0", "&&", "requests", ".", "size", "(", ")", "==", "0", ")", "{", "req", "=", "new", "Object", "[", "]", "{", "\"SP\"", ",", "lastSeenSeq", "}", ";", "}", "else", "{", "req", "=", "new", "Object", "[", "requests", ".", "size", "(", ")", "+", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "requests", ".", "size", "(", ")", ";", "i", "++", ")", "{", "req", "[", "i", "]", "=", "requests", ".", "get", "(", "i", ")", ";", "}", "req", "[", "req", ".", "length", "-", "1", "]", "=", "lastSeenSeq", ";", "requests", ".", "clear", "(", ")", ";", "}", "sendCallArray", "(", "req", ")", ".", "then", "(", "new", "Callback", "<", "Integer", ">", "(", ")", "{", "@", "Override", "public", "void", "receive", "(", "Integer", "result", ",", "Object", "error", ")", "{", "synchronized", "(", "requests", ")", "{", "requestUnderway", "=", "false", ";", "if", "(", "requests", ".", "size", "(", ")", ">", "0", "||", "(", "result", "!=", "null", "&&", "result", ">", "0", "&&", "openFutureRequests", ".", "get", "(", ")", ">", "0", ")", ")", "{", "myExec", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "sendRequests", "(", ")", ";", "}", "}", ")", ";", "}", "}", "}", "}", ")", ";", "}", "}", "}", ",", "1", ")", ";", "}", "}" ]
sends pending requests async. needs be executed inside lock (see calls of this)
[ "sends", "pending", "requests", "async", ".", "needs", "be", "executed", "inside", "lock", "(", "see", "calls", "of", "this", ")" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/modules/kontraktor-bare/src/main/java/org/nustaq/kontraktor/barebone/RemoteActorConnection.java#L437-L476
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setValue
public Parameters setValue(@NonNull String name, Object value) { """ Set a value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The value. @return The self object. """ if (name == null) { throw new IllegalArgumentException("name cannot be null."); } if (readonly) { throw new IllegalStateException("Parameters is readonly mode."); } map.put(name, value); return this; }
java
public Parameters setValue(@NonNull String name, Object value) { if (name == null) { throw new IllegalArgumentException("name cannot be null."); } if (readonly) { throw new IllegalStateException("Parameters is readonly mode."); } map.put(name, value); return this; }
[ "public", "Parameters", "setValue", "(", "@", "NonNull", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"name cannot be null.\"", ")", ";", "}", "if", "(", "readonly", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Parameters is readonly mode.\"", ")", ";", "}", "map", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Set a value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The value. @return The self object.
[ "Set", "a", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L64-L69
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doPost
protected <T> T doPost(String path, MultivaluedMap<String, String> formParams, GenericType<T> genericType) throws ClientException { """ Submits a form and gets back a JSON object. Adds appropriate Accepts and Content Type headers. @param <T> the type of object that is expected in the response. @param path the API to call. @param formParams the form parameters to send. @param genericType the type of object that is expected in the response. @return the object in the response. @throws ClientException if a status code other than 200 (OK) is returned. """ return doPost(path, formParams, genericType, null); }
java
protected <T> T doPost(String path, MultivaluedMap<String, String> formParams, GenericType<T> genericType) throws ClientException { return doPost(path, formParams, genericType, null); }
[ "protected", "<", "T", ">", "T", "doPost", "(", "String", "path", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "formParams", ",", "GenericType", "<", "T", ">", "genericType", ")", "throws", "ClientException", "{", "return", "doPost", "(", "path", ",", "formParams", ",", "genericType", ",", "null", ")", ";", "}" ]
Submits a form and gets back a JSON object. Adds appropriate Accepts and Content Type headers. @param <T> the type of object that is expected in the response. @param path the API to call. @param formParams the form parameters to send. @param genericType the type of object that is expected in the response. @return the object in the response. @throws ClientException if a status code other than 200 (OK) is returned.
[ "Submits", "a", "form", "and", "gets", "back", "a", "JSON", "object", ".", "Adds", "appropriate", "Accepts", "and", "Content", "Type", "headers", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L487-L489
sporniket/core
sporniket-core-strings/src/main/java/com/sporniket/strings/QuickDiff.java
QuickDiff.outputReportLine
private void outputReportLine(List<String> report, MessageFormat template, String[] textLines, int currentLine) { """ Add a report line the designated line. @param report The report buffer. @param template The template to use (to distinguish between text on left and text on right). @param textLines The source text as an array of lines. @param currentLine The line to output. """ Object[] _args = { currentLine, textLines[currentLine] }; report.add(template.format(_args)); }
java
private void outputReportLine(List<String> report, MessageFormat template, String[] textLines, int currentLine) { Object[] _args = { currentLine, textLines[currentLine] }; report.add(template.format(_args)); }
[ "private", "void", "outputReportLine", "(", "List", "<", "String", ">", "report", ",", "MessageFormat", "template", ",", "String", "[", "]", "textLines", ",", "int", "currentLine", ")", "{", "Object", "[", "]", "_args", "=", "{", "currentLine", ",", "textLines", "[", "currentLine", "]", "}", ";", "report", ".", "add", "(", "template", ".", "format", "(", "_args", ")", ")", ";", "}" ]
Add a report line the designated line. @param report The report buffer. @param template The template to use (to distinguish between text on left and text on right). @param textLines The source text as an array of lines. @param currentLine The line to output.
[ "Add", "a", "report", "line", "the", "designated", "line", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-strings/src/main/java/com/sporniket/strings/QuickDiff.java#L253-L260
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.writeObjectToTempFileNoExceptions
public static File writeObjectToTempFileNoExceptions(Object o, String filename) { """ Write object to a temp file and ignore exceptions. @param o object to be written to file @param filename name of the temp file @return File containing the object """ try { return writeObjectToTempFile(o, filename); } catch (Exception e) { System.err.println("Error writing object to file " + filename); e.printStackTrace(); return null; } }
java
public static File writeObjectToTempFileNoExceptions(Object o, String filename) { try { return writeObjectToTempFile(o, filename); } catch (Exception e) { System.err.println("Error writing object to file " + filename); e.printStackTrace(); return null; } }
[ "public", "static", "File", "writeObjectToTempFileNoExceptions", "(", "Object", "o", ",", "String", "filename", ")", "{", "try", "{", "return", "writeObjectToTempFile", "(", "o", ",", "filename", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Error writing object to file \"", "+", "filename", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "}" ]
Write object to a temp file and ignore exceptions. @param o object to be written to file @param filename name of the temp file @return File containing the object
[ "Write", "object", "to", "a", "temp", "file", "and", "ignore", "exceptions", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L144-L152
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSegment.java
IPv6AddressSegment.getSplitSegments
public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) { """ Converts this IPv6 address segment into smaller segments, copying them into the given array starting at the given index. If a segment does not fit into the array because the segment index in the array is out of bounds of the array, then it is not copied. @param segs @param index """ if(!isMultiple()) { int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1; Integer myPrefix = getSegmentPrefixLength(); Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0); Integer lowPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 1); if(index >= 0 && index < segs.length) { segs[index] = creator.createSegment(highByte(), highPrefixBits); } if(++index >= 0 && index < segs.length) { segs[index] = creator.createSegment(lowByte(), lowPrefixBits); } } else { getSplitSegmentsMultiple(segs, index, creator); } }
java
public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) { if(!isMultiple()) { int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1; Integer myPrefix = getSegmentPrefixLength(); Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0); Integer lowPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 1); if(index >= 0 && index < segs.length) { segs[index] = creator.createSegment(highByte(), highPrefixBits); } if(++index >= 0 && index < segs.length) { segs[index] = creator.createSegment(lowByte(), lowPrefixBits); } } else { getSplitSegmentsMultiple(segs, index, creator); } }
[ "public", "<", "S", "extends", "AddressSegment", ">", "void", "getSplitSegments", "(", "S", "segs", "[", "]", ",", "int", "index", ",", "AddressSegmentCreator", "<", "S", ">", "creator", ")", "{", "if", "(", "!", "isMultiple", "(", ")", ")", "{", "int", "bitSizeSplit", "=", "IPv6Address", ".", "BITS_PER_SEGMENT", ">>>", "1", ";", "Integer", "myPrefix", "=", "getSegmentPrefixLength", "(", ")", ";", "Integer", "highPrefixBits", "=", "getSplitSegmentPrefix", "(", "bitSizeSplit", ",", "myPrefix", ",", "0", ")", ";", "Integer", "lowPrefixBits", "=", "getSplitSegmentPrefix", "(", "bitSizeSplit", ",", "myPrefix", ",", "1", ")", ";", "if", "(", "index", ">=", "0", "&&", "index", "<", "segs", ".", "length", ")", "{", "segs", "[", "index", "]", "=", "creator", ".", "createSegment", "(", "highByte", "(", ")", ",", "highPrefixBits", ")", ";", "}", "if", "(", "++", "index", ">=", "0", "&&", "index", "<", "segs", ".", "length", ")", "{", "segs", "[", "index", "]", "=", "creator", ".", "createSegment", "(", "lowByte", "(", ")", ",", "lowPrefixBits", ")", ";", "}", "}", "else", "{", "getSplitSegmentsMultiple", "(", "segs", ",", "index", ",", "creator", ")", ";", "}", "}" ]
Converts this IPv6 address segment into smaller segments, copying them into the given array starting at the given index. If a segment does not fit into the array because the segment index in the array is out of bounds of the array, then it is not copied. @param segs @param index
[ "Converts", "this", "IPv6", "address", "segment", "into", "smaller", "segments", "copying", "them", "into", "the", "given", "array", "starting", "at", "the", "given", "index", "." ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSegment.java#L302-L317
att/AAF
cadi/aaf/src/main/java/com/att/cadi/aaf/client/ErrMessage.java
ErrMessage.toMsg
public StringBuilder toMsg(StringBuilder sb, String attErrJson) throws APIException { """ AT&T Requires a specific Error Format for RESTful Services, which AAF complies with. This code will create a meaningful string from this format. @param sb @param df @param r @throws APIException """ return toMsg(sb,errDF.newData().in(TYPE.JSON).load(attErrJson).asObject()); }
java
public StringBuilder toMsg(StringBuilder sb, String attErrJson) throws APIException { return toMsg(sb,errDF.newData().in(TYPE.JSON).load(attErrJson).asObject()); }
[ "public", "StringBuilder", "toMsg", "(", "StringBuilder", "sb", ",", "String", "attErrJson", ")", "throws", "APIException", "{", "return", "toMsg", "(", "sb", ",", "errDF", ".", "newData", "(", ")", ".", "in", "(", "TYPE", ".", "JSON", ")", ".", "load", "(", "attErrJson", ")", ".", "asObject", "(", ")", ")", ";", "}" ]
AT&T Requires a specific Error Format for RESTful Services, which AAF complies with. This code will create a meaningful string from this format. @param sb @param df @param r @throws APIException
[ "AT&T", "Requires", "a", "specific", "Error", "Format", "for", "RESTful", "Services", "which", "AAF", "complies", "with", "." ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/client/ErrMessage.java#L50-L52
threerings/narya
core/src/main/java/com/threerings/presents/dobj/DObject.java
DObject.requestAttributeChange
protected void requestAttributeChange (String name, Object value, Object oldValue) { """ Called by derived instances when an attribute setter method was called. """ requestAttributeChange(name, value, oldValue, Transport.DEFAULT); }
java
protected void requestAttributeChange (String name, Object value, Object oldValue) { requestAttributeChange(name, value, oldValue, Transport.DEFAULT); }
[ "protected", "void", "requestAttributeChange", "(", "String", "name", ",", "Object", "value", ",", "Object", "oldValue", ")", "{", "requestAttributeChange", "(", "name", ",", "value", ",", "oldValue", ",", "Transport", ".", "DEFAULT", ")", ";", "}" ]
Called by derived instances when an attribute setter method was called.
[ "Called", "by", "derived", "instances", "when", "an", "attribute", "setter", "method", "was", "called", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L813-L816
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.opacify
public RgbaColor opacify(float amount) { """ Returns a new color that has the alpha adjusted by the specified amount. """ return new RgbaColor(r, g, b, alphaCheck(a + amount)); }
java
public RgbaColor opacify(float amount) { return new RgbaColor(r, g, b, alphaCheck(a + amount)); }
[ "public", "RgbaColor", "opacify", "(", "float", "amount", ")", "{", "return", "new", "RgbaColor", "(", "r", ",", "g", ",", "b", ",", "alphaCheck", "(", "a", "+", "amount", ")", ")", ";", "}" ]
Returns a new color that has the alpha adjusted by the specified amount.
[ "Returns", "a", "new", "color", "that", "has", "the", "alpha", "adjusted", "by", "the", "specified", "amount", "." ]
train
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L439-L441
craftercms/core
src/main/java/org/craftercms/core/processors/impl/TextMetaDataExtractingProcessor.java
TextMetaDataExtractingProcessor.process
@Override public Item process(Context context, CachingOptions cachingOptions, Item item) { """ For every XPath query provided in {@code metaDataNodesXPathQueries}, a single node is selected and its text value is extracted and put in the item's properties. """ for (String xpathQuery : metaDataNodesXPathQueries) { String metaDataValue = item.queryDescriptorValue(xpathQuery); if (StringUtils.isNotEmpty(metaDataValue)) { item.setProperty(xpathQuery, metaDataValue); } } return item; }
java
@Override public Item process(Context context, CachingOptions cachingOptions, Item item) { for (String xpathQuery : metaDataNodesXPathQueries) { String metaDataValue = item.queryDescriptorValue(xpathQuery); if (StringUtils.isNotEmpty(metaDataValue)) { item.setProperty(xpathQuery, metaDataValue); } } return item; }
[ "@", "Override", "public", "Item", "process", "(", "Context", "context", ",", "CachingOptions", "cachingOptions", ",", "Item", "item", ")", "{", "for", "(", "String", "xpathQuery", ":", "metaDataNodesXPathQueries", ")", "{", "String", "metaDataValue", "=", "item", ".", "queryDescriptorValue", "(", "xpathQuery", ")", ";", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "metaDataValue", ")", ")", "{", "item", ".", "setProperty", "(", "xpathQuery", ",", "metaDataValue", ")", ";", "}", "}", "return", "item", ";", "}" ]
For every XPath query provided in {@code metaDataNodesXPathQueries}, a single node is selected and its text value is extracted and put in the item's properties.
[ "For", "every", "XPath", "query", "provided", "in", "{" ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/processors/impl/TextMetaDataExtractingProcessor.java#L53-L63
morimekta/utils
diff-util/src/main/java/net/morimekta/diff/DiffBase.java
DiffBase.linesToChars
LinesToCharsResult linesToChars(String text1, String text2) { """ Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line. @param text1 First string. @param text2 Second string. @return An object containing the encoded text1, the encoded text2 and the List of unique strings. The zeroth element of the List of unique strings is intentionally blank. """ List<String> lineArray = new ArrayList<>(); Map<String, Integer> lineHash = new HashMap<>(); // e.g. linearray[4] == "Hello\n" // e.g. linehash.get("Hello\n") == 4 // "\x00" is a valid character, but various debuggers don't like it. // So we'll insert a junk entry to avoid generating a null character. lineArray.add(""); String chars1 = linesToCharsMunge(text1, lineArray, lineHash); String chars2 = linesToCharsMunge(text2, lineArray, lineHash); return new LinesToCharsResult(chars1, chars2, lineArray); }
java
LinesToCharsResult linesToChars(String text1, String text2) { List<String> lineArray = new ArrayList<>(); Map<String, Integer> lineHash = new HashMap<>(); // e.g. linearray[4] == "Hello\n" // e.g. linehash.get("Hello\n") == 4 // "\x00" is a valid character, but various debuggers don't like it. // So we'll insert a junk entry to avoid generating a null character. lineArray.add(""); String chars1 = linesToCharsMunge(text1, lineArray, lineHash); String chars2 = linesToCharsMunge(text2, lineArray, lineHash); return new LinesToCharsResult(chars1, chars2, lineArray); }
[ "LinesToCharsResult", "linesToChars", "(", "String", "text1", ",", "String", "text2", ")", "{", "List", "<", "String", ">", "lineArray", "=", "new", "ArrayList", "<>", "(", ")", ";", "Map", "<", "String", ",", "Integer", ">", "lineHash", "=", "new", "HashMap", "<>", "(", ")", ";", "// e.g. linearray[4] == \"Hello\\n\"", "// e.g. linehash.get(\"Hello\\n\") == 4", "// \"\\x00\" is a valid character, but various debuggers don't like it.", "// So we'll insert a junk entry to avoid generating a null character.", "lineArray", ".", "add", "(", "\"\"", ")", ";", "String", "chars1", "=", "linesToCharsMunge", "(", "text1", ",", "lineArray", ",", "lineHash", ")", ";", "String", "chars2", "=", "linesToCharsMunge", "(", "text2", ",", "lineArray", ",", "lineHash", ")", ";", "return", "new", "LinesToCharsResult", "(", "chars1", ",", "chars2", ",", "lineArray", ")", ";", "}" ]
Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line. @param text1 First string. @param text2 Second string. @return An object containing the encoded text1, the encoded text2 and the List of unique strings. The zeroth element of the List of unique strings is intentionally blank.
[ "Split", "two", "texts", "into", "a", "list", "of", "strings", ".", "Reduce", "the", "texts", "to", "a", "string", "of", "hashes", "where", "each", "Unicode", "character", "represents", "one", "line", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/diff-util/src/main/java/net/morimekta/diff/DiffBase.java#L657-L670
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/TriggerDefinition.java
TriggerDefinition.deleteFromSchema
public void deleteFromSchema(Mutation mutation, String cfName, long timestamp) { """ Drop specified trigger from the schema using given mutation. @param mutation The schema mutation @param cfName The name of the parent ColumnFamily @param timestamp The timestamp to use for the tombstone """ ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); int ldt = (int) (System.currentTimeMillis() / 1000); Composite prefix = CFMetaData.SchemaTriggersCf.comparator.make(cfName, name); cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt)); }
java
public void deleteFromSchema(Mutation mutation, String cfName, long timestamp) { ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); int ldt = (int) (System.currentTimeMillis() / 1000); Composite prefix = CFMetaData.SchemaTriggersCf.comparator.make(cfName, name); cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt)); }
[ "public", "void", "deleteFromSchema", "(", "Mutation", "mutation", ",", "String", "cfName", ",", "long", "timestamp", ")", "{", "ColumnFamily", "cf", "=", "mutation", ".", "addOrGet", "(", "SystemKeyspace", ".", "SCHEMA_TRIGGERS_CF", ")", ";", "int", "ldt", "=", "(", "int", ")", "(", "System", ".", "currentTimeMillis", "(", ")", "/", "1000", ")", ";", "Composite", "prefix", "=", "CFMetaData", ".", "SchemaTriggersCf", ".", "comparator", ".", "make", "(", "cfName", ",", "name", ")", ";", "cf", ".", "addAtom", "(", "new", "RangeTombstone", "(", "prefix", ",", "prefix", ".", "end", "(", ")", ",", "timestamp", ",", "ldt", ")", ")", ";", "}" ]
Drop specified trigger from the schema using given mutation. @param mutation The schema mutation @param cfName The name of the parent ColumnFamily @param timestamp The timestamp to use for the tombstone
[ "Drop", "specified", "trigger", "from", "the", "schema", "using", "given", "mutation", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/TriggerDefinition.java#L99-L106
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/ProtoNodeTable.java
ProtoNodeTable.addNode
public Integer addNode(final int termIndex, final String label) { """ Adds a proto node {@link String label} for a specific {@link Integer term index}. If the {@link Integer term index} has already been added then its {@link Integer proto node index} will be returned. <p> This operation maintains the {@link Map map} of term index to node index. </p> @param termIndex {@link Integer} the term index created from the addition to the {@link TermTable term table} @param label {@link String} the placeholder label from the {@link TermTable term table} @return the {@link Integer proto node index} @throws InvalidArgument Thrown if {@code label} is {@code null} """ if (label == null) { throw new InvalidArgument("label", label); } // if we have already seen this term index, return Integer visitedIndex = termNodeIndex.get(termIndex); if (visitedIndex != null) { return visitedIndex; } // add this new proto node int pnIndex = protoNodes.size(); protoNodes.add(label); // bi-directionally map term index to node index termNodeIndex.put(termIndex, pnIndex); nodeTermIndex.put(pnIndex, termIndex); getEquivalences().put(pnIndex, getEquivalences().size()); return pnIndex; }
java
public Integer addNode(final int termIndex, final String label) { if (label == null) { throw new InvalidArgument("label", label); } // if we have already seen this term index, return Integer visitedIndex = termNodeIndex.get(termIndex); if (visitedIndex != null) { return visitedIndex; } // add this new proto node int pnIndex = protoNodes.size(); protoNodes.add(label); // bi-directionally map term index to node index termNodeIndex.put(termIndex, pnIndex); nodeTermIndex.put(pnIndex, termIndex); getEquivalences().put(pnIndex, getEquivalences().size()); return pnIndex; }
[ "public", "Integer", "addNode", "(", "final", "int", "termIndex", ",", "final", "String", "label", ")", "{", "if", "(", "label", "==", "null", ")", "{", "throw", "new", "InvalidArgument", "(", "\"label\"", ",", "label", ")", ";", "}", "// if we have already seen this term index, return", "Integer", "visitedIndex", "=", "termNodeIndex", ".", "get", "(", "termIndex", ")", ";", "if", "(", "visitedIndex", "!=", "null", ")", "{", "return", "visitedIndex", ";", "}", "// add this new proto node", "int", "pnIndex", "=", "protoNodes", ".", "size", "(", ")", ";", "protoNodes", ".", "add", "(", "label", ")", ";", "// bi-directionally map term index to node index", "termNodeIndex", ".", "put", "(", "termIndex", ",", "pnIndex", ")", ";", "nodeTermIndex", ".", "put", "(", "pnIndex", ",", "termIndex", ")", ";", "getEquivalences", "(", ")", ".", "put", "(", "pnIndex", ",", "getEquivalences", "(", ")", ".", "size", "(", ")", ")", ";", "return", "pnIndex", ";", "}" ]
Adds a proto node {@link String label} for a specific {@link Integer term index}. If the {@link Integer term index} has already been added then its {@link Integer proto node index} will be returned. <p> This operation maintains the {@link Map map} of term index to node index. </p> @param termIndex {@link Integer} the term index created from the addition to the {@link TermTable term table} @param label {@link String} the placeholder label from the {@link TermTable term table} @return the {@link Integer proto node index} @throws InvalidArgument Thrown if {@code label} is {@code null}
[ "Adds", "a", "proto", "node", "{", "@link", "String", "label", "}", "for", "a", "specific", "{", "@link", "Integer", "term", "index", "}", ".", "If", "the", "{", "@link", "Integer", "term", "index", "}", "has", "already", "been", "added", "then", "its", "{", "@link", "Integer", "proto", "node", "index", "}", "will", "be", "returned", ".", "<p", ">", "This", "operation", "maintains", "the", "{", "@link", "Map", "map", "}", "of", "term", "index", "to", "node", "index", ".", "<", "/", "p", ">" ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/ProtoNodeTable.java#L112-L133
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/ModuleWebhooks.java
ModuleWebhooks.fetchOne
public CMAWebhook fetchOne(String spaceId, String webhookId) { """ Retrieve exactly one webhook, whose id you know. <p> This method will override the configuration specified through {@link CMAClient.Builder#setSpaceId(String)} and will ignore {@link CMAClient.Builder#setEnvironmentId(String)}. @param spaceId The id of the space to be hosting this webhook. @param webhookId The id of the webhook to be returned. @return The webhook found, or null, if no such webhook is available. @throws IllegalArgumentException if spaceId is null. @throws IllegalArgumentException if webhookId is null. """ assertNotNull(spaceId, "spaceId"); assertNotNull(webhookId, "webhookId"); return service.fetchOne(spaceId, webhookId).blockingFirst(); }
java
public CMAWebhook fetchOne(String spaceId, String webhookId) { assertNotNull(spaceId, "spaceId"); assertNotNull(webhookId, "webhookId"); return service.fetchOne(spaceId, webhookId).blockingFirst(); }
[ "public", "CMAWebhook", "fetchOne", "(", "String", "spaceId", ",", "String", "webhookId", ")", "{", "assertNotNull", "(", "spaceId", ",", "\"spaceId\"", ")", ";", "assertNotNull", "(", "webhookId", ",", "\"webhookId\"", ")", ";", "return", "service", ".", "fetchOne", "(", "spaceId", ",", "webhookId", ")", ".", "blockingFirst", "(", ")", ";", "}" ]
Retrieve exactly one webhook, whose id you know. <p> This method will override the configuration specified through {@link CMAClient.Builder#setSpaceId(String)} and will ignore {@link CMAClient.Builder#setEnvironmentId(String)}. @param spaceId The id of the space to be hosting this webhook. @param webhookId The id of the webhook to be returned. @return The webhook found, or null, if no such webhook is available. @throws IllegalArgumentException if spaceId is null. @throws IllegalArgumentException if webhookId is null.
[ "Retrieve", "exactly", "one", "webhook", "whose", "id", "you", "know", ".", "<p", ">", "This", "method", "will", "override", "the", "configuration", "specified", "through", "{", "@link", "CMAClient", ".", "Builder#setSpaceId", "(", "String", ")", "}", "and", "will", "ignore", "{", "@link", "CMAClient", ".", "Builder#setEnvironmentId", "(", "String", ")", "}", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleWebhooks.java#L244-L249
redkale/redkale
src/org/redkale/net/http/HttpResponse.java
HttpResponse.finishMapJson
public void finishMapJson(final JsonConvert convert, final Object... objs) { """ 将对象数组用Map的形式以JSON格式输出 <br> 例如: finishMap("a",2,"b",3) 输出结果为 {"a":2,"b":3} @param convert 指定的JsonConvert @param objs 输出对象 """ this.contentType = this.jsonContentType; if (this.recycleListener != null) this.output = objs; finish(convert.convertMapTo(getBodyBufferSupplier(), objs)); }
java
public void finishMapJson(final JsonConvert convert, final Object... objs) { this.contentType = this.jsonContentType; if (this.recycleListener != null) this.output = objs; finish(convert.convertMapTo(getBodyBufferSupplier(), objs)); }
[ "public", "void", "finishMapJson", "(", "final", "JsonConvert", "convert", ",", "final", "Object", "...", "objs", ")", "{", "this", ".", "contentType", "=", "this", ".", "jsonContentType", ";", "if", "(", "this", ".", "recycleListener", "!=", "null", ")", "this", ".", "output", "=", "objs", ";", "finish", "(", "convert", ".", "convertMapTo", "(", "getBodyBufferSupplier", "(", ")", ",", "objs", ")", ")", ";", "}" ]
将对象数组用Map的形式以JSON格式输出 <br> 例如: finishMap("a",2,"b",3) 输出结果为 {"a":2,"b":3} @param convert 指定的JsonConvert @param objs 输出对象
[ "将对象数组用Map的形式以JSON格式输出", "<br", ">", "例如", ":", "finishMap", "(", "a", "2", "b", "3", ")", "输出结果为", "{", "a", ":", "2", "b", ":", "3", "}" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpResponse.java#L334-L338
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java
UnsignedUtils.forDigit
public static char forDigit(int digit, int radix) { """ Determines the character representation for a specific digit in the specified radix. Note: If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix, the null character ('\u0000') is returned. @param digit @param radix @return """ if (digit >= 0 && digit < radix && radix >= Character.MIN_RADIX && radix <= MAX_RADIX) { return digits[digit]; } return '\u0000'; }
java
public static char forDigit(int digit, int radix) { if (digit >= 0 && digit < radix && radix >= Character.MIN_RADIX && radix <= MAX_RADIX) { return digits[digit]; } return '\u0000'; }
[ "public", "static", "char", "forDigit", "(", "int", "digit", ",", "int", "radix", ")", "{", "if", "(", "digit", ">=", "0", "&&", "digit", "<", "radix", "&&", "radix", ">=", "Character", ".", "MIN_RADIX", "&&", "radix", "<=", "MAX_RADIX", ")", "{", "return", "digits", "[", "digit", "]", ";", "}", "return", "'", "'", ";", "}" ]
Determines the character representation for a specific digit in the specified radix. Note: If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix, the null character ('\u0000') is returned. @param digit @param radix @return
[ "Determines", "the", "character", "representation", "for", "a", "specific", "digit", "in", "the", "specified", "radix", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java#L76-L81
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java
Variable.fixupVariables
public void fixupVariables(java.util.Vector vars, int globalsSize) { """ This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. @param vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame). """ m_fixUpWasCalled = true; int sz = vars.size(); for (int i = vars.size()-1; i >= 0; i--) { QName qn = (QName)vars.elementAt(i); // System.out.println("qn: "+qn); if(qn.equals(m_qname)) { if(i < globalsSize) { m_isGlobal = true; m_index = i; } else { m_index = i-globalsSize; } return; } } java.lang.String msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_COULD_NOT_FIND_VAR, new Object[]{m_qname.toString()}); TransformerException te = new TransformerException(msg, this); throw new org.apache.xml.utils.WrappedRuntimeException(te); }
java
public void fixupVariables(java.util.Vector vars, int globalsSize) { m_fixUpWasCalled = true; int sz = vars.size(); for (int i = vars.size()-1; i >= 0; i--) { QName qn = (QName)vars.elementAt(i); // System.out.println("qn: "+qn); if(qn.equals(m_qname)) { if(i < globalsSize) { m_isGlobal = true; m_index = i; } else { m_index = i-globalsSize; } return; } } java.lang.String msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_COULD_NOT_FIND_VAR, new Object[]{m_qname.toString()}); TransformerException te = new TransformerException(msg, this); throw new org.apache.xml.utils.WrappedRuntimeException(te); }
[ "public", "void", "fixupVariables", "(", "java", ".", "util", ".", "Vector", "vars", ",", "int", "globalsSize", ")", "{", "m_fixUpWasCalled", "=", "true", ";", "int", "sz", "=", "vars", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "vars", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "QName", "qn", "=", "(", "QName", ")", "vars", ".", "elementAt", "(", "i", ")", ";", "// System.out.println(\"qn: \"+qn);", "if", "(", "qn", ".", "equals", "(", "m_qname", ")", ")", "{", "if", "(", "i", "<", "globalsSize", ")", "{", "m_isGlobal", "=", "true", ";", "m_index", "=", "i", ";", "}", "else", "{", "m_index", "=", "i", "-", "globalsSize", ";", "}", "return", ";", "}", "}", "java", ".", "lang", ".", "String", "msg", "=", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_COULD_NOT_FIND_VAR", ",", "new", "Object", "[", "]", "{", "m_qname", ".", "toString", "(", ")", "}", ")", ";", "TransformerException", "te", "=", "new", "TransformerException", "(", "msg", ",", "this", ")", ";", "throw", "new", "org", ".", "apache", ".", "xml", ".", "utils", ".", "WrappedRuntimeException", "(", "te", ")", ";", "}" ]
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. @param vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).
[ "This", "function", "is", "used", "to", "fixup", "variables", "from", "QNames", "to", "stack", "frame", "indexes", "at", "stylesheet", "build", "time", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java#L117-L150
TakahikoKawasaki/nv-websocket-client
src/main/java/com/neovisionaries/ws/client/HandshakeReader.java
HandshakeReader.validateProtocol
private void validateProtocol(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException { """ Validate the value of {@code Sec-WebSocket-Protocol} header. <blockquote> <p>From RFC 6455, p20.</p> <p><i> If the response includes a {@code Sec-WebSocket-Protocol} header field and this header field indicates the use of a subprotocol that was not present in the client's handshake (the server has indicated a subprotocol not requested by the client), the client MUST Fail the WebSocket Connection. </i></p> </blockquote> """ // Get the values of Sec-WebSocket-Protocol. List<String> values = headers.get("Sec-WebSocket-Protocol"); if (values == null) { // Nothing to check. return; } // Protocol String protocol = values.get(0); if (protocol == null || protocol.length() == 0) { // Ignore. return; } // If the protocol is not contained in the original request // from this client. if (mWebSocket.getHandshakeBuilder().containsProtocol(protocol) == false) { // The protocol contained in the Sec-WebSocket-Protocol header is not supported. throw new OpeningHandshakeException( WebSocketError.UNSUPPORTED_PROTOCOL, "The protocol contained in the Sec-WebSocket-Protocol header is not supported: " + protocol, statusLine, headers); } // Agreed protocol. mWebSocket.setAgreedProtocol(protocol); }
java
private void validateProtocol(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException { // Get the values of Sec-WebSocket-Protocol. List<String> values = headers.get("Sec-WebSocket-Protocol"); if (values == null) { // Nothing to check. return; } // Protocol String protocol = values.get(0); if (protocol == null || protocol.length() == 0) { // Ignore. return; } // If the protocol is not contained in the original request // from this client. if (mWebSocket.getHandshakeBuilder().containsProtocol(protocol) == false) { // The protocol contained in the Sec-WebSocket-Protocol header is not supported. throw new OpeningHandshakeException( WebSocketError.UNSUPPORTED_PROTOCOL, "The protocol contained in the Sec-WebSocket-Protocol header is not supported: " + protocol, statusLine, headers); } // Agreed protocol. mWebSocket.setAgreedProtocol(protocol); }
[ "private", "void", "validateProtocol", "(", "StatusLine", "statusLine", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headers", ")", "throws", "WebSocketException", "{", "// Get the values of Sec-WebSocket-Protocol.", "List", "<", "String", ">", "values", "=", "headers", ".", "get", "(", "\"Sec-WebSocket-Protocol\"", ")", ";", "if", "(", "values", "==", "null", ")", "{", "// Nothing to check.", "return", ";", "}", "// Protocol", "String", "protocol", "=", "values", ".", "get", "(", "0", ")", ";", "if", "(", "protocol", "==", "null", "||", "protocol", ".", "length", "(", ")", "==", "0", ")", "{", "// Ignore.", "return", ";", "}", "// If the protocol is not contained in the original request", "// from this client.", "if", "(", "mWebSocket", ".", "getHandshakeBuilder", "(", ")", ".", "containsProtocol", "(", "protocol", ")", "==", "false", ")", "{", "// The protocol contained in the Sec-WebSocket-Protocol header is not supported.", "throw", "new", "OpeningHandshakeException", "(", "WebSocketError", ".", "UNSUPPORTED_PROTOCOL", ",", "\"The protocol contained in the Sec-WebSocket-Protocol header is not supported: \"", "+", "protocol", ",", "statusLine", ",", "headers", ")", ";", "}", "// Agreed protocol.", "mWebSocket", ".", "setAgreedProtocol", "(", "protocol", ")", ";", "}" ]
Validate the value of {@code Sec-WebSocket-Protocol} header. <blockquote> <p>From RFC 6455, p20.</p> <p><i> If the response includes a {@code Sec-WebSocket-Protocol} header field and this header field indicates the use of a subprotocol that was not present in the client's handshake (the server has indicated a subprotocol not requested by the client), the client MUST Fail the WebSocket Connection. </i></p> </blockquote>
[ "Validate", "the", "value", "of", "{", "@code", "Sec", "-", "WebSocket", "-", "Protocol", "}", "header", "." ]
train
https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/HandshakeReader.java#L579-L612
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/LeetEncoder.java
LeetEncoder.leetConvert
public static void leetConvert(LeetLevel level, SecureCharArray message) throws Exception { """ Converts a SecureCharArray into a new SecureCharArray with any applicable characters converted to leet-speak. @param level What level of leet to use. Each leet corresponds to a different leet lookup table. @param message The array to convert. @throws Exception upon sizing error. """ // pre-allocate an array that is 4 times the size of the message. I don't // see anything in the leet-table that is larger than 3 characters, but I'm // using 4-characters to calcualte the size just in case. This is to avoid // a bunch of array resizes. SecureCharArray ret = new SecureCharArray(message.size() * 4); char[] messageBytes = message.getData(); // Reference to message's data char[] retBytes = ret.getData(); // Reference to ret's data int currentRetByte = 0; // Index of current ret byte if (level.compareTo(LeetLevel.LEVEL1) >= 0 && level.compareTo(LeetLevel.LEVEL9) <= 0) { for (char messageByte : messageBytes) { char b = Character.toLowerCase(messageByte); if (b >= 'a' && b <= 'z') { for (int j = 0; j < LEVELS[level.getLevel() - 1][b - 'a'].length(); j++) retBytes[currentRetByte++] = LEVELS[level.getLevel() - 1][b - 'a'].charAt(j); } else { retBytes[currentRetByte++] = b; } } } // Resize the array to the length that we actually filled it, then replace // the original message and erase the buffer we built up. ret.resize(currentRetByte, true); message.replace(ret); ret.erase(); }
java
public static void leetConvert(LeetLevel level, SecureCharArray message) throws Exception { // pre-allocate an array that is 4 times the size of the message. I don't // see anything in the leet-table that is larger than 3 characters, but I'm // using 4-characters to calcualte the size just in case. This is to avoid // a bunch of array resizes. SecureCharArray ret = new SecureCharArray(message.size() * 4); char[] messageBytes = message.getData(); // Reference to message's data char[] retBytes = ret.getData(); // Reference to ret's data int currentRetByte = 0; // Index of current ret byte if (level.compareTo(LeetLevel.LEVEL1) >= 0 && level.compareTo(LeetLevel.LEVEL9) <= 0) { for (char messageByte : messageBytes) { char b = Character.toLowerCase(messageByte); if (b >= 'a' && b <= 'z') { for (int j = 0; j < LEVELS[level.getLevel() - 1][b - 'a'].length(); j++) retBytes[currentRetByte++] = LEVELS[level.getLevel() - 1][b - 'a'].charAt(j); } else { retBytes[currentRetByte++] = b; } } } // Resize the array to the length that we actually filled it, then replace // the original message and erase the buffer we built up. ret.resize(currentRetByte, true); message.replace(ret); ret.erase(); }
[ "public", "static", "void", "leetConvert", "(", "LeetLevel", "level", ",", "SecureCharArray", "message", ")", "throws", "Exception", "{", "// pre-allocate an array that is 4 times the size of the message. I don't", "// see anything in the leet-table that is larger than 3 characters, but I'm", "// using 4-characters to calcualte the size just in case. This is to avoid", "// a bunch of array resizes.", "SecureCharArray", "ret", "=", "new", "SecureCharArray", "(", "message", ".", "size", "(", ")", "*", "4", ")", ";", "char", "[", "]", "messageBytes", "=", "message", ".", "getData", "(", ")", ";", "// Reference to message's data", "char", "[", "]", "retBytes", "=", "ret", ".", "getData", "(", ")", ";", "// Reference to ret's data", "int", "currentRetByte", "=", "0", ";", "// Index of current ret byte", "if", "(", "level", ".", "compareTo", "(", "LeetLevel", ".", "LEVEL1", ")", ">=", "0", "&&", "level", ".", "compareTo", "(", "LeetLevel", ".", "LEVEL9", ")", "<=", "0", ")", "{", "for", "(", "char", "messageByte", ":", "messageBytes", ")", "{", "char", "b", "=", "Character", ".", "toLowerCase", "(", "messageByte", ")", ";", "if", "(", "b", ">=", "'", "'", "&&", "b", "<=", "'", "'", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "LEVELS", "[", "level", ".", "getLevel", "(", ")", "-", "1", "]", "[", "b", "-", "'", "'", "]", ".", "length", "(", ")", ";", "j", "++", ")", "retBytes", "[", "currentRetByte", "++", "]", "=", "LEVELS", "[", "level", ".", "getLevel", "(", ")", "-", "1", "]", "[", "-", "'", "'", "]", ".", "charAt", "(", "j", ")", ";", "}", "else", "{", "retBytes", "[", "currentRetByte", "++", "]", "=", "b", ";", "}", "}", "}", "// Resize the array to the length that we actually filled it, then replace", "// the original message and erase the buffer we built up.", "ret", ".", "resize", "(", "currentRetByte", ",", "true", ")", ";", "message", ".", "replace", "(", "ret", ")", ";", "ret", ".", "erase", "(", ")", ";", "}" ]
Converts a SecureCharArray into a new SecureCharArray with any applicable characters converted to leet-speak. @param level What level of leet to use. Each leet corresponds to a different leet lookup table. @param message The array to convert. @throws Exception upon sizing error.
[ "Converts", "a", "SecureCharArray", "into", "a", "new", "SecureCharArray", "with", "any", "applicable", "characters", "converted", "to", "leet", "-", "speak", "." ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/LeetEncoder.java#L67-L95
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/operations/validation/SubnetValidator.java
SubnetValidator.rangeCheck
private int rangeCheck(int value, int begin, int end) { """ /* Convenience function to check integer boundaries. Checks if a value x is in the range [begin,end]. Returns x if it is in range, throws an exception otherwise. """ if (value >= begin && value <= end) { // (begin,end] return value; } throw new IllegalArgumentException("Value [" + value + "] not in range [" + begin + "," + end + "]"); }
java
private int rangeCheck(int value, int begin, int end) { if (value >= begin && value <= end) { // (begin,end] return value; } throw new IllegalArgumentException("Value [" + value + "] not in range [" + begin + "," + end + "]"); }
[ "private", "int", "rangeCheck", "(", "int", "value", ",", "int", "begin", ",", "int", "end", ")", "{", "if", "(", "value", ">=", "begin", "&&", "value", "<=", "end", ")", "{", "// (begin,end]", "return", "value", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Value [\"", "+", "value", "+", "\"] not in range [\"", "+", "begin", "+", "\",\"", "+", "end", "+", "\"]\"", ")", ";", "}" ]
/* Convenience function to check integer boundaries. Checks if a value x is in the range [begin,end]. Returns x if it is in range, throws an exception otherwise.
[ "/", "*", "Convenience", "function", "to", "check", "integer", "boundaries", ".", "Checks", "if", "a", "value", "x", "is", "in", "the", "range", "[", "begin", "end", "]", ".", "Returns", "x", "if", "it", "is", "in", "range", "throws", "an", "exception", "otherwise", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/validation/SubnetValidator.java#L92-L98
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/ListFixture.java
ListFixture.setValueAtIn
public void setValueAtIn(Object value, int index, List aList) { """ Sets value of element at index (0-based). If the current list has less elements it is extended to have exactly index elements. @param value value to store. @param index 0-based index to add element. @param aList list to set element in. """ Object cleanValue = cleanupValue(value); while (aList.size() <= index) { aList.add(null); } aList.set(index, cleanValue); }
java
public void setValueAtIn(Object value, int index, List aList) { Object cleanValue = cleanupValue(value); while (aList.size() <= index) { aList.add(null); } aList.set(index, cleanValue); }
[ "public", "void", "setValueAtIn", "(", "Object", "value", ",", "int", "index", ",", "List", "aList", ")", "{", "Object", "cleanValue", "=", "cleanupValue", "(", "value", ")", ";", "while", "(", "aList", ".", "size", "(", ")", "<=", "index", ")", "{", "aList", ".", "add", "(", "null", ")", ";", "}", "aList", ".", "set", "(", "index", ",", "cleanValue", ")", ";", "}" ]
Sets value of element at index (0-based). If the current list has less elements it is extended to have exactly index elements. @param value value to store. @param index 0-based index to add element. @param aList list to set element in.
[ "Sets", "value", "of", "element", "at", "index", "(", "0", "-", "based", ")", ".", "If", "the", "current", "list", "has", "less", "elements", "it", "is", "extended", "to", "have", "exactly", "index", "elements", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/ListFixture.java#L118-L124
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java
ExposeLinearLayoutManagerEx.recycleChildren
protected void recycleChildren(RecyclerView.Recycler recycler, int startIndex, int endIndex) { """ Recycles children between given indices. @param startIndex inclusive @param endIndex exclusive """ if (startIndex == endIndex) { return; } if (DEBUG) { Log.d(TAG, "Recycling " + Math.abs(startIndex - endIndex) + " items"); } if (endIndex > startIndex) { for (int i = endIndex - 1; i >= startIndex; i--) { removeAndRecycleViewAt(i, recycler); } } else { for (int i = startIndex; i > endIndex; i--) { removeAndRecycleViewAt(i, recycler); } } }
java
protected void recycleChildren(RecyclerView.Recycler recycler, int startIndex, int endIndex) { if (startIndex == endIndex) { return; } if (DEBUG) { Log.d(TAG, "Recycling " + Math.abs(startIndex - endIndex) + " items"); } if (endIndex > startIndex) { for (int i = endIndex - 1; i >= startIndex; i--) { removeAndRecycleViewAt(i, recycler); } } else { for (int i = startIndex; i > endIndex; i--) { removeAndRecycleViewAt(i, recycler); } } }
[ "protected", "void", "recycleChildren", "(", "RecyclerView", ".", "Recycler", "recycler", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "if", "(", "startIndex", "==", "endIndex", ")", "{", "return", ";", "}", "if", "(", "DEBUG", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"Recycling \"", "+", "Math", ".", "abs", "(", "startIndex", "-", "endIndex", ")", "+", "\" items\"", ")", ";", "}", "if", "(", "endIndex", ">", "startIndex", ")", "{", "for", "(", "int", "i", "=", "endIndex", "-", "1", ";", "i", ">=", "startIndex", ";", "i", "--", ")", "{", "removeAndRecycleViewAt", "(", "i", ",", "recycler", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "startIndex", ";", "i", ">", "endIndex", ";", "i", "--", ")", "{", "removeAndRecycleViewAt", "(", "i", ",", "recycler", ")", ";", "}", "}", "}" ]
Recycles children between given indices. @param startIndex inclusive @param endIndex exclusive
[ "Recycles", "children", "between", "given", "indices", "." ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java#L1015-L1031
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WEditableImageRenderer.java
WEditableImageRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given {@link WEditableImage}. @param component the WEditableImage to paint. @param renderContext the RenderContext to paint to. """ WEditableImage editableImage = (WEditableImage) component; XmlStringBuilder xml = renderContext.getWriter(); // No image set if (editableImage.getImage() == null && editableImage.getImageUrl() == null) { return; } WImageRenderer.renderTagOpen(editableImage, xml); WComponent uploader = editableImage.getEditUploader(); if (uploader != null) { xml.appendAttribute("data-wc-editor", uploader.getId()); } xml.appendEnd(); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WEditableImage editableImage = (WEditableImage) component; XmlStringBuilder xml = renderContext.getWriter(); // No image set if (editableImage.getImage() == null && editableImage.getImageUrl() == null) { return; } WImageRenderer.renderTagOpen(editableImage, xml); WComponent uploader = editableImage.getEditUploader(); if (uploader != null) { xml.appendAttribute("data-wc-editor", uploader.getId()); } xml.appendEnd(); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WEditableImage", "editableImage", "=", "(", "WEditableImage", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "// No image set", "if", "(", "editableImage", ".", "getImage", "(", ")", "==", "null", "&&", "editableImage", ".", "getImageUrl", "(", ")", "==", "null", ")", "{", "return", ";", "}", "WImageRenderer", ".", "renderTagOpen", "(", "editableImage", ",", "xml", ")", ";", "WComponent", "uploader", "=", "editableImage", ".", "getEditUploader", "(", ")", ";", "if", "(", "uploader", "!=", "null", ")", "{", "xml", ".", "appendAttribute", "(", "\"data-wc-editor\"", ",", "uploader", ".", "getId", "(", ")", ")", ";", "}", "xml", ".", "appendEnd", "(", ")", ";", "}" ]
Paints the given {@link WEditableImage}. @param component the WEditableImage to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "{", "@link", "WEditableImage", "}", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WEditableImageRenderer.java#L23-L39
apache/reef
lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/utils/DefinedRuntimesSerializer.java
DefinedRuntimesSerializer.toBytes
public byte[] toBytes(final DefinedRuntimes definedRuntimes) { """ Serializes DefinedRuntimes. @param definedRuntimes the Avro object to toString @return Serialized avro string """ final DatumWriter<DefinedRuntimes> configurationWriter = new SpecificDatumWriter<>(DefinedRuntimes.class); try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) { final BinaryEncoder binaryEncoder = EncoderFactory.get().binaryEncoder(out, null); configurationWriter.write(definedRuntimes, binaryEncoder); binaryEncoder.flush(); out.flush(); return out.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Unable to serialize DefinedRuntimes", e); } }
java
public byte[] toBytes(final DefinedRuntimes definedRuntimes){ final DatumWriter<DefinedRuntimes> configurationWriter = new SpecificDatumWriter<>(DefinedRuntimes.class); try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) { final BinaryEncoder binaryEncoder = EncoderFactory.get().binaryEncoder(out, null); configurationWriter.write(definedRuntimes, binaryEncoder); binaryEncoder.flush(); out.flush(); return out.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Unable to serialize DefinedRuntimes", e); } }
[ "public", "byte", "[", "]", "toBytes", "(", "final", "DefinedRuntimes", "definedRuntimes", ")", "{", "final", "DatumWriter", "<", "DefinedRuntimes", ">", "configurationWriter", "=", "new", "SpecificDatumWriter", "<>", "(", "DefinedRuntimes", ".", "class", ")", ";", "try", "(", "final", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ")", "{", "final", "BinaryEncoder", "binaryEncoder", "=", "EncoderFactory", ".", "get", "(", ")", ".", "binaryEncoder", "(", "out", ",", "null", ")", ";", "configurationWriter", ".", "write", "(", "definedRuntimes", ",", "binaryEncoder", ")", ";", "binaryEncoder", ".", "flush", "(", ")", ";", "out", ".", "flush", "(", ")", ";", "return", "out", ".", "toByteArray", "(", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to serialize DefinedRuntimes\"", ",", "e", ")", ";", "}", "}" ]
Serializes DefinedRuntimes. @param definedRuntimes the Avro object to toString @return Serialized avro string
[ "Serializes", "DefinedRuntimes", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/utils/DefinedRuntimesSerializer.java#L44-L56
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings.java
lbmonbindings.count_filtered
public static long count_filtered(nitro_service service, lbmonbindings obj, String filter) throws Exception { """ Use this API to count filtered the set of lbmonbindings resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ options option = new options(); option.set_count(true); option.set_filter(filter); option.set_args(nitro_util.object_to_string_withoutquotes(obj)); lbmonbindings[] response = (lbmonbindings[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, lbmonbindings obj, String filter) throws Exception{ options option = new options(); option.set_count(true); option.set_filter(filter); option.set_args(nitro_util.object_to_string_withoutquotes(obj)); lbmonbindings[] response = (lbmonbindings[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "lbmonbindings", "obj", ",", "String", "filter", ")", "throws", "Exception", "{", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_count", "(", "true", ")", ";", "option", ".", "set_filter", "(", "filter", ")", ";", "option", ".", "set_args", "(", "nitro_util", ".", "object_to_string_withoutquotes", "(", "obj", ")", ")", ";", "lbmonbindings", "[", "]", "response", "=", "(", "lbmonbindings", "[", "]", ")", "obj", ".", "getfiltered", "(", "service", ",", "option", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "return", "response", "[", "0", "]", ".", "__count", ";", "}", "return", "0", ";", "}" ]
Use this API to count filtered the set of lbmonbindings resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "filtered", "the", "set", "of", "lbmonbindings", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings.java#L181-L191
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java
MetadataClient.unregisterWorkflowDef
public void unregisterWorkflowDef(String name, Integer version) { """ Removes the workflow definition of a workflow from the conductor server. It does not remove associated workflows. Use with caution. @param name Name of the workflow to be unregistered. @param version Version of the workflow definition to be unregistered. """ Preconditions.checkArgument(StringUtils.isNotBlank(name), "Workflow name cannot be blank"); Preconditions.checkNotNull(version, "Version cannot be null"); delete("metadata/workflow/{name}/{version}", name, version); }
java
public void unregisterWorkflowDef(String name, Integer version) { Preconditions.checkArgument(StringUtils.isNotBlank(name), "Workflow name cannot be blank"); Preconditions.checkNotNull(version, "Version cannot be null"); delete("metadata/workflow/{name}/{version}", name, version); }
[ "public", "void", "unregisterWorkflowDef", "(", "String", "name", ",", "Integer", "version", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "name", ")", ",", "\"Workflow name cannot be blank\"", ")", ";", "Preconditions", ".", "checkNotNull", "(", "version", ",", "\"Version cannot be null\"", ")", ";", "delete", "(", "\"metadata/workflow/{name}/{version}\"", ",", "name", ",", "version", ")", ";", "}" ]
Removes the workflow definition of a workflow from the conductor server. It does not remove associated workflows. Use with caution. @param name Name of the workflow to be unregistered. @param version Version of the workflow definition to be unregistered.
[ "Removes", "the", "workflow", "definition", "of", "a", "workflow", "from", "the", "conductor", "server", ".", "It", "does", "not", "remove", "associated", "workflows", ".", "Use", "with", "caution", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java#L127-L131
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
Extern.readPackageListFromFile
private void readPackageListFromFile(String path, DocFile pkgListPath) throws Fault { """ Read the "package-list" file which is available locally. @param path URL or directory path to the packages. @param pkgListPath Path to the local "package-list" file. """ DocFile file = pkgListPath.resolve(DocPaths.PACKAGE_LIST); if (! (file.isAbsolute() || linkoffline)){ file = file.resolveAgainst(DocumentationTool.Location.DOCUMENTATION_OUTPUT); } try { if (file.exists() && file.canRead()) { boolean pathIsRelative = !DocFile.createFileForInput(configuration, path).isAbsolute() && !isUrl(path); readPackageList(file.openInputStream(), path, pathIsRelative); } else { throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null); } } catch (IOException exc) { throw new Fault(configuration.getText("doclet.File_error", file.getPath()), exc); } }
java
private void readPackageListFromFile(String path, DocFile pkgListPath) throws Fault { DocFile file = pkgListPath.resolve(DocPaths.PACKAGE_LIST); if (! (file.isAbsolute() || linkoffline)){ file = file.resolveAgainst(DocumentationTool.Location.DOCUMENTATION_OUTPUT); } try { if (file.exists() && file.canRead()) { boolean pathIsRelative = !DocFile.createFileForInput(configuration, path).isAbsolute() && !isUrl(path); readPackageList(file.openInputStream(), path, pathIsRelative); } else { throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null); } } catch (IOException exc) { throw new Fault(configuration.getText("doclet.File_error", file.getPath()), exc); } }
[ "private", "void", "readPackageListFromFile", "(", "String", "path", ",", "DocFile", "pkgListPath", ")", "throws", "Fault", "{", "DocFile", "file", "=", "pkgListPath", ".", "resolve", "(", "DocPaths", ".", "PACKAGE_LIST", ")", ";", "if", "(", "!", "(", "file", ".", "isAbsolute", "(", ")", "||", "linkoffline", ")", ")", "{", "file", "=", "file", ".", "resolveAgainst", "(", "DocumentationTool", ".", "Location", ".", "DOCUMENTATION_OUTPUT", ")", ";", "}", "try", "{", "if", "(", "file", ".", "exists", "(", ")", "&&", "file", ".", "canRead", "(", ")", ")", "{", "boolean", "pathIsRelative", "=", "!", "DocFile", ".", "createFileForInput", "(", "configuration", ",", "path", ")", ".", "isAbsolute", "(", ")", "&&", "!", "isUrl", "(", "path", ")", ";", "readPackageList", "(", "file", ".", "openInputStream", "(", ")", ",", "path", ",", "pathIsRelative", ")", ";", "}", "else", "{", "throw", "new", "Fault", "(", "configuration", ".", "getText", "(", "\"doclet.File_error\"", ",", "file", ".", "getPath", "(", ")", ")", ",", "null", ")", ";", "}", "}", "catch", "(", "IOException", "exc", ")", "{", "throw", "new", "Fault", "(", "configuration", ".", "getText", "(", "\"doclet.File_error\"", ",", "file", ".", "getPath", "(", ")", ")", ",", "exc", ")", ";", "}", "}" ]
Read the "package-list" file which is available locally. @param path URL or directory path to the packages. @param pkgListPath Path to the local "package-list" file.
[ "Read", "the", "package", "-", "list", "file", "which", "is", "available", "locally", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java#L252-L270
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriFragmentId
public static void unescapeUriFragmentId(final Reader reader, final Writer writer) throws IOException { """ <p> Perform am URI fragment identifier <strong>unescape</strong> operation on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use <tt>UTF-8</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ unescapeUriFragmentId(reader, writer, DEFAULT_ENCODING); }
java
public static void unescapeUriFragmentId(final Reader reader, final Writer writer) throws IOException { unescapeUriFragmentId(reader, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "unescapeUriFragmentId", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "unescapeUriFragmentId", "(", "reader", ",", "writer", ",", "DEFAULT_ENCODING", ")", ";", "}" ]
<p> Perform am URI fragment identifier <strong>unescape</strong> operation on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use <tt>UTF-8</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "fragment", "identifier", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "as", "encoding", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "unescape", "every", "percent", "-", "encoded", "(", "<tt", ">", "%HH<", "/", "tt", ">", ")", "sequences", "present", "in", "input", "even", "for", "those", "characters", "that", "do", "not", "need", "to", "be", "percent", "-", "encoded", "in", "this", "context", "(", "unreserved", "characters", "can", "be", "percent", "-", "encoded", "even", "if", "/", "when", "this", "is", "not", "required", "though", "it", "is", "not", "generally", "considered", "a", "good", "practice", ")", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "use", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "in", "order", "to", "determine", "the", "characters", "specified", "in", "the", "percent", "-", "encoded", "byte", "sequences", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L2338-L2341
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.getVolume
public GetVolumeResponse getVolume(GetVolumeRequest request) { """ Get the detail information of specified volume. @param request The request containing all options for getting the detail information of specified volume. @return The response containing the detail information of specified volume. """ checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getVolumeId(), "request volumeId should not be empty."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX, request.getVolumeId()); return invokeHttpClient(internalRequest, GetVolumeResponse.class); }
java
public GetVolumeResponse getVolume(GetVolumeRequest request) { checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getVolumeId(), "request volumeId should not be empty."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX, request.getVolumeId()); return invokeHttpClient(internalRequest, GetVolumeResponse.class); }
[ "public", "GetVolumeResponse", "getVolume", "(", "GetVolumeRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getVolumeId", "(", ")", ",", "\"request volumeId should not be empty.\"", ")", ";", "InternalRequest", "internalRequest", "=", "this", ".", "createRequest", "(", "request", ",", "HttpMethodName", ".", "GET", ",", "VOLUME_PREFIX", ",", "request", ".", "getVolumeId", "(", ")", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "GetVolumeResponse", ".", "class", ")", ";", "}" ]
Get the detail information of specified volume. @param request The request containing all options for getting the detail information of specified volume. @return The response containing the detail information of specified volume.
[ "Get", "the", "detail", "information", "of", "specified", "volume", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L944-L950
pryzach/midao
midao-jdbc-dbcp-1-4/src/main/java/org/midao/jdbc/core/pool/MjdbcPoolBinder.java
MjdbcPoolBinder.createDataSource
public static DataSource createDataSource(String driverClassName, String url, String userName, String password, int initialSize, int maxActive) throws SQLException { """ Returns new Pooled {@link DataSource} implementation <p/> In case this function won't work - use {@link #createDataSource(java.util.Properties)} @param driverClassName Driver Class name @param url Database connection url @param userName Database user name @param password Database user password @param initialSize initial pool size @param maxActive max connection active @return new Pooled {@link DataSource} implementation @throws SQLException """ assertNotNull(driverClassName); assertNotNull(url); assertNotNull(userName); assertNotNull(password); BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(driverClassName); ds.setUrl(url); ds.setUsername(userName); ds.setPassword(password); ds.setMaxActive(maxActive); ds.setInitialSize(initialSize); return ds; }
java
public static DataSource createDataSource(String driverClassName, String url, String userName, String password, int initialSize, int maxActive) throws SQLException { assertNotNull(driverClassName); assertNotNull(url); assertNotNull(userName); assertNotNull(password); BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(driverClassName); ds.setUrl(url); ds.setUsername(userName); ds.setPassword(password); ds.setMaxActive(maxActive); ds.setInitialSize(initialSize); return ds; }
[ "public", "static", "DataSource", "createDataSource", "(", "String", "driverClassName", ",", "String", "url", ",", "String", "userName", ",", "String", "password", ",", "int", "initialSize", ",", "int", "maxActive", ")", "throws", "SQLException", "{", "assertNotNull", "(", "driverClassName", ")", ";", "assertNotNull", "(", "url", ")", ";", "assertNotNull", "(", "userName", ")", ";", "assertNotNull", "(", "password", ")", ";", "BasicDataSource", "ds", "=", "new", "BasicDataSource", "(", ")", ";", "ds", ".", "setDriverClassName", "(", "driverClassName", ")", ";", "ds", ".", "setUrl", "(", "url", ")", ";", "ds", ".", "setUsername", "(", "userName", ")", ";", "ds", ".", "setPassword", "(", "password", ")", ";", "ds", ".", "setMaxActive", "(", "maxActive", ")", ";", "ds", ".", "setInitialSize", "(", "initialSize", ")", ";", "return", "ds", ";", "}" ]
Returns new Pooled {@link DataSource} implementation <p/> In case this function won't work - use {@link #createDataSource(java.util.Properties)} @param driverClassName Driver Class name @param url Database connection url @param userName Database user name @param password Database user password @param initialSize initial pool size @param maxActive max connection active @return new Pooled {@link DataSource} implementation @throws SQLException
[ "Returns", "new", "Pooled", "{", "@link", "DataSource", "}", "implementation", "<p", "/", ">", "In", "case", "this", "function", "won", "t", "work", "-", "use", "{", "@link", "#createDataSource", "(", "java", ".", "util", ".", "Properties", ")", "}" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-dbcp-1-4/src/main/java/org/midao/jdbc/core/pool/MjdbcPoolBinder.java#L121-L137
sahan/ZombieLink
zombielink/src/main/java/com/lonepulse/zombielink/executor/ConfigurationService.java
ConfigurationService.getDefault
@Override public Configuration getDefault() { """ <p>The <i>out-of-the-box</i> configuration for an instance of {@link HttpClient} which will be used for executing all endpoint requests. Below is a detailed description of all configured properties.</p> <br> <ul> <li> <p><b>HttpClient</b></p> <br> <p>It registers two {@link Scheme}s:</p> <br> <ol> <li><b>HTTP</b> on port <b>80</b> using sockets from {@link PlainSocketFactory#getSocketFactory}</li> <li><b>HTTPS</b> on port <b>443</b> using sockets from {@link SSLSocketFactory#getSocketFactory}</li> </ol> <p>It uses a {@link PoolingClientConnectionManager} with the maximum number of client connections per route set to <b>4</b> and the total set to <b>128</b>.</p> </li> </ul> @return the instance of {@link HttpClient} which will be used for request execution <br><br> @since 1.3.0 """ return new Configuration() { @Override public HttpClient httpClient() { try { SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory())); PoolingClientConnectionManager pccm = new PoolingClientConnectionManager(schemeRegistry); pccm.setMaxTotal(200); pccm.setDefaultMaxPerRoute(20); return new DefaultHttpClient(pccm); } catch(Exception e) { throw new ConfigurationFailedException(e); } } }; }
java
@Override public Configuration getDefault() { return new Configuration() { @Override public HttpClient httpClient() { try { SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory())); PoolingClientConnectionManager pccm = new PoolingClientConnectionManager(schemeRegistry); pccm.setMaxTotal(200); pccm.setDefaultMaxPerRoute(20); return new DefaultHttpClient(pccm); } catch(Exception e) { throw new ConfigurationFailedException(e); } } }; }
[ "@", "Override", "public", "Configuration", "getDefault", "(", ")", "{", "return", "new", "Configuration", "(", ")", "{", "@", "Override", "public", "HttpClient", "httpClient", "(", ")", "{", "try", "{", "SchemeRegistry", "schemeRegistry", "=", "new", "SchemeRegistry", "(", ")", ";", "schemeRegistry", ".", "register", "(", "new", "Scheme", "(", "\"http\"", ",", "80", ",", "PlainSocketFactory", ".", "getSocketFactory", "(", ")", ")", ")", ";", "schemeRegistry", ".", "register", "(", "new", "Scheme", "(", "\"https\"", ",", "443", ",", "SSLSocketFactory", ".", "getSocketFactory", "(", ")", ")", ")", ";", "PoolingClientConnectionManager", "pccm", "=", "new", "PoolingClientConnectionManager", "(", "schemeRegistry", ")", ";", "pccm", ".", "setMaxTotal", "(", "200", ")", ";", "pccm", ".", "setDefaultMaxPerRoute", "(", "20", ")", ";", "return", "new", "DefaultHttpClient", "(", "pccm", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ConfigurationFailedException", "(", "e", ")", ";", "}", "}", "}", ";", "}" ]
<p>The <i>out-of-the-box</i> configuration for an instance of {@link HttpClient} which will be used for executing all endpoint requests. Below is a detailed description of all configured properties.</p> <br> <ul> <li> <p><b>HttpClient</b></p> <br> <p>It registers two {@link Scheme}s:</p> <br> <ol> <li><b>HTTP</b> on port <b>80</b> using sockets from {@link PlainSocketFactory#getSocketFactory}</li> <li><b>HTTPS</b> on port <b>443</b> using sockets from {@link SSLSocketFactory#getSocketFactory}</li> </ol> <p>It uses a {@link PoolingClientConnectionManager} with the maximum number of client connections per route set to <b>4</b> and the total set to <b>128</b>.</p> </li> </ul> @return the instance of {@link HttpClient} which will be used for request execution <br><br> @since 1.3.0
[ "<p", ">", "The", "<i", ">", "out", "-", "of", "-", "the", "-", "box<", "/", "i", ">", "configuration", "for", "an", "instance", "of", "{", "@link", "HttpClient", "}", "which", "will", "be", "used", "for", "executing", "all", "endpoint", "requests", ".", "Below", "is", "a", "detailed", "description", "of", "all", "configured", "properties", ".", "<", "/", "p", ">", "<br", ">", "<ul", ">", "<li", ">", "<p", ">", "<b", ">", "HttpClient<", "/", "b", ">", "<", "/", "p", ">", "<br", ">", "<p", ">", "It", "registers", "two", "{", "@link", "Scheme", "}", "s", ":", "<", "/", "p", ">", "<br", ">", "<ol", ">", "<li", ">", "<b", ">", "HTTP<", "/", "b", ">", "on", "port", "<b", ">", "80<", "/", "b", ">", "using", "sockets", "from", "{", "@link", "PlainSocketFactory#getSocketFactory", "}", "<", "/", "li", ">", "<li", ">", "<b", ">", "HTTPS<", "/", "b", ">", "on", "port", "<b", ">", "443<", "/", "b", ">", "using", "sockets", "from", "{", "@link", "SSLSocketFactory#getSocketFactory", "}", "<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/sahan/ZombieLink/blob/a9971add56d4f6919a4a5e84c78e9220011d8982/zombielink/src/main/java/com/lonepulse/zombielink/executor/ConfigurationService.java#L71-L97
jroyalty/jglm
src/main/java/com/hackoeur/jglm/support/FastMathCalc.java
FastMathCalc.expint
static double expint(int p, final double result[]) { """ Compute exp(p) for a integer p in extended precision. @param p integer whose exponential is requested @param result placeholder where to put the result in extended precision @return exp(p) in standard precision (equal to result[0] + result[1]) """ //double x = M_E; final double xs[] = new double[2]; final double as[] = new double[2]; final double ys[] = new double[2]; //split(x, xs); //xs[1] = (double)(2.7182818284590452353602874713526625L - xs[0]); //xs[0] = 2.71827697753906250000; //xs[1] = 4.85091998273542816811e-06; //xs[0] = Double.longBitsToDouble(0x4005bf0800000000L); //xs[1] = Double.longBitsToDouble(0x3ed458a2bb4a9b00L); /* E */ xs[0] = 2.718281828459045; xs[1] = 1.4456468917292502E-16; split(1.0, ys); while (p > 0) { if ((p & 1) != 0) { quadMult(ys, xs, as); ys[0] = as[0]; ys[1] = as[1]; } quadMult(xs, xs, as); xs[0] = as[0]; xs[1] = as[1]; p >>= 1; } if (result != null) { result[0] = ys[0]; result[1] = ys[1]; resplit(result); } return ys[0] + ys[1]; }
java
static double expint(int p, final double result[]) { //double x = M_E; final double xs[] = new double[2]; final double as[] = new double[2]; final double ys[] = new double[2]; //split(x, xs); //xs[1] = (double)(2.7182818284590452353602874713526625L - xs[0]); //xs[0] = 2.71827697753906250000; //xs[1] = 4.85091998273542816811e-06; //xs[0] = Double.longBitsToDouble(0x4005bf0800000000L); //xs[1] = Double.longBitsToDouble(0x3ed458a2bb4a9b00L); /* E */ xs[0] = 2.718281828459045; xs[1] = 1.4456468917292502E-16; split(1.0, ys); while (p > 0) { if ((p & 1) != 0) { quadMult(ys, xs, as); ys[0] = as[0]; ys[1] = as[1]; } quadMult(xs, xs, as); xs[0] = as[0]; xs[1] = as[1]; p >>= 1; } if (result != null) { result[0] = ys[0]; result[1] = ys[1]; resplit(result); } return ys[0] + ys[1]; }
[ "static", "double", "expint", "(", "int", "p", ",", "final", "double", "result", "[", "]", ")", "{", "//double x = M_E;", "final", "double", "xs", "[", "]", "=", "new", "double", "[", "2", "]", ";", "final", "double", "as", "[", "]", "=", "new", "double", "[", "2", "]", ";", "final", "double", "ys", "[", "]", "=", "new", "double", "[", "2", "]", ";", "//split(x, xs);", "//xs[1] = (double)(2.7182818284590452353602874713526625L - xs[0]);", "//xs[0] = 2.71827697753906250000;", "//xs[1] = 4.85091998273542816811e-06;", "//xs[0] = Double.longBitsToDouble(0x4005bf0800000000L);", "//xs[1] = Double.longBitsToDouble(0x3ed458a2bb4a9b00L);", "/* E */", "xs", "[", "0", "]", "=", "2.718281828459045", ";", "xs", "[", "1", "]", "=", "1.4456468917292502E-16", ";", "split", "(", "1.0", ",", "ys", ")", ";", "while", "(", "p", ">", "0", ")", "{", "if", "(", "(", "p", "&", "1", ")", "!=", "0", ")", "{", "quadMult", "(", "ys", ",", "xs", ",", "as", ")", ";", "ys", "[", "0", "]", "=", "as", "[", "0", "]", ";", "ys", "[", "1", "]", "=", "as", "[", "1", "]", ";", "}", "quadMult", "(", "xs", ",", "xs", ",", "as", ")", ";", "xs", "[", "0", "]", "=", "as", "[", "0", "]", ";", "xs", "[", "1", "]", "=", "as", "[", "1", "]", ";", "p", ">>=", "1", ";", "}", "if", "(", "result", "!=", "null", ")", "{", "result", "[", "0", "]", "=", "ys", "[", "0", "]", ";", "result", "[", "1", "]", "=", "ys", "[", "1", "]", ";", "resplit", "(", "result", ")", ";", "}", "return", "ys", "[", "0", "]", "+", "ys", "[", "1", "]", ";", "}" ]
Compute exp(p) for a integer p in extended precision. @param p integer whose exponential is requested @param result placeholder where to put the result in extended precision @return exp(p) in standard precision (equal to result[0] + result[1])
[ "Compute", "exp", "(", "p", ")", "for", "a", "integer", "p", "in", "extended", "precision", "." ]
train
https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L490-L528
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEBeanLifeCycleInfo.java
TEBeanLifeCycleInfo.traceBeanState
public static void traceBeanState(int oldState, String oldString, int newState, String newString) // d167264 { """ This is called by the EJB container server code to write a ejb bean state record to the trace log, if enabled. """ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { StringBuffer sbuf = new StringBuffer(); sbuf .append(BeanLifeCycle_State_Type_Str).append(DataDelimiter) .append(BeanLifeCycle_State_Type).append(DataDelimiter) .append(oldState).append(DataDelimiter) // d167264 .append(oldString).append(DataDelimiter) // d167264 .append(newState).append(DataDelimiter) // d167264 .append(newString).append(DataDelimiter) // d167264 ; Tr.debug(tc, sbuf.toString()); } }
java
public static void traceBeanState(int oldState, String oldString, int newState, String newString) // d167264 { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { StringBuffer sbuf = new StringBuffer(); sbuf .append(BeanLifeCycle_State_Type_Str).append(DataDelimiter) .append(BeanLifeCycle_State_Type).append(DataDelimiter) .append(oldState).append(DataDelimiter) // d167264 .append(oldString).append(DataDelimiter) // d167264 .append(newState).append(DataDelimiter) // d167264 .append(newString).append(DataDelimiter) // d167264 ; Tr.debug(tc, sbuf.toString()); } }
[ "public", "static", "void", "traceBeanState", "(", "int", "oldState", ",", "String", "oldString", ",", "int", "newState", ",", "String", "newString", ")", "// d167264", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "StringBuffer", "sbuf", "=", "new", "StringBuffer", "(", ")", ";", "sbuf", ".", "append", "(", "BeanLifeCycle_State_Type_Str", ")", ".", "append", "(", "DataDelimiter", ")", ".", "append", "(", "BeanLifeCycle_State_Type", ")", ".", "append", "(", "DataDelimiter", ")", ".", "append", "(", "oldState", ")", ".", "append", "(", "DataDelimiter", ")", "// d167264", ".", "append", "(", "oldString", ")", ".", "append", "(", "DataDelimiter", ")", "// d167264", ".", "append", "(", "newState", ")", ".", "append", "(", "DataDelimiter", ")", "// d167264", ".", "append", "(", "newString", ")", ".", "append", "(", "DataDelimiter", ")", "// d167264", ";", "Tr", ".", "debug", "(", "tc", ",", "sbuf", ".", "toString", "(", ")", ")", ";", "}", "}" ]
This is called by the EJB container server code to write a ejb bean state record to the trace log, if enabled.
[ "This", "is", "called", "by", "the", "EJB", "container", "server", "code", "to", "write", "a", "ejb", "bean", "state", "record", "to", "the", "trace", "log", "if", "enabled", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEBeanLifeCycleInfo.java#L68-L85
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java
BaseMessagingEngineImpl.alterLocalizationPoint
final void alterLocalizationPoint(BaseDestination dest,LWMConfig lp) { """ Pass the request to alter a localization point onto the localizer object. @param lp localization point definition """ String thisMethodName = "alterLocalizationPoint"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, lp); } try { _localizer.alterLocalizationPoint(dest,lp); } catch (Exception e) { SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
java
final void alterLocalizationPoint(BaseDestination dest,LWMConfig lp) { String thisMethodName = "alterLocalizationPoint"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, lp); } try { _localizer.alterLocalizationPoint(dest,lp); } catch (Exception e) { SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
[ "final", "void", "alterLocalizationPoint", "(", "BaseDestination", "dest", ",", "LWMConfig", "lp", ")", "{", "String", "thisMethodName", "=", "\"alterLocalizationPoint\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "thisMethodName", ",", "lp", ")", ";", "}", "try", "{", "_localizer", ".", "alterLocalizationPoint", "(", "dest", ",", "lp", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "thisMethodName", ")", ";", "}", "}" ]
Pass the request to alter a localization point onto the localizer object. @param lp localization point definition
[ "Pass", "the", "request", "to", "alter", "a", "localization", "point", "onto", "the", "localizer", "object", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1495-L1512
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.rotateTowards
public Matrix3d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { """ Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local <code>+Z</code> axis with <code>direction</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix, then the new matrix will be <code>M * L</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the lookat transformation will be applied first! <p> In order to set the matrix to a rotation transformation without post-multiplying it, use {@link #rotationTowards(double, double, double, double, double, double) rotationTowards()}. <p> This method is equivalent to calling: <code>mul(new Matrix3d().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert())</code> @see #rotateTowards(Vector3dc, Vector3dc) @see #rotationTowards(double, double, double, double, double, double) @param dirX the x-coordinate of the direction to rotate towards @param dirY the y-coordinate of the direction to rotate towards @param dirZ the z-coordinate of the direction to rotate towards @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @return this """ return rotateTowards(dirX, dirY, dirZ, upX, upY, upZ, this); }
java
public Matrix3d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { return rotateTowards(dirX, dirY, dirZ, upX, upY, upZ, this); }
[ "public", "Matrix3d", "rotateTowards", "(", "double", "dirX", ",", "double", "dirY", ",", "double", "dirZ", ",", "double", "upX", ",", "double", "upY", ",", "double", "upZ", ")", "{", "return", "rotateTowards", "(", "dirX", ",", "dirY", ",", "dirZ", ",", "upX", ",", "upY", ",", "upZ", ",", "this", ")", ";", "}" ]
Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local <code>+Z</code> axis with <code>direction</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix, then the new matrix will be <code>M * L</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the lookat transformation will be applied first! <p> In order to set the matrix to a rotation transformation without post-multiplying it, use {@link #rotationTowards(double, double, double, double, double, double) rotationTowards()}. <p> This method is equivalent to calling: <code>mul(new Matrix3d().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert())</code> @see #rotateTowards(Vector3dc, Vector3dc) @see #rotationTowards(double, double, double, double, double, double) @param dirX the x-coordinate of the direction to rotate towards @param dirY the y-coordinate of the direction to rotate towards @param dirZ the z-coordinate of the direction to rotate towards @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @return this
[ "Apply", "a", "model", "transformation", "to", "this", "matrix", "for", "a", "right", "-", "handed", "coordinate", "system", "that", "aligns", "the", "local", "<code", ">", "+", "Z<", "/", "code", ">", "axis", "with", "<code", ">", "direction<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "L<", "/", "code", ">", "the", "lookat", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "L<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "L", "*", "v<", "/", "code", ">", "the", "lookat", "transformation", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "rotation", "transformation", "without", "post", "-", "multiplying", "it", "use", "{", "@link", "#rotationTowards", "(", "double", "double", "double", "double", "double", "double", ")", "rotationTowards", "()", "}", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", ":", "<code", ">", "mul", "(", "new", "Matrix3d", "()", ".", "lookAlong", "(", "-", "dirX", "-", "dirY", "-", "dirZ", "upX", "upY", "upZ", ")", ".", "invert", "()", ")", "<", "/", "code", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L4452-L4454
bazaarvoice/emodb
queue-client-common/src/main/java/com/bazaarvoice/emodb/queue/client/AbstractQueueClient.java
AbstractQueueClient.sendAll
public void sendAll(String apiKey, String queue, Collection<?> messages) { """ Any server can handle sending messages, no need for @PartitionKey """ checkNotNull(queue, "queue"); checkNotNull(messages, "messages"); if (messages.isEmpty()) { return; } try { URI uri = _queueService.clone() .segment(queue, "sendbatch") .build(); _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .post(messages); } catch (EmoClientException e) { throw convertException(e); } }
java
public void sendAll(String apiKey, String queue, Collection<?> messages) { checkNotNull(queue, "queue"); checkNotNull(messages, "messages"); if (messages.isEmpty()) { return; } try { URI uri = _queueService.clone() .segment(queue, "sendbatch") .build(); _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .post(messages); } catch (EmoClientException e) { throw convertException(e); } }
[ "public", "void", "sendAll", "(", "String", "apiKey", ",", "String", "queue", ",", "Collection", "<", "?", ">", "messages", ")", "{", "checkNotNull", "(", "queue", ",", "\"queue\"", ")", ";", "checkNotNull", "(", "messages", ",", "\"messages\"", ")", ";", "if", "(", "messages", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "try", "{", "URI", "uri", "=", "_queueService", ".", "clone", "(", ")", ".", "segment", "(", "queue", ",", "\"sendbatch\"", ")", ".", "build", "(", ")", ";", "_client", ".", "resource", "(", "uri", ")", ".", "type", "(", "MediaType", ".", "APPLICATION_JSON_TYPE", ")", ".", "header", "(", "ApiKeyRequest", ".", "AUTHENTICATION_HEADER", ",", "apiKey", ")", ".", "post", "(", "messages", ")", ";", "}", "catch", "(", "EmoClientException", "e", ")", "{", "throw", "convertException", "(", "e", ")", ";", "}", "}" ]
Any server can handle sending messages, no need for @PartitionKey
[ "Any", "server", "can", "handle", "sending", "messages", "no", "need", "for" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/queue-client-common/src/main/java/com/bazaarvoice/emodb/queue/client/AbstractQueueClient.java#L59-L76
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/ClassFile.java
ClassFile.getMethodIndex
int getMethodIndex(ExecutableElement method) { """ Returns the constant map index to method @param method @return """ TypeElement declaringClass = (TypeElement) method.getEnclosingElement(); String fullyQualifiedname = declaringClass.getQualifiedName().toString(); return getRefIndex(Methodref.class, fullyQualifiedname, method.getSimpleName().toString(), Descriptor.getDesriptor(method)); }
java
int getMethodIndex(ExecutableElement method) { TypeElement declaringClass = (TypeElement) method.getEnclosingElement(); String fullyQualifiedname = declaringClass.getQualifiedName().toString(); return getRefIndex(Methodref.class, fullyQualifiedname, method.getSimpleName().toString(), Descriptor.getDesriptor(method)); }
[ "int", "getMethodIndex", "(", "ExecutableElement", "method", ")", "{", "TypeElement", "declaringClass", "=", "(", "TypeElement", ")", "method", ".", "getEnclosingElement", "(", ")", ";", "String", "fullyQualifiedname", "=", "declaringClass", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ";", "return", "getRefIndex", "(", "Methodref", ".", "class", ",", "fullyQualifiedname", ",", "method", ".", "getSimpleName", "(", ")", ".", "toString", "(", ")", ",", "Descriptor", ".", "getDesriptor", "(", "method", ")", ")", ";", "}" ]
Returns the constant map index to method @param method @return
[ "Returns", "the", "constant", "map", "index", "to", "method" ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/ClassFile.java#L234-L239
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java
CommandGroupFactoryBean.addCommandMember
private void addCommandMember(String commandId, CommandGroup group) { """ Adds the command object with the given id to the given command group. If a command registry has not yet been provided to this factory, the command id will be passed as a 'lazy placeholder' to the group instead. @param commandId The id of the command to be added to the group. This is expected to be in decoded form, i.e. any command prefixes have been removed. Must not be null. @param group The group that the commands will be added to. Must not be null. """ Assert.notNull(commandId, "commandId"); Assert.notNull(group, "group"); if (logger.isDebugEnabled()) { logger.debug("adding command group member with id [" + commandId + "] to group [" + group.getId() + "]"); } AbstractCommand command = null; if (getCommandRegistry() != null) { command = (AbstractCommand) getCommandRegistry().getCommand(commandId); if (command != null) { group.addInternal(command); } } if (command == null) { group.addLazyInternal(commandId); } }
java
private void addCommandMember(String commandId, CommandGroup group) { Assert.notNull(commandId, "commandId"); Assert.notNull(group, "group"); if (logger.isDebugEnabled()) { logger.debug("adding command group member with id [" + commandId + "] to group [" + group.getId() + "]"); } AbstractCommand command = null; if (getCommandRegistry() != null) { command = (AbstractCommand) getCommandRegistry().getCommand(commandId); if (command != null) { group.addInternal(command); } } if (command == null) { group.addLazyInternal(commandId); } }
[ "private", "void", "addCommandMember", "(", "String", "commandId", ",", "CommandGroup", "group", ")", "{", "Assert", ".", "notNull", "(", "commandId", ",", "\"commandId\"", ")", ";", "Assert", ".", "notNull", "(", "group", ",", "\"group\"", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"adding command group member with id [\"", "+", "commandId", "+", "\"] to group [\"", "+", "group", ".", "getId", "(", ")", "+", "\"]\"", ")", ";", "}", "AbstractCommand", "command", "=", "null", ";", "if", "(", "getCommandRegistry", "(", ")", "!=", "null", ")", "{", "command", "=", "(", "AbstractCommand", ")", "getCommandRegistry", "(", ")", ".", "getCommand", "(", "commandId", ")", ";", "if", "(", "command", "!=", "null", ")", "{", "group", ".", "addInternal", "(", "command", ")", ";", "}", "}", "if", "(", "command", "==", "null", ")", "{", "group", ".", "addLazyInternal", "(", "commandId", ")", ";", "}", "}" ]
Adds the command object with the given id to the given command group. If a command registry has not yet been provided to this factory, the command id will be passed as a 'lazy placeholder' to the group instead. @param commandId The id of the command to be added to the group. This is expected to be in decoded form, i.e. any command prefixes have been removed. Must not be null. @param group The group that the commands will be added to. Must not be null.
[ "Adds", "the", "command", "object", "with", "the", "given", "id", "to", "the", "given", "command", "group", ".", "If", "a", "command", "registry", "has", "not", "yet", "been", "provided", "to", "this", "factory", "the", "command", "id", "will", "be", "passed", "as", "a", "lazy", "placeholder", "to", "the", "group", "instead", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroupFactoryBean.java#L403-L425
looly/hutool
hutool-core/src/main/java/cn/hutool/core/codec/Base64Encoder.java
Base64Encoder.encodeUrlSafe
public static String encodeUrlSafe(String source, String charset) { """ base64编码,URL安全 @param source 被编码的base64字符串 @param charset 字符集 @return 被加密后的字符串 @since 3.0.6 """ return encodeUrlSafe(StrUtil.bytes(source, charset), charset); }
java
public static String encodeUrlSafe(String source, String charset) { return encodeUrlSafe(StrUtil.bytes(source, charset), charset); }
[ "public", "static", "String", "encodeUrlSafe", "(", "String", "source", ",", "String", "charset", ")", "{", "return", "encodeUrlSafe", "(", "StrUtil", ".", "bytes", "(", "source", ",", "charset", ")", ",", "charset", ")", ";", "}" ]
base64编码,URL安全 @param source 被编码的base64字符串 @param charset 字符集 @return 被加密后的字符串 @since 3.0.6
[ "base64编码", "URL安全" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Base64Encoder.java#L87-L89
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/provisioning/OperationsApi.java
OperationsApi.getUsersAsync
public void getUsersAsync(UserSearchParams searchParams, AsyncCallback callback) throws ProvisioningApiException { """ Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param searchParams an object containing the search parameters. Parameters include (limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid). @param callback The callback function called when the skills are returned asynchronously. Callback takes one parameter: Map&lt;String, Object&lt; results. @throws ProvisioningApiException if the call is unsuccessful. """ getUsersAsync( searchParams.getLimit(), searchParams.getOffset(), searchParams.getOrder(), searchParams.getSortBy(), searchParams.getFilterName(), searchParams.getFilterParameters(), searchParams.getRoles(), searchParams.getSkills(), searchParams.getUserEnabled(), searchParams.getUserValid(), callback ); }
java
public void getUsersAsync(UserSearchParams searchParams, AsyncCallback callback) throws ProvisioningApiException { getUsersAsync( searchParams.getLimit(), searchParams.getOffset(), searchParams.getOrder(), searchParams.getSortBy(), searchParams.getFilterName(), searchParams.getFilterParameters(), searchParams.getRoles(), searchParams.getSkills(), searchParams.getUserEnabled(), searchParams.getUserValid(), callback ); }
[ "public", "void", "getUsersAsync", "(", "UserSearchParams", "searchParams", ",", "AsyncCallback", "callback", ")", "throws", "ProvisioningApiException", "{", "getUsersAsync", "(", "searchParams", ".", "getLimit", "(", ")", ",", "searchParams", ".", "getOffset", "(", ")", ",", "searchParams", ".", "getOrder", "(", ")", ",", "searchParams", ".", "getSortBy", "(", ")", ",", "searchParams", ".", "getFilterName", "(", ")", ",", "searchParams", ".", "getFilterParameters", "(", ")", ",", "searchParams", ".", "getRoles", "(", ")", ",", "searchParams", ".", "getSkills", "(", ")", ",", "searchParams", ".", "getUserEnabled", "(", ")", ",", "searchParams", ".", "getUserValid", "(", ")", ",", "callback", ")", ";", "}" ]
Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param searchParams an object containing the search parameters. Parameters include (limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid). @param callback The callback function called when the skills are returned asynchronously. Callback takes one parameter: Map&lt;String, Object&lt; results. @throws ProvisioningApiException if the call is unsuccessful.
[ "Get", "users", ".", "Get", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", ")", "objects", "based", "on", "the", "specified", "filters", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/OperationsApi.java#L96-L110
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java
DwgFile.addDwgObjectOffset
public void addDwgObjectOffset( int handle, int offset ) { """ Add a DWG object offset to the dwgObjectOffsets vector @param handle Object handle @param offset Offset of the object data in the DWG file """ DwgObjectOffset doo = new DwgObjectOffset(handle, offset); dwgObjectOffsets.add(doo); }
java
public void addDwgObjectOffset( int handle, int offset ) { DwgObjectOffset doo = new DwgObjectOffset(handle, offset); dwgObjectOffsets.add(doo); }
[ "public", "void", "addDwgObjectOffset", "(", "int", "handle", ",", "int", "offset", ")", "{", "DwgObjectOffset", "doo", "=", "new", "DwgObjectOffset", "(", "handle", ",", "offset", ")", ";", "dwgObjectOffsets", ".", "add", "(", "doo", ")", ";", "}" ]
Add a DWG object offset to the dwgObjectOffsets vector @param handle Object handle @param offset Offset of the object data in the DWG file
[ "Add", "a", "DWG", "object", "offset", "to", "the", "dwgObjectOffsets", "vector" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L1152-L1155
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java
LatLongUtils.distanceSegmentPoint
public static double distanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) { """ Returns the distance between the given segment and point. <p> libGDX (Apache 2.0) """ Point nearest = nearestSegmentPoint(startX, startY, endX, endY, pointX, pointY); return Math.hypot(nearest.x - pointX, nearest.y - pointY); }
java
public static double distanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) { Point nearest = nearestSegmentPoint(startX, startY, endX, endY, pointX, pointY); return Math.hypot(nearest.x - pointX, nearest.y - pointY); }
[ "public", "static", "double", "distanceSegmentPoint", "(", "double", "startX", ",", "double", "startY", ",", "double", "endX", ",", "double", "endY", ",", "double", "pointX", ",", "double", "pointY", ")", "{", "Point", "nearest", "=", "nearestSegmentPoint", "(", "startX", ",", "startY", ",", "endX", ",", "endY", ",", "pointX", ",", "pointY", ")", ";", "return", "Math", ".", "hypot", "(", "nearest", ".", "x", "-", "pointX", ",", "nearest", ".", "y", "-", "pointY", ")", ";", "}" ]
Returns the distance between the given segment and point. <p> libGDX (Apache 2.0)
[ "Returns", "the", "distance", "between", "the", "given", "segment", "and", "point", ".", "<p", ">", "libGDX", "(", "Apache", "2", ".", "0", ")" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java#L167-L170
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/QueryRecord.java
QueryRecord.addRelationship
public void addRelationship(int linkType, Record recLeft, Record recRight, String fldLeft1, String fldRight1, String fldLeft2, String fldRight2, String fldLeft3, String fldRight3) { """ Add this table link to this query. Creates a new tablelink and adds it to the link list. """ new TableLink(this, linkType, recLeft, recRight, fldLeft1, fldRight1, fldLeft2, fldRight2, fldLeft3, fldRight3); }
java
public void addRelationship(int linkType, Record recLeft, Record recRight, String fldLeft1, String fldRight1, String fldLeft2, String fldRight2, String fldLeft3, String fldRight3) { new TableLink(this, linkType, recLeft, recRight, fldLeft1, fldRight1, fldLeft2, fldRight2, fldLeft3, fldRight3); }
[ "public", "void", "addRelationship", "(", "int", "linkType", ",", "Record", "recLeft", ",", "Record", "recRight", ",", "String", "fldLeft1", ",", "String", "fldRight1", ",", "String", "fldLeft2", ",", "String", "fldRight2", ",", "String", "fldLeft3", ",", "String", "fldRight3", ")", "{", "new", "TableLink", "(", "this", ",", "linkType", ",", "recLeft", ",", "recRight", ",", "fldLeft1", ",", "fldRight1", ",", "fldLeft2", ",", "fldRight2", ",", "fldLeft3", ",", "fldRight3", ")", ";", "}" ]
Add this table link to this query. Creates a new tablelink and adds it to the link list.
[ "Add", "this", "table", "link", "to", "this", "query", ".", "Creates", "a", "new", "tablelink", "and", "adds", "it", "to", "the", "link", "list", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/QueryRecord.java#L176-L179
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/path/PathBuilder.java
PathBuilder.cubicTo
public PathBuilder cubicTo(Point2d cp1, Point2d cp2, Point2d ep) { """ Make a cubic curve in the path, with two control points. @param cp1 the first control point @param cp2 the second control point @param ep the end point of the curve @return a reference to this builder """ add(new CubicTo(cp1, cp2, ep)); return this; }
java
public PathBuilder cubicTo(Point2d cp1, Point2d cp2, Point2d ep) { add(new CubicTo(cp1, cp2, ep)); return this; }
[ "public", "PathBuilder", "cubicTo", "(", "Point2d", "cp1", ",", "Point2d", "cp2", ",", "Point2d", "ep", ")", "{", "add", "(", "new", "CubicTo", "(", "cp1", ",", "cp2", ",", "ep", ")", ")", ";", "return", "this", ";", "}" ]
Make a cubic curve in the path, with two control points. @param cp1 the first control point @param cp2 the second control point @param ep the end point of the curve @return a reference to this builder
[ "Make", "a", "cubic", "curve", "in", "the", "path", "with", "two", "control", "points", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/path/PathBuilder.java#L124-L127
aws/aws-sdk-java
aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/ResultByTime.java
ResultByTime.withTotal
public ResultByTime withTotal(java.util.Map<String, MetricValue> total) { """ <p> The total amount of cost or usage accrued during the time period. </p> @param total The total amount of cost or usage accrued during the time period. @return Returns a reference to this object so that method calls can be chained together. """ setTotal(total); return this; }
java
public ResultByTime withTotal(java.util.Map<String, MetricValue> total) { setTotal(total); return this; }
[ "public", "ResultByTime", "withTotal", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "MetricValue", ">", "total", ")", "{", "setTotal", "(", "total", ")", ";", "return", "this", ";", "}" ]
<p> The total amount of cost or usage accrued during the time period. </p> @param total The total amount of cost or usage accrued during the time period. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "total", "amount", "of", "cost", "or", "usage", "accrued", "during", "the", "time", "period", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/ResultByTime.java#L131-L134
LearnLib/automatalib
util/src/main/java/net/automatalib/util/ts/copy/TSCopy.java
TSCopy.copy
public static <S1, I1, T1, SP, TP, S2, I2, T2> Mapping<S1, S2> copy(TSTraversalMethod method, UniversalTransitionSystem<S1, ? super I1, T1, ? extends SP, ? extends TP> in, int limit, Collection<? extends I1> inputs, MutableAutomaton<S2, I2, T2, ? super SP, ? super TP> out, Function<? super I1, ? extends I2> inputsMapping) { """ Copies a {@link UniversalAutomaton} with possibly heterogeneous input alphabets, but compatible properties. States and transitions will not be filtered @param method the traversal method to use @param in the input transition system @param limit the traversal limit, a value less than 0 means no limit @param inputs the inputs to consider @param out the output automaton @param inputsMapping a mapping from inputs in the input automaton to inputs in the output automaton @return a mapping from old to new states """ return copy(method, in, limit, inputs, out, inputsMapping, x -> true, TransitionPredicates.alwaysTrue()); }
java
public static <S1, I1, T1, SP, TP, S2, I2, T2> Mapping<S1, S2> copy(TSTraversalMethod method, UniversalTransitionSystem<S1, ? super I1, T1, ? extends SP, ? extends TP> in, int limit, Collection<? extends I1> inputs, MutableAutomaton<S2, I2, T2, ? super SP, ? super TP> out, Function<? super I1, ? extends I2> inputsMapping) { return copy(method, in, limit, inputs, out, inputsMapping, x -> true, TransitionPredicates.alwaysTrue()); }
[ "public", "static", "<", "S1", ",", "I1", ",", "T1", ",", "SP", ",", "TP", ",", "S2", ",", "I2", ",", "T2", ">", "Mapping", "<", "S1", ",", "S2", ">", "copy", "(", "TSTraversalMethod", "method", ",", "UniversalTransitionSystem", "<", "S1", ",", "?", "super", "I1", ",", "T1", ",", "?", "extends", "SP", ",", "?", "extends", "TP", ">", "in", ",", "int", "limit", ",", "Collection", "<", "?", "extends", "I1", ">", "inputs", ",", "MutableAutomaton", "<", "S2", ",", "I2", ",", "T2", ",", "?", "super", "SP", ",", "?", "super", "TP", ">", "out", ",", "Function", "<", "?", "super", "I1", ",", "?", "extends", "I2", ">", "inputsMapping", ")", "{", "return", "copy", "(", "method", ",", "in", ",", "limit", ",", "inputs", ",", "out", ",", "inputsMapping", ",", "x", "->", "true", ",", "TransitionPredicates", ".", "alwaysTrue", "(", ")", ")", ";", "}" ]
Copies a {@link UniversalAutomaton} with possibly heterogeneous input alphabets, but compatible properties. States and transitions will not be filtered @param method the traversal method to use @param in the input transition system @param limit the traversal limit, a value less than 0 means no limit @param inputs the inputs to consider @param out the output automaton @param inputsMapping a mapping from inputs in the input automaton to inputs in the output automaton @return a mapping from old to new states
[ "Copies", "a", "{", "@link", "UniversalAutomaton", "}", "with", "possibly", "heterogeneous", "input", "alphabets", "but", "compatible", "properties", ".", "States", "and", "transitions", "will", "not", "be", "filtered" ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/ts/copy/TSCopy.java#L415-L422
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/net/BlockingClient.java
BlockingClient.runReadLoop
public static void runReadLoop(InputStream stream, StreamConnection connection) throws Exception { """ A blocking call that never returns, except by throwing an exception. It reads bytes from the input stream and feeds them to the provided {@link StreamConnection}, for example, a {@link Peer}. """ ByteBuffer dbuf = ByteBuffer.allocateDirect(Math.min(Math.max(connection.getMaxMessageSize(), BUFFER_SIZE_LOWER_BOUND), BUFFER_SIZE_UPPER_BOUND)); byte[] readBuff = new byte[dbuf.capacity()]; while (true) { // TODO Kill the message duplication here checkState(dbuf.remaining() > 0 && dbuf.remaining() <= readBuff.length); int read = stream.read(readBuff, 0, Math.max(1, Math.min(dbuf.remaining(), stream.available()))); if (read == -1) return; dbuf.put(readBuff, 0, read); // "flip" the buffer - setting the limit to the current position and setting position to 0 dbuf.flip(); // Use connection.receiveBytes's return value as a double-check that it stopped reading at the right // location int bytesConsumed = connection.receiveBytes(dbuf); checkState(dbuf.position() == bytesConsumed); // Now drop the bytes which were read by compacting dbuf (resetting limit and keeping relative // position) dbuf.compact(); } }
java
public static void runReadLoop(InputStream stream, StreamConnection connection) throws Exception { ByteBuffer dbuf = ByteBuffer.allocateDirect(Math.min(Math.max(connection.getMaxMessageSize(), BUFFER_SIZE_LOWER_BOUND), BUFFER_SIZE_UPPER_BOUND)); byte[] readBuff = new byte[dbuf.capacity()]; while (true) { // TODO Kill the message duplication here checkState(dbuf.remaining() > 0 && dbuf.remaining() <= readBuff.length); int read = stream.read(readBuff, 0, Math.max(1, Math.min(dbuf.remaining(), stream.available()))); if (read == -1) return; dbuf.put(readBuff, 0, read); // "flip" the buffer - setting the limit to the current position and setting position to 0 dbuf.flip(); // Use connection.receiveBytes's return value as a double-check that it stopped reading at the right // location int bytesConsumed = connection.receiveBytes(dbuf); checkState(dbuf.position() == bytesConsumed); // Now drop the bytes which were read by compacting dbuf (resetting limit and keeping relative // position) dbuf.compact(); } }
[ "public", "static", "void", "runReadLoop", "(", "InputStream", "stream", ",", "StreamConnection", "connection", ")", "throws", "Exception", "{", "ByteBuffer", "dbuf", "=", "ByteBuffer", ".", "allocateDirect", "(", "Math", ".", "min", "(", "Math", ".", "max", "(", "connection", ".", "getMaxMessageSize", "(", ")", ",", "BUFFER_SIZE_LOWER_BOUND", ")", ",", "BUFFER_SIZE_UPPER_BOUND", ")", ")", ";", "byte", "[", "]", "readBuff", "=", "new", "byte", "[", "dbuf", ".", "capacity", "(", ")", "]", ";", "while", "(", "true", ")", "{", "// TODO Kill the message duplication here", "checkState", "(", "dbuf", ".", "remaining", "(", ")", ">", "0", "&&", "dbuf", ".", "remaining", "(", ")", "<=", "readBuff", ".", "length", ")", ";", "int", "read", "=", "stream", ".", "read", "(", "readBuff", ",", "0", ",", "Math", ".", "max", "(", "1", ",", "Math", ".", "min", "(", "dbuf", ".", "remaining", "(", ")", ",", "stream", ".", "available", "(", ")", ")", ")", ")", ";", "if", "(", "read", "==", "-", "1", ")", "return", ";", "dbuf", ".", "put", "(", "readBuff", ",", "0", ",", "read", ")", ";", "// \"flip\" the buffer - setting the limit to the current position and setting position to 0", "dbuf", ".", "flip", "(", ")", ";", "// Use connection.receiveBytes's return value as a double-check that it stopped reading at the right", "// location", "int", "bytesConsumed", "=", "connection", ".", "receiveBytes", "(", "dbuf", ")", ";", "checkState", "(", "dbuf", ".", "position", "(", ")", "==", "bytesConsumed", ")", ";", "// Now drop the bytes which were read by compacting dbuf (resetting limit and keeping relative", "// position)", "dbuf", ".", "compact", "(", ")", ";", "}", "}" ]
A blocking call that never returns, except by throwing an exception. It reads bytes from the input stream and feeds them to the provided {@link StreamConnection}, for example, a {@link Peer}.
[ "A", "blocking", "call", "that", "never", "returns", "except", "by", "throwing", "an", "exception", ".", "It", "reads", "bytes", "from", "the", "input", "stream", "and", "feeds", "them", "to", "the", "provided", "{" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/net/BlockingClient.java#L108-L128
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java
DefaultInputFile.newRange
public TextRange newRange(int startOffset, int endOffset) { """ Create Range from global offsets. Used for backward compatibility with older API. """ checkMetadata(); return newRangeValidPointers(newPointer(startOffset), newPointer(endOffset), false); }
java
public TextRange newRange(int startOffset, int endOffset) { checkMetadata(); return newRangeValidPointers(newPointer(startOffset), newPointer(endOffset), false); }
[ "public", "TextRange", "newRange", "(", "int", "startOffset", ",", "int", "endOffset", ")", "{", "checkMetadata", "(", ")", ";", "return", "newRangeValidPointers", "(", "newPointer", "(", "startOffset", ")", ",", "newPointer", "(", "endOffset", ")", ",", "false", ")", ";", "}" ]
Create Range from global offsets. Used for backward compatibility with older API.
[ "Create", "Range", "from", "global", "offsets", ".", "Used", "for", "backward", "compatibility", "with", "older", "API", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java#L309-L312
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java
BAMInputFormat.convertSimpleIntervalToQueryInterval
private static QueryInterval convertSimpleIntervalToQueryInterval( final Interval interval, final SAMSequenceDictionary sequenceDictionary ) { """ Converts an interval in SimpleInterval format into an htsjdk QueryInterval. In doing so, a header lookup is performed to convert from contig name to index @param interval interval to convert @param sequenceDictionary sequence dictionary used to perform the conversion @return an equivalent interval in QueryInterval format """ if (interval == null) { throw new IllegalArgumentException("interval may not be null"); } if (sequenceDictionary == null) { throw new IllegalArgumentException("sequence dictionary may not be null"); } final int contigIndex = sequenceDictionary.getSequenceIndex(interval.getContig()); if ( contigIndex == -1 ) { throw new IllegalArgumentException("Contig " + interval.getContig() + " not present in reads sequence " + "dictionary"); } return new QueryInterval(contigIndex, interval.getStart(), interval.getEnd()); }
java
private static QueryInterval convertSimpleIntervalToQueryInterval( final Interval interval, final SAMSequenceDictionary sequenceDictionary ) { if (interval == null) { throw new IllegalArgumentException("interval may not be null"); } if (sequenceDictionary == null) { throw new IllegalArgumentException("sequence dictionary may not be null"); } final int contigIndex = sequenceDictionary.getSequenceIndex(interval.getContig()); if ( contigIndex == -1 ) { throw new IllegalArgumentException("Contig " + interval.getContig() + " not present in reads sequence " + "dictionary"); } return new QueryInterval(contigIndex, interval.getStart(), interval.getEnd()); }
[ "private", "static", "QueryInterval", "convertSimpleIntervalToQueryInterval", "(", "final", "Interval", "interval", ",", "final", "SAMSequenceDictionary", "sequenceDictionary", ")", "{", "if", "(", "interval", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"interval may not be null\"", ")", ";", "}", "if", "(", "sequenceDictionary", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"sequence dictionary may not be null\"", ")", ";", "}", "final", "int", "contigIndex", "=", "sequenceDictionary", ".", "getSequenceIndex", "(", "interval", ".", "getContig", "(", ")", ")", ";", "if", "(", "contigIndex", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Contig \"", "+", "interval", ".", "getContig", "(", ")", "+", "\" not present in reads sequence \"", "+", "\"dictionary\"", ")", ";", "}", "return", "new", "QueryInterval", "(", "contigIndex", ",", "interval", ".", "getStart", "(", ")", ",", "interval", ".", "getEnd", "(", ")", ")", ";", "}" ]
Converts an interval in SimpleInterval format into an htsjdk QueryInterval. In doing so, a header lookup is performed to convert from contig name to index @param interval interval to convert @param sequenceDictionary sequence dictionary used to perform the conversion @return an equivalent interval in QueryInterval format
[ "Converts", "an", "interval", "in", "SimpleInterval", "format", "into", "an", "htsjdk", "QueryInterval", "." ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java#L675-L690
zxing/zxing
android/src/com/google/zxing/client/android/camera/CameraManager.java
CameraManager.requestPreviewFrame
public synchronized void requestPreviewFrame(Handler handler, int message) { """ A single preview frame will be returned to the handler supplied. The data will arrive as byte[] in the message.obj field, with width and height encoded as message.arg1 and message.arg2, respectively. @param handler The handler to send the message to. @param message The what field of the message to be sent. """ OpenCamera theCamera = camera; if (theCamera != null && previewing) { previewCallback.setHandler(handler, message); theCamera.getCamera().setOneShotPreviewCallback(previewCallback); } }
java
public synchronized void requestPreviewFrame(Handler handler, int message) { OpenCamera theCamera = camera; if (theCamera != null && previewing) { previewCallback.setHandler(handler, message); theCamera.getCamera().setOneShotPreviewCallback(previewCallback); } }
[ "public", "synchronized", "void", "requestPreviewFrame", "(", "Handler", "handler", ",", "int", "message", ")", "{", "OpenCamera", "theCamera", "=", "camera", ";", "if", "(", "theCamera", "!=", "null", "&&", "previewing", ")", "{", "previewCallback", ".", "setHandler", "(", "handler", ",", "message", ")", ";", "theCamera", ".", "getCamera", "(", ")", ".", "setOneShotPreviewCallback", "(", "previewCallback", ")", ";", "}", "}" ]
A single preview frame will be returned to the handler supplied. The data will arrive as byte[] in the message.obj field, with width and height encoded as message.arg1 and message.arg2, respectively. @param handler The handler to send the message to. @param message The what field of the message to be sent.
[ "A", "single", "preview", "frame", "will", "be", "returned", "to", "the", "handler", "supplied", ".", "The", "data", "will", "arrive", "as", "byte", "[]", "in", "the", "message", ".", "obj", "field", "with", "width", "and", "height", "encoded", "as", "message", ".", "arg1", "and", "message", ".", "arg2", "respectively", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L198-L204
bootique/bootique-jersey
bootique-jersey/src/main/java/io/bootique/jersey/JerseyModuleExtender.java
JerseyModuleExtender.setProperty
public JerseyModuleExtender setProperty(String name, Object value) { """ Sets Jersey container property. This allows setting ResourceConfig properties that can not be set via JAX RS features. @param name property name @param value property value @return @see org.glassfish.jersey.server.ServerProperties @since 0.22 """ contributeProperties().addBinding(name).toInstance(value); return this; }
java
public JerseyModuleExtender setProperty(String name, Object value) { contributeProperties().addBinding(name).toInstance(value); return this; }
[ "public", "JerseyModuleExtender", "setProperty", "(", "String", "name", ",", "Object", "value", ")", "{", "contributeProperties", "(", ")", ".", "addBinding", "(", "name", ")", ".", "toInstance", "(", "value", ")", ";", "return", "this", ";", "}" ]
Sets Jersey container property. This allows setting ResourceConfig properties that can not be set via JAX RS features. @param name property name @param value property value @return @see org.glassfish.jersey.server.ServerProperties @since 0.22
[ "Sets", "Jersey", "container", "property", ".", "This", "allows", "setting", "ResourceConfig", "properties", "that", "can", "not", "be", "set", "via", "JAX", "RS", "features", "." ]
train
https://github.com/bootique/bootique-jersey/blob/8def056158f0ad1914e975625eb5ed3e4712648c/bootique-jersey/src/main/java/io/bootique/jersey/JerseyModuleExtender.java#L104-L107
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.isSubclass
public static boolean isSubclass(String superclass, String otherclass) { """ Checks whether the "otherclass" is a subclass of the given "superclass". @param superclass the superclass to check against @param otherclass this class is checked whether it is a subclass of the the superclass @return TRUE if "otherclass" is a true subclass """ String key; key = superclass + "-" + otherclass; if (m_CheckSubClass.containsKey(key)) return m_CheckSubClass.get(key); try { return isSubclass(Class.forName(superclass), Class.forName(otherclass)); } catch (Throwable t) { return false; } }
java
public static boolean isSubclass(String superclass, String otherclass) { String key; key = superclass + "-" + otherclass; if (m_CheckSubClass.containsKey(key)) return m_CheckSubClass.get(key); try { return isSubclass(Class.forName(superclass), Class.forName(otherclass)); } catch (Throwable t) { return false; } }
[ "public", "static", "boolean", "isSubclass", "(", "String", "superclass", ",", "String", "otherclass", ")", "{", "String", "key", ";", "key", "=", "superclass", "+", "\"-\"", "+", "otherclass", ";", "if", "(", "m_CheckSubClass", ".", "containsKey", "(", "key", ")", ")", "return", "m_CheckSubClass", ".", "get", "(", "key", ")", ";", "try", "{", "return", "isSubclass", "(", "Class", ".", "forName", "(", "superclass", ")", ",", "Class", ".", "forName", "(", "otherclass", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "return", "false", ";", "}", "}" ]
Checks whether the "otherclass" is a subclass of the given "superclass". @param superclass the superclass to check against @param otherclass this class is checked whether it is a subclass of the the superclass @return TRUE if "otherclass" is a true subclass
[ "Checks", "whether", "the", "otherclass", "is", "a", "subclass", "of", "the", "given", "superclass", "." ]
train
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L588-L601
igniterealtime/Smack
smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java
AgentSession.getAgentHistory
public AgentChatHistory getAgentHistory(EntityBareJid jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException, InterruptedException { """ Retrieves the AgentChatHistory associated with a particular agent jid. @param jid the jid of the agent. @param maxSessions the max number of sessions to retrieve. @param startDate point in time from which on history should get retrieved. @return the chat history associated with a given jid. @throws XMPPException if an error occurs while retrieving the AgentChatHistory. @throws NotConnectedException @throws InterruptedException """ AgentChatHistory request; if (startDate != null) { request = new AgentChatHistory(jid, maxSessions, startDate); } else { request = new AgentChatHistory(jid, maxSessions); } request.setType(IQ.Type.get); request.setTo(workgroupJID); AgentChatHistory response = connection.createStanzaCollectorAndSend( request).nextResult(); return response; }
java
public AgentChatHistory getAgentHistory(EntityBareJid jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException, InterruptedException { AgentChatHistory request; if (startDate != null) { request = new AgentChatHistory(jid, maxSessions, startDate); } else { request = new AgentChatHistory(jid, maxSessions); } request.setType(IQ.Type.get); request.setTo(workgroupJID); AgentChatHistory response = connection.createStanzaCollectorAndSend( request).nextResult(); return response; }
[ "public", "AgentChatHistory", "getAgentHistory", "(", "EntityBareJid", "jid", ",", "int", "maxSessions", ",", "Date", "startDate", ")", "throws", "XMPPException", ",", "NotConnectedException", ",", "InterruptedException", "{", "AgentChatHistory", "request", ";", "if", "(", "startDate", "!=", "null", ")", "{", "request", "=", "new", "AgentChatHistory", "(", "jid", ",", "maxSessions", ",", "startDate", ")", ";", "}", "else", "{", "request", "=", "new", "AgentChatHistory", "(", "jid", ",", "maxSessions", ")", ";", "}", "request", ".", "setType", "(", "IQ", ".", "Type", ".", "get", ")", ";", "request", ".", "setTo", "(", "workgroupJID", ")", ";", "AgentChatHistory", "response", "=", "connection", ".", "createStanzaCollectorAndSend", "(", "request", ")", ".", "nextResult", "(", ")", ";", "return", "response", ";", "}" ]
Retrieves the AgentChatHistory associated with a particular agent jid. @param jid the jid of the agent. @param maxSessions the max number of sessions to retrieve. @param startDate point in time from which on history should get retrieved. @return the chat history associated with a given jid. @throws XMPPException if an error occurs while retrieving the AgentChatHistory. @throws NotConnectedException @throws InterruptedException
[ "Retrieves", "the", "AgentChatHistory", "associated", "with", "a", "particular", "agent", "jid", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L896-L912
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateUUID
public static <T extends CharSequence> T validateUUID(T value, String errorMsg) throws ValidateException { """ 验证是否为UUID<br> 包括带横线标准格式和不带横线的简单模式 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常 """ if (false == isUUID(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateUUID(T value, String errorMsg) throws ValidateException { if (false == isUUID(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateUUID", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isUUID", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsg", ")", ";", "}", "return", "value", ";", "}" ]
验证是否为UUID<br> 包括带横线标准格式和不带横线的简单模式 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为UUID<br", ">", "包括带横线标准格式和不带横线的简单模式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L1002-L1007
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java
AlertResources.deleteNotificationsById
@DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/ { """ Deletes the notification. @param req The HttpServlet request object. Cannot be null. @param alertId The alert Id. Cannot be null and must be a positive non-zero number. @param notificationId The notification id. Cannot be null and must be a positive non-zero number. @return Updated alert object. @throws WebApplicationException The exception with 404 status will be thrown if an alert does not exist. """alertId}/notifications/{notificationId}") @Description( "Deletes a notification having the given ID if it is associated with the given alert ID. Associated triggers are not deleted from the alert." ) public Response deleteNotificationsById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId, @PathParam("notificationId") BigInteger notificationId) { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (notificationId == null || notificationId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Notification Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Alert alert = alertService.findAlertByPrimaryKey(alertId); if (alert == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req)); List<Notification> listNotification = new ArrayList<Notification>(alert.getNotifications()); Iterator<Notification> it = listNotification.iterator(); while (it.hasNext()) { Notification notification = it.next(); if (notification.getId().equals(notificationId)) { it.remove(); alert.setNotifications(listNotification); alert.setModifiedBy(getRemoteUser(req)); alertService.updateAlert(alert); return Response.status(Status.OK).build(); } } throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); }
java
@DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{alertId}/notifications/{notificationId}") @Description( "Deletes a notification having the given ID if it is associated with the given alert ID. Associated triggers are not deleted from the alert." ) public Response deleteNotificationsById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId, @PathParam("notificationId") BigInteger notificationId) { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (notificationId == null || notificationId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Notification Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Alert alert = alertService.findAlertByPrimaryKey(alertId); if (alert == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req)); List<Notification> listNotification = new ArrayList<Notification>(alert.getNotifications()); Iterator<Notification> it = listNotification.iterator(); while (it.hasNext()) { Notification notification = it.next(); if (notification.getId().equals(notificationId)) { it.remove(); alert.setNotifications(listNotification); alert.setModifiedBy(getRemoteUser(req)); alertService.updateAlert(alert); return Response.status(Status.OK).build(); } } throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); }
[ "@", "DELETE", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"/{alertId}/notifications/{notificationId}\"", ")", "@", "Description", "(", "\"Deletes a notification having the given ID if it is associated with the given alert ID. Associated triggers are not deleted from the alert.\"", ")", "public", "Response", "deleteNotificationsById", "(", "@", "Context", "HttpServletRequest", "req", ",", "@", "PathParam", "(", "\"alertId\"", ")", "BigInteger", "alertId", ",", "@", "PathParam", "(", "\"notificationId\"", ")", "BigInteger", "notificationId", ")", "{", "if", "(", "alertId", "==", "null", "||", "alertId", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "1", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Alert Id cannot be null and must be a positive non-zero number.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "if", "(", "notificationId", "==", "null", "||", "notificationId", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "1", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Notification Id cannot be null and must be a positive non-zero number.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "Alert", "alert", "=", "alertService", ".", "findAlertByPrimaryKey", "(", "alertId", ")", ";", "if", "(", "alert", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "Status", ".", "NOT_FOUND", ".", "getReasonPhrase", "(", ")", ",", "Response", ".", "Status", ".", "NOT_FOUND", ")", ";", "}", "validateResourceAuthorization", "(", "req", ",", "alert", ".", "getOwner", "(", ")", ",", "getRemoteUser", "(", "req", ")", ")", ";", "List", "<", "Notification", ">", "listNotification", "=", "new", "ArrayList", "<", "Notification", ">", "(", "alert", ".", "getNotifications", "(", ")", ")", ";", "Iterator", "<", "Notification", ">", "it", "=", "listNotification", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Notification", "notification", "=", "it", ".", "next", "(", ")", ";", "if", "(", "notification", ".", "getId", "(", ")", ".", "equals", "(", "notificationId", ")", ")", "{", "it", ".", "remove", "(", ")", ";", "alert", ".", "setNotifications", "(", "listNotification", ")", ";", "alert", ".", "setModifiedBy", "(", "getRemoteUser", "(", "req", ")", ")", ";", "alertService", ".", "updateAlert", "(", "alert", ")", ";", "return", "Response", ".", "status", "(", "Status", ".", "OK", ")", ".", "build", "(", ")", ";", "}", "}", "throw", "new", "WebApplicationException", "(", "Response", ".", "Status", ".", "NOT_FOUND", ".", "getReasonPhrase", "(", ")", ",", "Response", ".", "Status", ".", "NOT_FOUND", ")", ";", "}" ]
Deletes the notification. @param req The HttpServlet request object. Cannot be null. @param alertId The alert Id. Cannot be null and must be a positive non-zero number. @param notificationId The notification id. Cannot be null and must be a positive non-zero number. @return Updated alert object. @throws WebApplicationException The exception with 404 status will be thrown if an alert does not exist.
[ "Deletes", "the", "notification", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java#L1043-L1081
haifengl/smile
nlp/src/main/java/smile/nlp/Trie.java
Trie.put
public void put(K[] key, V value) { """ Add a key with associated value to the trie. @param key the key. @param value the value. """ Node child = root.get(key[0]); if (child == null) { child = new Node(key[0]); root.put(key[0], child); } child.addChild(key, value, 1); }
java
public void put(K[] key, V value) { Node child = root.get(key[0]); if (child == null) { child = new Node(key[0]); root.put(key[0], child); } child.addChild(key, value, 1); }
[ "public", "void", "put", "(", "K", "[", "]", "key", ",", "V", "value", ")", "{", "Node", "child", "=", "root", ".", "get", "(", "key", "[", "0", "]", ")", ";", "if", "(", "child", "==", "null", ")", "{", "child", "=", "new", "Node", "(", "key", "[", "0", "]", ")", ";", "root", ".", "put", "(", "key", "[", "0", "]", ",", "child", ")", ";", "}", "child", ".", "addChild", "(", "key", ",", "value", ",", "1", ")", ";", "}" ]
Add a key with associated value to the trie. @param key the key. @param value the value.
[ "Add", "a", "key", "with", "associated", "value", "to", "the", "trie", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/nlp/src/main/java/smile/nlp/Trie.java#L136-L143
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/CASH.java
CASH.runDerivator
private LinearEquationSystem runDerivator(Relation<ParameterizationFunction> relation, int dimensionality, DBIDs ids) { """ Runs the derivator on the specified interval and assigns all points having a distance less then the standard deviation of the derivator model to the model to this model. @param relation the database containing the parameterization functions @param ids the ids to build the model @param dimensionality the dimensionality of the subspace @return a basis of the found subspace """ try { // build database for derivator Database derivatorDB = buildDerivatorDB(relation, ids); PCARunner pca = new PCARunner(new StandardCovarianceMatrixBuilder()); EigenPairFilter filter = new FirstNEigenPairFilter(dimensionality); DependencyDerivator<DoubleVector> derivator = new DependencyDerivator<>(null, FormatUtil.NF4, pca, filter, 0, false); CorrelationAnalysisSolution<DoubleVector> model = derivator.run(derivatorDB); LinearEquationSystem les = model.getNormalizedLinearEquationSystem(null); return les; } catch(NonNumericFeaturesException e) { throw new IllegalStateException("Error during normalization" + e); } }
java
private LinearEquationSystem runDerivator(Relation<ParameterizationFunction> relation, int dimensionality, DBIDs ids) { try { // build database for derivator Database derivatorDB = buildDerivatorDB(relation, ids); PCARunner pca = new PCARunner(new StandardCovarianceMatrixBuilder()); EigenPairFilter filter = new FirstNEigenPairFilter(dimensionality); DependencyDerivator<DoubleVector> derivator = new DependencyDerivator<>(null, FormatUtil.NF4, pca, filter, 0, false); CorrelationAnalysisSolution<DoubleVector> model = derivator.run(derivatorDB); LinearEquationSystem les = model.getNormalizedLinearEquationSystem(null); return les; } catch(NonNumericFeaturesException e) { throw new IllegalStateException("Error during normalization" + e); } }
[ "private", "LinearEquationSystem", "runDerivator", "(", "Relation", "<", "ParameterizationFunction", ">", "relation", ",", "int", "dimensionality", ",", "DBIDs", "ids", ")", "{", "try", "{", "// build database for derivator", "Database", "derivatorDB", "=", "buildDerivatorDB", "(", "relation", ",", "ids", ")", ";", "PCARunner", "pca", "=", "new", "PCARunner", "(", "new", "StandardCovarianceMatrixBuilder", "(", ")", ")", ";", "EigenPairFilter", "filter", "=", "new", "FirstNEigenPairFilter", "(", "dimensionality", ")", ";", "DependencyDerivator", "<", "DoubleVector", ">", "derivator", "=", "new", "DependencyDerivator", "<>", "(", "null", ",", "FormatUtil", ".", "NF4", ",", "pca", ",", "filter", ",", "0", ",", "false", ")", ";", "CorrelationAnalysisSolution", "<", "DoubleVector", ">", "model", "=", "derivator", ".", "run", "(", "derivatorDB", ")", ";", "LinearEquationSystem", "les", "=", "model", ".", "getNormalizedLinearEquationSystem", "(", "null", ")", ";", "return", "les", ";", "}", "catch", "(", "NonNumericFeaturesException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error during normalization\"", "+", "e", ")", ";", "}", "}" ]
Runs the derivator on the specified interval and assigns all points having a distance less then the standard deviation of the derivator model to the model to this model. @param relation the database containing the parameterization functions @param ids the ids to build the model @param dimensionality the dimensionality of the subspace @return a basis of the found subspace
[ "Runs", "the", "derivator", "on", "the", "specified", "interval", "and", "assigns", "all", "points", "having", "a", "distance", "less", "then", "the", "standard", "deviation", "of", "the", "derivator", "model", "to", "the", "model", "to", "this", "model", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/CASH.java#L692-L708
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/registry/CachingCodecRegistry.java
CachingCodecRegistry.createCodec
protected TypeCodec<?> createCodec(GenericType<?> javaType, boolean isJavaCovariant) { """ Variant where the CQL type is unknown. Can be covariant if we come from a lookup by Java value. """ TypeToken<?> token = javaType.__getToken(); if (List.class.isAssignableFrom(token.getRawType()) && token.getType() instanceof ParameterizedType) { Type[] typeArguments = ((ParameterizedType) token.getType()).getActualTypeArguments(); GenericType<?> elementType = GenericType.of(typeArguments[0]); TypeCodec<?> elementCodec = codecFor(elementType, isJavaCovariant); return TypeCodecs.listOf(elementCodec); } else if (Set.class.isAssignableFrom(token.getRawType()) && token.getType() instanceof ParameterizedType) { Type[] typeArguments = ((ParameterizedType) token.getType()).getActualTypeArguments(); GenericType<?> elementType = GenericType.of(typeArguments[0]); TypeCodec<?> elementCodec = codecFor(elementType, isJavaCovariant); return TypeCodecs.setOf(elementCodec); } else if (Map.class.isAssignableFrom(token.getRawType()) && token.getType() instanceof ParameterizedType) { Type[] typeArguments = ((ParameterizedType) token.getType()).getActualTypeArguments(); GenericType<?> keyType = GenericType.of(typeArguments[0]); GenericType<?> valueType = GenericType.of(typeArguments[1]); TypeCodec<?> keyCodec = codecFor(keyType, isJavaCovariant); TypeCodec<?> valueCodec = codecFor(valueType, isJavaCovariant); return TypeCodecs.mapOf(keyCodec, valueCodec); } throw new CodecNotFoundException(null, javaType); }
java
protected TypeCodec<?> createCodec(GenericType<?> javaType, boolean isJavaCovariant) { TypeToken<?> token = javaType.__getToken(); if (List.class.isAssignableFrom(token.getRawType()) && token.getType() instanceof ParameterizedType) { Type[] typeArguments = ((ParameterizedType) token.getType()).getActualTypeArguments(); GenericType<?> elementType = GenericType.of(typeArguments[0]); TypeCodec<?> elementCodec = codecFor(elementType, isJavaCovariant); return TypeCodecs.listOf(elementCodec); } else if (Set.class.isAssignableFrom(token.getRawType()) && token.getType() instanceof ParameterizedType) { Type[] typeArguments = ((ParameterizedType) token.getType()).getActualTypeArguments(); GenericType<?> elementType = GenericType.of(typeArguments[0]); TypeCodec<?> elementCodec = codecFor(elementType, isJavaCovariant); return TypeCodecs.setOf(elementCodec); } else if (Map.class.isAssignableFrom(token.getRawType()) && token.getType() instanceof ParameterizedType) { Type[] typeArguments = ((ParameterizedType) token.getType()).getActualTypeArguments(); GenericType<?> keyType = GenericType.of(typeArguments[0]); GenericType<?> valueType = GenericType.of(typeArguments[1]); TypeCodec<?> keyCodec = codecFor(keyType, isJavaCovariant); TypeCodec<?> valueCodec = codecFor(valueType, isJavaCovariant); return TypeCodecs.mapOf(keyCodec, valueCodec); } throw new CodecNotFoundException(null, javaType); }
[ "protected", "TypeCodec", "<", "?", ">", "createCodec", "(", "GenericType", "<", "?", ">", "javaType", ",", "boolean", "isJavaCovariant", ")", "{", "TypeToken", "<", "?", ">", "token", "=", "javaType", ".", "__getToken", "(", ")", ";", "if", "(", "List", ".", "class", ".", "isAssignableFrom", "(", "token", ".", "getRawType", "(", ")", ")", "&&", "token", ".", "getType", "(", ")", "instanceof", "ParameterizedType", ")", "{", "Type", "[", "]", "typeArguments", "=", "(", "(", "ParameterizedType", ")", "token", ".", "getType", "(", ")", ")", ".", "getActualTypeArguments", "(", ")", ";", "GenericType", "<", "?", ">", "elementType", "=", "GenericType", ".", "of", "(", "typeArguments", "[", "0", "]", ")", ";", "TypeCodec", "<", "?", ">", "elementCodec", "=", "codecFor", "(", "elementType", ",", "isJavaCovariant", ")", ";", "return", "TypeCodecs", ".", "listOf", "(", "elementCodec", ")", ";", "}", "else", "if", "(", "Set", ".", "class", ".", "isAssignableFrom", "(", "token", ".", "getRawType", "(", ")", ")", "&&", "token", ".", "getType", "(", ")", "instanceof", "ParameterizedType", ")", "{", "Type", "[", "]", "typeArguments", "=", "(", "(", "ParameterizedType", ")", "token", ".", "getType", "(", ")", ")", ".", "getActualTypeArguments", "(", ")", ";", "GenericType", "<", "?", ">", "elementType", "=", "GenericType", ".", "of", "(", "typeArguments", "[", "0", "]", ")", ";", "TypeCodec", "<", "?", ">", "elementCodec", "=", "codecFor", "(", "elementType", ",", "isJavaCovariant", ")", ";", "return", "TypeCodecs", ".", "setOf", "(", "elementCodec", ")", ";", "}", "else", "if", "(", "Map", ".", "class", ".", "isAssignableFrom", "(", "token", ".", "getRawType", "(", ")", ")", "&&", "token", ".", "getType", "(", ")", "instanceof", "ParameterizedType", ")", "{", "Type", "[", "]", "typeArguments", "=", "(", "(", "ParameterizedType", ")", "token", ".", "getType", "(", ")", ")", ".", "getActualTypeArguments", "(", ")", ";", "GenericType", "<", "?", ">", "keyType", "=", "GenericType", ".", "of", "(", "typeArguments", "[", "0", "]", ")", ";", "GenericType", "<", "?", ">", "valueType", "=", "GenericType", ".", "of", "(", "typeArguments", "[", "1", "]", ")", ";", "TypeCodec", "<", "?", ">", "keyCodec", "=", "codecFor", "(", "keyType", ",", "isJavaCovariant", ")", ";", "TypeCodec", "<", "?", ">", "valueCodec", "=", "codecFor", "(", "valueType", ",", "isJavaCovariant", ")", ";", "return", "TypeCodecs", ".", "mapOf", "(", "keyCodec", ",", "valueCodec", ")", ";", "}", "throw", "new", "CodecNotFoundException", "(", "null", ",", "javaType", ")", ";", "}" ]
Variant where the CQL type is unknown. Can be covariant if we come from a lookup by Java value.
[ "Variant", "where", "the", "CQL", "type", "is", "unknown", ".", "Can", "be", "covariant", "if", "we", "come", "from", "a", "lookup", "by", "Java", "value", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/registry/CachingCodecRegistry.java#L348-L372
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java
NamespaceRegistryImpl.registerNamespace
private synchronized void registerNamespace(String prefix, String uri, boolean persist) throws NamespaceException, RepositoryException { """ Registers the namespace and persists it if <code>persist</code> has been set to <code>true</code> and a persister has been configured """ if (namespaces.containsKey(prefix)) { unregisterNamespace(prefix); } else if (prefixes.containsKey(uri)) { unregisterNamespace(prefixes.get(uri)); } if (persister != null && persist) { persister.addNamespace(prefix, uri); } final String newPrefix = new String(prefix); final String newUri = new String(uri); namespaces.put(newPrefix, newUri); prefixes.put(newUri, newPrefix); }
java
private synchronized void registerNamespace(String prefix, String uri, boolean persist) throws NamespaceException, RepositoryException { if (namespaces.containsKey(prefix)) { unregisterNamespace(prefix); } else if (prefixes.containsKey(uri)) { unregisterNamespace(prefixes.get(uri)); } if (persister != null && persist) { persister.addNamespace(prefix, uri); } final String newPrefix = new String(prefix); final String newUri = new String(uri); namespaces.put(newPrefix, newUri); prefixes.put(newUri, newPrefix); }
[ "private", "synchronized", "void", "registerNamespace", "(", "String", "prefix", ",", "String", "uri", ",", "boolean", "persist", ")", "throws", "NamespaceException", ",", "RepositoryException", "{", "if", "(", "namespaces", ".", "containsKey", "(", "prefix", ")", ")", "{", "unregisterNamespace", "(", "prefix", ")", ";", "}", "else", "if", "(", "prefixes", ".", "containsKey", "(", "uri", ")", ")", "{", "unregisterNamespace", "(", "prefixes", ".", "get", "(", "uri", ")", ")", ";", "}", "if", "(", "persister", "!=", "null", "&&", "persist", ")", "{", "persister", ".", "addNamespace", "(", "prefix", ",", "uri", ")", ";", "}", "final", "String", "newPrefix", "=", "new", "String", "(", "prefix", ")", ";", "final", "String", "newUri", "=", "new", "String", "(", "uri", ")", ";", "namespaces", ".", "put", "(", "newPrefix", ",", "newUri", ")", ";", "prefixes", ".", "put", "(", "newUri", ",", "newPrefix", ")", ";", "}" ]
Registers the namespace and persists it if <code>persist</code> has been set to <code>true</code> and a persister has been configured
[ "Registers", "the", "namespace", "and", "persists", "it", "if", "<code", ">", "persist<", "/", "code", ">", "has", "been", "set", "to", "<code", ">", "true<", "/", "code", ">", "and", "a", "persister", "has", "been", "configured" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java#L360-L379
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/BindingFactory.java
BindingFactory.toBinding
public Binding toBinding(BindingElement element) { """ Convert a binding element to a Guive binding. @param element the element to convert. @return the Guice binding. """ final TypeReference typeReference = typeRef(element.getBind()); final String annotatedWith = element.getAnnotatedWith(); final String annotatedWithName = element.getAnnotatedWithName(); if (!Strings.isEmpty(annotatedWith)) { final TypeReference annotationType = typeRef(annotatedWith); if (element.isInstance()) { return bindAnnotatedWithToInstance(typeReference, annotationType, element.getTo(), element.getFunctionName()); } final TypeReference typeReference2 = typeRef(element.getTo()); return bindAnnotatedWith(typeReference, annotationType, typeReference2, element.getFunctionName()); } if (!Strings.isEmpty(annotatedWithName)) { if (element.isInstance()) { return bindAnnotatedWithNameToInstance(typeReference, annotatedWithName, element.getTo(), element.getFunctionName()); } final TypeReference typeReference2 = typeRef(element.getTo()); return bindAnnotatedWithName(typeReference, annotatedWithName, typeReference2, element.getFunctionName()); } if (element.isInstance()) { return bindToInstance(typeReference, element.getFunctionName(), element.getTo(), element.isSingleton(), element.isEager()); } final TypeReference typeReference2 = typeRef(element.getTo()); return bindToType( typeReference, element.getFunctionName(), typeReference2, element.isSingleton(), element.isEager(), element.isProvider()); }
java
public Binding toBinding(BindingElement element) { final TypeReference typeReference = typeRef(element.getBind()); final String annotatedWith = element.getAnnotatedWith(); final String annotatedWithName = element.getAnnotatedWithName(); if (!Strings.isEmpty(annotatedWith)) { final TypeReference annotationType = typeRef(annotatedWith); if (element.isInstance()) { return bindAnnotatedWithToInstance(typeReference, annotationType, element.getTo(), element.getFunctionName()); } final TypeReference typeReference2 = typeRef(element.getTo()); return bindAnnotatedWith(typeReference, annotationType, typeReference2, element.getFunctionName()); } if (!Strings.isEmpty(annotatedWithName)) { if (element.isInstance()) { return bindAnnotatedWithNameToInstance(typeReference, annotatedWithName, element.getTo(), element.getFunctionName()); } final TypeReference typeReference2 = typeRef(element.getTo()); return bindAnnotatedWithName(typeReference, annotatedWithName, typeReference2, element.getFunctionName()); } if (element.isInstance()) { return bindToInstance(typeReference, element.getFunctionName(), element.getTo(), element.isSingleton(), element.isEager()); } final TypeReference typeReference2 = typeRef(element.getTo()); return bindToType( typeReference, element.getFunctionName(), typeReference2, element.isSingleton(), element.isEager(), element.isProvider()); }
[ "public", "Binding", "toBinding", "(", "BindingElement", "element", ")", "{", "final", "TypeReference", "typeReference", "=", "typeRef", "(", "element", ".", "getBind", "(", ")", ")", ";", "final", "String", "annotatedWith", "=", "element", ".", "getAnnotatedWith", "(", ")", ";", "final", "String", "annotatedWithName", "=", "element", ".", "getAnnotatedWithName", "(", ")", ";", "if", "(", "!", "Strings", ".", "isEmpty", "(", "annotatedWith", ")", ")", "{", "final", "TypeReference", "annotationType", "=", "typeRef", "(", "annotatedWith", ")", ";", "if", "(", "element", ".", "isInstance", "(", ")", ")", "{", "return", "bindAnnotatedWithToInstance", "(", "typeReference", ",", "annotationType", ",", "element", ".", "getTo", "(", ")", ",", "element", ".", "getFunctionName", "(", ")", ")", ";", "}", "final", "TypeReference", "typeReference2", "=", "typeRef", "(", "element", ".", "getTo", "(", ")", ")", ";", "return", "bindAnnotatedWith", "(", "typeReference", ",", "annotationType", ",", "typeReference2", ",", "element", ".", "getFunctionName", "(", ")", ")", ";", "}", "if", "(", "!", "Strings", ".", "isEmpty", "(", "annotatedWithName", ")", ")", "{", "if", "(", "element", ".", "isInstance", "(", ")", ")", "{", "return", "bindAnnotatedWithNameToInstance", "(", "typeReference", ",", "annotatedWithName", ",", "element", ".", "getTo", "(", ")", ",", "element", ".", "getFunctionName", "(", ")", ")", ";", "}", "final", "TypeReference", "typeReference2", "=", "typeRef", "(", "element", ".", "getTo", "(", ")", ")", ";", "return", "bindAnnotatedWithName", "(", "typeReference", ",", "annotatedWithName", ",", "typeReference2", ",", "element", ".", "getFunctionName", "(", ")", ")", ";", "}", "if", "(", "element", ".", "isInstance", "(", ")", ")", "{", "return", "bindToInstance", "(", "typeReference", ",", "element", ".", "getFunctionName", "(", ")", ",", "element", ".", "getTo", "(", ")", ",", "element", ".", "isSingleton", "(", ")", ",", "element", ".", "isEager", "(", ")", ")", ";", "}", "final", "TypeReference", "typeReference2", "=", "typeRef", "(", "element", ".", "getTo", "(", ")", ")", ";", "return", "bindToType", "(", "typeReference", ",", "element", ".", "getFunctionName", "(", ")", ",", "typeReference2", ",", "element", ".", "isSingleton", "(", ")", ",", "element", ".", "isEager", "(", ")", ",", "element", ".", "isProvider", "(", ")", ")", ";", "}" ]
Convert a binding element to a Guive binding. @param element the element to convert. @return the Guice binding.
[ "Convert", "a", "binding", "element", "to", "a", "Guive", "binding", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/BindingFactory.java#L405-L444
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.get
protected Object get(int access, String name, Object defaultValue) { """ return element that has at least given access or null @param access @param name @return matching value """ return get(access, KeyImpl.init(name), defaultValue); }
java
protected Object get(int access, String name, Object defaultValue) { return get(access, KeyImpl.init(name), defaultValue); }
[ "protected", "Object", "get", "(", "int", "access", ",", "String", "name", ",", "Object", "defaultValue", ")", "{", "return", "get", "(", "access", ",", "KeyImpl", ".", "init", "(", "name", ")", ",", "defaultValue", ")", ";", "}" ]
return element that has at least given access or null @param access @param name @return matching value
[ "return", "element", "that", "has", "at", "least", "given", "access", "or", "null" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L1879-L1881
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/reflect/AbstractFixture.java
AbstractFixture.getField
protected Field getField(Class type, String name) { """ <p>getField.</p> @param type a {@link java.lang.Class} object. @param name a {@link java.lang.String} object. @return a {@link java.lang.reflect.Field} object. """ return introspector(type).getField( toJavaIdentifierForm(name)); }
java
protected Field getField(Class type, String name) { return introspector(type).getField( toJavaIdentifierForm(name)); }
[ "protected", "Field", "getField", "(", "Class", "type", ",", "String", "name", ")", "{", "return", "introspector", "(", "type", ")", ".", "getField", "(", "toJavaIdentifierForm", "(", "name", ")", ")", ";", "}" ]
<p>getField.</p> @param type a {@link java.lang.Class} object. @param name a {@link java.lang.String} object. @return a {@link java.lang.reflect.Field} object.
[ "<p", ">", "getField", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/reflect/AbstractFixture.java#L106-L109
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.getRequiredCheck
public static String getRequiredCheck(int order, Field field) { """ get required field check java expression. @param order field order @param field java field @return full java expression """ String fieldName = getFieldName(order); String code = "if (" + fieldName + "== null) {\n"; code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"))" + ClassCode.JAVA_LINE_BREAK; code += "}\n"; return code; }
java
public static String getRequiredCheck(int order, Field field) { String fieldName = getFieldName(order); String code = "if (" + fieldName + "== null) {\n"; code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"))" + ClassCode.JAVA_LINE_BREAK; code += "}\n"; return code; }
[ "public", "static", "String", "getRequiredCheck", "(", "int", "order", ",", "Field", "field", ")", "{", "String", "fieldName", "=", "getFieldName", "(", "order", ")", ";", "String", "code", "=", "\"if (\"", "+", "fieldName", "+", "\"== null) {\\n\"", ";", "code", "+=", "\"throw new UninitializedMessageException(CodedConstant.asList(\\\"\"", "+", "field", ".", "getName", "(", ")", "+", "\"\\\"))\"", "+", "ClassCode", ".", "JAVA_LINE_BREAK", ";", "code", "+=", "\"}\\n\"", ";", "return", "code", ";", "}" ]
get required field check java expression. @param order field order @param field java field @return full java expression
[ "get", "required", "field", "check", "java", "expression", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L477-L485
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java
ArrayHelper.getConcatenated
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE [] getConcatenated (@Nullable final ELEMENTTYPE [] aHeadArray, @Nullable final ELEMENTTYPE aTail, @Nonnull final Class <ELEMENTTYPE> aClass) { """ Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array. @param <ELEMENTTYPE> Array element type @param aHeadArray The head array. May be <code>null</code>. @param aTail The last element of the result array. If this element is <code>null</code> it will be inserted as such into the array! @param aClass The element class. Must be present, because in case both elements are <code>null</code> there would be no way to create a new array. May not be <code>null</code>. @return <code>null</code> if both array parameters are <code>null</code> - a non-<code>null</code> array with all elements in the correct order otherwise. """ if (isEmpty (aHeadArray)) return newArraySingleElement (aTail, aClass); // Start concatenating final ELEMENTTYPE [] ret = newArray (aClass, aHeadArray.length + 1); System.arraycopy (aHeadArray, 0, ret, 0, aHeadArray.length); ret[aHeadArray.length] = aTail; return ret; }
java
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE [] getConcatenated (@Nullable final ELEMENTTYPE [] aHeadArray, @Nullable final ELEMENTTYPE aTail, @Nonnull final Class <ELEMENTTYPE> aClass) { if (isEmpty (aHeadArray)) return newArraySingleElement (aTail, aClass); // Start concatenating final ELEMENTTYPE [] ret = newArray (aClass, aHeadArray.length + 1); System.arraycopy (aHeadArray, 0, ret, 0, aHeadArray.length); ret[aHeadArray.length] = aTail; return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "<", "ELEMENTTYPE", ">", "ELEMENTTYPE", "[", "]", "getConcatenated", "(", "@", "Nullable", "final", "ELEMENTTYPE", "[", "]", "aHeadArray", ",", "@", "Nullable", "final", "ELEMENTTYPE", "aTail", ",", "@", "Nonnull", "final", "Class", "<", "ELEMENTTYPE", ">", "aClass", ")", "{", "if", "(", "isEmpty", "(", "aHeadArray", ")", ")", "return", "newArraySingleElement", "(", "aTail", ",", "aClass", ")", ";", "// Start concatenating", "final", "ELEMENTTYPE", "[", "]", "ret", "=", "newArray", "(", "aClass", ",", "aHeadArray", ".", "length", "+", "1", ")", ";", "System", ".", "arraycopy", "(", "aHeadArray", ",", "0", ",", "ret", ",", "0", ",", "aHeadArray", ".", "length", ")", ";", "ret", "[", "aHeadArray", ".", "length", "]", "=", "aTail", ";", "return", "ret", ";", "}" ]
Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array. @param <ELEMENTTYPE> Array element type @param aHeadArray The head array. May be <code>null</code>. @param aTail The last element of the result array. If this element is <code>null</code> it will be inserted as such into the array! @param aClass The element class. Must be present, because in case both elements are <code>null</code> there would be no way to create a new array. May not be <code>null</code>. @return <code>null</code> if both array parameters are <code>null</code> - a non-<code>null</code> array with all elements in the correct order otherwise.
[ "Get", "a", "new", "array", "that", "combines", "the", "passed", "array", "and", "the", "tail", "element", ".", "The", "tail", "element", "will", "be", "the", "last", "element", "of", "the", "created", "array", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L1996-L2010
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java
Document.setRelations
public void setRelations(int i, Relation v) { """ indexed setter for relations - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array """ if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_relations == null) jcasType.jcas.throwFeatMissing("relations", "de.julielab.jules.types.ace.Document"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setRelations(int i, Relation v) { if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_relations == null) jcasType.jcas.throwFeatMissing("relations", "de.julielab.jules.types.ace.Document"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setRelations", "(", "int", "i", ",", "Relation", "v", ")", "{", "if", "(", "Document_Type", ".", "featOkTst", "&&", "(", "(", "Document_Type", ")", "jcasType", ")", ".", "casFeat_relations", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"relations\"", ",", "\"de.julielab.jules.types.ace.Document\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "Document_Type", ")", "jcasType", ")", ".", "casFeatCode_relations", ")", ",", "i", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setRefArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "Document_Type", ")", "jcasType", ")", ".", "casFeatCode_relations", ")", ",", "i", ",", "jcasType", ".", "ll_cas", ".", "ll_getFSRef", "(", "v", ")", ")", ";", "}" ]
indexed setter for relations - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "relations", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java#L270-L274
pravega/pravega
common/src/main/java/io/pravega/common/util/CollectionHelpers.java
CollectionHelpers.binarySearch
public static <T> int binarySearch(List<? extends T> list, Function<? super T, Integer> comparator) { """ Performs a binary search on the given sorted list using the given comparator. This method has undefined behavior if the list is not sorted. <p> This method is different than that in java.util.Collections in the following ways: 1. This one searches by a simple comparator, vs the ones in the Collections class which search for a specific element. This one is useful if we don't have an instance of a search object or we want to implement a fuzzy comparison. 2. This one returns -1 if the element is not found. The ones in the Collections class return (-(start+1)), which is the index where the item should be inserted if it were to go in the list. @param list The list to search on. @param comparator The comparator to use for comparison. Returns -1 if sought item is before the current item, +1 if it is after or 0 if an exact match. @param <T> Type of the elements in the list. @return The index of the sought item, or -1 if not found. """ return binarySearch(list, comparator, false); }
java
public static <T> int binarySearch(List<? extends T> list, Function<? super T, Integer> comparator) { return binarySearch(list, comparator, false); }
[ "public", "static", "<", "T", ">", "int", "binarySearch", "(", "List", "<", "?", "extends", "T", ">", "list", ",", "Function", "<", "?", "super", "T", ",", "Integer", ">", "comparator", ")", "{", "return", "binarySearch", "(", "list", ",", "comparator", ",", "false", ")", ";", "}" ]
Performs a binary search on the given sorted list using the given comparator. This method has undefined behavior if the list is not sorted. <p> This method is different than that in java.util.Collections in the following ways: 1. This one searches by a simple comparator, vs the ones in the Collections class which search for a specific element. This one is useful if we don't have an instance of a search object or we want to implement a fuzzy comparison. 2. This one returns -1 if the element is not found. The ones in the Collections class return (-(start+1)), which is the index where the item should be inserted if it were to go in the list. @param list The list to search on. @param comparator The comparator to use for comparison. Returns -1 if sought item is before the current item, +1 if it is after or 0 if an exact match. @param <T> Type of the elements in the list. @return The index of the sought item, or -1 if not found.
[ "Performs", "a", "binary", "search", "on", "the", "given", "sorted", "list", "using", "the", "given", "comparator", ".", "This", "method", "has", "undefined", "behavior", "if", "the", "list", "is", "not", "sorted", ".", "<p", ">", "This", "method", "is", "different", "than", "that", "in", "java", ".", "util", ".", "Collections", "in", "the", "following", "ways", ":", "1", ".", "This", "one", "searches", "by", "a", "simple", "comparator", "vs", "the", "ones", "in", "the", "Collections", "class", "which", "search", "for", "a", "specific", "element", ".", "This", "one", "is", "useful", "if", "we", "don", "t", "have", "an", "instance", "of", "a", "search", "object", "or", "we", "want", "to", "implement", "a", "fuzzy", "comparison", ".", "2", ".", "This", "one", "returns", "-", "1", "if", "the", "element", "is", "not", "found", ".", "The", "ones", "in", "the", "Collections", "class", "return", "(", "-", "(", "start", "+", "1", "))", "which", "is", "the", "index", "where", "the", "item", "should", "be", "inserted", "if", "it", "were", "to", "go", "in", "the", "list", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/CollectionHelpers.java#L44-L46
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java
BootstrapConfig.substituteSymbols
protected void substituteSymbols(Map<String, String> initProps) { """ Perform substitution of symbols used in config @param initProps """ for (Entry<String, String> entry : initProps.entrySet()) { Object value = entry.getValue(); if (value instanceof String) { String strValue = (String) value; Matcher m = SYMBOL_DEF.matcher(strValue); int i = 0; while (m.find() && i++ < 4) { String symbol = m.group(1); Object expansion = initProps.get(symbol); if (expansion != null && expansion instanceof String) { strValue = strValue.replace(m.group(0), (String) expansion); entry.setValue(strValue); } } } } }
java
protected void substituteSymbols(Map<String, String> initProps) { for (Entry<String, String> entry : initProps.entrySet()) { Object value = entry.getValue(); if (value instanceof String) { String strValue = (String) value; Matcher m = SYMBOL_DEF.matcher(strValue); int i = 0; while (m.find() && i++ < 4) { String symbol = m.group(1); Object expansion = initProps.get(symbol); if (expansion != null && expansion instanceof String) { strValue = strValue.replace(m.group(0), (String) expansion); entry.setValue(strValue); } } } } }
[ "protected", "void", "substituteSymbols", "(", "Map", "<", "String", ",", "String", ">", "initProps", ")", "{", "for", "(", "Entry", "<", "String", ",", "String", ">", "entry", ":", "initProps", ".", "entrySet", "(", ")", ")", "{", "Object", "value", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "value", "instanceof", "String", ")", "{", "String", "strValue", "=", "(", "String", ")", "value", ";", "Matcher", "m", "=", "SYMBOL_DEF", ".", "matcher", "(", "strValue", ")", ";", "int", "i", "=", "0", ";", "while", "(", "m", ".", "find", "(", ")", "&&", "i", "++", "<", "4", ")", "{", "String", "symbol", "=", "m", ".", "group", "(", "1", ")", ";", "Object", "expansion", "=", "initProps", ".", "get", "(", "symbol", ")", ";", "if", "(", "expansion", "!=", "null", "&&", "expansion", "instanceof", "String", ")", "{", "strValue", "=", "strValue", ".", "replace", "(", "m", ".", "group", "(", "0", ")", ",", "(", "String", ")", "expansion", ")", ";", "entry", ".", "setValue", "(", "strValue", ")", ";", "}", "}", "}", "}", "}" ]
Perform substitution of symbols used in config @param initProps
[ "Perform", "substitution", "of", "symbols", "used", "in", "config" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L748-L765
netty/netty
common/src/main/java/io/netty/util/ConstantPool.java
ConstantPool.createOrThrow
private T createOrThrow(String name) { """ Creates constant by name or throws exception. Threadsafe @param name the name of the {@link Constant} """ T constant = constants.get(name); if (constant == null) { final T tempConstant = newConstant(nextId(), name); constant = constants.putIfAbsent(name, tempConstant); if (constant == null) { return tempConstant; } } throw new IllegalArgumentException(String.format("'%s' is already in use", name)); }
java
private T createOrThrow(String name) { T constant = constants.get(name); if (constant == null) { final T tempConstant = newConstant(nextId(), name); constant = constants.putIfAbsent(name, tempConstant); if (constant == null) { return tempConstant; } } throw new IllegalArgumentException(String.format("'%s' is already in use", name)); }
[ "private", "T", "createOrThrow", "(", "String", "name", ")", "{", "T", "constant", "=", "constants", ".", "get", "(", "name", ")", ";", "if", "(", "constant", "==", "null", ")", "{", "final", "T", "tempConstant", "=", "newConstant", "(", "nextId", "(", ")", ",", "name", ")", ";", "constant", "=", "constants", ".", "putIfAbsent", "(", "name", ",", "tempConstant", ")", ";", "if", "(", "constant", "==", "null", ")", "{", "return", "tempConstant", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"'%s' is already in use\"", ",", "name", ")", ")", ";", "}" ]
Creates constant by name or throws exception. Threadsafe @param name the name of the {@link Constant}
[ "Creates", "constant", "by", "name", "or", "throws", "exception", ".", "Threadsafe" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ConstantPool.java#L103-L114
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/GetFunctionDefinitionResult.java
GetFunctionDefinitionResult.withTags
public GetFunctionDefinitionResult withTags(java.util.Map<String, String> tags) { """ The tags for the definition. @param tags The tags for the definition. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public GetFunctionDefinitionResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "GetFunctionDefinitionResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
The tags for the definition. @param tags The tags for the definition. @return Returns a reference to this object so that method calls can be chained together.
[ "The", "tags", "for", "the", "definition", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/GetFunctionDefinitionResult.java#L310-L313
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ReflectUtil.java
ReflectUtil.createInstance
public static <T> T createInstance(Class<T> type, Object... parameters) { """ Create a new instance of the provided type @param type the class to create a new instance of @param parameters the parameters to pass to the constructor @return the created instance """ // get types for parameters Class<?>[] parameterTypes = new Class<?>[parameters.length]; for (int i = 0; i < parameters.length; i++) { Object parameter = parameters[i]; parameterTypes[i] = parameter.getClass(); } try { // create instance Constructor<T> constructor = type.getConstructor(parameterTypes); return constructor.newInstance(parameters); } catch (Exception e) { throw new ModelException("Exception while creating an instance of type "+type, e); } }
java
public static <T> T createInstance(Class<T> type, Object... parameters) { // get types for parameters Class<?>[] parameterTypes = new Class<?>[parameters.length]; for (int i = 0; i < parameters.length; i++) { Object parameter = parameters[i]; parameterTypes[i] = parameter.getClass(); } try { // create instance Constructor<T> constructor = type.getConstructor(parameterTypes); return constructor.newInstance(parameters); } catch (Exception e) { throw new ModelException("Exception while creating an instance of type "+type, e); } }
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "Class", "<", "T", ">", "type", ",", "Object", "...", "parameters", ")", "{", "// get types for parameters", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "new", "Class", "<", "?", ">", "[", "parameters", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameters", ".", "length", ";", "i", "++", ")", "{", "Object", "parameter", "=", "parameters", "[", "i", "]", ";", "parameterTypes", "[", "i", "]", "=", "parameter", ".", "getClass", "(", ")", ";", "}", "try", "{", "// create instance", "Constructor", "<", "T", ">", "constructor", "=", "type", ".", "getConstructor", "(", "parameterTypes", ")", ";", "return", "constructor", ".", "newInstance", "(", "parameters", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ModelException", "(", "\"Exception while creating an instance of type \"", "+", "type", ",", "e", ")", ";", "}", "}" ]
Create a new instance of the provided type @param type the class to create a new instance of @param parameters the parameters to pass to the constructor @return the created instance
[ "Create", "a", "new", "instance", "of", "the", "provided", "type" ]
train
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ReflectUtil.java#L81-L98
landawn/AbacusUtil
src/com/landawn/abacus/util/JdbcUtil.java
JdbcUtil.importData
public static int importData(final DataSet dataset, final PreparedStatement stmt) throws UncheckedSQLException { """ Imports the data from <code>DataSet</code> to database. @param dataset @param stmt the column order in the sql must be consistent with the column order in the DataSet. @return @throws UncheckedSQLException """ return importData(dataset, dataset.columnNameList(), stmt); }
java
public static int importData(final DataSet dataset, final PreparedStatement stmt) throws UncheckedSQLException { return importData(dataset, dataset.columnNameList(), stmt); }
[ "public", "static", "int", "importData", "(", "final", "DataSet", "dataset", ",", "final", "PreparedStatement", "stmt", ")", "throws", "UncheckedSQLException", "{", "return", "importData", "(", "dataset", ",", "dataset", ".", "columnNameList", "(", ")", ",", "stmt", ")", ";", "}" ]
Imports the data from <code>DataSet</code> to database. @param dataset @param stmt the column order in the sql must be consistent with the column order in the DataSet. @return @throws UncheckedSQLException
[ "Imports", "the", "data", "from", "<code", ">", "DataSet<", "/", "code", ">", "to", "database", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2176-L2178
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/iterable/S3Objects.java
S3Objects.withPrefix
public static S3Objects withPrefix(AmazonS3 s3, String bucketName, String prefix) { """ Constructs an iterable that covers the objects in an Amazon S3 bucket where the key begins with the given prefix. @param s3 The Amazon S3 client. @param bucketName The bucket name. @param prefix The prefix. @return An iterator for object summaries. """ S3Objects objects = new S3Objects(s3, bucketName); objects.prefix = prefix; return objects; }
java
public static S3Objects withPrefix(AmazonS3 s3, String bucketName, String prefix) { S3Objects objects = new S3Objects(s3, bucketName); objects.prefix = prefix; return objects; }
[ "public", "static", "S3Objects", "withPrefix", "(", "AmazonS3", "s3", ",", "String", "bucketName", ",", "String", "prefix", ")", "{", "S3Objects", "objects", "=", "new", "S3Objects", "(", "s3", ",", "bucketName", ")", ";", "objects", ".", "prefix", "=", "prefix", ";", "return", "objects", ";", "}" ]
Constructs an iterable that covers the objects in an Amazon S3 bucket where the key begins with the given prefix. @param s3 The Amazon S3 client. @param bucketName The bucket name. @param prefix The prefix. @return An iterator for object summaries.
[ "Constructs", "an", "iterable", "that", "covers", "the", "objects", "in", "an", "Amazon", "S3", "bucket", "where", "the", "key", "begins", "with", "the", "given", "prefix", "." ]
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/iterable/S3Objects.java#L76-L80
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/features/ExampleFeatureSurf.java
ExampleFeatureSurf.harder
public static <II extends ImageGray<II>> void harder(GrayF32 image ) { """ Configured exactly the same as the easy example above, but require a lot more code and a more in depth understanding of how SURF works and is configured. Instead of TupleDesc_F64, SurfFeature are computed in this case. They are almost the same as TupleDesc_F64, but contain the Laplacian's sign which can be used to speed up association. That is an example of how using less generalized interfaces can improve performance. @param image Input image type. DOES NOT NEED TO BE GrayF32, GrayU8 works too """ // SURF works off of integral images Class<II> integralType = GIntegralImageOps.getIntegralType(GrayF32.class); // define the feature detection algorithm NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(2, 0, 5, true)); FastHessianFeatureDetector<II> detector = new FastHessianFeatureDetector<>(extractor, 200, 2, 9, 4, 4, 6); // estimate orientation OrientationIntegral<II> orientation = FactoryOrientationAlgs.sliding_ii(null, integralType); DescribePointSurf<II> descriptor = FactoryDescribePointAlgs.<II>surfStability(null,integralType); // compute the integral image of 'image' II integral = GeneralizedImageOps.createSingleBand(integralType,image.width,image.height); GIntegralImageOps.transform(image, integral); // detect fast hessian features detector.detect(integral); // tell algorithms which image to process orientation.setImage(integral); descriptor.setImage(integral); List<ScalePoint> points = detector.getFoundPoints(); List<BrightFeature> descriptions = new ArrayList<>(); for( ScalePoint p : points ) { // estimate orientation orientation.setObjectRadius( p.scale*BoofDefaults.SURF_SCALE_TO_RADIUS); double angle = orientation.compute(p.x,p.y); // extract the SURF description for this region BrightFeature desc = descriptor.createDescription(); descriptor.describe(p.x,p.y,angle,p.scale,desc); // save everything for processing later on descriptions.add(desc); } System.out.println("Found Features: "+points.size()); System.out.println("First descriptor's first value: "+descriptions.get(0).value[0]); }
java
public static <II extends ImageGray<II>> void harder(GrayF32 image ) { // SURF works off of integral images Class<II> integralType = GIntegralImageOps.getIntegralType(GrayF32.class); // define the feature detection algorithm NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(2, 0, 5, true)); FastHessianFeatureDetector<II> detector = new FastHessianFeatureDetector<>(extractor, 200, 2, 9, 4, 4, 6); // estimate orientation OrientationIntegral<II> orientation = FactoryOrientationAlgs.sliding_ii(null, integralType); DescribePointSurf<II> descriptor = FactoryDescribePointAlgs.<II>surfStability(null,integralType); // compute the integral image of 'image' II integral = GeneralizedImageOps.createSingleBand(integralType,image.width,image.height); GIntegralImageOps.transform(image, integral); // detect fast hessian features detector.detect(integral); // tell algorithms which image to process orientation.setImage(integral); descriptor.setImage(integral); List<ScalePoint> points = detector.getFoundPoints(); List<BrightFeature> descriptions = new ArrayList<>(); for( ScalePoint p : points ) { // estimate orientation orientation.setObjectRadius( p.scale*BoofDefaults.SURF_SCALE_TO_RADIUS); double angle = orientation.compute(p.x,p.y); // extract the SURF description for this region BrightFeature desc = descriptor.createDescription(); descriptor.describe(p.x,p.y,angle,p.scale,desc); // save everything for processing later on descriptions.add(desc); } System.out.println("Found Features: "+points.size()); System.out.println("First descriptor's first value: "+descriptions.get(0).value[0]); }
[ "public", "static", "<", "II", "extends", "ImageGray", "<", "II", ">", ">", "void", "harder", "(", "GrayF32", "image", ")", "{", "// SURF works off of integral images", "Class", "<", "II", ">", "integralType", "=", "GIntegralImageOps", ".", "getIntegralType", "(", "GrayF32", ".", "class", ")", ";", "// define the feature detection algorithm", "NonMaxSuppression", "extractor", "=", "FactoryFeatureExtractor", ".", "nonmax", "(", "new", "ConfigExtract", "(", "2", ",", "0", ",", "5", ",", "true", ")", ")", ";", "FastHessianFeatureDetector", "<", "II", ">", "detector", "=", "new", "FastHessianFeatureDetector", "<>", "(", "extractor", ",", "200", ",", "2", ",", "9", ",", "4", ",", "4", ",", "6", ")", ";", "// estimate orientation", "OrientationIntegral", "<", "II", ">", "orientation", "=", "FactoryOrientationAlgs", ".", "sliding_ii", "(", "null", ",", "integralType", ")", ";", "DescribePointSurf", "<", "II", ">", "descriptor", "=", "FactoryDescribePointAlgs", ".", "<", "II", ">", "surfStability", "(", "null", ",", "integralType", ")", ";", "// compute the integral image of 'image'", "II", "integral", "=", "GeneralizedImageOps", ".", "createSingleBand", "(", "integralType", ",", "image", ".", "width", ",", "image", ".", "height", ")", ";", "GIntegralImageOps", ".", "transform", "(", "image", ",", "integral", ")", ";", "// detect fast hessian features", "detector", ".", "detect", "(", "integral", ")", ";", "// tell algorithms which image to process", "orientation", ".", "setImage", "(", "integral", ")", ";", "descriptor", ".", "setImage", "(", "integral", ")", ";", "List", "<", "ScalePoint", ">", "points", "=", "detector", ".", "getFoundPoints", "(", ")", ";", "List", "<", "BrightFeature", ">", "descriptions", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "ScalePoint", "p", ":", "points", ")", "{", "// estimate orientation", "orientation", ".", "setObjectRadius", "(", "p", ".", "scale", "*", "BoofDefaults", ".", "SURF_SCALE_TO_RADIUS", ")", ";", "double", "angle", "=", "orientation", ".", "compute", "(", "p", ".", "x", ",", "p", ".", "y", ")", ";", "// extract the SURF description for this region", "BrightFeature", "desc", "=", "descriptor", ".", "createDescription", "(", ")", ";", "descriptor", ".", "describe", "(", "p", ".", "x", ",", "p", ".", "y", ",", "angle", ",", "p", ".", "scale", ",", "desc", ")", ";", "// save everything for processing later on", "descriptions", ".", "add", "(", "desc", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"Found Features: \"", "+", "points", ".", "size", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"First descriptor's first value: \"", "+", "descriptions", ".", "get", "(", "0", ")", ".", "value", "[", "0", "]", ")", ";", "}" ]
Configured exactly the same as the easy example above, but require a lot more code and a more in depth understanding of how SURF works and is configured. Instead of TupleDesc_F64, SurfFeature are computed in this case. They are almost the same as TupleDesc_F64, but contain the Laplacian's sign which can be used to speed up association. That is an example of how using less generalized interfaces can improve performance. @param image Input image type. DOES NOT NEED TO BE GrayF32, GrayU8 works too
[ "Configured", "exactly", "the", "same", "as", "the", "easy", "example", "above", "but", "require", "a", "lot", "more", "code", "and", "a", "more", "in", "depth", "understanding", "of", "how", "SURF", "works", "and", "is", "configured", ".", "Instead", "of", "TupleDesc_F64", "SurfFeature", "are", "computed", "in", "this", "case", ".", "They", "are", "almost", "the", "same", "as", "TupleDesc_F64", "but", "contain", "the", "Laplacian", "s", "sign", "which", "can", "be", "used", "to", "speed", "up", "association", ".", "That", "is", "an", "example", "of", "how", "using", "less", "generalized", "interfaces", "can", "improve", "performance", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFeatureSurf.java#L79-L124
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java
CertificatesInner.createOrUpdateAsync
public Observable<IntegrationAccountCertificateInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String certificateName, IntegrationAccountCertificateInner certificate) { """ Creates or updates an integration account certificate. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param certificateName The integration account certificate name. @param certificate The integration account certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountCertificateInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName, certificate).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() { @Override public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountCertificateInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String certificateName, IntegrationAccountCertificateInner certificate) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName, certificate).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() { @Override public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountCertificateInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "certificateName", ",", "IntegrationAccountCertificateInner", "certificate", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ",", "certificateName", ",", "certificate", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "IntegrationAccountCertificateInner", ">", ",", "IntegrationAccountCertificateInner", ">", "(", ")", "{", "@", "Override", "public", "IntegrationAccountCertificateInner", "call", "(", "ServiceResponse", "<", "IntegrationAccountCertificateInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates an integration account certificate. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param certificateName The integration account certificate name. @param certificate The integration account certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountCertificateInner object
[ "Creates", "or", "updates", "an", "integration", "account", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java#L465-L472
cdk/cdk
base/core/src/main/java/org/openscience/cdk/DynamicFactory.java
DynamicFactory.ofClass
public <T extends ICDKObject> T ofClass(Class<T> intf, Object... objects) { """ Construct an implementation using a constructor whose parameters match that of the provided objects. @param intf the interface to construct an instance of @param <T> the type of the class @return an implementation of provided interface @throws IllegalArgumentException thrown if the implementation can not be constructed @throws IllegalArgumentException thrown if the provided class is not an interface """ try { if (!intf.isInterface()) throw new IllegalArgumentException("expected interface, got " + intf.getClass()); Creator<T> constructor = get(new ObjectBasedKey(intf, objects)); return constructor.create(objects); } catch (InstantiationException e) { throw new IllegalArgumentException("unable to instantiate chem object: ", e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("constructor is not accessible: ", e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("invocation target exception: ", e); } }
java
public <T extends ICDKObject> T ofClass(Class<T> intf, Object... objects) { try { if (!intf.isInterface()) throw new IllegalArgumentException("expected interface, got " + intf.getClass()); Creator<T> constructor = get(new ObjectBasedKey(intf, objects)); return constructor.create(objects); } catch (InstantiationException e) { throw new IllegalArgumentException("unable to instantiate chem object: ", e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("constructor is not accessible: ", e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("invocation target exception: ", e); } }
[ "public", "<", "T", "extends", "ICDKObject", ">", "T", "ofClass", "(", "Class", "<", "T", ">", "intf", ",", "Object", "...", "objects", ")", "{", "try", "{", "if", "(", "!", "intf", ".", "isInterface", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"expected interface, got \"", "+", "intf", ".", "getClass", "(", ")", ")", ";", "Creator", "<", "T", ">", "constructor", "=", "get", "(", "new", "ObjectBasedKey", "(", "intf", ",", "objects", ")", ")", ";", "return", "constructor", ".", "create", "(", "objects", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"unable to instantiate chem object: \"", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"constructor is not accessible: \"", ",", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"invocation target exception: \"", ",", "e", ")", ";", "}", "}" ]
Construct an implementation using a constructor whose parameters match that of the provided objects. @param intf the interface to construct an instance of @param <T> the type of the class @return an implementation of provided interface @throws IllegalArgumentException thrown if the implementation can not be constructed @throws IllegalArgumentException thrown if the provided class is not an interface
[ "Construct", "an", "implementation", "using", "a", "constructor", "whose", "parameters", "match", "that", "of", "the", "provided", "objects", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/DynamicFactory.java#L512-L529
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/IntCounter.java
IntCounter.incrementCounts
public void incrementCounts(Collection<E> keys, int count) { """ Adds the given count to the current counts for each of the given keys. If any of the keys haven't been seen before, they are assumed to have count 0, and thus this method will set their counts to the given amount. Negative increments are equivalent to calling <tt>decrementCounts</tt>. <p/> To more conveniently increment the counts of a collection of objects by 1, use {@link #incrementCounts(Collection)}. <p/> To set the counts of a collection of objects to a specific value instead of incrementing them, use {@link #setCounts(Collection,int)}. """ for (E key : keys) { incrementCount(key, count); } }
java
public void incrementCounts(Collection<E> keys, int count) { for (E key : keys) { incrementCount(key, count); } }
[ "public", "void", "incrementCounts", "(", "Collection", "<", "E", ">", "keys", ",", "int", "count", ")", "{", "for", "(", "E", "key", ":", "keys", ")", "{", "incrementCount", "(", "key", ",", "count", ")", ";", "}", "}" ]
Adds the given count to the current counts for each of the given keys. If any of the keys haven't been seen before, they are assumed to have count 0, and thus this method will set their counts to the given amount. Negative increments are equivalent to calling <tt>decrementCounts</tt>. <p/> To more conveniently increment the counts of a collection of objects by 1, use {@link #incrementCounts(Collection)}. <p/> To set the counts of a collection of objects to a specific value instead of incrementing them, use {@link #setCounts(Collection,int)}.
[ "Adds", "the", "given", "count", "to", "the", "current", "counts", "for", "each", "of", "the", "given", "keys", ".", "If", "any", "of", "the", "keys", "haven", "t", "been", "seen", "before", "they", "are", "assumed", "to", "have", "count", "0", "and", "thus", "this", "method", "will", "set", "their", "counts", "to", "the", "given", "amount", ".", "Negative", "increments", "are", "equivalent", "to", "calling", "<tt", ">", "decrementCounts<", "/", "tt", ">", ".", "<p", "/", ">", "To", "more", "conveniently", "increment", "the", "counts", "of", "a", "collection", "of", "objects", "by", "1", "use", "{" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/IntCounter.java#L280-L284
palatable/lambda
src/main/java/com/jnape/palatable/lambda/optics/lenses/CollectionLens.java
CollectionLens.asCopy
public static <X, CX extends Collection<X>> Lens.Simple<CX, CX> asCopy(Function<? super CX, ? extends CX> copyFn) { """ Convenience static factory method for creating a lens that focuses on a copy of a <code>Collection</code>, given a function that creates the copy. Useful for composition to avoid mutating a <code>Collection</code> reference. @param copyFn the copying function @param <X> the collection element type @param <CX> the type of the collection @return a lens that focuses on a copy of CX """ return simpleLens(copyFn, (__, copy) -> copy); }
java
public static <X, CX extends Collection<X>> Lens.Simple<CX, CX> asCopy(Function<? super CX, ? extends CX> copyFn) { return simpleLens(copyFn, (__, copy) -> copy); }
[ "public", "static", "<", "X", ",", "CX", "extends", "Collection", "<", "X", ">", ">", "Lens", ".", "Simple", "<", "CX", ",", "CX", ">", "asCopy", "(", "Function", "<", "?", "super", "CX", ",", "?", "extends", "CX", ">", "copyFn", ")", "{", "return", "simpleLens", "(", "copyFn", ",", "(", "__", ",", "copy", ")", "->", "copy", ")", ";", "}" ]
Convenience static factory method for creating a lens that focuses on a copy of a <code>Collection</code>, given a function that creates the copy. Useful for composition to avoid mutating a <code>Collection</code> reference. @param copyFn the copying function @param <X> the collection element type @param <CX> the type of the collection @return a lens that focuses on a copy of CX
[ "Convenience", "static", "factory", "method", "for", "creating", "a", "lens", "that", "focuses", "on", "a", "copy", "of", "a", "<code", ">", "Collection<", "/", "code", ">", "given", "a", "function", "that", "creates", "the", "copy", ".", "Useful", "for", "composition", "to", "avoid", "mutating", "a", "<code", ">", "Collection<", "/", "code", ">", "reference", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/optics/lenses/CollectionLens.java#L30-L32
craigwblake/redline
src/main/java/org/redline_rpm/Builder.java
Builder.addLink
public void addLink( final String path, final String target) throws NoSuchAlgorithmException, IOException { """ Adds a symbolic link to the repository. @param path the absolute path at which this link will be installed. @param target the path of the file this link will point to. @throws NoSuchAlgorithmException the algorithm isn't supported @throws IOException there was an IO error """ contents.addLink( path, target); }
java
public void addLink( final String path, final String target) throws NoSuchAlgorithmException, IOException { contents.addLink( path, target); }
[ "public", "void", "addLink", "(", "final", "String", "path", ",", "final", "String", "target", ")", "throws", "NoSuchAlgorithmException", ",", "IOException", "{", "contents", ".", "addLink", "(", "path", ",", "target", ")", ";", "}" ]
Adds a symbolic link to the repository. @param path the absolute path at which this link will be installed. @param target the path of the file this link will point to. @throws NoSuchAlgorithmException the algorithm isn't supported @throws IOException there was an IO error
[ "Adds", "a", "symbolic", "link", "to", "the", "repository", "." ]
train
https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1134-L1136
YahooArchive/samoa
samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/rules/centralized/AMRulesRegressorProcessor.java
AMRulesRegressorProcessor.isAnomaly
private boolean isAnomaly(Instance instance, ActiveRule rule) { """ Method to verify if the instance is an anomaly. @param instance @param rule @return """ //AMRUles is equipped with anomaly detection. If on, compute the anomaly value. boolean isAnomaly = false; if (this.noAnomalyDetection == false){ if (rule.getInstancesSeen() >= this.anomalyNumInstThreshold) { isAnomaly = rule.isAnomaly(instance, this.univariateAnomalyprobabilityThreshold, this.multivariateAnomalyProbabilityThreshold, this.anomalyNumInstThreshold); } } return isAnomaly; }
java
private boolean isAnomaly(Instance instance, ActiveRule rule) { //AMRUles is equipped with anomaly detection. If on, compute the anomaly value. boolean isAnomaly = false; if (this.noAnomalyDetection == false){ if (rule.getInstancesSeen() >= this.anomalyNumInstThreshold) { isAnomaly = rule.isAnomaly(instance, this.univariateAnomalyprobabilityThreshold, this.multivariateAnomalyProbabilityThreshold, this.anomalyNumInstThreshold); } } return isAnomaly; }
[ "private", "boolean", "isAnomaly", "(", "Instance", "instance", ",", "ActiveRule", "rule", ")", "{", "//AMRUles is equipped with anomaly detection. If on, compute the anomaly value. \t\t\t", "boolean", "isAnomaly", "=", "false", ";", "if", "(", "this", ".", "noAnomalyDetection", "==", "false", ")", "{", "if", "(", "rule", ".", "getInstancesSeen", "(", ")", ">=", "this", ".", "anomalyNumInstThreshold", ")", "{", "isAnomaly", "=", "rule", ".", "isAnomaly", "(", "instance", ",", "this", ".", "univariateAnomalyprobabilityThreshold", ",", "this", ".", "multivariateAnomalyProbabilityThreshold", ",", "this", ".", "anomalyNumInstThreshold", ")", ";", "}", "}", "return", "isAnomaly", ";", "}" ]
Method to verify if the instance is an anomaly. @param instance @param rule @return
[ "Method", "to", "verify", "if", "the", "instance", "is", "an", "anomaly", "." ]
train
https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/rules/centralized/AMRulesRegressorProcessor.java#L270-L282
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/preprocessing/MaxAbsScaler.java
MaxAbsScaler.scale
private Double scale(Double value, Double maxAbsolute) { """ Performs the actual rescaling handling corner cases. @param value @param maxAbsolute @return """ if(maxAbsolute.equals(0.0)) { return Math.signum(value); } else { return value/maxAbsolute; } }
java
private Double scale(Double value, Double maxAbsolute) { if(maxAbsolute.equals(0.0)) { return Math.signum(value); } else { return value/maxAbsolute; } }
[ "private", "Double", "scale", "(", "Double", "value", ",", "Double", "maxAbsolute", ")", "{", "if", "(", "maxAbsolute", ".", "equals", "(", "0.0", ")", ")", "{", "return", "Math", ".", "signum", "(", "value", ")", ";", "}", "else", "{", "return", "value", "/", "maxAbsolute", ";", "}", "}" ]
Performs the actual rescaling handling corner cases. @param value @param maxAbsolute @return
[ "Performs", "the", "actual", "rescaling", "handling", "corner", "cases", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/preprocessing/MaxAbsScaler.java#L177-L184
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/EntityLockService.java
EntityLockService.newReadLock
public IEntityLock newReadLock(Class entityType, String entityKey, String owner) throws LockingException { """ Returns a read lock for the entity type, entity key and owner. @return org.apereo.portal.concurrency.locking.IEntityLock @param entityType Class @param entityKey String @param owner String @exception LockingException """ return lockService.newLock(entityType, entityKey, IEntityLockService.READ_LOCK, owner); }
java
public IEntityLock newReadLock(Class entityType, String entityKey, String owner) throws LockingException { return lockService.newLock(entityType, entityKey, IEntityLockService.READ_LOCK, owner); }
[ "public", "IEntityLock", "newReadLock", "(", "Class", "entityType", ",", "String", "entityKey", ",", "String", "owner", ")", "throws", "LockingException", "{", "return", "lockService", ".", "newLock", "(", "entityType", ",", "entityKey", ",", "IEntityLockService", ".", "READ_LOCK", ",", "owner", ")", ";", "}" ]
Returns a read lock for the entity type, entity key and owner. @return org.apereo.portal.concurrency.locking.IEntityLock @param entityType Class @param entityKey String @param owner String @exception LockingException
[ "Returns", "a", "read", "lock", "for", "the", "entity", "type", "entity", "key", "and", "owner", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/EntityLockService.java#L118-L121
liyiorg/weixin-popular
src/main/java/weixin/popular/api/UserAPI.java
UserAPI.userInfoUpdateremark
public static BaseResult userInfoUpdateremark(String access_token,String openid,String remark) { """ 设置备注名 @param access_token access_token @param openid openid @param remark remark @return BaseResult """ String postJson = String.format("{\"openid\":\"%1$s\",\"remark\":\"%2$s\"}", openid,remark); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/user/info/updateremark") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(postJson,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); }
java
public static BaseResult userInfoUpdateremark(String access_token,String openid,String remark){ String postJson = String.format("{\"openid\":\"%1$s\",\"remark\":\"%2$s\"}", openid,remark); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/user/info/updateremark") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(postJson,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); }
[ "public", "static", "BaseResult", "userInfoUpdateremark", "(", "String", "access_token", ",", "String", "openid", ",", "String", "remark", ")", "{", "String", "postJson", "=", "String", ".", "format", "(", "\"{\\\"openid\\\":\\\"%1$s\\\",\\\"remark\\\":\\\"%2$s\\\"}\"", ",", "openid", ",", "remark", ")", ";", "HttpUriRequest", "httpUriRequest", "=", "RequestBuilder", ".", "post", "(", ")", ".", "setHeader", "(", "jsonHeader", ")", ".", "setUri", "(", "BASE_URI", "+", "\"/cgi-bin/user/info/updateremark\"", ")", ".", "addParameter", "(", "PARAM_ACCESS_TOKEN", ",", "API", ".", "accessToken", "(", "access_token", ")", ")", ".", "setEntity", "(", "new", "StringEntity", "(", "postJson", ",", "Charset", ".", "forName", "(", "\"utf-8\"", ")", ")", ")", ".", "build", "(", ")", ";", "return", "LocalHttpClient", ".", "executeJsonResult", "(", "httpUriRequest", ",", "BaseResult", ".", "class", ")", ";", "}" ]
设置备注名 @param access_token access_token @param openid openid @param remark remark @return BaseResult
[ "设置备注名" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/UserAPI.java#L144-L153
google/closure-compiler
src/com/google/javascript/rhino/TypeDeclarationsIR.java
TypeDeclarationsIR.functionType
public static TypeDeclarationNode functionType( Node returnType, LinkedHashMap<String, TypeDeclarationNode> requiredParams, LinkedHashMap<String, TypeDeclarationNode> optionalParams, String restName, TypeDeclarationNode restType) { """ Represents a function type. Closure has syntax like {@code {function(string, boolean):number}} Closure doesn't include parameter names. If the parameter types are unnamed, arbitrary names can be substituted, eg. p1, p2, etc. <p>Example: <pre> FUNCTION_TYPE NUMBER_TYPE STRING_KEY p1 [declared_type_expr: STRING_TYPE] STRING_KEY p2 [declared_type_expr: BOOLEAN_TYPE] </pre> @param returnType the type returned by the function, possibly ANY_TYPE @param requiredParams the names and types of the required parameters. @param optionalParams the names and types of the optional parameters. @param restName the name of the rest parameter, if any. @param restType the type of the rest parameter, if any. """ TypeDeclarationNode node = new TypeDeclarationNode(Token.FUNCTION_TYPE, returnType); checkNotNull(requiredParams); checkNotNull(optionalParams); for (Map.Entry<String, TypeDeclarationNode> param : requiredParams.entrySet()) { Node name = IR.name(param.getKey()); node.addChildToBack(maybeAddType(name, param.getValue())); } for (Map.Entry<String, TypeDeclarationNode> param : optionalParams.entrySet()) { Node name = IR.name(param.getKey()); name.putBooleanProp(Node.OPT_ES6_TYPED, true); node.addChildToBack(maybeAddType(name, param.getValue())); } if (restName != null) { Node rest = new Node(Token.REST, IR.name(restName)); node.addChildToBack(maybeAddType(rest, restType)); } return node; }
java
public static TypeDeclarationNode functionType( Node returnType, LinkedHashMap<String, TypeDeclarationNode> requiredParams, LinkedHashMap<String, TypeDeclarationNode> optionalParams, String restName, TypeDeclarationNode restType) { TypeDeclarationNode node = new TypeDeclarationNode(Token.FUNCTION_TYPE, returnType); checkNotNull(requiredParams); checkNotNull(optionalParams); for (Map.Entry<String, TypeDeclarationNode> param : requiredParams.entrySet()) { Node name = IR.name(param.getKey()); node.addChildToBack(maybeAddType(name, param.getValue())); } for (Map.Entry<String, TypeDeclarationNode> param : optionalParams.entrySet()) { Node name = IR.name(param.getKey()); name.putBooleanProp(Node.OPT_ES6_TYPED, true); node.addChildToBack(maybeAddType(name, param.getValue())); } if (restName != null) { Node rest = new Node(Token.REST, IR.name(restName)); node.addChildToBack(maybeAddType(rest, restType)); } return node; }
[ "public", "static", "TypeDeclarationNode", "functionType", "(", "Node", "returnType", ",", "LinkedHashMap", "<", "String", ",", "TypeDeclarationNode", ">", "requiredParams", ",", "LinkedHashMap", "<", "String", ",", "TypeDeclarationNode", ">", "optionalParams", ",", "String", "restName", ",", "TypeDeclarationNode", "restType", ")", "{", "TypeDeclarationNode", "node", "=", "new", "TypeDeclarationNode", "(", "Token", ".", "FUNCTION_TYPE", ",", "returnType", ")", ";", "checkNotNull", "(", "requiredParams", ")", ";", "checkNotNull", "(", "optionalParams", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "TypeDeclarationNode", ">", "param", ":", "requiredParams", ".", "entrySet", "(", ")", ")", "{", "Node", "name", "=", "IR", ".", "name", "(", "param", ".", "getKey", "(", ")", ")", ";", "node", ".", "addChildToBack", "(", "maybeAddType", "(", "name", ",", "param", ".", "getValue", "(", ")", ")", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "TypeDeclarationNode", ">", "param", ":", "optionalParams", ".", "entrySet", "(", ")", ")", "{", "Node", "name", "=", "IR", ".", "name", "(", "param", ".", "getKey", "(", ")", ")", ";", "name", ".", "putBooleanProp", "(", "Node", ".", "OPT_ES6_TYPED", ",", "true", ")", ";", "node", ".", "addChildToBack", "(", "maybeAddType", "(", "name", ",", "param", ".", "getValue", "(", ")", ")", ")", ";", "}", "if", "(", "restName", "!=", "null", ")", "{", "Node", "rest", "=", "new", "Node", "(", "Token", ".", "REST", ",", "IR", ".", "name", "(", "restName", ")", ")", ";", "node", ".", "addChildToBack", "(", "maybeAddType", "(", "rest", ",", "restType", ")", ")", ";", "}", "return", "node", ";", "}" ]
Represents a function type. Closure has syntax like {@code {function(string, boolean):number}} Closure doesn't include parameter names. If the parameter types are unnamed, arbitrary names can be substituted, eg. p1, p2, etc. <p>Example: <pre> FUNCTION_TYPE NUMBER_TYPE STRING_KEY p1 [declared_type_expr: STRING_TYPE] STRING_KEY p2 [declared_type_expr: BOOLEAN_TYPE] </pre> @param returnType the type returned by the function, possibly ANY_TYPE @param requiredParams the names and types of the required parameters. @param optionalParams the names and types of the optional parameters. @param restName the name of the rest parameter, if any. @param restType the type of the rest parameter, if any.
[ "Represents", "a", "function", "type", ".", "Closure", "has", "syntax", "like", "{", "@code", "{", "function", "(", "string", "boolean", ")", ":", "number", "}}", "Closure", "doesn", "t", "include", "parameter", "names", ".", "If", "the", "parameter", "types", "are", "unnamed", "arbitrary", "names", "can", "be", "substituted", "eg", ".", "p1", "p2", "etc", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/TypeDeclarationsIR.java#L188-L212
rhuss/jolokia
agent/core/src/main/java/org/jolokia/backend/MBeanServerExecutorLocal.java
MBeanServerExecutorLocal.handleRequest
public <R extends JmxRequest> Object handleRequest(JsonRequestHandler<R> pRequestHandler, R pJmxReq) throws MBeanException, ReflectionException, AttributeNotFoundException, InstanceNotFoundException, NotChangedException { """ Handle a single request @param pRequestHandler the handler which can deal with this request @param pJmxReq the request to execute @return the return value @throws MBeanException @throws ReflectionException @throws AttributeNotFoundException @throws InstanceNotFoundException """ AttributeNotFoundException attrException = null; InstanceNotFoundException objNotFoundException = null; for (MBeanServerConnection conn : getMBeanServers()) { try { return pRequestHandler.handleRequest(conn, pJmxReq); } catch (InstanceNotFoundException exp) { // Remember exceptions for later use objNotFoundException = exp; } catch (AttributeNotFoundException exp) { attrException = exp; } catch (IOException exp) { throw new IllegalStateException("I/O Error while dispatching",exp); } } if (attrException != null) { throw attrException; } // Must be there, otherwise we would not have left the loop throw objNotFoundException; }
java
public <R extends JmxRequest> Object handleRequest(JsonRequestHandler<R> pRequestHandler, R pJmxReq) throws MBeanException, ReflectionException, AttributeNotFoundException, InstanceNotFoundException, NotChangedException { AttributeNotFoundException attrException = null; InstanceNotFoundException objNotFoundException = null; for (MBeanServerConnection conn : getMBeanServers()) { try { return pRequestHandler.handleRequest(conn, pJmxReq); } catch (InstanceNotFoundException exp) { // Remember exceptions for later use objNotFoundException = exp; } catch (AttributeNotFoundException exp) { attrException = exp; } catch (IOException exp) { throw new IllegalStateException("I/O Error while dispatching",exp); } } if (attrException != null) { throw attrException; } // Must be there, otherwise we would not have left the loop throw objNotFoundException; }
[ "public", "<", "R", "extends", "JmxRequest", ">", "Object", "handleRequest", "(", "JsonRequestHandler", "<", "R", ">", "pRequestHandler", ",", "R", "pJmxReq", ")", "throws", "MBeanException", ",", "ReflectionException", ",", "AttributeNotFoundException", ",", "InstanceNotFoundException", ",", "NotChangedException", "{", "AttributeNotFoundException", "attrException", "=", "null", ";", "InstanceNotFoundException", "objNotFoundException", "=", "null", ";", "for", "(", "MBeanServerConnection", "conn", ":", "getMBeanServers", "(", ")", ")", "{", "try", "{", "return", "pRequestHandler", ".", "handleRequest", "(", "conn", ",", "pJmxReq", ")", ";", "}", "catch", "(", "InstanceNotFoundException", "exp", ")", "{", "// Remember exceptions for later use", "objNotFoundException", "=", "exp", ";", "}", "catch", "(", "AttributeNotFoundException", "exp", ")", "{", "attrException", "=", "exp", ";", "}", "catch", "(", "IOException", "exp", ")", "{", "throw", "new", "IllegalStateException", "(", "\"I/O Error while dispatching\"", ",", "exp", ")", ";", "}", "}", "if", "(", "attrException", "!=", "null", ")", "{", "throw", "attrException", ";", "}", "// Must be there, otherwise we would not have left the loop", "throw", "objNotFoundException", ";", "}" ]
Handle a single request @param pRequestHandler the handler which can deal with this request @param pJmxReq the request to execute @return the return value @throws MBeanException @throws ReflectionException @throws AttributeNotFoundException @throws InstanceNotFoundException
[ "Handle", "a", "single", "request" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/MBeanServerExecutorLocal.java#L102-L124
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.localSeo_emailAvailability_GET
public OvhEmailAvailability localSeo_emailAvailability_GET(String email) throws IOException { """ Check email availability for a local SEO order REST: GET /hosting/web/localSeo/emailAvailability @param email [required] The email address to check """ String qPath = "/hosting/web/localSeo/emailAvailability"; StringBuilder sb = path(qPath); query(sb, "email", email); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhEmailAvailability.class); }
java
public OvhEmailAvailability localSeo_emailAvailability_GET(String email) throws IOException { String qPath = "/hosting/web/localSeo/emailAvailability"; StringBuilder sb = path(qPath); query(sb, "email", email); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhEmailAvailability.class); }
[ "public", "OvhEmailAvailability", "localSeo_emailAvailability_GET", "(", "String", "email", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/localSeo/emailAvailability\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"email\"", ",", "email", ")", ";", "String", "resp", "=", "execN", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhEmailAvailability", ".", "class", ")", ";", "}" ]
Check email availability for a local SEO order REST: GET /hosting/web/localSeo/emailAvailability @param email [required] The email address to check
[ "Check", "email", "availability", "for", "a", "local", "SEO", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2264-L2270
ixa-ehu/ixa-pipe-pos
src/main/java/eus/ixa/ixa/pipe/pos/Resources.java
Resources.getBinaryDict
public final URL getBinaryDict(final String lang, final String resourcesDirectory) { """ The the dictionary for the {@code MorfologikLemmatizer}. @param lang the language @param resourcesDirectory the directory where the dictionary can be found. If {@code null}, load from package resources. @return the URL of the dictonary """ return resourcesDirectory == null ? getBinaryDictFromResources(lang) : getBinaryDictFromDirectory(lang, resourcesDirectory); }
java
public final URL getBinaryDict(final String lang, final String resourcesDirectory) { return resourcesDirectory == null ? getBinaryDictFromResources(lang) : getBinaryDictFromDirectory(lang, resourcesDirectory); }
[ "public", "final", "URL", "getBinaryDict", "(", "final", "String", "lang", ",", "final", "String", "resourcesDirectory", ")", "{", "return", "resourcesDirectory", "==", "null", "?", "getBinaryDictFromResources", "(", "lang", ")", ":", "getBinaryDictFromDirectory", "(", "lang", ",", "resourcesDirectory", ")", ";", "}" ]
The the dictionary for the {@code MorfologikLemmatizer}. @param lang the language @param resourcesDirectory the directory where the dictionary can be found. If {@code null}, load from package resources. @return the URL of the dictonary
[ "The", "the", "dictionary", "for", "the", "{", "@code", "MorfologikLemmatizer", "}", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/Resources.java#L67-L71
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.notifyParentMoved
@UiThread public void notifyParentMoved(int fromParentPosition, int toParentPosition) { """ Notify any registered observers that the parent and its children reflected at {@code fromParentPosition} has been moved to {@code toParentPosition}. <p> <p>This is a structural change event. Representations of other existing items in the data set are still considered up to date and will not be rebound, though their positions may be altered.</p> @param fromParentPosition Previous position of the parent, relative to the list of parents only. @param toParentPosition New position of the parent, relative to the list of parents only. """ int fromFlatParentPosition = getFlatParentPosition(fromParentPosition); ExpandableWrapper<P, C> fromParentWrapper = mFlatItemList.get(fromFlatParentPosition); // If the parent is collapsed we can take advantage of notifyItemMoved otherwise // we are forced to do a "manual" move by removing and then adding the parent + children // (no notifyItemRangeMovedAvailable) boolean isCollapsed = !fromParentWrapper.isExpanded(); boolean isExpandedNoChildren = !isCollapsed && (fromParentWrapper.getWrappedChildList().size() == 0); if (isCollapsed || isExpandedNoChildren) { int toFlatParentPosition = getFlatParentPosition(toParentPosition); ExpandableWrapper<P, C> toParentWrapper = mFlatItemList.get(toFlatParentPosition); mFlatItemList.remove(fromFlatParentPosition); int childOffset = 0; if (toParentWrapper.isExpanded()) { childOffset = toParentWrapper.getWrappedChildList().size(); } mFlatItemList.add(toFlatParentPosition + childOffset, fromParentWrapper); notifyItemMoved(fromFlatParentPosition, toFlatParentPosition + childOffset); } else { // Remove the parent and children int sizeChanged = 0; int childListSize = fromParentWrapper.getWrappedChildList().size(); for (int i = 0; i < childListSize + 1; i++) { mFlatItemList.remove(fromFlatParentPosition); sizeChanged++; } notifyItemRangeRemoved(fromFlatParentPosition, sizeChanged); // Add the parent and children at new position int toFlatParentPosition = getFlatParentPosition(toParentPosition); int childOffset = 0; if (toFlatParentPosition != INVALID_FLAT_POSITION) { ExpandableWrapper<P, C> toParentWrapper = mFlatItemList.get(toFlatParentPosition); if (toParentWrapper.isExpanded()) { childOffset = toParentWrapper.getWrappedChildList().size(); } } else { toFlatParentPosition = mFlatItemList.size(); } mFlatItemList.add(toFlatParentPosition + childOffset, fromParentWrapper); List<ExpandableWrapper<P, C>> wrappedChildList = fromParentWrapper.getWrappedChildList(); sizeChanged = wrappedChildList.size() + 1; mFlatItemList.addAll(toFlatParentPosition + childOffset + 1, wrappedChildList); notifyItemRangeInserted(toFlatParentPosition + childOffset, sizeChanged); } }
java
@UiThread public void notifyParentMoved(int fromParentPosition, int toParentPosition) { int fromFlatParentPosition = getFlatParentPosition(fromParentPosition); ExpandableWrapper<P, C> fromParentWrapper = mFlatItemList.get(fromFlatParentPosition); // If the parent is collapsed we can take advantage of notifyItemMoved otherwise // we are forced to do a "manual" move by removing and then adding the parent + children // (no notifyItemRangeMovedAvailable) boolean isCollapsed = !fromParentWrapper.isExpanded(); boolean isExpandedNoChildren = !isCollapsed && (fromParentWrapper.getWrappedChildList().size() == 0); if (isCollapsed || isExpandedNoChildren) { int toFlatParentPosition = getFlatParentPosition(toParentPosition); ExpandableWrapper<P, C> toParentWrapper = mFlatItemList.get(toFlatParentPosition); mFlatItemList.remove(fromFlatParentPosition); int childOffset = 0; if (toParentWrapper.isExpanded()) { childOffset = toParentWrapper.getWrappedChildList().size(); } mFlatItemList.add(toFlatParentPosition + childOffset, fromParentWrapper); notifyItemMoved(fromFlatParentPosition, toFlatParentPosition + childOffset); } else { // Remove the parent and children int sizeChanged = 0; int childListSize = fromParentWrapper.getWrappedChildList().size(); for (int i = 0; i < childListSize + 1; i++) { mFlatItemList.remove(fromFlatParentPosition); sizeChanged++; } notifyItemRangeRemoved(fromFlatParentPosition, sizeChanged); // Add the parent and children at new position int toFlatParentPosition = getFlatParentPosition(toParentPosition); int childOffset = 0; if (toFlatParentPosition != INVALID_FLAT_POSITION) { ExpandableWrapper<P, C> toParentWrapper = mFlatItemList.get(toFlatParentPosition); if (toParentWrapper.isExpanded()) { childOffset = toParentWrapper.getWrappedChildList().size(); } } else { toFlatParentPosition = mFlatItemList.size(); } mFlatItemList.add(toFlatParentPosition + childOffset, fromParentWrapper); List<ExpandableWrapper<P, C>> wrappedChildList = fromParentWrapper.getWrappedChildList(); sizeChanged = wrappedChildList.size() + 1; mFlatItemList.addAll(toFlatParentPosition + childOffset + 1, wrappedChildList); notifyItemRangeInserted(toFlatParentPosition + childOffset, sizeChanged); } }
[ "@", "UiThread", "public", "void", "notifyParentMoved", "(", "int", "fromParentPosition", ",", "int", "toParentPosition", ")", "{", "int", "fromFlatParentPosition", "=", "getFlatParentPosition", "(", "fromParentPosition", ")", ";", "ExpandableWrapper", "<", "P", ",", "C", ">", "fromParentWrapper", "=", "mFlatItemList", ".", "get", "(", "fromFlatParentPosition", ")", ";", "// If the parent is collapsed we can take advantage of notifyItemMoved otherwise", "// we are forced to do a \"manual\" move by removing and then adding the parent + children", "// (no notifyItemRangeMovedAvailable)", "boolean", "isCollapsed", "=", "!", "fromParentWrapper", ".", "isExpanded", "(", ")", ";", "boolean", "isExpandedNoChildren", "=", "!", "isCollapsed", "&&", "(", "fromParentWrapper", ".", "getWrappedChildList", "(", ")", ".", "size", "(", ")", "==", "0", ")", ";", "if", "(", "isCollapsed", "||", "isExpandedNoChildren", ")", "{", "int", "toFlatParentPosition", "=", "getFlatParentPosition", "(", "toParentPosition", ")", ";", "ExpandableWrapper", "<", "P", ",", "C", ">", "toParentWrapper", "=", "mFlatItemList", ".", "get", "(", "toFlatParentPosition", ")", ";", "mFlatItemList", ".", "remove", "(", "fromFlatParentPosition", ")", ";", "int", "childOffset", "=", "0", ";", "if", "(", "toParentWrapper", ".", "isExpanded", "(", ")", ")", "{", "childOffset", "=", "toParentWrapper", ".", "getWrappedChildList", "(", ")", ".", "size", "(", ")", ";", "}", "mFlatItemList", ".", "add", "(", "toFlatParentPosition", "+", "childOffset", ",", "fromParentWrapper", ")", ";", "notifyItemMoved", "(", "fromFlatParentPosition", ",", "toFlatParentPosition", "+", "childOffset", ")", ";", "}", "else", "{", "// Remove the parent and children", "int", "sizeChanged", "=", "0", ";", "int", "childListSize", "=", "fromParentWrapper", ".", "getWrappedChildList", "(", ")", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childListSize", "+", "1", ";", "i", "++", ")", "{", "mFlatItemList", ".", "remove", "(", "fromFlatParentPosition", ")", ";", "sizeChanged", "++", ";", "}", "notifyItemRangeRemoved", "(", "fromFlatParentPosition", ",", "sizeChanged", ")", ";", "// Add the parent and children at new position", "int", "toFlatParentPosition", "=", "getFlatParentPosition", "(", "toParentPosition", ")", ";", "int", "childOffset", "=", "0", ";", "if", "(", "toFlatParentPosition", "!=", "INVALID_FLAT_POSITION", ")", "{", "ExpandableWrapper", "<", "P", ",", "C", ">", "toParentWrapper", "=", "mFlatItemList", ".", "get", "(", "toFlatParentPosition", ")", ";", "if", "(", "toParentWrapper", ".", "isExpanded", "(", ")", ")", "{", "childOffset", "=", "toParentWrapper", ".", "getWrappedChildList", "(", ")", ".", "size", "(", ")", ";", "}", "}", "else", "{", "toFlatParentPosition", "=", "mFlatItemList", ".", "size", "(", ")", ";", "}", "mFlatItemList", ".", "add", "(", "toFlatParentPosition", "+", "childOffset", ",", "fromParentWrapper", ")", ";", "List", "<", "ExpandableWrapper", "<", "P", ",", "C", ">", ">", "wrappedChildList", "=", "fromParentWrapper", ".", "getWrappedChildList", "(", ")", ";", "sizeChanged", "=", "wrappedChildList", ".", "size", "(", ")", "+", "1", ";", "mFlatItemList", ".", "addAll", "(", "toFlatParentPosition", "+", "childOffset", "+", "1", ",", "wrappedChildList", ")", ";", "notifyItemRangeInserted", "(", "toFlatParentPosition", "+", "childOffset", ",", "sizeChanged", ")", ";", "}", "}" ]
Notify any registered observers that the parent and its children reflected at {@code fromParentPosition} has been moved to {@code toParentPosition}. <p> <p>This is a structural change event. Representations of other existing items in the data set are still considered up to date and will not be rebound, though their positions may be altered.</p> @param fromParentPosition Previous position of the parent, relative to the list of parents only. @param toParentPosition New position of the parent, relative to the list of parents only.
[ "Notify", "any", "registered", "observers", "that", "the", "parent", "and", "its", "children", "reflected", "at", "{", "@code", "fromParentPosition", "}", "has", "been", "moved", "to", "{", "@code", "toParentPosition", "}", ".", "<p", ">", "<p", ">", "This", "is", "a", "structural", "change", "event", ".", "Representations", "of", "other", "existing", "items", "in", "the", "data", "set", "are", "still", "considered", "up", "to", "date", "and", "will", "not", "be", "rebound", "though", "their", "positions", "may", "be", "altered", ".", "<", "/", "p", ">" ]
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L1057-L1109
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java
CmsGalleriesTab.updateTreeContent
public void updateTreeContent(List<CmsGalleryTreeEntry> galleryTreeEntries, List<String> selectedGalleries) { """ Update the galleries tree.<p> @param galleryTreeEntries the new gallery tree list @param selectedGalleries the list of galleries to select """ clearList(); m_selectedGalleries = selectedGalleries; if (!galleryTreeEntries.isEmpty()) { m_itemIterator = new TreeItemGenerator(galleryTreeEntries); loadMoreItems(); } else { showIsEmptyLabel(); } onContentChange(); }
java
public void updateTreeContent(List<CmsGalleryTreeEntry> galleryTreeEntries, List<String> selectedGalleries) { clearList(); m_selectedGalleries = selectedGalleries; if (!galleryTreeEntries.isEmpty()) { m_itemIterator = new TreeItemGenerator(galleryTreeEntries); loadMoreItems(); } else { showIsEmptyLabel(); } onContentChange(); }
[ "public", "void", "updateTreeContent", "(", "List", "<", "CmsGalleryTreeEntry", ">", "galleryTreeEntries", ",", "List", "<", "String", ">", "selectedGalleries", ")", "{", "clearList", "(", ")", ";", "m_selectedGalleries", "=", "selectedGalleries", ";", "if", "(", "!", "galleryTreeEntries", ".", "isEmpty", "(", ")", ")", "{", "m_itemIterator", "=", "new", "TreeItemGenerator", "(", "galleryTreeEntries", ")", ";", "loadMoreItems", "(", ")", ";", "}", "else", "{", "showIsEmptyLabel", "(", ")", ";", "}", "onContentChange", "(", ")", ";", "}" ]
Update the galleries tree.<p> @param galleryTreeEntries the new gallery tree list @param selectedGalleries the list of galleries to select
[ "Update", "the", "galleries", "tree", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java#L428-L439
qos-ch/slf4j
slf4j-ext/src/main/java/org/slf4j/profiler/SpacePadder.java
SpacePadder.spacePad
@Deprecated final static public void spacePad(StringBuffer sbuf, int length) { """ Fast space padding method. @param sbuf the buffer to pad @param length the target size of the buffer after padding """ while (length >= 32) { sbuf.append(SPACES[5]); length -= 32; } for (int i = 4; i >= 0; i--) { if ((length & (1 << i)) != 0) { sbuf.append(SPACES[i]); } } }
java
@Deprecated final static public void spacePad(StringBuffer sbuf, int length) { while (length >= 32) { sbuf.append(SPACES[5]); length -= 32; } for (int i = 4; i >= 0; i--) { if ((length & (1 << i)) != 0) { sbuf.append(SPACES[i]); } } }
[ "@", "Deprecated", "final", "static", "public", "void", "spacePad", "(", "StringBuffer", "sbuf", ",", "int", "length", ")", "{", "while", "(", "length", ">=", "32", ")", "{", "sbuf", ".", "append", "(", "SPACES", "[", "5", "]", ")", ";", "length", "-=", "32", ";", "}", "for", "(", "int", "i", "=", "4", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "(", "length", "&", "(", "1", "<<", "i", ")", ")", "!=", "0", ")", "{", "sbuf", ".", "append", "(", "SPACES", "[", "i", "]", ")", ";", "}", "}", "}" ]
Fast space padding method. @param sbuf the buffer to pad @param length the target size of the buffer after padding
[ "Fast", "space", "padding", "method", "." ]
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/slf4j-ext/src/main/java/org/slf4j/profiler/SpacePadder.java#L95-L107
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobsInner.java
DscCompilationJobsInner.getAsync
public Observable<DscCompilationJobInner> getAsync(String resourceGroupName, String automationAccountName, UUID compilationJobId) { """ Retrieve the Dsc configuration compilation job identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param compilationJobId The Dsc configuration compilation job id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscCompilationJobInner object """ return getWithServiceResponseAsync(resourceGroupName, automationAccountName, compilationJobId).map(new Func1<ServiceResponse<DscCompilationJobInner>, DscCompilationJobInner>() { @Override public DscCompilationJobInner call(ServiceResponse<DscCompilationJobInner> response) { return response.body(); } }); }
java
public Observable<DscCompilationJobInner> getAsync(String resourceGroupName, String automationAccountName, UUID compilationJobId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, compilationJobId).map(new Func1<ServiceResponse<DscCompilationJobInner>, DscCompilationJobInner>() { @Override public DscCompilationJobInner call(ServiceResponse<DscCompilationJobInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DscCompilationJobInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "UUID", "compilationJobId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "compilationJobId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DscCompilationJobInner", ">", ",", "DscCompilationJobInner", ">", "(", ")", "{", "@", "Override", "public", "DscCompilationJobInner", "call", "(", "ServiceResponse", "<", "DscCompilationJobInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve the Dsc configuration compilation job identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param compilationJobId The Dsc configuration compilation job id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscCompilationJobInner object
[ "Retrieve", "the", "Dsc", "configuration", "compilation", "job", "identified", "by", "job", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobsInner.java#L224-L231