repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java
InsertAllRequest.of
public static InsertAllRequest of(TableId tableId, Iterable<RowToInsert> rows) { return newBuilder(tableId, rows).build(); }
java
public static InsertAllRequest of(TableId tableId, Iterable<RowToInsert> rows) { return newBuilder(tableId, rows).build(); }
[ "public", "static", "InsertAllRequest", "of", "(", "TableId", "tableId", ",", "Iterable", "<", "RowToInsert", ">", "rows", ")", "{", "return", "newBuilder", "(", "tableId", ",", "rows", ")", ".", "build", "(", ")", ";", "}" ]
Returns a {@code InsertAllRequest} object given the destination table and the rows to insert.
[ "Returns", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java#L395-L397
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multTransAB
public static void multTransAB(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { if( b.numRows == 1) { // there are significantly faster algorithms when dealing with vectors if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixVectorMult_DDRM.multTransA_reorder(a,b,c); } else { MatrixVectorMult_DDRM.multTransA_small(a,b,c); } } else if( a.numCols >= EjmlParameters.MULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multTransAB_aux(a, b, c, null); } else { MatrixMatrixMult_DDRM.multTransAB(a, b, c); } }
java
public static void multTransAB(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { if( b.numRows == 1) { // there are significantly faster algorithms when dealing with vectors if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixVectorMult_DDRM.multTransA_reorder(a,b,c); } else { MatrixVectorMult_DDRM.multTransA_small(a,b,c); } } else if( a.numCols >= EjmlParameters.MULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multTransAB_aux(a, b, c, null); } else { MatrixMatrixMult_DDRM.multTransAB(a, b, c); } }
[ "public", "static", "void", "multTransAB", "(", "DMatrix1Row", "a", ",", "DMatrix1Row", "b", ",", "DMatrix1Row", "c", ")", "{", "if", "(", "b", ".", "numRows", "==", "1", ")", "{", "// there are significantly faster algorithms when dealing with vectors", "if", "("...
<p> Performs the following operation:<br> <br> c = a<sup>T</sup> * b<sup>T</sup><br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a<sup", ">", "T<", "/", "sup", ">", "*", "b<sup", ">", "T<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L215-L229
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java
BeansToExcelOnTemplate.mergeCols
private void mergeCols(ExcelRows excelRowsAnn, Cell templateCell, int itemSize) { val tmplRowIndexRef = templateCell.getRowIndex() + 1; for (val mergeColAnn : excelRowsAnn.mergeCols()) { val from = PoiUtil.findCell(sheet, mergeColAnn.fromColRef() + tmplRowIndexRef); val to = PoiUtil.findCell(sheet, mergeColAnn.toColRef() + tmplRowIndexRef); val fromRow = from.getRowIndex(); val fromCol = from.getColumnIndex(); val toCol = to.getColumnIndex(); for (int i = fromRow; i < fromRow + itemSize; ++i) { sheet.addMergedRegion(new CellRangeAddress(i, i, fromCol, toCol)); } } }
java
private void mergeCols(ExcelRows excelRowsAnn, Cell templateCell, int itemSize) { val tmplRowIndexRef = templateCell.getRowIndex() + 1; for (val mergeColAnn : excelRowsAnn.mergeCols()) { val from = PoiUtil.findCell(sheet, mergeColAnn.fromColRef() + tmplRowIndexRef); val to = PoiUtil.findCell(sheet, mergeColAnn.toColRef() + tmplRowIndexRef); val fromRow = from.getRowIndex(); val fromCol = from.getColumnIndex(); val toCol = to.getColumnIndex(); for (int i = fromRow; i < fromRow + itemSize; ++i) { sheet.addMergedRegion(new CellRangeAddress(i, i, fromCol, toCol)); } } }
[ "private", "void", "mergeCols", "(", "ExcelRows", "excelRowsAnn", ",", "Cell", "templateCell", ",", "int", "itemSize", ")", "{", "val", "tmplRowIndexRef", "=", "templateCell", ".", "getRowIndex", "(", ")", "+", "1", ";", "for", "(", "val", "mergeColAnn", ":"...
根据@ExcelRows注解的指示,合并横向合并单元格。 @param excelRowsAnn @ExcelRows注解值。 @param templateCell 模板单元格。 @param itemSize 在多少行上横向合并单元格。
[ "根据@ExcelRows注解的指示,合并横向合并单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L104-L118
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java
SOS.estimateInitialBeta
@Reference(authors = "Erich Schubert, Michael Gertz", // title = "Intrinsic t-Stochastic Neighbor Embedding for Visualization and Outlier Detection: A Remedy Against the Curse of Dimensionality?", // booktitle = "Proc. Int. Conf. Similarity Search and Applications, SISAP'2017", // url = "https://doi.org/10.1007/978-3-319-68474-1_13", // bibkey = "DBLP:conf/sisap/SchubertG17") protected static double estimateInitialBeta(DBIDRef ignore, DoubleDBIDListIter it, double perplexity) { double sum = 0.; int size = 0; for(it.seek(0); it.valid(); it.advance()) { if(DBIDUtil.equal(ignore, it)) { continue; } sum += it.doubleValue() < Double.POSITIVE_INFINITY ? it.doubleValue() : 0.; ++size; } // In degenerate cases, simply return 1. return (sum > 0. && sum < Double.POSITIVE_INFINITY) ? (.5 / sum * perplexity * (size - 1.)) : 1.; }
java
@Reference(authors = "Erich Schubert, Michael Gertz", // title = "Intrinsic t-Stochastic Neighbor Embedding for Visualization and Outlier Detection: A Remedy Against the Curse of Dimensionality?", // booktitle = "Proc. Int. Conf. Similarity Search and Applications, SISAP'2017", // url = "https://doi.org/10.1007/978-3-319-68474-1_13", // bibkey = "DBLP:conf/sisap/SchubertG17") protected static double estimateInitialBeta(DBIDRef ignore, DoubleDBIDListIter it, double perplexity) { double sum = 0.; int size = 0; for(it.seek(0); it.valid(); it.advance()) { if(DBIDUtil.equal(ignore, it)) { continue; } sum += it.doubleValue() < Double.POSITIVE_INFINITY ? it.doubleValue() : 0.; ++size; } // In degenerate cases, simply return 1. return (sum > 0. && sum < Double.POSITIVE_INFINITY) ? (.5 / sum * perplexity * (size - 1.)) : 1.; }
[ "@", "Reference", "(", "authors", "=", "\"Erich Schubert, Michael Gertz\"", ",", "//", "title", "=", "\"Intrinsic t-Stochastic Neighbor Embedding for Visualization and Outlier Detection: A Remedy Against the Curse of Dimensionality?\"", ",", "//", "booktitle", "=", "\"Proc. Int. Conf. ...
Estimate beta from the distances in a row. <p> This lacks a thorough mathematical argument, but is a handcrafted heuristic to avoid numerical problems. The average distance is usually too large, so we scale the average distance by 2*N/perplexity. Then estimate beta as 1/x. @param ignore Object to skip @param it Distance iterator @param perplexity Desired perplexity @return Estimated beta.
[ "Estimate", "beta", "from", "the", "distances", "in", "a", "row", ".", "<p", ">", "This", "lacks", "a", "thorough", "mathematical", "argument", "but", "is", "a", "handcrafted", "heuristic", "to", "avoid", "numerical", "problems", ".", "The", "average", "dist...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java#L244-L261
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.sendSms
public static Intent sendSms(String to, String message) { Uri smsUri = Uri.parse("tel:" + to); Intent intent = new Intent(Intent.ACTION_VIEW, smsUri); intent.putExtra("address", to); intent.putExtra("sms_body", message); intent.setType("vnd.android-dir/mms-sms"); return intent; }
java
public static Intent sendSms(String to, String message) { Uri smsUri = Uri.parse("tel:" + to); Intent intent = new Intent(Intent.ACTION_VIEW, smsUri); intent.putExtra("address", to); intent.putExtra("sms_body", message); intent.setType("vnd.android-dir/mms-sms"); return intent; }
[ "public", "static", "Intent", "sendSms", "(", "String", "to", ",", "String", "message", ")", "{", "Uri", "smsUri", "=", "Uri", ".", "parse", "(", "\"tel:\"", "+", "to", ")", ";", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_VIE...
Send SMS message using built-in app @param to Receiver phone number @param message Text to send
[ "Send", "SMS", "message", "using", "built", "-", "in", "app" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L117-L124
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceInfoMap.java
SourceInfoMap.getMethodLine
public @CheckForNull SourceLineRange getMethodLine(String className, String methodName, String methodSignature) { return methodLineMap.get(new MethodDescriptor(className, methodName, methodSignature)); }
java
public @CheckForNull SourceLineRange getMethodLine(String className, String methodName, String methodSignature) { return methodLineMap.get(new MethodDescriptor(className, methodName, methodSignature)); }
[ "public", "@", "CheckForNull", "SourceLineRange", "getMethodLine", "(", "String", "className", ",", "String", "methodName", ",", "String", "methodSignature", ")", "{", "return", "methodLineMap", ".", "get", "(", "new", "MethodDescriptor", "(", "className", ",", "m...
Look up the line number range for a method. @param className name of class containing the method @param methodName name of method @param methodSignature signature of method @return the line number range, or null if no line number is known for the method
[ "Look", "up", "the", "line", "number", "range", "for", "a", "method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceInfoMap.java#L310-L313
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.clickOn
@Conditioned @Quand("Je clique sur '(.*)-(.*)'[\\.|\\?]") @When("I click on '(.*)-(.*)'[\\.|\\?]") public void clickOn(String page, String toClick, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { logger.debug("{} clickOn: {}", page, toClick); clickOn(Page.getInstance(page).getPageElementByKey('-' + toClick)); }
java
@Conditioned @Quand("Je clique sur '(.*)-(.*)'[\\.|\\?]") @When("I click on '(.*)-(.*)'[\\.|\\?]") public void clickOn(String page, String toClick, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { logger.debug("{} clickOn: {}", page, toClick); clickOn(Page.getInstance(page).getPageElementByKey('-' + toClick)); }
[ "@", "Conditioned", "@", "Quand", "(", "\"Je clique sur '(.*)-(.*)'[\\\\.|\\\\?]\"", ")", "@", "When", "(", "\"I click on '(.*)-(.*)'[\\\\.|\\\\?]\"", ")", "public", "void", "clickOn", "(", "String", "page", ",", "String", "toClick", ",", "List", "<", "GherkinStepCond...
Click on html element if all 'expected' parameters equals 'actual' parameters in conditions. @param page The concerned page of toClick @param toClick html element. @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK} message (with screenshot, no exception) @throws FailureException if the scenario encounters a functional error
[ "Click", "on", "html", "element", "if", "all", "expected", "parameters", "equals", "actual", "parameters", "in", "conditions", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L384-L390
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlUtils.java
ControlUtils.resolveDefaultBinding
public static String resolveDefaultBinding( String implBinding, String controlClass ) { int intfIndex = implBinding.indexOf(ControlInterface.INTERFACE_NAME); if (intfIndex >= 0) { implBinding = implBinding.substring(0,intfIndex) + controlClass + implBinding.substring(intfIndex + ControlInterface.INTERFACE_NAME.length()); } return implBinding; }
java
public static String resolveDefaultBinding( String implBinding, String controlClass ) { int intfIndex = implBinding.indexOf(ControlInterface.INTERFACE_NAME); if (intfIndex >= 0) { implBinding = implBinding.substring(0,intfIndex) + controlClass + implBinding.substring(intfIndex + ControlInterface.INTERFACE_NAME.length()); } return implBinding; }
[ "public", "static", "String", "resolveDefaultBinding", "(", "String", "implBinding", ",", "String", "controlClass", ")", "{", "int", "intfIndex", "=", "implBinding", ".", "indexOf", "(", "ControlInterface", ".", "INTERFACE_NAME", ")", ";", "if", "(", "intfIndex", ...
Implements the default control implementation binding algorithm ( <InterfaceName> + "Impl" ). See documentation for the org.apache.beehive.controls.api.bean.ControlInterface annotation. @param implBinding the value of the defaultBinding attribute returned from a ControlInterface annotation @param controlClass the actual name of the interface decorated by the ControlInterface annotation @return the resolved defaultBinding value
[ "Implements", "the", "default", "control", "implementation", "binding", "algorithm", "(", "<InterfaceName", ">", "+", "Impl", ")", ".", "See", "documentation", "for", "the", "org", ".", "apache", ".", "beehive", ".", "controls", ".", "api", ".", "bean", ".",...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlUtils.java#L40-L50
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getAllCurrencyID
public List<Integer> getAllCurrencyID() throws GuildWars2Exception { try { Response<List<Integer>> response = gw2API.getAllCurrencies().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public List<Integer> getAllCurrencyID() throws GuildWars2Exception { try { Response<List<Integer>> response = gw2API.getAllCurrencies().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "List", "<", "Integer", ">", "getAllCurrencyID", "(", ")", "throws", "GuildWars2Exception", "{", "try", "{", "Response", "<", "List", "<", "Integer", ">>", "response", "=", "gw2API", ".", "getAllCurrencies", "(", ")", ".", "execute", "(", ")", ";...
For more info on Currency API go <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> Get all currency ids @return list of currency ids @throws GuildWars2Exception see {@link ErrorCode} for detail @see Currency currency info
[ "For", "more", "info", "on", "Currency", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "currencies", ">", "here<", "/", "a", ">", "<br", "/", ">", "Get", "all", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L1667-L1675
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/DefaultQueryParameter.java
DefaultQueryParameter.putIfNotSet
static void putIfNotSet(Map<String, String> target, Map<String, String> defaults) { for (final String key : defaults.keySet()) { if (!target.containsKey(key)) { target.put(key, defaults.get(key)); } } }
java
static void putIfNotSet(Map<String, String> target, Map<String, String> defaults) { for (final String key : defaults.keySet()) { if (!target.containsKey(key)) { target.put(key, defaults.get(key)); } } }
[ "static", "void", "putIfNotSet", "(", "Map", "<", "String", ",", "String", ">", "target", ",", "Map", "<", "String", ",", "String", ">", "defaults", ")", "{", "for", "(", "final", "String", "key", ":", "defaults", ".", "keySet", "(", ")", ")", "{", ...
Update a given map with some default values if not already present in map. @param target the map to be filled with values, if a key for them is not set already. @param defaults the list of defaults, to be set.
[ "Update", "a", "given", "map", "with", "some", "default", "values", "if", "not", "already", "present", "in", "map", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/DefaultQueryParameter.java#L37-L43
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/meta/PathProperties.java
PathProperties.removeAll
public void removeAll(Supplier<JournalContext> ctx, String path) { try (LockResource r = new LockResource(mLock.writeLock())) { Map<String, String> properties = mState.getProperties(path); if (!properties.isEmpty()) { mState.applyAndJournal(ctx, RemovePathPropertiesEntry.newBuilder().setPath(path).build()); } } }
java
public void removeAll(Supplier<JournalContext> ctx, String path) { try (LockResource r = new LockResource(mLock.writeLock())) { Map<String, String> properties = mState.getProperties(path); if (!properties.isEmpty()) { mState.applyAndJournal(ctx, RemovePathPropertiesEntry.newBuilder().setPath(path).build()); } } }
[ "public", "void", "removeAll", "(", "Supplier", "<", "JournalContext", ">", "ctx", ",", "String", "path", ")", "{", "try", "(", "LockResource", "r", "=", "new", "LockResource", "(", "mLock", ".", "writeLock", "(", ")", ")", ")", "{", "Map", "<", "Strin...
Removes all properties for path. @param ctx the journal context @param path the path
[ "Removes", "all", "properties", "for", "path", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/meta/PathProperties.java#L117-L124
CloudBees-community/syslog-java-client
src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java
UdpSyslogMessageSender.sendMessage
@Override public void sendMessage(SyslogMessage message) throws IOException { sendCounter.incrementAndGet(); long nanosBefore = System.nanoTime(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Writer out = new OutputStreamWriter(baos, UTF_8); message.toSyslogMessage(messageFormat, out); out.flush(); if (logger.isLoggable(Level.FINEST)) { logger.finest("Send syslog message " + new String(baos.toByteArray(), UTF_8)); } byte[] bytes = baos.toByteArray(); DatagramPacket packet = new DatagramPacket(bytes, bytes.length, syslogServerHostnameReference.get(), syslogServerPort); datagramSocket.send(packet); } catch (IOException e) { sendErrorCounter.incrementAndGet(); throw e; } catch (RuntimeException e) { sendErrorCounter.incrementAndGet(); throw e; } finally { sendDurationInNanosCounter.addAndGet(System.nanoTime() - nanosBefore); } }
java
@Override public void sendMessage(SyslogMessage message) throws IOException { sendCounter.incrementAndGet(); long nanosBefore = System.nanoTime(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Writer out = new OutputStreamWriter(baos, UTF_8); message.toSyslogMessage(messageFormat, out); out.flush(); if (logger.isLoggable(Level.FINEST)) { logger.finest("Send syslog message " + new String(baos.toByteArray(), UTF_8)); } byte[] bytes = baos.toByteArray(); DatagramPacket packet = new DatagramPacket(bytes, bytes.length, syslogServerHostnameReference.get(), syslogServerPort); datagramSocket.send(packet); } catch (IOException e) { sendErrorCounter.incrementAndGet(); throw e; } catch (RuntimeException e) { sendErrorCounter.incrementAndGet(); throw e; } finally { sendDurationInNanosCounter.addAndGet(System.nanoTime() - nanosBefore); } }
[ "@", "Override", "public", "void", "sendMessage", "(", "SyslogMessage", "message", ")", "throws", "IOException", "{", "sendCounter", ".", "incrementAndGet", "(", ")", ";", "long", "nanosBefore", "=", "System", ".", "nanoTime", "(", ")", ";", "try", "{", "Byt...
Send the given {@link com.cloudbees.syslog.SyslogMessage} over UDP. @param message the message to send @throws IOException
[ "Send", "the", "given", "{", "@link", "com", ".", "cloudbees", ".", "syslog", ".", "SyslogMessage", "}", "over", "UDP", "." ]
train
https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/sender/UdpSyslogMessageSender.java#L76-L103
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.buildTimeZoneAliases
private void buildTimeZoneAliases(TypeSpec.Builder type, Map<String, String> map) { MethodSpec.Builder method = MethodSpec.methodBuilder("getTimeZoneAlias") .addModifiers(PUBLIC, STATIC) .addParameter(String.class, "zoneId") .returns(String.class); method.beginControlFlow("switch (zoneId)"); for (Map.Entry<String, String> entry : map.entrySet()) { method.addStatement("case $S: return $S", entry.getKey(), entry.getValue()); } method.addStatement("default: return null"); method.endControlFlow(); type.addMethod(method.build()); }
java
private void buildTimeZoneAliases(TypeSpec.Builder type, Map<String, String> map) { MethodSpec.Builder method = MethodSpec.methodBuilder("getTimeZoneAlias") .addModifiers(PUBLIC, STATIC) .addParameter(String.class, "zoneId") .returns(String.class); method.beginControlFlow("switch (zoneId)"); for (Map.Entry<String, String> entry : map.entrySet()) { method.addStatement("case $S: return $S", entry.getKey(), entry.getValue()); } method.addStatement("default: return null"); method.endControlFlow(); type.addMethod(method.build()); }
[ "private", "void", "buildTimeZoneAliases", "(", "TypeSpec", ".", "Builder", "type", ",", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "\"getTimeZoneAlias\"", ")...
Creates a switch table to resolve a retired time zone to a valid one.
[ "Creates", "a", "switch", "table", "to", "resolve", "a", "retired", "time", "zone", "to", "a", "valid", "one", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L186-L199
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java
IOUtil.readBytesFromOtherInputStream
public static int readBytesFromOtherInputStream(InputStream is, byte[] targetArray) throws IOException { assert targetArray != null; if (targetArray.length == 0) return 0; int len; int off = 0; while (off < targetArray.length && (len = is.read(targetArray, off, targetArray.length - off)) != -1) { off += len; } return off; }
java
public static int readBytesFromOtherInputStream(InputStream is, byte[] targetArray) throws IOException { assert targetArray != null; if (targetArray.length == 0) return 0; int len; int off = 0; while (off < targetArray.length && (len = is.read(targetArray, off, targetArray.length - off)) != -1) { off += len; } return off; }
[ "public", "static", "int", "readBytesFromOtherInputStream", "(", "InputStream", "is", ",", "byte", "[", "]", "targetArray", ")", "throws", "IOException", "{", "assert", "targetArray", "!=", "null", ";", "if", "(", "targetArray", ".", "length", "==", "0", ")", ...
从InputStream读取指定长度的字节出来 @param is 流 @param targetArray output @return 实际读取了多少字节,返回0表示遇到了文件尾部 @throws IOException
[ "从InputStream读取指定长度的字节出来" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L292-L303
voldemort/voldemort
src/java/voldemort/rest/coordinator/config/ClientConfigUtil.java
ClientConfigUtil.readSingleClientConfigAvro
@SuppressWarnings("unchecked") public static Properties readSingleClientConfigAvro(String configAvro) { Properties props = new Properties(); try { JsonDecoder decoder = new JsonDecoder(CLIENT_CONFIG_AVRO_SCHEMA, configAvro); GenericDatumReader<Object> datumReader = new GenericDatumReader<Object>(CLIENT_CONFIG_AVRO_SCHEMA); Map<Utf8, Utf8> flowMap = (Map<Utf8, Utf8>) datumReader.read(null, decoder); for(Utf8 key: flowMap.keySet()) { props.put(key.toString(), flowMap.get(key).toString()); } } catch(Exception e) { e.printStackTrace(); } return props; }
java
@SuppressWarnings("unchecked") public static Properties readSingleClientConfigAvro(String configAvro) { Properties props = new Properties(); try { JsonDecoder decoder = new JsonDecoder(CLIENT_CONFIG_AVRO_SCHEMA, configAvro); GenericDatumReader<Object> datumReader = new GenericDatumReader<Object>(CLIENT_CONFIG_AVRO_SCHEMA); Map<Utf8, Utf8> flowMap = (Map<Utf8, Utf8>) datumReader.read(null, decoder); for(Utf8 key: flowMap.keySet()) { props.put(key.toString(), flowMap.get(key).toString()); } } catch(Exception e) { e.printStackTrace(); } return props; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Properties", "readSingleClientConfigAvro", "(", "String", "configAvro", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "try", "{", "JsonDecoder", "decoder", "=", ...
Parses a string that contains single fat client config string in avro format @param configAvro Input string of avro format, that contains config for multiple stores @return Properties of single fat client config
[ "Parses", "a", "string", "that", "contains", "single", "fat", "client", "config", "string", "in", "avro", "format" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/config/ClientConfigUtil.java#L34-L48
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java
TasksImpl.listNext
public PagedList<CloudTask> listNext(final String nextPageLink, final TaskListNextOptions taskListNextOptions) { ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> response = listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single(); return new PagedList<CloudTask>(response.body()) { @Override public Page<CloudTask> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<CloudTask> listNext(final String nextPageLink, final TaskListNextOptions taskListNextOptions) { ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> response = listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single(); return new PagedList<CloudTask>(response.body()) { @Override public Page<CloudTask> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "CloudTask", ">", "listNext", "(", "final", "String", "nextPageLink", ",", "final", "TaskListNextOptions", "taskListNextOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudTask", ">", ",", "TaskListHeaders", ">", "re...
Lists all of the tasks that are associated with the specified job. For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. @param nextPageLink The NextLink from the previous successful call to List operation. @param taskListNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudTask&gt; object if successful.
[ "Lists", "all", "of", "the", "tasks", "that", "are", "associated", "with", "the", "specified", "job", ".", "For", "multi", "-", "instance", "tasks", "information", "such", "as", "affinityId", "executionInfo", "and", "nodeInfo", "refer", "to", "the", "primary",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L2441-L2449
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java
AccountsImpl.listNodeAgentSkusNextAsync
public Observable<Page<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { return listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, accountListNodeAgentSkusNextOptions) .map(new Func1<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>, Page<NodeAgentSku>>() { @Override public Page<NodeAgentSku> call(ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response) { return response.body(); } }); }
java
public Observable<Page<NodeAgentSku>> listNodeAgentSkusNextAsync(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { return listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, accountListNodeAgentSkusNextOptions) .map(new Func1<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>, Page<NodeAgentSku>>() { @Override public Page<NodeAgentSku> call(ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "NodeAgentSku", ">", ">", "listNodeAgentSkusNextAsync", "(", "final", "String", "nextPageLink", ",", "final", "AccountListNodeAgentSkusNextOptions", "accountListNodeAgentSkusNextOptions", ")", "{", "return", "listNodeAgentSkusNextWith...
Lists all node agent SKUs supported by the Azure Batch service. @param nextPageLink The NextLink from the previous successful call to List operation. @param accountListNodeAgentSkusNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeAgentSku&gt; object
[ "Lists", "all", "node", "agent", "SKUs", "supported", "by", "the", "Azure", "Batch", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L799-L807
JetBrains/xodus
environment/src/main/java/jetbrains/exodus/env/EnvironmentImpl.java
EnvironmentImpl.loadMetaTree
@Nullable BTree loadMetaTree(final long rootAddress, final LogTip logTip) { if (rootAddress < 0 || rootAddress >= logTip.highAddress) return null; return new BTree(log, getBTreeBalancePolicy(), rootAddress, false, META_TREE_ID) { @NotNull @Override public DataIterator getDataIterator(long address) { return new DataIterator(log, address); } }; }
java
@Nullable BTree loadMetaTree(final long rootAddress, final LogTip logTip) { if (rootAddress < 0 || rootAddress >= logTip.highAddress) return null; return new BTree(log, getBTreeBalancePolicy(), rootAddress, false, META_TREE_ID) { @NotNull @Override public DataIterator getDataIterator(long address) { return new DataIterator(log, address); } }; }
[ "@", "Nullable", "BTree", "loadMetaTree", "(", "final", "long", "rootAddress", ",", "final", "LogTip", "logTip", ")", "{", "if", "(", "rootAddress", "<", "0", "||", "rootAddress", ">=", "logTip", ".", "highAddress", ")", "return", "null", ";", "return", "n...
Tries to load meta tree located at specified rootAddress. @param rootAddress tree root address. @return tree instance or null if the address is not valid.
[ "Tries", "to", "load", "meta", "tree", "located", "at", "specified", "rootAddress", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/env/EnvironmentImpl.java#L618-L628
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.valueOf
public static String valueOf(char source[], int start, int limit, int offset16) { switch (bounds(source, start, limit, offset16)) { case LEAD_SURROGATE_BOUNDARY: return new String(source, start + offset16, 2); case TRAIL_SURROGATE_BOUNDARY: return new String(source, start + offset16 - 1, 2); } return new String(source, start + offset16, 1); }
java
public static String valueOf(char source[], int start, int limit, int offset16) { switch (bounds(source, start, limit, offset16)) { case LEAD_SURROGATE_BOUNDARY: return new String(source, start + offset16, 2); case TRAIL_SURROGATE_BOUNDARY: return new String(source, start + offset16 - 1, 2); } return new String(source, start + offset16, 1); }
[ "public", "static", "String", "valueOf", "(", "char", "source", "[", "]", ",", "int", "start", ",", "int", "limit", ",", "int", "offset16", ")", "{", "switch", "(", "bounds", "(", "source", ",", "start", ",", "limit", ",", "offset16", ")", ")", "{", ...
Convenience method. Returns a one or two char string containing the UTF-32 value in UTF16 format. If offset16 indexes a surrogate character, the whole supplementary codepoint will be returned, except when either the leading or trailing surrogate character lies out of the specified subarray. In the latter case, only the surrogate character within bounds will be returned. If a validity check is required, use {@link android.icu.lang.UCharacter#isLegal(int)} on the codepoint at offset16 before calling. The result returned will be a newly created String containing the relevant characters. @param source The input char array. @param start Start index of the subarray @param limit End index of the subarray @param offset16 The UTF16 index to the codepoint in source relative to start @return string value of char32 in UTF16 format
[ "Convenience", "method", ".", "Returns", "a", "one", "or", "two", "char", "string", "containing", "the", "UTF", "-", "32", "value", "in", "UTF16", "format", ".", "If", "offset16", "indexes", "a", "surrogate", "character", "the", "whole", "supplementary", "co...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L710-L718
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ApiRequestExecutorImpl.java
ApiRequestExecutorImpl.createResponseChain
private Chain<ApiResponse> createResponseChain(IAsyncHandler<ApiResponse> responseHandler) { ResponseChain chain = new ResponseChain(policyImpls, context); chain.headHandler(responseHandler); chain.policyFailureHandler(result -> { if (apiConnectionResponse != null) { apiConnectionResponse.abort(); } policyFailureHandler.handle(result); }); chain.policyErrorHandler(result -> { if (apiConnectionResponse != null) { apiConnectionResponse.abort(); } policyErrorHandler.handle(result); }); return chain; }
java
private Chain<ApiResponse> createResponseChain(IAsyncHandler<ApiResponse> responseHandler) { ResponseChain chain = new ResponseChain(policyImpls, context); chain.headHandler(responseHandler); chain.policyFailureHandler(result -> { if (apiConnectionResponse != null) { apiConnectionResponse.abort(); } policyFailureHandler.handle(result); }); chain.policyErrorHandler(result -> { if (apiConnectionResponse != null) { apiConnectionResponse.abort(); } policyErrorHandler.handle(result); }); return chain; }
[ "private", "Chain", "<", "ApiResponse", ">", "createResponseChain", "(", "IAsyncHandler", "<", "ApiResponse", ">", "responseHandler", ")", "{", "ResponseChain", "chain", "=", "new", "ResponseChain", "(", "policyImpls", ",", "context", ")", ";", "chain", ".", "he...
Creates the chain used to apply policies in reverse order to the api response.
[ "Creates", "the", "chain", "used", "to", "apply", "policies", "in", "reverse", "order", "to", "the", "api", "response", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ApiRequestExecutorImpl.java#L824-L840
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XSynchronizedExpression expression, ISideEffectContext context) { return hasSideEffects(expression.getExpression(), context); }
java
protected Boolean _hasSideEffects(XSynchronizedExpression expression, ISideEffectContext context) { return hasSideEffects(expression.getExpression(), context); }
[ "protected", "Boolean", "_hasSideEffects", "(", "XSynchronizedExpression", "expression", ",", "ISideEffectContext", "context", ")", "{", "return", "hasSideEffects", "(", "expression", ".", "getExpression", "(", ")", ",", "context", ")", ";", "}" ]
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L264-L266
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/resource/TemplateDraft.java
TemplateDraft.serializeMergeFields
public static String serializeMergeFields(Map<String, FieldType> mergeFields) throws HelloSignException { if (mergeFields == null || mergeFields.isEmpty()) { return null; } JSONArray mergeFieldArray = new JSONArray(); for (String key : mergeFields.keySet()) { FieldType type = mergeFields.get(key); JSONObject mergeFieldObj = new JSONObject(); try { mergeFieldObj.put("name", key); mergeFieldObj.put("type", type.toString()); } catch (JSONException e) { throw new HelloSignException(e); } mergeFieldArray.put(mergeFieldObj); } return mergeFieldArray.toString(); }
java
public static String serializeMergeFields(Map<String, FieldType> mergeFields) throws HelloSignException { if (mergeFields == null || mergeFields.isEmpty()) { return null; } JSONArray mergeFieldArray = new JSONArray(); for (String key : mergeFields.keySet()) { FieldType type = mergeFields.get(key); JSONObject mergeFieldObj = new JSONObject(); try { mergeFieldObj.put("name", key); mergeFieldObj.put("type", type.toString()); } catch (JSONException e) { throw new HelloSignException(e); } mergeFieldArray.put(mergeFieldObj); } return mergeFieldArray.toString(); }
[ "public", "static", "String", "serializeMergeFields", "(", "Map", "<", "String", ",", "FieldType", ">", "mergeFields", ")", "throws", "HelloSignException", "{", "if", "(", "mergeFields", "==", "null", "||", "mergeFields", ".", "isEmpty", "(", ")", ")", "{", ...
Helper method to convert a Java Map into the JSON string required by the HelloSign API. @param mergeFields Map @return String @throws HelloSignException Thrown if there's a problem parsing JSONObjects
[ "Helper", "method", "to", "convert", "a", "Java", "Map", "into", "the", "JSON", "string", "required", "by", "the", "HelloSign", "API", "." ]
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/resource/TemplateDraft.java#L240-L257
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ClustersNames.java
ClustersNames.getClusterName
public String getClusterName(Configuration conf) { // ResourceManager address in Hadoop2 String clusterIdentifier = conf.get("yarn.resourcemanager.address"); clusterIdentifier = getClusterName(clusterIdentifier); // If job is running outside of Hadoop (Standalone) use hostname // If clusterIdentifier is localhost or 0.0.0.0 use hostname if (clusterIdentifier == null || StringUtils.startsWithIgnoreCase(clusterIdentifier, "localhost") || StringUtils.startsWithIgnoreCase(clusterIdentifier, "0.0.0.0")) { try { clusterIdentifier = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { // Do nothing. Tag will not be generated } } return clusterIdentifier; }
java
public String getClusterName(Configuration conf) { // ResourceManager address in Hadoop2 String clusterIdentifier = conf.get("yarn.resourcemanager.address"); clusterIdentifier = getClusterName(clusterIdentifier); // If job is running outside of Hadoop (Standalone) use hostname // If clusterIdentifier is localhost or 0.0.0.0 use hostname if (clusterIdentifier == null || StringUtils.startsWithIgnoreCase(clusterIdentifier, "localhost") || StringUtils.startsWithIgnoreCase(clusterIdentifier, "0.0.0.0")) { try { clusterIdentifier = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { // Do nothing. Tag will not be generated } } return clusterIdentifier; }
[ "public", "String", "getClusterName", "(", "Configuration", "conf", ")", "{", "// ResourceManager address in Hadoop2", "String", "clusterIdentifier", "=", "conf", ".", "get", "(", "\"yarn.resourcemanager.address\"", ")", ";", "clusterIdentifier", "=", "getClusterName", "(...
Returns the cluster name on which the application is running. Uses Hadoop configuration passed in to get the url of the resourceManager or jobtracker. The URL is then translated into a human readable cluster name using {@link #getClusterName(String)} <p> <b>MapReduce mode</b> Uses the value for "yarn.resourcemanager.address" from {@link Configuration} excluding the port number. </p> <p> <b>Standalone mode (outside of hadoop)</b> Uses the Hostname of {@link InetAddress#getLocalHost()} </p> <p> Use {@link #getClusterName(String)} if you already have the cluster URL </p> @see #getClusterName() @param conf Hadoop configuration to use to get resourceManager or jobTracker URLs
[ "Returns", "the", "cluster", "name", "on", "which", "the", "application", "is", "running", ".", "Uses", "Hadoop", "configuration", "passed", "in", "to", "get", "the", "url", "of", "the", "resourceManager", "or", "jobtracker", ".", "The", "URL", "is", "then",...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ClustersNames.java#L151-L168
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java
RuleBasedCollator.getCollationKey
@Override public CollationKey getCollationKey(String source) { if (source == null) { return null; } CollationBuffer buffer = null; try { buffer = getCollationBuffer(); return getCollationKey(source, buffer); } finally { releaseCollationBuffer(buffer); } }
java
@Override public CollationKey getCollationKey(String source) { if (source == null) { return null; } CollationBuffer buffer = null; try { buffer = getCollationBuffer(); return getCollationKey(source, buffer); } finally { releaseCollationBuffer(buffer); } }
[ "@", "Override", "public", "CollationKey", "getCollationKey", "(", "String", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "CollationBuffer", "buffer", "=", "null", ";", "try", "{", "buffer", "=", "getCollatio...
<p> Get a Collation key for the argument String source from this RuleBasedCollator. <p> General recommendation: <br> If comparison are to be done to the same String multiple times, it would be more efficient to generate CollationKeys for the Strings and use CollationKey.compareTo(CollationKey) for the comparisons. If the each Strings are compared to only once, using the method RuleBasedCollator.compare(String, String) will have a better performance. <p> See the class documentation for an explanation about CollationKeys. @param source the text String to be transformed into a collation key. @return the CollationKey for the given String based on this RuleBasedCollator's collation rules. If the source String is null, a null CollationKey is returned. @see CollationKey @see #compare(String, String) @see #getRawCollationKey
[ "<p", ">", "Get", "a", "Collation", "key", "for", "the", "argument", "String", "source", "from", "this", "RuleBasedCollator", ".", "<p", ">", "General", "recommendation", ":", "<br", ">", "If", "comparison", "are", "to", "be", "done", "to", "the", "same", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L1030-L1042
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java
PropertyBuilder.buildPropertyComments
public void buildPropertyComments(XMLNode node, Content propertyDocTree) { if (!configuration.nocomment) { writer.addComments((MethodDoc) properties.get(currentPropertyIndex), propertyDocTree); } }
java
public void buildPropertyComments(XMLNode node, Content propertyDocTree) { if (!configuration.nocomment) { writer.addComments((MethodDoc) properties.get(currentPropertyIndex), propertyDocTree); } }
[ "public", "void", "buildPropertyComments", "(", "XMLNode", "node", ",", "Content", "propertyDocTree", ")", "{", "if", "(", "!", "configuration", ".", "nocomment", ")", "{", "writer", ".", "addComments", "(", "(", "MethodDoc", ")", "properties", ".", "get", "...
Build the comments for the property. Do nothing if {@link Configuration#nocomment} is set to true. @param node the XML element that specifies which components to document @param propertyDocTree the content tree to which the documentation will be added
[ "Build", "the", "comments", "for", "the", "property", ".", "Do", "nothing", "if", "{", "@link", "Configuration#nocomment", "}", "is", "set", "to", "true", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java#L205-L209
zxing/zxing
android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
IntentIntegrator.parseActivityResult
public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == REQUEST_CODE) { if (resultCode == Activity.RESULT_OK) { String contents = intent.getStringExtra("SCAN_RESULT"); String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT"); byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES"); int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE); Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation; String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL"); return new IntentResult(contents, formatName, rawBytes, orientation, errorCorrectionLevel); } return new IntentResult(); } return null; }
java
public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == REQUEST_CODE) { if (resultCode == Activity.RESULT_OK) { String contents = intent.getStringExtra("SCAN_RESULT"); String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT"); byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES"); int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE); Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation; String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL"); return new IntentResult(contents, formatName, rawBytes, orientation, errorCorrectionLevel); } return new IntentResult(); } return null; }
[ "public", "static", "IntentResult", "parseActivityResult", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "intent", ")", "{", "if", "(", "requestCode", "==", "REQUEST_CODE", ")", "{", "if", "(", "resultCode", "==", "Activity", ".", "RESULT...
<p>Call this from your {@link Activity}'s {@link Activity#onActivityResult(int, int, Intent)} method.</p> @param requestCode request code from {@code onActivityResult()} @param resultCode result code from {@code onActivityResult()} @param intent {@link Intent} from {@code onActivityResult()} @return null if the event handled here was not related to this class, or else an {@link IntentResult} containing the result of the scan. If the user cancelled scanning, the fields will be null.
[ "<p", ">", "Call", "this", "from", "your", "{", "@link", "Activity", "}", "s", "{", "@link", "Activity#onActivityResult", "(", "int", "int", "Intent", ")", "}", "method", ".", "<", "/", "p", ">" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L419-L437
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_lines_serviceName_hardware_POST
public OvhOrder telephony_lines_serviceName_hardware_POST(String serviceName, String hardware, String mondialRelayId, Boolean retractation, String shippingContactId) throws IOException { String qPath = "/order/telephony/lines/{serviceName}/hardware"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "hardware", hardware); addBody(o, "mondialRelayId", mondialRelayId); addBody(o, "retractation", retractation); addBody(o, "shippingContactId", shippingContactId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_lines_serviceName_hardware_POST(String serviceName, String hardware, String mondialRelayId, Boolean retractation, String shippingContactId) throws IOException { String qPath = "/order/telephony/lines/{serviceName}/hardware"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "hardware", hardware); addBody(o, "mondialRelayId", mondialRelayId); addBody(o, "retractation", retractation); addBody(o, "shippingContactId", shippingContactId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_lines_serviceName_hardware_POST", "(", "String", "serviceName", ",", "String", "hardware", ",", "String", "mondialRelayId", ",", "Boolean", "retractation", ",", "String", "shippingContactId", ")", "throws", "IOException", "{", "String", ...
Create order REST: POST /order/telephony/lines/{serviceName}/hardware @param hardware [required] The hardware you want to order for this specific line @param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry. @param shippingContactId [required] Shipping contact information id from /me entry point @param retractation [required] Retractation rights if set @param serviceName [required] Your line number
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6924-L6934
hdbeukel/james-extensions
src/main/java/org/jamesframework/ext/analysis/SearchRunResults.java
SearchRunResults.updateBestSolution
public void updateBestSolution(long time, double value, SolutionType newBestSolution){ times.add(time); values.add(value); bestSolution = newBestSolution; }
java
public void updateBestSolution(long time, double value, SolutionType newBestSolution){ times.add(time); values.add(value); bestSolution = newBestSolution; }
[ "public", "void", "updateBestSolution", "(", "long", "time", ",", "double", "value", ",", "SolutionType", "newBestSolution", ")", "{", "times", ".", "add", "(", "time", ")", ";", "values", ".", "add", "(", "value", ")", ";", "bestSolution", "=", "newBestSo...
Update the best found solution. The update time and newly obtained value are added to the list of updates and the final best solution is overwritten. @param time time at which the solution was found (milliseconds) @param value value of the solution @param newBestSolution newly found best solution
[ "Update", "the", "best", "found", "solution", ".", "The", "update", "time", "and", "newly", "obtained", "value", "are", "added", "to", "the", "list", "of", "updates", "and", "the", "final", "best", "solution", "is", "overwritten", "." ]
train
https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/SearchRunResults.java#L75-L79
Azure/azure-sdk-for-java
dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/RecordSetsInner.java
RecordSetsInner.updateAsync
public Observable<RecordSetInner> updateAsync(String resourceGroupName, String zoneName, String relativeRecordSetName, RecordType recordType, RecordSetInner parameters, String ifMatch) { return updateWithServiceResponseAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch).map(new Func1<ServiceResponse<RecordSetInner>, RecordSetInner>() { @Override public RecordSetInner call(ServiceResponse<RecordSetInner> response) { return response.body(); } }); }
java
public Observable<RecordSetInner> updateAsync(String resourceGroupName, String zoneName, String relativeRecordSetName, RecordType recordType, RecordSetInner parameters, String ifMatch) { return updateWithServiceResponseAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch).map(new Func1<ServiceResponse<RecordSetInner>, RecordSetInner>() { @Override public RecordSetInner call(ServiceResponse<RecordSetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RecordSetInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "zoneName", ",", "String", "relativeRecordSetName", ",", "RecordType", "recordType", ",", "RecordSetInner", "parameters", ",", "String", "ifMatch", ")...
Updates a record set within a DNS zone. @param resourceGroupName The name of the resource group. @param zoneName The name of the DNS zone (without a terminating dot). @param relativeRecordSetName The name of the record set, relative to the name of the zone. @param recordType The type of DNS record in this record set. Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' @param parameters Parameters supplied to the Update operation. @param ifMatch The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwritting concurrent changes. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RecordSetInner object
[ "Updates", "a", "record", "set", "within", "a", "DNS", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/RecordSetsInner.java#L249-L256
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/linker/AppCacheLinker.java
AppCacheLinker.emitLandingPageCacheManifest
@SuppressWarnings( "rawtypes" ) private Artifact<?> emitLandingPageCacheManifest( LinkerContext context, TreeLogger logger, ArtifactSet artifacts ) throws UnableToCompleteException { StringBuilder publicSourcesSb = new StringBuilder(); StringBuilder staticResoucesSb = new StringBuilder(); if( artifacts != null ) { // Iterate over all emitted artifacts, and collect all cacheable // artifacts for( Artifact artifact : artifacts ) { if( artifact instanceof EmittedArtifact ) { EmittedArtifact ea = (EmittedArtifact) artifact; String pathName = ea.getPartialPath(); if( pathName.endsWith( "symbolMap" ) || pathName.endsWith( ".xml.gz" ) || pathName.endsWith( "rpc.log" ) || pathName.endsWith( "gwt.rpc" ) || pathName.endsWith( "manifest.txt" ) || pathName.startsWith( "rpcPolicyManifest" ) || pathName.startsWith( "soycReport" ) || pathName.endsWith( ".cssmap" ) ) { continue;// skip these resources } else { publicSourcesSb.append( context.getModuleName() ).append( "/" ).append( pathName.replace( "\\", "/" ) ).append( "\n" ); } } } String[] cacheExtraFiles = getCacheExtraFiles( logger, context ); for( int i = 0; i < cacheExtraFiles.length; i++ ) { staticResoucesSb.append( cacheExtraFiles[i] ); staticResoucesSb.append( "\n" ); } } // build cache list StringBuilder sb = new StringBuilder(); sb.append( "CACHE MANIFEST\n" ); sb.append( "# " + UUID.randomUUID() + "-" + System.currentTimeMillis() + "\n" ); // we have to generate this unique id because the resources can change // but // the hashed cache.html files can remain the same. sb.append( "# Note: must change this every time for cache to invalidate\n" ); sb.append( "\n" ); sb.append( "CACHE:\n" ); sb.append( "# Static app files\n" ); sb.append( staticResoucesSb ); sb.append( "\n# Generated app files\n" ); sb.append( publicSourcesSb ); sb.append( "\n\n" ); sb.append( "# All other resources require the user to be online.\n" ); sb.append( "NETWORK:\n" ); sb.append( "*\n" ); sb.append( "http://*\n" ); sb.append( "\n\n" ); sb.append( "# Available values: fast, prefer-online\n" ); sb.append( "SETTINGS:\n" ); sb.append( "fast\n" ); logger.log( TreeLogger.DEBUG, "Be sure your landing page's <html> tag declares a manifest: <html manifest=" + MANIFEST + "\">" ); // Create the manifest as a new artifact and return it: return emitString( logger, sb.toString(), "../" + MANIFEST ); }
java
@SuppressWarnings( "rawtypes" ) private Artifact<?> emitLandingPageCacheManifest( LinkerContext context, TreeLogger logger, ArtifactSet artifacts ) throws UnableToCompleteException { StringBuilder publicSourcesSb = new StringBuilder(); StringBuilder staticResoucesSb = new StringBuilder(); if( artifacts != null ) { // Iterate over all emitted artifacts, and collect all cacheable // artifacts for( Artifact artifact : artifacts ) { if( artifact instanceof EmittedArtifact ) { EmittedArtifact ea = (EmittedArtifact) artifact; String pathName = ea.getPartialPath(); if( pathName.endsWith( "symbolMap" ) || pathName.endsWith( ".xml.gz" ) || pathName.endsWith( "rpc.log" ) || pathName.endsWith( "gwt.rpc" ) || pathName.endsWith( "manifest.txt" ) || pathName.startsWith( "rpcPolicyManifest" ) || pathName.startsWith( "soycReport" ) || pathName.endsWith( ".cssmap" ) ) { continue;// skip these resources } else { publicSourcesSb.append( context.getModuleName() ).append( "/" ).append( pathName.replace( "\\", "/" ) ).append( "\n" ); } } } String[] cacheExtraFiles = getCacheExtraFiles( logger, context ); for( int i = 0; i < cacheExtraFiles.length; i++ ) { staticResoucesSb.append( cacheExtraFiles[i] ); staticResoucesSb.append( "\n" ); } } // build cache list StringBuilder sb = new StringBuilder(); sb.append( "CACHE MANIFEST\n" ); sb.append( "# " + UUID.randomUUID() + "-" + System.currentTimeMillis() + "\n" ); // we have to generate this unique id because the resources can change // but // the hashed cache.html files can remain the same. sb.append( "# Note: must change this every time for cache to invalidate\n" ); sb.append( "\n" ); sb.append( "CACHE:\n" ); sb.append( "# Static app files\n" ); sb.append( staticResoucesSb ); sb.append( "\n# Generated app files\n" ); sb.append( publicSourcesSb ); sb.append( "\n\n" ); sb.append( "# All other resources require the user to be online.\n" ); sb.append( "NETWORK:\n" ); sb.append( "*\n" ); sb.append( "http://*\n" ); sb.append( "\n\n" ); sb.append( "# Available values: fast, prefer-online\n" ); sb.append( "SETTINGS:\n" ); sb.append( "fast\n" ); logger.log( TreeLogger.DEBUG, "Be sure your landing page's <html> tag declares a manifest: <html manifest=" + MANIFEST + "\">" ); // Create the manifest as a new artifact and return it: return emitString( logger, sb.toString(), "../" + MANIFEST ); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "Artifact", "<", "?", ">", "emitLandingPageCacheManifest", "(", "LinkerContext", "context", ",", "TreeLogger", "logger", ",", "ArtifactSet", "artifacts", ")", "throws", "UnableToCompleteException", "{", "St...
Creates the cache-manifest resource specific for the landing page. @param context the linker environment @param logger the tree logger to record to @param artifacts {@code null} to generate an empty cache manifest
[ "Creates", "the", "cache", "-", "manifest", "resource", "specific", "for", "the", "landing", "page", "." ]
train
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/linker/AppCacheLinker.java#L106-L169
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/Diff.java
Diff.skippedComparison
public void skippedComparison(Node control, Node test) { if (differenceListenerDelegate != null) { differenceListenerDelegate.skippedComparison(control, test); } else { System.err.println("DifferenceListener.skippedComparison: " + "unhandled control node type=" + control + ", unhandled test node type=" + test); } }
java
public void skippedComparison(Node control, Node test) { if (differenceListenerDelegate != null) { differenceListenerDelegate.skippedComparison(control, test); } else { System.err.println("DifferenceListener.skippedComparison: " + "unhandled control node type=" + control + ", unhandled test node type=" + test); } }
[ "public", "void", "skippedComparison", "(", "Node", "control", ",", "Node", "test", ")", "{", "if", "(", "differenceListenerDelegate", "!=", "null", ")", "{", "differenceListenerDelegate", ".", "skippedComparison", "(", "control", ",", "test", ")", ";", "}", "...
DifferenceListener implementation. If the {@link Diff#overrideDifferenceListener overrideDifferenceListener} method has been called then the call will be delegated otherwise a message is printed to <code>System.err</code>. @param control @param test
[ "DifferenceListener", "implementation", ".", "If", "the", "{" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/Diff.java#L334-L342
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/CreateOptions.java
CreateOptions.writeOptions
public static WriteOptions writeOptions(Boolean overwrite, Boolean forceSync){ WriteOptions wo = new WriteOptions(); if (overwrite != null) wo.setOverwrite(overwrite); if (forceSync != null) wo.setForcesync(forceSync); return wo; }
java
public static WriteOptions writeOptions(Boolean overwrite, Boolean forceSync){ WriteOptions wo = new WriteOptions(); if (overwrite != null) wo.setOverwrite(overwrite); if (forceSync != null) wo.setForcesync(forceSync); return wo; }
[ "public", "static", "WriteOptions", "writeOptions", "(", "Boolean", "overwrite", ",", "Boolean", "forceSync", ")", "{", "WriteOptions", "wo", "=", "new", "WriteOptions", "(", ")", ";", "if", "(", "overwrite", "!=", "null", ")", "wo", ".", "setOverwrite", "("...
Creates a WriteOptions from given overwrite and forceSync values. If null passed, it will use their default value.
[ "Creates", "a", "WriteOptions", "from", "given", "overwrite", "and", "forceSync", "values", ".", "If", "null", "passed", "it", "will", "use", "their", "default", "value", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/CreateOptions.java#L39-L46
TakahikoKawasaki/nv-cipher
src/main/java/com/neovisionaries/security/AESCipher.java
AESCipher.setKey
public AESCipher setKey(SecretKey key, IvParameterSpec iv) { return (AESCipher)setInit(key, iv); }
java
public AESCipher setKey(SecretKey key, IvParameterSpec iv) { return (AESCipher)setInit(key, iv); }
[ "public", "AESCipher", "setKey", "(", "SecretKey", "key", ",", "IvParameterSpec", "iv", ")", "{", "return", "(", "AESCipher", ")", "setInit", "(", "key", ",", "iv", ")", ";", "}" ]
Set cipher initialization parameters. <p> This method is an alias of {@link #setInit(java.security.Key, java.security.spec.AlgorithmParameterSpec) setInit(key, iv)}. </p> @param key Secret key. @param iv Initial vector. @return {@code this} object. @throws IllegalArgumentException {@code key} is {@code null}.
[ "Set", "cipher", "initialization", "parameters", "." ]
train
https://github.com/TakahikoKawasaki/nv-cipher/blob/d01aa4f53611e2724ae03633060f55bacf549175/src/main/java/com/neovisionaries/security/AESCipher.java#L228-L231
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/ui/jedit/LineNumberPanel.java
LineNumberPanel.updateSize
private void updateSize() { int newLineCount = ActionUtils.getLineCount(pane); if (newLineCount == lineCount) { return; } lineCount = newLineCount; int h = (int) pane.getPreferredSize().getHeight(); int d = (int) Math.log10(lineCount) + 1; if (d < 1) { d = 1; } int w = d * charWidth + r_margin + l_margin; format = "%" + d + "d"; setPreferredSize(new Dimension(w, h)); getParent().doLayout(); }
java
private void updateSize() { int newLineCount = ActionUtils.getLineCount(pane); if (newLineCount == lineCount) { return; } lineCount = newLineCount; int h = (int) pane.getPreferredSize().getHeight(); int d = (int) Math.log10(lineCount) + 1; if (d < 1) { d = 1; } int w = d * charWidth + r_margin + l_margin; format = "%" + d + "d"; setPreferredSize(new Dimension(w, h)); getParent().doLayout(); }
[ "private", "void", "updateSize", "(", ")", "{", "int", "newLineCount", "=", "ActionUtils", ".", "getLineCount", "(", "pane", ")", ";", "if", "(", "newLineCount", "==", "lineCount", ")", "{", "return", ";", "}", "lineCount", "=", "newLineCount", ";", "int",...
Update the size of the line numbers based on the length of the document
[ "Update", "the", "size", "of", "the", "line", "numbers", "based", "on", "the", "length", "of", "the", "document" ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/ui/jedit/LineNumberPanel.java#L146-L161
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java
GeoBounds.setRect
private void setRect(double minLat, double minLng, double maxLat, double maxLng) { if (!(minLat < maxLat)) { throw new IllegalArgumentException("GeoBounds is not valid - minLat must be less that maxLat."); } if (!(minLng < maxLng)) { if (minLng > 0 && minLng < 180 && maxLng < 0) { rects = new Rectangle2D[] { // split into two rects e.g. 176.8793 to 180 and -180 to // -175.0104 new Rectangle2D.Double(minLng, minLat, 180 - minLng, maxLat - minLat), new Rectangle2D.Double(-180, minLat, maxLng + 180, maxLat - minLat) }; } else { rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; throw new IllegalArgumentException("GeoBounds is not valid - minLng must be less that maxLng or " + "minLng must be greater than 0 and maxLng must be less than 0."); } } else { rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; } }
java
private void setRect(double minLat, double minLng, double maxLat, double maxLng) { if (!(minLat < maxLat)) { throw new IllegalArgumentException("GeoBounds is not valid - minLat must be less that maxLat."); } if (!(minLng < maxLng)) { if (minLng > 0 && minLng < 180 && maxLng < 0) { rects = new Rectangle2D[] { // split into two rects e.g. 176.8793 to 180 and -180 to // -175.0104 new Rectangle2D.Double(minLng, minLat, 180 - minLng, maxLat - minLat), new Rectangle2D.Double(-180, minLat, maxLng + 180, maxLat - minLat) }; } else { rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; throw new IllegalArgumentException("GeoBounds is not valid - minLng must be less that maxLng or " + "minLng must be greater than 0 and maxLng must be less than 0."); } } else { rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; } }
[ "private", "void", "setRect", "(", "double", "minLat", ",", "double", "minLng", ",", "double", "maxLat", ",", "double", "maxLng", ")", "{", "if", "(", "!", "(", "minLat", "<", "maxLat", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"G...
Sets the internal rectangle representation. @param minLat The minimum latitude. @param minLng The minimum longitude. @param maxLat The maximum latitude. @param maxLng The maximum longitude.
[ "Sets", "the", "internal", "rectangle", "representation", "." ]
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java#L62-L90
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java
GarbageCollector.onBeanCreated
public synchronized void onBeanCreated(Object bean, boolean rootBean) { if (!configuration.isUseGc()) { return; } Assert.requireNonNull(bean, "bean"); if (allInstances.containsKey(bean)) { throw new IllegalArgumentException("Bean instance is already managed!"); } IdentitySet<Property> properties = getAllProperties(bean); IdentitySet<ObservableList> lists = getAllLists(bean); Instance instance = new Instance(bean, rootBean, properties, lists); allInstances.put(bean, instance); for (Property property : properties) { propertyToParent.put(property, instance); } for (ObservableList list : lists) { listToParent.put(list, instance); } if (!rootBean) { //Until the bean isn't referenced in another bean it will be removed at gc addToGC(instance, bean); } }
java
public synchronized void onBeanCreated(Object bean, boolean rootBean) { if (!configuration.isUseGc()) { return; } Assert.requireNonNull(bean, "bean"); if (allInstances.containsKey(bean)) { throw new IllegalArgumentException("Bean instance is already managed!"); } IdentitySet<Property> properties = getAllProperties(bean); IdentitySet<ObservableList> lists = getAllLists(bean); Instance instance = new Instance(bean, rootBean, properties, lists); allInstances.put(bean, instance); for (Property property : properties) { propertyToParent.put(property, instance); } for (ObservableList list : lists) { listToParent.put(list, instance); } if (!rootBean) { //Until the bean isn't referenced in another bean it will be removed at gc addToGC(instance, bean); } }
[ "public", "synchronized", "void", "onBeanCreated", "(", "Object", "bean", ",", "boolean", "rootBean", ")", "{", "if", "(", "!", "configuration", ".", "isUseGc", "(", ")", ")", "{", "return", ";", "}", "Assert", ".", "requireNonNull", "(", "bean", ",", "\...
This method must be called for each new Dolphin bean (see {@link RemotingBean}). Normally beans are created by {@link BeanManager#create(Class)} @param bean the bean that was created @param rootBean if this is true the bean is handled as a root bean. This bean don't need a reference.
[ "This", "method", "must", "be", "called", "for", "each", "new", "Dolphin", "bean", "(", "see", "{", "@link", "RemotingBean", "}", ")", ".", "Normally", "beans", "are", "created", "by", "{", "@link", "BeanManager#create", "(", "Class", ")", "}" ]
train
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java#L88-L112
apache/incubator-atlas
common/src/main/java/org/apache/atlas/utils/ParamChecker.java
ParamChecker.notEmptyIfNotNull
public static String notEmptyIfNotNull(String value, String name) { return notEmptyIfNotNull(value, name, null); }
java
public static String notEmptyIfNotNull(String value, String name) { return notEmptyIfNotNull(value, name, null); }
[ "public", "static", "String", "notEmptyIfNotNull", "(", "String", "value", ",", "String", "name", ")", "{", "return", "notEmptyIfNotNull", "(", "value", ",", "name", ",", "null", ")", ";", "}" ]
Check that a string is not empty if its not null. @param value value. @param name parameter name for the exception message. @return the given value.
[ "Check", "that", "a", "string", "is", "not", "empty", "if", "its", "not", "null", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/common/src/main/java/org/apache/atlas/utils/ParamChecker.java#L104-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java
MultiScopeRecoveryLog.associateLog
@Override public void associateLog(DistributedRecoveryLog otherLog, boolean failAssociatedLog) { if (tc.isEntryEnabled()) Tr.entry(tc, "associateLog", new Object[] { otherLog, failAssociatedLog, this }); if (otherLog instanceof MultiScopeLog) { _associatedLog = (MultiScopeLog) otherLog; _failAssociatedLog = failAssociatedLog; } if (tc.isEntryEnabled()) Tr.exit(tc, "associateLog"); }
java
@Override public void associateLog(DistributedRecoveryLog otherLog, boolean failAssociatedLog) { if (tc.isEntryEnabled()) Tr.entry(tc, "associateLog", new Object[] { otherLog, failAssociatedLog, this }); if (otherLog instanceof MultiScopeLog) { _associatedLog = (MultiScopeLog) otherLog; _failAssociatedLog = failAssociatedLog; } if (tc.isEntryEnabled()) Tr.exit(tc, "associateLog"); }
[ "@", "Override", "public", "void", "associateLog", "(", "DistributedRecoveryLog", "otherLog", ",", "boolean", "failAssociatedLog", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"associateLog\"", ",", "...
Associates another log with this one. PI45254. The code is protects against infinite recursion since associated logs are only marked as failed if the log isn't already mark as failed. The code does NOT protect against deadlock due to synchronization for logA->logB and logB->logA - this is not an issue since failAssociated is only set to true for tranLog and not partnerLog - this could be fixed for general use by delegating to an 'AssociatedLogGroup' object shared between associated logs.
[ "Associates", "another", "log", "with", "this", "one", ".", "PI45254", ".", "The", "code", "is", "protects", "against", "infinite", "recursion", "since", "associated", "logs", "are", "only", "marked", "as", "failed", "if", "the", "log", "isn", "t", "already"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java#L2564-L2577
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/background/BackgroundModelStationary.java
BackgroundModelStationary.updateBackground
public void updateBackground( T frame , GrayU8 segment ) { updateBackground(frame); segment(frame,segment); }
java
public void updateBackground( T frame , GrayU8 segment ) { updateBackground(frame); segment(frame,segment); }
[ "public", "void", "updateBackground", "(", "T", "frame", ",", "GrayU8", "segment", ")", "{", "updateBackground", "(", "frame", ")", ";", "segment", "(", "frame", ",", "segment", ")", ";", "}" ]
Updates the background and segments it at the same time. In some implementations this can be significantly faster than doing it with separate function calls. Segmentation is performed using the model which it has prior to the update.
[ "Updates", "the", "background", "and", "segments", "it", "at", "the", "same", "time", ".", "In", "some", "implementations", "this", "can", "be", "significantly", "faster", "than", "doing", "it", "with", "separate", "function", "calls", ".", "Segmentation", "is...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/background/BackgroundModelStationary.java#L48-L51
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java
SSOCookieHelperImpl.addJwtCookies
protected boolean addJwtCookies(String cookieByteString, HttpServletRequest req, HttpServletResponse resp) { String baseName = getJwtCookieName(); if (baseName == null) { return false; } if ((!req.isSecure()) && getJwtCookieSecure()) { Tr.warning(tc, "JWT_COOKIE_SECURITY_MISMATCH", new Object[] {}); // CWWKS9127W } String[] chunks = splitString(cookieByteString, 3900); String cookieName = baseName; for (int i = 0; i < chunks.length; i++) { if (i > 98) { String eMsg = "Too many jwt cookies created"; com.ibm.ws.ffdc.FFDCFilter.processException(new Exception(eMsg), this.getClass().getName(), "132"); break; } Cookie ssoCookie = createCookie(req, cookieName, chunks[i], getJwtCookieSecure()); //name resp.addCookie(ssoCookie); cookieName = baseName + (i + 2 < 10 ? "0" : "") + (i + 2); //name02... name99 } return true; }
java
protected boolean addJwtCookies(String cookieByteString, HttpServletRequest req, HttpServletResponse resp) { String baseName = getJwtCookieName(); if (baseName == null) { return false; } if ((!req.isSecure()) && getJwtCookieSecure()) { Tr.warning(tc, "JWT_COOKIE_SECURITY_MISMATCH", new Object[] {}); // CWWKS9127W } String[] chunks = splitString(cookieByteString, 3900); String cookieName = baseName; for (int i = 0; i < chunks.length; i++) { if (i > 98) { String eMsg = "Too many jwt cookies created"; com.ibm.ws.ffdc.FFDCFilter.processException(new Exception(eMsg), this.getClass().getName(), "132"); break; } Cookie ssoCookie = createCookie(req, cookieName, chunks[i], getJwtCookieSecure()); //name resp.addCookie(ssoCookie); cookieName = baseName + (i + 2 < 10 ? "0" : "") + (i + 2); //name02... name99 } return true; }
[ "protected", "boolean", "addJwtCookies", "(", "String", "cookieByteString", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "{", "String", "baseName", "=", "getJwtCookieName", "(", ")", ";", "if", "(", "baseName", "==", "null", ")", "{...
Add the cookie or cookies as needed, depending on size of token. Return true if any cookies were added
[ "Add", "the", "cookie", "or", "cookies", "as", "needed", "depending", "on", "size", "of", "token", ".", "Return", "true", "if", "any", "cookies", "were", "added" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java#L129-L151
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.handleObjectPressed
protected void handleObjectPressed (final SceneObject scobj, int mx, int my) { String action = scobj.info.action; final ObjectActionHandler handler = ObjectActionHandler.lookup(action); // if there's no handler, just fire the action immediately if (handler == null) { fireObjectAction(null, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // if the action's not allowed, pretend like we handled it if (!handler.actionAllowed(action)) { return; } // if there's no menu for this object, fire the action immediately RadialMenu menu = handler.handlePressed(scobj); if (menu == null) { fireObjectAction(handler, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // make the menu surround the clicked object, but with consistent size Rectangle mbounds = getRadialMenuBounds(scobj); _activeMenu = menu; _activeMenu.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e) { if (e instanceof CommandEvent) { fireObjectAction(handler, scobj, e); } else { SceneObjectActionEvent event = new SceneObjectActionEvent( e.getSource(), e.getID(), e.getActionCommand(), e.getModifiers(), scobj); fireObjectAction(handler, scobj, event); } } }); _activeMenu.activate(this, mbounds, scobj); }
java
protected void handleObjectPressed (final SceneObject scobj, int mx, int my) { String action = scobj.info.action; final ObjectActionHandler handler = ObjectActionHandler.lookup(action); // if there's no handler, just fire the action immediately if (handler == null) { fireObjectAction(null, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // if the action's not allowed, pretend like we handled it if (!handler.actionAllowed(action)) { return; } // if there's no menu for this object, fire the action immediately RadialMenu menu = handler.handlePressed(scobj); if (menu == null) { fireObjectAction(handler, scobj, new SceneObjectActionEvent( this, 0, action, 0, scobj)); return; } // make the menu surround the clicked object, but with consistent size Rectangle mbounds = getRadialMenuBounds(scobj); _activeMenu = menu; _activeMenu.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e) { if (e instanceof CommandEvent) { fireObjectAction(handler, scobj, e); } else { SceneObjectActionEvent event = new SceneObjectActionEvent( e.getSource(), e.getID(), e.getActionCommand(), e.getModifiers(), scobj); fireObjectAction(handler, scobj, event); } } }); _activeMenu.activate(this, mbounds, scobj); }
[ "protected", "void", "handleObjectPressed", "(", "final", "SceneObject", "scobj", ",", "int", "mx", ",", "int", "my", ")", "{", "String", "action", "=", "scobj", ".", "info", ".", "action", ";", "final", "ObjectActionHandler", "handler", "=", "ObjectActionHand...
Called when the user presses the mouse button over an object.
[ "Called", "when", "the", "user", "presses", "the", "mouse", "button", "over", "an", "object", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L443-L485
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java
WTable.updateBeanValueForRenderedRows
private void updateBeanValueForRenderedRows() { WTableRowRenderer rowRenderer = (WTableRowRenderer) repeater.getRepeatedComponent(); TableModel model = getTableModel(); int index = 0; List<RowIdWrapper> wrappers = repeater.getBeanList(); int columnCount = getColumnCount(); for (RowIdWrapper wrapper : wrappers) { UIContext rowContext = repeater.getRowContext(wrapper, index++); List<Integer> rowIndex = wrapper.getRowIndex(); Class<? extends WComponent> expandRenderer = model.getRendererClass(rowIndex); if (expandRenderer == null) { // Process Columns for (int col = 0; col < columnCount; col++) { // Check if this cell is editable if (model.isCellEditable(rowIndex, col)) { updateBeanValueForColumnInRow(rowRenderer, rowContext, rowIndex, col, model); } } } else if (model.isCellEditable(rowIndex, -1)) { // Check if this expanded row is editable updateBeanValueForRowRenderer(rowRenderer, rowContext, expandRenderer); } } }
java
private void updateBeanValueForRenderedRows() { WTableRowRenderer rowRenderer = (WTableRowRenderer) repeater.getRepeatedComponent(); TableModel model = getTableModel(); int index = 0; List<RowIdWrapper> wrappers = repeater.getBeanList(); int columnCount = getColumnCount(); for (RowIdWrapper wrapper : wrappers) { UIContext rowContext = repeater.getRowContext(wrapper, index++); List<Integer> rowIndex = wrapper.getRowIndex(); Class<? extends WComponent> expandRenderer = model.getRendererClass(rowIndex); if (expandRenderer == null) { // Process Columns for (int col = 0; col < columnCount; col++) { // Check if this cell is editable if (model.isCellEditable(rowIndex, col)) { updateBeanValueForColumnInRow(rowRenderer, rowContext, rowIndex, col, model); } } } else if (model.isCellEditable(rowIndex, -1)) { // Check if this expanded row is editable updateBeanValueForRowRenderer(rowRenderer, rowContext, expandRenderer); } } }
[ "private", "void", "updateBeanValueForRenderedRows", "(", ")", "{", "WTableRowRenderer", "rowRenderer", "=", "(", "WTableRowRenderer", ")", "repeater", ".", "getRepeatedComponent", "(", ")", ";", "TableModel", "model", "=", "getTableModel", "(", ")", ";", "int", "...
Updates the bean using the table data model's {@link TableModel#setValueAt(Object, List, int)} method. This method only updates the data for the currently set row ids.
[ "Updates", "the", "bean", "using", "the", "table", "data", "model", "s", "{" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java#L400-L429
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java
BytecodeUtils.asList
public static Expression asList(Iterable<? extends Expression> items) { final ImmutableList<Expression> copy = ImmutableList.copyOf(items); if (copy.isEmpty()) { return MethodRef.IMMUTABLE_LIST_OF.get(0).invoke(); } // Note, we cannot necessarily use ImmutableList for anything besides the empty list because // we may need to put a null in it. final Expression construct = ConstructorRef.ARRAY_LIST_SIZE.construct(constant(copy.size())); return new Expression(ARRAY_LIST_TYPE, Feature.NON_NULLABLE) { @Override protected void doGen(CodeBuilder mv) { construct.gen(mv); for (Expression child : copy) { mv.dup(); child.gen(mv); MethodRef.ARRAY_LIST_ADD.invokeUnchecked(mv); mv.pop(); // pop the bool result of arraylist.add } } }; }
java
public static Expression asList(Iterable<? extends Expression> items) { final ImmutableList<Expression> copy = ImmutableList.copyOf(items); if (copy.isEmpty()) { return MethodRef.IMMUTABLE_LIST_OF.get(0).invoke(); } // Note, we cannot necessarily use ImmutableList for anything besides the empty list because // we may need to put a null in it. final Expression construct = ConstructorRef.ARRAY_LIST_SIZE.construct(constant(copy.size())); return new Expression(ARRAY_LIST_TYPE, Feature.NON_NULLABLE) { @Override protected void doGen(CodeBuilder mv) { construct.gen(mv); for (Expression child : copy) { mv.dup(); child.gen(mv); MethodRef.ARRAY_LIST_ADD.invokeUnchecked(mv); mv.pop(); // pop the bool result of arraylist.add } } }; }
[ "public", "static", "Expression", "asList", "(", "Iterable", "<", "?", "extends", "Expression", ">", "items", ")", "{", "final", "ImmutableList", "<", "Expression", ">", "copy", "=", "ImmutableList", ".", "copyOf", "(", "items", ")", ";", "if", "(", "copy"...
Returns an expression that returns a new {@link ArrayList} containing all the given items.
[ "Returns", "an", "expression", "that", "returns", "a", "new", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L794-L814
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java
LdapConnection.searchByOperationalAttribute
public SearchResult searchByOperationalAttribute(String dn, String filter, List<String> inEntityTypes, List<String> propNames, String oprAttribute) throws WIMException { String inEntityType = null; List<String> supportedProps = propNames; if (inEntityTypes != null && inEntityTypes.size() > 0) { inEntityType = inEntityTypes.get(0); supportedProps = iLdapConfigMgr.getSupportedProperties(inEntityType, propNames); } String[] attrIds = iLdapConfigMgr.getAttributeNames(inEntityTypes, supportedProps, false, false); attrIds = Arrays.copyOf(attrIds, attrIds.length + 1); attrIds[attrIds.length - 1] = oprAttribute; NamingEnumeration<SearchResult> neu = null; neu = search(dn, filter, SearchControls.OBJECT_SCOPE, attrIds, iCountLimit, iTimeLimit); if (neu != null) { try { if (neu.hasMore()) { return neu.next(); } } catch (NamingException e) { String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true))); throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e); } } return null; }
java
public SearchResult searchByOperationalAttribute(String dn, String filter, List<String> inEntityTypes, List<String> propNames, String oprAttribute) throws WIMException { String inEntityType = null; List<String> supportedProps = propNames; if (inEntityTypes != null && inEntityTypes.size() > 0) { inEntityType = inEntityTypes.get(0); supportedProps = iLdapConfigMgr.getSupportedProperties(inEntityType, propNames); } String[] attrIds = iLdapConfigMgr.getAttributeNames(inEntityTypes, supportedProps, false, false); attrIds = Arrays.copyOf(attrIds, attrIds.length + 1); attrIds[attrIds.length - 1] = oprAttribute; NamingEnumeration<SearchResult> neu = null; neu = search(dn, filter, SearchControls.OBJECT_SCOPE, attrIds, iCountLimit, iTimeLimit); if (neu != null) { try { if (neu.hasMore()) { return neu.next(); } } catch (NamingException e) { String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true))); throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e); } } return null; }
[ "public", "SearchResult", "searchByOperationalAttribute", "(", "String", "dn", ",", "String", "filter", ",", "List", "<", "String", ">", "inEntityTypes", ",", "List", "<", "String", ">", "propNames", ",", "String", "oprAttribute", ")", "throws", "WIMException", ...
Search using operational attribute specified in the parameter. @param dn The DN to search on @param filter The LDAP filter for the search. @param inEntityTypes The entity types to search for. @param propNames The property names to return. @param oprAttribute The operational attribute. @return The search results or null if there are no results. @throws WIMException If the entity types do not exist or the search failed.
[ "Search", "using", "operational", "attribute", "specified", "in", "the", "parameter", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L2066-L2094
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java
JQMPage.prepareTransparentOpened
private static void prepareTransparentOpened(boolean add, String transparentPageId) { Element p = Document.get().getBody(); if (p != null) { String s = JQM4GWT_DLG_TRANSPARENT_OPENED_PREFIX + transparentPageId; if (add) { p.addClassName(JQM4GWT_DLG_TRANSPARENT_OPENED); p.addClassName(s); } else { p.removeClassName(s); String ss = JQMCommon.getStyleStartsWith(p, JQM4GWT_DLG_TRANSPARENT_OPENED_PREFIX); // checking for "opened dialog chain" case if (Empty.is(ss)) p.removeClassName(JQM4GWT_DLG_TRANSPARENT_OPENED); } } }
java
private static void prepareTransparentOpened(boolean add, String transparentPageId) { Element p = Document.get().getBody(); if (p != null) { String s = JQM4GWT_DLG_TRANSPARENT_OPENED_PREFIX + transparentPageId; if (add) { p.addClassName(JQM4GWT_DLG_TRANSPARENT_OPENED); p.addClassName(s); } else { p.removeClassName(s); String ss = JQMCommon.getStyleStartsWith(p, JQM4GWT_DLG_TRANSPARENT_OPENED_PREFIX); // checking for "opened dialog chain" case if (Empty.is(ss)) p.removeClassName(JQM4GWT_DLG_TRANSPARENT_OPENED); } } }
[ "private", "static", "void", "prepareTransparentOpened", "(", "boolean", "add", ",", "String", "transparentPageId", ")", "{", "Element", "p", "=", "Document", ".", "get", "(", ")", ".", "getBody", "(", ")", ";", "if", "(", "p", "!=", "null", ")", "{", ...
Needed mostly in case of page container surrounded by external panels, so these panels could be synchronously disabled/enabled when "modal" dialog shown by jqm application. <br> from afterShow till beforeHide.
[ "Needed", "mostly", "in", "case", "of", "page", "container", "surrounded", "by", "external", "panels", "so", "these", "panels", "could", "be", "synchronously", "disabled", "/", "enabled", "when", "modal", "dialog", "shown", "by", "jqm", "application", ".", "<b...
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMPage.java#L498-L512
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/impl/xmlConfiguration/CacheConfigurationProviderImpl.java
CacheConfigurationProviderImpl.handleCollection
@SuppressWarnings("unchecked") private boolean handleCollection( final ConfigurationContext ctx, final Class<?> _type, final Object cfg, final ParsedConfiguration _parsedCfg) { String _containerName = _parsedCfg.getContainer(); Method m; try { m = cfg.getClass().getMethod(constructGetterName(_containerName)); } catch (NoSuchMethodException ex) { return false; } if (!Collection.class.isAssignableFrom(m.getReturnType())) { return false; } Collection c; try { c = (Collection) m.invoke(cfg); } catch (Exception ex) { throw new ConfigurationException("Cannot access collection for '" + _containerName + "' " + ex, _parsedCfg); } Object _bean = createBeanAndApplyConfiguration(ctx, _type, _parsedCfg); try { c.add(_bean); } catch (IllegalArgumentException ex) { throw new ConfigurationException("Rejected add '" + _containerName + "': " + ex.getMessage(), _parsedCfg); } return true; }
java
@SuppressWarnings("unchecked") private boolean handleCollection( final ConfigurationContext ctx, final Class<?> _type, final Object cfg, final ParsedConfiguration _parsedCfg) { String _containerName = _parsedCfg.getContainer(); Method m; try { m = cfg.getClass().getMethod(constructGetterName(_containerName)); } catch (NoSuchMethodException ex) { return false; } if (!Collection.class.isAssignableFrom(m.getReturnType())) { return false; } Collection c; try { c = (Collection) m.invoke(cfg); } catch (Exception ex) { throw new ConfigurationException("Cannot access collection for '" + _containerName + "' " + ex, _parsedCfg); } Object _bean = createBeanAndApplyConfiguration(ctx, _type, _parsedCfg); try { c.add(_bean); } catch (IllegalArgumentException ex) { throw new ConfigurationException("Rejected add '" + _containerName + "': " + ex.getMessage(), _parsedCfg); } return true; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "boolean", "handleCollection", "(", "final", "ConfigurationContext", "ctx", ",", "final", "Class", "<", "?", ">", "_type", ",", "final", "Object", "cfg", ",", "final", "ParsedConfiguration", "_parsedCf...
Get appropriate collection e.g. {@link Cache2kConfiguration#getListeners()} create the bean and add it to the collection. @return True, if applied, false if there is no getter for a collection.
[ "Get", "appropriate", "collection", "e", ".", "g", ".", "{", "@link", "Cache2kConfiguration#getListeners", "()", "}", "create", "the", "bean", "and", "add", "it", "to", "the", "collection", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/impl/xmlConfiguration/CacheConfigurationProviderImpl.java#L343-L372
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java
SwaptionDataLattice.getValue
public double getValue(int maturityInMonths, int tenorInMonths, int moneynessBP, QuotingConvention convention, double displacement, AnalyticModel model) { DataKey key = new DataKey(maturityInMonths, tenorInMonths, moneynessBP); return convertToConvention(getValue(key), key, convention, displacement, quotingConvention, this.displacement, model); }
java
public double getValue(int maturityInMonths, int tenorInMonths, int moneynessBP, QuotingConvention convention, double displacement, AnalyticModel model) { DataKey key = new DataKey(maturityInMonths, tenorInMonths, moneynessBP); return convertToConvention(getValue(key), key, convention, displacement, quotingConvention, this.displacement, model); }
[ "public", "double", "getValue", "(", "int", "maturityInMonths", ",", "int", "tenorInMonths", ",", "int", "moneynessBP", ",", "QuotingConvention", "convention", ",", "double", "displacement", ",", "AnalyticModel", "model", ")", "{", "DataKey", "key", "=", "new", ...
Return the value in the given quoting convention. Conversion involving receiver premium assumes zero wide collar. @param maturityInMonths The maturity of the option as offset in months from the reference date. @param tenorInMonths The tenor of the swap as offset in months from the option maturity. @param moneynessBP The moneyness in basis points on the par swap rate, as understood in the original convention. @param convention The desired quoting convention. @param displacement The displacement to be used, if converting to log normal implied volatility. @param model The model for context. @return The value converted to the convention.
[ "Return", "the", "value", "in", "the", "given", "quoting", "convention", ".", "Conversion", "involving", "receiver", "premium", "assumes", "zero", "wide", "collar", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L630-L633
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.zremrangeByScore
@Override public Long zremrangeByScore(final byte[] key, final double min, final double max) { checkIsInMultiOrPipeline(); client.zremrangeByScore(key, min, max); return client.getIntegerReply(); }
java
@Override public Long zremrangeByScore(final byte[] key, final double min, final double max) { checkIsInMultiOrPipeline(); client.zremrangeByScore(key, min, max); return client.getIntegerReply(); }
[ "@", "Override", "public", "Long", "zremrangeByScore", "(", "final", "byte", "[", "]", "key", ",", "final", "double", "min", ",", "final", "double", "max", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "zremrangeByScore", "(", "key", ...
Remove all the elements in the sorted set at key with a score between min and max (including elements with score equal to min or max). <p> <b>Time complexity:</b> <p> O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation @param key @param min @param max @return Integer reply, specifically the number of elements removed.
[ "Remove", "all", "the", "elements", "in", "the", "sorted", "set", "at", "key", "with", "a", "score", "between", "min", "and", "max", "(", "including", "elements", "with", "score", "equal", "to", "min", "or", "max", ")", ".", "<p", ">", "<b", ">", "Ti...
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L2607-L2612
aaberg/sql2o
core/src/main/java/org/sql2o/Sql2o.java
Sql2o.withConnection
public void withConnection(StatementRunnable runnable, Object argument) { Connection connection = null; try{ connection = open(); runnable.run(connection, argument); } catch (Throwable t) { throw new Sql2oException("An error occurred while executing StatementRunnable", t); } finally{ if (connection != null) { connection.close(); } } }
java
public void withConnection(StatementRunnable runnable, Object argument) { Connection connection = null; try{ connection = open(); runnable.run(connection, argument); } catch (Throwable t) { throw new Sql2oException("An error occurred while executing StatementRunnable", t); } finally{ if (connection != null) { connection.close(); } } }
[ "public", "void", "withConnection", "(", "StatementRunnable", "runnable", ",", "Object", "argument", ")", "{", "Connection", "connection", "=", "null", ";", "try", "{", "connection", "=", "open", "(", ")", ";", "runnable", ".", "run", "(", "connection", ",",...
Invokes the run method on the {@link org.sql2o.StatementRunnableWithResult} instance. This method guarantees that the connection is closed properly, when either the run method completes or if an exception occurs. @param runnable @param argument
[ "Invokes", "the", "run", "method", "on", "the", "{" ]
train
https://github.com/aaberg/sql2o/blob/01d3490a6d2440cf60f973d23508ac4ed57a8e20/core/src/main/java/org/sql2o/Sql2o.java#L258-L271
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java
QrCodePositionPatternDetector.createPositionPatternGraph
private void createPositionPatternGraph() { // Add items to NN search nn.setPoints((List)positionPatterns.toList(),false); for (int i = 0; i < positionPatterns.size(); i++) { PositionPatternNode f = positionPatterns.get(i); // The QR code version specifies the number of "modules"/blocks across the marker is // A position pattern is 7 blocks. A version 1 qr code is 21 blocks. Each version past one increments // by 4 blocks. The search is relative to the center of each position pattern, hence the - 7 double maximumQrCodeWidth = f.largestSide*(17+4*maxVersionQR-7.0)/7.0; double searchRadius = 1.2*maximumQrCodeWidth; // search 1/2 the width + some fudge factor searchRadius*=searchRadius; // Connect all the finder patterns which are near by each other together in a graph search.findNearest(f,searchRadius,Integer.MAX_VALUE,searchResults); if( searchResults.size > 1) { for (int j = 0; j < searchResults.size; j++) { NnData<SquareNode> r = searchResults.get(j); if( r.point == f ) continue; // skip over if it's the square that initiated the search considerConnect(f,r.point); } } } }
java
private void createPositionPatternGraph() { // Add items to NN search nn.setPoints((List)positionPatterns.toList(),false); for (int i = 0; i < positionPatterns.size(); i++) { PositionPatternNode f = positionPatterns.get(i); // The QR code version specifies the number of "modules"/blocks across the marker is // A position pattern is 7 blocks. A version 1 qr code is 21 blocks. Each version past one increments // by 4 blocks. The search is relative to the center of each position pattern, hence the - 7 double maximumQrCodeWidth = f.largestSide*(17+4*maxVersionQR-7.0)/7.0; double searchRadius = 1.2*maximumQrCodeWidth; // search 1/2 the width + some fudge factor searchRadius*=searchRadius; // Connect all the finder patterns which are near by each other together in a graph search.findNearest(f,searchRadius,Integer.MAX_VALUE,searchResults); if( searchResults.size > 1) { for (int j = 0; j < searchResults.size; j++) { NnData<SquareNode> r = searchResults.get(j); if( r.point == f ) continue; // skip over if it's the square that initiated the search considerConnect(f,r.point); } } } }
[ "private", "void", "createPositionPatternGraph", "(", ")", "{", "// Add items to NN search", "nn", ".", "setPoints", "(", "(", "List", ")", "positionPatterns", ".", "toList", "(", ")", ",", "false", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "...
Connects together position patterns. For each square, finds all of its neighbors based on center distance. Then considers them for connections
[ "Connects", "together", "position", "patterns", ".", "For", "each", "square", "finds", "all", "of", "its", "neighbors", "based", "on", "center", "distance", ".", "Then", "considers", "them", "for", "connections" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java#L241-L269
Metatavu/edelphi
edelphi-persistence/src/main/java/fi/metatavu/edelphi/dao/resources/GoogleDocumentDAO.java
GoogleDocumentDAO.updateName
public GoogleDocument updateName(GoogleDocument googleDocument, String name, String urlName) { googleDocument.setName(name); googleDocument.setUrlName(urlName); getEntityManager().persist(googleDocument); return googleDocument; }
java
public GoogleDocument updateName(GoogleDocument googleDocument, String name, String urlName) { googleDocument.setName(name); googleDocument.setUrlName(urlName); getEntityManager().persist(googleDocument); return googleDocument; }
[ "public", "GoogleDocument", "updateName", "(", "GoogleDocument", "googleDocument", ",", "String", "name", ",", "String", "urlName", ")", "{", "googleDocument", ".", "setName", "(", "name", ")", ";", "googleDocument", ".", "setUrlName", "(", "urlName", ")", ";", ...
Updates GoogleDocument name. This method does not update lastModifier and lastModified fields and thus should be called only by system operations (e.g. scheduler) @param googleDocument GoogleDocument entity @param name new resource name @param urlName new resource urlName @return Updated GoogleDocument
[ "Updates", "GoogleDocument", "name", ".", "This", "method", "does", "not", "update", "lastModifier", "and", "lastModified", "fields", "and", "thus", "should", "be", "called", "only", "by", "system", "operations", "(", "e", ".", "g", ".", "scheduler", ")" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi-persistence/src/main/java/fi/metatavu/edelphi/dao/resources/GoogleDocumentDAO.java#L72-L77
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableArray.java
MutableArray.insertDate
@NonNull @Override public MutableArray insertDate(int index, Date value) { return insertValue(index, value); }
java
@NonNull @Override public MutableArray insertDate(int index, Date value) { return insertValue(index, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableArray", "insertDate", "(", "int", "index", ",", "Date", "value", ")", "{", "return", "insertValue", "(", "index", ",", "value", ")", ";", "}" ]
Inserts a Date object at the given index. @param index the index. This value must not exceed the bounds of the array. @param value the Date object @return The self object
[ "Inserts", "a", "Date", "object", "at", "the", "given", "index", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L527-L531
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java
BinaryString.keyValue
public BinaryString keyValue(byte split1, byte split2, BinaryString keyName) { ensureMaterialized(); if (keyName == null || keyName.getSizeInBytes() == 0) { return null; } if (inFirstSegment() && keyName.inFirstSegment()) { // position in byte int byteIdx = 0; // position of last split1 int lastSplit1Idx = -1; while (byteIdx < sizeInBytes) { // If find next split1 in str, process current kv if (segments[0].get(offset + byteIdx) == split1) { int currentKeyIdx = lastSplit1Idx + 1; // If key of current kv is keyName, return the value directly BinaryString value = findValueOfKey(split2, keyName, currentKeyIdx, byteIdx); if (value != null) { return value; } lastSplit1Idx = byteIdx; } byteIdx++; } // process the string which is not ends with split1 int currentKeyIdx = lastSplit1Idx + 1; return findValueOfKey(split2, keyName, currentKeyIdx, sizeInBytes); } else { return keyValueSlow(split1, split2, keyName); } }
java
public BinaryString keyValue(byte split1, byte split2, BinaryString keyName) { ensureMaterialized(); if (keyName == null || keyName.getSizeInBytes() == 0) { return null; } if (inFirstSegment() && keyName.inFirstSegment()) { // position in byte int byteIdx = 0; // position of last split1 int lastSplit1Idx = -1; while (byteIdx < sizeInBytes) { // If find next split1 in str, process current kv if (segments[0].get(offset + byteIdx) == split1) { int currentKeyIdx = lastSplit1Idx + 1; // If key of current kv is keyName, return the value directly BinaryString value = findValueOfKey(split2, keyName, currentKeyIdx, byteIdx); if (value != null) { return value; } lastSplit1Idx = byteIdx; } byteIdx++; } // process the string which is not ends with split1 int currentKeyIdx = lastSplit1Idx + 1; return findValueOfKey(split2, keyName, currentKeyIdx, sizeInBytes); } else { return keyValueSlow(split1, split2, keyName); } }
[ "public", "BinaryString", "keyValue", "(", "byte", "split1", ",", "byte", "split2", ",", "BinaryString", "keyName", ")", "{", "ensureMaterialized", "(", ")", ";", "if", "(", "keyName", "==", "null", "||", "keyName", ".", "getSizeInBytes", "(", ")", "==", "...
Parse target string as key-value string and return the value matches key name. If accept any null arguments, return null. example: keyvalue('k1=v1;k2=v2', ';', '=', 'k2') = 'v2' keyvalue('k1:v1,k2:v2', ',', ':', 'k3') = NULL @param split1 separator between key-value tuple. @param split2 separator between key and value. @param keyName name of the key whose value you want return. @return target value.
[ "Parse", "target", "string", "as", "key", "-", "value", "string", "and", "return", "the", "value", "matches", "key", "name", ".", "If", "accept", "any", "null", "arguments", "return", "null", ".", "example", ":", "keyvalue", "(", "k1", "=", "v1", ";", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L936-L965
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java
Configuration.setIfUnset
public void setIfUnset(String name, String value) { if (get(name) == null) { set(name, value); } }
java
public void setIfUnset(String name, String value) { if (get(name) == null) { set(name, value); } }
[ "public", "void", "setIfUnset", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "get", "(", "name", ")", "==", "null", ")", "{", "set", "(", "name", ",", "value", ")", ";", "}", "}" ]
Sets a property if it is currently unset. @param name the property name @param value the new value
[ "Sets", "a", "property", "if", "it", "is", "currently", "unset", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L437-L441
rnorth/visible-assertions
src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java
VisibleAssertions.assertRoughlyEquals
public static void assertRoughlyEquals(String message, Double expected, Double actual, Double epsilon) { String expectedInQuotes = inQuotesIfNotNull(expected); String actualInQuotes = inQuotesIfNotNull(actual); if (areBothNull(expected, actual)) { pass(message); } else if (Math.abs(actual - expected) < epsilon) { pass(message); } else { fail(message, actualInQuotes + " differs from expected " + expectedInQuotes + " by more than allowed amount (" + epsilon + ")"); } }
java
public static void assertRoughlyEquals(String message, Double expected, Double actual, Double epsilon) { String expectedInQuotes = inQuotesIfNotNull(expected); String actualInQuotes = inQuotesIfNotNull(actual); if (areBothNull(expected, actual)) { pass(message); } else if (Math.abs(actual - expected) < epsilon) { pass(message); } else { fail(message, actualInQuotes + " differs from expected " + expectedInQuotes + " by more than allowed amount (" + epsilon + ")"); } }
[ "public", "static", "void", "assertRoughlyEquals", "(", "String", "message", ",", "Double", "expected", ",", "Double", "actual", ",", "Double", "epsilon", ")", "{", "String", "expectedInQuotes", "=", "inQuotesIfNotNull", "(", "expected", ")", ";", "String", "act...
Assert that an actual value is approximately equal to an expected value - determined by whether the difference between the two values is less than a provided epsilon value. <p> If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown. @param message message to display alongside the assertion outcome @param expected the expected value @param actual the actual value @param epsilon the allowable absolute difference between expected and actual values
[ "Assert", "that", "an", "actual", "value", "is", "approximately", "equal", "to", "an", "expected", "value", "-", "determined", "by", "whether", "the", "difference", "between", "the", "two", "values", "is", "less", "than", "a", "provided", "epsilon", "value", ...
train
https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L212-L224
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/wavelet/UtilWavelet.java
UtilWavelet.borderInverseUpper
public static int borderInverseUpper( WlBorderCoef<?> desc , BorderIndex1D border, int dataLength ) { WlCoef inner = desc.getInnerCoefficients(); int borderSize = borderForwardUpper(inner,dataLength); borderSize += borderSize%2; WlCoef uu = borderSize > 0 ? inner : null; WlCoef ul = uu; WlCoef ll = inner; int indexUL = 1998; if( desc.getUpperLength() > 0 ) { uu = desc.getBorderCoefficients(-2); indexUL = 2000-desc.getUpperLength()*2; ul = desc.getBorderCoefficients(2000-indexUL); } if( desc.getLowerLength() > 0 ) { ll = desc.getBorderCoefficients(0); } border.setLength(2000); borderSize = checkInverseUpper(uu,2000-borderSize,border,borderSize); borderSize = checkInverseUpper(ul,indexUL,border,borderSize); borderSize = checkInverseUpper(ll,0,border,borderSize); return borderSize; }
java
public static int borderInverseUpper( WlBorderCoef<?> desc , BorderIndex1D border, int dataLength ) { WlCoef inner = desc.getInnerCoefficients(); int borderSize = borderForwardUpper(inner,dataLength); borderSize += borderSize%2; WlCoef uu = borderSize > 0 ? inner : null; WlCoef ul = uu; WlCoef ll = inner; int indexUL = 1998; if( desc.getUpperLength() > 0 ) { uu = desc.getBorderCoefficients(-2); indexUL = 2000-desc.getUpperLength()*2; ul = desc.getBorderCoefficients(2000-indexUL); } if( desc.getLowerLength() > 0 ) { ll = desc.getBorderCoefficients(0); } border.setLength(2000); borderSize = checkInverseUpper(uu,2000-borderSize,border,borderSize); borderSize = checkInverseUpper(ul,indexUL,border,borderSize); borderSize = checkInverseUpper(ll,0,border,borderSize); return borderSize; }
[ "public", "static", "int", "borderInverseUpper", "(", "WlBorderCoef", "<", "?", ">", "desc", ",", "BorderIndex1D", "border", ",", "int", "dataLength", ")", "{", "WlCoef", "inner", "=", "desc", ".", "getInnerCoefficients", "(", ")", ";", "int", "borderSize", ...
Returns the upper border (offset from image edge) for an inverse wavelet transform.
[ "Returns", "the", "upper", "border", "(", "offset", "from", "image", "edge", ")", "for", "an", "inverse", "wavelet", "transform", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/wavelet/UtilWavelet.java#L247-L274
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlInterface interf, PyAppendable it, IExtraLanguageGeneratorContext context) { generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(), interf.getName(), true, interf.getExtends(), getTypeBuilder().getDocumentation(interf), true, interf.getMembers(), it, context, null); }
java
protected void _generate(SarlInterface interf, PyAppendable it, IExtraLanguageGeneratorContext context) { generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(), interf.getName(), true, interf.getExtends(), getTypeBuilder().getDocumentation(interf), true, interf.getMembers(), it, context, null); }
[ "protected", "void", "_generate", "(", "SarlInterface", "interf", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "generateTypeDeclaration", "(", "this", ".", "qualifiedNameProvider", ".", "getFullyQualifiedName", "(", "interf", ")...
Generate the given object. @param interf the interface. @param it the target for the generated content. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L898-L905
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/compat/ASpatialDb.java
ASpatialDb.createSpatialIndex
public void createSpatialIndex( String tableName, String geomColumnName ) throws Exception { if (geomColumnName == null) { geomColumnName = "the_geom"; } String realColumnName = getProperColumnNameCase(tableName, geomColumnName); String realTableName = getProperTableNameCase(tableName); String sql = "CREATE SPATIAL INDEX ON " + realTableName + "(" + realColumnName + ");"; execOnConnection(connection -> { try (IHMStatement stmt = connection.createStatement()) { stmt.execute(sql.toString()); } return null; }); }
java
public void createSpatialIndex( String tableName, String geomColumnName ) throws Exception { if (geomColumnName == null) { geomColumnName = "the_geom"; } String realColumnName = getProperColumnNameCase(tableName, geomColumnName); String realTableName = getProperTableNameCase(tableName); String sql = "CREATE SPATIAL INDEX ON " + realTableName + "(" + realColumnName + ");"; execOnConnection(connection -> { try (IHMStatement stmt = connection.createStatement()) { stmt.execute(sql.toString()); } return null; }); }
[ "public", "void", "createSpatialIndex", "(", "String", "tableName", ",", "String", "geomColumnName", ")", "throws", "Exception", "{", "if", "(", "geomColumnName", "==", "null", ")", "{", "geomColumnName", "=", "\"the_geom\"", ";", "}", "String", "realColumnName", ...
Create a spatial index. @param tableName the table name. @param geomColumnName the geometry column name. @throws Exception
[ "Create", "a", "spatial", "index", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/compat/ASpatialDb.java#L165-L180
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java
FileUtilsV2_2.contentEquals
public static boolean contentEquals(File file1, File file2) throws IOException { boolean file1Exists = file1.exists(); if (file1Exists != file2.exists()) { return false; } if (!file1Exists) { // two not existing files are equal return true; } if (file1.isDirectory() || file2.isDirectory()) { // don't want to compare directory contents throw new IOException("Can't compare directories, only files"); } if (file1.length() != file2.length()) { // lengths differ, cannot be equal return false; } if (file1.getCanonicalFile().equals(file2.getCanonicalFile())) { // same file return true; } InputStream input1 = null; InputStream input2 = null; try { input1 = new FileInputStream(file1); input2 = new FileInputStream(file2); return IOUtils.contentEquals(input1, input2); } finally { IOUtils.closeQuietly(input1); IOUtils.closeQuietly(input2); } }
java
public static boolean contentEquals(File file1, File file2) throws IOException { boolean file1Exists = file1.exists(); if (file1Exists != file2.exists()) { return false; } if (!file1Exists) { // two not existing files are equal return true; } if (file1.isDirectory() || file2.isDirectory()) { // don't want to compare directory contents throw new IOException("Can't compare directories, only files"); } if (file1.length() != file2.length()) { // lengths differ, cannot be equal return false; } if (file1.getCanonicalFile().equals(file2.getCanonicalFile())) { // same file return true; } InputStream input1 = null; InputStream input2 = null; try { input1 = new FileInputStream(file1); input2 = new FileInputStream(file2); return IOUtils.contentEquals(input1, input2); } finally { IOUtils.closeQuietly(input1); IOUtils.closeQuietly(input2); } }
[ "public", "static", "boolean", "contentEquals", "(", "File", "file1", ",", "File", "file2", ")", "throws", "IOException", "{", "boolean", "file1Exists", "=", "file1", ".", "exists", "(", ")", ";", "if", "(", "file1Exists", "!=", "file2", ".", "exists", "("...
Compares the contents of two files to determine if they are equal or not. <p> This method checks to see if the two files are different lengths or if they point to the same file, before resorting to byte-by-byte comparison of the contents. <p> Code origin: Avalon @param file1 the first file @param file2 the second file @return true if the content of the files are equal or they both don't exist, false otherwise @throws IOException in case of an I/O error
[ "Compares", "the", "contents", "of", "two", "files", "to", "determine", "if", "they", "are", "equal", "or", "not", ".", "<p", ">", "This", "method", "checks", "to", "see", "if", "the", "two", "files", "are", "different", "lengths", "or", "if", "they", ...
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java#L230-L267
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapreduce/server/jobtracker/TaskTracker.java
TaskTracker.reserveSlots
public void reserveSlots(TaskType taskType, JobInProgress job, int numSlots) { JobID jobId = job.getJobID(); if (taskType == TaskType.MAP) { if (jobForFallowMapSlot != null && !jobForFallowMapSlot.getJobID().equals(jobId)) { throw new RuntimeException(trackerName + " already has " + "slots reserved for " + jobForFallowMapSlot + "; being" + " asked to reserve " + numSlots + " for " + jobId); } jobForFallowMapSlot = job; } else if (taskType == TaskType.REDUCE){ if (jobForFallowReduceSlot != null && !jobForFallowReduceSlot.getJobID().equals(jobId)) { throw new RuntimeException(trackerName + " already has " + "slots reserved for " + jobForFallowReduceSlot + "; being" + " asked to reserve " + numSlots + " for " + jobId); } jobForFallowReduceSlot = job; } job.reserveTaskTracker(this, taskType, numSlots); LOG.info(trackerName + ": Reserved " + numSlots + " " + taskType + " slots for " + jobId); }
java
public void reserveSlots(TaskType taskType, JobInProgress job, int numSlots) { JobID jobId = job.getJobID(); if (taskType == TaskType.MAP) { if (jobForFallowMapSlot != null && !jobForFallowMapSlot.getJobID().equals(jobId)) { throw new RuntimeException(trackerName + " already has " + "slots reserved for " + jobForFallowMapSlot + "; being" + " asked to reserve " + numSlots + " for " + jobId); } jobForFallowMapSlot = job; } else if (taskType == TaskType.REDUCE){ if (jobForFallowReduceSlot != null && !jobForFallowReduceSlot.getJobID().equals(jobId)) { throw new RuntimeException(trackerName + " already has " + "slots reserved for " + jobForFallowReduceSlot + "; being" + " asked to reserve " + numSlots + " for " + jobId); } jobForFallowReduceSlot = job; } job.reserveTaskTracker(this, taskType, numSlots); LOG.info(trackerName + ": Reserved " + numSlots + " " + taskType + " slots for " + jobId); }
[ "public", "void", "reserveSlots", "(", "TaskType", "taskType", ",", "JobInProgress", "job", ",", "int", "numSlots", ")", "{", "JobID", "jobId", "=", "job", ".", "getJobID", "(", ")", ";", "if", "(", "taskType", "==", "TaskType", ".", "MAP", ")", "{", "...
Reserve specified number of slots for a given <code>job</code>. @param taskType {@link TaskType} of the task @param job the job for which slots on this <code>TaskTracker</code> are to be reserved @param numSlots number of slots to be reserved
[ "Reserve", "specified", "number", "of", "slots", "for", "a", "given", "<code", ">", "job<", "/", "code", ">", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/server/jobtracker/TaskTracker.java#L120-L149
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/crypto/TransactionSignature.java
TransactionSignature.decodeFromBitcoin
public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonicalEncoding, boolean requireCanonicalSValue) throws SignatureDecodeException, VerificationException { // Bitcoin encoding is DER signature + sighash byte. if (requireCanonicalEncoding && !isEncodingCanonical(bytes)) throw new VerificationException.NoncanonicalSignature(); ECKey.ECDSASignature sig = ECKey.ECDSASignature.decodeFromDER(bytes); if (requireCanonicalSValue && !sig.isCanonical()) throw new VerificationException("S-value is not canonical."); // In Bitcoin, any value of the final byte is valid, but not necessarily canonical. See javadocs for // isEncodingCanonical to learn more about this. So we must store the exact byte found. return new TransactionSignature(sig.r, sig.s, bytes[bytes.length - 1]); }
java
public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonicalEncoding, boolean requireCanonicalSValue) throws SignatureDecodeException, VerificationException { // Bitcoin encoding is DER signature + sighash byte. if (requireCanonicalEncoding && !isEncodingCanonical(bytes)) throw new VerificationException.NoncanonicalSignature(); ECKey.ECDSASignature sig = ECKey.ECDSASignature.decodeFromDER(bytes); if (requireCanonicalSValue && !sig.isCanonical()) throw new VerificationException("S-value is not canonical."); // In Bitcoin, any value of the final byte is valid, but not necessarily canonical. See javadocs for // isEncodingCanonical to learn more about this. So we must store the exact byte found. return new TransactionSignature(sig.r, sig.s, bytes[bytes.length - 1]); }
[ "public", "static", "TransactionSignature", "decodeFromBitcoin", "(", "byte", "[", "]", "bytes", ",", "boolean", "requireCanonicalEncoding", ",", "boolean", "requireCanonicalSValue", ")", "throws", "SignatureDecodeException", ",", "VerificationException", "{", "// Bitcoin e...
Returns a decoded signature. @param requireCanonicalEncoding if the encoding of the signature must be canonical. @param requireCanonicalSValue if the S-value must be canonical (below half the order of the curve). @throws SignatureDecodeException if the signature is unparseable in some way. @throws VerificationException if the signature is invalid.
[ "Returns", "a", "decoded", "signature", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/TransactionSignature.java#L175-L187
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/SslUtils.java
SslUtils.trustAllHostnameVerifier
@Beta public static HostnameVerifier trustAllHostnameVerifier() { return new HostnameVerifier() { public boolean verify(String arg0, SSLSession arg1) { return true; } }; }
java
@Beta public static HostnameVerifier trustAllHostnameVerifier() { return new HostnameVerifier() { public boolean verify(String arg0, SSLSession arg1) { return true; } }; }
[ "@", "Beta", "public", "static", "HostnameVerifier", "trustAllHostnameVerifier", "(", ")", "{", "return", "new", "HostnameVerifier", "(", ")", "{", "public", "boolean", "verify", "(", "String", "arg0", ",", "SSLSession", "arg1", ")", "{", "return", "true", ";"...
{@link Beta} <br> Returns a verifier that trusts all host names. <p>Be careful! Disabling host name verification is dangerous and should only be done in testing environments.
[ "{", "@link", "Beta", "}", "<br", ">", "Returns", "a", "verifier", "that", "trusts", "all", "host", "names", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/SslUtils.java#L148-L156
canoo/open-dolphin
subprojects/server/src/main/groovy/org/opendolphin/server/adapter/DolphinServlet.java
DolphinServlet.createServerDolphin
protected DefaultServerDolphin createServerDolphin() { ServerModelStore modelStore = createServerModelStore(); ServerConnector connector = createServerConnector(modelStore, createCodec()); return new DefaultServerDolphin(modelStore, connector); }
java
protected DefaultServerDolphin createServerDolphin() { ServerModelStore modelStore = createServerModelStore(); ServerConnector connector = createServerConnector(modelStore, createCodec()); return new DefaultServerDolphin(modelStore, connector); }
[ "protected", "DefaultServerDolphin", "createServerDolphin", "(", ")", "{", "ServerModelStore", "modelStore", "=", "createServerModelStore", "(", ")", ";", "ServerConnector", "connector", "=", "createServerConnector", "(", "modelStore", ",", "createCodec", "(", ")", ")",...
Creates a new instance of {@code DefaultServerDolphin}. Subclasses may override this method to customize how this instance should be created. @return a newly created {@code DefaultServerDolphin}.
[ "Creates", "a", "new", "instance", "of", "{", "@code", "DefaultServerDolphin", "}", ".", "Subclasses", "may", "override", "this", "method", "to", "customize", "how", "this", "instance", "should", "be", "created", "." ]
train
https://github.com/canoo/open-dolphin/blob/50166defc3ef2de473d7a7246c32dc04304d80ef/subprojects/server/src/main/groovy/org/opendolphin/server/adapter/DolphinServlet.java#L140-L144
beders/Resty
src/main/java/us/monoid/web/Resty.java
Resty.addStandardHeaders
protected <T extends AbstractResource> void addStandardHeaders(URLConnection con, T resource) { con.setRequestProperty("User-Agent", userAgent); con.setRequestProperty("Accept", resource.getAcceptedTypes()); }
java
protected <T extends AbstractResource> void addStandardHeaders(URLConnection con, T resource) { con.setRequestProperty("User-Agent", userAgent); con.setRequestProperty("Accept", resource.getAcceptedTypes()); }
[ "protected", "<", "T", "extends", "AbstractResource", ">", "void", "addStandardHeaders", "(", "URLConnection", "con", ",", "T", "resource", ")", "{", "con", ".", "setRequestProperty", "(", "\"User-Agent\"", ",", "userAgent", ")", ";", "con", ".", "setRequestProp...
Add all standard headers (User-Agent, Accept) to the URLConnection.
[ "Add", "all", "standard", "headers", "(", "User", "-", "Agent", "Accept", ")", "to", "the", "URLConnection", "." ]
train
https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L412-L415
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.put
public synchronized boolean put(Object key, byte[] value, int len, long expirationTime) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { if (key == null) return false; //if ( value == null ) return false; // comment this line to allow the value=NULL mapPut(key, value, len, expirationTime, -1, null, null, 0, !ALIAS_ID); return true; }
java
public synchronized boolean put(Object key, byte[] value, int len, long expirationTime) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { if (key == null) return false; //if ( value == null ) return false; // comment this line to allow the value=NULL mapPut(key, value, len, expirationTime, -1, null, null, 0, !ALIAS_ID); return true; }
[ "public", "synchronized", "boolean", "put", "(", "Object", "key", ",", "byte", "[", "]", "value", ",", "int", "len", ",", "long", "expirationTime", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ","...
************************************************************************ Associates the object with the key and stores it. If an object already exists for this key it is replaced and the previous object discard. The object is assumed to have been "manually" serialized by the caller and will be written up to length "len", directly on disk with no further serialization. @param key The key for the object to store. @param value The object to store. @param len The maximum number of bytes from "value" to write to disk. @param expirationTime The expiration time of this object @return true if the object is placed into the hashtable false oherwise. False only occurs if the key is null. @exception FileManagerException The underlying file manager has a problem. @exception ClassNotFoundException Some key in the hash bucket cannot be deserialized while searching to see if the object already exists. The underlying file is likely corrupted. @exception IOException The underlying file has a problem and is likely corrupt. @exception EOFxception We were asked to seek beyond the end of the file. The file is likely corrupt. @exception HashtableOnDiskException The hashtable header is readable but invalid. One or more of the following is true: the magic string is invalid, the header pointers are null, the header pointers do not point to a recognizable hashtable. ***********************************************************************
[ "************************************************************************", "Associates", "the", "object", "with", "the", "key", "and", "stores", "it", ".", "If", "an", "object", "already", "exists", "for", "this", "key", "it", "is", "replaced", "and", "the", "previou...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L841-L854
SteelBridgeLabs/neo4j-gremlin-bolt
src/main/java/com/steelbridgelabs/oss/neo4j/structure/Neo4JGraph.java
Neo4JGraph.createIndex
public void createIndex(String label, String propertyName) { Objects.requireNonNull(label, "label cannot be null"); Objects.requireNonNull(propertyName, "propertyName cannot be null"); // get current session Neo4JSession session = currentSession(); // transaction should be ready for io operations transaction.readWrite(); // execute statement session.executeStatement(new Statement("CREATE INDEX ON :`" + label + "`(" + propertyName + ")")); }
java
public void createIndex(String label, String propertyName) { Objects.requireNonNull(label, "label cannot be null"); Objects.requireNonNull(propertyName, "propertyName cannot be null"); // get current session Neo4JSession session = currentSession(); // transaction should be ready for io operations transaction.readWrite(); // execute statement session.executeStatement(new Statement("CREATE INDEX ON :`" + label + "`(" + propertyName + ")")); }
[ "public", "void", "createIndex", "(", "String", "label", ",", "String", "propertyName", ")", "{", "Objects", ".", "requireNonNull", "(", "label", ",", "\"label cannot be null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "propertyName", ",", "\"propertyName...
Creates an index in the neo4j database. @param label The label associated with the Index. @param propertyName The property name associated with the Index.
[ "Creates", "an", "index", "in", "the", "neo4j", "database", "." ]
train
https://github.com/SteelBridgeLabs/neo4j-gremlin-bolt/blob/df3ab429e0c83affae6cd43d41edd90de80c032e/src/main/java/com/steelbridgelabs/oss/neo4j/structure/Neo4JGraph.java#L358-L367
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/autocomplete/AutocompleteUtil.java
AutocompleteUtil.getCombinedForAddSection
public static String getCombinedForAddSection(final String sectionName, final Autocompleteable component) { if (Util.empty(sectionName)) { throw new IllegalArgumentException("Auto-fill section names must not be empty."); } if (component == null) { return getNamedSection(sectionName); } if (component.isAutocompleteOff()) { throw new SystemException("Auto-fill sections cannot be applied to fields with autocomplete off."); } String currentValue = component.getAutocomplete(); return getCombinedForSection(sectionName, currentValue); }
java
public static String getCombinedForAddSection(final String sectionName, final Autocompleteable component) { if (Util.empty(sectionName)) { throw new IllegalArgumentException("Auto-fill section names must not be empty."); } if (component == null) { return getNamedSection(sectionName); } if (component.isAutocompleteOff()) { throw new SystemException("Auto-fill sections cannot be applied to fields with autocomplete off."); } String currentValue = component.getAutocomplete(); return getCombinedForSection(sectionName, currentValue); }
[ "public", "static", "String", "getCombinedForAddSection", "(", "final", "String", "sectionName", ",", "final", "Autocompleteable", "component", ")", "{", "if", "(", "Util", ".", "empty", "(", "sectionName", ")", ")", "{", "throw", "new", "IllegalArgumentException"...
Helper to reduce typing in implementations of {@link Autocompleteable}. @param sectionName the name of the auto-fill section to add to the component's {@code autocomplete} attribute @param component the component being modified @return a value for the {@code autocomplete} attribute which is pre-pended by the formatted auto-fill section name
[ "Helper", "to", "reduce", "typing", "in", "implementations", "of", "{" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/autocomplete/AutocompleteUtil.java#L171-L184
Chorus-bdd/Chorus
interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/TagExpressionEvaluator.java
TagExpressionEvaluator.checkSimpleExpression
private boolean checkSimpleExpression(String tagExpression, List<String> scenarioTags) { Set<String> expressionTags = extractTagsFromSimpleExpression(tagExpression); for (String expressionTag : expressionTags) { if (expressionTag.startsWith("@")) { if (!scenarioTags.contains(expressionTag)) { //this tag is not listed on the scenario so don't execute return false; } } else if (expressionTag.startsWith("!")) { String expressionTagWithoutNot = expressionTag.substring(1, expressionTag.length()); if (scenarioTags.contains(expressionTagWithoutNot)) { //this is a negated tag and it exists on the scenario so don't execute return false; } } else { throw new IllegalStateException(String.format("'%s' is not a valid tag, no @ or !@ prefix", expressionTag)); } } //there are no reasons left for not executing return true; }
java
private boolean checkSimpleExpression(String tagExpression, List<String> scenarioTags) { Set<String> expressionTags = extractTagsFromSimpleExpression(tagExpression); for (String expressionTag : expressionTags) { if (expressionTag.startsWith("@")) { if (!scenarioTags.contains(expressionTag)) { //this tag is not listed on the scenario so don't execute return false; } } else if (expressionTag.startsWith("!")) { String expressionTagWithoutNot = expressionTag.substring(1, expressionTag.length()); if (scenarioTags.contains(expressionTagWithoutNot)) { //this is a negated tag and it exists on the scenario so don't execute return false; } } else { throw new IllegalStateException(String.format("'%s' is not a valid tag, no @ or !@ prefix", expressionTag)); } } //there are no reasons left for not executing return true; }
[ "private", "boolean", "checkSimpleExpression", "(", "String", "tagExpression", ",", "List", "<", "String", ">", "scenarioTags", ")", "{", "Set", "<", "String", ">", "expressionTags", "=", "extractTagsFromSimpleExpression", "(", "tagExpression", ")", ";", "for", "(...
Checks a simple expression (i.e. one that does not contain the or '|' operator) @param tagExpression a simple tag expression @param scenarioTags tags present on a scenario @return true iff the scenarion should be executed
[ "Checks", "a", "simple", "expression", "(", "i", ".", "e", ".", "one", "that", "does", "not", "contain", "the", "or", "|", "operator", ")" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/TagExpressionEvaluator.java#L72-L94
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java
JobTargetGroupsInner.createOrUpdateAsync
public Observable<JobTargetGroupInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List<JobTarget> members) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).map(new Func1<ServiceResponse<JobTargetGroupInner>, JobTargetGroupInner>() { @Override public JobTargetGroupInner call(ServiceResponse<JobTargetGroupInner> response) { return response.body(); } }); }
java
public Observable<JobTargetGroupInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List<JobTarget> members) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).map(new Func1<ServiceResponse<JobTargetGroupInner>, JobTargetGroupInner>() { @Override public JobTargetGroupInner call(ServiceResponse<JobTargetGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobTargetGroupInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "targetGroupName", ",", "List", "<", "JobTarget", ">", "members", ")", "{",...
Creates or updates a target group. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param jobAgentName The name of the job agent. @param targetGroupName The name of the target group. @param members Members of the target group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobTargetGroupInner object
[ "Creates", "or", "updates", "a", "target", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobTargetGroupsInner.java#L362-L369
abel533/EasyXls
src/main/java/com/github/abel533/easyxls/EasyXls.java
EasyXls.list2Xls
public static boolean list2Xls(List<?> list, String xmlPath, String filePath, String fileName) throws Exception { return XlsUtil.list2Xls(list, xmlPath, filePath, fileName); }
java
public static boolean list2Xls(List<?> list, String xmlPath, String filePath, String fileName) throws Exception { return XlsUtil.list2Xls(list, xmlPath, filePath, fileName); }
[ "public", "static", "boolean", "list2Xls", "(", "List", "<", "?", ">", "list", ",", "String", "xmlPath", ",", "String", "filePath", ",", "String", "fileName", ")", "throws", "Exception", "{", "return", "XlsUtil", ".", "list2Xls", "(", "list", ",", "xmlPath...
导出list对象到excel @param list 导出的list @param xmlPath xml完整路径 @param filePath 保存xls路径 @param fileName 保存xls文件名 @return 处理结果,true成功,false失败 @throws Exception
[ "导出list对象到excel" ]
train
https://github.com/abel533/EasyXls/blob/f73be23745c2180d7c0b8f0a510e72e61cc37d5d/src/main/java/com/github/abel533/easyxls/EasyXls.java#L82-L84
huangp/entityunit
src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java
PreferredValueMakersRegistry.addFieldOrPropertyMaker
public PreferredValueMakersRegistry addFieldOrPropertyMaker(Class ownerType, String propertyName, Maker<?> maker) { Preconditions.checkNotNull(ownerType); Preconditions.checkNotNull(propertyName); makers.put(Matchers.equalTo(String.format(Settable.FULL_NAME_FORMAT, ownerType.getName(), propertyName)), maker); return this; }
java
public PreferredValueMakersRegistry addFieldOrPropertyMaker(Class ownerType, String propertyName, Maker<?> maker) { Preconditions.checkNotNull(ownerType); Preconditions.checkNotNull(propertyName); makers.put(Matchers.equalTo(String.format(Settable.FULL_NAME_FORMAT, ownerType.getName(), propertyName)), maker); return this; }
[ "public", "PreferredValueMakersRegistry", "addFieldOrPropertyMaker", "(", "Class", "ownerType", ",", "String", "propertyName", ",", "Maker", "<", "?", ">", "maker", ")", "{", "Preconditions", ".", "checkNotNull", "(", "ownerType", ")", ";", "Preconditions", ".", "...
Add a field/property maker to a class type. i.e. with: <pre> {@code Class Person { String name } } </pre> You could define a custom maker for name field as (Person.class, "name", myNameMaker) @param ownerType the class that owns the field. @param propertyName field or property name @param maker custom maker @return this
[ "Add", "a", "field", "/", "property", "maker", "to", "a", "class", "type", ".", "i", ".", "e", ".", "with", ":", "<pre", ">", "{", "@code" ]
train
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java#L74-L79
FDMediagroep/hamcrest-jsoup
src/main/java/nl/fd/hamcrest/jsoup/ElementWithAttribute.java
ElementWithAttribute.hasAttribute
@Factory public static Matcher<Element> hasAttribute(final String attributeName, final Matcher<? super String> attributeValueMatcher) { return new ElementWithAttribute(attributeName, attributeValueMatcher); }
java
@Factory public static Matcher<Element> hasAttribute(final String attributeName, final Matcher<? super String> attributeValueMatcher) { return new ElementWithAttribute(attributeName, attributeValueMatcher); }
[ "@", "Factory", "public", "static", "Matcher", "<", "Element", ">", "hasAttribute", "(", "final", "String", "attributeName", ",", "final", "Matcher", "<", "?", "super", "String", ">", "attributeValueMatcher", ")", "{", "return", "new", "ElementWithAttribute", "(...
Creates a {@link org.hamcrest.Matcher} for a JSoup {@link org.jsoup.nodes.Element} with the given {@code expectedValue} for the given {@code attributeName}. @param attributeName The attribute name whose value to check @param attributeValueMatcher A matcher for the attribute value @return a {@link org.hamcrest.Matcher} for a JSoup {@link org.jsoup.nodes.Element} with the given {@code expectedValue} for the given {@code attributeName}
[ "Creates", "a", "{", "@link", "org", ".", "hamcrest", ".", "Matcher", "}", "for", "a", "JSoup", "{", "@link", "org", ".", "jsoup", ".", "nodes", ".", "Element", "}", "with", "the", "given", "{", "@code", "expectedValue", "}", "for", "the", "given", "...
train
https://github.com/FDMediagroep/hamcrest-jsoup/blob/b7152dac6f834e40117fb7cfdd3149a268d95f7b/src/main/java/nl/fd/hamcrest/jsoup/ElementWithAttribute.java#L70-L73
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipAssert.java
SipAssert.responseReceived
public static boolean responseReceived(int statusCode, MessageListener messageListener) { ArrayList<SipResponse> responses = messageListener.getAllReceivedResponses(); for (SipResponse r : responses) { if (statusCode == r.getStatusCode()) { return true; } } return false; }
java
public static boolean responseReceived(int statusCode, MessageListener messageListener) { ArrayList<SipResponse> responses = messageListener.getAllReceivedResponses(); for (SipResponse r : responses) { if (statusCode == r.getStatusCode()) { return true; } } return false; }
[ "public", "static", "boolean", "responseReceived", "(", "int", "statusCode", ",", "MessageListener", "messageListener", ")", "{", "ArrayList", "<", "SipResponse", ">", "responses", "=", "messageListener", ".", "getAllReceivedResponses", "(", ")", ";", "for", "(", ...
Check the given message listener object received a response with the indicated status code. @param statusCode the code we want to find @param messageListener the {@link MessageListener} we want to check @return true if a received response matches the given statusCode
[ "Check", "the", "given", "message", "listener", "object", "received", "a", "response", "with", "the", "indicated", "status", "code", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L303-L313
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java
ConfigUtils.configToProperties
public static Properties configToProperties(Config config, Optional<String> prefix) { Properties properties = new Properties(); if (config != null) { Config resolvedConfig = config.resolve(); for (Map.Entry<String, ConfigValue> entry : resolvedConfig.entrySet()) { if (!prefix.isPresent() || entry.getKey().startsWith(prefix.get())) { String propKey = desanitizeKey(entry.getKey()); properties.setProperty(propKey, resolvedConfig.getString(entry.getKey())); } } } return properties; }
java
public static Properties configToProperties(Config config, Optional<String> prefix) { Properties properties = new Properties(); if (config != null) { Config resolvedConfig = config.resolve(); for (Map.Entry<String, ConfigValue> entry : resolvedConfig.entrySet()) { if (!prefix.isPresent() || entry.getKey().startsWith(prefix.get())) { String propKey = desanitizeKey(entry.getKey()); properties.setProperty(propKey, resolvedConfig.getString(entry.getKey())); } } } return properties; }
[ "public", "static", "Properties", "configToProperties", "(", "Config", "config", ",", "Optional", "<", "String", ">", "prefix", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "if", "(", "config", "!=", "null", ")", "{", "Con...
Convert a given {@link Config} instance to a {@link Properties} instance. @param config the given {@link Config} instance @param prefix an optional prefix; if present, only properties whose name starts with the prefix will be returned. @return a {@link Properties} instance
[ "Convert", "a", "given", "{", "@link", "Config", "}", "instance", "to", "a", "{", "@link", "Properties", "}", "instance", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java#L99-L112
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunActionsInner.java
WorkflowRunActionsInner.getAsync
public Observable<WorkflowRunActionInner> getAsync(String resourceGroupName, String workflowName, String runName, String actionName) { return getWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName).map(new Func1<ServiceResponse<WorkflowRunActionInner>, WorkflowRunActionInner>() { @Override public WorkflowRunActionInner call(ServiceResponse<WorkflowRunActionInner> response) { return response.body(); } }); }
java
public Observable<WorkflowRunActionInner> getAsync(String resourceGroupName, String workflowName, String runName, String actionName) { return getWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName).map(new Func1<ServiceResponse<WorkflowRunActionInner>, WorkflowRunActionInner>() { @Override public WorkflowRunActionInner call(ServiceResponse<WorkflowRunActionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkflowRunActionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "runName", ",", "String", "actionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName",...
Gets a workflow run action. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param runName The workflow run name. @param actionName The workflow action name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowRunActionInner object
[ "Gets", "a", "workflow", "run", "action", "." ]
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/WorkflowRunActionsInner.java#L387-L394
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WConfirmationButtonExample.java
WConfirmationButtonExample.addAjaxExample
private void addAjaxExample() { add(new WHeading(HeadingLevel.H2, "Confirm as ajax trigger")); final String before = "Before"; final String after = "After"; final WText ajaxContent = new WText("Before"); final WPanel target = new WPanel(WPanel.Type.BOX); add(target); target.add(ajaxContent); WButton confirmWithAjax = new WButton("Replace"); confirmWithAjax.setMessage("Are you sure?"); confirmWithAjax.setAction(new Action() { @Override public void execute(final ActionEvent event) { ajaxContent.setText(before.equals(ajaxContent.getText()) ? after : before); } }); add(confirmWithAjax); add(new WAjaxControl(confirmWithAjax, target)); }
java
private void addAjaxExample() { add(new WHeading(HeadingLevel.H2, "Confirm as ajax trigger")); final String before = "Before"; final String after = "After"; final WText ajaxContent = new WText("Before"); final WPanel target = new WPanel(WPanel.Type.BOX); add(target); target.add(ajaxContent); WButton confirmWithAjax = new WButton("Replace"); confirmWithAjax.setMessage("Are you sure?"); confirmWithAjax.setAction(new Action() { @Override public void execute(final ActionEvent event) { ajaxContent.setText(before.equals(ajaxContent.getText()) ? after : before); } }); add(confirmWithAjax); add(new WAjaxControl(confirmWithAjax, target)); }
[ "private", "void", "addAjaxExample", "(", ")", "{", "add", "(", "new", "WHeading", "(", "HeadingLevel", ".", "H2", ",", "\"Confirm as ajax trigger\"", ")", ")", ";", "final", "String", "before", "=", "\"Before\"", ";", "final", "String", "after", "=", "\"Aft...
This is used to reproduce a WComponents bug condition to make sure we do not re-create it once it is fixed. See https://github.com/BorderTech/wcomponents/issues/1266.
[ "This", "is", "used", "to", "reproduce", "a", "WComponents", "bug", "condition", "to", "make", "sure", "we", "do", "not", "re", "-", "create", "it", "once", "it", "is", "fixed", ".", "See", "https", ":", "//", "github", ".", "com", "/", "BorderTech", ...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WConfirmationButtonExample.java#L87-L107
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java
OSMTablesFactory.createRelationMemberTable
public static PreparedStatement createRelationMemberTable(Connection connection, String relationMemberTable) throws SQLException { try (Statement stmt = connection.createStatement()) { StringBuilder sb = new StringBuilder("CREATE TABLE "); sb.append(relationMemberTable); sb.append("(ID_RELATION BIGINT, ID_SUB_RELATION BIGINT, ROLE VARCHAR, RELATION_ORDER INT);"); stmt.execute(sb.toString()); } return connection.prepareStatement("INSERT INTO " + relationMemberTable + " VALUES ( ?,?,?,?);"); }
java
public static PreparedStatement createRelationMemberTable(Connection connection, String relationMemberTable) throws SQLException { try (Statement stmt = connection.createStatement()) { StringBuilder sb = new StringBuilder("CREATE TABLE "); sb.append(relationMemberTable); sb.append("(ID_RELATION BIGINT, ID_SUB_RELATION BIGINT, ROLE VARCHAR, RELATION_ORDER INT);"); stmt.execute(sb.toString()); } return connection.prepareStatement("INSERT INTO " + relationMemberTable + " VALUES ( ?,?,?,?);"); }
[ "public", "static", "PreparedStatement", "createRelationMemberTable", "(", "Connection", "connection", ",", "String", "relationMemberTable", ")", "throws", "SQLException", "{", "try", "(", "Statement", "stmt", "=", "connection", ".", "createStatement", "(", ")", ")", ...
Store all relation members @param connection @param relationMemberTable @return @throws SQLException
[ "Store", "all", "relation", "members" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java#L308-L316
looly/hutool
hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java
DaoTemplate.get
public <T> Entity get(String field, T value) throws SQLException { return this.get(Entity.create(tableName).set(field, value)); }
java
public <T> Entity get(String field, T value) throws SQLException { return this.get(Entity.create(tableName).set(field, value)); }
[ "public", "<", "T", ">", "Entity", "get", "(", "String", "field", ",", "T", "value", ")", "throws", "SQLException", "{", "return", "this", ".", "get", "(", "Entity", ".", "create", "(", "tableName", ")", ".", "set", "(", "field", ",", "value", ")", ...
根据某个字段(最好是唯一字段)查询单个记录<br> 当有多条返回时,只显示查询到的第一条 @param <T> 字段值类型 @param field 字段名 @param value 字段值 @return 记录 @throws SQLException SQL执行异常
[ "根据某个字段(最好是唯一字段)查询单个记录<br", ">", "当有多条返回时,只显示查询到的第一条" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java#L232-L234
tvesalainen/util
util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java
CachedScheduledThreadPool.iterateAtFixedRate
public ScheduledFuture<?> iterateAtFixedRate(long initialDelay, long period, TimeUnit unit, Collection<Runnable> commands) { return iterateAtFixedRate(initialDelay, period, unit, commands.iterator()); }
java
public ScheduledFuture<?> iterateAtFixedRate(long initialDelay, long period, TimeUnit unit, Collection<Runnable> commands) { return iterateAtFixedRate(initialDelay, period, unit, commands.iterator()); }
[ "public", "ScheduledFuture", "<", "?", ">", "iterateAtFixedRate", "(", "long", "initialDelay", ",", "long", "period", ",", "TimeUnit", "unit", ",", "Collection", "<", "Runnable", ">", "commands", ")", "{", "return", "iterateAtFixedRate", "(", "initialDelay", ","...
After initialDelay executes commands using collections iterator until either iterator has no more commands or command throws exception. @param initialDelay @param period @param unit @param commands @return @see java.util.concurrent.ScheduledThreadPoolExecutor#scheduleAtFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
[ "After", "initialDelay", "executes", "commands", "using", "collections", "iterator", "until", "either", "iterator", "has", "no", "more", "commands", "or", "command", "throws", "exception", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java#L206-L209
infinispan/infinispan
server/integration/commons/src/main/java/org/infinispan/server/commons/controller/Operations.java
Operations.createWriteAttributeOperation
public static ModelNode createWriteAttributeOperation(PathAddress address, String name, ModelNode value) { ModelNode operation = createAttributeOperation(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, address, name); operation.get(ModelDescriptionConstants.VALUE).set(value); return operation; }
java
public static ModelNode createWriteAttributeOperation(PathAddress address, String name, ModelNode value) { ModelNode operation = createAttributeOperation(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, address, name); operation.get(ModelDescriptionConstants.VALUE).set(value); return operation; }
[ "public", "static", "ModelNode", "createWriteAttributeOperation", "(", "PathAddress", "address", ",", "String", "name", ",", "ModelNode", "value", ")", "{", "ModelNode", "operation", "=", "createAttributeOperation", "(", "ModelDescriptionConstants", ".", "WRITE_ATTRIBUTE_...
Creates a write-attribute operation using the specified address, namem and value. @param address a resource path @param name an attribute name @param value an attribute value @return a write-attribute operation
[ "Creates", "a", "write", "-", "attribute", "operation", "using", "the", "specified", "address", "namem", "and", "value", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/controller/Operations.java#L117-L121
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java
NodeSet.matchRegexOrEquals
public static boolean matchRegexOrEquals(final String inputSelector, final String item) { //see if inputSelector is wrapped in '/' chars String testregex = inputSelector; if (testregex.length()>=2 && testregex.indexOf('/') == 0 && testregex.lastIndexOf('/') == testregex.length() - 1) { testregex = inputSelector.substring(1, inputSelector.length() - 1); return item.matches(testregex.trim()); } boolean match = false; try { match = item.matches(inputSelector.trim()); } catch (PatternSyntaxException e) { } return match || inputSelector.trim().equals(item); }
java
public static boolean matchRegexOrEquals(final String inputSelector, final String item) { //see if inputSelector is wrapped in '/' chars String testregex = inputSelector; if (testregex.length()>=2 && testregex.indexOf('/') == 0 && testregex.lastIndexOf('/') == testregex.length() - 1) { testregex = inputSelector.substring(1, inputSelector.length() - 1); return item.matches(testregex.trim()); } boolean match = false; try { match = item.matches(inputSelector.trim()); } catch (PatternSyntaxException e) { } return match || inputSelector.trim().equals(item); }
[ "public", "static", "boolean", "matchRegexOrEquals", "(", "final", "String", "inputSelector", ",", "final", "String", "item", ")", "{", "//see if inputSelector is wrapped in '/' chars", "String", "testregex", "=", "inputSelector", ";", "if", "(", "testregex", ".", "le...
Tests whether the selector string matches the item, in three possible ways: first, if the selector looks like: "/.../" then it the outer '/' chars are removed and it is treated as a regular expression *only* and PatternSyntaxExceptions are not caught. Otherwise, it is treated as a regular expression and any PatternSyntaxExceptions are caught. If it does not match or if the pattern is invalid, it is tested for string equality with the input. @param inputSelector test string which may be a regular expression, or explicit regular expression string wrapped in '/' characters @param item item to test @return true if the item matches the selector
[ "Tests", "whether", "the", "selector", "string", "matches", "the", "item", "in", "three", "possible", "ways", ":", "first", "if", "the", "selector", "looks", "like", ":", "/", "...", "/", "then", "it", "the", "outer", "/", "chars", "are", "removed", "and...
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java#L359-L373
OpenHFT/Chronicle-Map
src/main/java/net/openhft/chronicle/hash/impl/stage/hash/ThreadLocalState.java
ThreadLocalState.lockContextLocally
public boolean lockContextLocally(ChronicleHash<?, ?, ?, ?> hash) { // hash().isOpen() check guarantees no starvation of a thread calling chMap.close() and // trying to close this context by closeContext() method below, while the thread owning this // context frequently locks and unlocks it (e. g. in a loop). This is also the only check // for chMap openness during the whole context usage lifecycle. if (hash.isOpen() && MEMORY.compareAndSwapInt(this, CONTEXT_LOCK_OFFSET, CONTEXT_UNLOCKED, CONTEXT_LOCKED_LOCALLY)) { return true; } else { if (contextLock == CONTEXT_LOCKED_LOCALLY) return false; // Don't extract this hash().isOpen() and the one above, because they could return // different results: the first (above) could return true, the second (below) - false. if (contextLock == CONTEXT_CLOSED || !hash.isOpen()) throw new ChronicleHashClosedException(hash); throw new AssertionError("Unknown context lock state: " + contextLock); } }
java
public boolean lockContextLocally(ChronicleHash<?, ?, ?, ?> hash) { // hash().isOpen() check guarantees no starvation of a thread calling chMap.close() and // trying to close this context by closeContext() method below, while the thread owning this // context frequently locks and unlocks it (e. g. in a loop). This is also the only check // for chMap openness during the whole context usage lifecycle. if (hash.isOpen() && MEMORY.compareAndSwapInt(this, CONTEXT_LOCK_OFFSET, CONTEXT_UNLOCKED, CONTEXT_LOCKED_LOCALLY)) { return true; } else { if (contextLock == CONTEXT_LOCKED_LOCALLY) return false; // Don't extract this hash().isOpen() and the one above, because they could return // different results: the first (above) could return true, the second (below) - false. if (contextLock == CONTEXT_CLOSED || !hash.isOpen()) throw new ChronicleHashClosedException(hash); throw new AssertionError("Unknown context lock state: " + contextLock); } }
[ "public", "boolean", "lockContextLocally", "(", "ChronicleHash", "<", "?", ",", "?", ",", "?", ",", "?", ">", "hash", ")", "{", "// hash().isOpen() check guarantees no starvation of a thread calling chMap.close() and", "// trying to close this context by closeContext() method bel...
Returns {@code true} if this is the outer context lock in this thread, {@code false} if this is a nested context.
[ "Returns", "{" ]
train
https://github.com/OpenHFT/Chronicle-Map/blob/0b09733cc96302f96be4394a261699eeb021fe37/src/main/java/net/openhft/chronicle/hash/impl/stage/hash/ThreadLocalState.java#L55-L72
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.isPointNearMarker
public static boolean isPointNearMarker(LatLng point, MarkerOptions shapeMarker, double tolerance) { return isPointNearPoint(point, shapeMarker.getPosition(), tolerance); }
java
public static boolean isPointNearMarker(LatLng point, MarkerOptions shapeMarker, double tolerance) { return isPointNearPoint(point, shapeMarker.getPosition(), tolerance); }
[ "public", "static", "boolean", "isPointNearMarker", "(", "LatLng", "point", ",", "MarkerOptions", "shapeMarker", ",", "double", "tolerance", ")", "{", "return", "isPointNearPoint", "(", "point", ",", "shapeMarker", ".", "getPosition", "(", ")", ",", "tolerance", ...
Is the point near the shape marker @param point point @param shapeMarker shape marker @param tolerance distance tolerance @return true if near
[ "Is", "the", "point", "near", "the", "shape", "marker" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L281-L283
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.getTitle
private String getTitle(String text, FontMetrics fm, int availTextWidth) { return SwingUtilities2.clipStringIfNecessary(rootPane, fm, text, availTextWidth); }
java
private String getTitle(String text, FontMetrics fm, int availTextWidth) { return SwingUtilities2.clipStringIfNecessary(rootPane, fm, text, availTextWidth); }
[ "private", "String", "getTitle", "(", "String", "text", ",", "FontMetrics", "fm", ",", "int", "availTextWidth", ")", "{", "return", "SwingUtilities2", ".", "clipStringIfNecessary", "(", "rootPane", ",", "fm", ",", "text", ",", "availTextWidth", ")", ";", "}" ]
Get the title text, clipped if necessary. @param text the title text. @param fm the font metrics to compute size with. @param availTextWidth the available space to display the title in. @return the text, clipped to fit the available space.
[ "Get", "the", "title", "text", "clipped", "if", "necessary", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L762-L764
EdwardRaff/JSAT
JSAT/src/jsat/linear/solvers/ConjugateGradient.java
ConjugateGradient.solveCGNR
public static Vec solveCGNR(double eps, Matrix A, Vec x, Vec b) { if(A.rows() != b.length()) throw new ArithmeticException("Dimensions do not agree for Matrix A and Vector b"); else if(A.cols() != x.length()) throw new ArithmeticException("Dimensions do not agree for Matrix A and Vector x"); //TODO write a version that does not explicityly form the transpose matrix Matrix At = A.transpose(); Matrix AtA = At.multiply(A); Vec AtB = At.multiply(b); return solve(eps, AtA, x, AtB); }
java
public static Vec solveCGNR(double eps, Matrix A, Vec x, Vec b) { if(A.rows() != b.length()) throw new ArithmeticException("Dimensions do not agree for Matrix A and Vector b"); else if(A.cols() != x.length()) throw new ArithmeticException("Dimensions do not agree for Matrix A and Vector x"); //TODO write a version that does not explicityly form the transpose matrix Matrix At = A.transpose(); Matrix AtA = At.multiply(A); Vec AtB = At.multiply(b); return solve(eps, AtA, x, AtB); }
[ "public", "static", "Vec", "solveCGNR", "(", "double", "eps", ",", "Matrix", "A", ",", "Vec", "x", ",", "Vec", "b", ")", "{", "if", "(", "A", ".", "rows", "(", ")", "!=", "b", ".", "length", "(", ")", ")", "throw", "new", "ArithmeticException", "...
Uses the Conjugate Gradient method to compute the least squares solution to a system of linear equations.<br> Computes the least squares solution to A x = b. Where A is an m x n matrix and b is a vector of length m and x is a vector of length n <br><br> NOTE: Unlike {@link #solve(double, jsat.linear.Matrix, jsat.linear.Vec, jsat.linear.Vec) }, the CGNR method does not need any special properties of the matrix. Because of this, slower convergence or numerical error can occur. @param eps the desired precision for the result @param A any m x n matrix @param x the initial guess for x, can be all zeros. This vector will be altered @param b the target values @return the least squares solution to A x = b
[ "Uses", "the", "Conjugate", "Gradient", "method", "to", "compute", "the", "least", "squares", "solution", "to", "a", "system", "of", "linear", "equations", ".", "<br", ">", "Computes", "the", "least", "squares", "solution", "to", "A", "x", "=", "b", ".", ...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/solvers/ConjugateGradient.java#L167-L180
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java
VariantMetadataManager.addFile
public void addFile(String filename, VCFHeader vcfHeader, String studyId) { // sanity check if (StringUtils.isEmpty(filename)) { logger.error("VCF filename is empty or null: '{}'", filename); return; } if (vcfHeader == null) { logger.error("VCF header is missingDataset not found. Check your study ID: '{}'", studyId); return; } VCFHeaderToVariantFileHeaderConverter headerConverter = new VCFHeaderToVariantFileHeaderConverter(); VariantFileMetadata variantFileMetadata = new VariantFileMetadata(); variantFileMetadata.setId(filename); variantFileMetadata.setSampleIds(vcfHeader.getSampleNamesInOrder()); variantFileMetadata.setHeader(headerConverter.convert(vcfHeader)); addFile(variantFileMetadata, studyId); }
java
public void addFile(String filename, VCFHeader vcfHeader, String studyId) { // sanity check if (StringUtils.isEmpty(filename)) { logger.error("VCF filename is empty or null: '{}'", filename); return; } if (vcfHeader == null) { logger.error("VCF header is missingDataset not found. Check your study ID: '{}'", studyId); return; } VCFHeaderToVariantFileHeaderConverter headerConverter = new VCFHeaderToVariantFileHeaderConverter(); VariantFileMetadata variantFileMetadata = new VariantFileMetadata(); variantFileMetadata.setId(filename); variantFileMetadata.setSampleIds(vcfHeader.getSampleNamesInOrder()); variantFileMetadata.setHeader(headerConverter.convert(vcfHeader)); addFile(variantFileMetadata, studyId); }
[ "public", "void", "addFile", "(", "String", "filename", ",", "VCFHeader", "vcfHeader", ",", "String", "studyId", ")", "{", "// sanity check", "if", "(", "StringUtils", ".", "isEmpty", "(", "filename", ")", ")", "{", "logger", ".", "error", "(", "\"VCF filena...
Add a variant file metadata (from VCF file and header) to a given variant study metadata (from study ID). @param filename VCF filename (as an ID) @param vcfHeader VCF header @param studyId Study ID
[ "Add", "a", "variant", "file", "metadata", "(", "from", "VCF", "file", "and", "header", ")", "to", "a", "given", "variant", "study", "metadata", "(", "from", "study", "ID", ")", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L258-L275
dihedron/dihedron-commons
src/main/java/org/dihedron/patterns/activities/TypedVector.java
TypedVector.insertElementAt
@Override public void insertElementAt(E obj, int index) { int idx = getRealIndex(index); super.insertElementAt(obj, idx); }
java
@Override public void insertElementAt(E obj, int index) { int idx = getRealIndex(index); super.insertElementAt(obj, idx); }
[ "@", "Override", "public", "void", "insertElementAt", "(", "E", "obj", ",", "int", "index", ")", "{", "int", "idx", "=", "getRealIndex", "(", "index", ")", ";", "super", ".", "insertElementAt", "(", "obj", ",", "idx", ")", ";", "}" ]
Inserts the specified object as a component in this vector at the specified index. @param obj the element to insert. @param index the index at which the element should be inserted; it can be a positive number, or a negative number that is smaller than the size of the vector; see {@link #getRealIndex(int)}. @see java.util.Vector#insertElementAt(java.lang.Object, int)
[ "Inserts", "the", "specified", "object", "as", "a", "component", "in", "this", "vector", "at", "the", "specified", "index", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/activities/TypedVector.java#L167-L171
bazaarvoice/curator-extensions
recipes/src/main/java/com/bazaarvoice/curator/recipes/leader/LeaderService.java
LeaderService.listenTo
private Service listenTo(Service delegate) { delegate.addListener(new Listener() { @Override public void starting() { // Do nothing } @Override public void running() { // Do nothing } @Override public void stopping(State from) { // Do nothing } @Override public void terminated(State from) { closeLeaderLatch(); } @Override public void failed(State from, Throwable failure) { closeLeaderLatch(); } }, MoreExecutors.sameThreadExecutor()); return delegate; }
java
private Service listenTo(Service delegate) { delegate.addListener(new Listener() { @Override public void starting() { // Do nothing } @Override public void running() { // Do nothing } @Override public void stopping(State from) { // Do nothing } @Override public void terminated(State from) { closeLeaderLatch(); } @Override public void failed(State from, Throwable failure) { closeLeaderLatch(); } }, MoreExecutors.sameThreadExecutor()); return delegate; }
[ "private", "Service", "listenTo", "(", "Service", "delegate", ")", "{", "delegate", ".", "addListener", "(", "new", "Listener", "(", ")", "{", "@", "Override", "public", "void", "starting", "(", ")", "{", "// Do nothing", "}", "@", "Override", "public", "v...
Release leadership when the service terminates (normally or abnormally).
[ "Release", "leadership", "when", "the", "service", "terminates", "(", "normally", "or", "abnormally", ")", "." ]
train
https://github.com/bazaarvoice/curator-extensions/blob/eb1e1b478f1ae6aed602bb5d5cb481277203004e/recipes/src/main/java/com/bazaarvoice/curator/recipes/leader/LeaderService.java#L294-L322
aoindustries/aoweb-framework
src/main/java/com/aoindustries/website/framework/WebSiteRequest.java
WebSiteRequest.getURL
public String getURL(Class<? extends WebPage> clazz, Object param) throws IOException, SQLException { WebPage page=WebPage.getWebPage(sourcePage.getServletContext(), clazz, param); return getURL(page, param); }
java
public String getURL(Class<? extends WebPage> clazz, Object param) throws IOException, SQLException { WebPage page=WebPage.getWebPage(sourcePage.getServletContext(), clazz, param); return getURL(page, param); }
[ "public", "String", "getURL", "(", "Class", "<", "?", "extends", "WebPage", ">", "clazz", ",", "Object", "param", ")", "throws", "IOException", ",", "SQLException", "{", "WebPage", "page", "=", "WebPage", ".", "getWebPage", "(", "sourcePage", ".", "getServle...
Gets the context-relative URL to a web page. Parameters should already be URL encoded but not yet XML encoded.
[ "Gets", "the", "context", "-", "relative", "URL", "to", "a", "web", "page", ".", "Parameters", "should", "already", "be", "URL", "encoded", "but", "not", "yet", "XML", "encoded", "." ]
train
https://github.com/aoindustries/aoweb-framework/blob/8e58af4f5dd898cd2fdb855ffa810a1ca6973ae0/src/main/java/com/aoindustries/website/framework/WebSiteRequest.java#L448-L451
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/codec/JBIG2Image.java
JBIG2Image.getJbig2Image
public static Image getJbig2Image(RandomAccessFileOrArray ra, int page) { if (page < 1) throw new IllegalArgumentException("The page number must be >= 1."); try { JBIG2SegmentReader sr = new JBIG2SegmentReader(ra); sr.read(); JBIG2SegmentReader.JBIG2Page p = sr.getPage(page); Image img = new ImgJBIG2(p.pageBitmapWidth, p.pageBitmapHeight, p.getData(true), sr.getGlobal(true)); return img; } catch (Exception e) { throw new ExceptionConverter(e); } }
java
public static Image getJbig2Image(RandomAccessFileOrArray ra, int page) { if (page < 1) throw new IllegalArgumentException("The page number must be >= 1."); try { JBIG2SegmentReader sr = new JBIG2SegmentReader(ra); sr.read(); JBIG2SegmentReader.JBIG2Page p = sr.getPage(page); Image img = new ImgJBIG2(p.pageBitmapWidth, p.pageBitmapHeight, p.getData(true), sr.getGlobal(true)); return img; } catch (Exception e) { throw new ExceptionConverter(e); } }
[ "public", "static", "Image", "getJbig2Image", "(", "RandomAccessFileOrArray", "ra", ",", "int", "page", ")", "{", "if", "(", "page", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"The page number must be >= 1.\"", ")", ";", "try", "{", "JBIG2...
returns an Image representing the given page. @param ra the file or array containing the image @param page the page number of the image @return an Image object
[ "returns", "an", "Image", "representing", "the", "given", "page", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/codec/JBIG2Image.java#L87-L100
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_mailingList_name_moderator_email_GET
public OvhModerator domain_mailingList_name_moderator_email_GET(String domain, String name, String email) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}/moderator/{email}"; StringBuilder sb = path(qPath, domain, name, email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhModerator.class); }
java
public OvhModerator domain_mailingList_name_moderator_email_GET(String domain, String name, String email) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}/moderator/{email}"; StringBuilder sb = path(qPath, domain, name, email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhModerator.class); }
[ "public", "OvhModerator", "domain_mailingList_name_moderator_email_GET", "(", "String", "domain", ",", "String", "name", ",", "String", "email", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/mailingList/{name}/moderator/{email}\"", ";", ...
Get this object properties REST: GET /email/domain/{domain}/mailingList/{name}/moderator/{email} @param domain [required] Name of your domain name @param name [required] Name of mailing list @param email [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1447-L1452
undertow-io/undertow
core/src/main/java/io/undertow/util/DateUtils.java
DateUtils.handleIfModifiedSince
public static boolean handleIfModifiedSince(final HttpServerExchange exchange, final Date lastModified) { return handleIfModifiedSince(exchange.getRequestHeaders().getFirst(Headers.IF_MODIFIED_SINCE), lastModified); }
java
public static boolean handleIfModifiedSince(final HttpServerExchange exchange, final Date lastModified) { return handleIfModifiedSince(exchange.getRequestHeaders().getFirst(Headers.IF_MODIFIED_SINCE), lastModified); }
[ "public", "static", "boolean", "handleIfModifiedSince", "(", "final", "HttpServerExchange", "exchange", ",", "final", "Date", "lastModified", ")", "{", "return", "handleIfModifiedSince", "(", "exchange", ".", "getRequestHeaders", "(", ")", ".", "getFirst", "(", "Hea...
Handles the if-modified-since header. returns true if the request should proceed, false otherwise @param exchange the exchange @param lastModified The last modified date @return
[ "Handles", "the", "if", "-", "modified", "-", "since", "header", ".", "returns", "true", "if", "the", "request", "should", "proceed", "false", "otherwise" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/DateUtils.java#L180-L182
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setText
public void setText(int index, String value) { set(selectField(ResourceFieldLists.CUSTOM_TEXT, index), value); }
java
public void setText(int index, String value) { set(selectField(ResourceFieldLists.CUSTOM_TEXT, index), value); }
[ "public", "void", "setText", "(", "int", "index", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "CUSTOM_TEXT", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a text value. @param index text index (1-30) @param value text value
[ "Set", "a", "text", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1470-L1473
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/Log.java
Log.wtf
public static int wtf(String tag, String msg) { collectLogEntry(Constants.ASSERT, tag, msg, null); if (isLoggable(tag, Constants.ASSERT)) { if (useWTF) { try { return (Integer) wtfTagMessageMethod.invoke(null, new Object[] { tag, msg }); } catch (Exception e) { return LogHelper.println(Constants.ASSERT, tag, msg); } } else { return LogHelper.println(Constants.ASSERT, tag, msg); } } return 0; }
java
public static int wtf(String tag, String msg) { collectLogEntry(Constants.ASSERT, tag, msg, null); if (isLoggable(tag, Constants.ASSERT)) { if (useWTF) { try { return (Integer) wtfTagMessageMethod.invoke(null, new Object[] { tag, msg }); } catch (Exception e) { return LogHelper.println(Constants.ASSERT, tag, msg); } } else { return LogHelper.println(Constants.ASSERT, tag, msg); } } return 0; }
[ "public", "static", "int", "wtf", "(", "String", "tag", ",", "String", "msg", ")", "{", "collectLogEntry", "(", "Constants", ".", "ASSERT", ",", "tag", ",", "msg", ",", "null", ")", ";", "if", "(", "isLoggable", "(", "tag", ",", "Constants", ".", "AS...
What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level Constants.ASSERT despite the logging is disabled. Depending on system configuration, and on Android 2.2+, a report may be added to the DropBoxManager and/or the process may be terminated immediately with an error dialog. On older Android version (before 2.2), the message is logged with the Assert level. Those log messages will always be logged. @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. @param msg The message you would like logged.
[ "What", "a", "Terrible", "Failure", ":", "Report", "a", "condition", "that", "should", "never", "happen", ".", "The", "error", "will", "always", "be", "logged", "at", "level", "Constants", ".", "ASSERT", "despite", "the", "logging", "is", "disabled", ".", ...
train
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/Log.java#L976-L991
xerial/snappy-java
src/main/java/org/xerial/snappy/SnappyInputStream.java
SnappyInputStream.rawRead
public int rawRead(Object array, int byteOffset, int byteLength) throws IOException { int writtenBytes = 0; for (; writtenBytes < byteLength; ) { if (uncompressedCursor >= uncompressedLimit) { if (hasNextChunk()) { continue; } else { return writtenBytes == 0 ? -1 : writtenBytes; } } int bytesToWrite = Math.min(uncompressedLimit - uncompressedCursor, byteLength - writtenBytes); Snappy.arrayCopy(uncompressed, uncompressedCursor, bytesToWrite, array, byteOffset + writtenBytes); writtenBytes += bytesToWrite; uncompressedCursor += bytesToWrite; } return writtenBytes; }
java
public int rawRead(Object array, int byteOffset, int byteLength) throws IOException { int writtenBytes = 0; for (; writtenBytes < byteLength; ) { if (uncompressedCursor >= uncompressedLimit) { if (hasNextChunk()) { continue; } else { return writtenBytes == 0 ? -1 : writtenBytes; } } int bytesToWrite = Math.min(uncompressedLimit - uncompressedCursor, byteLength - writtenBytes); Snappy.arrayCopy(uncompressed, uncompressedCursor, bytesToWrite, array, byteOffset + writtenBytes); writtenBytes += bytesToWrite; uncompressedCursor += bytesToWrite; } return writtenBytes; }
[ "public", "int", "rawRead", "(", "Object", "array", ",", "int", "byteOffset", ",", "int", "byteLength", ")", "throws", "IOException", "{", "int", "writtenBytes", "=", "0", ";", "for", "(", ";", "writtenBytes", "<", "byteLength", ";", ")", "{", "if", "(",...
Read uncompressed data into the specified array @param array @param byteOffset @param byteLength @return written bytes @throws IOException
[ "Read", "uncompressed", "data", "into", "the", "specified", "array" ]
train
https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyInputStream.java#L192-L213
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/reader/PrivateKeyReader.java
PrivateKeyReader.readPrivateKey
public static PrivateKey readPrivateKey(final File file) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException { return readPrivateKey(file, KeyPairGeneratorAlgorithm.RSA.getAlgorithm()); }
java
public static PrivateKey readPrivateKey(final File file) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException { return readPrivateKey(file, KeyPairGeneratorAlgorithm.RSA.getAlgorithm()); }
[ "public", "static", "PrivateKey", "readPrivateKey", "(", "final", "File", "file", ")", "throws", "IOException", ",", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", ",", "NoSuchProviderException", "{", "return", "readPrivateKey", "(", "file", ",", "KeyPairGe...
Reads the given {@link File}( in *.der format) with the default RSA algorithm and returns the {@link PrivateKey} object. @param file the file( in *.der format) that contains the private key @return the {@link PrivateKey} object @throws IOException Signals that an I/O exception has occurred. @throws NoSuchAlgorithmException is thrown if instantiation of the cypher object fails. @throws InvalidKeySpecException is thrown if generation of the SecretKey object fails. @throws NoSuchProviderException is thrown if the specified provider is not registered in the security provider list.
[ "Reads", "the", "given", "{", "@link", "File", "}", "(", "in", "*", ".", "der", "format", ")", "with", "the", "default", "RSA", "algorithm", "and", "returns", "the", "{", "@link", "PrivateKey", "}", "object", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/reader/PrivateKeyReader.java#L154-L158
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java
AbstractResourceBundleHandler.getStoredBundlePath
private String getStoredBundlePath(String bundleName, boolean asGzippedBundle) { String tempFileName; if (asGzippedBundle) tempFileName = gzipDirPath; else tempFileName = textDirPath; return getStoredBundlePath(tempFileName, bundleName); }
java
private String getStoredBundlePath(String bundleName, boolean asGzippedBundle) { String tempFileName; if (asGzippedBundle) tempFileName = gzipDirPath; else tempFileName = textDirPath; return getStoredBundlePath(tempFileName, bundleName); }
[ "private", "String", "getStoredBundlePath", "(", "String", "bundleName", ",", "boolean", "asGzippedBundle", ")", "{", "String", "tempFileName", ";", "if", "(", "asGzippedBundle", ")", "tempFileName", "=", "gzipDirPath", ";", "else", "tempFileName", "=", "textDirPath...
Resolves the file name with which a bundle is stored. @param bundleName the bundle name @param asGzippedBundle the flag indicating if it's a gzipped bundle or not @return the file name.
[ "Resolves", "the", "file", "name", "with", "which", "a", "bundle", "is", "stored", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java#L429-L438
stripe/stripe-android
stripe/src/main/java/com/stripe/android/Stripe.java
Stripe.createBankAccountTokenSynchronous
public Token createBankAccountTokenSynchronous(final BankAccount bankAccount) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { return createBankAccountTokenSynchronous(bankAccount, mDefaultPublishableKey); }
java
public Token createBankAccountTokenSynchronous(final BankAccount bankAccount) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { return createBankAccountTokenSynchronous(bankAccount, mDefaultPublishableKey); }
[ "public", "Token", "createBankAccountTokenSynchronous", "(", "final", "BankAccount", "bankAccount", ")", "throws", "AuthenticationException", ",", "InvalidRequestException", ",", "APIConnectionException", ",", "CardException", ",", "APIException", "{", "return", "createBankAc...
Blocking method to create a {@link Token} for a {@link BankAccount}. Do not call this on the UI thread or your app will crash. This method uses the default publishable key for this {@link Stripe} instance. @param bankAccount the {@link Card} to use for this token @return a {@link Token} that can be used for this {@link BankAccount} @throws AuthenticationException failure to properly authenticate yourself (check your key) @throws InvalidRequestException your request has invalid parameters @throws APIConnectionException failure to connect to Stripe's API @throws CardException should not be thrown with this type of token, but is theoretically possible given the underlying methods called @throws APIException any other type of problem (for instance, a temporary issue with Stripe's servers
[ "Blocking", "method", "to", "create", "a", "{", "@link", "Token", "}", "for", "a", "{", "@link", "BankAccount", "}", ".", "Do", "not", "call", "this", "on", "the", "UI", "thread", "or", "your", "app", "will", "crash", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L202-L209
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/Launcher.java
Launcher.handleActions
protected ReturnCode handleActions(BootstrapConfig bootProps, LaunchArguments launchArgs) { ReturnCode rc = launchArgs.getRc(); switch (rc) { case OK: rc = new KernelBootstrap(bootProps).go(); break; case CREATE_ACTION: // Use initialized bootstrap configuration to create the server lock. // This ensures the server and nested workarea directory exist and are writable ServerLock.createServerLock(bootProps); boolean generatePass = launchArgs.getOption("no-password") == null; rc = bootProps.generateServerEnv(generatePass); break; case MESSAGE_ACTION: rc = showMessage(launchArgs); break; case HELP_ACTION: rc = showHelp(launchArgs); break; case VERSION_ACTION: KernelBootstrap.showVersion(bootProps); rc = ReturnCode.OK; break; case STOP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).stop(); break; case STATUS_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).status(false); break; case STARTING_STATUS_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).status(true); break; case START_STATUS_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).startStatus(); break; case PACKAGE_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.PackageCommand(bootProps, launchArgs).doPackage(); break; case PACKAGE_WLP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.PackageCommand(bootProps, launchArgs).doPackageRuntimeOnly(); break; case DUMP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).dump(); break; case JAVADUMP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).dumpJava(); break; case PAUSE_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).pause(); break; case RESUME_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).resume(); break; case LIST_ACTION: rc = new ListServerHelper(bootProps, launchArgs).listServers(); break; default: showHelp(launchArgs); rc = ReturnCode.BAD_ARGUMENT; } return rc; }
java
protected ReturnCode handleActions(BootstrapConfig bootProps, LaunchArguments launchArgs) { ReturnCode rc = launchArgs.getRc(); switch (rc) { case OK: rc = new KernelBootstrap(bootProps).go(); break; case CREATE_ACTION: // Use initialized bootstrap configuration to create the server lock. // This ensures the server and nested workarea directory exist and are writable ServerLock.createServerLock(bootProps); boolean generatePass = launchArgs.getOption("no-password") == null; rc = bootProps.generateServerEnv(generatePass); break; case MESSAGE_ACTION: rc = showMessage(launchArgs); break; case HELP_ACTION: rc = showHelp(launchArgs); break; case VERSION_ACTION: KernelBootstrap.showVersion(bootProps); rc = ReturnCode.OK; break; case STOP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).stop(); break; case STATUS_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).status(false); break; case STARTING_STATUS_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).status(true); break; case START_STATUS_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).startStatus(); break; case PACKAGE_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.PackageCommand(bootProps, launchArgs).doPackage(); break; case PACKAGE_WLP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.PackageCommand(bootProps, launchArgs).doPackageRuntimeOnly(); break; case DUMP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).dump(); break; case JAVADUMP_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).dumpJava(); break; case PAUSE_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).pause(); break; case RESUME_ACTION: rc = new com.ibm.ws.kernel.boot.internal.commands.ProcessControlHelper(bootProps, launchArgs).resume(); break; case LIST_ACTION: rc = new ListServerHelper(bootProps, launchArgs).listServers(); break; default: showHelp(launchArgs); rc = ReturnCode.BAD_ARGUMENT; } return rc; }
[ "protected", "ReturnCode", "handleActions", "(", "BootstrapConfig", "bootProps", ",", "LaunchArguments", "launchArgs", ")", "{", "ReturnCode", "rc", "=", "launchArgs", ".", "getRc", "(", ")", ";", "switch", "(", "rc", ")", "{", "case", "OK", ":", "rc", "=", ...
Handle the process action. @param bootProps An instance of BootstrapConfig @param launchArgs An instance of LaunchArguments
[ "Handle", "the", "process", "action", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/Launcher.java#L236-L299
gturri/aXMLRPC
src/main/java/de/timroes/axmlrpc/XMLRPCClient.java
XMLRPCClient.callAsync
public long callAsync(XMLRPCCallback listener, String methodName, Object... params) { long id = System.currentTimeMillis(); new Caller(listener, id, methodName, params).start(); return id; }
java
public long callAsync(XMLRPCCallback listener, String methodName, Object... params) { long id = System.currentTimeMillis(); new Caller(listener, id, methodName, params).start(); return id; }
[ "public", "long", "callAsync", "(", "XMLRPCCallback", "listener", ",", "String", "methodName", ",", "Object", "...", "params", ")", "{", "long", "id", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "new", "Caller", "(", "listener", ",", "id", ",",...
Asynchronously call a remote procedure on the server. The method must be described by a method name. If the method requires parameters, this must be set. When the server returns a response the onResponse method is called on the listener. If the server returns an error the onServerError method is called on the listener. The onError method is called whenever something fails. This method returns immediately and returns an identifier for the request. All listener methods get this id as a parameter to distinguish between multiple requests. @param listener A listener, which will be notified about the server response or errors. @param methodName A method name to call on the server. @param params An array of parameters for the method. @return The id of the current request.
[ "Asynchronously", "call", "a", "remote", "procedure", "on", "the", "server", ".", "The", "method", "must", "be", "described", "by", "a", "method", "name", ".", "If", "the", "method", "requires", "parameters", "this", "must", "be", "set", ".", "When", "the"...
train
https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/XMLRPCClient.java#L485-L489