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
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java
ZooKeeperStateHandleStore.releaseAll
public void releaseAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child: children) { try { release(child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release all state nodes.", exception); } }
java
public void releaseAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child: children) { try { release(child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release all state nodes.", exception); } }
[ "public", "void", "releaseAll", "(", ")", "throws", "Exception", "{", "Collection", "<", "String", ">", "children", "=", "getAllPaths", "(", ")", ";", "Exception", "exception", "=", "null", ";", "for", "(", "String", "child", ":", "children", ")", "{", "...
Releases all lock nodes of this ZooKeeperStateHandleStore. @throws Exception if the delete operation of a lock file fails
[ "Releases", "all", "lock", "nodes", "of", "this", "ZooKeeperStateHandleStore", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L410-L426
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.getReader
public static BufferedReader getReader(String path, String charsetName) throws IORuntimeException { return getReader(file(path), charsetName); }
java
public static BufferedReader getReader(String path, String charsetName) throws IORuntimeException { return getReader(file(path), charsetName); }
[ "public", "static", "BufferedReader", "getReader", "(", "String", "path", ",", "String", "charsetName", ")", "throws", "IORuntimeException", "{", "return", "getReader", "(", "file", "(", "path", ")", ",", "charsetName", ")", ";", "}" ]
获得一个文件读取器 @param path 绝对路径 @param charsetName 字符集 @return BufferedReader对象 @throws IORuntimeException IO异常
[ "获得一个文件读取器" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2017-L2019
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java
CassandraDataHandlerBase.prepareSuperColumn
private void prepareSuperColumn(ThriftRow tr, EntityMetadata m, Object value, byte[] name, long timestamp) { if (value != null) { if (m.isCounterColumnType()) { CounterSuperColumn counterSuper = new CounterSuperColumn(); counterSuper.setName(name); CounterColumn counterColumn = prepareCounterColumn((String) value, name); List<CounterColumn> subCounterColumn = new ArrayList<CounterColumn>(); subCounterColumn.add(counterColumn); counterSuper.setColumns(subCounterColumn); tr.addCounterSuperColumn(counterSuper); } else { SuperColumn superCol = new SuperColumn(); superCol.setName(name); Column column = prepareColumn((byte[]) value, name, timestamp, 0); List<Column> subColumn = new ArrayList<Column>(); subColumn.add(column); superCol.setColumns(subColumn); tr.addSuperColumn(superCol); } } }
java
private void prepareSuperColumn(ThriftRow tr, EntityMetadata m, Object value, byte[] name, long timestamp) { if (value != null) { if (m.isCounterColumnType()) { CounterSuperColumn counterSuper = new CounterSuperColumn(); counterSuper.setName(name); CounterColumn counterColumn = prepareCounterColumn((String) value, name); List<CounterColumn> subCounterColumn = new ArrayList<CounterColumn>(); subCounterColumn.add(counterColumn); counterSuper.setColumns(subCounterColumn); tr.addCounterSuperColumn(counterSuper); } else { SuperColumn superCol = new SuperColumn(); superCol.setName(name); Column column = prepareColumn((byte[]) value, name, timestamp, 0); List<Column> subColumn = new ArrayList<Column>(); subColumn.add(column); superCol.setColumns(subColumn); tr.addSuperColumn(superCol); } } }
[ "private", "void", "prepareSuperColumn", "(", "ThriftRow", "tr", ",", "EntityMetadata", "m", ",", "Object", "value", ",", "byte", "[", "]", "name", ",", "long", "timestamp", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "m", ".", "...
Prepare super column. @param tr the tr @param m the m @param value the value @param name the name @param timestamp the timestamp
[ "Prepare", "super", "column", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L2105-L2130
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/PluginLoader.java
PluginLoader.guessManifest
@CheckForNull private static File guessManifest(@Nonnull File parent) { File file = new File(parent, "MANIFEST.MF"); if(!file.isFile()){ file = new File(parent, "META-INF/MANIFEST.MF"); } if(!file.isFile()){ file = new File(parent, "../META-INF/MANIFEST.MF"); } if(file.isFile()){ return file; } return null; }
java
@CheckForNull private static File guessManifest(@Nonnull File parent) { File file = new File(parent, "MANIFEST.MF"); if(!file.isFile()){ file = new File(parent, "META-INF/MANIFEST.MF"); } if(!file.isFile()){ file = new File(parent, "../META-INF/MANIFEST.MF"); } if(file.isFile()){ return file; } return null; }
[ "@", "CheckForNull", "private", "static", "File", "guessManifest", "(", "@", "Nonnull", "File", "parent", ")", "{", "File", "file", "=", "new", "File", "(", "parent", ",", "\"MANIFEST.MF\"", ")", ";", "if", "(", "!", "file", ".", "isFile", "(", ")", ")...
Trying to find the manifest of "exploded plugin" in the current dir, "standard jar" manifest location or "standard" Eclipse location (sibling to the current classpath)
[ "Trying", "to", "find", "the", "manifest", "of", "exploded", "plugin", "in", "the", "current", "dir", "standard", "jar", "manifest", "location", "or", "standard", "Eclipse", "location", "(", "sibling", "to", "the", "current", "classpath", ")" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/PluginLoader.java#L359-L372
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStoreFactory.java
SimpleHadoopFilesystemConfigStoreFactory.createConfigStore
@Override public SimpleHadoopFilesystemConfigStore createConfigStore(URI configKey) throws ConfigStoreCreationException { FileSystem fs = createFileSystem(configKey); URI physicalStoreRoot = getStoreRoot(fs, configKey); URI logicalStoreRoot = URI.create(getSchemePrefix() + physicalStoreRoot); return new SimpleHadoopFilesystemConfigStore(fs, physicalStoreRoot, logicalStoreRoot); }
java
@Override public SimpleHadoopFilesystemConfigStore createConfigStore(URI configKey) throws ConfigStoreCreationException { FileSystem fs = createFileSystem(configKey); URI physicalStoreRoot = getStoreRoot(fs, configKey); URI logicalStoreRoot = URI.create(getSchemePrefix() + physicalStoreRoot); return new SimpleHadoopFilesystemConfigStore(fs, physicalStoreRoot, logicalStoreRoot); }
[ "@", "Override", "public", "SimpleHadoopFilesystemConfigStore", "createConfigStore", "(", "URI", "configKey", ")", "throws", "ConfigStoreCreationException", "{", "FileSystem", "fs", "=", "createFileSystem", "(", "configKey", ")", ";", "URI", "physicalStoreRoot", "=", "g...
Creates a {@link SimpleHadoopFilesystemConfigStore} for the given {@link URI}. The {@link URI} specified should be the fully qualified path to the dataset in question. For example, {@code simple-hdfs://[authority]:[port][path-to-config-store][path-to-dataset]}. It is important to note that the path to the config store on HDFS must also be specified. The combination {@code [path-to-config-store][path-to-dataset]} need not specify an actual {@link Path} on HDFS. <p> If the {@link URI} does not contain an authority, a default authority and root directory are provided. The default authority is taken from the NameNode {@link URI} the current process is co-located with. The default path is "/user/[current-user]/". </p> @param configKey The URI of the config key that needs to be accessed. @return a {@link SimpleHadoopFilesystemConfigStore} configured with the the given {@link URI}. @throws ConfigStoreCreationException if the {@link SimpleHadoopFilesystemConfigStore} could not be created.
[ "Creates", "a", "{", "@link", "SimpleHadoopFilesystemConfigStore", "}", "for", "the", "given", "{", "@link", "URI", "}", ".", "The", "{", "@link", "URI", "}", "specified", "should", "be", "the", "fully", "qualified", "path", "to", "the", "dataset", "in", "...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStoreFactory.java#L181-L187
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/table/RtfTable.java
RtfTable.importTable
private void importTable(PdfPTable table) { this.rows = new ArrayList(); this.tableWidthPercent = table.getWidthPercentage(); // this.tableWidthPercent = table.getWidth(); this.proportionalWidths = table.getAbsoluteWidths(); // this.proportionalWidths = table.getProportionalWidths(); this.cellPadding = (float) (table.spacingAfter() * TWIPS_FACTOR); // this.cellPadding = (float) (table.getPadding() * TWIPS_FACTOR); this.cellSpacing = (float) (table.spacingAfter() * TWIPS_FACTOR); // this.cellSpacing = (float) (table.getSpacing() * TWIPS_FACTOR); // this.borders = new RtfBorderGroup(this.document, RtfBorder.ROW_BORDER, table.getBorder(), table.getBorderWidth(), table.getBorderColor()); // this.borders = new RtfBorderGroup(this.document, RtfBorder.ROW_BORDER, table.getBorder(), table.getBorderWidth(), table.getBorderColor()); this.alignment = table.getHorizontalAlignment(); // this.alignment = table.getAlignment(); int i = 0; Iterator rowIterator = table.getRows().iterator(); // Iterator rowIterator = table.iterator(); while(rowIterator.hasNext()) { this.rows.add(new RtfRow(this.document, this, (PdfPRow) rowIterator.next(), i)); i++; } for(i = 0; i < this.rows.size(); i++) { ((RtfRow) this.rows.get(i)).handleCellSpanning(); ((RtfRow) this.rows.get(i)).cleanRow(); } this.headerRows = table.getHeaderRows(); // this.headerRows = table.getLastHeaderRow(); this.cellsFitToPage = table.getKeepTogether(); // this.cellsFitToPage = table.isCellsFitPage(); this.tableFitToPage = table.getKeepTogether(); // this.tableFitToPage = table.isTableFitsPage(); // if(!Float.isNaN(table.getOffset())) { // this.offset = (int) (table.getOffset() * 2); // } // if(!Float.isNaN(table.getOffset())) { // this.offset = (int) (table.getOffset() * 2); // } }
java
private void importTable(PdfPTable table) { this.rows = new ArrayList(); this.tableWidthPercent = table.getWidthPercentage(); // this.tableWidthPercent = table.getWidth(); this.proportionalWidths = table.getAbsoluteWidths(); // this.proportionalWidths = table.getProportionalWidths(); this.cellPadding = (float) (table.spacingAfter() * TWIPS_FACTOR); // this.cellPadding = (float) (table.getPadding() * TWIPS_FACTOR); this.cellSpacing = (float) (table.spacingAfter() * TWIPS_FACTOR); // this.cellSpacing = (float) (table.getSpacing() * TWIPS_FACTOR); // this.borders = new RtfBorderGroup(this.document, RtfBorder.ROW_BORDER, table.getBorder(), table.getBorderWidth(), table.getBorderColor()); // this.borders = new RtfBorderGroup(this.document, RtfBorder.ROW_BORDER, table.getBorder(), table.getBorderWidth(), table.getBorderColor()); this.alignment = table.getHorizontalAlignment(); // this.alignment = table.getAlignment(); int i = 0; Iterator rowIterator = table.getRows().iterator(); // Iterator rowIterator = table.iterator(); while(rowIterator.hasNext()) { this.rows.add(new RtfRow(this.document, this, (PdfPRow) rowIterator.next(), i)); i++; } for(i = 0; i < this.rows.size(); i++) { ((RtfRow) this.rows.get(i)).handleCellSpanning(); ((RtfRow) this.rows.get(i)).cleanRow(); } this.headerRows = table.getHeaderRows(); // this.headerRows = table.getLastHeaderRow(); this.cellsFitToPage = table.getKeepTogether(); // this.cellsFitToPage = table.isCellsFitPage(); this.tableFitToPage = table.getKeepTogether(); // this.tableFitToPage = table.isTableFitsPage(); // if(!Float.isNaN(table.getOffset())) { // this.offset = (int) (table.getOffset() * 2); // } // if(!Float.isNaN(table.getOffset())) { // this.offset = (int) (table.getOffset() * 2); // } }
[ "private", "void", "importTable", "(", "PdfPTable", "table", ")", "{", "this", ".", "rows", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "tableWidthPercent", "=", "table", ".", "getWidthPercentage", "(", ")", ";", "// this.tableWidthPercent = tabl...
Imports the rows and settings from the Table into this RtfTable. @param table The source PdfPTable @since 2.1.3
[ "Imports", "the", "rows", "and", "settings", "from", "the", "Table", "into", "this", "RtfTable", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/table/RtfTable.java#L189-L228
liferay/com-liferay-commerce
commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentCriterionPersistenceImpl.java
CommerceUserSegmentCriterionPersistenceImpl.findAll
@Override public List<CommerceUserSegmentCriterion> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceUserSegmentCriterion> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceUserSegmentCriterion", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce user segment criterions. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceUserSegmentCriterionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce user segment criterions @param end the upper bound of the range of commerce user segment criterions (not inclusive) @return the range of commerce user segment criterions
[ "Returns", "a", "range", "of", "all", "the", "commerce", "user", "segment", "criterions", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentCriterionPersistenceImpl.java#L1185-L1188
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.copyOfRange
public static <T> T[] copyOfRange(final T[] original, int from, final int to, final int step, final Class<? extends T[]> newType) { N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, original.length); if (step == 0) { throw new IllegalArgumentException("The input parameter 'by' can not be zero"); } if (from == to || from < to != step > 0) { return Object[].class.equals(newType) ? (T[]) new Object[0] : (T[]) N.newArray(newType.getComponentType(), 0); } if (step == 1) { return copyOfRange(original, from, to); } from = from > to ? N.min(original.length - 1, from) : from; final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1); final T[] copy = Object[].class.equals(newType) ? (T[]) new Object[len] : (T[]) N.newArray(newType.getComponentType(), len); for (int i = 0, j = from; i < len; i++, j += step) { copy[i] = original[j]; } return copy; }
java
public static <T> T[] copyOfRange(final T[] original, int from, final int to, final int step, final Class<? extends T[]> newType) { N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, original.length); if (step == 0) { throw new IllegalArgumentException("The input parameter 'by' can not be zero"); } if (from == to || from < to != step > 0) { return Object[].class.equals(newType) ? (T[]) new Object[0] : (T[]) N.newArray(newType.getComponentType(), 0); } if (step == 1) { return copyOfRange(original, from, to); } from = from > to ? N.min(original.length - 1, from) : from; final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1); final T[] copy = Object[].class.equals(newType) ? (T[]) new Object[len] : (T[]) N.newArray(newType.getComponentType(), len); for (int i = 0, j = from; i < len; i++, j += step) { copy[i] = original[j]; } return copy; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "copyOfRange", "(", "final", "T", "[", "]", "original", ",", "int", "from", ",", "final", "int", "to", ",", "final", "int", "step", ",", "final", "Class", "<", "?", "extends", "T", "[", "]", ">", ...
Copy all the elements in <code>original</code>, through <code>to</code>-<code>from</code>, by <code>step</code>. @param original @param from @param to @param step @return @see N#copyOfRange(int[], int, int, int)
[ "Copy", "all", "the", "elements", "in", "<code", ">", "original<", "/", "code", ">", "through", "<code", ">", "to<", "/", "code", ">", "-", "<code", ">", "from<", "/", "code", ">", "by", "<code", ">", "step<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L10971-L10995
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/utils/InlineSchemaUtils.java
InlineSchemaUtils.createInlineType
public static Type createInlineType(Type type, String name, String uniqueName, List<ObjectType> inlineDefinitions) { if (type instanceof ObjectType) { return createInlineObjectType(type, name, uniqueName, inlineDefinitions); } else if (type instanceof ArrayType) { ArrayType arrayType = (ArrayType) type; arrayType.setOfType(createInlineType(arrayType.getOfType(), name, uniqueName, inlineDefinitions)); return arrayType; } else if (type instanceof MapType) { MapType mapType = (MapType) type; if (mapType.getValueType() instanceof ObjectType) mapType.setValueType(createInlineType(mapType.getValueType(), name, uniqueName, inlineDefinitions)); return mapType; } else { return type; } }
java
public static Type createInlineType(Type type, String name, String uniqueName, List<ObjectType> inlineDefinitions) { if (type instanceof ObjectType) { return createInlineObjectType(type, name, uniqueName, inlineDefinitions); } else if (type instanceof ArrayType) { ArrayType arrayType = (ArrayType) type; arrayType.setOfType(createInlineType(arrayType.getOfType(), name, uniqueName, inlineDefinitions)); return arrayType; } else if (type instanceof MapType) { MapType mapType = (MapType) type; if (mapType.getValueType() instanceof ObjectType) mapType.setValueType(createInlineType(mapType.getValueType(), name, uniqueName, inlineDefinitions)); return mapType; } else { return type; } }
[ "public", "static", "Type", "createInlineType", "(", "Type", "type", ",", "String", "name", ",", "String", "uniqueName", ",", "List", "<", "ObjectType", ">", "inlineDefinitions", ")", "{", "if", "(", "type", "instanceof", "ObjectType", ")", "{", "return", "c...
Returns a RefType to a new inlined type named with {@code name} and {@code uniqueName}.<br> The returned RefType point to the new inlined type which is added to the {@code inlineDefinitions} collection.<br> The function is recursive and support collections (ArrayType and MapType).<br> The function is transparent : {@code type} is returned as-is if type is not inlinable or if !config.isInlineSchemaEnabled().<br> @param type type to inline @param name name of the created inline ObjectType @param uniqueName unique name of the created inline ObjectType @param inlineDefinitions a non null collection of inline ObjectType @return the type referencing the newly created inline ObjectType. Can be a RefType, an ArrayType or a MapType
[ "Returns", "a", "RefType", "to", "a", "new", "inlined", "type", "named", "with", "{", "@code", "name", "}", "and", "{", "@code", "uniqueName", "}", ".", "<br", ">", "The", "returned", "RefType", "point", "to", "the", "new", "inlined", "type", "which", ...
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/utils/InlineSchemaUtils.java#L38-L55
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/BranchAsyncTask.java
BranchAsyncTask.executeTask
public AsyncTask<Params, Progress, Result> executeTask(Params... params) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { try { return executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); } catch (Throwable t) { return execute(params); } } else return execute(params); }
java
public AsyncTask<Params, Progress, Result> executeTask(Params... params) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { try { return executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); } catch (Throwable t) { return execute(params); } } else return execute(params); }
[ "public", "AsyncTask", "<", "Params", ",", "Progress", ",", "Result", ">", "executeTask", "(", "Params", "...", "params", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "{", "try"...
Execute Params in back ground depending on the platform version. This executes task in parallel with the {@link AsyncTask#THREAD_POOL_EXECUTOR} @param params Params for executing this Async task @return This object for method chaining
[ "Execute", "Params", "in", "back", "ground", "depending", "on", "the", "platform", "version", ".", "This", "executes", "task", "in", "parallel", "with", "the", "{", "@link", "AsyncTask#THREAD_POOL_EXECUTOR", "}" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/BranchAsyncTask.java#L19-L28
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java
COSAPIClient.correctPlusSign
private String correctPlusSign(String origin, String stringToCorrect) { if (origin.contains("+")) { LOG.debug("Adapt plus sign in {} to avoid SDK bug on {}", origin, stringToCorrect); StringBuilder tmpStringToCorrect = new StringBuilder(stringToCorrect); boolean hasSign = true; int fromIndex = 0; while (hasSign) { int plusLocation = origin.indexOf("+", fromIndex); if (plusLocation < 0) { hasSign = false; break; } if (tmpStringToCorrect.charAt(plusLocation) == ' ') { tmpStringToCorrect.setCharAt(plusLocation, '+'); } if (origin.length() <= plusLocation + 1) { fromIndex = plusLocation + 1; } else { fromIndex = origin.length(); } } LOG.debug("Adapt plus sign {} corrected to {}", stringToCorrect, tmpStringToCorrect.toString()); return tmpStringToCorrect.toString(); } return stringToCorrect; }
java
private String correctPlusSign(String origin, String stringToCorrect) { if (origin.contains("+")) { LOG.debug("Adapt plus sign in {} to avoid SDK bug on {}", origin, stringToCorrect); StringBuilder tmpStringToCorrect = new StringBuilder(stringToCorrect); boolean hasSign = true; int fromIndex = 0; while (hasSign) { int plusLocation = origin.indexOf("+", fromIndex); if (plusLocation < 0) { hasSign = false; break; } if (tmpStringToCorrect.charAt(plusLocation) == ' ') { tmpStringToCorrect.setCharAt(plusLocation, '+'); } if (origin.length() <= plusLocation + 1) { fromIndex = plusLocation + 1; } else { fromIndex = origin.length(); } } LOG.debug("Adapt plus sign {} corrected to {}", stringToCorrect, tmpStringToCorrect.toString()); return tmpStringToCorrect.toString(); } return stringToCorrect; }
[ "private", "String", "correctPlusSign", "(", "String", "origin", ",", "String", "stringToCorrect", ")", "{", "if", "(", "origin", ".", "contains", "(", "\"+\"", ")", ")", "{", "LOG", ".", "debug", "(", "\"Adapt plus sign in {} to avoid SDK bug on {}\"", ",", "or...
Due to SDK bug, list operations may return strings that has spaces instead of + This method will try to fix names for known patterns @param origin original string that may contain @param stringToCorrect string that may contain original string with spaces instead of + @return corrected string
[ "Due", "to", "SDK", "bug", "list", "operations", "may", "return", "strings", "that", "has", "spaces", "instead", "of", "+", "This", "method", "will", "try", "to", "fix", "names", "for", "known", "patterns" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java#L1567-L1593
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerScriptRequestHandler.java
ClientSideHandlerScriptRequestHandler.handleClientSideHandlerRequest
public void handleClientSideHandlerRequest(HttpServletRequest request, HttpServletResponse response) { Handler handler; Map<String, String> variants = config.getGeneratorRegistry().resolveVariants(request); String variantKey = VariantUtils.getVariantKey(variants); if (handlerCache.containsKey(variantKey)) { handler = (Handler) handlerCache.get(variantKey); } else { StringBuffer sb = rsHandler.getClientSideHandler().getClientSideHandlerScript(request); handler = new Handler(sb, Integer.toString(sb.hashCode())); handlerCache.put(variantKey, handler); } // Decide whether to set a 304 response if (useNotModifiedHeader(request, handler.hash)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return; } response.setHeader(HEADER_ETAG, handler.hash); response.setDateHeader(HEADER_LAST_MODIFIED, START_TIME); response.setContentType(JAVASCRIPT_CONTENT_TYPE); if (RendererRequestUtils.isRequestGzippable(request, this.config)) { try { response.setHeader("Content-Encoding", "gzip"); GZIPOutputStream gzOut = new GZIPOutputStream(response.getOutputStream()); byte[] data = handler.data.toString().getBytes(this.config.getResourceCharset().name()); gzOut.write(data, 0, data.length); gzOut.close(); } catch (IOException e) { throw new BundlingProcessException("Unexpected IOException writing ClientSideHandlerScript", e); } } else { StringReader rd = new StringReader(handler.data.toString()); try { Writer writer = response.getWriter(); IOUtils.copy(rd, writer, true); } catch (IOException e) { throw new BundlingProcessException("Unexpected IOException writing ClientSideHandlerScript", e); } } }
java
public void handleClientSideHandlerRequest(HttpServletRequest request, HttpServletResponse response) { Handler handler; Map<String, String> variants = config.getGeneratorRegistry().resolveVariants(request); String variantKey = VariantUtils.getVariantKey(variants); if (handlerCache.containsKey(variantKey)) { handler = (Handler) handlerCache.get(variantKey); } else { StringBuffer sb = rsHandler.getClientSideHandler().getClientSideHandlerScript(request); handler = new Handler(sb, Integer.toString(sb.hashCode())); handlerCache.put(variantKey, handler); } // Decide whether to set a 304 response if (useNotModifiedHeader(request, handler.hash)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return; } response.setHeader(HEADER_ETAG, handler.hash); response.setDateHeader(HEADER_LAST_MODIFIED, START_TIME); response.setContentType(JAVASCRIPT_CONTENT_TYPE); if (RendererRequestUtils.isRequestGzippable(request, this.config)) { try { response.setHeader("Content-Encoding", "gzip"); GZIPOutputStream gzOut = new GZIPOutputStream(response.getOutputStream()); byte[] data = handler.data.toString().getBytes(this.config.getResourceCharset().name()); gzOut.write(data, 0, data.length); gzOut.close(); } catch (IOException e) { throw new BundlingProcessException("Unexpected IOException writing ClientSideHandlerScript", e); } } else { StringReader rd = new StringReader(handler.data.toString()); try { Writer writer = response.getWriter(); IOUtils.copy(rd, writer, true); } catch (IOException e) { throw new BundlingProcessException("Unexpected IOException writing ClientSideHandlerScript", e); } } }
[ "public", "void", "handleClientSideHandlerRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "Handler", "handler", ";", "Map", "<", "String", ",", "String", ">", "variants", "=", "config", ".", "getGeneratorRegistry", "...
Generates a locale dependent script used to include bundles in non dynamic html pages. Uses a cache of said scripts to avoid constant regeneration. It also keeps track of eTags and if-modified-since headers to take advantage of client side caching. @param request the request @param response the response
[ "Generates", "a", "locale", "dependent", "script", "used", "to", "include", "bundles", "in", "non", "dynamic", "html", "pages", ".", "Uses", "a", "cache", "of", "said", "scripts", "to", "avoid", "constant", "regeneration", ".", "It", "also", "keeps", "track"...
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ClientSideHandlerScriptRequestHandler.java#L131-L173
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java
EstimateSceneCalibrated.addTriangulatedStereoFeatures
void addTriangulatedStereoFeatures(View base , Motion edge , double scale ) { View viewA = edge.viewSrc; View viewB = edge.viewDst; boolean baseIsA = base == viewA; View other = baseIsA ? viewB : viewA; // Determine transform from other to world edge.a_to_b.T.scale(scale); Se3_F64 otherToBase = baseIsA ? edge.a_to_b.invert(null) : edge.a_to_b.copy(); otherToBase.concat(base.viewToWorld, other.viewToWorld); // Convert already computed stereo 3D features and turn them into real features for (int i = 0; i < edge.stereoTriangulations.size(); i++) { Feature3D edge3D = edge.stereoTriangulations.get(i); int indexSrc = edge3D.obsIdx.get(0); int indexDst = edge3D.obsIdx.get(1); Feature3D world3D = baseIsA ? viewA.features3D[indexSrc] : viewB.features3D[indexDst]; // find the 3D location of the point in world frame edge3D.worldPt.scale(scale); if( baseIsA ) { viewA.viewToWorld.transform(edge3D.worldPt, edge3D.worldPt); } else { edge.a_to_b.transform(edge3D.worldPt, edge3D.worldPt); viewB.viewToWorld.transform(edge3D.worldPt, edge3D.worldPt); } // See if the feature is already known if( world3D != null ) { // Add the other view if another feature in the other view was not already associated with this feature if( !world3D.views.contains(other) ) { world3D.views.add(other); world3D.obsIdx.add( baseIsA ? indexDst : indexSrc ); } // Retriangulate the point if it appears that this stereo pair is better than the one which originally // computed it if( world3D.triangulationAngle >= edge3D.triangulationAngle ) { continue; } world3D.worldPt.set(edge3D.worldPt); world3D.triangulationAngle = edge3D.triangulationAngle; other.features3D[baseIsA ? indexDst : indexSrc] = edge3D; } else { graph.features3D.add(edge3D); viewA.features3D[indexSrc] = edge3D; viewB.features3D[indexDst] = edge3D; } } // free memory edge.stereoTriangulations = new ArrayList<>(); }
java
void addTriangulatedStereoFeatures(View base , Motion edge , double scale ) { View viewA = edge.viewSrc; View viewB = edge.viewDst; boolean baseIsA = base == viewA; View other = baseIsA ? viewB : viewA; // Determine transform from other to world edge.a_to_b.T.scale(scale); Se3_F64 otherToBase = baseIsA ? edge.a_to_b.invert(null) : edge.a_to_b.copy(); otherToBase.concat(base.viewToWorld, other.viewToWorld); // Convert already computed stereo 3D features and turn them into real features for (int i = 0; i < edge.stereoTriangulations.size(); i++) { Feature3D edge3D = edge.stereoTriangulations.get(i); int indexSrc = edge3D.obsIdx.get(0); int indexDst = edge3D.obsIdx.get(1); Feature3D world3D = baseIsA ? viewA.features3D[indexSrc] : viewB.features3D[indexDst]; // find the 3D location of the point in world frame edge3D.worldPt.scale(scale); if( baseIsA ) { viewA.viewToWorld.transform(edge3D.worldPt, edge3D.worldPt); } else { edge.a_to_b.transform(edge3D.worldPt, edge3D.worldPt); viewB.viewToWorld.transform(edge3D.worldPt, edge3D.worldPt); } // See if the feature is already known if( world3D != null ) { // Add the other view if another feature in the other view was not already associated with this feature if( !world3D.views.contains(other) ) { world3D.views.add(other); world3D.obsIdx.add( baseIsA ? indexDst : indexSrc ); } // Retriangulate the point if it appears that this stereo pair is better than the one which originally // computed it if( world3D.triangulationAngle >= edge3D.triangulationAngle ) { continue; } world3D.worldPt.set(edge3D.worldPt); world3D.triangulationAngle = edge3D.triangulationAngle; other.features3D[baseIsA ? indexDst : indexSrc] = edge3D; } else { graph.features3D.add(edge3D); viewA.features3D[indexSrc] = edge3D; viewB.features3D[indexDst] = edge3D; } } // free memory edge.stereoTriangulations = new ArrayList<>(); }
[ "void", "addTriangulatedStereoFeatures", "(", "View", "base", ",", "Motion", "edge", ",", "double", "scale", ")", "{", "View", "viewA", "=", "edge", ".", "viewSrc", ";", "View", "viewB", "=", "edge", ".", "viewDst", ";", "boolean", "baseIsA", "=", "base", ...
Adds features which were triangulated using the stereo pair after the scale factor has been determined. Don't mark the other view as being processed. It's 3D pose will be estimated later on using PNP with the new features and features determined later on
[ "Adds", "features", "which", "were", "triangulated", "using", "the", "stereo", "pair", "after", "the", "scale", "factor", "has", "been", "determined", ".", "Don", "t", "mark", "the", "other", "view", "as", "being", "processed", ".", "It", "s", "3D", "pose"...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L296-L351
FasterXML/jackson-jr
jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java
JSONObjectException.wrapWithPath
public static JSONObjectException wrapWithPath(Throwable src, Reference ref) { JSONObjectException jme; if (src instanceof JSONObjectException) { jme = (JSONObjectException) src; } else { String msg = src.getMessage(); if (msg == null || msg.length() == 0) { msg = "(was "+src.getClass().getName()+")"; } jme = new JSONObjectException(msg, null, src); } jme.prependPath(ref); return jme; }
java
public static JSONObjectException wrapWithPath(Throwable src, Reference ref) { JSONObjectException jme; if (src instanceof JSONObjectException) { jme = (JSONObjectException) src; } else { String msg = src.getMessage(); if (msg == null || msg.length() == 0) { msg = "(was "+src.getClass().getName()+")"; } jme = new JSONObjectException(msg, null, src); } jme.prependPath(ref); return jme; }
[ "public", "static", "JSONObjectException", "wrapWithPath", "(", "Throwable", "src", ",", "Reference", "ref", ")", "{", "JSONObjectException", "jme", ";", "if", "(", "src", "instanceof", "JSONObjectException", ")", "{", "jme", "=", "(", "JSONObjectException", ")", ...
Method that can be called to either create a new JsonMappingException (if underlying exception is not a JsonMappingException), or augment given exception with given path/reference information.
[ "Method", "that", "can", "be", "called", "to", "either", "create", "a", "new", "JsonMappingException", "(", "if", "underlying", "exception", "is", "not", "a", "JsonMappingException", ")", "or", "augment", "given", "exception", "with", "given", "path", "/", "re...
train
https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSONObjectException.java#L226-L240
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/share.java
share.shareMethod
private static void shareMethod(String message, String activityInfoName) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, message); PackageManager pm = QuickUtils.getContext().getPackageManager(); List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0); for (final ResolveInfo app : activityList) { if ((app.activityInfo.name).contains(activityInfoName)) { final ActivityInfo activity = app.activityInfo; final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name); shareIntent.addCategory(Intent.CATEGORY_LAUNCHER); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); shareIntent.setComponent(name); QuickUtils.getContext().startActivity(shareIntent); break; } } }
java
private static void shareMethod(String message, String activityInfoName) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, message); PackageManager pm = QuickUtils.getContext().getPackageManager(); List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0); for (final ResolveInfo app : activityList) { if ((app.activityInfo.name).contains(activityInfoName)) { final ActivityInfo activity = app.activityInfo; final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name); shareIntent.addCategory(Intent.CATEGORY_LAUNCHER); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); shareIntent.setComponent(name); QuickUtils.getContext().startActivity(shareIntent); break; } } }
[ "private", "static", "void", "shareMethod", "(", "String", "message", ",", "String", "activityInfoName", ")", "{", "Intent", "shareIntent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_SEND", ")", ";", "shareIntent", ".", "setType", "(", "\"text/plain\"", ...
Private method that handles facebook and twitter sharing @param message Message to be delivered @param activityInfoName
[ "Private", "method", "that", "handles", "facebook", "and", "twitter", "sharing" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/share.java#L53-L70
petergeneric/stdlib
guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/jaxrs/GuiceDynamicProxyProvider.java
GuiceDynamicProxyProvider.invoke
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { // Get an instance of the implementing class via Guice final Object instance = registry.getInjector().getInstance(clazz); return thisMethod.invoke(instance, args); }
java
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { // Get an instance of the implementing class via Guice final Object instance = registry.getInjector().getInstance(clazz); return thisMethod.invoke(instance, args); }
[ "@", "Override", "public", "Object", "invoke", "(", "Object", "self", ",", "Method", "thisMethod", ",", "Method", "proceed", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "// Get an instance of the implementing class via Guice", "final", "Object"...
A MethodHandler that proxies the Method invocation through to a Guice-acquired instance
[ "A", "MethodHandler", "that", "proxies", "the", "Method", "invocation", "through", "to", "a", "Guice", "-", "acquired", "instance" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/jaxrs/GuiceDynamicProxyProvider.java#L48-L55
spring-projects/spring-ldap
core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java
DefaultIncrementalAttributesMapper.lookupAttributeValues
public static List<Object> lookupAttributeValues(LdapOperations ldapOperations, String dn, String attribute) { return lookupAttributeValues(ldapOperations, LdapUtils.newLdapName(dn), attribute); }
java
public static List<Object> lookupAttributeValues(LdapOperations ldapOperations, String dn, String attribute) { return lookupAttributeValues(ldapOperations, LdapUtils.newLdapName(dn), attribute); }
[ "public", "static", "List", "<", "Object", ">", "lookupAttributeValues", "(", "LdapOperations", "ldapOperations", ",", "String", "dn", ",", "String", "attribute", ")", "{", "return", "lookupAttributeValues", "(", "ldapOperations", ",", "LdapUtils", ".", "newLdapName...
Lookup all values for the specified attribute, looping through the results incrementally if necessary. @param ldapOperations The instance to use for performing the actual lookup. @param dn The distinguished name of the object to find. @param attribute name of the attribute to request. @return a list with all attribute values found for the requested attribute. Never <code>null</code>, an empty list indicates that the attribute was not set or empty.
[ "Lookup", "all", "values", "for", "the", "specified", "attribute", "looping", "through", "the", "results", "incrementally", "if", "necessary", "." ]
train
https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java#L317-L319
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java
SSLConfigManager.removeSSLConfigFromMap
public synchronized void removeSSLConfigFromMap(String alias, SSLConfig sslConfig) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "removeSSLConfigFromMap", new Object[] { alias }); sslConfigMap.remove(alias); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "removeSSLConfigFromMap"); }
java
public synchronized void removeSSLConfigFromMap(String alias, SSLConfig sslConfig) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "removeSSLConfigFromMap", new Object[] { alias }); sslConfigMap.remove(alias); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "removeSSLConfigFromMap"); }
[ "public", "synchronized", "void", "removeSSLConfigFromMap", "(", "String", "alias", ",", "SSLConfig", "sslConfig", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")...
* This method adds an SSL config to the SSLConfigManager map and list. @param alias @param sslConfig @throws Exception *
[ "*", "This", "method", "adds", "an", "SSL", "config", "to", "the", "SSLConfigManager", "map", "and", "list", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L1308-L1315
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_image_imageId_GET
public OvhImage project_serviceName_image_imageId_GET(String serviceName, String imageId) throws IOException { String qPath = "/cloud/project/{serviceName}/image/{imageId}"; StringBuilder sb = path(qPath, serviceName, imageId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhImage.class); }
java
public OvhImage project_serviceName_image_imageId_GET(String serviceName, String imageId) throws IOException { String qPath = "/cloud/project/{serviceName}/image/{imageId}"; StringBuilder sb = path(qPath, serviceName, imageId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhImage.class); }
[ "public", "OvhImage", "project_serviceName_image_imageId_GET", "(", "String", "serviceName", ",", "String", "imageId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/image/{imageId}\"", ";", "StringBuilder", "sb", "=", "path", "...
Get image REST: GET /cloud/project/{serviceName}/image/{imageId} @param imageId [required] Image id @param serviceName [required] Project id
[ "Get", "image" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1004-L1009
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Symtab.java
Symtab.enterBinop
private void enterBinop(String name, Type left, Type right, Type res, int opcode) { predefClass.members().enter( new OperatorSymbol( makeOperatorName(name), new MethodType(List.of(left, right), res, List.<Type>nil(), methodClass), opcode, predefClass)); }
java
private void enterBinop(String name, Type left, Type right, Type res, int opcode) { predefClass.members().enter( new OperatorSymbol( makeOperatorName(name), new MethodType(List.of(left, right), res, List.<Type>nil(), methodClass), opcode, predefClass)); }
[ "private", "void", "enterBinop", "(", "String", "name", ",", "Type", "left", ",", "Type", "right", ",", "Type", "res", ",", "int", "opcode", ")", "{", "predefClass", ".", "members", "(", ")", ".", "enter", "(", "new", "OperatorSymbol", "(", "makeOperator...
Enter a binary operation into symbol table. @param name The name of the operator. @param left The type of the left operand. @param right The type of the left operand. @param res The operation's result type. @param opcode The operation's bytecode instruction.
[ "Enter", "a", "binary", "operation", "into", "symbol", "table", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symtab.java#L251-L261
aerogear/aerogear-android-core
library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java
Property.findFieldInClass
private Field findFieldInClass(Class klass, String fieldName) throws NoSuchFieldException { try { return klass.getDeclaredField(fieldName); } catch (NoSuchFieldException e) { Class superclass = klass.getSuperclass(); if (superclass != null) { return findFieldInClass(superclass, fieldName); } throw new NoSuchFieldException(); } }
java
private Field findFieldInClass(Class klass, String fieldName) throws NoSuchFieldException { try { return klass.getDeclaredField(fieldName); } catch (NoSuchFieldException e) { Class superclass = klass.getSuperclass(); if (superclass != null) { return findFieldInClass(superclass, fieldName); } throw new NoSuchFieldException(); } }
[ "private", "Field", "findFieldInClass", "(", "Class", "klass", ",", "String", "fieldName", ")", "throws", "NoSuchFieldException", "{", "try", "{", "return", "klass", ".", "getDeclaredField", "(", "fieldName", ")", ";", "}", "catch", "(", "NoSuchFieldException", ...
Search field in class/superclasses @param klass Class to search @param fieldName Field to search @return Field with @RecordId @throws NoSuchFieldException if field isn't found
[ "Search", "field", "in", "class", "/", "superclasses" ]
train
https://github.com/aerogear/aerogear-android-core/blob/3be24a79dd3d2792804935572bb672ff8714e6aa/library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java#L80-L90
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/query/ServiceInstanceQuery.java
ServiceInstanceQuery.getNotInQueryCriterion
public ServiceInstanceQuery getNotInQueryCriterion(String key, List<String> list){ QueryCriterion c = new NotInQueryCriterion(key, list); addQueryCriterion(c); return this; }
java
public ServiceInstanceQuery getNotInQueryCriterion(String key, List<String> list){ QueryCriterion c = new NotInQueryCriterion(key, list); addQueryCriterion(c); return this; }
[ "public", "ServiceInstanceQuery", "getNotInQueryCriterion", "(", "String", "key", ",", "List", "<", "String", ">", "list", ")", "{", "QueryCriterion", "c", "=", "new", "NotInQueryCriterion", "(", "key", ",", "list", ")", ";", "addQueryCriterion", "(", "c", ")"...
Get a metadata value not in String list QueryCriterion. Add a QueryCriterion to check ServiceInstance has metadata value not in the target String list. @param key the metadata key. @param list the target String list that metadata value should not be in. @return the ServiceInstanceQuery.
[ "Get", "a", "metadata", "value", "not", "in", "String", "list", "QueryCriterion", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/query/ServiceInstanceQuery.java#L171-L175
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyEncoder.java
KeyEncoder.encodeDesc
public static void encodeDesc(Float value, byte[] dst, int dstOffset) { if (value == null) { DataEncoder.encode(~0x7fffffff, dst, dstOffset); } else { encodeDesc(value.floatValue(), dst, dstOffset); } }
java
public static void encodeDesc(Float value, byte[] dst, int dstOffset) { if (value == null) { DataEncoder.encode(~0x7fffffff, dst, dstOffset); } else { encodeDesc(value.floatValue(), dst, dstOffset); } }
[ "public", "static", "void", "encodeDesc", "(", "Float", "value", ",", "byte", "[", "]", "dst", ",", "int", "dstOffset", ")", "{", "if", "(", "value", "==", "null", ")", "{", "DataEncoder", ".", "encode", "(", "~", "0x7fffffff", ",", "dst", ",", "dstO...
Encodes the given Float object into exactly 4 bytes for descending order. A non-canonical NaN value is used to represent null. @param value optional Float value to encode @param dst destination for encoded bytes @param dstOffset offset into destination array
[ "Encodes", "the", "given", "Float", "object", "into", "exactly", "4", "bytes", "for", "descending", "order", ".", "A", "non", "-", "canonical", "NaN", "value", "is", "used", "to", "represent", "null", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L255-L261
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.addAllTo
public static <T, R extends Collection<T>> R addAllTo(Iterable<? extends T> iterable, R targetCollection) { Iterate.addAllIterable(iterable, targetCollection); return targetCollection; }
java
public static <T, R extends Collection<T>> R addAllTo(Iterable<? extends T> iterable, R targetCollection) { Iterate.addAllIterable(iterable, targetCollection); return targetCollection; }
[ "public", "static", "<", "T", ",", "R", "extends", "Collection", "<", "T", ">", ">", "R", "addAllTo", "(", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "R", "targetCollection", ")", "{", "Iterate", ".", "addAllIterable", "(", "iterable", ...
Add all elements from the source Iterable to the target collection, return the target collection.
[ "Add", "all", "elements", "from", "the", "source", "Iterable", "to", "the", "target", "collection", "return", "the", "target", "collection", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1115-L1119
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java
FieldList.handleRemoteCommand
public Object handleRemoteCommand(String strCommand, Map<String, Object> properties, boolean bWriteAndRefresh, boolean bDontCallIfLocal, boolean bCloneServerRecord) throws DBException, RemoteException { RemoteTarget remoteTask = this.getTable().getRemoteTableType(org.jbundle.model.Remote.class); if (remoteTask == null) { if (bDontCallIfLocal) return Boolean.FALSE; else return this.doRemoteCommand(strCommand, properties); } return remoteTask.doRemoteAction(strCommand, properties); }
java
public Object handleRemoteCommand(String strCommand, Map<String, Object> properties, boolean bWriteAndRefresh, boolean bDontCallIfLocal, boolean bCloneServerRecord) throws DBException, RemoteException { RemoteTarget remoteTask = this.getTable().getRemoteTableType(org.jbundle.model.Remote.class); if (remoteTask == null) { if (bDontCallIfLocal) return Boolean.FALSE; else return this.doRemoteCommand(strCommand, properties); } return remoteTask.doRemoteAction(strCommand, properties); }
[ "public", "Object", "handleRemoteCommand", "(", "String", "strCommand", ",", "Map", "<", "String", ",", "Object", ">", "properties", ",", "boolean", "bWriteAndRefresh", ",", "boolean", "bDontCallIfLocal", ",", "boolean", "bCloneServerRecord", ")", "throws", "DBExcep...
Do a remote command. This method simplifies the task of calling a remote method. Instead of having to override the session, all you have to do is override doRemoteCommand in your record and handleRemoteCommand will call the remote version of the record. @param strCommand @param properties @return
[ "Do", "a", "remote", "command", ".", "This", "method", "simplifies", "the", "task", "of", "calling", "a", "remote", "method", ".", "Instead", "of", "having", "to", "override", "the", "session", "all", "you", "have", "to", "do", "is", "override", "doRemoteC...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java#L904-L916
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Invoker.java
Invoker.callStaticMethod
public static Object callStaticMethod(Class staticClass, String methodName, Object[] values) throws PageException { if (values == null) values = new Object[0]; MethodParameterPair mp; try { mp = getMethodParameterPairIgnoreCase(staticClass, methodName, values); } catch (NoSuchMethodException e) { throw Caster.toPageException(e); } try { return mp.getMethod().invoke(null, mp.getParameters()); } catch (InvocationTargetException e) { Throwable target = e.getTargetException(); if (target instanceof PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
public static Object callStaticMethod(Class staticClass, String methodName, Object[] values) throws PageException { if (values == null) values = new Object[0]; MethodParameterPair mp; try { mp = getMethodParameterPairIgnoreCase(staticClass, methodName, values); } catch (NoSuchMethodException e) { throw Caster.toPageException(e); } try { return mp.getMethod().invoke(null, mp.getParameters()); } catch (InvocationTargetException e) { Throwable target = e.getTargetException(); if (target instanceof PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "public", "static", "Object", "callStaticMethod", "(", "Class", "staticClass", ",", "String", "methodName", ",", "Object", "[", "]", "values", ")", "throws", "PageException", "{", "if", "(", "values", "==", "null", ")", "values", "=", "new", "Object", "[", ...
call of a static method of a Class @param staticClass class how contains method to invoke @param methodName method name to invoke @param values Arguments for the Method @return return value from method @throws PageException
[ "call", "of", "a", "static", "method", "of", "a", "Class" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L409-L431
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java
GenStrutsApp.canWrite
public boolean canWrite() { if ( ! _strutsConfigFile.canWrite() ) { return false; } try { // // This appears to be the only way to predict whether the file can actually be // written to; it may be that canWrite() returns true, but the file permissions // (NTFS only?) will cause an exception to be thrown. // new FileOutputStream( _strutsConfigFile, true ).close(); } catch ( FileNotFoundException e ) { return false; } catch ( IOException e ) { return false; } return true; }
java
public boolean canWrite() { if ( ! _strutsConfigFile.canWrite() ) { return false; } try { // // This appears to be the only way to predict whether the file can actually be // written to; it may be that canWrite() returns true, but the file permissions // (NTFS only?) will cause an exception to be thrown. // new FileOutputStream( _strutsConfigFile, true ).close(); } catch ( FileNotFoundException e ) { return false; } catch ( IOException e ) { return false; } return true; }
[ "public", "boolean", "canWrite", "(", ")", "{", "if", "(", "!", "_strutsConfigFile", ".", "canWrite", "(", ")", ")", "{", "return", "false", ";", "}", "try", "{", "//", "// This appears to be the only way to predict whether the file can actually be", "// written to; i...
In some cases, canWrite() does not guarantee that a FileNotFoundException will not be thrown when trying to write to a file. This method actually tries to overwrite the file as a test to see whether it's possible.
[ "In", "some", "cases", "canWrite", "()", "does", "not", "guarantee", "that", "a", "FileNotFoundException", "will", "not", "be", "thrown", "when", "trying", "to", "write", "to", "a", "file", ".", "This", "method", "actually", "tries", "to", "overwrite", "the"...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/genmodel/GenStrutsApp.java#L421-L447
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/source/StringSourceFactory.java
StringSourceFactory.createSources
@Override public List<StringSource> createSources(String sourceFileName) { return Util.list(new StringSource(sourceFileName, source)); }
java
@Override public List<StringSource> createSources(String sourceFileName) { return Util.list(new StringSource(sourceFileName, source)); }
[ "@", "Override", "public", "List", "<", "StringSource", ">", "createSources", "(", "String", "sourceFileName", ")", "{", "return", "Util", ".", "list", "(", "new", "StringSource", "(", "sourceFileName", ",", "source", ")", ")", ";", "}" ]
Create a list with a single StringSource - the sourceFileName will be used as the srcInfo in the resulting Source
[ "Create", "a", "list", "with", "a", "single", "StringSource", "-", "the", "sourceFileName", "will", "be", "used", "as", "the", "srcInfo", "in", "the", "resulting", "Source" ]
train
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/source/StringSourceFactory.java#L45-L48
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
protected XExpression _generate(XThrowExpression throwStatement, IAppendable it, IExtraLanguageGeneratorContext context) { it.append("raise "); //$NON-NLS-1$ generate(throwStatement.getExpression(), it, context); return throwStatement; }
java
protected XExpression _generate(XThrowExpression throwStatement, IAppendable it, IExtraLanguageGeneratorContext context) { it.append("raise "); //$NON-NLS-1$ generate(throwStatement.getExpression(), it, context); return throwStatement; }
[ "protected", "XExpression", "_generate", "(", "XThrowExpression", "throwStatement", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "it", ".", "append", "(", "\"raise \"", ")", ";", "//$NON-NLS-1$", "generate", "(", "throwStatemen...
Generate the given object. @param throwStatement the throw statement. @param it the target for the generated content. @param context the context. @return the statement.
[ "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/PyExpressionGenerator.java#L916-L920
Netflix/ribbon
ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java
ExecutionContextListenerInvoker.onExecutionFailed
public void onExecutionFailed(ExecutionContext<I> context, Throwable finalException, ExecutionInfo info) { for (ExecutionListener<I, O> listener: listeners) { try { if (!isListenerDisabled(listener)) { listener.onExecutionFailed(context.getChildContext(listener), finalException, info); } } catch (Throwable e) { logger.error("Error invoking listener " + listener, e); } } }
java
public void onExecutionFailed(ExecutionContext<I> context, Throwable finalException, ExecutionInfo info) { for (ExecutionListener<I, O> listener: listeners) { try { if (!isListenerDisabled(listener)) { listener.onExecutionFailed(context.getChildContext(listener), finalException, info); } } catch (Throwable e) { logger.error("Error invoking listener " + listener, e); } } }
[ "public", "void", "onExecutionFailed", "(", "ExecutionContext", "<", "I", ">", "context", ",", "Throwable", "finalException", ",", "ExecutionInfo", "info", ")", "{", "for", "(", "ExecutionListener", "<", "I", ",", "O", ">", "listener", ":", "listeners", ")", ...
Called when the request is considered failed after all retries. @param finalException Final exception received.
[ "Called", "when", "the", "request", "is", "considered", "failed", "after", "all", "retries", "." ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java#L160-L170
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/context/option/mapper/StringConverter.java
StringConverter.parseEnum
@SuppressWarnings("unchecked") private static Enum parseEnum(final String value) { final int idx = value.lastIndexOf('.'); try { final Class type = Class.forName(value.substring(0, idx)); if (!type.isEnum()) { throw new IllegalStateException("Type " + type.getName() + " is not enum"); } return Enum.valueOf(type, value.substring(idx + 1)); } catch (Exception ex) { throw new IllegalStateException("Failed to recognize enum value: " + value, ex); } }
java
@SuppressWarnings("unchecked") private static Enum parseEnum(final String value) { final int idx = value.lastIndexOf('.'); try { final Class type = Class.forName(value.substring(0, idx)); if (!type.isEnum()) { throw new IllegalStateException("Type " + type.getName() + " is not enum"); } return Enum.valueOf(type, value.substring(idx + 1)); } catch (Exception ex) { throw new IllegalStateException("Failed to recognize enum value: " + value, ex); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "Enum", "parseEnum", "(", "final", "String", "value", ")", "{", "final", "int", "idx", "=", "value", ".", "lastIndexOf", "(", "'", "'", ")", ";", "try", "{", "final", "Class", "type...
Parse enum from full definition: enumClass.enumValue. @param value full enum definition @return parsed enum
[ "Parse", "enum", "from", "full", "definition", ":", "enumClass", ".", "enumValue", "." ]
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/option/mapper/StringConverter.java#L109-L121
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableKeysAndAttributes.java
TableKeysAndAttributes.addHashOnlyPrimaryKeys
public TableKeysAndAttributes addHashOnlyPrimaryKeys(String hashKeyName, Object ... hashKeyValues) { for (Object hashKeyValue: hashKeyValues) { this.addPrimaryKey(new PrimaryKey(hashKeyName, hashKeyValue)); } return this; }
java
public TableKeysAndAttributes addHashOnlyPrimaryKeys(String hashKeyName, Object ... hashKeyValues) { for (Object hashKeyValue: hashKeyValues) { this.addPrimaryKey(new PrimaryKey(hashKeyName, hashKeyValue)); } return this; }
[ "public", "TableKeysAndAttributes", "addHashOnlyPrimaryKeys", "(", "String", "hashKeyName", ",", "Object", "...", "hashKeyValues", ")", "{", "for", "(", "Object", "hashKeyValue", ":", "hashKeyValues", ")", "{", "this", ".", "addPrimaryKey", "(", "new", "PrimaryKey",...
Adds multiple hash-only primary keys to be included in the batch get-item operation. @param hashKeyName name of the hash key attribute name @param hashKeyValues multiple hash key values @return the current instance for method chaining purposes
[ "Adds", "multiple", "hash", "-", "only", "primary", "keys", "to", "be", "included", "in", "the", "batch", "get", "-", "item", "operation", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableKeysAndAttributes.java#L169-L175
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java
DatastreamResource.getDatastreamProfile
@Path("/{dsID}") @GET public Response getDatastreamProfile(@PathParam(RestParam.PID) String pid, @PathParam(RestParam.DSID) String dsID, @QueryParam(RestParam.AS_OF_DATE_TIME) String dateTime, @QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format, @QueryParam(RestParam.VALIDATE_CHECKSUM) @DefaultValue("false") boolean validateChecksum, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { try { Date asOfDateTime = DateUtility.parseDateOrNull(dateTime); Context context = getContext(); Datastream dsProfile = m_management.getDatastream(context, pid, dsID, asOfDateTime); if (dsProfile == null) { return Response .status(Status.NOT_FOUND) .type("text/plain") .entity("No datastream could be found. Either there is no datastream for " + "the digital object \"" + pid + "\" with datastream ID of \"" + dsID + "\" OR there are no datastreams that match the specified " + "date/time value of \"" + dateTime + "\".") .build(); } ReadableCharArrayWriter out = new ReadableCharArrayWriter(512); DefaultSerializer .datastreamProfileToXML( pid, dsID, dsProfile, asOfDateTime, validateChecksum, out); out.close(); MediaType mime = RestHelper.getContentType(format); if (TEXT_HTML.isCompatible(mime)) { Reader reader = out.toReader(); out = new ReadableCharArrayWriter(512); transform(reader, "management/viewDatastreamProfile.xslt", out); } return Response.ok(out.toReader(), mime).build(); } catch (Exception ex) { return handleException(ex, flash); } }
java
@Path("/{dsID}") @GET public Response getDatastreamProfile(@PathParam(RestParam.PID) String pid, @PathParam(RestParam.DSID) String dsID, @QueryParam(RestParam.AS_OF_DATE_TIME) String dateTime, @QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format, @QueryParam(RestParam.VALIDATE_CHECKSUM) @DefaultValue("false") boolean validateChecksum, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { try { Date asOfDateTime = DateUtility.parseDateOrNull(dateTime); Context context = getContext(); Datastream dsProfile = m_management.getDatastream(context, pid, dsID, asOfDateTime); if (dsProfile == null) { return Response .status(Status.NOT_FOUND) .type("text/plain") .entity("No datastream could be found. Either there is no datastream for " + "the digital object \"" + pid + "\" with datastream ID of \"" + dsID + "\" OR there are no datastreams that match the specified " + "date/time value of \"" + dateTime + "\".") .build(); } ReadableCharArrayWriter out = new ReadableCharArrayWriter(512); DefaultSerializer .datastreamProfileToXML( pid, dsID, dsProfile, asOfDateTime, validateChecksum, out); out.close(); MediaType mime = RestHelper.getContentType(format); if (TEXT_HTML.isCompatible(mime)) { Reader reader = out.toReader(); out = new ReadableCharArrayWriter(512); transform(reader, "management/viewDatastreamProfile.xslt", out); } return Response.ok(out.toReader(), mime).build(); } catch (Exception ex) { return handleException(ex, flash); } }
[ "@", "Path", "(", "\"/{dsID}\"", ")", "@", "GET", "public", "Response", "getDatastreamProfile", "(", "@", "PathParam", "(", "RestParam", ".", "PID", ")", "String", "pid", ",", "@", "PathParam", "(", "RestParam", ".", "DSID", ")", "String", "dsID", ",", "...
<p>Invoke API-M.getDatastream(context, pid, dsID, asOfDateTime) </p><p> GET /objects/{pid}/datastreams/{dsID} ? asOfDateTime &amp; validateChecksum=true|false</p>
[ "<p", ">", "Invoke", "API", "-", "M", ".", "getDatastream", "(", "context", "pid", "dsID", "asOfDateTime", ")", "<", "/", "p", ">", "<p", ">", "GET", "/", "objects", "/", "{", "pid", "}", "/", "datastreams", "/", "{", "dsID", "}", "?", "asOfDateTim...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java#L141-L192
janus-project/guava.janusproject.io
guava/src/com/google/common/math/IntMath.java
IntMath.gcd
public static int gcd(int a, int b) { /* * The reason we require both arguments to be >= 0 is because otherwise, what do you return on * gcd(0, Integer.MIN_VALUE)? BigInteger.gcd would return positive 2^31, but positive 2^31 * isn't an int. */ checkNonNegative("a", a); checkNonNegative("b", b); if (a == 0) { // 0 % b == 0, so b divides a, but the converse doesn't hold. // BigInteger.gcd is consistent with this decision. return b; } else if (b == 0) { return a; // similar logic } /* * Uses the binary GCD algorithm; see http://en.wikipedia.org/wiki/Binary_GCD_algorithm. * This is >40% faster than the Euclidean algorithm in benchmarks. */ int aTwos = Integer.numberOfTrailingZeros(a); a >>= aTwos; // divide out all 2s int bTwos = Integer.numberOfTrailingZeros(b); b >>= bTwos; // divide out all 2s while (a != b) { // both a, b are odd // The key to the binary GCD algorithm is as follows: // Both a and b are odd. Assume a > b; then gcd(a - b, b) = gcd(a, b). // But in gcd(a - b, b), a - b is even and b is odd, so we can divide out powers of two. // We bend over backwards to avoid branching, adapting a technique from // http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax int delta = a - b; // can't overflow, since a and b are nonnegative int minDeltaOrZero = delta & (delta >> (Integer.SIZE - 1)); // equivalent to Math.min(delta, 0) a = delta - minDeltaOrZero - minDeltaOrZero; // sets a to Math.abs(a - b) // a is now nonnegative and even b += minDeltaOrZero; // sets b to min(old a, b) a >>= Integer.numberOfTrailingZeros(a); // divide out all 2s, since 2 doesn't divide b } return a << min(aTwos, bTwos); }
java
public static int gcd(int a, int b) { /* * The reason we require both arguments to be >= 0 is because otherwise, what do you return on * gcd(0, Integer.MIN_VALUE)? BigInteger.gcd would return positive 2^31, but positive 2^31 * isn't an int. */ checkNonNegative("a", a); checkNonNegative("b", b); if (a == 0) { // 0 % b == 0, so b divides a, but the converse doesn't hold. // BigInteger.gcd is consistent with this decision. return b; } else if (b == 0) { return a; // similar logic } /* * Uses the binary GCD algorithm; see http://en.wikipedia.org/wiki/Binary_GCD_algorithm. * This is >40% faster than the Euclidean algorithm in benchmarks. */ int aTwos = Integer.numberOfTrailingZeros(a); a >>= aTwos; // divide out all 2s int bTwos = Integer.numberOfTrailingZeros(b); b >>= bTwos; // divide out all 2s while (a != b) { // both a, b are odd // The key to the binary GCD algorithm is as follows: // Both a and b are odd. Assume a > b; then gcd(a - b, b) = gcd(a, b). // But in gcd(a - b, b), a - b is even and b is odd, so we can divide out powers of two. // We bend over backwards to avoid branching, adapting a technique from // http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax int delta = a - b; // can't overflow, since a and b are nonnegative int minDeltaOrZero = delta & (delta >> (Integer.SIZE - 1)); // equivalent to Math.min(delta, 0) a = delta - minDeltaOrZero - minDeltaOrZero; // sets a to Math.abs(a - b) // a is now nonnegative and even b += minDeltaOrZero; // sets b to min(old a, b) a >>= Integer.numberOfTrailingZeros(a); // divide out all 2s, since 2 doesn't divide b } return a << min(aTwos, bTwos); }
[ "public", "static", "int", "gcd", "(", "int", "a", ",", "int", "b", ")", "{", "/*\n * The reason we require both arguments to be >= 0 is because otherwise, what do you return on\n * gcd(0, Integer.MIN_VALUE)? BigInteger.gcd would return positive 2^31, but positive 2^31\n * isn't ...
Returns the greatest common divisor of {@code a, b}. Returns {@code 0} if {@code a == 0 && b == 0}. @throws IllegalArgumentException if {@code a < 0} or {@code b < 0}
[ "Returns", "the", "greatest", "common", "divisor", "of", "{", "@code", "a", "b", "}", ".", "Returns", "{", "@code", "0", "}", "if", "{", "@code", "a", "==", "0", "&&", "b", "==", "0", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/math/IntMath.java#L364-L407
alkacon/opencms-core
src-gwt/org/opencms/ui/client/contextmenu/CmsContextMenuWidget.java
CmsContextMenuWidget.addRootMenuItem
public void addRootMenuItem(ContextMenuItemState rootItem, CmsContextMenuConnector connector) { CmsContextMenuItemWidget itemWidget = createEmptyItemWidget( rootItem.getId(), rootItem.getCaption(), rootItem.getDescription(), connector); itemWidget.setEnabled(rootItem.isEnabled()); itemWidget.setSeparatorVisible(rootItem.isSeparator()); setStyleNames(itemWidget, rootItem.getStyles()); m_menuOverlay.addMenuItem(itemWidget); for (ContextMenuItemState childState : rootItem.getChildren()) { createSubMenu(itemWidget, childState, connector); } }
java
public void addRootMenuItem(ContextMenuItemState rootItem, CmsContextMenuConnector connector) { CmsContextMenuItemWidget itemWidget = createEmptyItemWidget( rootItem.getId(), rootItem.getCaption(), rootItem.getDescription(), connector); itemWidget.setEnabled(rootItem.isEnabled()); itemWidget.setSeparatorVisible(rootItem.isSeparator()); setStyleNames(itemWidget, rootItem.getStyles()); m_menuOverlay.addMenuItem(itemWidget); for (ContextMenuItemState childState : rootItem.getChildren()) { createSubMenu(itemWidget, childState, connector); } }
[ "public", "void", "addRootMenuItem", "(", "ContextMenuItemState", "rootItem", ",", "CmsContextMenuConnector", "connector", ")", "{", "CmsContextMenuItemWidget", "itemWidget", "=", "createEmptyItemWidget", "(", "rootItem", ".", "getId", "(", ")", ",", "rootItem", ".", ...
Adds new item as context menu root item.<p> @param rootItem the root item @param connector the connector
[ "Adds", "new", "item", "as", "context", "menu", "root", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/contextmenu/CmsContextMenuWidget.java#L89-L106
xsonorg/xson
src/main/java/org/xson/core/asm/Type.java
Type.getReturnType
public static Type getReturnType(final String methodDescriptor) { char[] buf = methodDescriptor.toCharArray(); return getType(buf, methodDescriptor.indexOf(')') + 1); }
java
public static Type getReturnType(final String methodDescriptor) { char[] buf = methodDescriptor.toCharArray(); return getType(buf, methodDescriptor.indexOf(')') + 1); }
[ "public", "static", "Type", "getReturnType", "(", "final", "String", "methodDescriptor", ")", "{", "char", "[", "]", "buf", "=", "methodDescriptor", ".", "toCharArray", "(", ")", ";", "return", "getType", "(", "buf", ",", "methodDescriptor", ".", "indexOf", ...
Returns the Java type corresponding to the return type of the given method descriptor. @param methodDescriptor a method descriptor. @return the Java type corresponding to the return type of the given method descriptor.
[ "Returns", "the", "Java", "type", "corresponding", "to", "the", "return", "type", "of", "the", "given", "method", "descriptor", "." ]
train
https://github.com/xsonorg/xson/blob/ce1e197ec4ef9be448ed6ca96513e886151f83a9/src/main/java/org/xson/core/asm/Type.java#L313-L316
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putTicketGrantingTicketInScopes
public static void putTicketGrantingTicketInScopes(final RequestContext context, final TicketGrantingTicket ticket) { val ticketValue = ticket != null ? ticket.getId() : null; putTicketGrantingTicketInScopes(context, ticketValue); }
java
public static void putTicketGrantingTicketInScopes(final RequestContext context, final TicketGrantingTicket ticket) { val ticketValue = ticket != null ? ticket.getId() : null; putTicketGrantingTicketInScopes(context, ticketValue); }
[ "public", "static", "void", "putTicketGrantingTicketInScopes", "(", "final", "RequestContext", "context", ",", "final", "TicketGrantingTicket", "ticket", ")", "{", "val", "ticketValue", "=", "ticket", "!=", "null", "?", "ticket", ".", "getId", "(", ")", ":", "nu...
Put ticket granting ticket in request and flow scopes. @param context the context @param ticket the ticket value
[ "Put", "ticket", "granting", "ticket", "in", "request", "and", "flow", "scopes", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L168-L171
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java
JsonModelCoder.getList
public List<T> getList(InputStream stream) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(stream); return getList(parser, null); }
java
public List<T> getList(InputStream stream) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(stream); return getList(parser, null); }
[ "public", "List", "<", "T", ">", "getList", "(", "InputStream", "stream", ")", "throws", "IOException", ",", "JsonFormatException", "{", "JsonPullParser", "parser", "=", "JsonPullParser", ".", "newParser", "(", "stream", ")", ";", "return", "getList", "(", "pa...
Attempts to parse the given data as {@link List} of objects. @param stream JSON-formatted data @return {@link List} of objects @throws IOException @throws JsonFormatException The given data is malformed, or its type is unexpected
[ "Attempts", "to", "parse", "the", "given", "data", "as", "{", "@link", "List", "}", "of", "objects", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L83-L86
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java
Normalizer.compare
public static int compare(int char32a, int char32b, int options) { return internalCompare(UTF16.valueOf(char32a), UTF16.valueOf(char32b), options|INPUT_IS_FCD); }
java
public static int compare(int char32a, int char32b, int options) { return internalCompare(UTF16.valueOf(char32a), UTF16.valueOf(char32b), options|INPUT_IS_FCD); }
[ "public", "static", "int", "compare", "(", "int", "char32a", ",", "int", "char32b", ",", "int", "options", ")", "{", "return", "internalCompare", "(", "UTF16", ".", "valueOf", "(", "char32a", ")", ",", "UTF16", ".", "valueOf", "(", "char32b", ")", ",", ...
Convenience method that can have faster implementation by not allocating buffers. @param char32a the first code point to be checked against the @param char32b the second code point @param options A bit set of options
[ "Convenience", "method", "that", "can", "have", "faster", "implementation", "by", "not", "allocating", "buffers", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L1291-L1293
mgormley/pacaya
src/main/java/edu/jhu/pacaya/sch/graph/WeightedIntDiGraph.java
WeightedIntDiGraph.fromUnweighted
public static WeightedIntDiGraph fromUnweighted(IntDiGraph g, Function<DiEdge, Double> makeDefaultWeight) { WeightedIntDiGraph wg = new WeightedIntDiGraph(makeDefaultWeight); wg.addAll(g); return wg; }
java
public static WeightedIntDiGraph fromUnweighted(IntDiGraph g, Function<DiEdge, Double> makeDefaultWeight) { WeightedIntDiGraph wg = new WeightedIntDiGraph(makeDefaultWeight); wg.addAll(g); return wg; }
[ "public", "static", "WeightedIntDiGraph", "fromUnweighted", "(", "IntDiGraph", "g", ",", "Function", "<", "DiEdge", ",", "Double", ">", "makeDefaultWeight", ")", "{", "WeightedIntDiGraph", "wg", "=", "new", "WeightedIntDiGraph", "(", "makeDefaultWeight", ")", ";", ...
Constructs a weighted directed graph with the same nodes and edges as the given unweighted graph
[ "Constructs", "a", "weighted", "directed", "graph", "with", "the", "same", "nodes", "and", "edges", "as", "the", "given", "unweighted", "graph" ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/sch/graph/WeightedIntDiGraph.java#L83-L87
SG-O/miIO
src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java
Vacuum.installSoundpack
public VacuumSounpackInstallState installSoundpack(String url, String md5, int soundId) throws CommandExecutionException { if (url == null || md5 == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_PARAMETERS); JSONObject install = new JSONObject(); install.put("url", url); install.put("md5", md5); install.put("sid", soundId); JSONArray ret = sendToArray("dnld_install_sound", install); if (ret == null) return null; return new VacuumSounpackInstallState(ret.optJSONObject(0)); }
java
public VacuumSounpackInstallState installSoundpack(String url, String md5, int soundId) throws CommandExecutionException { if (url == null || md5 == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_PARAMETERS); JSONObject install = new JSONObject(); install.put("url", url); install.put("md5", md5); install.put("sid", soundId); JSONArray ret = sendToArray("dnld_install_sound", install); if (ret == null) return null; return new VacuumSounpackInstallState(ret.optJSONObject(0)); }
[ "public", "VacuumSounpackInstallState", "installSoundpack", "(", "String", "url", ",", "String", "md5", ",", "int", "soundId", ")", "throws", "CommandExecutionException", "{", "if", "(", "url", "==", "null", "||", "md5", "==", "null", ")", "throw", "new", "Com...
Install a new soundpack to the device. @param url The url the soundpack should be downloaded from. @param md5 The md5 checksum of the new soundpack. @param soundId The ID of the soundpacks language. @return The current installation status. @throws CommandExecutionException When there has been a error during the communication or the response was invalid.
[ "Install", "a", "new", "soundpack", "to", "the", "device", "." ]
train
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java#L517-L526
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.lookupPrincipal
public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, CmsUUID principalId) { try { CmsGroup group = getUserDriver(dbc).readGroup(dbc, principalId); if (group != null) { return group; } } catch (Exception e) { // ignore this exception } try { CmsUser user = readUser(dbc, principalId); if (user != null) { return user; } } catch (Exception e) { // ignore this exception } return null; }
java
public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, CmsUUID principalId) { try { CmsGroup group = getUserDriver(dbc).readGroup(dbc, principalId); if (group != null) { return group; } } catch (Exception e) { // ignore this exception } try { CmsUser user = readUser(dbc, principalId); if (user != null) { return user; } } catch (Exception e) { // ignore this exception } return null; }
[ "public", "I_CmsPrincipal", "lookupPrincipal", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "principalId", ")", "{", "try", "{", "CmsGroup", "group", "=", "getUserDriver", "(", "dbc", ")", ".", "readGroup", "(", "dbc", ",", "principalId", ")", ";", "if", "(",...
Lookup and read the user or group with the given UUID.<p> @param dbc the current database context @param principalId the UUID of the principal to lookup @return the principal (group or user) if found, otherwise <code>null</code>
[ "Lookup", "and", "read", "the", "user", "or", "group", "with", "the", "given", "UUID", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L5640-L5661
lindar-open/well-rested-client
src/main/java/com/lindar/wellrested/WellRestedRequest.java
WellRestedRequest.globalHeaders
public WellRestedRequest globalHeaders(Map<String, String> globalHeaders) { this.globalHeaders = WellRestedUtil.buildHeaders(globalHeaders); return this; }
java
public WellRestedRequest globalHeaders(Map<String, String> globalHeaders) { this.globalHeaders = WellRestedUtil.buildHeaders(globalHeaders); return this; }
[ "public", "WellRestedRequest", "globalHeaders", "(", "Map", "<", "String", ",", "String", ">", "globalHeaders", ")", "{", "this", ".", "globalHeaders", "=", "WellRestedUtil", ".", "buildHeaders", "(", "globalHeaders", ")", ";", "return", "this", ";", "}" ]
Use this method to add some global headers to the WellRestedRequest object. These headers are going to be added on every request you make. <br/> A good use for this method is setting a global authentication header or a content type header.
[ "Use", "this", "method", "to", "add", "some", "global", "headers", "to", "the", "WellRestedRequest", "object", ".", "These", "headers", "are", "going", "to", "be", "added", "on", "every", "request", "you", "make", ".", "<br", "/", ">", "A", "good", "use"...
train
https://github.com/lindar-open/well-rested-client/blob/d87542f747cd624e3ce0cdc8230f51836326596b/src/main/java/com/lindar/wellrested/WellRestedRequest.java#L102-L105
xm-online/xm-commons
xm-commons-config/src/main/java/com/icthh/xm/commons/config/client/repository/kafka/ConfigTopicConsumer.java
ConfigTopicConsumer.consumeEvent
@Retryable(maxAttemptsExpression = "${application.retry.max-attempts}", backoff = @Backoff(delayExpression = "${application.retry.delay}", multiplierExpression = "${application.retry.multiplier}")) public void consumeEvent(ConsumerRecord<String, String> message) { MdcUtils.putRid(); try { log.info("Consume event from topic [{}]", message.topic()); try { ConfigEvent event = mapper.readValue(message.value(), ConfigEvent.class); log.info("Process event from topic [{}], event_id ='{}'", message.topic(), event.getEventId()); configService.updateConfigurations(event.getCommit(), event.getPaths()); } catch (IOException e) { log.error("Config topic message has incorrect format: '{}'", message.value(), e); } } finally { MdcUtils.removeRid(); } }
java
@Retryable(maxAttemptsExpression = "${application.retry.max-attempts}", backoff = @Backoff(delayExpression = "${application.retry.delay}", multiplierExpression = "${application.retry.multiplier}")) public void consumeEvent(ConsumerRecord<String, String> message) { MdcUtils.putRid(); try { log.info("Consume event from topic [{}]", message.topic()); try { ConfigEvent event = mapper.readValue(message.value(), ConfigEvent.class); log.info("Process event from topic [{}], event_id ='{}'", message.topic(), event.getEventId()); configService.updateConfigurations(event.getCommit(), event.getPaths()); } catch (IOException e) { log.error("Config topic message has incorrect format: '{}'", message.value(), e); } } finally { MdcUtils.removeRid(); } }
[ "@", "Retryable", "(", "maxAttemptsExpression", "=", "\"${application.retry.max-attempts}\"", ",", "backoff", "=", "@", "Backoff", "(", "delayExpression", "=", "\"${application.retry.delay}\"", ",", "multiplierExpression", "=", "\"${application.retry.multiplier}\"", ")", ")",...
Consume tenant command event message. @param message the tenant command event message
[ "Consume", "tenant", "command", "event", "message", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-config/src/main/java/com/icthh/xm/commons/config/client/repository/kafka/ConfigTopicConsumer.java#L32-L51
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getGeneralGuildInfo
public Guild getGeneralGuildInfo(String id) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.GUILD, id)); try { Response<Guild> response = gw2API.getGeneralGuildInfo(id).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 Guild getGeneralGuildInfo(String id) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.GUILD, id)); try { Response<Guild> response = gw2API.getGeneralGuildInfo(id).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", "Guild", "getGeneralGuildInfo", "(", "String", "id", ")", "throws", "GuildWars2Exception", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", ".", "GUILD", ",", "id", ")", ")", ";", "try", "{", "Response", "<", "Guild", ">", "respon...
For more info on guild API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id">here</a><br/> Get guild info for the given guild id @param id {@link Guild#id} @return list of guild info @throws GuildWars2Exception see {@link ErrorCode} for detail @see Guild guild info
[ "For", "more", "info", "on", "guild", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "guild", "/", ":", "id", ">", "here<", "/", "a", ">", "<br", "/", ">", "G...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L1927-L1936
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/attribute/StringAttribute.java
StringAttribute.wildCardEq
public Operation wildCardEq(String pattern) { if (pattern == null) { return this.isNull(); } AnalyzedWildcardPattern wildcardPattern = WildcardParser.getAnalyzedPattern(pattern, null); if (wildcardPattern.getPlain() != null) { return this.eq(pattern); } else if (wildcardPattern.getContains() != null) { return this.contains(wildcardPattern.getContains().iterator().next()); } else if (wildcardPattern.getEndsWith() != null) { return this.endsWith(wildcardPattern.getEndsWith().iterator().next()); } else if (wildcardPattern.getSubstring() != null) { Iterator<Set<String>> intObjectIterator = wildcardPattern.getSubstring().iterator(); return this.startsWith(intObjectIterator.next().iterator().next()); } return new StringWildCardEqOperation(this, wildcardPattern.getWildcard().iterator().next()); }
java
public Operation wildCardEq(String pattern) { if (pattern == null) { return this.isNull(); } AnalyzedWildcardPattern wildcardPattern = WildcardParser.getAnalyzedPattern(pattern, null); if (wildcardPattern.getPlain() != null) { return this.eq(pattern); } else if (wildcardPattern.getContains() != null) { return this.contains(wildcardPattern.getContains().iterator().next()); } else if (wildcardPattern.getEndsWith() != null) { return this.endsWith(wildcardPattern.getEndsWith().iterator().next()); } else if (wildcardPattern.getSubstring() != null) { Iterator<Set<String>> intObjectIterator = wildcardPattern.getSubstring().iterator(); return this.startsWith(intObjectIterator.next().iterator().next()); } return new StringWildCardEqOperation(this, wildcardPattern.getWildcard().iterator().next()); }
[ "public", "Operation", "wildCardEq", "(", "String", "pattern", ")", "{", "if", "(", "pattern", "==", "null", ")", "{", "return", "this", ".", "isNull", "(", ")", ";", "}", "AnalyzedWildcardPattern", "wildcardPattern", "=", "WildcardParser", ".", "getAnalyzedPa...
Wild cards can include * and ?, which mean 'zero or many' and 'exactly one' character respectively. A wild card can be escaped using single-quote. A single-quote must be escaped with another single quote Examples: "a?b*" matches "acbdefg" and "agb", but not "ab" "a'*" matches "a*" (a followed with the star character) "a''*" matches "a'" and "a'bced" (the two quotes are an escaped single-quote) "a'''*" matches "a'*" (a followed by single-quote and then the star character) A single quote that is not followed by ',?, or * is ignored, so the pattern "a'b" is the same as "ab", which matches just "ab" @param pattern the pattern to match @return a wild card operation
[ "Wild", "cards", "can", "include", "*", "and", "?", "which", "mean", "zero", "or", "many", "and", "exactly", "one", "character", "respectively", ".", "A", "wild", "card", "can", "be", "escaped", "using", "single", "-", "quote", ".", "A", "single", "-", ...
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/attribute/StringAttribute.java#L172-L197
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java
Expr.setPrimitive
public void setPrimitive(Type type, int val) { if (type.hasValue()) { this.type = type; this.value = val; this.left = null; this.right = null; this.query = null; } else { throw new IllegalArgumentException("Value provided for non-value " + "expression type!"); } }
java
public void setPrimitive(Type type, int val) { if (type.hasValue()) { this.type = type; this.value = val; this.left = null; this.right = null; this.query = null; } else { throw new IllegalArgumentException("Value provided for non-value " + "expression type!"); } }
[ "public", "void", "setPrimitive", "(", "Type", "type", ",", "int", "val", ")", "{", "if", "(", "type", ".", "hasValue", "(", ")", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "value", "=", "val", ";", "this", ".", "left", "=", ...
Set the primitive value of this atom expression. @param type the type of expression @param val the value to check
[ "Set", "the", "primitive", "value", "of", "this", "atom", "expression", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java#L558-L569
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java
Collator.doCompare
@Deprecated protected int doCompare(CharSequence left, CharSequence right) { return compare(left.toString(), right.toString()); }
java
@Deprecated protected int doCompare(CharSequence left, CharSequence right) { return compare(left.toString(), right.toString()); }
[ "@", "Deprecated", "protected", "int", "doCompare", "(", "CharSequence", "left", ",", "CharSequence", "right", ")", "{", "return", "compare", "(", "left", ".", "toString", "(", ")", ",", "right", ".", "toString", "(", ")", ")", ";", "}" ]
Compares two CharSequences. The base class just calls compare(left.toString(), right.toString()). Subclasses should instead implement this method and have the String API call this method. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Compares", "two", "CharSequences", ".", "The", "base", "class", "just", "calls", "compare", "(", "left", ".", "toString", "()", "right", ".", "toString", "()", ")", ".", "Subclasses", "should", "instead", "implement", "this", "method", "and", "have", "the",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L1210-L1213
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java
BootstrapTools.substituteDeprecatedConfigKey
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated) { // set the designated key only if it is not set already if (!config.containsKey(designated)) { final String valueForDeprecated = config.getString(deprecated, null); if (valueForDeprecated != null) { config.setString(designated, valueForDeprecated); } } }
java
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated) { // set the designated key only if it is not set already if (!config.containsKey(designated)) { final String valueForDeprecated = config.getString(deprecated, null); if (valueForDeprecated != null) { config.setString(designated, valueForDeprecated); } } }
[ "public", "static", "void", "substituteDeprecatedConfigKey", "(", "Configuration", "config", ",", "String", "deprecated", ",", "String", "designated", ")", "{", "// set the designated key only if it is not set already", "if", "(", "!", "config", ".", "containsKey", "(", ...
Sets the value of a new config key to the value of a deprecated config key. @param config Config to write @param deprecated The old config key @param designated The new config key
[ "Sets", "the", "value", "of", "a", "new", "config", "key", "to", "the", "value", "of", "a", "deprecated", "config", "key", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java#L329-L337
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageStatistics.java
ImageStatistics.meanDiffSq
public static double meanDiffSq(GrayF32 imgA, GrayF32 imgB ) { InputSanityCheck.checkSameShape(imgA,imgB); if(BoofConcurrency.USE_CONCURRENT) { return ImplImageStatistics_MT.meanDiffSq(imgA.data,imgA.startIndex,imgA.stride, imgB.data,imgB.startIndex,imgB.stride,imgA.height, imgA.width); } else { return ImplImageStatistics.meanDiffSq(imgA.data,imgA.startIndex,imgA.stride, imgB.data,imgB.startIndex,imgB.stride,imgA.height, imgA.width); } }
java
public static double meanDiffSq(GrayF32 imgA, GrayF32 imgB ) { InputSanityCheck.checkSameShape(imgA,imgB); if(BoofConcurrency.USE_CONCURRENT) { return ImplImageStatistics_MT.meanDiffSq(imgA.data,imgA.startIndex,imgA.stride, imgB.data,imgB.startIndex,imgB.stride,imgA.height, imgA.width); } else { return ImplImageStatistics.meanDiffSq(imgA.data,imgA.startIndex,imgA.stride, imgB.data,imgB.startIndex,imgB.stride,imgA.height, imgA.width); } }
[ "public", "static", "double", "meanDiffSq", "(", "GrayF32", "imgA", ",", "GrayF32", "imgB", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "imgA", ",", "imgB", ")", ";", "if", "(", "BoofConcurrency", ".", "USE_CONCURRENT", ")", "{", "return", "Imp...
<p>Computes the mean squared error (MSE) between the two images.</p> @param imgA first image. Not modified. @param imgB second image. Not modified. @return error between the two images.
[ "<p", ">", "Computes", "the", "mean", "squared", "error", "(", "MSE", ")", "between", "the", "two", "images", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageStatistics.java#L1518-L1525
uber/rides-java-sdk
uber-core/src/main/java/com/uber/sdk/core/client/utils/Preconditions.java
Preconditions.checkNotNull
@Nonnull public static <T> T checkNotNull(T value, @Nonnull String errorMessage) { if (value == null) { throw new NullPointerException(errorMessage); } return value; }
java
@Nonnull public static <T> T checkNotNull(T value, @Nonnull String errorMessage) { if (value == null) { throw new NullPointerException(errorMessage); } return value; }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "value", ",", "@", "Nonnull", "String", "errorMessage", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "errorMessage", "...
Ensures the value is not null. @param value value to be validated. @param errorMessage error message thrown if value is null. @param <T> type of value. @return value passed in if not null.
[ "Ensures", "the", "value", "is", "not", "null", "." ]
train
https://github.com/uber/rides-java-sdk/blob/6c75570ab7884f8ecafaad312ef471dd33f64c42/uber-core/src/main/java/com/uber/sdk/core/client/utils/Preconditions.java#L79-L85
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.getInstance
public static final DateIntervalFormat getInstance(String skeleton, DateIntervalInfo dtitvinf) { return getInstance(skeleton, ULocale.getDefault(Category.FORMAT), dtitvinf); }
java
public static final DateIntervalFormat getInstance(String skeleton, DateIntervalInfo dtitvinf) { return getInstance(skeleton, ULocale.getDefault(Category.FORMAT), dtitvinf); }
[ "public", "static", "final", "DateIntervalFormat", "getInstance", "(", "String", "skeleton", ",", "DateIntervalInfo", "dtitvinf", ")", "{", "return", "getInstance", "(", "skeleton", ",", "ULocale", ".", "getDefault", "(", "Category", ".", "FORMAT", ")", ",", "dt...
Construct a DateIntervalFormat from skeleton DateIntervalInfo, and the default <code>FORMAT</code> locale. This is a convenient override of getInstance(String skeleton, ULocale locale, DateIntervalInfo dtitvinf) with the locale value as default <code>FORMAT</code> locale. @param skeleton the skeleton on which interval format based. @param dtitvinf the DateIntervalInfo object to be adopted. @return a date time interval formatter. @see Category#FORMAT
[ "Construct", "a", "DateIntervalFormat", "from", "skeleton", "DateIntervalInfo", "and", "the", "default", "<code", ">", "FORMAT<", "/", "code", ">", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L489-L493
alkacon/opencms-core
src/org/opencms/db/CmsUserSettings.java
CmsUserSettings.setStartGalleriesSetting
public void setStartGalleriesSetting(Map<String, String> settings) { m_startGalleriesSettings = new TreeMap<String, String>(settings); }
java
public void setStartGalleriesSetting(Map<String, String> settings) { m_startGalleriesSettings = new TreeMap<String, String>(settings); }
[ "public", "void", "setStartGalleriesSetting", "(", "Map", "<", "String", ",", "String", ">", "settings", ")", "{", "m_startGalleriesSettings", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", "settings", ")", ";", "}" ]
Sets the start galleries settings of the user.<p> @param settings the start galleries setting of the user
[ "Sets", "the", "start", "galleries", "settings", "of", "the", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L2194-L2197
ops4j/org.ops4j.pax.logging
pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java
ResolverUtil.loadImplementationsInDirectory
private void loadImplementationsInDirectory(final Test test, final String parent, final File location) { final File[] files = location.listFiles(); if (files == null) { return; } StringBuilder builder; for (final File file : files) { builder = new StringBuilder(); builder.append(parent).append('/').append(file.getName()); final String packageOrClass = parent == null ? file.getName() : builder.toString(); if (file.isDirectory()) { loadImplementationsInDirectory(test, packageOrClass, file); } else if (isTestApplicable(test, file.getName())) { addIfMatching(test, packageOrClass); } } }
java
private void loadImplementationsInDirectory(final Test test, final String parent, final File location) { final File[] files = location.listFiles(); if (files == null) { return; } StringBuilder builder; for (final File file : files) { builder = new StringBuilder(); builder.append(parent).append('/').append(file.getName()); final String packageOrClass = parent == null ? file.getName() : builder.toString(); if (file.isDirectory()) { loadImplementationsInDirectory(test, packageOrClass, file); } else if (isTestApplicable(test, file.getName())) { addIfMatching(test, packageOrClass); } } }
[ "private", "void", "loadImplementationsInDirectory", "(", "final", "Test", "test", ",", "final", "String", "parent", ",", "final", "File", "location", ")", "{", "final", "File", "[", "]", "files", "=", "location", ".", "listFiles", "(", ")", ";", "if", "("...
Finds matches in a physical directory on a filesystem. Examines all files within a directory - if the File object is not a directory, and ends with <i>.class</i> the file is loaded and tested to see if it is acceptable according to the Test. Operates recursively to find classes within a folder structure matching the package structure. @param test a Test used to filter the classes that are discovered @param parent the package name up to this directory in the package hierarchy. E.g. if /classes is in the classpath and we wish to examine files in /classes/org/apache then the values of <i>parent</i> would be <i>org/apache</i> @param location a File object representing a directory
[ "Finds", "matches", "in", "a", "physical", "directory", "on", "a", "filesystem", ".", "Examines", "all", "files", "within", "a", "directory", "-", "if", "the", "File", "object", "is", "not", "a", "directory", "and", "ends", "with", "<i", ">", ".", "class...
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java#L274-L292
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/result/KMLOutputHandler.java
KMLOutputHandler.makeDescription
private StringBuilder makeDescription(Collection<Relation<?>> relations, DBIDRef id) { StringBuilder buf = new StringBuilder(); for(Relation<?> rel : relations) { Object o = rel.get(id); if(o == null) { continue; } String s = o.toString(); // FIXME: strip html characters if(s != null) { if(buf.length() > 0) { buf.append("<br />"); } buf.append(s); } } return buf; }
java
private StringBuilder makeDescription(Collection<Relation<?>> relations, DBIDRef id) { StringBuilder buf = new StringBuilder(); for(Relation<?> rel : relations) { Object o = rel.get(id); if(o == null) { continue; } String s = o.toString(); // FIXME: strip html characters if(s != null) { if(buf.length() > 0) { buf.append("<br />"); } buf.append(s); } } return buf; }
[ "private", "StringBuilder", "makeDescription", "(", "Collection", "<", "Relation", "<", "?", ">", ">", "relations", ",", "DBIDRef", "id", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Relation", "<", "?", ">", ...
Make an HTML description. @param relations Relations @param id Object ID @return Buffer
[ "Make", "an", "HTML", "description", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/result/KMLOutputHandler.java#L551-L568
knowm/XChart
xchart/src/main/java/org/knowm/xchart/XYChart.java
XYChart.addSeries
private XYSeries addSeries( String seriesName, double[] xData, double[] yData, double[] errorBars, DataType dataType) { // Sanity checks sanityCheck(seriesName, xData, yData, errorBars); XYSeries series; if (xData != null) { // Sanity check if (xData.length != yData.length) { throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!"); } series = new XYSeries(seriesName, xData, yData, errorBars, dataType); } else { // generate xData series = new XYSeries( seriesName, Utils.getGeneratedDataAsArray(yData.length), yData, errorBars, dataType); } seriesMap.put(seriesName, series); return series; }
java
private XYSeries addSeries( String seriesName, double[] xData, double[] yData, double[] errorBars, DataType dataType) { // Sanity checks sanityCheck(seriesName, xData, yData, errorBars); XYSeries series; if (xData != null) { // Sanity check if (xData.length != yData.length) { throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!"); } series = new XYSeries(seriesName, xData, yData, errorBars, dataType); } else { // generate xData series = new XYSeries( seriesName, Utils.getGeneratedDataAsArray(yData.length), yData, errorBars, dataType); } seriesMap.put(seriesName, series); return series; }
[ "private", "XYSeries", "addSeries", "(", "String", "seriesName", ",", "double", "[", "]", "xData", ",", "double", "[", "]", "yData", ",", "double", "[", "]", "errorBars", ",", "DataType", "dataType", ")", "{", "// Sanity checks", "sanityCheck", "(", "seriesN...
Add a series for a X-Y type chart using Lists with error bars @param seriesName @param xData the X-Axis data @param yData the Y-Axis data @param errorBars the error bar data @return A Series object that you can set properties on
[ "Add", "a", "series", "for", "a", "X", "-", "Y", "type", "chart", "using", "Lists", "with", "error", "bars" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/XYChart.java#L283-L307
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java
SshUtilities.killProcessByPid
public static void killProcessByPid( Session session, int pid ) throws Exception { String command = "kill -9 " + pid; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { return; } else { new Exception(remoteResponseStr); } }
java
public static void killProcessByPid( Session session, int pid ) throws Exception { String command = "kill -9 " + pid; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { return; } else { new Exception(remoteResponseStr); } }
[ "public", "static", "void", "killProcessByPid", "(", "Session", "session", ",", "int", "pid", ")", "throws", "Exception", "{", "String", "command", "=", "\"kill -9 \"", "+", "pid", ";", "String", "remoteResponseStr", "=", "launchACommand", "(", "session", ",", ...
Kills a process using its pid. <P><b>THIS WORKS ONLY ON LINUX HOSTS</b></p> @param session the session to use. @param pid the pid to use. @throws Exception
[ "Kills", "a", "process", "using", "its", "pid", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java#L142-L151
hector-client/hector
core/src/main/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplate.java
ColumnFamilyTemplate.queryColumns
public <T> T queryColumns(K key, HSlicePredicate<N> predicate, ColumnFamilyRowMapper<K, N, T> mapper) { return doExecuteSlice(key, predicate, mapper); }
java
public <T> T queryColumns(K key, HSlicePredicate<N> predicate, ColumnFamilyRowMapper<K, N, T> mapper) { return doExecuteSlice(key, predicate, mapper); }
[ "public", "<", "T", ">", "T", "queryColumns", "(", "K", "key", ",", "HSlicePredicate", "<", "N", ">", "predicate", ",", "ColumnFamilyRowMapper", "<", "K", ",", "N", ",", "T", ">", "mapper", ")", "{", "return", "doExecuteSlice", "(", "key", ",", "predic...
Queries a range of columns at the given key and maps them to an object of type OBJ using the given mapping object @param <T> @param key @param predicate The {@link HSlicePredicate} which can hold specific column names or a range of columns @param mapper @return
[ "Queries", "a", "range", "of", "columns", "at", "the", "given", "key", "and", "maps", "them", "to", "an", "object", "of", "type", "OBJ", "using", "the", "given", "mapping", "object" ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplate.java#L135-L138
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java
JarPluginProviderLoader.matchesProviderDeclaration
static boolean matchesProviderDeclaration(final ProviderIdent ident, final Class<?> cls) throws PluginException { final Plugin annotation = getPluginMetadata(cls); return ident.getFirst().equals(annotation.service()) && ident.getSecond().equals(annotation.name()); }
java
static boolean matchesProviderDeclaration(final ProviderIdent ident, final Class<?> cls) throws PluginException { final Plugin annotation = getPluginMetadata(cls); return ident.getFirst().equals(annotation.service()) && ident.getSecond().equals(annotation.name()); }
[ "static", "boolean", "matchesProviderDeclaration", "(", "final", "ProviderIdent", "ident", ",", "final", "Class", "<", "?", ">", "cls", ")", "throws", "PluginException", "{", "final", "Plugin", "annotation", "=", "getPluginMetadata", "(", "cls", ")", ";", "retur...
Return true if the ident matches the Plugin annotation for the class
[ "Return", "true", "if", "the", "ident", "matches", "the", "Plugin", "annotation", "for", "the", "class" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java#L204-L207
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.listQueryResultsForManagementGroup
public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName) { return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).toBlocking().single().body(); }
java
public PolicyStatesQueryResultsInner listQueryResultsForManagementGroup(PolicyStatesResource policyStatesResource, String managementGroupName) { return listQueryResultsForManagementGroupWithServiceResponseAsync(policyStatesResource, managementGroupName).toBlocking().single().body(); }
[ "public", "PolicyStatesQueryResultsInner", "listQueryResultsForManagementGroup", "(", "PolicyStatesResource", "policyStatesResource", ",", "String", "managementGroupName", ")", "{", "return", "listQueryResultsForManagementGroupWithServiceResponseAsync", "(", "policyStatesResource", ","...
Queries policy states for the resources under the management group. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param managementGroupName Management group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicyStatesQueryResultsInner object if successful.
[ "Queries", "policy", "states", "for", "the", "resources", "under", "the", "management", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L139-L141
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/GroupsApi.java
GroupsApi.listGroupUsers
public UsersResponse listGroupUsers(String accountId, String groupId, GroupsApi.ListGroupUsersOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listGroupUsers"); } // verify the required parameter 'groupId' is set if (groupId == null) { throw new ApiException(400, "Missing the required parameter 'groupId' when calling listGroupUsers"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/groups/{groupId}/users".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "groupId" + "\\}", apiClient.escapeString(groupId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<UsersResponse> localVarReturnType = new GenericType<UsersResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public UsersResponse listGroupUsers(String accountId, String groupId, GroupsApi.ListGroupUsersOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listGroupUsers"); } // verify the required parameter 'groupId' is set if (groupId == null) { throw new ApiException(400, "Missing the required parameter 'groupId' when calling listGroupUsers"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/groups/{groupId}/users".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "groupId" + "\\}", apiClient.escapeString(groupId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<UsersResponse> localVarReturnType = new GenericType<UsersResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "UsersResponse", "listGroupUsers", "(", "String", "accountId", ",", "String", "groupId", ",", "GroupsApi", ".", "ListGroupUsersOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "\"{}\"", ";", "// verify the required pa...
Gets a list of users in a group. Retrieves a list of users in a group. @param accountId The external account number (int) or account ID Guid. (required) @param groupId The ID of the group being accessed. (required) @param options for modifying the method behavior. @return UsersResponse @throws ApiException if fails to make API call
[ "Gets", "a", "list", "of", "users", "in", "a", "group", ".", "Retrieves", "a", "list", "of", "users", "in", "a", "group", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/GroupsApi.java#L328-L371
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.appendObject
public AppendObjectResponse appendObject(String bucketName, String key, byte[] value) { return this.appendObject(bucketName, key, value, new ObjectMetadata()); }
java
public AppendObjectResponse appendObject(String bucketName, String key, byte[] value) { return this.appendObject(bucketName, key, value, new ObjectMetadata()); }
[ "public", "AppendObjectResponse", "appendObject", "(", "String", "bucketName", ",", "String", "key", ",", "byte", "[", "]", "value", ")", "{", "return", "this", ".", "appendObject", "(", "bucketName", ",", "key", ",", "value", ",", "new", "ObjectMetadata", "...
Uploads the specified bytes to Bos under the specified bucket and key name. @param bucketName The name of an existing bucket, to which you have Write permission. @param key The key under which to store the specified file. @param value The bytes containing the value to be uploaded to Bos. @return An AppendObjectResponse object containing the information returned by Bos for the newly created object.
[ "Uploads", "the", "specified", "bytes", "to", "Bos", "under", "the", "specified", "bucket", "and", "key", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1733-L1735
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/support/action/Action.java
Action.doAction
private void doAction(List<ActionBlock> actions) throws ActionException { try { actions.get(nextStep).execute(); } catch (ActionException e) { throw e; } catch (Exception e) { throw new ActionException("Exception raised by step: " + nextStep, e); } }
java
private void doAction(List<ActionBlock> actions) throws ActionException { try { actions.get(nextStep).execute(); } catch (ActionException e) { throw e; } catch (Exception e) { throw new ActionException("Exception raised by step: " + nextStep, e); } }
[ "private", "void", "doAction", "(", "List", "<", "ActionBlock", ">", "actions", ")", "throws", "ActionException", "{", "try", "{", "actions", ".", "get", "(", "nextStep", ")", ".", "execute", "(", ")", ";", "}", "catch", "(", "ActionException", "e", ")",...
Subroutine that calls an action block from either performs, backOuts or cleanUps. @param actions @throws ActionException
[ "Subroutine", "that", "calls", "an", "action", "block", "from", "either", "performs", "backOuts", "or", "cleanUps", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/action/Action.java#L210-L218
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.processField
public void processField(final By by, final String value) { checkTopmostElement(by); fih.by(by).value(value).perform(); }
java
public void processField(final By by, final String value) { checkTopmostElement(by); fih.by(by).value(value).perform(); }
[ "public", "void", "processField", "(", "final", "By", "by", ",", "final", "String", "value", ")", "{", "checkTopmostElement", "(", "by", ")", ";", "fih", ".", "by", "(", "by", ")", ".", "value", "(", "value", ")", ".", "perform", "(", ")", ";", "}"...
Uses the internal {@link FormInputHandler} to set form field. This method does not use a data set to retrieve the value. @param by the {@link By} used to locate the element representing an HTML input or textarea @param value the value to set the field to
[ "Uses", "the", "internal", "{", "@link", "FormInputHandler", "}", "to", "set", "form", "field", ".", "This", "method", "does", "not", "use", "a", "data", "set", "to", "retrieve", "the", "value", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L667-L670
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java
StringSelectionListBinding.getLabelsFromMap
public static Collection getLabelsFromMap(Collection sortedKeys, Map keysAndLabels) { Collection<Object> labels = new ArrayList<Object>(); Iterator keyIt = sortedKeys.iterator(); while (keyIt.hasNext()) { labels.add(keysAndLabels.get(keyIt.next())); } return labels; }
java
public static Collection getLabelsFromMap(Collection sortedKeys, Map keysAndLabels) { Collection<Object> labels = new ArrayList<Object>(); Iterator keyIt = sortedKeys.iterator(); while (keyIt.hasNext()) { labels.add(keysAndLabels.get(keyIt.next())); } return labels; }
[ "public", "static", "Collection", "getLabelsFromMap", "(", "Collection", "sortedKeys", ",", "Map", "keysAndLabels", ")", "{", "Collection", "<", "Object", ">", "labels", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "Iterator", "keyIt", "=", "s...
Will extract labels from a map in sorted order. @param sortedKeys collection with keys in the appropriate order. Each key corresponds to one in the map. @param keysAndLabels map containing both, keys and labels, from which the labels have to be extracted. @return a collection containing the labels corresponding to the collection of sortedKeys.
[ "Will", "extract", "labels", "from", "a", "map", "in", "sorted", "order", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/StringSelectionListBinding.java#L104-L113
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfLine.java
PdfLine.getWidthCorrected
public float getWidthCorrected(float charSpacing, float wordSpacing) { float total = 0; for (int k = 0; k < line.size(); ++k) { PdfChunk ck = (PdfChunk)line.get(k); total += ck.getWidthCorrected(charSpacing, wordSpacing); } return total; }
java
public float getWidthCorrected(float charSpacing, float wordSpacing) { float total = 0; for (int k = 0; k < line.size(); ++k) { PdfChunk ck = (PdfChunk)line.get(k); total += ck.getWidthCorrected(charSpacing, wordSpacing); } return total; }
[ "public", "float", "getWidthCorrected", "(", "float", "charSpacing", ",", "float", "wordSpacing", ")", "{", "float", "total", "=", "0", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "line", ".", "size", "(", ")", ";", "++", "k", ")", "{", ...
Gets a width corrected with a charSpacing and wordSpacing. @param charSpacing @param wordSpacing @return a corrected width
[ "Gets", "a", "width", "corrected", "with", "a", "charSpacing", "and", "wordSpacing", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfLine.java#L497-L504
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/CheckedExceptionsFactory.java
CheckedExceptionsFactory.newTimeoutException
public static TimeoutException newTimeoutException(String message, Object... args) { return newTimeoutException(null, message, args); }
java
public static TimeoutException newTimeoutException(String message, Object... args) { return newTimeoutException(null, message, args); }
[ "public", "static", "TimeoutException", "newTimeoutException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newTimeoutException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link TimeoutException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link TimeoutException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link TimeoutException} with the given {@link String message}. @see #newTimeoutException(Throwable, String, Object...) @see java.util.concurrent.TimeoutException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "TimeoutException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/CheckedExceptionsFactory.java#L103-L105
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java
AtomCache.getStructureForDomain
public Structure getStructureForDomain(ScopDomain domain, ScopDatabase scopDatabase) throws IOException, StructureException { return getStructureForDomain(domain, scopDatabase, false); }
java
public Structure getStructureForDomain(ScopDomain domain, ScopDatabase scopDatabase) throws IOException, StructureException { return getStructureForDomain(domain, scopDatabase, false); }
[ "public", "Structure", "getStructureForDomain", "(", "ScopDomain", "domain", ",", "ScopDatabase", "scopDatabase", ")", "throws", "IOException", ",", "StructureException", "{", "return", "getStructureForDomain", "(", "domain", ",", "scopDatabase", ",", "false", ")", ";...
Returns the representation of a {@link ScopDomain} as a BioJava {@link Structure} object. @param domain a SCOP domain @param scopDatabase A {@link ScopDatabase} to use @return a Structure object @throws IOException @throws StructureException
[ "Returns", "the", "representation", "of", "a", "{", "@link", "ScopDomain", "}", "as", "a", "BioJava", "{", "@link", "Structure", "}", "object", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java#L543-L546
bytefish/PgBulkInsert
PgBulkInsert/src/main/java/de/bytefish/pgbulkinsert/PgBulkInsert.java
PgBulkInsert.saveAll
public void saveAll(PGConnection connection, Stream<TEntity> entities) throws SQLException { try (PgBinaryWriter bw = new PgBinaryWriter(configuration.getBufferSize())) { // Wrap the CopyOutputStream in our own Writer: bw.open(new PGCopyOutputStream(connection, mapping.getCopyCommand(), 1)); // Insert Each Column: entities.forEach(entity -> saveEntitySynchonized(bw, entity)); } }
java
public void saveAll(PGConnection connection, Stream<TEntity> entities) throws SQLException { try (PgBinaryWriter bw = new PgBinaryWriter(configuration.getBufferSize())) { // Wrap the CopyOutputStream in our own Writer: bw.open(new PGCopyOutputStream(connection, mapping.getCopyCommand(), 1)); // Insert Each Column: entities.forEach(entity -> saveEntitySynchonized(bw, entity)); } }
[ "public", "void", "saveAll", "(", "PGConnection", "connection", ",", "Stream", "<", "TEntity", ">", "entities", ")", "throws", "SQLException", "{", "try", "(", "PgBinaryWriter", "bw", "=", "new", "PgBinaryWriter", "(", "configuration", ".", "getBufferSize", "(",...
Save stream of entities @param connection underlying db connection @param entities stream of entities @throws SQLException
[ "Save", "stream", "of", "entities" ]
train
https://github.com/bytefish/PgBulkInsert/blob/ed3dcdb95a66a38171016dee4a71642ac7cd4a11/PgBulkInsert/src/main/java/de/bytefish/pgbulkinsert/PgBulkInsert.java#L44-L54
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/CSSDecoder.java
CSSDecoder.getLength
public int getLength(TermLengthOrPercent value, boolean auto, TermLengthOrPercent defval, TermLengthOrPercent autoval, int whole) { TermLengthOrPercent val = value; if (value == null) val = defval; if (auto) val = autoval; if (val != null) return (int) context.pxLength(val, whole); else return 0; }
java
public int getLength(TermLengthOrPercent value, boolean auto, TermLengthOrPercent defval, TermLengthOrPercent autoval, int whole) { TermLengthOrPercent val = value; if (value == null) val = defval; if (auto) val = autoval; if (val != null) return (int) context.pxLength(val, whole); else return 0; }
[ "public", "int", "getLength", "(", "TermLengthOrPercent", "value", ",", "boolean", "auto", ",", "TermLengthOrPercent", "defval", ",", "TermLengthOrPercent", "autoval", ",", "int", "whole", ")", "{", "TermLengthOrPercent", "val", "=", "value", ";", "if", "(", "va...
Returns the length in pixels from a CSS definition. <code>null</code> values of the lengths are interpreted as zero. @param value The length or percentage value to be converted @param auto True, if the property is set to <code>auto</code> @param defval The length value to be used when the first one is null @param autoval The value to be used when "auto" is specified @param whole the length to be returned as 100% (in case of percentage values)
[ "Returns", "the", "length", "in", "pixels", "from", "a", "CSS", "definition", ".", "<code", ">", "null<", "/", "code", ">", "values", "of", "the", "lengths", "are", "interpreted", "as", "zero", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/CSSDecoder.java#L80-L89
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java
AnnotationQuery.setTags
public final void setTags(Map<String, String> tags) { Map<String, String> updatedTags = new TreeMap<>(); if (tags != null) { for (Map.Entry<String, String> entry : tags.entrySet()) { String key = entry.getKey(); requireArgument(!Metric.ReservedField.isReservedField(key), MessageFormat.format("Tag {0} is a reserved tag name.", key)); updatedTags.put(key, entry.getValue()); } } _tags.clear(); _tags.putAll(updatedTags); }
java
public final void setTags(Map<String, String> tags) { Map<String, String> updatedTags = new TreeMap<>(); if (tags != null) { for (Map.Entry<String, String> entry : tags.entrySet()) { String key = entry.getKey(); requireArgument(!Metric.ReservedField.isReservedField(key), MessageFormat.format("Tag {0} is a reserved tag name.", key)); updatedTags.put(key, entry.getValue()); } } _tags.clear(); _tags.putAll(updatedTags); }
[ "public", "final", "void", "setTags", "(", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "Map", "<", "String", ",", "String", ">", "updatedTags", "=", "new", "TreeMap", "<>", "(", ")", ";", "if", "(", "tags", "!=", "null", ")", "{", ...
Replaces the tags for the query. @param tags The new tags. May be null.
[ "Replaces", "the", "tags", "for", "the", "query", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/AnnotationQuery.java#L222-L235
milaboratory/milib
src/main/java/com/milaboratory/core/alignment/AlignmentTrimmer.java
AlignmentTrimmer.leftTrimAlignment
public static <S extends Sequence<S>> Alignment<S> leftTrimAlignment(Alignment<S> alignment, LinearGapAlignmentScoring<S> scoring) { S seq1 = alignment.getSequence1(); AlignmentIteratorForward<S> iterator = alignment.forwardIterator(); int score = 0; int minScore = 1; int minSeq1Position = 0, minSeq2Position = 0, minMutPointer = 0; while (iterator.advance()) { final int mut = iterator.getCurrentMutation(); switch (Mutation.getRawTypeCode(mut)) { case RAW_MUTATION_TYPE_SUBSTITUTION: score += scoring.getScore(Mutation.getFrom(mut), Mutation.getTo(mut)); break; case RAW_MUTATION_TYPE_DELETION: case RAW_MUTATION_TYPE_INSERTION: score += scoring.getGapPenalty(); break; default: byte c = seq1.codeAt(iterator.getSeq1Position()); score += scoring.getScore(c, c); break; } // score <= minScore to maximally trim alignment with several equal trimming options if (score <= 0 && score <= minScore) { minScore = score; minSeq1Position = Mutation.isInsertion(mut) ? iterator.getSeq1Position() : iterator.getSeq1Position() + 1; minSeq2Position = Mutation.isDeletion(mut) ? iterator.getSeq2Position() : iterator.getSeq2Position() + 1; minMutPointer = iterator.getMutationsPointer(); } } if (minScore == 1) return alignment; Mutations<S> mutations = alignment.getAbsoluteMutations(); return new Alignment<>(seq1, mutations.getRange(minMutPointer + 1, mutations.size()), new Range(minSeq1Position, alignment.getSequence1Range().getTo()), new Range(minSeq2Position, alignment.getSequence2Range().getTo()), score - minScore); }
java
public static <S extends Sequence<S>> Alignment<S> leftTrimAlignment(Alignment<S> alignment, LinearGapAlignmentScoring<S> scoring) { S seq1 = alignment.getSequence1(); AlignmentIteratorForward<S> iterator = alignment.forwardIterator(); int score = 0; int minScore = 1; int minSeq1Position = 0, minSeq2Position = 0, minMutPointer = 0; while (iterator.advance()) { final int mut = iterator.getCurrentMutation(); switch (Mutation.getRawTypeCode(mut)) { case RAW_MUTATION_TYPE_SUBSTITUTION: score += scoring.getScore(Mutation.getFrom(mut), Mutation.getTo(mut)); break; case RAW_MUTATION_TYPE_DELETION: case RAW_MUTATION_TYPE_INSERTION: score += scoring.getGapPenalty(); break; default: byte c = seq1.codeAt(iterator.getSeq1Position()); score += scoring.getScore(c, c); break; } // score <= minScore to maximally trim alignment with several equal trimming options if (score <= 0 && score <= minScore) { minScore = score; minSeq1Position = Mutation.isInsertion(mut) ? iterator.getSeq1Position() : iterator.getSeq1Position() + 1; minSeq2Position = Mutation.isDeletion(mut) ? iterator.getSeq2Position() : iterator.getSeq2Position() + 1; minMutPointer = iterator.getMutationsPointer(); } } if (minScore == 1) return alignment; Mutations<S> mutations = alignment.getAbsoluteMutations(); return new Alignment<>(seq1, mutations.getRange(minMutPointer + 1, mutations.size()), new Range(minSeq1Position, alignment.getSequence1Range().getTo()), new Range(minSeq2Position, alignment.getSequence2Range().getTo()), score - minScore); }
[ "public", "static", "<", "S", "extends", "Sequence", "<", "S", ">", ">", "Alignment", "<", "S", ">", "leftTrimAlignment", "(", "Alignment", "<", "S", ">", "alignment", ",", "LinearGapAlignmentScoring", "<", "S", ">", "scoring", ")", "{", "S", "seq1", "="...
Try increase total alignment score by partially (or fully) trimming it from left side. If score can't be increased the same alignment will be returned. LinearGapAlignmentScoring case. @param alignment input alignment @param scoring scoring @return resulting alignment
[ "Try", "increase", "total", "alignment", "score", "by", "partially", "(", "or", "fully", ")", "trimming", "it", "from", "left", "side", ".", "If", "score", "can", "t", "be", "increased", "the", "same", "alignment", "will", "be", "returned", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/AlignmentTrimmer.java#L54-L99
ixa-ehu/kaflib
src/main/java/ixa/kaflib/ReadWriteManager.java
ReadWriteManager.print
static void print(KAFDocument kaf) { try { Writer out = new BufferedWriter(new OutputStreamWriter(System.out, "UTF8")); out.write(kafToStr(kaf)); out.flush(); } catch (Exception e) { System.out.println(e); } }
java
static void print(KAFDocument kaf) { try { Writer out = new BufferedWriter(new OutputStreamWriter(System.out, "UTF8")); out.write(kafToStr(kaf)); out.flush(); } catch (Exception e) { System.out.println(e); } }
[ "static", "void", "print", "(", "KAFDocument", "kaf", ")", "{", "try", "{", "Writer", "out", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "System", ".", "out", ",", "\"UTF8\"", ")", ")", ";", "out", ".", "write", "(", "kafToStr", ...
Writes the content of a KAFDocument object to standard output.
[ "Writes", "the", "content", "of", "a", "KAFDocument", "object", "to", "standard", "output", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/ReadWriteManager.java#L73-L81
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.retrieveBean
@Override public <T> T retrieveBean(String name, T bean, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { return getCurrentResource().retrieveBean(name, bean, wheres, orderBy, nativeExpressions); }
java
@Override public <T> T retrieveBean(String name, T bean, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { return getCurrentResource().retrieveBean(name, bean, wheres, orderBy, nativeExpressions); }
[ "@", "Override", "public", "<", "T", ">", "T", "retrieveBean", "(", "String", "name", ",", "T", "bean", ",", "Collection", "<", "CpoWhere", ">", "wheres", ",", "Collection", "<", "CpoOrderBy", ">", "orderBy", ",", "Collection", "<", "CpoNativeFunction", ">...
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for this beans returns more than one row, an exception will be thrown. @param name DOCUMENT ME! @param bean This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the function. @param wheres A collection of CpoWhere beans that define the constraints that should be used when retrieving beans @param orderBy The CpoOrderBy bean that defines the order in which beans should be returned @param nativeExpressions Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time @return An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve. @throws CpoException Thrown if there are errors accessing the datasource
[ "Retrieves", "the", "bean", "from", "the", "datasource", ".", "The", "assumption", "is", "that", "the", "bean", "exists", "in", "the", "datasource", ".", "If", "the", "retrieve", "function", "defined", "for", "this", "beans", "returns", "more", "than", "one"...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L1311-L1314
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_rules_optin_GET
public ArrayList<OvhOptin> serviceName_rules_optin_GET(String serviceName) throws IOException { String qPath = "/domain/{serviceName}/rules/optin"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public ArrayList<OvhOptin> serviceName_rules_optin_GET(String serviceName) throws IOException { String qPath = "/domain/{serviceName}/rules/optin"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "ArrayList", "<", "OvhOptin", ">", "serviceName_rules_optin_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/rules/optin\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", ...
Retrieve optin rule REST: GET /domain/{serviceName}/rules/optin @param serviceName [required] The internal name of your domain
[ "Retrieve", "optin", "rule" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1376-L1381
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/SQLExecuteCallbackFactory.java
SQLExecuteCallbackFactory.getPreparedUpdateSQLExecuteCallback
public static SQLExecuteCallback<Integer> getPreparedUpdateSQLExecuteCallback(final DatabaseType databaseType, final boolean isExceptionThrown) { return new SQLExecuteCallback<Integer>(databaseType, isExceptionThrown) { @Override protected Integer executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException { return ((PreparedStatement) statement).executeUpdate(); } }; }
java
public static SQLExecuteCallback<Integer> getPreparedUpdateSQLExecuteCallback(final DatabaseType databaseType, final boolean isExceptionThrown) { return new SQLExecuteCallback<Integer>(databaseType, isExceptionThrown) { @Override protected Integer executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException { return ((PreparedStatement) statement).executeUpdate(); } }; }
[ "public", "static", "SQLExecuteCallback", "<", "Integer", ">", "getPreparedUpdateSQLExecuteCallback", "(", "final", "DatabaseType", "databaseType", ",", "final", "boolean", "isExceptionThrown", ")", "{", "return", "new", "SQLExecuteCallback", "<", "Integer", ">", "(", ...
Get update callback. @param databaseType database type @param isExceptionThrown is exception thrown @return update callback
[ "Get", "update", "callback", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/SQLExecuteCallbackFactory.java#L43-L51
aboutsip/pkts
pkts-sip/src/main/java/io/pkts/packet/sip/impl/PreConditions.java
PreConditions.ensureNotEmpty
public static Buffer ensureNotEmpty(final Buffer reference, final String msg) throws IllegalArgumentException { if (reference == null || reference.isEmpty()) { throw new IllegalArgumentException(msg); } return reference; }
java
public static Buffer ensureNotEmpty(final Buffer reference, final String msg) throws IllegalArgumentException { if (reference == null || reference.isEmpty()) { throw new IllegalArgumentException(msg); } return reference; }
[ "public", "static", "Buffer", "ensureNotEmpty", "(", "final", "Buffer", "reference", ",", "final", "String", "msg", ")", "throws", "IllegalArgumentException", "{", "if", "(", "reference", "==", "null", "||", "reference", ".", "isEmpty", "(", ")", ")", "{", "...
Assert that the {@link Buffer} is not null nor empty. @param reference @param msg @return @throws IllegalArgumentException
[ "Assert", "that", "the", "{", "@link", "Buffer", "}", "is", "not", "null", "nor", "empty", "." ]
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/PreConditions.java#L114-L119
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java
RedisStorage.pauseTrigger
@Override public void pauseTrigger(TriggerKey triggerKey, Jedis jedis) throws JobPersistenceException { final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Pipeline pipe = jedis.pipelined(); Response<Boolean> exists = pipe.exists(triggerHashKey); Response<Double> completedScore = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.COMPLETED), triggerHashKey); Response<String> nextFireTimeResponse = pipe.hget(triggerHashKey, TRIGGER_NEXT_FIRE_TIME); Response<Double> blockedScore = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.BLOCKED), triggerHashKey); pipe.sync(); if(!exists.get()){ return; } if(completedScore.get() != null){ // doesn't make sense to pause a completed trigger return; } final long nextFireTime = nextFireTimeResponse.get() == null || nextFireTimeResponse.get().isEmpty() ? -1 : Long.parseLong(nextFireTimeResponse.get()); if(blockedScore.get() != null){ setTriggerState(RedisTriggerState.PAUSED_BLOCKED, (double) nextFireTime, triggerHashKey, jedis); } else{ setTriggerState(RedisTriggerState.PAUSED, (double) nextFireTime, triggerHashKey, jedis); } }
java
@Override public void pauseTrigger(TriggerKey triggerKey, Jedis jedis) throws JobPersistenceException { final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Pipeline pipe = jedis.pipelined(); Response<Boolean> exists = pipe.exists(triggerHashKey); Response<Double> completedScore = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.COMPLETED), triggerHashKey); Response<String> nextFireTimeResponse = pipe.hget(triggerHashKey, TRIGGER_NEXT_FIRE_TIME); Response<Double> blockedScore = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.BLOCKED), triggerHashKey); pipe.sync(); if(!exists.get()){ return; } if(completedScore.get() != null){ // doesn't make sense to pause a completed trigger return; } final long nextFireTime = nextFireTimeResponse.get() == null || nextFireTimeResponse.get().isEmpty() ? -1 : Long.parseLong(nextFireTimeResponse.get()); if(blockedScore.get() != null){ setTriggerState(RedisTriggerState.PAUSED_BLOCKED, (double) nextFireTime, triggerHashKey, jedis); } else{ setTriggerState(RedisTriggerState.PAUSED, (double) nextFireTime, triggerHashKey, jedis); } }
[ "@", "Override", "public", "void", "pauseTrigger", "(", "TriggerKey", "triggerKey", ",", "Jedis", "jedis", ")", "throws", "JobPersistenceException", "{", "final", "String", "triggerHashKey", "=", "redisSchema", ".", "triggerHashKey", "(", "triggerKey", ")", ";", "...
Pause the trigger with the given key @param triggerKey the key of the trigger to be paused @param jedis a thread-safe Redis connection @throws JobPersistenceException if the desired trigger does not exist
[ "Pause", "the", "trigger", "with", "the", "given", "key" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java#L444-L470
iipc/webarchive-commons
src/main/java/org/archive/util/SurtPrefixSet.java
SurtPrefixSet.importFromMixed
public void importFromMixed(Reader r, boolean deduceFromSeeds) { BufferedReader reader = new BufferedReader(r); String s; Iterator<String> iter = new RegexLineIterator( new LineReadingIterator(reader), RegexLineIterator.COMMENT_LINE, RegexLineIterator.NONWHITESPACE_ENTRY_TRAILING_COMMENT, RegexLineIterator.ENTRY); while (iter.hasNext()) { s = (String) iter.next(); if(s.startsWith(SURT_PREFIX_DIRECTIVE)) { considerAsAddDirective(s.substring(SURT_PREFIX_DIRECTIVE.length())); continue; } else { if(deduceFromSeeds) { // also deducing 'implied' SURT prefixes // from normal URIs/hostname seeds addFromPlain(s); } } } }
java
public void importFromMixed(Reader r, boolean deduceFromSeeds) { BufferedReader reader = new BufferedReader(r); String s; Iterator<String> iter = new RegexLineIterator( new LineReadingIterator(reader), RegexLineIterator.COMMENT_LINE, RegexLineIterator.NONWHITESPACE_ENTRY_TRAILING_COMMENT, RegexLineIterator.ENTRY); while (iter.hasNext()) { s = (String) iter.next(); if(s.startsWith(SURT_PREFIX_DIRECTIVE)) { considerAsAddDirective(s.substring(SURT_PREFIX_DIRECTIVE.length())); continue; } else { if(deduceFromSeeds) { // also deducing 'implied' SURT prefixes // from normal URIs/hostname seeds addFromPlain(s); } } } }
[ "public", "void", "importFromMixed", "(", "Reader", "r", ",", "boolean", "deduceFromSeeds", ")", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "r", ")", ";", "String", "s", ";", "Iterator", "<", "String", ">", "iter", "=", "new", "Reg...
Import SURT prefixes from a reader with mixed URI and SURT prefix format. @param r the reader to import the prefixes from @param deduceFromSeeds true to also import SURT prefixes implied from normal URIs/hostname seeds
[ "Import", "SURT", "prefixes", "from", "a", "reader", "with", "mixed", "URI", "and", "SURT", "prefix", "format", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/SurtPrefixSet.java#L107-L131
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/suppression/SuppressionParser.java
SuppressionParser.parseSuppressionRules
public List<SuppressionRule> parseSuppressionRules(InputStream inputStream) throws SuppressionParseException, SAXException { try ( InputStream schemaStream12 = FileUtils.getResourceAsStream(SUPPRESSION_SCHEMA_1_2); InputStream schemaStream11 = FileUtils.getResourceAsStream(SUPPRESSION_SCHEMA_1_1); InputStream schemaStream10 = FileUtils.getResourceAsStream(SUPPRESSION_SCHEMA_1_0);) { final SuppressionHandler handler = new SuppressionHandler(); final SAXParser saxParser = XmlUtils.buildSecureSaxParser(schemaStream12, schemaStream11, schemaStream10); final XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setErrorHandler(new SuppressionErrorHandler()); xmlReader.setContentHandler(handler); try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { final InputSource in = new InputSource(reader); xmlReader.parse(in); return handler.getSuppressionRules(); } } catch (ParserConfigurationException | FileNotFoundException ex) { LOGGER.debug("", ex); throw new SuppressionParseException(ex); } catch (SAXException ex) { if (ex.getMessage().contains("Cannot find the declaration of element 'suppressions'.")) { throw ex; } else { LOGGER.debug("", ex); throw new SuppressionParseException(ex); } } catch (IOException ex) { LOGGER.debug("", ex); throw new SuppressionParseException(ex); } }
java
public List<SuppressionRule> parseSuppressionRules(InputStream inputStream) throws SuppressionParseException, SAXException { try ( InputStream schemaStream12 = FileUtils.getResourceAsStream(SUPPRESSION_SCHEMA_1_2); InputStream schemaStream11 = FileUtils.getResourceAsStream(SUPPRESSION_SCHEMA_1_1); InputStream schemaStream10 = FileUtils.getResourceAsStream(SUPPRESSION_SCHEMA_1_0);) { final SuppressionHandler handler = new SuppressionHandler(); final SAXParser saxParser = XmlUtils.buildSecureSaxParser(schemaStream12, schemaStream11, schemaStream10); final XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setErrorHandler(new SuppressionErrorHandler()); xmlReader.setContentHandler(handler); try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { final InputSource in = new InputSource(reader); xmlReader.parse(in); return handler.getSuppressionRules(); } } catch (ParserConfigurationException | FileNotFoundException ex) { LOGGER.debug("", ex); throw new SuppressionParseException(ex); } catch (SAXException ex) { if (ex.getMessage().contains("Cannot find the declaration of element 'suppressions'.")) { throw ex; } else { LOGGER.debug("", ex); throw new SuppressionParseException(ex); } } catch (IOException ex) { LOGGER.debug("", ex); throw new SuppressionParseException(ex); } }
[ "public", "List", "<", "SuppressionRule", ">", "parseSuppressionRules", "(", "InputStream", "inputStream", ")", "throws", "SuppressionParseException", ",", "SAXException", "{", "try", "(", "InputStream", "schemaStream12", "=", "FileUtils", ".", "getResourceAsStream", "(...
Parses the given XML stream and returns a list of the suppression rules contained. @param inputStream an InputStream containing suppression rules @return a list of suppression rules @throws SuppressionParseException thrown if the XML cannot be parsed @throws SAXException thrown if the XML cannot be parsed
[ "Parses", "the", "given", "XML", "stream", "and", "returns", "a", "list", "of", "the", "suppression", "rules", "contained", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/suppression/SuppressionParser.java#L95-L124
lightblueseas/email-tails
src/main/java/de/alpharogroup/email/utils/EmailExtensions.java
EmailExtensions.newAddress
public static Address newAddress(final String emailAddress, final String personal) throws AddressException, UnsupportedEncodingException { return newAddress(emailAddress, personal, null); }
java
public static Address newAddress(final String emailAddress, final String personal) throws AddressException, UnsupportedEncodingException { return newAddress(emailAddress, personal, null); }
[ "public", "static", "Address", "newAddress", "(", "final", "String", "emailAddress", ",", "final", "String", "personal", ")", "throws", "AddressException", ",", "UnsupportedEncodingException", "{", "return", "newAddress", "(", "emailAddress", ",", "personal", ",", "...
Creates from the given the address and personal name an Adress-object. @param emailAddress The address in RFC822 format. @param personal The personal name. @return The created Adress-object from the given address and personal name. @throws UnsupportedEncodingException is thrown if the encoding not supported @throws AddressException is thrown if the parse failed
[ "Creates", "from", "the", "given", "the", "address", "and", "personal", "name", "an", "Adress", "-", "object", "." ]
train
https://github.com/lightblueseas/email-tails/blob/7be6fee3548e61e697cc8e64e90603cb1f505be2/src/main/java/de/alpharogroup/email/utils/EmailExtensions.java#L196-L200
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java
FileSearchExtensions.containsFileRecursive
public static boolean containsFileRecursive(final File parent, final File search) { final File toSearch = search.getAbsoluteFile(); boolean exists = false; final File[] children = parent.getAbsoluteFile().listFiles(); if (children == null) { return false; } final List<File> fileList = Arrays.asList(children); for (final File currentFile : fileList) { if (currentFile.isDirectory()) { exists = FileSearchExtensions.containsFileRecursive(currentFile, toSearch); if (exists) { return true; } } if (fileList.contains(toSearch)) { return true; } } return exists; }
java
public static boolean containsFileRecursive(final File parent, final File search) { final File toSearch = search.getAbsoluteFile(); boolean exists = false; final File[] children = parent.getAbsoluteFile().listFiles(); if (children == null) { return false; } final List<File> fileList = Arrays.asList(children); for (final File currentFile : fileList) { if (currentFile.isDirectory()) { exists = FileSearchExtensions.containsFileRecursive(currentFile, toSearch); if (exists) { return true; } } if (fileList.contains(toSearch)) { return true; } } return exists; }
[ "public", "static", "boolean", "containsFileRecursive", "(", "final", "File", "parent", ",", "final", "File", "search", ")", "{", "final", "File", "toSearch", "=", "search", ".", "getAbsoluteFile", "(", ")", ";", "boolean", "exists", "=", "false", ";", "fina...
Checks if the given file contains only in the parent file recursively. @param parent The parent directory to search. @param search The file to search. @return 's true if the file exists in the parent directory otherwise false.
[ "Checks", "if", "the", "given", "file", "contains", "only", "in", "the", "parent", "file", "recursively", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/FileSearchExtensions.java#L100-L126
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
OmemoService.createRatchetUpdateElement
OmemoElement createRatchetUpdateElement(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice) throws InterruptedException, SmackException.NoResponseException, CorruptedOmemoKeyException, SmackException.NotConnectedException, CannotEstablishOmemoSessionException, NoSuchAlgorithmException, CryptoFailedException { OmemoManager manager = managerGuard.get(); OmemoDevice userDevice = manager.getOwnDevice(); if (contactsDevice.equals(userDevice)) { throw new IllegalArgumentException("\"Thou shall not update thy own ratchet!\" - William Shakespeare"); } // Establish session if necessary if (!hasSession(userDevice, contactsDevice)) { buildFreshSessionWithDevice(manager.getConnection(), userDevice, contactsDevice); } // Generate fresh AES key and IV byte[] messageKey = OmemoMessageBuilder.generateKey(KEYTYPE, KEYLENGTH); byte[] iv = OmemoMessageBuilder.generateIv(); // Create message builder OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> builder; try { builder = new OmemoMessageBuilder<>(userDevice, gullibleTrustCallback, getOmemoRatchet(manager), messageKey, iv, null); } catch (InvalidKeyException | InvalidAlgorithmParameterException | NoSuchPaddingException | BadPaddingException | UnsupportedEncodingException | IllegalBlockSizeException e) { throw new CryptoFailedException(e); } // Add recipient try { builder.addRecipient(contactsDevice); } catch (UndecidedOmemoIdentityException | UntrustedOmemoIdentityException e) { throw new AssertionError("Gullible Trust Callback reported undecided or untrusted device, " + "even though it MUST NOT do that."); } catch (NoIdentityKeyException e) { throw new AssertionError("We MUST have an identityKey for " + contactsDevice + " since we built a session." + e); } // Note: We don't need to update our message counter for a ratchet update message. return builder.finish(); }
java
OmemoElement createRatchetUpdateElement(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice) throws InterruptedException, SmackException.NoResponseException, CorruptedOmemoKeyException, SmackException.NotConnectedException, CannotEstablishOmemoSessionException, NoSuchAlgorithmException, CryptoFailedException { OmemoManager manager = managerGuard.get(); OmemoDevice userDevice = manager.getOwnDevice(); if (contactsDevice.equals(userDevice)) { throw new IllegalArgumentException("\"Thou shall not update thy own ratchet!\" - William Shakespeare"); } // Establish session if necessary if (!hasSession(userDevice, contactsDevice)) { buildFreshSessionWithDevice(manager.getConnection(), userDevice, contactsDevice); } // Generate fresh AES key and IV byte[] messageKey = OmemoMessageBuilder.generateKey(KEYTYPE, KEYLENGTH); byte[] iv = OmemoMessageBuilder.generateIv(); // Create message builder OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> builder; try { builder = new OmemoMessageBuilder<>(userDevice, gullibleTrustCallback, getOmemoRatchet(manager), messageKey, iv, null); } catch (InvalidKeyException | InvalidAlgorithmParameterException | NoSuchPaddingException | BadPaddingException | UnsupportedEncodingException | IllegalBlockSizeException e) { throw new CryptoFailedException(e); } // Add recipient try { builder.addRecipient(contactsDevice); } catch (UndecidedOmemoIdentityException | UntrustedOmemoIdentityException e) { throw new AssertionError("Gullible Trust Callback reported undecided or untrusted device, " + "even though it MUST NOT do that."); } catch (NoIdentityKeyException e) { throw new AssertionError("We MUST have an identityKey for " + contactsDevice + " since we built a session." + e); } // Note: We don't need to update our message counter for a ratchet update message. return builder.finish(); }
[ "OmemoElement", "createRatchetUpdateElement", "(", "OmemoManager", ".", "LoggedInOmemoManager", "managerGuard", ",", "OmemoDevice", "contactsDevice", ")", "throws", "InterruptedException", ",", "SmackException", ".", "NoResponseException", ",", "CorruptedOmemoKeyException", ","...
Create an empty OMEMO message, which is used to forward the ratchet of the recipient. This message type is typically used to create stable sessions. Note that trust decisions are ignored for the creation of this message. @param managerGuard Logged in OmemoManager @param contactsDevice OmemoDevice of the contact @return ratchet update message @throws NoSuchAlgorithmException if AES algorithms are not supported on this system. @throws InterruptedException @throws SmackException.NoResponseException @throws CorruptedOmemoKeyException if our IdentityKeyPair is corrupted. @throws SmackException.NotConnectedException @throws CannotEstablishOmemoSessionException if session negotiation fails.
[ "Create", "an", "empty", "OMEMO", "message", "which", "is", "used", "to", "forward", "the", "ratchet", "of", "the", "recipient", ".", "This", "message", "type", "is", "typically", "used", "to", "create", "stable", "sessions", ".", "Note", "that", "trust", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L283-L327
graknlabs/grakn
server/src/server/ServerFactory.java
ServerFactory.createServer
public static Server createServer( ServerID serverID, io.grpc.Server rpcServer, LockManager lockManager, AttributeDeduplicatorDaemon attributeDeduplicatorDaemon, KeyspaceManager keyspaceStore) { Server server = new Server(serverID, lockManager, rpcServer, attributeDeduplicatorDaemon, keyspaceStore); Runtime.getRuntime().addShutdownHook(new Thread(server::close, "grakn-server-shutdown")); return server; }
java
public static Server createServer( ServerID serverID, io.grpc.Server rpcServer, LockManager lockManager, AttributeDeduplicatorDaemon attributeDeduplicatorDaemon, KeyspaceManager keyspaceStore) { Server server = new Server(serverID, lockManager, rpcServer, attributeDeduplicatorDaemon, keyspaceStore); Runtime.getRuntime().addShutdownHook(new Thread(server::close, "grakn-server-shutdown")); return server; }
[ "public", "static", "Server", "createServer", "(", "ServerID", "serverID", ",", "io", ".", "grpc", ".", "Server", "rpcServer", ",", "LockManager", "lockManager", ",", "AttributeDeduplicatorDaemon", "attributeDeduplicatorDaemon", ",", "KeyspaceManager", "keyspaceStore", ...
Allows the creation of a Server instance with various configurations @return a Server instance
[ "Allows", "the", "creation", "of", "a", "Server", "instance", "with", "various", "configurations" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/ServerFactory.java#L81-L90
buschmais/jqa-core-framework
scanner/src/main/java/com/buschmais/jqassistant/core/scanner/api/ScopeHelper.java
ScopeHelper.printScopes
public void printScopes(Map<String, Scope> scopes) { logger.info("Scopes [" + scopes.size() + "]"); for (String scopeName : scopes.keySet()) { logger.info("\t" + scopeName); } }
java
public void printScopes(Map<String, Scope> scopes) { logger.info("Scopes [" + scopes.size() + "]"); for (String scopeName : scopes.keySet()) { logger.info("\t" + scopeName); } }
[ "public", "void", "printScopes", "(", "Map", "<", "String", ",", "Scope", ">", "scopes", ")", "{", "logger", ".", "info", "(", "\"Scopes [\"", "+", "scopes", ".", "size", "(", ")", "+", "\"]\"", ")", ";", "for", "(", "String", "scopeName", ":", "scop...
Print a list of available scopes to the console. @param scopes The available scopes.
[ "Print", "a", "list", "of", "available", "scopes", "to", "the", "console", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/scanner/src/main/java/com/buschmais/jqassistant/core/scanner/api/ScopeHelper.java#L30-L35
Activiti/Activiti
activiti-engine/src/main/java/org/activiti/engine/impl/util/json/CDL.java
CDL.toJSONArray
public static JSONArray toJSONArray(JSONArray names, JSONTokener x) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (;;) { JSONObject jo = rowToJSONObject(names, x); if (jo == null) { break; } ja.put(jo); } if (ja.length() == 0) { return null; } return ja; }
java
public static JSONArray toJSONArray(JSONArray names, JSONTokener x) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (;;) { JSONObject jo = rowToJSONObject(names, x); if (jo == null) { break; } ja.put(jo); } if (ja.length() == 0) { return null; } return ja; }
[ "public", "static", "JSONArray", "toJSONArray", "(", "JSONArray", "names", ",", "JSONTokener", "x", ")", "throws", "JSONException", "{", "if", "(", "names", "==", "null", "||", "names", ".", "length", "(", ")", "==", "0", ")", "{", "return", "null", ";",...
Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of element names. @param names A JSONArray of strings. @param x A JSONTokener of the source text. @return A JSONArray of JSONObjects. @throws JSONException
[ "Produce", "a", "JSONArray", "of", "JSONObjects", "from", "a", "comma", "delimited", "text", "string", "using", "a", "supplied", "JSONArray", "as", "the", "source", "of", "element", "names", "." ]
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/util/json/CDL.java#L181-L197
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectIntersectionOfImpl_CustomFieldSerializer.java
OWLObjectIntersectionOfImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectIntersectionOfImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectIntersectionOfImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectIntersectionOfImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectIntersectionOfImpl_CustomFieldSerializer.java#L90-L93
alkacon/opencms-core
src/org/opencms/ui/login/CmsPasswordForm.java
CmsPasswordForm.setErrorPassword1
public void setErrorPassword1(UserError error, String style) { m_passwordField1.setComponentError(error); m_password1Style.setStyle(style); }
java
public void setErrorPassword1(UserError error, String style) { m_passwordField1.setComponentError(error); m_password1Style.setStyle(style); }
[ "public", "void", "setErrorPassword1", "(", "UserError", "error", ",", "String", "style", ")", "{", "m_passwordField1", ".", "setComponentError", "(", "error", ")", ";", "m_password1Style", ".", "setStyle", "(", "style", ")", ";", "}" ]
Sets the password 1 error.<p> @param error the error @param style the style class
[ "Sets", "the", "password", "1", "error", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsPasswordForm.java#L218-L222
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/painter/TextPainter.java
TextPainter.deleteShape
public void deleteShape(Paintable paintable, Object group, MapContext context) { Text text = (Text) paintable; context.getVectorContext().deleteElement(group, text.getId()); }
java
public void deleteShape(Paintable paintable, Object group, MapContext context) { Text text = (Text) paintable; context.getVectorContext().deleteElement(group, text.getId()); }
[ "public", "void", "deleteShape", "(", "Paintable", "paintable", ",", "Object", "group", ",", "MapContext", "context", ")", "{", "Text", "text", "=", "(", "Text", ")", "paintable", ";", "context", ".", "getVectorContext", "(", ")", ".", "deleteElement", "(", ...
Delete a {@link Paintable} object from the given {@link MapContext}. It the object does not exist, nothing will be done. @param paintable The object to be painted. @param group The group where the object resides in (optional). @param graphics The context to paint on.
[ "Delete", "a", "{", "@link", "Paintable", "}", "object", "from", "the", "given", "{", "@link", "MapContext", "}", ".", "It", "the", "object", "does", "not", "exist", "nothing", "will", "be", "done", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/TextPainter.java#L65-L68
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/Kickflip.java
Kickflip.getApiClient
public static KickflipApiClient getApiClient(Context context, KickflipCallback callback) { checkNotNull(sClientKey); checkNotNull(sClientSecret); if (sKickflip == null || !sKickflip.getConfig().getClientId().equals(sClientKey)) { sKickflip = new KickflipApiClient(context, sClientKey, sClientSecret, callback); } else if (callback != null) { callback.onSuccess(sKickflip.getActiveUser()); } return sKickflip; }
java
public static KickflipApiClient getApiClient(Context context, KickflipCallback callback) { checkNotNull(sClientKey); checkNotNull(sClientSecret); if (sKickflip == null || !sKickflip.getConfig().getClientId().equals(sClientKey)) { sKickflip = new KickflipApiClient(context, sClientKey, sClientSecret, callback); } else if (callback != null) { callback.onSuccess(sKickflip.getActiveUser()); } return sKickflip; }
[ "public", "static", "KickflipApiClient", "getApiClient", "(", "Context", "context", ",", "KickflipCallback", "callback", ")", "{", "checkNotNull", "(", "sClientKey", ")", ";", "checkNotNull", "(", "sClientSecret", ")", ";", "if", "(", "sKickflip", "==", "null", ...
Create a new instance of the KickflipApiClient if one hasn't yet been created, or the provided API keys don't match the existing client. @param context the context of the host application @param callback an optional callback to be notified with the Kickflip user corresponding to the provided API keys. @return
[ "Create", "a", "new", "instance", "of", "the", "KickflipApiClient", "if", "one", "hasn", "t", "yet", "been", "created", "or", "the", "provided", "API", "keys", "don", "t", "match", "the", "existing", "client", "." ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/Kickflip.java#L336-L345
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java
PAbstractObject.getFloat
@Override public final float getFloat(final String key) { Float result = optFloat(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
@Override public final float getFloat(final String key) { Float result = optFloat(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
[ "@", "Override", "public", "final", "float", "getFloat", "(", "final", "String", "key", ")", "{", "Float", "result", "=", "optFloat", "(", "key", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throw", "new", "ObjectMissingException", "(", "this"...
Get a property as a float or throw an exception. @param key the property name
[ "Get", "a", "property", "as", "a", "float", "or", "throw", "an", "exception", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L128-L135
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Ir.java
Ir.addMessage
public void addMessage(final long messageId, final List<Token> messageTokens) { Verify.notNull(messageTokens, "messageTokens"); captureTypes(messageTokens, 0, messageTokens.size() - 1); updateComponentTokenCounts(messageTokens); messagesByIdMap.put(messageId, new ArrayList<>(messageTokens)); }
java
public void addMessage(final long messageId, final List<Token> messageTokens) { Verify.notNull(messageTokens, "messageTokens"); captureTypes(messageTokens, 0, messageTokens.size() - 1); updateComponentTokenCounts(messageTokens); messagesByIdMap.put(messageId, new ArrayList<>(messageTokens)); }
[ "public", "void", "addMessage", "(", "final", "long", "messageId", ",", "final", "List", "<", "Token", ">", "messageTokens", ")", "{", "Verify", ".", "notNull", "(", "messageTokens", ",", "\"messageTokens\"", ")", ";", "captureTypes", "(", "messageTokens", ","...
Add a List of {@link Token}s for a given message id. @param messageId to identify the list of tokens for the message. @param messageTokens the List of {@link Token}s representing the message.
[ "Add", "a", "List", "of", "{", "@link", "Token", "}", "s", "for", "a", "given", "message", "id", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Ir.java#L104-L112
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageManager.java
BaseMessageManager.getMessageQueue
public MessageQueue getMessageQueue(String strQueueName, String strQueueType) { // Look up the message Queue! return (BaseMessageQueue)m_messageMap.get(strQueueName); }
java
public MessageQueue getMessageQueue(String strQueueName, String strQueueType) { // Look up the message Queue! return (BaseMessageQueue)m_messageMap.get(strQueueName); }
[ "public", "MessageQueue", "getMessageQueue", "(", "String", "strQueueName", ",", "String", "strQueueType", ")", "{", "// Look up the message Queue!", "return", "(", "BaseMessageQueue", ")", "m_messageMap", ".", "get", "(", "strQueueName", ")", ";", "}" ]
Get this Message Queue (or create one if this name doesn't exist). Override this to supply the correct message queue if it hasn't already been built. @param strQueueName The queue name to lookup. @param strQueueType The queue type if this queue needs to be created. @return The message queue.
[ "Get", "this", "Message", "Queue", "(", "or", "create", "one", "if", "this", "name", "doesn", "t", "exist", ")", ".", "Override", "this", "to", "supply", "the", "correct", "message", "queue", "if", "it", "hasn", "t", "already", "been", "built", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageManager.java#L133-L136
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.setObjectIndex
public static Object setObjectIndex(Object obj, double dblIndex, Object value, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefWriteError(obj, String.valueOf(dblIndex), value); } int index = (int)dblIndex; if (index == dblIndex) { return setObjectIndex(sobj, index, value, cx); } String s = toString(dblIndex); return setObjectProp(sobj, s, value, cx); }
java
public static Object setObjectIndex(Object obj, double dblIndex, Object value, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefWriteError(obj, String.valueOf(dblIndex), value); } int index = (int)dblIndex; if (index == dblIndex) { return setObjectIndex(sobj, index, value, cx); } String s = toString(dblIndex); return setObjectProp(sobj, s, value, cx); }
[ "public", "static", "Object", "setObjectIndex", "(", "Object", "obj", ",", "double", "dblIndex", ",", "Object", "value", ",", "Context", "cx", ",", "Scriptable", "scope", ")", "{", "Scriptable", "sobj", "=", "toObjectOrNull", "(", "cx", ",", "obj", ",", "s...
A cheaper and less general version of the above for well-known argument types.
[ "A", "cheaper", "and", "less", "general", "version", "of", "the", "above", "for", "well", "-", "known", "argument", "types", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1764-L1779
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.fromParallelCollection
public <OUT> DataStreamSource<OUT> fromParallelCollection(SplittableIterator<OUT> iterator, TypeInformation<OUT> typeInfo) { return fromParallelCollection(iterator, typeInfo, "Parallel Collection Source"); }
java
public <OUT> DataStreamSource<OUT> fromParallelCollection(SplittableIterator<OUT> iterator, TypeInformation<OUT> typeInfo) { return fromParallelCollection(iterator, typeInfo, "Parallel Collection Source"); }
[ "public", "<", "OUT", ">", "DataStreamSource", "<", "OUT", ">", "fromParallelCollection", "(", "SplittableIterator", "<", "OUT", ">", "iterator", ",", "TypeInformation", "<", "OUT", ">", "typeInfo", ")", "{", "return", "fromParallelCollection", "(", "iterator", ...
Creates a new data stream that contains elements in the iterator. The iterator is splittable, allowing the framework to create a parallel data stream source that returns the elements in the iterator. <p>Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the iterator must be given explicitly in the form of the type information. This method is useful for cases where the type is generic. In that case, the type class (as given in {@link #fromParallelCollection(org.apache.flink.util.SplittableIterator, Class)} does not supply all type information. @param iterator The iterator that produces the elements of the data stream @param typeInfo The TypeInformation for the produced data stream. @param <OUT> The type of the returned data stream @return A data stream representing the elements in the iterator
[ "Creates", "a", "new", "data", "stream", "that", "contains", "elements", "in", "the", "iterator", ".", "The", "iterator", "is", "splittable", "allowing", "the", "framework", "to", "create", "a", "parallel", "data", "stream", "source", "that", "returns", "the",...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L912-L915
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.unprotectedConcat
public void unprotectedConcat(String target, String [] srcs, long now) throws IOException { if (NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSNamesystem.concat to "+target); } // do the move INode [] trgINodes = getExistingPathINodes(target); INodeFile trgInode = (INodeFile) trgINodes[trgINodes.length-1]; INodeDirectory trgParent = (INodeDirectory)trgINodes[trgINodes.length-2]; INodeFile [] allSrcInodes = new INodeFile[srcs.length]; int i = 0; int totalBlocks = 0; writeLock(); try { for(String src : srcs) { INodeFile srcInode = getFileINode(src); allSrcInodes[i++] = srcInode; totalBlocks += srcInode.getBlocks().length; } trgInode.getStorage().appendBlocks(allSrcInodes, totalBlocks, trgInode); // copy the blocks // since we are in the same dir - we can use same parent to remove files int count = 0; for(INodeFile nodeToRemove: allSrcInodes) { if(nodeToRemove == null) continue; nodeToRemove.storage = null; trgParent.removeChild(nodeToRemove); inodeMap.remove(nodeToRemove); count++; } trgInode.setModificationTime(now); trgParent.setModificationTime(now); // update quota on the parent directory ('count' files removed, 0 space) unprotectedUpdateCount(trgINodes, trgINodes.length-1, - count, 0); } finally { writeUnlock(); } }
java
public void unprotectedConcat(String target, String [] srcs, long now) throws IOException { if (NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSNamesystem.concat to "+target); } // do the move INode [] trgINodes = getExistingPathINodes(target); INodeFile trgInode = (INodeFile) trgINodes[trgINodes.length-1]; INodeDirectory trgParent = (INodeDirectory)trgINodes[trgINodes.length-2]; INodeFile [] allSrcInodes = new INodeFile[srcs.length]; int i = 0; int totalBlocks = 0; writeLock(); try { for(String src : srcs) { INodeFile srcInode = getFileINode(src); allSrcInodes[i++] = srcInode; totalBlocks += srcInode.getBlocks().length; } trgInode.getStorage().appendBlocks(allSrcInodes, totalBlocks, trgInode); // copy the blocks // since we are in the same dir - we can use same parent to remove files int count = 0; for(INodeFile nodeToRemove: allSrcInodes) { if(nodeToRemove == null) continue; nodeToRemove.storage = null; trgParent.removeChild(nodeToRemove); inodeMap.remove(nodeToRemove); count++; } trgInode.setModificationTime(now); trgParent.setModificationTime(now); // update quota on the parent directory ('count' files removed, 0 space) unprotectedUpdateCount(trgINodes, trgINodes.length-1, - count, 0); } finally { writeUnlock(); } }
[ "public", "void", "unprotectedConcat", "(", "String", "target", ",", "String", "[", "]", "srcs", ",", "long", "now", ")", "throws", "IOException", "{", "if", "(", "NameNode", ".", "stateChangeLog", ".", "isDebugEnabled", "(", ")", ")", "{", "NameNode", "."...
Concat all the blocks from srcs to trg and delete the srcs files @param target target file to move the blocks to @param srcs list of file to move the blocks from Must be public because also called from EditLogs NOTE: - it does not update quota (not needed for concat)
[ "Concat", "all", "the", "blocks", "from", "srcs", "to", "trg", "and", "delete", "the", "srcs", "files" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L1299-L1341
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java
VirtualNetworkTapsInner.beginUpdateTagsAsync
public Observable<VirtualNetworkTapInner> beginUpdateTagsAsync(String resourceGroupName, String tapName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, tapName).map(new Func1<ServiceResponse<VirtualNetworkTapInner>, VirtualNetworkTapInner>() { @Override public VirtualNetworkTapInner call(ServiceResponse<VirtualNetworkTapInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkTapInner> beginUpdateTagsAsync(String resourceGroupName, String tapName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, tapName).map(new Func1<ServiceResponse<VirtualNetworkTapInner>, VirtualNetworkTapInner>() { @Override public VirtualNetworkTapInner call(ServiceResponse<VirtualNetworkTapInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkTapInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "tapName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "tapName", ")", ".", "map", "(...
Updates an VirtualNetworkTap tags. @param resourceGroupName The name of the resource group. @param tapName The name of the tap. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkTapInner object
[ "Updates", "an", "VirtualNetworkTap", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java#L697-L704
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java
SymmetricCrypto.init
public SymmetricCrypto init(String algorithm, SecretKey key) { this.secretKey = key; if (algorithm.startsWith("PBE")) { // 对于PBE算法使用随机数加盐 this.params = new PBEParameterSpec(RandomUtil.randomBytes(8), 100); } this.cipher = SecureUtil.createCipher(algorithm); return this; }
java
public SymmetricCrypto init(String algorithm, SecretKey key) { this.secretKey = key; if (algorithm.startsWith("PBE")) { // 对于PBE算法使用随机数加盐 this.params = new PBEParameterSpec(RandomUtil.randomBytes(8), 100); } this.cipher = SecureUtil.createCipher(algorithm); return this; }
[ "public", "SymmetricCrypto", "init", "(", "String", "algorithm", ",", "SecretKey", "key", ")", "{", "this", ".", "secretKey", "=", "key", ";", "if", "(", "algorithm", ".", "startsWith", "(", "\"PBE\"", ")", ")", "{", "// 对于PBE算法使用随机数加盐\r", "this", ".", "pa...
初始化 @param algorithm 算法 @param key 密钥,如果为<code>null</code>自动生成一个key @return {@link SymmetricCrypto}
[ "初始化" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java#L127-L135
tvesalainen/util
util/src/main/java/org/vesalainen/bean/BeanHelper.java
BeanHelper.hasProperty
public static final boolean hasProperty(Object bean, String property) { try { return (boolean) doFor( bean, property, null, (Object a, int i)->{return true;}, (List l, int i)->{return true;}, (Object b, Class c, String p)->{getField(c, p);return true;}, (Object b, Method m)->{return true;}); } catch (BeanHelperException ex) { return false; } }
java
public static final boolean hasProperty(Object bean, String property) { try { return (boolean) doFor( bean, property, null, (Object a, int i)->{return true;}, (List l, int i)->{return true;}, (Object b, Class c, String p)->{getField(c, p);return true;}, (Object b, Method m)->{return true;}); } catch (BeanHelperException ex) { return false; } }
[ "public", "static", "final", "boolean", "hasProperty", "(", "Object", "bean", ",", "String", "property", ")", "{", "try", "{", "return", "(", "boolean", ")", "doFor", "(", "bean", ",", "property", ",", "null", ",", "(", "Object", "a", ",", "int", "i", ...
Return true if property exists. @param bean @param property @return
[ "Return", "true", "if", "property", "exists", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L355-L372
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getTopicTitleWithConditions
public static String getTopicTitleWithConditions(final ITopicNode specTopic, final BaseTopicWrapper<?> topic) { final String condition = specTopic.getConditionStatement(true); if (condition != null && topic.getTitle() != null && topic.getTitle().contains("condition")) { try { final Document doc = XMLUtilities.convertStringToDocument("<title>" + topic.getTitle() + "</title>"); // Process the condition on the title DocBookUtilities.processConditions(condition, doc); // Return the processed title return XMLUtilities.convertNodeToString(doc, false); } catch (Exception e) { log.debug(e.getMessage()); } return topic.getTitle(); } else { return topic.getTitle(); } }
java
public static String getTopicTitleWithConditions(final ITopicNode specTopic, final BaseTopicWrapper<?> topic) { final String condition = specTopic.getConditionStatement(true); if (condition != null && topic.getTitle() != null && topic.getTitle().contains("condition")) { try { final Document doc = XMLUtilities.convertStringToDocument("<title>" + topic.getTitle() + "</title>"); // Process the condition on the title DocBookUtilities.processConditions(condition, doc); // Return the processed title return XMLUtilities.convertNodeToString(doc, false); } catch (Exception e) { log.debug(e.getMessage()); } return topic.getTitle(); } else { return topic.getTitle(); } }
[ "public", "static", "String", "getTopicTitleWithConditions", "(", "final", "ITopicNode", "specTopic", ",", "final", "BaseTopicWrapper", "<", "?", ">", "topic", ")", "{", "final", "String", "condition", "=", "specTopic", ".", "getConditionStatement", "(", "true", "...
Gets a Topics title with conditional statements applied @param specTopic The TopicNode of the topic to get the title for. @param topic The actual topic to get the non-processed title from. @return The processed title that has the conditions applied.
[ "Gets", "a", "Topics", "title", "with", "conditional", "statements", "applied" ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L699-L718