repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
FasterXML/jackson-jr
jr-objects/src/main/java/com/fasterxml/jackson/jr/type/TypeBindings.java
TypeBindings.withUnboundVariable
public TypeBindings withUnboundVariable(String name) { """ Method for creating an instance that has same bindings as this object, plus an indicator for additional type variable that may be unbound within this context; this is needed to resolve recursive self-references. """ int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); }
java
public TypeBindings withUnboundVariable(String name) { int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); }
[ "public", "TypeBindings", "withUnboundVariable", "(", "String", "name", ")", "{", "int", "len", "=", "(", "_unboundVariables", "==", "null", ")", "?", "0", ":", "_unboundVariables", ".", "length", ";", "String", "[", "]", "names", "=", "(", "len", "==", "0", ")", "?", "new", "String", "[", "1", "]", ":", "Arrays", ".", "copyOf", "(", "_unboundVariables", ",", "len", "+", "1", ")", ";", "names", "[", "len", "]", "=", "name", ";", "return", "new", "TypeBindings", "(", "_names", ",", "_types", ",", "names", ")", ";", "}" ]
Method for creating an instance that has same bindings as this object, plus an indicator for additional type variable that may be unbound within this context; this is needed to resolve recursive self-references.
[ "Method", "for", "creating", "an", "instance", "that", "has", "same", "bindings", "as", "this", "object", "plus", "an", "indicator", "for", "additional", "type", "variable", "that", "may", "be", "unbound", "within", "this", "context", ";", "this", "is", "needed", "to", "resolve", "recursive", "self", "-", "references", "." ]
train
https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/type/TypeBindings.java#L78-L85
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsGalleryTreeItem.java
CmsGalleryTreeItem.createListWidget
private CmsListItemWidget createListWidget(CmsGalleryFolderEntry galleryFolder) { """ Creates the list item widget for the given folder.<p> @param galleryFolder the gallery folder @return the list item widget """ String title; if (galleryFolder.getOwnProperties().containsKey(CmsClientProperty.PROPERTY_TITLE)) { title = galleryFolder.getOwnProperties().get(CmsClientProperty.PROPERTY_TITLE).getStructureValue(); } else { title = CmsResource.getName(galleryFolder.getSitePath()); if (title.endsWith("/")) { title = title.substring(0, title.length() - 1); } } CmsListInfoBean infoBean = new CmsListInfoBean(title, galleryFolder.getSitePath(), null); CmsListItemWidget result = new CmsGalleryListItemWidget(infoBean); result.setIcon(galleryFolder.getIconClasses()); result.addIconClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry entry) { showGallery(entry); } }); } }); if ((CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()) == null) || CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()).isEditable()) { result.addTitleStyleName(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().itemTitle()); result.setTitleEditable(true); result.setTitleEditHandler(new I_CmsTitleEditHandler() { /** * @see org.opencms.gwt.client.ui.CmsListItemWidget.I_CmsTitleEditHandler#handleEdit(org.opencms.gwt.client.ui.input.CmsLabel, com.google.gwt.user.client.ui.TextBox) */ public void handleEdit(final CmsLabel titleLabel, final TextBox box) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry editEntry) { CmsGalleryTreeItem.this.handleEdit(editEntry, box.getText()); box.removeFromParent(); titleLabel.setVisible(true); } }); } }); } return result; }
java
private CmsListItemWidget createListWidget(CmsGalleryFolderEntry galleryFolder) { String title; if (galleryFolder.getOwnProperties().containsKey(CmsClientProperty.PROPERTY_TITLE)) { title = galleryFolder.getOwnProperties().get(CmsClientProperty.PROPERTY_TITLE).getStructureValue(); } else { title = CmsResource.getName(galleryFolder.getSitePath()); if (title.endsWith("/")) { title = title.substring(0, title.length() - 1); } } CmsListInfoBean infoBean = new CmsListInfoBean(title, galleryFolder.getSitePath(), null); CmsListItemWidget result = new CmsGalleryListItemWidget(infoBean); result.setIcon(galleryFolder.getIconClasses()); result.addIconClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry entry) { showGallery(entry); } }); } }); if ((CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()) == null) || CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()).isEditable()) { result.addTitleStyleName(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().itemTitle()); result.setTitleEditable(true); result.setTitleEditHandler(new I_CmsTitleEditHandler() { /** * @see org.opencms.gwt.client.ui.CmsListItemWidget.I_CmsTitleEditHandler#handleEdit(org.opencms.gwt.client.ui.input.CmsLabel, com.google.gwt.user.client.ui.TextBox) */ public void handleEdit(final CmsLabel titleLabel, final TextBox box) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry editEntry) { CmsGalleryTreeItem.this.handleEdit(editEntry, box.getText()); box.removeFromParent(); titleLabel.setVisible(true); } }); } }); } return result; }
[ "private", "CmsListItemWidget", "createListWidget", "(", "CmsGalleryFolderEntry", "galleryFolder", ")", "{", "String", "title", ";", "if", "(", "galleryFolder", ".", "getOwnProperties", "(", ")", ".", "containsKey", "(", "CmsClientProperty", ".", "PROPERTY_TITLE", ")", ")", "{", "title", "=", "galleryFolder", ".", "getOwnProperties", "(", ")", ".", "get", "(", "CmsClientProperty", ".", "PROPERTY_TITLE", ")", ".", "getStructureValue", "(", ")", ";", "}", "else", "{", "title", "=", "CmsResource", ".", "getName", "(", "galleryFolder", ".", "getSitePath", "(", ")", ")", ";", "if", "(", "title", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "title", "=", "title", ".", "substring", "(", "0", ",", "title", ".", "length", "(", ")", "-", "1", ")", ";", "}", "}", "CmsListInfoBean", "infoBean", "=", "new", "CmsListInfoBean", "(", "title", ",", "galleryFolder", ".", "getSitePath", "(", ")", ",", "null", ")", ";", "CmsListItemWidget", "result", "=", "new", "CmsGalleryListItemWidget", "(", "infoBean", ")", ";", "result", ".", "setIcon", "(", "galleryFolder", ".", "getIconClasses", "(", ")", ")", ";", "result", ".", "addIconClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getController", "(", ")", ".", "loadPath", "(", "getSitePath", "(", ")", ",", "new", "AsyncCallback", "<", "CmsClientSitemapEntry", ">", "(", ")", "{", "public", "void", "onFailure", "(", "Throwable", "caught", ")", "{", "// nothing to do", "}", "public", "void", "onSuccess", "(", "CmsClientSitemapEntry", "entry", ")", "{", "showGallery", "(", "entry", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "if", "(", "(", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getController", "(", ")", ".", "getEntryById", "(", "galleryFolder", ".", "getStructureId", "(", ")", ")", "==", "null", ")", "||", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getController", "(", ")", ".", "getEntryById", "(", "galleryFolder", ".", "getStructureId", "(", ")", ")", ".", "isEditable", "(", ")", ")", "{", "result", ".", "addTitleStyleName", "(", "I_CmsSitemapLayoutBundle", ".", "INSTANCE", ".", "sitemapItemCss", "(", ")", ".", "itemTitle", "(", ")", ")", ";", "result", ".", "setTitleEditable", "(", "true", ")", ";", "result", ".", "setTitleEditHandler", "(", "new", "I_CmsTitleEditHandler", "(", ")", "{", "/**\n * @see org.opencms.gwt.client.ui.CmsListItemWidget.I_CmsTitleEditHandler#handleEdit(org.opencms.gwt.client.ui.input.CmsLabel, com.google.gwt.user.client.ui.TextBox)\n */", "public", "void", "handleEdit", "(", "final", "CmsLabel", "titleLabel", ",", "final", "TextBox", "box", ")", "{", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getController", "(", ")", ".", "loadPath", "(", "getSitePath", "(", ")", ",", "new", "AsyncCallback", "<", "CmsClientSitemapEntry", ">", "(", ")", "{", "public", "void", "onFailure", "(", "Throwable", "caught", ")", "{", "// nothing to do", "}", "public", "void", "onSuccess", "(", "CmsClientSitemapEntry", "editEntry", ")", "{", "CmsGalleryTreeItem", ".", "this", ".", "handleEdit", "(", "editEntry", ",", "box", ".", "getText", "(", ")", ")", ";", "box", ".", "removeFromParent", "(", ")", ";", "titleLabel", ".", "setVisible", "(", "true", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "}", "return", "result", ";", "}" ]
Creates the list item widget for the given folder.<p> @param galleryFolder the gallery folder @return the list item widget
[ "Creates", "the", "list", "item", "widget", "for", "the", "given", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsGalleryTreeItem.java#L240-L306
apache/flink
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java
RocksDBIncrementalRestoreOperation.restoreInstanceDirectoryFromPath
private void restoreInstanceDirectoryFromPath(Path source, String instanceRocksDBPath) throws IOException { """ This recreates the new working directory of the recovered RocksDB instance and links/copies the contents from a local state. """ FileSystem fileSystem = source.getFileSystem(); final FileStatus[] fileStatuses = fileSystem.listStatus(source); if (fileStatuses == null) { throw new IOException("Cannot list file statues. Directory " + source + " does not exist."); } for (FileStatus fileStatus : fileStatuses) { final Path filePath = fileStatus.getPath(); final String fileName = filePath.getName(); File restoreFile = new File(source.getPath(), fileName); File targetFile = new File(instanceRocksDBPath, fileName); if (fileName.endsWith(SST_FILE_SUFFIX)) { // hardlink'ing the immutable sst-files. Files.createLink(targetFile.toPath(), restoreFile.toPath()); } else { // true copy for all other files. Files.copy(restoreFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } } }
java
private void restoreInstanceDirectoryFromPath(Path source, String instanceRocksDBPath) throws IOException { FileSystem fileSystem = source.getFileSystem(); final FileStatus[] fileStatuses = fileSystem.listStatus(source); if (fileStatuses == null) { throw new IOException("Cannot list file statues. Directory " + source + " does not exist."); } for (FileStatus fileStatus : fileStatuses) { final Path filePath = fileStatus.getPath(); final String fileName = filePath.getName(); File restoreFile = new File(source.getPath(), fileName); File targetFile = new File(instanceRocksDBPath, fileName); if (fileName.endsWith(SST_FILE_SUFFIX)) { // hardlink'ing the immutable sst-files. Files.createLink(targetFile.toPath(), restoreFile.toPath()); } else { // true copy for all other files. Files.copy(restoreFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } } }
[ "private", "void", "restoreInstanceDirectoryFromPath", "(", "Path", "source", ",", "String", "instanceRocksDBPath", ")", "throws", "IOException", "{", "FileSystem", "fileSystem", "=", "source", ".", "getFileSystem", "(", ")", ";", "final", "FileStatus", "[", "]", "fileStatuses", "=", "fileSystem", ".", "listStatus", "(", "source", ")", ";", "if", "(", "fileStatuses", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Cannot list file statues. Directory \"", "+", "source", "+", "\" does not exist.\"", ")", ";", "}", "for", "(", "FileStatus", "fileStatus", ":", "fileStatuses", ")", "{", "final", "Path", "filePath", "=", "fileStatus", ".", "getPath", "(", ")", ";", "final", "String", "fileName", "=", "filePath", ".", "getName", "(", ")", ";", "File", "restoreFile", "=", "new", "File", "(", "source", ".", "getPath", "(", ")", ",", "fileName", ")", ";", "File", "targetFile", "=", "new", "File", "(", "instanceRocksDBPath", ",", "fileName", ")", ";", "if", "(", "fileName", ".", "endsWith", "(", "SST_FILE_SUFFIX", ")", ")", "{", "// hardlink'ing the immutable sst-files.", "Files", ".", "createLink", "(", "targetFile", ".", "toPath", "(", ")", ",", "restoreFile", ".", "toPath", "(", ")", ")", ";", "}", "else", "{", "// true copy for all other files.", "Files", ".", "copy", "(", "restoreFile", ".", "toPath", "(", ")", ",", "targetFile", ".", "toPath", "(", ")", ",", "StandardCopyOption", ".", "REPLACE_EXISTING", ")", ";", "}", "}", "}" ]
This recreates the new working directory of the recovered RocksDB instance and links/copies the contents from a local state.
[ "This", "recreates", "the", "new", "working", "directory", "of", "the", "recovered", "RocksDB", "instance", "and", "links", "/", "copies", "the", "contents", "from", "a", "local", "state", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java#L456-L479
wisdom-framework/wisdom
core/application-configuration/src/main/java/org/wisdom/configuration/ApplicationConfigurationImpl.java
ApplicationConfigurationImpl.getFileWithDefault
@Override public File getFileWithDefault(String key, String file) { """ Get a File property or a default value when property cannot be found in any configuration file. The file object is constructed using <code>new File(basedir, value)</code>. @param key the key @param file the default file @return the file object """ String value = get(key); if (value == null) { return new File(baseDirectory, file); } else { return new File(baseDirectory, value); } }
java
@Override public File getFileWithDefault(String key, String file) { String value = get(key); if (value == null) { return new File(baseDirectory, file); } else { return new File(baseDirectory, value); } }
[ "@", "Override", "public", "File", "getFileWithDefault", "(", "String", "key", ",", "String", "file", ")", "{", "String", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "new", "File", "(", "baseDirectory", ",", "file", ")", ";", "}", "else", "{", "return", "new", "File", "(", "baseDirectory", ",", "value", ")", ";", "}", "}" ]
Get a File property or a default value when property cannot be found in any configuration file. The file object is constructed using <code>new File(basedir, value)</code>. @param key the key @param file the default file @return the file object
[ "Get", "a", "File", "property", "or", "a", "default", "value", "when", "property", "cannot", "be", "found", "in", "any", "configuration", "file", ".", "The", "file", "object", "is", "constructed", "using", "<code", ">", "new", "File", "(", "basedir", "value", ")", "<", "/", "code", ">", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ApplicationConfigurationImpl.java#L291-L299
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerBackendAddressPoolsInner.java
LoadBalancerBackendAddressPoolsInner.getAsync
public Observable<BackendAddressPoolInner> getAsync(String resourceGroupName, String loadBalancerName, String backendAddressPoolName) { """ Gets load balancer backend address pool. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param backendAddressPoolName The name of the backend address pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackendAddressPoolInner object """ return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, backendAddressPoolName).map(new Func1<ServiceResponse<BackendAddressPoolInner>, BackendAddressPoolInner>() { @Override public BackendAddressPoolInner call(ServiceResponse<BackendAddressPoolInner> response) { return response.body(); } }); }
java
public Observable<BackendAddressPoolInner> getAsync(String resourceGroupName, String loadBalancerName, String backendAddressPoolName) { return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, backendAddressPoolName).map(new Func1<ServiceResponse<BackendAddressPoolInner>, BackendAddressPoolInner>() { @Override public BackendAddressPoolInner call(ServiceResponse<BackendAddressPoolInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackendAddressPoolInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "String", "backendAddressPoolName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBalancerName", ",", "backendAddressPoolName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "BackendAddressPoolInner", ">", ",", "BackendAddressPoolInner", ">", "(", ")", "{", "@", "Override", "public", "BackendAddressPoolInner", "call", "(", "ServiceResponse", "<", "BackendAddressPoolInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets load balancer backend address pool. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param backendAddressPoolName The name of the backend address pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackendAddressPoolInner object
[ "Gets", "load", "balancer", "backend", "address", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerBackendAddressPoolsInner.java#L233-L240
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java
CompositesIndex.getIndexComparator
public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cfDef) { """ Check SecondaryIndex.getIndexComparator if you want to know why this is static """ if (cfDef.type.isCollection() && cfDef.type.isMultiCell()) { switch (((CollectionType)cfDef.type).kind) { case LIST: return CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef); case SET: return CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef); case MAP: return cfDef.hasIndexOption(SecondaryIndex.INDEX_KEYS_OPTION_NAME) ? CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef) : CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef); } } switch (cfDef.kind) { case CLUSTERING_COLUMN: return CompositesIndexOnClusteringKey.buildIndexComparator(baseMetadata, cfDef); case REGULAR: return CompositesIndexOnRegular.buildIndexComparator(baseMetadata, cfDef); case PARTITION_KEY: return CompositesIndexOnPartitionKey.buildIndexComparator(baseMetadata, cfDef); //case COMPACT_VALUE: // return CompositesIndexOnCompactValue.buildIndexComparator(baseMetadata, cfDef); } throw new AssertionError(); }
java
public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cfDef) { if (cfDef.type.isCollection() && cfDef.type.isMultiCell()) { switch (((CollectionType)cfDef.type).kind) { case LIST: return CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef); case SET: return CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef); case MAP: return cfDef.hasIndexOption(SecondaryIndex.INDEX_KEYS_OPTION_NAME) ? CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef) : CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef); } } switch (cfDef.kind) { case CLUSTERING_COLUMN: return CompositesIndexOnClusteringKey.buildIndexComparator(baseMetadata, cfDef); case REGULAR: return CompositesIndexOnRegular.buildIndexComparator(baseMetadata, cfDef); case PARTITION_KEY: return CompositesIndexOnPartitionKey.buildIndexComparator(baseMetadata, cfDef); //case COMPACT_VALUE: // return CompositesIndexOnCompactValue.buildIndexComparator(baseMetadata, cfDef); } throw new AssertionError(); }
[ "public", "static", "CellNameType", "getIndexComparator", "(", "CFMetaData", "baseMetadata", ",", "ColumnDefinition", "cfDef", ")", "{", "if", "(", "cfDef", ".", "type", ".", "isCollection", "(", ")", "&&", "cfDef", ".", "type", ".", "isMultiCell", "(", ")", ")", "{", "switch", "(", "(", "(", "CollectionType", ")", "cfDef", ".", "type", ")", ".", "kind", ")", "{", "case", "LIST", ":", "return", "CompositesIndexOnCollectionValue", ".", "buildIndexComparator", "(", "baseMetadata", ",", "cfDef", ")", ";", "case", "SET", ":", "return", "CompositesIndexOnCollectionKey", ".", "buildIndexComparator", "(", "baseMetadata", ",", "cfDef", ")", ";", "case", "MAP", ":", "return", "cfDef", ".", "hasIndexOption", "(", "SecondaryIndex", ".", "INDEX_KEYS_OPTION_NAME", ")", "?", "CompositesIndexOnCollectionKey", ".", "buildIndexComparator", "(", "baseMetadata", ",", "cfDef", ")", ":", "CompositesIndexOnCollectionValue", ".", "buildIndexComparator", "(", "baseMetadata", ",", "cfDef", ")", ";", "}", "}", "switch", "(", "cfDef", ".", "kind", ")", "{", "case", "CLUSTERING_COLUMN", ":", "return", "CompositesIndexOnClusteringKey", ".", "buildIndexComparator", "(", "baseMetadata", ",", "cfDef", ")", ";", "case", "REGULAR", ":", "return", "CompositesIndexOnRegular", ".", "buildIndexComparator", "(", "baseMetadata", ",", "cfDef", ")", ";", "case", "PARTITION_KEY", ":", "return", "CompositesIndexOnPartitionKey", ".", "buildIndexComparator", "(", "baseMetadata", ",", "cfDef", ")", ";", "//case COMPACT_VALUE:", "// return CompositesIndexOnCompactValue.buildIndexComparator(baseMetadata, cfDef);", "}", "throw", "new", "AssertionError", "(", ")", ";", "}" ]
Check SecondaryIndex.getIndexComparator if you want to know why this is static
[ "Check", "SecondaryIndex", ".", "getIndexComparator", "if", "you", "want", "to", "know", "why", "this", "is", "static" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java#L91-L120
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.createShapeInformation
public static DataBuffer createShapeInformation(int[] shape, int[] stride, long offset, int elementWiseStride, char order) { """ Creates the shape information buffer given the shape,stride @param shape the shape for the buffer @param stride the stride for the buffer @param offset the offset for the buffer @param elementWiseStride the element wise stride for the buffer @param order the order for the buffer @return the shape information buffer given the parameters """ if (shape.length != stride.length) throw new IllegalStateException("Shape and stride must be the same length"); int rank = shape.length; int shapeBuffer[] = new int[rank * 2 + 4]; shapeBuffer[0] = rank; int count = 1; for (int e = 0; e < shape.length; e++) shapeBuffer[count++] = shape[e]; for (int e = 0; e < stride.length; e++) shapeBuffer[count++] = stride[e]; shapeBuffer[count++] = (int) offset; shapeBuffer[count++] = elementWiseStride; shapeBuffer[count] = (int) order; DataBuffer ret = Nd4j.createBufferDetached(shapeBuffer); ret.setConstant(true); return ret; }
java
public static DataBuffer createShapeInformation(int[] shape, int[] stride, long offset, int elementWiseStride, char order) { if (shape.length != stride.length) throw new IllegalStateException("Shape and stride must be the same length"); int rank = shape.length; int shapeBuffer[] = new int[rank * 2 + 4]; shapeBuffer[0] = rank; int count = 1; for (int e = 0; e < shape.length; e++) shapeBuffer[count++] = shape[e]; for (int e = 0; e < stride.length; e++) shapeBuffer[count++] = stride[e]; shapeBuffer[count++] = (int) offset; shapeBuffer[count++] = elementWiseStride; shapeBuffer[count] = (int) order; DataBuffer ret = Nd4j.createBufferDetached(shapeBuffer); ret.setConstant(true); return ret; }
[ "public", "static", "DataBuffer", "createShapeInformation", "(", "int", "[", "]", "shape", ",", "int", "[", "]", "stride", ",", "long", "offset", ",", "int", "elementWiseStride", ",", "char", "order", ")", "{", "if", "(", "shape", ".", "length", "!=", "stride", ".", "length", ")", "throw", "new", "IllegalStateException", "(", "\"Shape and stride must be the same length\"", ")", ";", "int", "rank", "=", "shape", ".", "length", ";", "int", "shapeBuffer", "[", "]", "=", "new", "int", "[", "rank", "*", "2", "+", "4", "]", ";", "shapeBuffer", "[", "0", "]", "=", "rank", ";", "int", "count", "=", "1", ";", "for", "(", "int", "e", "=", "0", ";", "e", "<", "shape", ".", "length", ";", "e", "++", ")", "shapeBuffer", "[", "count", "++", "]", "=", "shape", "[", "]", ";", "for", "(", "int", "e", "=", "0", ";", "e", "<", "stride", ".", "length", ";", "e", "++", ")", "shapeBuffer", "[", "count", "++", "]", "=", "stride", "[", "]", ";", "shapeBuffer", "[", "count", "++", "]", "=", "(", "int", ")", "offset", ";", "shapeBuffer", "[", "count", "++", "]", "=", "elementWiseStride", ";", "shapeBuffer", "[", "count", "]", "=", "(", "int", ")", "order", ";", "DataBuffer", "ret", "=", "Nd4j", ".", "createBufferDetached", "(", "shapeBuffer", ")", ";", "ret", ".", "setConstant", "(", "true", ")", ";", "return", "ret", ";", "}" ]
Creates the shape information buffer given the shape,stride @param shape the shape for the buffer @param stride the stride for the buffer @param offset the offset for the buffer @param elementWiseStride the element wise stride for the buffer @param order the order for the buffer @return the shape information buffer given the parameters
[ "Creates", "the", "shape", "information", "buffer", "given", "the", "shape", "stride" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3170-L3192
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/SoftAllocationUrl.java
SoftAllocationUrl.getSoftAllocationUrl
public static MozuUrl getSoftAllocationUrl(String responseFields, Integer softAllocationId) { """ Get Resource Url for GetSoftAllocation @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param softAllocationId The unique identifier of the soft allocation. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/softallocations/{softAllocationId}?responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("softAllocationId", softAllocationId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getSoftAllocationUrl(String responseFields, Integer softAllocationId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/softallocations/{softAllocationId}?responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("softAllocationId", softAllocationId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getSoftAllocationUrl", "(", "String", "responseFields", ",", "Integer", "softAllocationId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/softallocations/{softAllocationId}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "formatter", ".", "formatUrl", "(", "\"softAllocationId\"", ",", "softAllocationId", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetSoftAllocation @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param softAllocationId The unique identifier of the soft allocation. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetSoftAllocation" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/SoftAllocationUrl.java#L42-L48
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemcpyArrayToArray
public static int cudaMemcpyArrayToArray(cudaArray dst, long wOffsetDst, long hOffsetDst, cudaArray src, long wOffsetSrc, long hOffsetSrc, long count, int cudaMemcpyKind_kind) { """ Copies data between host and device. <pre> cudaError_t cudaMemcpyArrayToArray ( cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind = cudaMemcpyDeviceToDevice ) </pre> <div> <p>Copies data between host and device. Copies <tt>count</tt> bytes from the CUDA array <tt>src</tt> starting at the upper left corner (<tt>wOffsetSrc</tt>, <tt>hOffsetSrc</tt>) to the CUDA array <tt>dst</tt> starting at the upper left corner (<tt>wOffsetDst</tt>, <tt>hOffsetDst</tt>) where <tt>kind</tt> is one of cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost, or cudaMemcpyDeviceToDevice, and specifies the direction of the copy. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param dst Destination memory address @param wOffsetDst Destination starting X offset @param hOffsetDst Destination starting Y offset @param src Source memory address @param wOffsetSrc Source starting X offset @param hOffsetSrc Source starting Y offset @param count Size in bytes to copy @param kind Type of transfer @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidMemcpyDirection @see JCuda#cudaMemcpy @see JCuda#cudaMemcpy2D @see JCuda#cudaMemcpyToArray @see JCuda#cudaMemcpy2DToArray @see JCuda#cudaMemcpyFromArray @see JCuda#cudaMemcpy2DFromArray @see JCuda#cudaMemcpy2DArrayToArray @see JCuda#cudaMemcpyToSymbol @see JCuda#cudaMemcpyFromSymbol @see JCuda#cudaMemcpyAsync @see JCuda#cudaMemcpy2DAsync @see JCuda#cudaMemcpyToArrayAsync @see JCuda#cudaMemcpy2DToArrayAsync @see JCuda#cudaMemcpyFromArrayAsync @see JCuda#cudaMemcpy2DFromArrayAsync @see JCuda#cudaMemcpyToSymbolAsync @see JCuda#cudaMemcpyFromSymbolAsync """ return checkResult(cudaMemcpyArrayToArrayNative(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, cudaMemcpyKind_kind)); }
java
public static int cudaMemcpyArrayToArray(cudaArray dst, long wOffsetDst, long hOffsetDst, cudaArray src, long wOffsetSrc, long hOffsetSrc, long count, int cudaMemcpyKind_kind) { return checkResult(cudaMemcpyArrayToArrayNative(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, cudaMemcpyKind_kind)); }
[ "public", "static", "int", "cudaMemcpyArrayToArray", "(", "cudaArray", "dst", ",", "long", "wOffsetDst", ",", "long", "hOffsetDst", ",", "cudaArray", "src", ",", "long", "wOffsetSrc", ",", "long", "hOffsetSrc", ",", "long", "count", ",", "int", "cudaMemcpyKind_kind", ")", "{", "return", "checkResult", "(", "cudaMemcpyArrayToArrayNative", "(", "dst", ",", "wOffsetDst", ",", "hOffsetDst", ",", "src", ",", "wOffsetSrc", ",", "hOffsetSrc", ",", "count", ",", "cudaMemcpyKind_kind", ")", ")", ";", "}" ]
Copies data between host and device. <pre> cudaError_t cudaMemcpyArrayToArray ( cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind = cudaMemcpyDeviceToDevice ) </pre> <div> <p>Copies data between host and device. Copies <tt>count</tt> bytes from the CUDA array <tt>src</tt> starting at the upper left corner (<tt>wOffsetSrc</tt>, <tt>hOffsetSrc</tt>) to the CUDA array <tt>dst</tt> starting at the upper left corner (<tt>wOffsetDst</tt>, <tt>hOffsetDst</tt>) where <tt>kind</tt> is one of cudaMemcpyHostToHost, cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost, or cudaMemcpyDeviceToDevice, and specifies the direction of the copy. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param dst Destination memory address @param wOffsetDst Destination starting X offset @param hOffsetDst Destination starting Y offset @param src Source memory address @param wOffsetSrc Source starting X offset @param hOffsetSrc Source starting Y offset @param count Size in bytes to copy @param kind Type of transfer @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidMemcpyDirection @see JCuda#cudaMemcpy @see JCuda#cudaMemcpy2D @see JCuda#cudaMemcpyToArray @see JCuda#cudaMemcpy2DToArray @see JCuda#cudaMemcpyFromArray @see JCuda#cudaMemcpy2DFromArray @see JCuda#cudaMemcpy2DArrayToArray @see JCuda#cudaMemcpyToSymbol @see JCuda#cudaMemcpyFromSymbol @see JCuda#cudaMemcpyAsync @see JCuda#cudaMemcpy2DAsync @see JCuda#cudaMemcpyToArrayAsync @see JCuda#cudaMemcpy2DToArrayAsync @see JCuda#cudaMemcpyFromArrayAsync @see JCuda#cudaMemcpy2DFromArrayAsync @see JCuda#cudaMemcpyToSymbolAsync @see JCuda#cudaMemcpyFromSymbolAsync
[ "Copies", "data", "between", "host", "and", "device", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L4889-L4892
derari/cthul
matchers/src/main/java/org/cthul/matchers/diagnose/nested/NestedMatcher.java
NestedMatcher.nestedMatch
protected boolean nestedMatch(Matcher<?> matcher, Object item, Description mismatch) { """ Invokes {@link #quickMatch(org.hamcrest.Matcher, java.lang.Object, org.hamcrest.Description)} for {@code m}, enclosed in parantheses if necessary. @param matcher @param item @param mismatch @return """ return Nested.matches(this, matcher, item, mismatch); }
java
protected boolean nestedMatch(Matcher<?> matcher, Object item, Description mismatch) { return Nested.matches(this, matcher, item, mismatch); }
[ "protected", "boolean", "nestedMatch", "(", "Matcher", "<", "?", ">", "matcher", ",", "Object", "item", ",", "Description", "mismatch", ")", "{", "return", "Nested", ".", "matches", "(", "this", ",", "matcher", ",", "item", ",", "mismatch", ")", ";", "}" ]
Invokes {@link #quickMatch(org.hamcrest.Matcher, java.lang.Object, org.hamcrest.Description)} for {@code m}, enclosed in parantheses if necessary. @param matcher @param item @param mismatch @return
[ "Invokes", "{" ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/matchers/src/main/java/org/cthul/matchers/diagnose/nested/NestedMatcher.java#L50-L52
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listModelsAsync
public Observable<List<ModelInfoResponse>> listModelsAsync(UUID appId, String versionId, ListModelsOptionalParameter listModelsOptionalParameter) { """ Gets information about the application version models. @param appId The application ID. @param versionId The version ID. @param listModelsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ModelInfoResponse&gt; object """ return listModelsWithServiceResponseAsync(appId, versionId, listModelsOptionalParameter).map(new Func1<ServiceResponse<List<ModelInfoResponse>>, List<ModelInfoResponse>>() { @Override public List<ModelInfoResponse> call(ServiceResponse<List<ModelInfoResponse>> response) { return response.body(); } }); }
java
public Observable<List<ModelInfoResponse>> listModelsAsync(UUID appId, String versionId, ListModelsOptionalParameter listModelsOptionalParameter) { return listModelsWithServiceResponseAsync(appId, versionId, listModelsOptionalParameter).map(new Func1<ServiceResponse<List<ModelInfoResponse>>, List<ModelInfoResponse>>() { @Override public List<ModelInfoResponse> call(ServiceResponse<List<ModelInfoResponse>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ModelInfoResponse", ">", ">", "listModelsAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListModelsOptionalParameter", "listModelsOptionalParameter", ")", "{", "return", "listModelsWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "listModelsOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "ModelInfoResponse", ">", ">", ",", "List", "<", "ModelInfoResponse", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "ModelInfoResponse", ">", "call", "(", "ServiceResponse", "<", "List", "<", "ModelInfoResponse", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets information about the application version models. @param appId The application ID. @param versionId The version ID. @param listModelsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ModelInfoResponse&gt; object
[ "Gets", "information", "about", "the", "application", "version", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2472-L2479
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java
JDBCResultSet.updateTime
public void updateTime(String columnLabel, Time x) throws SQLException { """ <!-- start generic documentation --> Updates the designated column with a <code>java.sql.Time</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column @param x the new column value @exception SQLException if a database access error occurs, the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCResultSet) """ updateTime(findColumn(columnLabel), x); }
java
public void updateTime(String columnLabel, Time x) throws SQLException { updateTime(findColumn(columnLabel), x); }
[ "public", "void", "updateTime", "(", "String", "columnLabel", ",", "Time", "x", ")", "throws", "SQLException", "{", "updateTime", "(", "findColumn", "(", "columnLabel", ")", ",", "x", ")", ";", "}" ]
<!-- start generic documentation --> Updates the designated column with a <code>java.sql.Time</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column @param x the new column value @exception SQLException if a database access error occurs, the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCResultSet)
[ "<!", "--", "start", "generic", "documentation", "--", ">", "Updates", "the", "designated", "column", "with", "a", "<code", ">", "java", ".", "sql", ".", "Time<", "/", "code", ">", "value", ".", "The", "updater", "methods", "are", "used", "to", "update", "column", "values", "in", "the", "current", "row", "or", "the", "insert", "row", ".", "The", "updater", "methods", "do", "not", "update", "the", "underlying", "database", ";", "instead", "the", "<code", ">", "updateRow<", "/", "code", ">", "or", "<code", ">", "insertRow<", "/", "code", ">", "methods", "are", "called", "to", "update", "the", "database", ".", "<!", "--", "end", "generic", "documentation", "--", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L3641-L3643
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java
RpcProtocolVersionsUtil.isGreaterThanOrEqualTo
@VisibleForTesting static boolean isGreaterThanOrEqualTo(Version first, Version second) { """ Returns true if first Rpc Protocol Version is greater than or equal to the second one. Returns false otherwise. """ if ((first.getMajor() > second.getMajor()) || (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) { return true; } return false; }
java
@VisibleForTesting static boolean isGreaterThanOrEqualTo(Version first, Version second) { if ((first.getMajor() > second.getMajor()) || (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) { return true; } return false; }
[ "@", "VisibleForTesting", "static", "boolean", "isGreaterThanOrEqualTo", "(", "Version", "first", ",", "Version", "second", ")", "{", "if", "(", "(", "first", ".", "getMajor", "(", ")", ">", "second", ".", "getMajor", "(", ")", ")", "||", "(", "first", ".", "getMajor", "(", ")", "==", "second", ".", "getMajor", "(", ")", "&&", "first", ".", "getMinor", "(", ")", ">=", "second", ".", "getMinor", "(", ")", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Returns true if first Rpc Protocol Version is greater than or equal to the second one. Returns false otherwise.
[ "Returns", "true", "if", "first", "Rpc", "Protocol", "Version", "is", "greater", "than", "or", "equal", "to", "the", "second", "one", ".", "Returns", "false", "otherwise", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java#L53-L60
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.unsubscribeAllDeletedResources
public void unsubscribeAllDeletedResources(CmsRequestContext context, String poolName, long deletedTo) throws CmsException { """ Unsubscribes all deleted resources that were deleted before the specified time stamp.<p> @param context the request context @param poolName the name of the database pool to use @param deletedTo the time stamp to which the resources have been deleted @throws CmsException if something goes wrong """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.unsubscribeAllDeletedResources(dbc, poolName, deletedTo); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_UNSUBSCRIBE_ALL_DELETED_RESOURCES_USER_0), e); } finally { dbc.clear(); } }
java
public void unsubscribeAllDeletedResources(CmsRequestContext context, String poolName, long deletedTo) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.unsubscribeAllDeletedResources(dbc, poolName, deletedTo); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_UNSUBSCRIBE_ALL_DELETED_RESOURCES_USER_0), e); } finally { dbc.clear(); } }
[ "public", "void", "unsubscribeAllDeletedResources", "(", "CmsRequestContext", "context", ",", "String", "poolName", ",", "long", "deletedTo", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "m_driverManager", ".", "unsubscribeAllDeletedResources", "(", "dbc", ",", "poolName", ",", "deletedTo", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_UNSUBSCRIBE_ALL_DELETED_RESOURCES_USER_0", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Unsubscribes all deleted resources that were deleted before the specified time stamp.<p> @param context the request context @param poolName the name of the database pool to use @param deletedTo the time stamp to which the resources have been deleted @throws CmsException if something goes wrong
[ "Unsubscribes", "all", "deleted", "resources", "that", "were", "deleted", "before", "the", "specified", "time", "stamp", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6331-L6344
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Compound.java
Compound.field2inout
public void field2inout(Object o, String field, Object comp, String inout) { """ Maps a field to an In and Out field @param o the object @param field the field name @param comp the component @param inout the field tagged with In and Out """ controller.mapInField(o, field, comp, inout); controller.mapOutField(comp, inout, o, field); }
java
public void field2inout(Object o, String field, Object comp, String inout) { controller.mapInField(o, field, comp, inout); controller.mapOutField(comp, inout, o, field); }
[ "public", "void", "field2inout", "(", "Object", "o", ",", "String", "field", ",", "Object", "comp", ",", "String", "inout", ")", "{", "controller", ".", "mapInField", "(", "o", ",", "field", ",", "comp", ",", "inout", ")", ";", "controller", ".", "mapOutField", "(", "comp", ",", "inout", ",", "o", ",", "field", ")", ";", "}" ]
Maps a field to an In and Out field @param o the object @param field the field name @param comp the component @param inout the field tagged with In and Out
[ "Maps", "a", "field", "to", "an", "In", "and", "Out", "field" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L167-L170
uniform-java/uniform
src/main/java/net/uniform/impl/ElementWithOptions.java
ElementWithOptions.addOptionToGroup
public ElementWithOptions addOptionToGroup(Option option, String groupId) { """ Adds an option to the group of this element with the given id. If the group is not found, it's created with null text. @param option New option with unique value in this element @param groupId Id of the option group @return This element """ if (option == null) { throw new IllegalArgumentException("Option cannot be null"); } for (OptionGroup group : optionGroups.values()) { if (group.hasValue(option.getValue())) { throw new IllegalArgumentException("The value '" + option.getValue() + "' is already present in this element"); } } OptionGroup group = optionGroups.get(groupId); if (group == null) { group = new OptionGroup(groupId, null); this.addOptionGroup(group); } group.addOption(option); return this; }
java
public ElementWithOptions addOptionToGroup(Option option, String groupId) { if (option == null) { throw new IllegalArgumentException("Option cannot be null"); } for (OptionGroup group : optionGroups.values()) { if (group.hasValue(option.getValue())) { throw new IllegalArgumentException("The value '" + option.getValue() + "' is already present in this element"); } } OptionGroup group = optionGroups.get(groupId); if (group == null) { group = new OptionGroup(groupId, null); this.addOptionGroup(group); } group.addOption(option); return this; }
[ "public", "ElementWithOptions", "addOptionToGroup", "(", "Option", "option", ",", "String", "groupId", ")", "{", "if", "(", "option", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Option cannot be null\"", ")", ";", "}", "for", "(", "OptionGroup", "group", ":", "optionGroups", ".", "values", "(", ")", ")", "{", "if", "(", "group", ".", "hasValue", "(", "option", ".", "getValue", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The value '\"", "+", "option", ".", "getValue", "(", ")", "+", "\"' is already present in this element\"", ")", ";", "}", "}", "OptionGroup", "group", "=", "optionGroups", ".", "get", "(", "groupId", ")", ";", "if", "(", "group", "==", "null", ")", "{", "group", "=", "new", "OptionGroup", "(", "groupId", ",", "null", ")", ";", "this", ".", "addOptionGroup", "(", "group", ")", ";", "}", "group", ".", "addOption", "(", "option", ")", ";", "return", "this", ";", "}" ]
Adds an option to the group of this element with the given id. If the group is not found, it's created with null text. @param option New option with unique value in this element @param groupId Id of the option group @return This element
[ "Adds", "an", "option", "to", "the", "group", "of", "this", "element", "with", "the", "given", "id", ".", "If", "the", "group", "is", "not", "found", "it", "s", "created", "with", "null", "text", "." ]
train
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L106-L127
gallandarakhneorg/afc
advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java
Log4jIntegrationModule.provideRootLogger
@SuppressWarnings("static-method") @Singleton @Provides public Logger provideRootLogger(ConfigurationFactory configFactory, Provider<Log4jIntegrationConfig> config) { """ Provide the root logger. @param configFactory the factory of configurations. @param config the logger configuration. @return the root logger. """ final Logger root = Logger.getRootLogger(); // Reroute JUL SLF4JBridgeHandler.removeHandlersForRootLogger(); SLF4JBridgeHandler.install(); final Log4jIntegrationConfig cfg = config.get(); if (!cfg.getUseLog4jConfig()) { cfg.configureLogger(root); } return root; }
java
@SuppressWarnings("static-method") @Singleton @Provides public Logger provideRootLogger(ConfigurationFactory configFactory, Provider<Log4jIntegrationConfig> config) { final Logger root = Logger.getRootLogger(); // Reroute JUL SLF4JBridgeHandler.removeHandlersForRootLogger(); SLF4JBridgeHandler.install(); final Log4jIntegrationConfig cfg = config.get(); if (!cfg.getUseLog4jConfig()) { cfg.configureLogger(root); } return root; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Singleton", "@", "Provides", "public", "Logger", "provideRootLogger", "(", "ConfigurationFactory", "configFactory", ",", "Provider", "<", "Log4jIntegrationConfig", ">", "config", ")", "{", "final", "Logger", "root", "=", "Logger", ".", "getRootLogger", "(", ")", ";", "// Reroute JUL", "SLF4JBridgeHandler", ".", "removeHandlersForRootLogger", "(", ")", ";", "SLF4JBridgeHandler", ".", "install", "(", ")", ";", "final", "Log4jIntegrationConfig", "cfg", "=", "config", ".", "get", "(", ")", ";", "if", "(", "!", "cfg", ".", "getUseLog4jConfig", "(", ")", ")", "{", "cfg", ".", "configureLogger", "(", "root", ")", ";", "}", "return", "root", ";", "}" ]
Provide the root logger. @param configFactory the factory of configurations. @param config the logger configuration. @return the root logger.
[ "Provide", "the", "root", "logger", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java#L89-L102
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
TypeAnnotationPosition.typeCast
public static TypeAnnotationPosition typeCast(final List<TypePathEntry> location, final int type_index) { """ Create a {@code TypeAnnotationPosition} for a type cast. @param location The type path. @param type_index The index into an intersection type. """ return typeCast(location, null, type_index, -1); }
java
public static TypeAnnotationPosition typeCast(final List<TypePathEntry> location, final int type_index) { return typeCast(location, null, type_index, -1); }
[ "public", "static", "TypeAnnotationPosition", "typeCast", "(", "final", "List", "<", "TypePathEntry", ">", "location", ",", "final", "int", "type_index", ")", "{", "return", "typeCast", "(", "location", ",", "null", ",", "type_index", ",", "-", "1", ")", ";", "}" ]
Create a {@code TypeAnnotationPosition} for a type cast. @param location The type path. @param type_index The index into an intersection type.
[ "Create", "a", "{", "@code", "TypeAnnotationPosition", "}", "for", "a", "type", "cast", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java#L878-L882
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
XSLTAttributeDef.processPREFIX_URLLIST
StringVector processPREFIX_URLLIST( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { """ Process an attribute string of type T_URLLIST into a vector of prefixes that may be resolved to URLs. @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value A list of whitespace delimited prefixes. @return A vector of strings that may be resolved to URLs. @throws org.xml.sax.SAXException if one of the prefixes can not be resolved. """ StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nStrings = tokenizer.countTokens(); StringVector strings = new StringVector(nStrings); for (int i = 0; i < nStrings; i++) { String prefix = tokenizer.nextToken(); String url = handler.getNamespaceForPrefix(prefix); if (url != null) strings.addElement(url); else throw new org.xml.sax.SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, new Object[] {prefix})); } return strings; }
java
StringVector processPREFIX_URLLIST( StylesheetHandler handler, String uri, String name, String rawName, String value) throws org.xml.sax.SAXException { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nStrings = tokenizer.countTokens(); StringVector strings = new StringVector(nStrings); for (int i = 0; i < nStrings; i++) { String prefix = tokenizer.nextToken(); String url = handler.getNamespaceForPrefix(prefix); if (url != null) strings.addElement(url); else throw new org.xml.sax.SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, new Object[] {prefix})); } return strings; }
[ "StringVector", "processPREFIX_URLLIST", "(", "StylesheetHandler", "handler", ",", "String", "uri", ",", "String", "name", ",", "String", "rawName", ",", "String", "value", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "value", ",", "\" \\t\\n\\r\\f\"", ")", ";", "int", "nStrings", "=", "tokenizer", ".", "countTokens", "(", ")", ";", "StringVector", "strings", "=", "new", "StringVector", "(", "nStrings", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nStrings", ";", "i", "++", ")", "{", "String", "prefix", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "String", "url", "=", "handler", ".", "getNamespaceForPrefix", "(", "prefix", ")", ";", "if", "(", "url", "!=", "null", ")", "strings", ".", "addElement", "(", "url", ")", ";", "else", "throw", "new", "org", ".", "xml", ".", "sax", ".", "SAXException", "(", "XSLMessages", ".", "createMessage", "(", "XSLTErrorResources", ".", "ER_CANT_RESOLVE_NSPREFIX", ",", "new", "Object", "[", "]", "{", "prefix", "}", ")", ")", ";", "}", "return", "strings", ";", "}" ]
Process an attribute string of type T_URLLIST into a vector of prefixes that may be resolved to URLs. @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value A list of whitespace delimited prefixes. @return A vector of strings that may be resolved to URLs. @throws org.xml.sax.SAXException if one of the prefixes can not be resolved.
[ "Process", "an", "attribute", "string", "of", "type", "T_URLLIST", "into", "a", "vector", "of", "prefixes", "that", "may", "be", "resolved", "to", "URLs", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1228-L1250
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_virtuozzo_serviceName_upgrade_duration_GET
public OvhOrder license_virtuozzo_serviceName_upgrade_duration_GET(String serviceName, String duration, OvhOrderableVirtuozzoContainerNumberEnum containerNumber) throws IOException { """ Get prices and contracts information REST: GET /order/license/virtuozzo/{serviceName}/upgrade/{duration} @param containerNumber [required] How much container is this license able to manage ... @param serviceName [required] The name of your Virtuozzo license @param duration [required] Duration """ String qPath = "/order/license/virtuozzo/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "containerNumber", containerNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder license_virtuozzo_serviceName_upgrade_duration_GET(String serviceName, String duration, OvhOrderableVirtuozzoContainerNumberEnum containerNumber) throws IOException { String qPath = "/order/license/virtuozzo/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "containerNumber", containerNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "license_virtuozzo_serviceName_upgrade_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhOrderableVirtuozzoContainerNumberEnum", "containerNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/license/virtuozzo/{serviceName}/upgrade/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"containerNumber\"", ",", "containerNumber", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/license/virtuozzo/{serviceName}/upgrade/{duration} @param containerNumber [required] How much container is this license able to manage ... @param serviceName [required] The name of your Virtuozzo license @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1070-L1076
esigate/esigate
esigate-core/src/main/java/org/esigate/Driver.java
Driver.performRendering
private String performRendering(String pageUrl, DriverRequest originalRequest, CloseableHttpResponse response, String body, Renderer[] renderers) throws IOException, HttpErrorPage { """ Performs rendering (apply a render list) on an http response body (as a String). @param pageUrl The remove url from which the body was retrieved. @param originalRequest The request received by esigate. @param response The Http Reponse. @param body The body of the Http Response which will be rendered. @param renderers list of renderers to apply. @return The rendered response body. @throws HttpErrorPage @throws IOException """ // Start rendering RenderEvent renderEvent = new RenderEvent(pageUrl, originalRequest, response); // Create renderer list from parameters. renderEvent.getRenderers().addAll(Arrays.asList(renderers)); String currentBody = body; this.eventManager.fire(EventManager.EVENT_RENDER_PRE, renderEvent); for (Renderer renderer : renderEvent.getRenderers()) { StringBuilderWriter stringWriter = new StringBuilderWriter(Parameters.DEFAULT_BUFFER_SIZE); renderer.render(originalRequest, currentBody, stringWriter); stringWriter.close(); currentBody = stringWriter.toString(); } this.eventManager.fire(EventManager.EVENT_RENDER_POST, renderEvent); return currentBody; }
java
private String performRendering(String pageUrl, DriverRequest originalRequest, CloseableHttpResponse response, String body, Renderer[] renderers) throws IOException, HttpErrorPage { // Start rendering RenderEvent renderEvent = new RenderEvent(pageUrl, originalRequest, response); // Create renderer list from parameters. renderEvent.getRenderers().addAll(Arrays.asList(renderers)); String currentBody = body; this.eventManager.fire(EventManager.EVENT_RENDER_PRE, renderEvent); for (Renderer renderer : renderEvent.getRenderers()) { StringBuilderWriter stringWriter = new StringBuilderWriter(Parameters.DEFAULT_BUFFER_SIZE); renderer.render(originalRequest, currentBody, stringWriter); stringWriter.close(); currentBody = stringWriter.toString(); } this.eventManager.fire(EventManager.EVENT_RENDER_POST, renderEvent); return currentBody; }
[ "private", "String", "performRendering", "(", "String", "pageUrl", ",", "DriverRequest", "originalRequest", ",", "CloseableHttpResponse", "response", ",", "String", "body", ",", "Renderer", "[", "]", "renderers", ")", "throws", "IOException", ",", "HttpErrorPage", "{", "// Start rendering", "RenderEvent", "renderEvent", "=", "new", "RenderEvent", "(", "pageUrl", ",", "originalRequest", ",", "response", ")", ";", "// Create renderer list from parameters.", "renderEvent", ".", "getRenderers", "(", ")", ".", "addAll", "(", "Arrays", ".", "asList", "(", "renderers", ")", ")", ";", "String", "currentBody", "=", "body", ";", "this", ".", "eventManager", ".", "fire", "(", "EventManager", ".", "EVENT_RENDER_PRE", ",", "renderEvent", ")", ";", "for", "(", "Renderer", "renderer", ":", "renderEvent", ".", "getRenderers", "(", ")", ")", "{", "StringBuilderWriter", "stringWriter", "=", "new", "StringBuilderWriter", "(", "Parameters", ".", "DEFAULT_BUFFER_SIZE", ")", ";", "renderer", ".", "render", "(", "originalRequest", ",", "currentBody", ",", "stringWriter", ")", ";", "stringWriter", ".", "close", "(", ")", ";", "currentBody", "=", "stringWriter", ".", "toString", "(", ")", ";", "}", "this", ".", "eventManager", ".", "fire", "(", "EventManager", ".", "EVENT_RENDER_POST", ",", "renderEvent", ")", ";", "return", "currentBody", ";", "}" ]
Performs rendering (apply a render list) on an http response body (as a String). @param pageUrl The remove url from which the body was retrieved. @param originalRequest The request received by esigate. @param response The Http Reponse. @param body The body of the Http Response which will be rendered. @param renderers list of renderers to apply. @return The rendered response body. @throws HttpErrorPage @throws IOException
[ "Performs", "rendering", "(", "apply", "a", "render", "list", ")", "on", "an", "http", "response", "body", "(", "as", "a", "String", ")", "." ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/Driver.java#L399-L418
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/EuclideanDistance.java
EuclideanDistance.updateDistance
protected double updateDistance(double currDist, double diff) { """ Updates the current distance calculated so far with the new difference between two attributes. The difference between the attributes was calculated with the difference(int,double,double) method. @param currDist the current distance calculated so far @param diff the difference between two new attributes @return the update distance @see #difference(int, double, double) """ double result; result = currDist; result += diff * diff; return result; }
java
protected double updateDistance(double currDist, double diff) { double result; result = currDist; result += diff * diff; return result; }
[ "protected", "double", "updateDistance", "(", "double", "currDist", ",", "double", "diff", ")", "{", "double", "result", ";", "result", "=", "currDist", ";", "result", "+=", "diff", "*", "diff", ";", "return", "result", ";", "}" ]
Updates the current distance calculated so far with the new difference between two attributes. The difference between the attributes was calculated with the difference(int,double,double) method. @param currDist the current distance calculated so far @param diff the difference between two new attributes @return the update distance @see #difference(int, double, double)
[ "Updates", "the", "current", "distance", "calculated", "so", "far", "with", "the", "new", "difference", "between", "two", "attributes", ".", "The", "difference", "between", "the", "attributes", "was", "calculated", "with", "the", "difference", "(", "int", "double", "double", ")", "method", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/EuclideanDistance.java#L138-L145
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.newTypeRef
@Deprecated public JvmTypeReference newTypeRef(JvmType type, JvmTypeReference... typeArgs) { """ Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments. @param type the type the reference shall point to. @param typeArgs type arguments @return the newly created {@link JvmTypeReference} @deprecated use {@link JvmTypeReferenceBuilder#typeRef(JvmType, JvmTypeReference...)} """ return references.createTypeRef(type, typeArgs); }
java
@Deprecated public JvmTypeReference newTypeRef(JvmType type, JvmTypeReference... typeArgs) { return references.createTypeRef(type, typeArgs); }
[ "@", "Deprecated", "public", "JvmTypeReference", "newTypeRef", "(", "JvmType", "type", ",", "JvmTypeReference", "...", "typeArgs", ")", "{", "return", "references", ".", "createTypeRef", "(", "type", ",", "typeArgs", ")", ";", "}" ]
Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments. @param type the type the reference shall point to. @param typeArgs type arguments @return the newly created {@link JvmTypeReference} @deprecated use {@link JvmTypeReferenceBuilder#typeRef(JvmType, JvmTypeReference...)}
[ "Creates", "a", "new", "{", "@link", "JvmTypeReference", "}", "pointing", "to", "the", "given", "class", "and", "containing", "the", "given", "type", "arguments", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1333-L1336
box/box-java-sdk
src/main/java/com/box/sdk/BoxUser.java
BoxUser.getUsersInfoForType
private static Iterable<BoxUser.Info> getUsersInfoForType(final BoxAPIConnection api, final String filterTerm, final String userType, final String externalAppUserId, final String... fields) { """ Helper method to abstract out the common logic from the various users methods. @param api the API connection to be used when retrieving the users. @param filterTerm The filter term to lookup users by (login for external, login or name for managed) @param userType The type of users we want to search with this request. Valid values are 'managed' (enterprise users), 'external' or 'all' @param externalAppUserId the external app user id that has been set for an app user @param fields the fields to retrieve. Leave this out for the standard fields. @return An iterator over the selected users. """ return new Iterable<BoxUser.Info>() { public Iterator<BoxUser.Info> iterator() { QueryStringBuilder builder = new QueryStringBuilder(); if (filterTerm != null) { builder.appendParam("filter_term", filterTerm); } if (userType != null) { builder.appendParam("user_type", userType); } if (externalAppUserId != null) { builder.appendParam("external_app_user_id", externalAppUserId); } if (fields.length > 0) { builder.appendParam("fields", fields); } URL url = USERS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); return new BoxUserIterator(api, url); } }; }
java
private static Iterable<BoxUser.Info> getUsersInfoForType(final BoxAPIConnection api, final String filterTerm, final String userType, final String externalAppUserId, final String... fields) { return new Iterable<BoxUser.Info>() { public Iterator<BoxUser.Info> iterator() { QueryStringBuilder builder = new QueryStringBuilder(); if (filterTerm != null) { builder.appendParam("filter_term", filterTerm); } if (userType != null) { builder.appendParam("user_type", userType); } if (externalAppUserId != null) { builder.appendParam("external_app_user_id", externalAppUserId); } if (fields.length > 0) { builder.appendParam("fields", fields); } URL url = USERS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); return new BoxUserIterator(api, url); } }; }
[ "private", "static", "Iterable", "<", "BoxUser", ".", "Info", ">", "getUsersInfoForType", "(", "final", "BoxAPIConnection", "api", ",", "final", "String", "filterTerm", ",", "final", "String", "userType", ",", "final", "String", "externalAppUserId", ",", "final", "String", "...", "fields", ")", "{", "return", "new", "Iterable", "<", "BoxUser", ".", "Info", ">", "(", ")", "{", "public", "Iterator", "<", "BoxUser", ".", "Info", ">", "iterator", "(", ")", "{", "QueryStringBuilder", "builder", "=", "new", "QueryStringBuilder", "(", ")", ";", "if", "(", "filterTerm", "!=", "null", ")", "{", "builder", ".", "appendParam", "(", "\"filter_term\"", ",", "filterTerm", ")", ";", "}", "if", "(", "userType", "!=", "null", ")", "{", "builder", ".", "appendParam", "(", "\"user_type\"", ",", "userType", ")", ";", "}", "if", "(", "externalAppUserId", "!=", "null", ")", "{", "builder", ".", "appendParam", "(", "\"external_app_user_id\"", ",", "externalAppUserId", ")", ";", "}", "if", "(", "fields", ".", "length", ">", "0", ")", "{", "builder", ".", "appendParam", "(", "\"fields\"", ",", "fields", ")", ";", "}", "URL", "url", "=", "USERS_URL_TEMPLATE", ".", "buildWithQuery", "(", "api", ".", "getBaseURL", "(", ")", ",", "builder", ".", "toString", "(", ")", ")", ";", "return", "new", "BoxUserIterator", "(", "api", ",", "url", ")", ";", "}", "}", ";", "}" ]
Helper method to abstract out the common logic from the various users methods. @param api the API connection to be used when retrieving the users. @param filterTerm The filter term to lookup users by (login for external, login or name for managed) @param userType The type of users we want to search with this request. Valid values are 'managed' (enterprise users), 'external' or 'all' @param externalAppUserId the external app user id that has been set for an app user @param fields the fields to retrieve. Leave this out for the standard fields. @return An iterator over the selected users.
[ "Helper", "method", "to", "abstract", "out", "the", "common", "logic", "from", "the", "various", "users", "methods", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L251-L272
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java
CoreRemoteMongoCollectionImpl.updateOne
public RemoteUpdateResult updateOne(final Bson filter, final Bson update) { """ Update a single document in the collection according to the specified arguments. @param filter a document describing the query filter, which may not be null. @param update a document describing the update, which may not be null. The update to apply must include only update operators. @return the result of the update one operation """ return updateOne(filter, update, new RemoteUpdateOptions()); }
java
public RemoteUpdateResult updateOne(final Bson filter, final Bson update) { return updateOne(filter, update, new RemoteUpdateOptions()); }
[ "public", "RemoteUpdateResult", "updateOne", "(", "final", "Bson", "filter", ",", "final", "Bson", "update", ")", "{", "return", "updateOne", "(", "filter", ",", "update", ",", "new", "RemoteUpdateOptions", "(", ")", ")", ";", "}" ]
Update a single document in the collection according to the specified arguments. @param filter a document describing the query filter, which may not be null. @param update a document describing the update, which may not be null. The update to apply must include only update operators. @return the result of the update one operation
[ "Update", "a", "single", "document", "in", "the", "collection", "according", "to", "the", "specified", "arguments", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java#L396-L398
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java
SDNN.batchNorm
public SDVariable batchNorm(SDVariable input, SDVariable mean, SDVariable variance, SDVariable gamma, SDVariable beta, double epsilon, int... axis) { """ Batch norm operation. @see #batchNorm(String, SDVariable, SDVariable, SDVariable, SDVariable, SDVariable, double, int...) """ return batchNorm(null, input, mean, variance, gamma, beta, true, true, epsilon, axis); }
java
public SDVariable batchNorm(SDVariable input, SDVariable mean, SDVariable variance, SDVariable gamma, SDVariable beta, double epsilon, int... axis) { return batchNorm(null, input, mean, variance, gamma, beta, true, true, epsilon, axis); }
[ "public", "SDVariable", "batchNorm", "(", "SDVariable", "input", ",", "SDVariable", "mean", ",", "SDVariable", "variance", ",", "SDVariable", "gamma", ",", "SDVariable", "beta", ",", "double", "epsilon", ",", "int", "...", "axis", ")", "{", "return", "batchNorm", "(", "null", ",", "input", ",", "mean", ",", "variance", ",", "gamma", ",", "beta", ",", "true", ",", "true", ",", "epsilon", ",", "axis", ")", ";", "}" ]
Batch norm operation. @see #batchNorm(String, SDVariable, SDVariable, SDVariable, SDVariable, SDVariable, double, int...)
[ "Batch", "norm", "operation", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L31-L35
stapler/stapler
core/src/main/java/org/kohsuke/stapler/lang/KlassNavigator.java
KlassNavigator.getArrayElement
public Object getArrayElement(Object o, int index) throws IndexOutOfBoundsException { """ Given an instance for which the type reported {@code isArray()==true}, obtains the element of the specified index. @see #isArray(Object) """ if (o instanceof List) return ((List)o).get(index); return Array.get(o,index); }
java
public Object getArrayElement(Object o, int index) throws IndexOutOfBoundsException { if (o instanceof List) return ((List)o).get(index); return Array.get(o,index); }
[ "public", "Object", "getArrayElement", "(", "Object", "o", ",", "int", "index", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "o", "instanceof", "List", ")", "return", "(", "(", "List", ")", "o", ")", ".", "get", "(", "index", ")", ";", "return", "Array", ".", "get", "(", "o", ",", "index", ")", ";", "}" ]
Given an instance for which the type reported {@code isArray()==true}, obtains the element of the specified index. @see #isArray(Object)
[ "Given", "an", "instance", "for", "which", "the", "type", "reported", "{" ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/lang/KlassNavigator.java#L120-L124
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigDecimalExtensions.java
BigDecimalExtensions.operator_minus
@Pure @Inline(value="$1.subtract($2)") public static BigDecimal operator_minus(BigDecimal a, BigDecimal b) { """ The binary <code>minus</code> operator. @param a a BigDecimal. May not be <code>null</code>. @param b a BigDecimal. May not be <code>null</code>. @return <code>a.subtract(b)</code> @throws NullPointerException if {@code a} or {@code b} is <code>null</code>. """ return a.subtract(b); }
java
@Pure @Inline(value="$1.subtract($2)") public static BigDecimal operator_minus(BigDecimal a, BigDecimal b) { return a.subtract(b); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"$1.subtract($2)\"", ")", "public", "static", "BigDecimal", "operator_minus", "(", "BigDecimal", "a", ",", "BigDecimal", "b", ")", "{", "return", "a", ".", "subtract", "(", "b", ")", ";", "}" ]
The binary <code>minus</code> operator. @param a a BigDecimal. May not be <code>null</code>. @param b a BigDecimal. May not be <code>null</code>. @return <code>a.subtract(b)</code> @throws NullPointerException if {@code a} or {@code b} is <code>null</code>.
[ "The", "binary", "<code", ">", "minus<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigDecimalExtensions.java#L66-L70
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java
ServerSentEvents.fromPublisher
public static HttpResponse fromPublisher(HttpHeaders headers, Publisher<? extends ServerSentEvent> contentPublisher) { """ Creates a new Server-Sent Events stream from the specified {@link Publisher}. @param headers the HTTP headers supposed to send @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents """ return fromPublisher(headers, contentPublisher, HttpHeaders.EMPTY_HEADERS); }
java
public static HttpResponse fromPublisher(HttpHeaders headers, Publisher<? extends ServerSentEvent> contentPublisher) { return fromPublisher(headers, contentPublisher, HttpHeaders.EMPTY_HEADERS); }
[ "public", "static", "HttpResponse", "fromPublisher", "(", "HttpHeaders", "headers", ",", "Publisher", "<", "?", "extends", "ServerSentEvent", ">", "contentPublisher", ")", "{", "return", "fromPublisher", "(", "headers", ",", "contentPublisher", ",", "HttpHeaders", ".", "EMPTY_HEADERS", ")", ";", "}" ]
Creates a new Server-Sent Events stream from the specified {@link Publisher}. @param headers the HTTP headers supposed to send @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents
[ "Creates", "a", "new", "Server", "-", "Sent", "Events", "stream", "from", "the", "specified", "{", "@link", "Publisher", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L97-L100
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.calcRotatedSize
private static Rectangle calcRotatedSize(int width, int height, int degree) { """ 计算旋转后的图片尺寸 @param width 宽度 @param height 高度 @param degree 旋转角度 @return 计算后目标尺寸 @since 4.1.20 """ if (degree >= 90) { if (degree / 90 % 2 == 1) { int temp = height; height = width; width = temp; } degree = degree % 90; } double r = Math.sqrt(height * height + width * width) / 2; double len = 2 * Math.sin(Math.toRadians(degree) / 2) * r; double angel_alpha = (Math.PI - Math.toRadians(degree)) / 2; double angel_dalta_width = Math.atan((double) height / width); double angel_dalta_height = Math.atan((double) width / height); int len_dalta_width = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_width)); int len_dalta_height = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_height)); int des_width = width + len_dalta_width * 2; int des_height = height + len_dalta_height * 2; return new Rectangle(des_width, des_height); }
java
private static Rectangle calcRotatedSize(int width, int height, int degree) { if (degree >= 90) { if (degree / 90 % 2 == 1) { int temp = height; height = width; width = temp; } degree = degree % 90; } double r = Math.sqrt(height * height + width * width) / 2; double len = 2 * Math.sin(Math.toRadians(degree) / 2) * r; double angel_alpha = (Math.PI - Math.toRadians(degree)) / 2; double angel_dalta_width = Math.atan((double) height / width); double angel_dalta_height = Math.atan((double) width / height); int len_dalta_width = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_width)); int len_dalta_height = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_height)); int des_width = width + len_dalta_width * 2; int des_height = height + len_dalta_height * 2; return new Rectangle(des_width, des_height); }
[ "private", "static", "Rectangle", "calcRotatedSize", "(", "int", "width", ",", "int", "height", ",", "int", "degree", ")", "{", "if", "(", "degree", ">=", "90", ")", "{", "if", "(", "degree", "/", "90", "%", "2", "==", "1", ")", "{", "int", "temp", "=", "height", ";", "height", "=", "width", ";", "width", "=", "temp", ";", "}", "degree", "=", "degree", "%", "90", ";", "}", "double", "r", "=", "Math", ".", "sqrt", "(", "height", "*", "height", "+", "width", "*", "width", ")", "/", "2", ";", "double", "len", "=", "2", "*", "Math", ".", "sin", "(", "Math", ".", "toRadians", "(", "degree", ")", "/", "2", ")", "*", "r", ";", "double", "angel_alpha", "=", "(", "Math", ".", "PI", "-", "Math", ".", "toRadians", "(", "degree", ")", ")", "/", "2", ";", "double", "angel_dalta_width", "=", "Math", ".", "atan", "(", "(", "double", ")", "height", "/", "width", ")", ";", "double", "angel_dalta_height", "=", "Math", ".", "atan", "(", "(", "double", ")", "width", "/", "height", ")", ";", "int", "len_dalta_width", "=", "(", "int", ")", "(", "len", "*", "Math", ".", "cos", "(", "Math", ".", "PI", "-", "angel_alpha", "-", "angel_dalta_width", ")", ")", ";", "int", "len_dalta_height", "=", "(", "int", ")", "(", "len", "*", "Math", ".", "cos", "(", "Math", ".", "PI", "-", "angel_alpha", "-", "angel_dalta_height", ")", ")", ";", "int", "des_width", "=", "width", "+", "len_dalta_width", "*", "2", ";", "int", "des_height", "=", "height", "+", "len_dalta_height", "*", "2", ";", "return", "new", "Rectangle", "(", "des_width", ",", "des_height", ")", ";", "}" ]
计算旋转后的图片尺寸 @param width 宽度 @param height 高度 @param degree 旋转角度 @return 计算后目标尺寸 @since 4.1.20
[ "计算旋转后的图片尺寸" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L636-L656
aws/aws-sdk-java
aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/AddTagsToVaultRequest.java
AddTagsToVaultRequest.withTags
public AddTagsToVaultRequest withTags(java.util.Map<String, String> tags) { """ <p> The tags to add to the vault. Each tag is composed of a key and a value. The value can be an empty string. </p> @param tags The tags to add to the vault. Each tag is composed of a key and a value. The value can be an empty string. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public AddTagsToVaultRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "AddTagsToVaultRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags to add to the vault. Each tag is composed of a key and a value. The value can be an empty string. </p> @param tags The tags to add to the vault. Each tag is composed of a key and a value. The value can be an empty string. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "to", "add", "to", "the", "vault", ".", "Each", "tag", "is", "composed", "of", "a", "key", "and", "a", "value", ".", "The", "value", "can", "be", "an", "empty", "string", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/AddTagsToVaultRequest.java#L184-L187
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/tcom/jmx/impl/JMXClient.java
JMXClient.addNotificationListener
public boolean addNotificationListener(String mbeanName, NotificationListener listener) throws Exception { """ /* Adds listener as notification and connection notification listener. @return true if successful, false otherwise @throws java.lang.Exception """ if (isConnected()) { ObjectName objectName = new ObjectName(mbeanName); jmxc.addConnectionNotificationListener(listener, null, null); mbsc.addNotificationListener(objectName, listener, null, null); return true; } else { return false; } }
java
public boolean addNotificationListener(String mbeanName, NotificationListener listener) throws Exception { if (isConnected()) { ObjectName objectName = new ObjectName(mbeanName); jmxc.addConnectionNotificationListener(listener, null, null); mbsc.addNotificationListener(objectName, listener, null, null); return true; } else { return false; } }
[ "public", "boolean", "addNotificationListener", "(", "String", "mbeanName", ",", "NotificationListener", "listener", ")", "throws", "Exception", "{", "if", "(", "isConnected", "(", ")", ")", "{", "ObjectName", "objectName", "=", "new", "ObjectName", "(", "mbeanName", ")", ";", "jmxc", ".", "addConnectionNotificationListener", "(", "listener", ",", "null", ",", "null", ")", ";", "mbsc", ".", "addNotificationListener", "(", "objectName", ",", "listener", ",", "null", ",", "null", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
/* Adds listener as notification and connection notification listener. @return true if successful, false otherwise @throws java.lang.Exception
[ "/", "*", "Adds", "listener", "as", "notification", "and", "connection", "notification", "listener", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/tcom/jmx/impl/JMXClient.java#L96-L105
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java
StorageAccountsInner.listByAccountAsync
public Observable<Page<StorageAccountInformationInner>> listByAccountAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { """ Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param filter The OData filter. Optional. @param top The number of items to return. Optional. @param skip The number of items to skip over before returning elements. Optional. @param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. @param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. @param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageAccountInformationInner&gt; object """ return listByAccountWithServiceResponseAsync(resourceGroupName, accountName, filter, top, skip, select, orderby, count) .map(new Func1<ServiceResponse<Page<StorageAccountInformationInner>>, Page<StorageAccountInformationInner>>() { @Override public Page<StorageAccountInformationInner> call(ServiceResponse<Page<StorageAccountInformationInner>> response) { return response.body(); } }); }
java
public Observable<Page<StorageAccountInformationInner>> listByAccountAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { return listByAccountWithServiceResponseAsync(resourceGroupName, accountName, filter, top, skip, select, orderby, count) .map(new Func1<ServiceResponse<Page<StorageAccountInformationInner>>, Page<StorageAccountInformationInner>>() { @Override public Page<StorageAccountInformationInner> call(ServiceResponse<Page<StorageAccountInformationInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "StorageAccountInformationInner", ">", ">", "listByAccountAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ",", "final", "String", "filter", ",", "final", "Integer", "top", ",", "final", "Integer", "skip", ",", "final", "String", "select", ",", "final", "String", "orderby", ",", "final", "Boolean", "count", ")", "{", "return", "listByAccountWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "filter", ",", "top", ",", "skip", ",", "select", ",", "orderby", ",", "count", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountInformationInner", ">", ">", ",", "Page", "<", "StorageAccountInformationInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "StorageAccountInformationInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "StorageAccountInformationInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param filter The OData filter. Optional. @param top The number of items to return. Optional. @param skip The number of items to skip over before returning elements. Optional. @param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. @param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. @param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageAccountInformationInner&gt; object
[ "Gets", "the", "first", "page", "of", "Azure", "Storage", "accounts", "if", "any", "linked", "to", "the", "specified", "Data", "Lake", "Analytics", "account", ".", "The", "response", "includes", "a", "link", "to", "the", "next", "page", "if", "any", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java#L303-L311
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.readFileAsString
private String readFileAsString(File file) throws java.io.IOException { """ Read the given file and return the content as a string. @param file the file @return the string @throws IOException Signals that an I/O exception has occurred. """ StringBuilder fileData = new StringBuilder(1000); try (BufferedReader reader = new BufferedReader(ReaderFactory.newReader(file, this.encoding))) { char[] buf = new char[1024]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } } return fileData.toString(); }
java
private String readFileAsString(File file) throws java.io.IOException { StringBuilder fileData = new StringBuilder(1000); try (BufferedReader reader = new BufferedReader(ReaderFactory.newReader(file, this.encoding))) { char[] buf = new char[1024]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } } return fileData.toString(); }
[ "private", "String", "readFileAsString", "(", "File", "file", ")", "throws", "java", ".", "io", ".", "IOException", "{", "StringBuilder", "fileData", "=", "new", "StringBuilder", "(", "1000", ")", ";", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "ReaderFactory", ".", "newReader", "(", "file", ",", "this", ".", "encoding", ")", ")", ")", "{", "char", "[", "]", "buf", "=", "new", "char", "[", "1024", "]", ";", "int", "numRead", "=", "0", ";", "while", "(", "(", "numRead", "=", "reader", ".", "read", "(", "buf", ")", ")", "!=", "-", "1", ")", "{", "String", "readData", "=", "String", ".", "valueOf", "(", "buf", ",", "0", ",", "numRead", ")", ";", "fileData", ".", "append", "(", "readData", ")", ";", "buf", "=", "new", "char", "[", "1024", "]", ";", "}", "}", "return", "fileData", ".", "toString", "(", ")", ";", "}" ]
Read the given file and return the content as a string. @param file the file @return the string @throws IOException Signals that an I/O exception has occurred.
[ "Read", "the", "given", "file", "and", "return", "the", "content", "as", "a", "string", "." ]
train
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L597-L609
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
BaseMessageFilter.setMessageReceiver
public void setMessageReceiver(BaseMessageReceiver messageReceiver, Integer intID) { """ Set the message receiver for this filter. @param messageReceiver The message receiver. """ if ((messageReceiver != null) || (intID != null)) if ((m_intID != null) || (m_messageReceiver != null)) Util.getLogger().warning("BaseMessageFilter/setMessageReceiver()----Error - Filter added twice."); m_messageReceiver = messageReceiver; m_intID = intID; }
java
public void setMessageReceiver(BaseMessageReceiver messageReceiver, Integer intID) { if ((messageReceiver != null) || (intID != null)) if ((m_intID != null) || (m_messageReceiver != null)) Util.getLogger().warning("BaseMessageFilter/setMessageReceiver()----Error - Filter added twice."); m_messageReceiver = messageReceiver; m_intID = intID; }
[ "public", "void", "setMessageReceiver", "(", "BaseMessageReceiver", "messageReceiver", ",", "Integer", "intID", ")", "{", "if", "(", "(", "messageReceiver", "!=", "null", ")", "||", "(", "intID", "!=", "null", ")", ")", "if", "(", "(", "m_intID", "!=", "null", ")", "||", "(", "m_messageReceiver", "!=", "null", ")", ")", "Util", ".", "getLogger", "(", ")", ".", "warning", "(", "\"BaseMessageFilter/setMessageReceiver()----Error - Filter added twice.\"", ")", ";", "m_messageReceiver", "=", "messageReceiver", ";", "m_intID", "=", "intID", ";", "}" ]
Set the message receiver for this filter. @param messageReceiver The message receiver.
[ "Set", "the", "message", "receiver", "for", "this", "filter", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L373-L380
jpelzer/pelzer-util
src/main/java/com/pelzer/util/json/JSONUtil.java
JSONUtil.fromJSON
public static JSONObject fromJSON(String json) { """ Parses the given JSON and looks for the "_i" key, which is then looked up against calls to {@link #register(JSONObject)}, and then returns the result of {@link #fromJSON(String, Class)} """ int index1 = json.lastIndexOf("\"_i\":\""); if (index1 < 0) throw new JsonParseException("Unable to find _i key."); index1 += 6; int index2 = json.indexOf("\"", index1 + 1); if (index2 < 0) throw new JsonParseException("Unable to find end of _i value."); String id = json.substring(index1, index2); Class<? extends JSONObject> clazz = registrations.get(id); if (clazz == null){ // See if the id is a full classname try{ clazz = (Class<? extends JSONObject>) Class.forName(id); registrations.put(id, clazz); }catch(ClassNotFoundException ex){ throw new JsonParseException("No registration for JSONObject message.identifier:" + id); } } return fromJSON(json, clazz); }
java
public static JSONObject fromJSON(String json) { int index1 = json.lastIndexOf("\"_i\":\""); if (index1 < 0) throw new JsonParseException("Unable to find _i key."); index1 += 6; int index2 = json.indexOf("\"", index1 + 1); if (index2 < 0) throw new JsonParseException("Unable to find end of _i value."); String id = json.substring(index1, index2); Class<? extends JSONObject> clazz = registrations.get(id); if (clazz == null){ // See if the id is a full classname try{ clazz = (Class<? extends JSONObject>) Class.forName(id); registrations.put(id, clazz); }catch(ClassNotFoundException ex){ throw new JsonParseException("No registration for JSONObject message.identifier:" + id); } } return fromJSON(json, clazz); }
[ "public", "static", "JSONObject", "fromJSON", "(", "String", "json", ")", "{", "int", "index1", "=", "json", ".", "lastIndexOf", "(", "\"\\\"_i\\\":\\\"\"", ")", ";", "if", "(", "index1", "<", "0", ")", "throw", "new", "JsonParseException", "(", "\"Unable to find _i key.\"", ")", ";", "index1", "+=", "6", ";", "int", "index2", "=", "json", ".", "indexOf", "(", "\"\\\"\"", ",", "index1", "+", "1", ")", ";", "if", "(", "index2", "<", "0", ")", "throw", "new", "JsonParseException", "(", "\"Unable to find end of _i value.\"", ")", ";", "String", "id", "=", "json", ".", "substring", "(", "index1", ",", "index2", ")", ";", "Class", "<", "?", "extends", "JSONObject", ">", "clazz", "=", "registrations", ".", "get", "(", "id", ")", ";", "if", "(", "clazz", "==", "null", ")", "{", "// See if the id is a full classname", "try", "{", "clazz", "=", "(", "Class", "<", "?", "extends", "JSONObject", ">", ")", "Class", ".", "forName", "(", "id", ")", ";", "registrations", ".", "put", "(", "id", ",", "clazz", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "throw", "new", "JsonParseException", "(", "\"No registration for JSONObject message.identifier:\"", "+", "id", ")", ";", "}", "}", "return", "fromJSON", "(", "json", ",", "clazz", ")", ";", "}" ]
Parses the given JSON and looks for the "_i" key, which is then looked up against calls to {@link #register(JSONObject)}, and then returns the result of {@link #fromJSON(String, Class)}
[ "Parses", "the", "given", "JSON", "and", "looks", "for", "the", "_i", "key", "which", "is", "then", "looked", "up", "against", "calls", "to", "{" ]
train
https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/json/JSONUtil.java#L40-L60
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/PropertyMap.java
PropertyMap.getBoolean
public boolean getBoolean(String key, boolean def) { """ Returns the default value if the given key isn't in this PropertyMap or if the the value isn't equal to "true", ignoring case. @param key Key of property to read @param def Default value """ String value = getString(key); if (value == null) { return def; } else { return "true".equalsIgnoreCase(value); } }
java
public boolean getBoolean(String key, boolean def) { String value = getString(key); if (value == null) { return def; } else { return "true".equalsIgnoreCase(value); } }
[ "public", "boolean", "getBoolean", "(", "String", "key", ",", "boolean", "def", ")", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "def", ";", "}", "else", "{", "return", "\"true\"", ".", "equalsIgnoreCase", "(", "value", ")", ";", "}", "}" ]
Returns the default value if the given key isn't in this PropertyMap or if the the value isn't equal to "true", ignoring case. @param key Key of property to read @param def Default value
[ "Returns", "the", "default", "value", "if", "the", "given", "key", "isn", "t", "in", "this", "PropertyMap", "or", "if", "the", "the", "value", "isn", "t", "equal", "to", "true", "ignoring", "case", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/PropertyMap.java#L400-L408
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.reimageComputeNode
public void reimageComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException { """ Reinstalls the operating system on the specified compute node. <p>You can reimage a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p> @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node to reimage. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ reimageComputeNode(poolId, nodeId, null, null); }
java
public void reimageComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException { reimageComputeNode(poolId, nodeId, null, null); }
[ "public", "void", "reimageComputeNode", "(", "String", "poolId", ",", "String", "nodeId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "reimageComputeNode", "(", "poolId", ",", "nodeId", ",", "null", ",", "null", ")", ";", "}" ]
Reinstalls the operating system on the specified compute node. <p>You can reimage a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p> @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node to reimage. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Reinstalls", "the", "operating", "system", "on", "the", "specified", "compute", "node", ".", "<p", ">", "You", "can", "reimage", "a", "compute", "node", "only", "when", "it", "is", "in", "the", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", "batch", ".", "protocol", ".", "models", ".", "ComputeNodeState#IDLE", "Idle", "}", "or", "{", "@link", "com", ".", "microsoft", ".", "azure", ".", "batch", ".", "protocol", ".", "models", ".", "ComputeNodeState#RUNNING", "Running", "}", "state", ".", "<", "/", "p", ">" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L323-L325
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java
JawrRequestHandler.initConfigPropertiesSource
private ConfigPropertiesSource initConfigPropertiesSource(ServletContext context, Properties configProps) throws ServletException { """ Initialize the config properties source that will provide with all configuration options. @param context the servlet context @param configProps the config properties @return the config properties source @throws ServletException if an exception occurs """ String configLocation = getInitParameter("configLocation"); String configPropsSourceClass = getInitParameter("configPropertiesSourceClass"); if (null == configProps && null == configLocation && null == configPropsSourceClass) throw new ServletException("Neither configLocation nor configPropertiesSourceClass init params were set." + " You must set at least the configLocation param. Please check your web.xml file"); // Initialize the config properties source that will provide with all // configuration options. ConfigPropertiesSource propsSrc = null; // Load a custom class to set config properties if (null != configPropsSourceClass) { propsSrc = (ConfigPropertiesSource) ClassLoaderResourceUtils.buildObjectInstance(configPropsSourceClass); if (propsSrc instanceof ServletContextAware) { ((ServletContextAware) propsSrc).setServletContext(context); } } else if (configLocation == null && configProps != null) { // configuration retrieved from the in memory configuration // properties propsSrc = new PropsConfigPropertiesSource(configProps); } else { // Default config properties source, reads from a .properties file // in the classpath. propsSrc = new PropsFilePropertiesSource(); } // If a custom properties source is a subclass of // PropsFilePropertiesSource, we hand it the configLocation param. // This affects the standard one as well. if (propsSrc instanceof PropsFilePropertiesSource) ((PropsFilePropertiesSource) propsSrc).setConfigLocation(configLocation); return propsSrc; }
java
private ConfigPropertiesSource initConfigPropertiesSource(ServletContext context, Properties configProps) throws ServletException { String configLocation = getInitParameter("configLocation"); String configPropsSourceClass = getInitParameter("configPropertiesSourceClass"); if (null == configProps && null == configLocation && null == configPropsSourceClass) throw new ServletException("Neither configLocation nor configPropertiesSourceClass init params were set." + " You must set at least the configLocation param. Please check your web.xml file"); // Initialize the config properties source that will provide with all // configuration options. ConfigPropertiesSource propsSrc = null; // Load a custom class to set config properties if (null != configPropsSourceClass) { propsSrc = (ConfigPropertiesSource) ClassLoaderResourceUtils.buildObjectInstance(configPropsSourceClass); if (propsSrc instanceof ServletContextAware) { ((ServletContextAware) propsSrc).setServletContext(context); } } else if (configLocation == null && configProps != null) { // configuration retrieved from the in memory configuration // properties propsSrc = new PropsConfigPropertiesSource(configProps); } else { // Default config properties source, reads from a .properties file // in the classpath. propsSrc = new PropsFilePropertiesSource(); } // If a custom properties source is a subclass of // PropsFilePropertiesSource, we hand it the configLocation param. // This affects the standard one as well. if (propsSrc instanceof PropsFilePropertiesSource) ((PropsFilePropertiesSource) propsSrc).setConfigLocation(configLocation); return propsSrc; }
[ "private", "ConfigPropertiesSource", "initConfigPropertiesSource", "(", "ServletContext", "context", ",", "Properties", "configProps", ")", "throws", "ServletException", "{", "String", "configLocation", "=", "getInitParameter", "(", "\"configLocation\"", ")", ";", "String", "configPropsSourceClass", "=", "getInitParameter", "(", "\"configPropertiesSourceClass\"", ")", ";", "if", "(", "null", "==", "configProps", "&&", "null", "==", "configLocation", "&&", "null", "==", "configPropsSourceClass", ")", "throw", "new", "ServletException", "(", "\"Neither configLocation nor configPropertiesSourceClass init params were set.\"", "+", "\" You must set at least the configLocation param. Please check your web.xml file\"", ")", ";", "// Initialize the config properties source that will provide with all", "// configuration options.", "ConfigPropertiesSource", "propsSrc", "=", "null", ";", "// Load a custom class to set config properties", "if", "(", "null", "!=", "configPropsSourceClass", ")", "{", "propsSrc", "=", "(", "ConfigPropertiesSource", ")", "ClassLoaderResourceUtils", ".", "buildObjectInstance", "(", "configPropsSourceClass", ")", ";", "if", "(", "propsSrc", "instanceof", "ServletContextAware", ")", "{", "(", "(", "ServletContextAware", ")", "propsSrc", ")", ".", "setServletContext", "(", "context", ")", ";", "}", "}", "else", "if", "(", "configLocation", "==", "null", "&&", "configProps", "!=", "null", ")", "{", "// configuration retrieved from the in memory configuration", "// properties", "propsSrc", "=", "new", "PropsConfigPropertiesSource", "(", "configProps", ")", ";", "}", "else", "{", "// Default config properties source, reads from a .properties file", "// in the classpath.", "propsSrc", "=", "new", "PropsFilePropertiesSource", "(", ")", ";", "}", "// If a custom properties source is a subclass of", "// PropsFilePropertiesSource, we hand it the configLocation param.", "// This affects the standard one as well.", "if", "(", "propsSrc", "instanceof", "PropsFilePropertiesSource", ")", "(", "(", "PropsFilePropertiesSource", ")", "propsSrc", ")", ".", "setConfigLocation", "(", "configLocation", ")", ";", "return", "propsSrc", ";", "}" ]
Initialize the config properties source that will provide with all configuration options. @param context the servlet context @param configProps the config properties @return the config properties source @throws ServletException if an exception occurs
[ "Initialize", "the", "config", "properties", "source", "that", "will", "provide", "with", "all", "configuration", "options", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java#L421-L458
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/DistributedAvatarFileSystem.java
DistributedAvatarFileSystem.getNewNameNode
@Override ClientProtocol getNewNameNode(ClientProtocol rpcNamenode, Configuration conf) throws IOException { """ This method ensures that when {@link DFSClient#getNewNameNodeIfNeeded(int)} runs, it still keeps the {@link DFSClient#namenode} object a type of {@link FailoverClientProtocol} """ ClientProtocol namenode = DFSClient.createNamenode(rpcNamenode, conf); if (failoverClient == null) { failoverClient = new FailoverClientProtocol(namenode, failoverHandler); } failoverClient.setNameNode(namenode); return failoverClient; }
java
@Override ClientProtocol getNewNameNode(ClientProtocol rpcNamenode, Configuration conf) throws IOException { ClientProtocol namenode = DFSClient.createNamenode(rpcNamenode, conf); if (failoverClient == null) { failoverClient = new FailoverClientProtocol(namenode, failoverHandler); } failoverClient.setNameNode(namenode); return failoverClient; }
[ "@", "Override", "ClientProtocol", "getNewNameNode", "(", "ClientProtocol", "rpcNamenode", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "ClientProtocol", "namenode", "=", "DFSClient", ".", "createNamenode", "(", "rpcNamenode", ",", "conf", ")", ";", "if", "(", "failoverClient", "==", "null", ")", "{", "failoverClient", "=", "new", "FailoverClientProtocol", "(", "namenode", ",", "failoverHandler", ")", ";", "}", "failoverClient", ".", "setNameNode", "(", "namenode", ")", ";", "return", "failoverClient", ";", "}" ]
This method ensures that when {@link DFSClient#getNewNameNodeIfNeeded(int)} runs, it still keeps the {@link DFSClient#namenode} object a type of {@link FailoverClientProtocol}
[ "This", "method", "ensures", "that", "when", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/DistributedAvatarFileSystem.java#L295-L305
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.fromWKT
public static GeographyPointValue fromWKT(String param) { """ Create a GeographyPointValue from a well-known text string. @param param A well-known text string. @return A new instance of GeographyPointValue. """ if (param == null) { throw new IllegalArgumentException("Null well known text argument to GeographyPointValue constructor."); } Matcher m = wktPattern.matcher(param); if (m.find()) { // Add 0.0 to avoid -0.0. double longitude = toDouble(m.group(1), m.group(2)) + 0.0; double latitude = toDouble(m.group(3), m.group(4)) + 0.0; if (Math.abs(latitude) > 90.0) { throw new IllegalArgumentException(String.format("Latitude \"%f\" out of bounds.", latitude)); } if (Math.abs(longitude) > 180.0) { throw new IllegalArgumentException(String.format("Longitude \"%f\" out of bounds.", longitude)); } return new GeographyPointValue(longitude, latitude); } else { throw new IllegalArgumentException("Cannot construct GeographyPointValue value from \"" + param + "\""); } }
java
public static GeographyPointValue fromWKT(String param) { if (param == null) { throw new IllegalArgumentException("Null well known text argument to GeographyPointValue constructor."); } Matcher m = wktPattern.matcher(param); if (m.find()) { // Add 0.0 to avoid -0.0. double longitude = toDouble(m.group(1), m.group(2)) + 0.0; double latitude = toDouble(m.group(3), m.group(4)) + 0.0; if (Math.abs(latitude) > 90.0) { throw new IllegalArgumentException(String.format("Latitude \"%f\" out of bounds.", latitude)); } if (Math.abs(longitude) > 180.0) { throw new IllegalArgumentException(String.format("Longitude \"%f\" out of bounds.", longitude)); } return new GeographyPointValue(longitude, latitude); } else { throw new IllegalArgumentException("Cannot construct GeographyPointValue value from \"" + param + "\""); } }
[ "public", "static", "GeographyPointValue", "fromWKT", "(", "String", "param", ")", "{", "if", "(", "param", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null well known text argument to GeographyPointValue constructor.\"", ")", ";", "}", "Matcher", "m", "=", "wktPattern", ".", "matcher", "(", "param", ")", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "// Add 0.0 to avoid -0.0.", "double", "longitude", "=", "toDouble", "(", "m", ".", "group", "(", "1", ")", ",", "m", ".", "group", "(", "2", ")", ")", "+", "0.0", ";", "double", "latitude", "=", "toDouble", "(", "m", ".", "group", "(", "3", ")", ",", "m", ".", "group", "(", "4", ")", ")", "+", "0.0", ";", "if", "(", "Math", ".", "abs", "(", "latitude", ")", ">", "90.0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Latitude \\\"%f\\\" out of bounds.\"", ",", "latitude", ")", ")", ";", "}", "if", "(", "Math", ".", "abs", "(", "longitude", ")", ">", "180.0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Longitude \\\"%f\\\" out of bounds.\"", ",", "longitude", ")", ")", ";", "}", "return", "new", "GeographyPointValue", "(", "longitude", ",", "latitude", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot construct GeographyPointValue value from \\\"\"", "+", "param", "+", "\"\\\"\"", ")", ";", "}", "}" ]
Create a GeographyPointValue from a well-known text string. @param param A well-known text string. @return A new instance of GeographyPointValue.
[ "Create", "a", "GeographyPointValue", "from", "a", "well", "-", "known", "text", "string", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L91-L110
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java
UnitQuaternions.orientationAngle
public static double orientationAngle(Point3d[] fixed, Point3d[] moved, boolean centered) { """ The angle of the relative orientation of the two sets of points in 3D. Equivalent to {@link #angle(Quat4d)} of the unit quaternion obtained by {@link #relativeOrientation(Point3d[], Point3d[])}. @param fixed array of Point3d. Original coordinates will not be modified. @param moved array of Point3d. Original coordinates will not be modified. @param centered true if the points are already centered at the origin @return the angle in radians of the relative orientation of the points, angle to rotate moved to bring it to the same orientation as fixed. """ if (!centered) { fixed = CalcPoint.clonePoint3dArray(fixed); moved = CalcPoint.clonePoint3dArray(moved); CalcPoint.center(fixed); CalcPoint.center(moved); } return orientationAngle(fixed, moved); }
java
public static double orientationAngle(Point3d[] fixed, Point3d[] moved, boolean centered) { if (!centered) { fixed = CalcPoint.clonePoint3dArray(fixed); moved = CalcPoint.clonePoint3dArray(moved); CalcPoint.center(fixed); CalcPoint.center(moved); } return orientationAngle(fixed, moved); }
[ "public", "static", "double", "orientationAngle", "(", "Point3d", "[", "]", "fixed", ",", "Point3d", "[", "]", "moved", ",", "boolean", "centered", ")", "{", "if", "(", "!", "centered", ")", "{", "fixed", "=", "CalcPoint", ".", "clonePoint3dArray", "(", "fixed", ")", ";", "moved", "=", "CalcPoint", ".", "clonePoint3dArray", "(", "moved", ")", ";", "CalcPoint", ".", "center", "(", "fixed", ")", ";", "CalcPoint", ".", "center", "(", "moved", ")", ";", "}", "return", "orientationAngle", "(", "fixed", ",", "moved", ")", ";", "}" ]
The angle of the relative orientation of the two sets of points in 3D. Equivalent to {@link #angle(Quat4d)} of the unit quaternion obtained by {@link #relativeOrientation(Point3d[], Point3d[])}. @param fixed array of Point3d. Original coordinates will not be modified. @param moved array of Point3d. Original coordinates will not be modified. @param centered true if the points are already centered at the origin @return the angle in radians of the relative orientation of the points, angle to rotate moved to bring it to the same orientation as fixed.
[ "The", "angle", "of", "the", "relative", "orientation", "of", "the", "two", "sets", "of", "points", "in", "3D", ".", "Equivalent", "to", "{", "@link", "#angle", "(", "Quat4d", ")", "}", "of", "the", "unit", "quaternion", "obtained", "by", "{", "@link", "#relativeOrientation", "(", "Point3d", "[]", "Point3d", "[]", ")", "}", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java#L178-L187
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/CUtil.java
CUtil.sameSet
public static boolean sameSet(final Object[] a, final Vector b) { """ Compares the contents of an array and a Vector for set equality. Assumes input array and vector are sets (i.e. no duplicate entries) """ if (a == null || b == null || a.length != b.size()) { return false; } if (a.length == 0) { return true; } // Convert the array into a set final Hashtable t = new Hashtable(); for (final Object element : a) { t.put(element, element); } for (int i = 0; i < b.size(); i++) { final Object o = b.elementAt(i); if (t.remove(o) == null) { return false; } } return t.size() == 0; }
java
public static boolean sameSet(final Object[] a, final Vector b) { if (a == null || b == null || a.length != b.size()) { return false; } if (a.length == 0) { return true; } // Convert the array into a set final Hashtable t = new Hashtable(); for (final Object element : a) { t.put(element, element); } for (int i = 0; i < b.size(); i++) { final Object o = b.elementAt(i); if (t.remove(o) == null) { return false; } } return t.size() == 0; }
[ "public", "static", "boolean", "sameSet", "(", "final", "Object", "[", "]", "a", ",", "final", "Vector", "b", ")", "{", "if", "(", "a", "==", "null", "||", "b", "==", "null", "||", "a", ".", "length", "!=", "b", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "a", ".", "length", "==", "0", ")", "{", "return", "true", ";", "}", "// Convert the array into a set", "final", "Hashtable", "t", "=", "new", "Hashtable", "(", ")", ";", "for", "(", "final", "Object", "element", ":", "a", ")", "{", "t", ".", "put", "(", "element", ",", "element", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "b", ".", "size", "(", ")", ";", "i", "++", ")", "{", "final", "Object", "o", "=", "b", ".", "elementAt", "(", "i", ")", ";", "if", "(", "t", ".", "remove", "(", "o", ")", "==", "null", ")", "{", "return", "false", ";", "}", "}", "return", "t", ".", "size", "(", ")", "==", "0", ";", "}" ]
Compares the contents of an array and a Vector for set equality. Assumes input array and vector are sets (i.e. no duplicate entries)
[ "Compares", "the", "contents", "of", "an", "array", "and", "a", "Vector", "for", "set", "equality", ".", "Assumes", "input", "array", "and", "vector", "are", "sets", "(", "i", ".", "e", ".", "no", "duplicate", "entries", ")" ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/CUtil.java#L464-L483
lucee/Lucee
core/src/main/java/lucee/intergral/fusiondebug/server/FDControllerImpl.java
FDControllerImpl.getByNativeIdentifier
private FDThreadImpl getByNativeIdentifier(String name, CFMLFactoryImpl factory, String id) { """ checks a single CFMLFactory for the thread @param name @param factory @param id @return matching thread or null """ Map<Integer, PageContextImpl> pcs = factory.getActivePageContexts(); Iterator<PageContextImpl> it = pcs.values().iterator(); PageContextImpl pc; while (it.hasNext()) { pc = it.next(); if (equals(pc, id)) return new FDThreadImpl(this, factory, name, pc); } return null; }
java
private FDThreadImpl getByNativeIdentifier(String name, CFMLFactoryImpl factory, String id) { Map<Integer, PageContextImpl> pcs = factory.getActivePageContexts(); Iterator<PageContextImpl> it = pcs.values().iterator(); PageContextImpl pc; while (it.hasNext()) { pc = it.next(); if (equals(pc, id)) return new FDThreadImpl(this, factory, name, pc); } return null; }
[ "private", "FDThreadImpl", "getByNativeIdentifier", "(", "String", "name", ",", "CFMLFactoryImpl", "factory", ",", "String", "id", ")", "{", "Map", "<", "Integer", ",", "PageContextImpl", ">", "pcs", "=", "factory", ".", "getActivePageContexts", "(", ")", ";", "Iterator", "<", "PageContextImpl", ">", "it", "=", "pcs", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "PageContextImpl", "pc", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "pc", "=", "it", ".", "next", "(", ")", ";", "if", "(", "equals", "(", "pc", ",", "id", ")", ")", "return", "new", "FDThreadImpl", "(", "this", ",", "factory", ",", "name", ",", "pc", ")", ";", "}", "return", "null", ";", "}" ]
checks a single CFMLFactory for the thread @param name @param factory @param id @return matching thread or null
[ "checks", "a", "single", "CFMLFactory", "for", "the", "thread" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/intergral/fusiondebug/server/FDControllerImpl.java#L167-L177
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java
Text.isDescendant
public static boolean isDescendant(String path, String descendant) { """ Determines if the <code>descendant</code> path is hierarchical a descendant of <code>path</code>. @param path the current path @param descendant the potential descendant @return <code>true</code> if the <code>descendant</code> is a descendant; <code>false</code> otherwise. """ return !path.equals(descendant) && descendant.startsWith(path) && descendant.charAt(path.length()) == '/'; }
java
public static boolean isDescendant(String path, String descendant) { return !path.equals(descendant) && descendant.startsWith(path) && descendant.charAt(path.length()) == '/'; }
[ "public", "static", "boolean", "isDescendant", "(", "String", "path", ",", "String", "descendant", ")", "{", "return", "!", "path", ".", "equals", "(", "descendant", ")", "&&", "descendant", ".", "startsWith", "(", "path", ")", "&&", "descendant", ".", "charAt", "(", "path", ".", "length", "(", ")", ")", "==", "'", "'", ";", "}" ]
Determines if the <code>descendant</code> path is hierarchical a descendant of <code>path</code>. @param path the current path @param descendant the potential descendant @return <code>true</code> if the <code>descendant</code> is a descendant; <code>false</code> otherwise.
[ "Determines", "if", "the", "<code", ">", "descendant<", "/", "code", ">", "path", "is", "hierarchical", "a", "descendant", "of", "<code", ">", "path<", "/", "code", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L717-L720
google/closure-compiler
src/com/google/javascript/jscomp/Es6ToEs3Util.java
Es6ToEs3Util.createType
static JSType createType(boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName) { """ Returns the JSType as specified by the typeName. Returns null if shouldCreate is false. """ if (!shouldCreate) { return null; } return registry.getNativeType(typeName); }
java
static JSType createType(boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName) { if (!shouldCreate) { return null; } return registry.getNativeType(typeName); }
[ "static", "JSType", "createType", "(", "boolean", "shouldCreate", ",", "JSTypeRegistry", "registry", ",", "JSTypeNative", "typeName", ")", "{", "if", "(", "!", "shouldCreate", ")", "{", "return", "null", ";", "}", "return", "registry", ".", "getNativeType", "(", "typeName", ")", ";", "}" ]
Returns the JSType as specified by the typeName. Returns null if shouldCreate is false.
[ "Returns", "the", "JSType", "as", "specified", "by", "the", "typeName", ".", "Returns", "null", "if", "shouldCreate", "is", "false", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ToEs3Util.java#L108-L113
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/warden/WardenNotifier.java
WardenNotifier.addAnnotationSuspendedUser
protected void addAnnotationSuspendedUser(NotificationContext context, SubSystem subSystem) { """ Add annotation for user suspension to the <tt>triggers.warden</tt> metric.. @param context The notification context. Cannot be null. @param subSystem The subsystem for which the user is being suspended. Cannot be null. """ Alert alert = context.getAlert(); PrincipalUser wardenUser = getWardenUser(alert.getName()); Metric metric = null; Map<Long, Double> datapoints = new HashMap<>(); metric = new Metric(Counter.WARDEN_TRIGGERS.getScope(), Counter.WARDEN_TRIGGERS.getMetric()); metric.setTag("user", wardenUser.getUserName()); datapoints.put(context.getTriggerFiredTime(), 1.0); metric.setDatapoints(datapoints); _tsdbService.putMetrics(Arrays.asList(new Metric[] { metric })); Annotation annotation = new Annotation(ANNOTATION_SOURCE, wardenUser.getUserName(), ANNOTATION_TYPE, Counter.WARDEN_TRIGGERS.getScope(), Counter.WARDEN_TRIGGERS.getMetric(), context.getTriggerFiredTime()); Map<String, String> fields = new TreeMap<>(); fields.put("Suspended from subsystem", subSystem.toString()); fields.put("Alert Name", alert.getName()); fields.put("Notification Name", context.getNotification().getName()); fields.put("Trigger Name", context.getTrigger().getName()); annotation.setFields(fields); _annotationService.updateAnnotation(alert.getOwner(), annotation); }
java
protected void addAnnotationSuspendedUser(NotificationContext context, SubSystem subSystem) { Alert alert = context.getAlert(); PrincipalUser wardenUser = getWardenUser(alert.getName()); Metric metric = null; Map<Long, Double> datapoints = new HashMap<>(); metric = new Metric(Counter.WARDEN_TRIGGERS.getScope(), Counter.WARDEN_TRIGGERS.getMetric()); metric.setTag("user", wardenUser.getUserName()); datapoints.put(context.getTriggerFiredTime(), 1.0); metric.setDatapoints(datapoints); _tsdbService.putMetrics(Arrays.asList(new Metric[] { metric })); Annotation annotation = new Annotation(ANNOTATION_SOURCE, wardenUser.getUserName(), ANNOTATION_TYPE, Counter.WARDEN_TRIGGERS.getScope(), Counter.WARDEN_TRIGGERS.getMetric(), context.getTriggerFiredTime()); Map<String, String> fields = new TreeMap<>(); fields.put("Suspended from subsystem", subSystem.toString()); fields.put("Alert Name", alert.getName()); fields.put("Notification Name", context.getNotification().getName()); fields.put("Trigger Name", context.getTrigger().getName()); annotation.setFields(fields); _annotationService.updateAnnotation(alert.getOwner(), annotation); }
[ "protected", "void", "addAnnotationSuspendedUser", "(", "NotificationContext", "context", ",", "SubSystem", "subSystem", ")", "{", "Alert", "alert", "=", "context", ".", "getAlert", "(", ")", ";", "PrincipalUser", "wardenUser", "=", "getWardenUser", "(", "alert", ".", "getName", "(", ")", ")", ";", "Metric", "metric", "=", "null", ";", "Map", "<", "Long", ",", "Double", ">", "datapoints", "=", "new", "HashMap", "<>", "(", ")", ";", "metric", "=", "new", "Metric", "(", "Counter", ".", "WARDEN_TRIGGERS", ".", "getScope", "(", ")", ",", "Counter", ".", "WARDEN_TRIGGERS", ".", "getMetric", "(", ")", ")", ";", "metric", ".", "setTag", "(", "\"user\"", ",", "wardenUser", ".", "getUserName", "(", ")", ")", ";", "datapoints", ".", "put", "(", "context", ".", "getTriggerFiredTime", "(", ")", ",", "1.0", ")", ";", "metric", ".", "setDatapoints", "(", "datapoints", ")", ";", "_tsdbService", ".", "putMetrics", "(", "Arrays", ".", "asList", "(", "new", "Metric", "[", "]", "{", "metric", "}", ")", ")", ";", "Annotation", "annotation", "=", "new", "Annotation", "(", "ANNOTATION_SOURCE", ",", "wardenUser", ".", "getUserName", "(", ")", ",", "ANNOTATION_TYPE", ",", "Counter", ".", "WARDEN_TRIGGERS", ".", "getScope", "(", ")", ",", "Counter", ".", "WARDEN_TRIGGERS", ".", "getMetric", "(", ")", ",", "context", ".", "getTriggerFiredTime", "(", ")", ")", ";", "Map", "<", "String", ",", "String", ">", "fields", "=", "new", "TreeMap", "<>", "(", ")", ";", "fields", ".", "put", "(", "\"Suspended from subsystem\"", ",", "subSystem", ".", "toString", "(", ")", ")", ";", "fields", ".", "put", "(", "\"Alert Name\"", ",", "alert", ".", "getName", "(", ")", ")", ";", "fields", ".", "put", "(", "\"Notification Name\"", ",", "context", ".", "getNotification", "(", ")", ".", "getName", "(", ")", ")", ";", "fields", ".", "put", "(", "\"Trigger Name\"", ",", "context", ".", "getTrigger", "(", ")", ".", "getName", "(", ")", ")", ";", "annotation", ".", "setFields", "(", "fields", ")", ";", "_annotationService", ".", "updateAnnotation", "(", "alert", ".", "getOwner", "(", ")", ",", "annotation", ")", ";", "}" ]
Add annotation for user suspension to the <tt>triggers.warden</tt> metric.. @param context The notification context. Cannot be null. @param subSystem The subsystem for which the user is being suspended. Cannot be null.
[ "Add", "annotation", "for", "user", "suspension", "to", "the", "<tt", ">", "triggers", ".", "warden<", "/", "tt", ">", "metric", ".." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/warden/WardenNotifier.java#L146-L169
michael-rapp/AndroidMaterialDialog
example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java
PreferenceFragment.createNegativeButtonListener
private OnClickListener createNegativeButtonListener() { """ Creates and returns a listener, which allows to show a toast, when the negative button of a dialog has been clicked. @return The listener, which has been created, as an instance of the class {@link OnClickListener} """ return new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), R.string.negative_button_toast, Toast.LENGTH_SHORT) .show(); } }; }
java
private OnClickListener createNegativeButtonListener() { return new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), R.string.negative_button_toast, Toast.LENGTH_SHORT) .show(); } }; }
[ "private", "OnClickListener", "createNegativeButtonListener", "(", ")", "{", "return", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "Toast", ".", "makeText", "(", "getActivity", "(", ")", ",", "R", ".", "string", ".", "negative_button_toast", ",", "Toast", ".", "LENGTH_SHORT", ")", ".", "show", "(", ")", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to show a toast, when the negative button of a dialog has been clicked. @return The listener, which has been created, as an instance of the class {@link OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "show", "a", "toast", "when", "the", "negative", "button", "of", "a", "dialog", "has", "been", "clicked", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java#L753-L763
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java
ServiceDirectoryConfig.getInt
public int getInt(String name, int defaultVal) { """ Get the property object as int, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as int, return defaultVal if property is undefined. """ if(this.configuration.containsKey(name)){ return this.configuration.getInt(name); } else { return defaultVal; } }
java
public int getInt(String name, int defaultVal){ if(this.configuration.containsKey(name)){ return this.configuration.getInt(name); } else { return defaultVal; } }
[ "public", "int", "getInt", "(", "String", "name", ",", "int", "defaultVal", ")", "{", "if", "(", "this", ".", "configuration", ".", "containsKey", "(", "name", ")", ")", "{", "return", "this", ".", "configuration", ".", "getInt", "(", "name", ")", ";", "}", "else", "{", "return", "defaultVal", ";", "}", "}" ]
Get the property object as int, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as int, return defaultVal if property is undefined.
[ "Get", "the", "property", "object", "as", "int", "or", "return", "defaultVal", "if", "property", "is", "not", "defined", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java#L207-L213
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/reflection/EntityClassReader.java
EntityClassReader.parseAsPropertyType
public Object parseAsPropertyType(String stringToParse, String propertyPath) { """ <p> Parses a given string into an object whose class corresponds with the type of the property given. For example, if you give the method "4", and you ask it to parse like "width", and width is of the type Long, you will receive an object of the type Long. If the property of the underlying class has a primitive type as its type, the method will return the boxed variant instead. </p> <p> <b>Currently, this method is only implemented for all numeric and boolean java types.</b> </p> @param stringToParse The string to convert into an object @param propertyPath Dot-separated path to the property whose type is to be used as the class to convert to @return A converted instance of the given string into the type of the given property. If the propertyName does not correspond with a property name, null is returned. If the propertyName has any other type than a supported type the original string is returned. """ Class propertyType = getPropertyType(propertyPath); if (propertyType == null) { return null; } NumberTransformer parser = transformers.get(propertyType); return parser == null ? stringToParse : parser.parseObject(stringToParse); }
java
public Object parseAsPropertyType(String stringToParse, String propertyPath) { Class propertyType = getPropertyType(propertyPath); if (propertyType == null) { return null; } NumberTransformer parser = transformers.get(propertyType); return parser == null ? stringToParse : parser.parseObject(stringToParse); }
[ "public", "Object", "parseAsPropertyType", "(", "String", "stringToParse", ",", "String", "propertyPath", ")", "{", "Class", "propertyType", "=", "getPropertyType", "(", "propertyPath", ")", ";", "if", "(", "propertyType", "==", "null", ")", "{", "return", "null", ";", "}", "NumberTransformer", "parser", "=", "transformers", ".", "get", "(", "propertyType", ")", ";", "return", "parser", "==", "null", "?", "stringToParse", ":", "parser", ".", "parseObject", "(", "stringToParse", ")", ";", "}" ]
<p> Parses a given string into an object whose class corresponds with the type of the property given. For example, if you give the method "4", and you ask it to parse like "width", and width is of the type Long, you will receive an object of the type Long. If the property of the underlying class has a primitive type as its type, the method will return the boxed variant instead. </p> <p> <b>Currently, this method is only implemented for all numeric and boolean java types.</b> </p> @param stringToParse The string to convert into an object @param propertyPath Dot-separated path to the property whose type is to be used as the class to convert to @return A converted instance of the given string into the type of the given property. If the propertyName does not correspond with a property name, null is returned. If the propertyName has any other type than a supported type the original string is returned.
[ "<p", ">", "Parses", "a", "given", "string", "into", "an", "object", "whose", "class", "corresponds", "with", "the", "type", "of", "the", "property", "given", ".", "For", "example", "if", "you", "give", "the", "method", "4", "and", "you", "ask", "it", "to", "parse", "like", "width", "and", "width", "is", "of", "the", "type", "Long", "you", "will", "receive", "an", "object", "of", "the", "type", "Long", ".", "If", "the", "property", "of", "the", "underlying", "class", "has", "a", "primitive", "type", "as", "its", "type", "the", "method", "will", "return", "the", "boxed", "variant", "instead", ".", "<", "/", "p", ">", "<p", ">", "<b", ">", "Currently", "this", "method", "is", "only", "implemented", "for", "all", "numeric", "and", "boolean", "java", "types", ".", "<", "/", "b", ">", "<", "/", "p", ">" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/reflection/EntityClassReader.java#L486-L494
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/proxy/cglib/CglibLazyInitializer.java
CglibLazyInitializer.getProxyFactory
public static Class getProxyFactory(Class persistentClass, Class[] interfaces) throws PersistenceException { """ Gets the proxy factory. @param persistentClass the persistent class @param interfaces the interfaces @return the proxy factory @throws PersistenceException the persistence exception """ Enhancer e = new Enhancer(); e.setSuperclass(interfaces.length == 1 ? persistentClass : null); e.setInterfaces(interfaces); e.setCallbackTypes(new Class[] { InvocationHandler.class, NoOp.class, }); e.setCallbackFilter(FINALIZE_FILTER); e.setUseFactory(false); e.setInterceptDuringConstruction(false); return e.createClass(); }
java
public static Class getProxyFactory(Class persistentClass, Class[] interfaces) throws PersistenceException { Enhancer e = new Enhancer(); e.setSuperclass(interfaces.length == 1 ? persistentClass : null); e.setInterfaces(interfaces); e.setCallbackTypes(new Class[] { InvocationHandler.class, NoOp.class, }); e.setCallbackFilter(FINALIZE_FILTER); e.setUseFactory(false); e.setInterceptDuringConstruction(false); return e.createClass(); }
[ "public", "static", "Class", "getProxyFactory", "(", "Class", "persistentClass", ",", "Class", "[", "]", "interfaces", ")", "throws", "PersistenceException", "{", "Enhancer", "e", "=", "new", "Enhancer", "(", ")", ";", "e", ".", "setSuperclass", "(", "interfaces", ".", "length", "==", "1", "?", "persistentClass", ":", "null", ")", ";", "e", ".", "setInterfaces", "(", "interfaces", ")", ";", "e", ".", "setCallbackTypes", "(", "new", "Class", "[", "]", "{", "InvocationHandler", ".", "class", ",", "NoOp", ".", "class", ",", "}", ")", ";", "e", ".", "setCallbackFilter", "(", "FINALIZE_FILTER", ")", ";", "e", ".", "setUseFactory", "(", "false", ")", ";", "e", ".", "setInterceptDuringConstruction", "(", "false", ")", ";", "return", "e", ".", "createClass", "(", ")", ";", "}" ]
Gets the proxy factory. @param persistentClass the persistent class @param interfaces the interfaces @return the proxy factory @throws PersistenceException the persistence exception
[ "Gets", "the", "proxy", "factory", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/proxy/cglib/CglibLazyInitializer.java#L189-L199
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java
DateContext.compareDate
public boolean compareDate(Date date1, Date date2) { """ Compare one date to another for equality in year, month and date. Note that this ignores all other values including the time. If either value is <code>null</code>, including if both are <code>null</code>, then <code>false</code> is returned. @param date1 The first date to compare. @param date2 The second date to compare. @return <code>true</code> if both dates have the same year/month/date, <code>false</code> if not. """ if (date1 == null || date2 == null) { return false; } boolean result; GregorianCalendar cal1 = new GregorianCalendar(); GregorianCalendar cal2 = new GregorianCalendar(); cal1.setTime(date1); cal2.setTime(date2); if (cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE)) { result = true; } else { result = false; } return result; }
java
public boolean compareDate(Date date1, Date date2) { if (date1 == null || date2 == null) { return false; } boolean result; GregorianCalendar cal1 = new GregorianCalendar(); GregorianCalendar cal2 = new GregorianCalendar(); cal1.setTime(date1); cal2.setTime(date2); if (cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE)) { result = true; } else { result = false; } return result; }
[ "public", "boolean", "compareDate", "(", "Date", "date1", ",", "Date", "date2", ")", "{", "if", "(", "date1", "==", "null", "||", "date2", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "result", ";", "GregorianCalendar", "cal1", "=", "new", "GregorianCalendar", "(", ")", ";", "GregorianCalendar", "cal2", "=", "new", "GregorianCalendar", "(", ")", ";", "cal1", ".", "setTime", "(", "date1", ")", ";", "cal2", ".", "setTime", "(", "date2", ")", ";", "if", "(", "cal1", ".", "get", "(", "Calendar", ".", "YEAR", ")", "==", "cal2", ".", "get", "(", "Calendar", ".", "YEAR", ")", "&&", "cal1", ".", "get", "(", "Calendar", ".", "MONTH", ")", "==", "cal2", ".", "get", "(", "Calendar", ".", "MONTH", ")", "&&", "cal1", ".", "get", "(", "Calendar", ".", "DATE", ")", "==", "cal2", ".", "get", "(", "Calendar", ".", "DATE", ")", ")", "{", "result", "=", "true", ";", "}", "else", "{", "result", "=", "false", ";", "}", "return", "result", ";", "}" ]
Compare one date to another for equality in year, month and date. Note that this ignores all other values including the time. If either value is <code>null</code>, including if both are <code>null</code>, then <code>false</code> is returned. @param date1 The first date to compare. @param date2 The second date to compare. @return <code>true</code> if both dates have the same year/month/date, <code>false</code> if not.
[ "Compare", "one", "date", "to", "another", "for", "equality", "in", "year", "month", "and", "date", ".", "Note", "that", "this", "ignores", "all", "other", "values", "including", "the", "time", ".", "If", "either", "value", "is", "<code", ">", "null<", "/", "code", ">", "including", "if", "both", "are", "<code", ">", "null<", "/", "code", ">", "then", "<code", ">", "false<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java#L485-L505
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java
StaxUtils.copy
public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { """ Copies the reader to the writer. The start and end document methods must be handled on the writer manually. @param reader @param writer @throws XMLStreamException """ copy(reader, writer, false, false); }
java
public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException { copy(reader, writer, false, false); }
[ "public", "static", "void", "copy", "(", "XMLStreamReader", "reader", ",", "XMLStreamWriter", "writer", ")", "throws", "XMLStreamException", "{", "copy", "(", "reader", ",", "writer", ",", "false", ",", "false", ")", ";", "}" ]
Copies the reader to the writer. The start and end document methods must be handled on the writer manually. @param reader @param writer @throws XMLStreamException
[ "Copies", "the", "reader", "to", "the", "writer", ".", "The", "start", "and", "end", "document", "methods", "must", "be", "handled", "on", "the", "writer", "manually", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L729-L731
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CrxApi.java
CrxApi.postPackageServiceJsonAsync
public com.squareup.okhttp.Call postPackageServiceJsonAsync(String path, String cmd, String groupName, String packageName, String packageVersion, String charset_, Boolean force, Boolean recursive, File _package, final ApiCallback<String> callback) throws ApiException { """ (asynchronously) @param path (required) @param cmd (required) @param groupName (optional) @param packageName (optional) @param packageVersion (optional) @param charset_ (optional) @param force (optional) @param recursive (optional) @param _package (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postPackageServiceJsonValidateBeforeCall(path, cmd, groupName, packageName, packageVersion, charset_, force, recursive, _package, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call postPackageServiceJsonAsync(String path, String cmd, String groupName, String packageName, String packageVersion, String charset_, Boolean force, Boolean recursive, File _package, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postPackageServiceJsonValidateBeforeCall(path, cmd, groupName, packageName, packageVersion, charset_, force, recursive, _package, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postPackageServiceJsonAsync", "(", "String", "path", ",", "String", "cmd", ",", "String", "groupName", ",", "String", "packageName", ",", "String", "packageVersion", ",", "String", "charset_", ",", "Boolean", "force", ",", "Boolean", "recursive", ",", "File", "_package", ",", "final", "ApiCallback", "<", "String", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "postPackageServiceJsonValidateBeforeCall", "(", "path", ",", "cmd", ",", "groupName", ",", "packageName", ",", "packageVersion", ",", "charset_", ",", "force", ",", "recursive", ",", "_package", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "String", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
(asynchronously) @param path (required) @param cmd (required) @param groupName (optional) @param packageName (optional) @param packageVersion (optional) @param charset_ (optional) @param force (optional) @param recursive (optional) @param _package (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CrxApi.java#L574-L599
JOML-CI/JOML
src/org/joml/Intersectiond.java
Intersectiond.intersectLineSegmentAab
public static int intersectLineSegmentAab(Vector3dc p0, Vector3dc p1, Vector3dc min, Vector3dc max, Vector2d result) { """ Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code> intersects the axis-aligned box given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection. <p> This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> @see #intersectLineSegmentAab(Vector3dc, Vector3dc, Vector3dc, Vector3dc, Vector2d) @param p0 the line segment's first end point @param p1 the line segment's second end point @param min the minimum corner of the axis-aligned box @param max the maximum corner of the axis-aligned box @param result a vector which will hold the resulting values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection iff the line segment intersects the axis-aligned box @return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned box; or {@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned box; or {@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned box; or {@link #TWO_INTERSECTION} if the line segment intersects two sides of the axis-aligned box or lies on an edge or a side of the box """ return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result); }
java
public static int intersectLineSegmentAab(Vector3dc p0, Vector3dc p1, Vector3dc min, Vector3dc max, Vector2d result) { return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result); }
[ "public", "static", "int", "intersectLineSegmentAab", "(", "Vector3dc", "p0", ",", "Vector3dc", "p1", ",", "Vector3dc", "min", ",", "Vector3dc", "max", ",", "Vector2d", "result", ")", "{", "return", "intersectLineSegmentAab", "(", "p0", ".", "x", "(", ")", ",", "p0", ".", "y", "(", ")", ",", "p0", ".", "z", "(", ")", ",", "p1", ".", "x", "(", ")", ",", "p1", ".", "y", "(", ")", ",", "p1", ".", "z", "(", ")", ",", "min", ".", "x", "(", ")", ",", "min", ".", "y", "(", ")", ",", "min", ".", "z", "(", ")", ",", "max", ".", "x", "(", ")", ",", "max", ".", "y", "(", ")", ",", "max", ".", "z", "(", ")", ",", "result", ")", ";", "}" ]
Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code> intersects the axis-aligned box given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection. <p> This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> @see #intersectLineSegmentAab(Vector3dc, Vector3dc, Vector3dc, Vector3dc, Vector2d) @param p0 the line segment's first end point @param p1 the line segment's second end point @param min the minimum corner of the axis-aligned box @param max the maximum corner of the axis-aligned box @param result a vector which will hold the resulting values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection iff the line segment intersects the axis-aligned box @return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned box; or {@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned box; or {@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned box; or {@link #TWO_INTERSECTION} if the line segment intersects two sides of the axis-aligned box or lies on an edge or a side of the box
[ "Determine", "whether", "the", "undirected", "line", "segment", "with", "the", "end", "points", "<code", ">", "p0<", "/", "code", ">", "and", "<code", ">", "p1<", "/", "code", ">", "intersects", "the", "axis", "-", "aligned", "box", "given", "as", "its", "minimum", "corner", "<code", ">", "min<", "/", "code", ">", "and", "maximum", "corner", "<code", ">", "max<", "/", "code", ">", "and", "return", "the", "values", "of", "the", "parameter", "<i", ">", "t<", "/", "i", ">", "in", "the", "ray", "equation", "<i", ">", "p", "(", "t", ")", "=", "origin", "+", "p0", "*", "(", "p1", "-", "p0", ")", "<", "/", "i", ">", "of", "the", "near", "and", "far", "point", "of", "intersection", ".", "<p", ">", "This", "method", "returns", "<code", ">", "true<", "/", "code", ">", "for", "a", "line", "segment", "whose", "either", "end", "point", "lies", "inside", "the", "axis", "-", "aligned", "box", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "https", ":", "//", "dl", ".", "acm", ".", "org", "/", "citation", ".", "cfm?id", "=", "1198748", ">", "An", "Efficient", "and", "Robust", "Ray–Box", "Intersection<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L2569-L2571
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/RecursiveXPathBuilder.java
RecursiveXPathBuilder.setNamespaceContext
public void setNamespaceContext(Map<String, String> prefix2uri) { """ Establish a namespace context that will be used in for the XPath. <p>Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.</p> @param prefix2uri maps from prefix to namespace URI. """ this.prefix2uri = prefix2uri == null ? Collections.<String, String> emptyMap() : Collections.unmodifiableMap(prefix2uri); }
java
public void setNamespaceContext(Map<String, String> prefix2uri) { this.prefix2uri = prefix2uri == null ? Collections.<String, String> emptyMap() : Collections.unmodifiableMap(prefix2uri); }
[ "public", "void", "setNamespaceContext", "(", "Map", "<", "String", ",", "String", ">", "prefix2uri", ")", "{", "this", ".", "prefix2uri", "=", "prefix2uri", "==", "null", "?", "Collections", ".", "<", "String", ",", "String", ">", "emptyMap", "(", ")", ":", "Collections", ".", "unmodifiableMap", "(", "prefix2uri", ")", ";", "}" ]
Establish a namespace context that will be used in for the XPath. <p>Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.</p> @param prefix2uri maps from prefix to namespace URI.
[ "Establish", "a", "namespace", "context", "that", "will", "be", "used", "in", "for", "the", "XPath", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/RecursiveXPathBuilder.java#L45-L49
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java
ParsedAddressGrouping.getNetworkPrefixLength
public static Integer getNetworkPrefixLength(int bitsPerSegment, int segmentPrefixLength, int segmentIndex) { """ Translates a non-null segment prefix length into an address prefix length. When calling this for the first segment with a non-null prefix length, this gives the overall prefix length. <p> Across an address prefixes are: IPv6: (null):...:(null):(1 to 16):(0):...:(0) or IPv4: ...(null).(1 to 8).(0)... """ int increment = (bitsPerSegment == 8) ? segmentIndex << 3 : ((bitsPerSegment == 16) ? segmentIndex << 4 : segmentIndex * bitsPerSegment); return increment + segmentPrefixLength; }
java
public static Integer getNetworkPrefixLength(int bitsPerSegment, int segmentPrefixLength, int segmentIndex) { int increment = (bitsPerSegment == 8) ? segmentIndex << 3 : ((bitsPerSegment == 16) ? segmentIndex << 4 : segmentIndex * bitsPerSegment); return increment + segmentPrefixLength; }
[ "public", "static", "Integer", "getNetworkPrefixLength", "(", "int", "bitsPerSegment", ",", "int", "segmentPrefixLength", ",", "int", "segmentIndex", ")", "{", "int", "increment", "=", "(", "bitsPerSegment", "==", "8", ")", "?", "segmentIndex", "<<", "3", ":", "(", "(", "bitsPerSegment", "==", "16", ")", "?", "segmentIndex", "<<", "4", ":", "segmentIndex", "*", "bitsPerSegment", ")", ";", "return", "increment", "+", "segmentPrefixLength", ";", "}" ]
Translates a non-null segment prefix length into an address prefix length. When calling this for the first segment with a non-null prefix length, this gives the overall prefix length. <p> Across an address prefixes are: IPv6: (null):...:(null):(1 to 16):(0):...:(0) or IPv4: ...(null).(1 to 8).(0)...
[ "Translates", "a", "non", "-", "null", "segment", "prefix", "length", "into", "an", "address", "prefix", "length", ".", "When", "calling", "this", "for", "the", "first", "segment", "with", "a", "non", "-", "null", "prefix", "length", "this", "gives", "the", "overall", "prefix", "length", ".", "<p", ">", "Across", "an", "address", "prefixes", "are", ":", "IPv6", ":", "(", "null", ")", ":", "...", ":", "(", "null", ")", ":", "(", "1", "to", "16", ")", ":", "(", "0", ")", ":", "...", ":", "(", "0", ")", "or", "IPv4", ":", "...", "(", "null", ")", ".", "(", "1", "to", "8", ")", ".", "(", "0", ")", "..." ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java#L101-L104
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowUtils.java
WindowUtils.installWeakWindowFocusListener
public static void installWeakWindowFocusListener(JComponent component, WindowFocusListener focusListener) { """ Installs a {@link WindowFocusListener} on the given {@link JComponent}'s parent {@link Window}. If the {@code JComponent} doesn't yet have a parent, then the listener will be installed when the component is added to a container. @param component the component who's parent frame to listen to focus changes on. @param focusListener the {@code WindowFocusListener} to notify when focus changes. """ WindowListener weakFocusListener = createWeakWindowFocusListener(focusListener); AncestorListener ancestorListener = createAncestorListener(component, weakFocusListener); component.addAncestorListener(ancestorListener); }
java
public static void installWeakWindowFocusListener(JComponent component, WindowFocusListener focusListener) { WindowListener weakFocusListener = createWeakWindowFocusListener(focusListener); AncestorListener ancestorListener = createAncestorListener(component, weakFocusListener); component.addAncestorListener(ancestorListener); }
[ "public", "static", "void", "installWeakWindowFocusListener", "(", "JComponent", "component", ",", "WindowFocusListener", "focusListener", ")", "{", "WindowListener", "weakFocusListener", "=", "createWeakWindowFocusListener", "(", "focusListener", ")", ";", "AncestorListener", "ancestorListener", "=", "createAncestorListener", "(", "component", ",", "weakFocusListener", ")", ";", "component", ".", "addAncestorListener", "(", "ancestorListener", ")", ";", "}" ]
Installs a {@link WindowFocusListener} on the given {@link JComponent}'s parent {@link Window}. If the {@code JComponent} doesn't yet have a parent, then the listener will be installed when the component is added to a container. @param component the component who's parent frame to listen to focus changes on. @param focusListener the {@code WindowFocusListener} to notify when focus changes.
[ "Installs", "a", "{", "@link", "WindowFocusListener", "}", "on", "the", "given", "{", "@link", "JComponent", "}", "s", "parent", "{", "@link", "Window", "}", ".", "If", "the", "{", "@code", "JComponent", "}", "doesn", "t", "yet", "have", "a", "parent", "then", "the", "listener", "will", "be", "installed", "when", "the", "component", "is", "added", "to", "a", "container", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowUtils.java#L185-L190
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java
ErrorUtils.printParseError
public static String printParseError(ParseError error, Formatter<InvalidInputError> formatter) { """ Pretty prints the given parse error showing its location in the given input buffer. @param error the parse error @param formatter the formatter for InvalidInputErrors @return the pretty print text """ checkArgNotNull(error, "error"); checkArgNotNull(formatter, "formatter"); String message = error.getErrorMessage() != null ? error.getErrorMessage() : error instanceof InvalidInputError ? formatter.format((InvalidInputError) error) : error.getClass().getSimpleName(); return printErrorMessage("%s (line %s, pos %s):", message, error.getStartIndex(), error.getEndIndex(), error.getInputBuffer()); }
java
public static String printParseError(ParseError error, Formatter<InvalidInputError> formatter) { checkArgNotNull(error, "error"); checkArgNotNull(formatter, "formatter"); String message = error.getErrorMessage() != null ? error.getErrorMessage() : error instanceof InvalidInputError ? formatter.format((InvalidInputError) error) : error.getClass().getSimpleName(); return printErrorMessage("%s (line %s, pos %s):", message, error.getStartIndex(), error.getEndIndex(), error.getInputBuffer()); }
[ "public", "static", "String", "printParseError", "(", "ParseError", "error", ",", "Formatter", "<", "InvalidInputError", ">", "formatter", ")", "{", "checkArgNotNull", "(", "error", ",", "\"error\"", ")", ";", "checkArgNotNull", "(", "formatter", ",", "\"formatter\"", ")", ";", "String", "message", "=", "error", ".", "getErrorMessage", "(", ")", "!=", "null", "?", "error", ".", "getErrorMessage", "(", ")", ":", "error", "instanceof", "InvalidInputError", "?", "formatter", ".", "format", "(", "(", "InvalidInputError", ")", "error", ")", ":", "error", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "return", "printErrorMessage", "(", "\"%s (line %s, pos %s):\"", ",", "message", ",", "error", ".", "getStartIndex", "(", ")", ",", "error", ".", "getEndIndex", "(", ")", ",", "error", ".", "getInputBuffer", "(", ")", ")", ";", "}" ]
Pretty prints the given parse error showing its location in the given input buffer. @param error the parse error @param formatter the formatter for InvalidInputErrors @return the pretty print text
[ "Pretty", "prints", "the", "given", "parse", "error", "showing", "its", "location", "in", "the", "given", "input", "buffer", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java#L112-L120
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseLongObj
@Nullable public static Long parseLongObj (@Nullable final Object aObject, @Nullable final Long aDefault) { """ Parse the given {@link Object} as {@link Long} with radix {@value #DEFAULT_RADIX}. @param aObject The object to parse. May be <code>null</code>. @param aDefault The default value to be returned if the passed object cannot be converted to a Long. May be <code>null</code>. @return <code>aDefault</code> if the object does not represent a valid value. """ return parseLongObj (aObject, DEFAULT_RADIX, aDefault); }
java
@Nullable public static Long parseLongObj (@Nullable final Object aObject, @Nullable final Long aDefault) { return parseLongObj (aObject, DEFAULT_RADIX, aDefault); }
[ "@", "Nullable", "public", "static", "Long", "parseLongObj", "(", "@", "Nullable", "final", "Object", "aObject", ",", "@", "Nullable", "final", "Long", "aDefault", ")", "{", "return", "parseLongObj", "(", "aObject", ",", "DEFAULT_RADIX", ",", "aDefault", ")", ";", "}" ]
Parse the given {@link Object} as {@link Long} with radix {@value #DEFAULT_RADIX}. @param aObject The object to parse. May be <code>null</code>. @param aDefault The default value to be returned if the passed object cannot be converted to a Long. May be <code>null</code>. @return <code>aDefault</code> if the object does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "Object", "}", "as", "{", "@link", "Long", "}", "with", "radix", "{", "@value", "#DEFAULT_RADIX", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1075-L1079
jmeetsma/Iglu-Common
src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java
StandardCache.createCache
public static <K, V> Cache<K, V> createCache(String cacheName) { """ Retrieves a cache from the current layer or creates it. Only a root request will be able to embed the constructed cache in the application. @param cacheName cache service ID @return """ return createCache(cacheName, DEFAULT_TTL, DEFAULT_CLEANUP_INTERVAL/*, application, layer*/); }
java
public static <K, V> Cache<K, V> createCache(String cacheName) { return createCache(cacheName, DEFAULT_TTL, DEFAULT_CLEANUP_INTERVAL/*, application, layer*/); }
[ "public", "static", "<", "K", ",", "V", ">", "Cache", "<", "K", ",", "V", ">", "createCache", "(", "String", "cacheName", ")", "{", "return", "createCache", "(", "cacheName", ",", "DEFAULT_TTL", ",", "DEFAULT_CLEANUP_INTERVAL", "/*, application, layer*/", ")", ";", "}" ]
Retrieves a cache from the current layer or creates it. Only a root request will be able to embed the constructed cache in the application. @param cacheName cache service ID @return
[ "Retrieves", "a", "cache", "from", "the", "current", "layer", "or", "creates", "it", ".", "Only", "a", "root", "request", "will", "be", "able", "to", "embed", "the", "constructed", "cache", "in", "the", "application", "." ]
train
https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java#L404-L406
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java
NodeSet.setElementAt
public void setElementAt(Node node, int index) { """ Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded. The index must be a value greater than or equal to 0 and less than the current size of the vector. @param node Node to set @param index Index of where to set the node """ if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } m_map[index] = node; }
java
public void setElementAt(Node node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } m_map[index] = node; }
[ "public", "void", "setElementAt", "(", "Node", "node", ",", "int", "index", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESET_NOT_MUTABLE", ",", "null", ")", ")", ";", "//\"This NodeSet is not mutable!\");", "if", "(", "null", "==", "m_map", ")", "{", "m_map", "=", "new", "Node", "[", "m_blocksize", "]", ";", "m_mapSize", "=", "m_blocksize", ";", "}", "m_map", "[", "index", "]", "=", "node", ";", "}" ]
Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded. The index must be a value greater than or equal to 0 and less than the current size of the vector. @param node Node to set @param index Index of where to set the node
[ "Sets", "the", "component", "at", "the", "specified", "index", "of", "this", "vector", "to", "be", "the", "specified", "object", ".", "The", "previous", "component", "at", "that", "position", "is", "discarded", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L1258-L1270
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/FormatUtils.java
FormatUtils.condenseFileSize
public static String condenseFileSize(long bytes, String precision) throws IllegalFormatException { """ Condense a file size in bytes to it's highest form (i.e. KB, MB, GB, etc) @param bytes the size in bytes @param precision the precision constant {@code ONE_DIGIT}, {@code TWO_DIGIT}, {@code THREE_DIGIT} @return the condensed string """ // Kilobyte Check float kilo = bytes / 1024f; float mega = kilo / 1024f; float giga = mega / 1024f; float tera = giga / 1024f; float peta = tera / 1024f; // Determine which value to send back if(peta > 1) return String.format(precision + " PB", peta); else if (tera > 1) return String.format(precision + " TB", tera); else if(giga > 1) return String.format(precision + " GB", giga); else if(mega > 1) return String.format(precision + " MB", mega); else if(kilo > 1) return String.format(precision + " KB", kilo); else return bytes + " b"; }
java
public static String condenseFileSize(long bytes, String precision) throws IllegalFormatException { // Kilobyte Check float kilo = bytes / 1024f; float mega = kilo / 1024f; float giga = mega / 1024f; float tera = giga / 1024f; float peta = tera / 1024f; // Determine which value to send back if(peta > 1) return String.format(precision + " PB", peta); else if (tera > 1) return String.format(precision + " TB", tera); else if(giga > 1) return String.format(precision + " GB", giga); else if(mega > 1) return String.format(precision + " MB", mega); else if(kilo > 1) return String.format(precision + " KB", kilo); else return bytes + " b"; }
[ "public", "static", "String", "condenseFileSize", "(", "long", "bytes", ",", "String", "precision", ")", "throws", "IllegalFormatException", "{", "// Kilobyte Check", "float", "kilo", "=", "bytes", "/", "1024f", ";", "float", "mega", "=", "kilo", "/", "1024f", ";", "float", "giga", "=", "mega", "/", "1024f", ";", "float", "tera", "=", "giga", "/", "1024f", ";", "float", "peta", "=", "tera", "/", "1024f", ";", "// Determine which value to send back", "if", "(", "peta", ">", "1", ")", "return", "String", ".", "format", "(", "precision", "+", "\" PB\"", ",", "peta", ")", ";", "else", "if", "(", "tera", ">", "1", ")", "return", "String", ".", "format", "(", "precision", "+", "\" TB\"", ",", "tera", ")", ";", "else", "if", "(", "giga", ">", "1", ")", "return", "String", ".", "format", "(", "precision", "+", "\" GB\"", ",", "giga", ")", ";", "else", "if", "(", "mega", ">", "1", ")", "return", "String", ".", "format", "(", "precision", "+", "\" MB\"", ",", "mega", ")", ";", "else", "if", "(", "kilo", ">", "1", ")", "return", "String", ".", "format", "(", "precision", "+", "\" KB\"", ",", "kilo", ")", ";", "else", "return", "bytes", "+", "\" b\"", ";", "}" ]
Condense a file size in bytes to it's highest form (i.e. KB, MB, GB, etc) @param bytes the size in bytes @param precision the precision constant {@code ONE_DIGIT}, {@code TWO_DIGIT}, {@code THREE_DIGIT} @return the condensed string
[ "Condense", "a", "file", "size", "in", "bytes", "to", "it", "s", "highest", "form", "(", "i", ".", "e", ".", "KB", "MB", "GB", "etc", ")" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/FormatUtils.java#L93-L116
playn/playn
html/src/playn/super/java/nio/ByteBuffer.java
ByteBuffer.putInt
public final ByteBuffer putInt (int baseOffset, int value) { """ Writes the given int to the specified index of this buffer. <p> The int is converted to bytes using the current byte order. The position is not changed. </p> @param index the index, must not be negative and equal or less than {@code limit - 4}. @param value the int to write. @return this buffer. @exception IndexOutOfBoundsException if {@code index} is invalid. @exception ReadOnlyBufferException if no changes may be made to the contents of this buffer. """ if (order == ByteOrder.BIG_ENDIAN) { for (int i = 3; i >= 0; i--) { byteArray.set(baseOffset + i, (byte)(value & 0xFF)); value = value >> 8; } } else { for (int i = 0; i <= 3; i++) { byteArray.set(baseOffset + i, (byte)(value & 0xFF)); value = value >> 8; } } return this; }
java
public final ByteBuffer putInt (int baseOffset, int value) { if (order == ByteOrder.BIG_ENDIAN) { for (int i = 3; i >= 0; i--) { byteArray.set(baseOffset + i, (byte)(value & 0xFF)); value = value >> 8; } } else { for (int i = 0; i <= 3; i++) { byteArray.set(baseOffset + i, (byte)(value & 0xFF)); value = value >> 8; } } return this; }
[ "public", "final", "ByteBuffer", "putInt", "(", "int", "baseOffset", ",", "int", "value", ")", "{", "if", "(", "order", "==", "ByteOrder", ".", "BIG_ENDIAN", ")", "{", "for", "(", "int", "i", "=", "3", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "byteArray", ".", "set", "(", "baseOffset", "+", "i", ",", "(", "byte", ")", "(", "value", "&", "0xFF", ")", ")", ";", "value", "=", "value", ">>", "8", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "3", ";", "i", "++", ")", "{", "byteArray", ".", "set", "(", "baseOffset", "+", "i", ",", "(", "byte", ")", "(", "value", "&", "0xFF", ")", ")", ";", "value", "=", "value", ">>", "8", ";", "}", "}", "return", "this", ";", "}" ]
Writes the given int to the specified index of this buffer. <p> The int is converted to bytes using the current byte order. The position is not changed. </p> @param index the index, must not be negative and equal or less than {@code limit - 4}. @param value the int to write. @return this buffer. @exception IndexOutOfBoundsException if {@code index} is invalid. @exception ReadOnlyBufferException if no changes may be made to the contents of this buffer.
[ "Writes", "the", "given", "int", "to", "the", "specified", "index", "of", "this", "buffer", ".", "<p", ">", "The", "int", "is", "converted", "to", "bytes", "using", "the", "current", "byte", "order", ".", "The", "position", "is", "not", "changed", ".", "<", "/", "p", ">" ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/ByteBuffer.java#L802-L815
square/dagger
core/src/main/java/dagger/internal/Keys.java
Keys.get
private static String get(Type type, Annotation annotation) { """ Returns a key for {@code type} annotated by {@code annotation}. """ type = boxIfPrimitive(type); if (annotation == null && type instanceof Class && !((Class<?>) type).isArray()) { return ((Class<?>) type).getName(); } StringBuilder result = new StringBuilder(); if (annotation != null) { result.append(annotation).append("/"); } typeToString(type, result, true); return result.toString(); }
java
private static String get(Type type, Annotation annotation) { type = boxIfPrimitive(type); if (annotation == null && type instanceof Class && !((Class<?>) type).isArray()) { return ((Class<?>) type).getName(); } StringBuilder result = new StringBuilder(); if (annotation != null) { result.append(annotation).append("/"); } typeToString(type, result, true); return result.toString(); }
[ "private", "static", "String", "get", "(", "Type", "type", ",", "Annotation", "annotation", ")", "{", "type", "=", "boxIfPrimitive", "(", "type", ")", ";", "if", "(", "annotation", "==", "null", "&&", "type", "instanceof", "Class", "&&", "!", "(", "(", "Class", "<", "?", ">", ")", "type", ")", ".", "isArray", "(", ")", ")", "{", "return", "(", "(", "Class", "<", "?", ">", ")", "type", ")", ".", "getName", "(", ")", ";", "}", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "annotation", "!=", "null", ")", "{", "result", ".", "append", "(", "annotation", ")", ".", "append", "(", "\"/\"", ")", ";", "}", "typeToString", "(", "type", ",", "result", ",", "true", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Returns a key for {@code type} annotated by {@code annotation}.
[ "Returns", "a", "key", "for", "{" ]
train
https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Keys.java#L71-L82
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.replaceAll
public StrBuilder replaceAll(final char search, final char replace) { """ Replaces the search character with the replace character throughout the builder. @param search the search character @param replace the replace character @return this, to enable chaining """ if (search != replace) { for (int i = 0; i < size; i++) { if (buffer[i] == search) { buffer[i] = replace; } } } return this; }
java
public StrBuilder replaceAll(final char search, final char replace) { if (search != replace) { for (int i = 0; i < size; i++) { if (buffer[i] == search) { buffer[i] = replace; } } } return this; }
[ "public", "StrBuilder", "replaceAll", "(", "final", "char", "search", ",", "final", "char", "replace", ")", "{", "if", "(", "search", "!=", "replace", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "buffer", "[", "i", "]", "==", "search", ")", "{", "buffer", "[", "i", "]", "=", "replace", ";", "}", "}", "}", "return", "this", ";", "}" ]
Replaces the search character with the replace character throughout the builder. @param search the search character @param replace the replace character @return this, to enable chaining
[ "Replaces", "the", "search", "character", "with", "the", "replace", "character", "throughout", "the", "builder", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1967-L1976
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java
ClusterSampling.xbarVariance
public static double xbarVariance(TransposeDataCollection sampleDataCollection, int populationM, double Nbar) { """ Calculates Variance for Xbar @param sampleDataCollection @param populationM @param Nbar @return """ double xbarVariance = 0.0; int sampleM = sampleDataCollection.size(); double mean = mean(sampleDataCollection); for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) { double sum = 0.0; Iterator<Double> it = entry.getValue().iteratorDouble(); while(it.hasNext()) { sum+=(it.next() - mean); } xbarVariance+= sum*sum/(sampleM-1); } xbarVariance *= (populationM-sampleM)/(populationM*sampleM*Nbar*Nbar); return xbarVariance; }
java
public static double xbarVariance(TransposeDataCollection sampleDataCollection, int populationM, double Nbar) { double xbarVariance = 0.0; int sampleM = sampleDataCollection.size(); double mean = mean(sampleDataCollection); for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) { double sum = 0.0; Iterator<Double> it = entry.getValue().iteratorDouble(); while(it.hasNext()) { sum+=(it.next() - mean); } xbarVariance+= sum*sum/(sampleM-1); } xbarVariance *= (populationM-sampleM)/(populationM*sampleM*Nbar*Nbar); return xbarVariance; }
[ "public", "static", "double", "xbarVariance", "(", "TransposeDataCollection", "sampleDataCollection", ",", "int", "populationM", ",", "double", "Nbar", ")", "{", "double", "xbarVariance", "=", "0.0", ";", "int", "sampleM", "=", "sampleDataCollection", ".", "size", "(", ")", ";", "double", "mean", "=", "mean", "(", "sampleDataCollection", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "FlatDataCollection", ">", "entry", ":", "sampleDataCollection", ".", "entrySet", "(", ")", ")", "{", "double", "sum", "=", "0.0", ";", "Iterator", "<", "Double", ">", "it", "=", "entry", ".", "getValue", "(", ")", ".", "iteratorDouble", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "sum", "+=", "(", "it", ".", "next", "(", ")", "-", "mean", ")", ";", "}", "xbarVariance", "+=", "sum", "*", "sum", "/", "(", "sampleM", "-", "1", ")", ";", "}", "xbarVariance", "*=", "(", "populationM", "-", "sampleM", ")", "/", "(", "populationM", "*", "sampleM", "*", "Nbar", "*", "Nbar", ")", ";", "return", "xbarVariance", ";", "}" ]
Calculates Variance for Xbar @param sampleDataCollection @param populationM @param Nbar @return
[ "Calculates", "Variance", "for", "Xbar" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java#L103-L122
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineSliders
private void defineSliders(UIDefaults d) { """ Initialize the slider settings. @param d the UI defaults map. """ // Rossi: slider inner color changed from gray to "white" d.put("sliderTrackBorderBase", new Color(0x709ad0)); // d.put("sliderTrackInteriorBase", new Color(0x709ad0)); // blue better? d.put("sliderTrackInteriorBase", Color.WHITE); // Light blue better? String p = "Slider"; d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape"); d.put(p + ".ArrowShape", new SliderArrowShapeState()); d.put(p + ".thumbWidth", new Integer(17)); d.put(p + ".thumbHeight", new Integer(20)); d.put(p + ".trackBorder", new Integer(0)); d.put(p + ".trackHeight", new Integer(5)); // Rossi: Changed ticks to dark blue to make them "less massive" d.put(p + ".tickColor", new Color(0x5b7ea4)); d.put(p + "[Disabled].tickColor", getDerivedColor("seaGlassDisabledText", 0, 0, 0, 0, true)); d.put(p + ".font", new DerivedFont("defaultFont", 0.769f, null, null)); d.put(p + ".paintValue", Boolean.FALSE); p = "Slider:SliderThumb"; String c = PAINTER_PREFIX + "SliderThumbPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape"); d.put(p + ".ArrowShape", new SliderArrowShapeState()); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Focused].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED)); d.put(p + "[Focused+MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_MOUSEOVER)); d.put(p + "[Focused+Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_PRESSED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[ArrowShape+Enabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_ENABLED_ARROWSHAPE)); d.put(p + "[ArrowShape+Disabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_DISABLED_ARROWSHAPE)); d.put(p + "[ArrowShape+MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_MOUSEOVER_ARROWSHAPE)); d.put(p + "[ArrowShape+Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_PRESSED_ARROWSHAPE)); d.put(p + "[ArrowShape+Focused].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_ARROWSHAPE)); d.put(p + "[ArrowShape+Focused+MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_MOUSEOVER_ARROWSHAPE)); d.put(p + "[ArrowShape+Focused+Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_PRESSED_ARROWSHAPE)); p = "Slider:SliderTrack"; c = PAINTER_PREFIX + "SliderTrackPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape"); d.put(p + ".ArrowShape", new SliderArrowShapeState()); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, SliderTrackPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SliderTrackPainter.Which.BACKGROUND_ENABLED)); }
java
private void defineSliders(UIDefaults d) { // Rossi: slider inner color changed from gray to "white" d.put("sliderTrackBorderBase", new Color(0x709ad0)); // d.put("sliderTrackInteriorBase", new Color(0x709ad0)); // blue better? d.put("sliderTrackInteriorBase", Color.WHITE); // Light blue better? String p = "Slider"; d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape"); d.put(p + ".ArrowShape", new SliderArrowShapeState()); d.put(p + ".thumbWidth", new Integer(17)); d.put(p + ".thumbHeight", new Integer(20)); d.put(p + ".trackBorder", new Integer(0)); d.put(p + ".trackHeight", new Integer(5)); // Rossi: Changed ticks to dark blue to make them "less massive" d.put(p + ".tickColor", new Color(0x5b7ea4)); d.put(p + "[Disabled].tickColor", getDerivedColor("seaGlassDisabledText", 0, 0, 0, 0, true)); d.put(p + ".font", new DerivedFont("defaultFont", 0.769f, null, null)); d.put(p + ".paintValue", Boolean.FALSE); p = "Slider:SliderThumb"; String c = PAINTER_PREFIX + "SliderThumbPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape"); d.put(p + ".ArrowShape", new SliderArrowShapeState()); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Focused].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED)); d.put(p + "[Focused+MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_MOUSEOVER)); d.put(p + "[Focused+Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_PRESSED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[ArrowShape+Enabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_ENABLED_ARROWSHAPE)); d.put(p + "[ArrowShape+Disabled].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_DISABLED_ARROWSHAPE)); d.put(p + "[ArrowShape+MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_MOUSEOVER_ARROWSHAPE)); d.put(p + "[ArrowShape+Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_PRESSED_ARROWSHAPE)); d.put(p + "[ArrowShape+Focused].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_ARROWSHAPE)); d.put(p + "[ArrowShape+Focused+MouseOver].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_MOUSEOVER_ARROWSHAPE)); d.put(p + "[ArrowShape+Focused+Pressed].backgroundPainter", new LazyPainter(c, SliderThumbPainter.Which.BACKGROUND_FOCUSED_PRESSED_ARROWSHAPE)); p = "Slider:SliderTrack"; c = PAINTER_PREFIX + "SliderTrackPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape"); d.put(p + ".ArrowShape", new SliderArrowShapeState()); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, SliderTrackPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SliderTrackPainter.Which.BACKGROUND_ENABLED)); }
[ "private", "void", "defineSliders", "(", "UIDefaults", "d", ")", "{", "// Rossi: slider inner color changed from gray to \"white\"", "d", ".", "put", "(", "\"sliderTrackBorderBase\"", ",", "new", "Color", "(", "0x709ad0", ")", ")", ";", "// d.put(\"sliderTrackInteriorBase\", new Color(0x709ad0)); // blue better?", "d", ".", "put", "(", "\"sliderTrackInteriorBase\"", ",", "Color", ".", "WHITE", ")", ";", "// Light blue better?", "String", "p", "=", "\"Slider\"", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".ArrowShape\"", ",", "new", "SliderArrowShapeState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".thumbWidth\"", ",", "new", "Integer", "(", "17", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".thumbHeight\"", ",", "new", "Integer", "(", "20", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".trackBorder\"", ",", "new", "Integer", "(", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".trackHeight\"", ",", "new", "Integer", "(", "5", ")", ")", ";", "// Rossi: Changed ticks to dark blue to make them \"less massive\"", "d", ".", "put", "(", "p", "+", "\".tickColor\"", ",", "new", "Color", "(", "0x5b7ea4", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].tickColor\"", ",", "getDerivedColor", "(", "\"seaGlassDisabledText\"", ",", "0", ",", "0", ",", "0", ",", "0", ",", "true", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".font\"", ",", "new", "DerivedFont", "(", "\"defaultFont\"", ",", "0.769f", ",", "null", ",", "null", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".paintValue\"", ",", "Boolean", ".", "FALSE", ")", ";", "p", "=", "\"Slider:SliderThumb\"", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"SliderThumbPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".ArrowShape\"", ",", "new", "SliderArrowShapeState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Focused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_FOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Focused+MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_FOCUSED_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Focused+Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_FOCUSED_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[ArrowShape+Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_ENABLED_ARROWSHAPE", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[ArrowShape+Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_DISABLED_ARROWSHAPE", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[ArrowShape+MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER_ARROWSHAPE", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[ArrowShape+Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_PRESSED_ARROWSHAPE", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[ArrowShape+Focused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_FOCUSED_ARROWSHAPE", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[ArrowShape+Focused+MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_FOCUSED_MOUSEOVER_ARROWSHAPE", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[ArrowShape+Focused+Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderThumbPainter", ".", "Which", ".", "BACKGROUND_FOCUSED_PRESSED_ARROWSHAPE", ")", ")", ";", "p", "=", "\"Slider:SliderTrack\"", ";", "c", "=", "PAINTER_PREFIX", "+", "\"SliderTrackPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Pressed,Disabled,Focused,Selected,ArrowShape\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".ArrowShape\"", ",", "new", "SliderArrowShapeState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderTrackPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SliderTrackPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "}" ]
Initialize the slider settings. @param d the UI defaults map.
[ "Initialize", "the", "slider", "settings", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1782-L1828
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/PathOverlay.java
PathOverlay.addGreatCircle
public void addGreatCircle(final GeoPoint startPoint, final GeoPoint endPoint, final int numberOfPoints) { """ Draw a great circle. @param startPoint start point of the great circle @param endPoint end point of the great circle @param numberOfPoints number of points to calculate along the path """ // adapted from page http://compastic.blogspot.co.uk/2011/07/how-to-draw-great-circle-on-map-in.html // which was adapted from page http://maps.forum.nu/gm_flight_path.html // convert to radians final double lat1 = startPoint.getLatitude() * Math.PI / 180; final double lon1 = startPoint.getLongitude() * Math.PI / 180; final double lat2 = endPoint.getLatitude() * Math.PI / 180; final double lon2 = endPoint.getLongitude() * Math.PI / 180; final double d = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin((lat1 - lat2) / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin((lon1 - lon2) / 2), 2))); double bearing = Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2)) / -(Math.PI / 180); bearing = bearing < 0 ? 360 + bearing : bearing; for (int i = 0, j = numberOfPoints + 1; i < j; i++) { final double f = 1.0 / numberOfPoints * i; final double A = Math.sin((1 - f) * d) / Math.sin(d); final double B = Math.sin(f * d) / Math.sin(d); final double x = A * Math.cos(lat1) * Math.cos(lon1) + B * Math.cos(lat2) * Math.cos(lon2); final double y = A * Math.cos(lat1) * Math.sin(lon1) + B * Math.cos(lat2) * Math.sin(lon2); final double z = A * Math.sin(lat1) + B * Math.sin(lat2); final double latN = Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))); final double lonN = Math.atan2(y, x); addPoint(latN / (Math.PI / 180), lonN / (Math.PI / 180)); } }
java
public void addGreatCircle(final GeoPoint startPoint, final GeoPoint endPoint, final int numberOfPoints) { // adapted from page http://compastic.blogspot.co.uk/2011/07/how-to-draw-great-circle-on-map-in.html // which was adapted from page http://maps.forum.nu/gm_flight_path.html // convert to radians final double lat1 = startPoint.getLatitude() * Math.PI / 180; final double lon1 = startPoint.getLongitude() * Math.PI / 180; final double lat2 = endPoint.getLatitude() * Math.PI / 180; final double lon2 = endPoint.getLongitude() * Math.PI / 180; final double d = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin((lat1 - lat2) / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin((lon1 - lon2) / 2), 2))); double bearing = Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2)) / -(Math.PI / 180); bearing = bearing < 0 ? 360 + bearing : bearing; for (int i = 0, j = numberOfPoints + 1; i < j; i++) { final double f = 1.0 / numberOfPoints * i; final double A = Math.sin((1 - f) * d) / Math.sin(d); final double B = Math.sin(f * d) / Math.sin(d); final double x = A * Math.cos(lat1) * Math.cos(lon1) + B * Math.cos(lat2) * Math.cos(lon2); final double y = A * Math.cos(lat1) * Math.sin(lon1) + B * Math.cos(lat2) * Math.sin(lon2); final double z = A * Math.sin(lat1) + B * Math.sin(lat2); final double latN = Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))); final double lonN = Math.atan2(y, x); addPoint(latN / (Math.PI / 180), lonN / (Math.PI / 180)); } }
[ "public", "void", "addGreatCircle", "(", "final", "GeoPoint", "startPoint", ",", "final", "GeoPoint", "endPoint", ",", "final", "int", "numberOfPoints", ")", "{", "//\tadapted from page http://compastic.blogspot.co.uk/2011/07/how-to-draw-great-circle-on-map-in.html", "//\twhich was adapted from page http://maps.forum.nu/gm_flight_path.html", "// convert to radians", "final", "double", "lat1", "=", "startPoint", ".", "getLatitude", "(", ")", "*", "Math", ".", "PI", "/", "180", ";", "final", "double", "lon1", "=", "startPoint", ".", "getLongitude", "(", ")", "*", "Math", ".", "PI", "/", "180", ";", "final", "double", "lat2", "=", "endPoint", ".", "getLatitude", "(", ")", "*", "Math", ".", "PI", "/", "180", ";", "final", "double", "lon2", "=", "endPoint", ".", "getLongitude", "(", ")", "*", "Math", ".", "PI", "/", "180", ";", "final", "double", "d", "=", "2", "*", "Math", ".", "asin", "(", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "Math", ".", "sin", "(", "(", "lat1", "-", "lat2", ")", "/", "2", ")", ",", "2", ")", "+", "Math", ".", "cos", "(", "lat1", ")", "*", "Math", ".", "cos", "(", "lat2", ")", "*", "Math", ".", "pow", "(", "Math", ".", "sin", "(", "(", "lon1", "-", "lon2", ")", "/", "2", ")", ",", "2", ")", ")", ")", ";", "double", "bearing", "=", "Math", ".", "atan2", "(", "Math", ".", "sin", "(", "lon1", "-", "lon2", ")", "*", "Math", ".", "cos", "(", "lat2", ")", ",", "Math", ".", "cos", "(", "lat1", ")", "*", "Math", ".", "sin", "(", "lat2", ")", "-", "Math", ".", "sin", "(", "lat1", ")", "*", "Math", ".", "cos", "(", "lat2", ")", "*", "Math", ".", "cos", "(", "lon1", "-", "lon2", ")", ")", "/", "-", "(", "Math", ".", "PI", "/", "180", ")", ";", "bearing", "=", "bearing", "<", "0", "?", "360", "+", "bearing", ":", "bearing", ";", "for", "(", "int", "i", "=", "0", ",", "j", "=", "numberOfPoints", "+", "1", ";", "i", "<", "j", ";", "i", "++", ")", "{", "final", "double", "f", "=", "1.0", "/", "numberOfPoints", "*", "i", ";", "final", "double", "A", "=", "Math", ".", "sin", "(", "(", "1", "-", "f", ")", "*", "d", ")", "/", "Math", ".", "sin", "(", "d", ")", ";", "final", "double", "B", "=", "Math", ".", "sin", "(", "f", "*", "d", ")", "/", "Math", ".", "sin", "(", "d", ")", ";", "final", "double", "x", "=", "A", "*", "Math", ".", "cos", "(", "lat1", ")", "*", "Math", ".", "cos", "(", "lon1", ")", "+", "B", "*", "Math", ".", "cos", "(", "lat2", ")", "*", "Math", ".", "cos", "(", "lon2", ")", ";", "final", "double", "y", "=", "A", "*", "Math", ".", "cos", "(", "lat1", ")", "*", "Math", ".", "sin", "(", "lon1", ")", "+", "B", "*", "Math", ".", "cos", "(", "lat2", ")", "*", "Math", ".", "sin", "(", "lon2", ")", ";", "final", "double", "z", "=", "A", "*", "Math", ".", "sin", "(", "lat1", ")", "+", "B", "*", "Math", ".", "sin", "(", "lat2", ")", ";", "final", "double", "latN", "=", "Math", ".", "atan2", "(", "z", ",", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "x", ",", "2", ")", "+", "Math", ".", "pow", "(", "y", ",", "2", ")", ")", ")", ";", "final", "double", "lonN", "=", "Math", ".", "atan2", "(", "y", ",", "x", ")", ";", "addPoint", "(", "latN", "/", "(", "Math", ".", "PI", "/", "180", ")", ",", "lonN", "/", "(", "Math", ".", "PI", "/", "180", ")", ")", ";", "}", "}" ]
Draw a great circle. @param startPoint start point of the great circle @param endPoint end point of the great circle @param numberOfPoints number of points to calculate along the path
[ "Draw", "a", "great", "circle", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/PathOverlay.java#L125-L154
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/engine/ClassParser.java
ClassParser.checkConstantTag
private void checkConstantTag(Constant constant, int expectedTag) throws InvalidClassFileFormatException { """ Check that a constant has the expected tag. @param constant the constant to check @param expectedTag the expected constant tag @throws InvalidClassFileFormatException if the constant's tag does not match the expected tag """ if (constant.tag != expectedTag) { throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry); } }
java
private void checkConstantTag(Constant constant, int expectedTag) throws InvalidClassFileFormatException { if (constant.tag != expectedTag) { throw new InvalidClassFileFormatException(expectedClassDescriptor, codeBaseEntry); } }
[ "private", "void", "checkConstantTag", "(", "Constant", "constant", ",", "int", "expectedTag", ")", "throws", "InvalidClassFileFormatException", "{", "if", "(", "constant", ".", "tag", "!=", "expectedTag", ")", "{", "throw", "new", "InvalidClassFileFormatException", "(", "expectedClassDescriptor", ",", "codeBaseEntry", ")", ";", "}", "}" ]
Check that a constant has the expected tag. @param constant the constant to check @param expectedTag the expected constant tag @throws InvalidClassFileFormatException if the constant's tag does not match the expected tag
[ "Check", "that", "a", "constant", "has", "the", "expected", "tag", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/engine/ClassParser.java#L364-L368
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
JavacFileManager.isValidFile
private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) { """ container is a directory, a zip file, or a non-existent path. """ JavaFileObject.Kind kind = getKind(s); return fileKinds.contains(kind); }
java
private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) { JavaFileObject.Kind kind = getKind(s); return fileKinds.contains(kind); }
[ "private", "boolean", "isValidFile", "(", "String", "s", ",", "Set", "<", "JavaFileObject", ".", "Kind", ">", "fileKinds", ")", "{", "JavaFileObject", ".", "Kind", "kind", "=", "getKind", "(", "s", ")", ";", "return", "fileKinds", ".", "contains", "(", "kind", ")", ";", "}" ]
container is a directory, a zip file, or a non-existent path.
[ "container", "is", "a", "directory", "a", "zip", "file", "or", "a", "non", "-", "existent", "path", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java#L613-L616
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L2_WSG84
@Pure public static GeodesicPosition L2_WSG84(double x, double y) { """ This function convert France Lambert II coordinate to geographic WSG84 Data. @param x is the coordinate in France Lambert II @param y is the coordinate in France Lambert II @return lambda and phi in geographic WSG84 in degrees. """ final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY()); }
java
@Pure public static GeodesicPosition L2_WSG84(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY()); }
[ "@", "Pure", "public", "static", "GeodesicPosition", "L2_WSG84", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_2_N", ",", "LAMBERT_2_C", ",", "LAMBERT_2_XS", ",", "LAMBERT_2_YS", ")", ";", "return", "NTFLambdaPhi_WSG84", "(", "ntfLambdaPhi", ".", "getX", "(", ")", ",", "ntfLambdaPhi", ".", "getY", "(", ")", ")", ";", "}" ]
This function convert France Lambert II coordinate to geographic WSG84 Data. @param x is the coordinate in France Lambert II @param y is the coordinate in France Lambert II @return lambda and phi in geographic WSG84 in degrees.
[ "This", "function", "convert", "France", "Lambert", "II", "coordinate", "to", "geographic", "WSG84", "Data", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L419-L427
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/QuickSelectDBIDs.java
QuickSelectDBIDs.quickSelect
public static void quickSelect(ArrayModifiableDBIDs data, Comparator<? super DBIDRef> comparator, int rank) { """ QuickSelect is essentially quicksort, except that we only "sort" that half of the array that we are interested in. Note: the array is <b>modified</b> by this. @param data Data to process @param comparator Comparator to use @param rank Rank position that we are interested in (integer!) """ quickSelect(data, comparator, 0, data.size(), rank); }
java
public static void quickSelect(ArrayModifiableDBIDs data, Comparator<? super DBIDRef> comparator, int rank) { quickSelect(data, comparator, 0, data.size(), rank); }
[ "public", "static", "void", "quickSelect", "(", "ArrayModifiableDBIDs", "data", ",", "Comparator", "<", "?", "super", "DBIDRef", ">", "comparator", ",", "int", "rank", ")", "{", "quickSelect", "(", "data", ",", "comparator", ",", "0", ",", "data", ".", "size", "(", ")", ",", "rank", ")", ";", "}" ]
QuickSelect is essentially quicksort, except that we only "sort" that half of the array that we are interested in. Note: the array is <b>modified</b> by this. @param data Data to process @param comparator Comparator to use @param rank Rank position that we are interested in (integer!)
[ "QuickSelect", "is", "essentially", "quicksort", "except", "that", "we", "only", "sort", "that", "half", "of", "the", "array", "that", "we", "are", "interested", "in", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/QuickSelectDBIDs.java#L88-L90
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java
DefinitionsDocument.buildDefinitionTitle
private void buildDefinitionTitle(MarkupDocBuilder markupDocBuilder, String title, String anchor) { """ Builds definition title @param markupDocBuilder the markupDocBuilder do use for output @param title definition title @param anchor optional anchor (null => auto-generate from title) """ markupDocBuilder.sectionTitleWithAnchorLevel2(title, anchor); }
java
private void buildDefinitionTitle(MarkupDocBuilder markupDocBuilder, String title, String anchor) { markupDocBuilder.sectionTitleWithAnchorLevel2(title, anchor); }
[ "private", "void", "buildDefinitionTitle", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "String", "title", ",", "String", "anchor", ")", "{", "markupDocBuilder", ".", "sectionTitleWithAnchorLevel2", "(", "title", ",", "anchor", ")", ";", "}" ]
Builds definition title @param markupDocBuilder the markupDocBuilder do use for output @param title definition title @param anchor optional anchor (null => auto-generate from title)
[ "Builds", "definition", "title" ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/document/DefinitionsDocument.java#L182-L184
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java
JsonAnnotations.getTypeProperty
public static EcoreTypeInfo getTypeProperty(final EClassifier classifier) { """ Returns the property that should be use to store the type information of the classifier. @param classifier @return the type information property """ String property = getValue(classifier, "JsonType", "property"); String use = getValue(classifier, "JsonType", "use"); ValueReader<String, EClass> valueReader = EcoreTypeInfo.defaultValueReader; ValueWriter<EClass, String> valueWriter = EcoreTypeInfo.defaultValueWriter; if (use != null) { EcoreTypeInfo.USE useType = EcoreTypeInfo.USE.valueOf(use.toUpperCase()); if (useType == NAME) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getName(); } else if (useType == CLASS) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getInstanceClassName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByQualifiedName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getInstanceClassName(); } else { valueReader = EcoreTypeInfo.defaultValueReader; valueWriter = EcoreTypeInfo.defaultValueWriter; } } return property != null ? new EcoreTypeInfo(property, valueReader, valueWriter): null; }
java
public static EcoreTypeInfo getTypeProperty(final EClassifier classifier) { String property = getValue(classifier, "JsonType", "property"); String use = getValue(classifier, "JsonType", "use"); ValueReader<String, EClass> valueReader = EcoreTypeInfo.defaultValueReader; ValueWriter<EClass, String> valueWriter = EcoreTypeInfo.defaultValueWriter; if (use != null) { EcoreTypeInfo.USE useType = EcoreTypeInfo.USE.valueOf(use.toUpperCase()); if (useType == NAME) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getName(); } else if (useType == CLASS) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getInstanceClassName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByQualifiedName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getInstanceClassName(); } else { valueReader = EcoreTypeInfo.defaultValueReader; valueWriter = EcoreTypeInfo.defaultValueWriter; } } return property != null ? new EcoreTypeInfo(property, valueReader, valueWriter): null; }
[ "public", "static", "EcoreTypeInfo", "getTypeProperty", "(", "final", "EClassifier", "classifier", ")", "{", "String", "property", "=", "getValue", "(", "classifier", ",", "\"JsonType\"", ",", "\"property\"", ")", ";", "String", "use", "=", "getValue", "(", "classifier", ",", "\"JsonType\"", ",", "\"use\"", ")", ";", "ValueReader", "<", "String", ",", "EClass", ">", "valueReader", "=", "EcoreTypeInfo", ".", "defaultValueReader", ";", "ValueWriter", "<", "EClass", ",", "String", ">", "valueWriter", "=", "EcoreTypeInfo", ".", "defaultValueWriter", ";", "if", "(", "use", "!=", "null", ")", "{", "EcoreTypeInfo", ".", "USE", "useType", "=", "EcoreTypeInfo", ".", "USE", ".", "valueOf", "(", "use", ".", "toUpperCase", "(", ")", ")", ";", "if", "(", "useType", "==", "NAME", ")", "{", "valueReader", "=", "(", "value", ",", "context", ")", "->", "{", "EClass", "type", "=", "value", "!=", "null", "&&", "value", ".", "equalsIgnoreCase", "(", "classifier", ".", "getName", "(", ")", ")", "?", "(", "EClass", ")", "classifier", ":", "null", ";", "if", "(", "type", "==", "null", ")", "{", "type", "=", "EMFContext", ".", "findEClassByName", "(", "value", ",", "classifier", ".", "getEPackage", "(", ")", ")", ";", "}", "return", "type", ";", "}", ";", "valueWriter", "=", "(", "value", ",", "context", ")", "->", "value", ".", "getName", "(", ")", ";", "}", "else", "if", "(", "useType", "==", "CLASS", ")", "{", "valueReader", "=", "(", "value", ",", "context", ")", "->", "{", "EClass", "type", "=", "value", "!=", "null", "&&", "value", ".", "equalsIgnoreCase", "(", "classifier", ".", "getInstanceClassName", "(", ")", ")", "?", "(", "EClass", ")", "classifier", ":", "null", ";", "if", "(", "type", "==", "null", ")", "{", "type", "=", "EMFContext", ".", "findEClassByQualifiedName", "(", "value", ",", "classifier", ".", "getEPackage", "(", ")", ")", ";", "}", "return", "type", ";", "}", ";", "valueWriter", "=", "(", "value", ",", "context", ")", "->", "value", ".", "getInstanceClassName", "(", ")", ";", "}", "else", "{", "valueReader", "=", "EcoreTypeInfo", ".", "defaultValueReader", ";", "valueWriter", "=", "EcoreTypeInfo", ".", "defaultValueWriter", ";", "}", "}", "return", "property", "!=", "null", "?", "new", "EcoreTypeInfo", "(", "property", ",", "valueReader", ",", "valueWriter", ")", ":", "null", ";", "}" ]
Returns the property that should be use to store the type information of the classifier. @param classifier @return the type information property
[ "Returns", "the", "property", "that", "should", "be", "use", "to", "store", "the", "type", "information", "of", "the", "classifier", "." ]
train
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java#L71-L106
alkacon/opencms-core
src/org/opencms/ui/components/codemirror/CmsCodeMirror.java
CmsCodeMirror.registerUndoRedo
public void registerUndoRedo(Button undo, Button redo) { """ Registers the given buttons as undo redo buttons.<p> @param undo the undo button @param redo the redo button """ if (getState().m_enableUndoRedo) { throw new RuntimeException("Undo/redo already registered."); } undo.setId(HTML_ID_PREFIX + m_componentId + "-undo"); redo.setId(HTML_ID_PREFIX + m_componentId + "-redo"); getState().m_enableUndoRedo = true; markAsDirty(); }
java
public void registerUndoRedo(Button undo, Button redo) { if (getState().m_enableUndoRedo) { throw new RuntimeException("Undo/redo already registered."); } undo.setId(HTML_ID_PREFIX + m_componentId + "-undo"); redo.setId(HTML_ID_PREFIX + m_componentId + "-redo"); getState().m_enableUndoRedo = true; markAsDirty(); }
[ "public", "void", "registerUndoRedo", "(", "Button", "undo", ",", "Button", "redo", ")", "{", "if", "(", "getState", "(", ")", ".", "m_enableUndoRedo", ")", "{", "throw", "new", "RuntimeException", "(", "\"Undo/redo already registered.\"", ")", ";", "}", "undo", ".", "setId", "(", "HTML_ID_PREFIX", "+", "m_componentId", "+", "\"-undo\"", ")", ";", "redo", ".", "setId", "(", "HTML_ID_PREFIX", "+", "m_componentId", "+", "\"-redo\"", ")", ";", "getState", "(", ")", ".", "m_enableUndoRedo", "=", "true", ";", "markAsDirty", "(", ")", ";", "}" ]
Registers the given buttons as undo redo buttons.<p> @param undo the undo button @param redo the redo button
[ "Registers", "the", "given", "buttons", "as", "undo", "redo", "buttons", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/codemirror/CmsCodeMirror.java#L564-L573
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/security/KeyStoreUtil.java
KeyStoreUtil.updateWithServerPems
public static void updateWithServerPems(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword) throws IOException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException { """ Update a key store with the keys found in a server PEM and its key file. @param pKeyStore keystore to update @param pServerCert server certificate @param pServerKey server key @param pKeyAlgo algorithm used in the keystore (e.g. "RSA") @param pPassword password to use for the key file. must not be null, use <code>char[0]</code> for an empty password. """ InputStream is = new FileInputStream(pServerCert); try { CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate cert = (X509Certificate) certFactory.generateCertificate(is); byte[] keyBytes = decodePem(pServerKey); PrivateKey privateKey; KeyFactory keyFactory = KeyFactory.getInstance(pKeyAlgo); try { // First let's try PKCS8 privateKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(keyBytes)); } catch (InvalidKeySpecException e) { // Otherwise try PKCS1 RSAPrivateCrtKeySpec keySpec = PKCS1Util.decodePKCS1(keyBytes); privateKey = keyFactory.generatePrivate(keySpec); } String alias = cert.getSubjectX500Principal().getName(); pKeyStore.setKeyEntry(alias, privateKey, pPassword, new Certificate[]{cert}); } finally { is.close(); } }
java
public static void updateWithServerPems(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword) throws IOException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException { InputStream is = new FileInputStream(pServerCert); try { CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate cert = (X509Certificate) certFactory.generateCertificate(is); byte[] keyBytes = decodePem(pServerKey); PrivateKey privateKey; KeyFactory keyFactory = KeyFactory.getInstance(pKeyAlgo); try { // First let's try PKCS8 privateKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(keyBytes)); } catch (InvalidKeySpecException e) { // Otherwise try PKCS1 RSAPrivateCrtKeySpec keySpec = PKCS1Util.decodePKCS1(keyBytes); privateKey = keyFactory.generatePrivate(keySpec); } String alias = cert.getSubjectX500Principal().getName(); pKeyStore.setKeyEntry(alias, privateKey, pPassword, new Certificate[]{cert}); } finally { is.close(); } }
[ "public", "static", "void", "updateWithServerPems", "(", "KeyStore", "pKeyStore", ",", "File", "pServerCert", ",", "File", "pServerKey", ",", "String", "pKeyAlgo", ",", "char", "[", "]", "pPassword", ")", "throws", "IOException", ",", "CertificateException", ",", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", ",", "KeyStoreException", "{", "InputStream", "is", "=", "new", "FileInputStream", "(", "pServerCert", ")", ";", "try", "{", "CertificateFactory", "certFactory", "=", "CertificateFactory", ".", "getInstance", "(", "\"X509\"", ")", ";", "X509Certificate", "cert", "=", "(", "X509Certificate", ")", "certFactory", ".", "generateCertificate", "(", "is", ")", ";", "byte", "[", "]", "keyBytes", "=", "decodePem", "(", "pServerKey", ")", ";", "PrivateKey", "privateKey", ";", "KeyFactory", "keyFactory", "=", "KeyFactory", ".", "getInstance", "(", "pKeyAlgo", ")", ";", "try", "{", "// First let's try PKCS8", "privateKey", "=", "keyFactory", ".", "generatePrivate", "(", "new", "PKCS8EncodedKeySpec", "(", "keyBytes", ")", ")", ";", "}", "catch", "(", "InvalidKeySpecException", "e", ")", "{", "// Otherwise try PKCS1", "RSAPrivateCrtKeySpec", "keySpec", "=", "PKCS1Util", ".", "decodePKCS1", "(", "keyBytes", ")", ";", "privateKey", "=", "keyFactory", ".", "generatePrivate", "(", "keySpec", ")", ";", "}", "String", "alias", "=", "cert", ".", "getSubjectX500Principal", "(", ")", ".", "getName", "(", ")", ";", "pKeyStore", ".", "setKeyEntry", "(", "alias", ",", "privateKey", ",", "pPassword", ",", "new", "Certificate", "[", "]", "{", "cert", "}", ")", ";", "}", "finally", "{", "is", ".", "close", "(", ")", ";", "}", "}" ]
Update a key store with the keys found in a server PEM and its key file. @param pKeyStore keystore to update @param pServerCert server certificate @param pServerKey server key @param pKeyAlgo algorithm used in the keystore (e.g. "RSA") @param pPassword password to use for the key file. must not be null, use <code>char[0]</code> for an empty password.
[ "Update", "a", "key", "store", "with", "the", "keys", "found", "in", "a", "server", "PEM", "and", "its", "key", "file", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/security/KeyStoreUtil.java#L79-L104
cloudendpoints/endpoints-management-java
endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java
PathTemplate.parentTemplate
public PathTemplate parentTemplate() { """ Returns a template for the parent of this template. @throws ValidationException if the template has no parent. """ int i = segments.size(); Segment seg = segments.get(--i); if (seg.kind() == SegmentKind.END_BINDING) { while (i > 0 && segments.get(--i).kind() != SegmentKind.BINDING) {} } if (i == 0) { throw new ValidationException("template does not have a parent"); } return new PathTemplate(segments.subList(0, i), urlEncoding); }
java
public PathTemplate parentTemplate() { int i = segments.size(); Segment seg = segments.get(--i); if (seg.kind() == SegmentKind.END_BINDING) { while (i > 0 && segments.get(--i).kind() != SegmentKind.BINDING) {} } if (i == 0) { throw new ValidationException("template does not have a parent"); } return new PathTemplate(segments.subList(0, i), urlEncoding); }
[ "public", "PathTemplate", "parentTemplate", "(", ")", "{", "int", "i", "=", "segments", ".", "size", "(", ")", ";", "Segment", "seg", "=", "segments", ".", "get", "(", "--", "i", ")", ";", "if", "(", "seg", ".", "kind", "(", ")", "==", "SegmentKind", ".", "END_BINDING", ")", "{", "while", "(", "i", ">", "0", "&&", "segments", ".", "get", "(", "--", "i", ")", ".", "kind", "(", ")", "!=", "SegmentKind", ".", "BINDING", ")", "{", "}", "}", "if", "(", "i", "==", "0", ")", "{", "throw", "new", "ValidationException", "(", "\"template does not have a parent\"", ")", ";", "}", "return", "new", "PathTemplate", "(", "segments", ".", "subList", "(", "0", ",", "i", ")", ",", "urlEncoding", ")", ";", "}" ]
Returns a template for the parent of this template. @throws ValidationException if the template has no parent.
[ "Returns", "a", "template", "for", "the", "parent", "of", "this", "template", "." ]
train
https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java#L262-L272
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
GlobalConfiguration.loadConfigurationWithDynamicProperties
public static Configuration loadConfigurationWithDynamicProperties(Configuration dynamicProperties) { """ Loads the global configuration and adds the given dynamic properties configuration. @param dynamicProperties The given dynamic properties @return Returns the loaded global configuration with dynamic properties """ final String configDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR); if (configDir == null) { return new Configuration(dynamicProperties); } return loadConfiguration(configDir, dynamicProperties); }
java
public static Configuration loadConfigurationWithDynamicProperties(Configuration dynamicProperties) { final String configDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR); if (configDir == null) { return new Configuration(dynamicProperties); } return loadConfiguration(configDir, dynamicProperties); }
[ "public", "static", "Configuration", "loadConfigurationWithDynamicProperties", "(", "Configuration", "dynamicProperties", ")", "{", "final", "String", "configDir", "=", "System", ".", "getenv", "(", "ConfigConstants", ".", "ENV_FLINK_CONF_DIR", ")", ";", "if", "(", "configDir", "==", "null", ")", "{", "return", "new", "Configuration", "(", "dynamicProperties", ")", ";", "}", "return", "loadConfiguration", "(", "configDir", ",", "dynamicProperties", ")", ";", "}" ]
Loads the global configuration and adds the given dynamic properties configuration. @param dynamicProperties The given dynamic properties @return Returns the loaded global configuration with dynamic properties
[ "Loads", "the", "global", "configuration", "and", "adds", "the", "given", "dynamic", "properties", "configuration", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java#L131-L138
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.getHybridConnectionPlanLimitAsync
public Observable<HybridConnectionLimitsInner> getHybridConnectionPlanLimitAsync(String resourceGroupName, String name) { """ Get the maximum number of Hybrid Connections allowed in an App Service plan. Get the maximum number of Hybrid Connections allowed in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the HybridConnectionLimitsInner object """ return getHybridConnectionPlanLimitWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<HybridConnectionLimitsInner>, HybridConnectionLimitsInner>() { @Override public HybridConnectionLimitsInner call(ServiceResponse<HybridConnectionLimitsInner> response) { return response.body(); } }); }
java
public Observable<HybridConnectionLimitsInner> getHybridConnectionPlanLimitAsync(String resourceGroupName, String name) { return getHybridConnectionPlanLimitWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<HybridConnectionLimitsInner>, HybridConnectionLimitsInner>() { @Override public HybridConnectionLimitsInner call(ServiceResponse<HybridConnectionLimitsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "HybridConnectionLimitsInner", ">", "getHybridConnectionPlanLimitAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "getHybridConnectionPlanLimitWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "HybridConnectionLimitsInner", ">", ",", "HybridConnectionLimitsInner", ">", "(", ")", "{", "@", "Override", "public", "HybridConnectionLimitsInner", "call", "(", "ServiceResponse", "<", "HybridConnectionLimitsInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the maximum number of Hybrid Connections allowed in an App Service plan. Get the maximum number of Hybrid Connections allowed in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the HybridConnectionLimitsInner object
[ "Get", "the", "maximum", "number", "of", "Hybrid", "Connections", "allowed", "in", "an", "App", "Service", "plan", ".", "Get", "the", "maximum", "number", "of", "Hybrid", "Connections", "allowed", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1616-L1623
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
L3ToSBGNPDConverter.createProcessAndConnections
private void createProcessAndConnections(Conversion cnv, ConversionDirectionType direction) { """ /* Creates a representation for Conversion. @param cnv the conversion @param direction direction of the conversion to create """ assert cnv.getConversionDirection() == null || cnv.getConversionDirection().equals(direction) || cnv.getConversionDirection().equals(ConversionDirectionType.REVERSIBLE); // create the process for the conversion in that direction Glyph process = factory.createGlyph(); process.setClazz(GlyphClazz.PROCESS.getClazz()); process.setId(convertID(cnv.getUri()) + "_" + direction.name().replaceAll("_","")); glyphMap.put(process.getId(), process); // Determine input and output sets Set<PhysicalEntity> input = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ? cnv.getRight() : cnv.getLeft(); Set<PhysicalEntity> output = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ? cnv.getLeft() : cnv.getRight(); // Create input and outputs ports for the process addPorts(process); Map<PhysicalEntity, Stoichiometry> stoic = getStoichiometry(cnv); // Associate inputs to input port for (PhysicalEntity pe : input) { Glyph g = getGlyphToLink(pe, process.getId()); createArc(g, process.getPort().get(0), direction == ConversionDirectionType.REVERSIBLE ? ArcClazz.PRODUCTION.getClazz() : ArcClazz.CONSUMPTION.getClazz(), stoic.get(pe)); } // Associate outputs to output port for (PhysicalEntity pe : output) { Glyph g = getGlyphToLink(pe, process.getId()); createArc(process.getPort().get(1), g, ArcClazz.PRODUCTION.getClazz(), stoic.get(pe)); } processControllers(cnv.getControlledOf(), process); // Record mapping Set<String> uris = new HashSet<String>(); uris.add(cnv.getUri()); sbgn2BPMap.put(process.getId(), uris); }
java
private void createProcessAndConnections(Conversion cnv, ConversionDirectionType direction) { assert cnv.getConversionDirection() == null || cnv.getConversionDirection().equals(direction) || cnv.getConversionDirection().equals(ConversionDirectionType.REVERSIBLE); // create the process for the conversion in that direction Glyph process = factory.createGlyph(); process.setClazz(GlyphClazz.PROCESS.getClazz()); process.setId(convertID(cnv.getUri()) + "_" + direction.name().replaceAll("_","")); glyphMap.put(process.getId(), process); // Determine input and output sets Set<PhysicalEntity> input = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ? cnv.getRight() : cnv.getLeft(); Set<PhysicalEntity> output = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ? cnv.getLeft() : cnv.getRight(); // Create input and outputs ports for the process addPorts(process); Map<PhysicalEntity, Stoichiometry> stoic = getStoichiometry(cnv); // Associate inputs to input port for (PhysicalEntity pe : input) { Glyph g = getGlyphToLink(pe, process.getId()); createArc(g, process.getPort().get(0), direction == ConversionDirectionType.REVERSIBLE ? ArcClazz.PRODUCTION.getClazz() : ArcClazz.CONSUMPTION.getClazz(), stoic.get(pe)); } // Associate outputs to output port for (PhysicalEntity pe : output) { Glyph g = getGlyphToLink(pe, process.getId()); createArc(process.getPort().get(1), g, ArcClazz.PRODUCTION.getClazz(), stoic.get(pe)); } processControllers(cnv.getControlledOf(), process); // Record mapping Set<String> uris = new HashSet<String>(); uris.add(cnv.getUri()); sbgn2BPMap.put(process.getId(), uris); }
[ "private", "void", "createProcessAndConnections", "(", "Conversion", "cnv", ",", "ConversionDirectionType", "direction", ")", "{", "assert", "cnv", ".", "getConversionDirection", "(", ")", "==", "null", "||", "cnv", ".", "getConversionDirection", "(", ")", ".", "equals", "(", "direction", ")", "||", "cnv", ".", "getConversionDirection", "(", ")", ".", "equals", "(", "ConversionDirectionType", ".", "REVERSIBLE", ")", ";", "// create the process for the conversion in that direction", "Glyph", "process", "=", "factory", ".", "createGlyph", "(", ")", ";", "process", ".", "setClazz", "(", "GlyphClazz", ".", "PROCESS", ".", "getClazz", "(", ")", ")", ";", "process", ".", "setId", "(", "convertID", "(", "cnv", ".", "getUri", "(", ")", ")", "+", "\"_\"", "+", "direction", ".", "name", "(", ")", ".", "replaceAll", "(", "\"_\"", ",", "\"\"", ")", ")", ";", "glyphMap", ".", "put", "(", "process", ".", "getId", "(", ")", ",", "process", ")", ";", "// Determine input and output sets", "Set", "<", "PhysicalEntity", ">", "input", "=", "direction", ".", "equals", "(", "ConversionDirectionType", ".", "RIGHT_TO_LEFT", ")", "?", "cnv", ".", "getRight", "(", ")", ":", "cnv", ".", "getLeft", "(", ")", ";", "Set", "<", "PhysicalEntity", ">", "output", "=", "direction", ".", "equals", "(", "ConversionDirectionType", ".", "RIGHT_TO_LEFT", ")", "?", "cnv", ".", "getLeft", "(", ")", ":", "cnv", ".", "getRight", "(", ")", ";", "// Create input and outputs ports for the process", "addPorts", "(", "process", ")", ";", "Map", "<", "PhysicalEntity", ",", "Stoichiometry", ">", "stoic", "=", "getStoichiometry", "(", "cnv", ")", ";", "// Associate inputs to input port", "for", "(", "PhysicalEntity", "pe", ":", "input", ")", "{", "Glyph", "g", "=", "getGlyphToLink", "(", "pe", ",", "process", ".", "getId", "(", ")", ")", ";", "createArc", "(", "g", ",", "process", ".", "getPort", "(", ")", ".", "get", "(", "0", ")", ",", "direction", "==", "ConversionDirectionType", ".", "REVERSIBLE", "?", "ArcClazz", ".", "PRODUCTION", ".", "getClazz", "(", ")", ":", "ArcClazz", ".", "CONSUMPTION", ".", "getClazz", "(", ")", ",", "stoic", ".", "get", "(", "pe", ")", ")", ";", "}", "// Associate outputs to output port", "for", "(", "PhysicalEntity", "pe", ":", "output", ")", "{", "Glyph", "g", "=", "getGlyphToLink", "(", "pe", ",", "process", ".", "getId", "(", ")", ")", ";", "createArc", "(", "process", ".", "getPort", "(", ")", ".", "get", "(", "1", ")", ",", "g", ",", "ArcClazz", ".", "PRODUCTION", ".", "getClazz", "(", ")", ",", "stoic", ".", "get", "(", "pe", ")", ")", ";", "}", "processControllers", "(", "cnv", ".", "getControlledOf", "(", ")", ",", "process", ")", ";", "// Record mapping", "Set", "<", "String", ">", "uris", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "uris", ".", "add", "(", "cnv", ".", "getUri", "(", ")", ")", ";", "sbgn2BPMap", ".", "put", "(", "process", ".", "getId", "(", ")", ",", "uris", ")", ";", "}" ]
/* Creates a representation for Conversion. @param cnv the conversion @param direction direction of the conversion to create
[ "/", "*", "Creates", "a", "representation", "for", "Conversion", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L924-L965
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/raytrace/Raytrace.java
Raytrace.getClosestHit
public static RayTraceResult getClosestHit(RayTraceResult.Type hitType, Point src, RayTraceResult result1, RayTraceResult result2) { """ Gets the closest {@link RayTraceResult} to the source. @param src the src @param result1 the mop1 @param result2 the mop2 @return the closest """ if (result1 == null) return result2; if (result2 == null) return result1; if (result1.typeOfHit == RayTraceResult.Type.MISS && result2.typeOfHit == hitType) return result2; if (result1.typeOfHit == hitType && result2.typeOfHit == RayTraceResult.Type.MISS) return result1; if (Point.distanceSquared(src, new Point(result1.hitVec)) > Point.distanceSquared(src, new Point(result2.hitVec))) return result2; return result1; }
java
public static RayTraceResult getClosestHit(RayTraceResult.Type hitType, Point src, RayTraceResult result1, RayTraceResult result2) { if (result1 == null) return result2; if (result2 == null) return result1; if (result1.typeOfHit == RayTraceResult.Type.MISS && result2.typeOfHit == hitType) return result2; if (result1.typeOfHit == hitType && result2.typeOfHit == RayTraceResult.Type.MISS) return result1; if (Point.distanceSquared(src, new Point(result1.hitVec)) > Point.distanceSquared(src, new Point(result2.hitVec))) return result2; return result1; }
[ "public", "static", "RayTraceResult", "getClosestHit", "(", "RayTraceResult", ".", "Type", "hitType", ",", "Point", "src", ",", "RayTraceResult", "result1", ",", "RayTraceResult", "result2", ")", "{", "if", "(", "result1", "==", "null", ")", "return", "result2", ";", "if", "(", "result2", "==", "null", ")", "return", "result1", ";", "if", "(", "result1", ".", "typeOfHit", "==", "RayTraceResult", ".", "Type", ".", "MISS", "&&", "result2", ".", "typeOfHit", "==", "hitType", ")", "return", "result2", ";", "if", "(", "result1", ".", "typeOfHit", "==", "hitType", "&&", "result2", ".", "typeOfHit", "==", "RayTraceResult", ".", "Type", ".", "MISS", ")", "return", "result1", ";", "if", "(", "Point", ".", "distanceSquared", "(", "src", ",", "new", "Point", "(", "result1", ".", "hitVec", ")", ")", ">", "Point", ".", "distanceSquared", "(", "src", ",", "new", "Point", "(", "result2", ".", "hitVec", ")", ")", ")", "return", "result2", ";", "return", "result1", ";", "}" ]
Gets the closest {@link RayTraceResult} to the source. @param src the src @param result1 the mop1 @param result2 the mop2 @return the closest
[ "Gets", "the", "closest", "{", "@link", "RayTraceResult", "}", "to", "the", "source", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/raytrace/Raytrace.java#L195-L210
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromTask
public PagedList<NodeFile> listFromTask(final String jobId, final String taskId) { """ Lists the files in a task's directory on its compute node. @param jobId The ID of the job that contains the task. @param taskId The ID of the task whose files you want to list. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeFile&gt; object if successful. """ ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> response = listFromTaskSinglePageAsync(jobId, taskId).toBlocking().single(); return new PagedList<NodeFile>(response.body()) { @Override public Page<NodeFile> nextPage(String nextPageLink) { return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); } }; }
java
public PagedList<NodeFile> listFromTask(final String jobId, final String taskId) { ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> response = listFromTaskSinglePageAsync(jobId, taskId).toBlocking().single(); return new PagedList<NodeFile>(response.body()) { @Override public Page<NodeFile> nextPage(String nextPageLink) { return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "NodeFile", ">", "listFromTask", "(", "final", "String", "jobId", ",", "final", "String", "taskId", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromTaskHeaders", ">", "response", "=", "listFromTaskSinglePageAsync", "(", "jobId", ",", "taskId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ";", "return", "new", "PagedList", "<", "NodeFile", ">", "(", "response", ".", "body", "(", ")", ")", "{", "@", "Override", "public", "Page", "<", "NodeFile", ">", "nextPage", "(", "String", "nextPageLink", ")", "{", "return", "listFromTaskNextSinglePageAsync", "(", "nextPageLink", ",", "null", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}", "}", ";", "}" ]
Lists the files in a task's directory on its compute node. @param jobId The ID of the job that contains the task. @param taskId The ID of the task whose files you want to list. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeFile&gt; object if successful.
[ "Lists", "the", "files", "in", "a", "task", "s", "directory", "on", "its", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L1605-L1613
apache/incubator-druid
core/src/main/java/org/apache/druid/timeline/SegmentId.java
SegmentId.iterateAllPossibleParsings
public static Iterable<SegmentId> iterateAllPossibleParsings(String segmentId) { """ Returns a (potentially empty) lazy iteration of all possible valid parsings of the given segment id string into {@code SegmentId} objects. Warning: most of the parsing work is repeated each time {@link Iterable#iterator()} of this iterable is consumed, so it should be consumed only once if possible. """ List<String> splits = DELIMITER_SPLITTER.splitToList(segmentId); String probableDataSource = tryExtractMostProbableDataSource(segmentId); // Iterate parsings with the most probably data source first to allow the users of iterateAllPossibleParsings() to // break from the iteration earlier with higher probability. if (probableDataSource != null) { List<SegmentId> probableParsings = iteratePossibleParsingsWithDataSource(probableDataSource, segmentId); Iterable<SegmentId> otherPossibleParsings = () -> IntStream .range(1, splits.size() - 3) .mapToObj(dataSourceDelimiterOrder -> DELIMITER_JOINER.join(splits.subList(0, dataSourceDelimiterOrder))) .filter(dataSource -> dataSource.length() != probableDataSource.length()) .flatMap(dataSource -> iteratePossibleParsingsWithDataSource(dataSource, segmentId).stream()) .iterator(); return Iterables.concat(probableParsings, otherPossibleParsings); } else { return () -> IntStream .range(1, splits.size() - 3) .mapToObj(dataSourceDelimiterOrder -> { String dataSource = DELIMITER_JOINER.join(splits.subList(0, dataSourceDelimiterOrder)); return iteratePossibleParsingsWithDataSource(dataSource, segmentId); }) .flatMap(List::stream) .iterator(); } }
java
public static Iterable<SegmentId> iterateAllPossibleParsings(String segmentId) { List<String> splits = DELIMITER_SPLITTER.splitToList(segmentId); String probableDataSource = tryExtractMostProbableDataSource(segmentId); // Iterate parsings with the most probably data source first to allow the users of iterateAllPossibleParsings() to // break from the iteration earlier with higher probability. if (probableDataSource != null) { List<SegmentId> probableParsings = iteratePossibleParsingsWithDataSource(probableDataSource, segmentId); Iterable<SegmentId> otherPossibleParsings = () -> IntStream .range(1, splits.size() - 3) .mapToObj(dataSourceDelimiterOrder -> DELIMITER_JOINER.join(splits.subList(0, dataSourceDelimiterOrder))) .filter(dataSource -> dataSource.length() != probableDataSource.length()) .flatMap(dataSource -> iteratePossibleParsingsWithDataSource(dataSource, segmentId).stream()) .iterator(); return Iterables.concat(probableParsings, otherPossibleParsings); } else { return () -> IntStream .range(1, splits.size() - 3) .mapToObj(dataSourceDelimiterOrder -> { String dataSource = DELIMITER_JOINER.join(splits.subList(0, dataSourceDelimiterOrder)); return iteratePossibleParsingsWithDataSource(dataSource, segmentId); }) .flatMap(List::stream) .iterator(); } }
[ "public", "static", "Iterable", "<", "SegmentId", ">", "iterateAllPossibleParsings", "(", "String", "segmentId", ")", "{", "List", "<", "String", ">", "splits", "=", "DELIMITER_SPLITTER", ".", "splitToList", "(", "segmentId", ")", ";", "String", "probableDataSource", "=", "tryExtractMostProbableDataSource", "(", "segmentId", ")", ";", "// Iterate parsings with the most probably data source first to allow the users of iterateAllPossibleParsings() to", "// break from the iteration earlier with higher probability.", "if", "(", "probableDataSource", "!=", "null", ")", "{", "List", "<", "SegmentId", ">", "probableParsings", "=", "iteratePossibleParsingsWithDataSource", "(", "probableDataSource", ",", "segmentId", ")", ";", "Iterable", "<", "SegmentId", ">", "otherPossibleParsings", "=", "(", ")", "->", "IntStream", ".", "range", "(", "1", ",", "splits", ".", "size", "(", ")", "-", "3", ")", ".", "mapToObj", "(", "dataSourceDelimiterOrder", "->", "DELIMITER_JOINER", ".", "join", "(", "splits", ".", "subList", "(", "0", ",", "dataSourceDelimiterOrder", ")", ")", ")", ".", "filter", "(", "dataSource", "->", "dataSource", ".", "length", "(", ")", "!=", "probableDataSource", ".", "length", "(", ")", ")", ".", "flatMap", "(", "dataSource", "->", "iteratePossibleParsingsWithDataSource", "(", "dataSource", ",", "segmentId", ")", ".", "stream", "(", ")", ")", ".", "iterator", "(", ")", ";", "return", "Iterables", ".", "concat", "(", "probableParsings", ",", "otherPossibleParsings", ")", ";", "}", "else", "{", "return", "(", ")", "->", "IntStream", ".", "range", "(", "1", ",", "splits", ".", "size", "(", ")", "-", "3", ")", ".", "mapToObj", "(", "dataSourceDelimiterOrder", "->", "{", "String", "dataSource", "=", "DELIMITER_JOINER", ".", "join", "(", "splits", ".", "subList", "(", "0", ",", "dataSourceDelimiterOrder", ")", ")", ";", "return", "iteratePossibleParsingsWithDataSource", "(", "dataSource", ",", "segmentId", ")", ";", "}", ")", ".", "flatMap", "(", "List", "::", "stream", ")", ".", "iterator", "(", ")", ";", "}", "}" ]
Returns a (potentially empty) lazy iteration of all possible valid parsings of the given segment id string into {@code SegmentId} objects. Warning: most of the parsing work is repeated each time {@link Iterable#iterator()} of this iterable is consumed, so it should be consumed only once if possible.
[ "Returns", "a", "(", "potentially", "empty", ")", "lazy", "iteration", "of", "all", "possible", "valid", "parsings", "of", "the", "given", "segment", "id", "string", "into", "{", "@code", "SegmentId", "}", "objects", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/timeline/SegmentId.java#L133-L158
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_PUT
public void packName_PUT(String packName, OvhPackAdsl body) throws IOException { """ Alter this object properties REST: PUT /pack/xdsl/{packName} @param body [required] New object properties @param packName [required] The internal name of your pack """ String qPath = "/pack/xdsl/{packName}"; StringBuilder sb = path(qPath, packName); exec(qPath, "PUT", sb.toString(), body); }
java
public void packName_PUT(String packName, OvhPackAdsl body) throws IOException { String qPath = "/pack/xdsl/{packName}"; StringBuilder sb = path(qPath, packName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "packName_PUT", "(", "String", "packName", ",", "OvhPackAdsl", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /pack/xdsl/{packName} @param body [required] New object properties @param packName [required] The internal name of your pack
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L486-L490
hawkular/hawkular-apm
client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java
RuleHelper.createInOutputStream
public OutputStream createInOutputStream(OutputStream os, String linkId) { """ This method returns an instrumented proxy output stream, to wrap the supplied output stream, which will record the written data. The optional link id can be used to initiate a link with the specified id (and disassociate the trace from the current thread). @param os The original output stream @param linkId The optional link id @return The instrumented output stream """ return new InstrumentedOutputStream(collector(), Direction.In, os, linkId); }
java
public OutputStream createInOutputStream(OutputStream os, String linkId) { return new InstrumentedOutputStream(collector(), Direction.In, os, linkId); }
[ "public", "OutputStream", "createInOutputStream", "(", "OutputStream", "os", ",", "String", "linkId", ")", "{", "return", "new", "InstrumentedOutputStream", "(", "collector", "(", ")", ",", "Direction", ".", "In", ",", "os", ",", "linkId", ")", ";", "}" ]
This method returns an instrumented proxy output stream, to wrap the supplied output stream, which will record the written data. The optional link id can be used to initiate a link with the specified id (and disassociate the trace from the current thread). @param os The original output stream @param linkId The optional link id @return The instrumented output stream
[ "This", "method", "returns", "an", "instrumented", "proxy", "output", "stream", "to", "wrap", "the", "supplied", "output", "stream", "which", "will", "record", "the", "written", "data", ".", "The", "optional", "link", "id", "can", "be", "used", "to", "initiate", "a", "link", "with", "the", "specified", "id", "(", "and", "disassociate", "the", "trace", "from", "the", "current", "thread", ")", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java#L606-L608
apiman/apiman
manager/api/gateway/src/main/java/io/apiman/manager/api/gateway/rest/GatewayClient.java
GatewayClient.parseStackTrace
protected static StackTraceElement[] parseStackTrace(String stacktrace) { """ Parses a stack trace from the given string. @param stacktrace """ try (BufferedReader reader = new BufferedReader(new StringReader(stacktrace))) { List<StackTraceElement> elements = new ArrayList<>(); String line; // Example lines: // \tat io.apiman.gateway.engine.es.ESRegistry$1.completed(ESRegistry.java:79) // \tat org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)\r\n while ( (line = reader.readLine()) != null) { if (line.startsWith("\tat ")) { //$NON-NLS-1$ int openParenIdx = line.indexOf('('); int closeParenIdx = line.indexOf(')'); String classAndMethod = line.substring(4, openParenIdx); String fileAndLineNum = line.substring(openParenIdx + 1, closeParenIdx); String className = classAndMethod.substring(0, classAndMethod.lastIndexOf('.')); String methodName = classAndMethod.substring(classAndMethod.lastIndexOf('.') + 1); String [] split = fileAndLineNum.split(":"); //$NON-NLS-1$ if (split.length == 1) { elements.add(new StackTraceElement(className, methodName, fileAndLineNum, -1)); } else { String fileName = split[0]; String lineNum = split[1]; elements.add(new StackTraceElement(className, methodName, fileName, new Integer(lineNum))); } } } return elements.toArray(new StackTraceElement[elements.size()]); } catch (Exception e) { e.printStackTrace(); return null; } }
java
protected static StackTraceElement[] parseStackTrace(String stacktrace) { try (BufferedReader reader = new BufferedReader(new StringReader(stacktrace))) { List<StackTraceElement> elements = new ArrayList<>(); String line; // Example lines: // \tat io.apiman.gateway.engine.es.ESRegistry$1.completed(ESRegistry.java:79) // \tat org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)\r\n while ( (line = reader.readLine()) != null) { if (line.startsWith("\tat ")) { //$NON-NLS-1$ int openParenIdx = line.indexOf('('); int closeParenIdx = line.indexOf(')'); String classAndMethod = line.substring(4, openParenIdx); String fileAndLineNum = line.substring(openParenIdx + 1, closeParenIdx); String className = classAndMethod.substring(0, classAndMethod.lastIndexOf('.')); String methodName = classAndMethod.substring(classAndMethod.lastIndexOf('.') + 1); String [] split = fileAndLineNum.split(":"); //$NON-NLS-1$ if (split.length == 1) { elements.add(new StackTraceElement(className, methodName, fileAndLineNum, -1)); } else { String fileName = split[0]; String lineNum = split[1]; elements.add(new StackTraceElement(className, methodName, fileName, new Integer(lineNum))); } } } return elements.toArray(new StackTraceElement[elements.size()]); } catch (Exception e) { e.printStackTrace(); return null; } }
[ "protected", "static", "StackTraceElement", "[", "]", "parseStackTrace", "(", "String", "stacktrace", ")", "{", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "StringReader", "(", "stacktrace", ")", ")", ")", "{", "List", "<", "StackTraceElement", ">", "elements", "=", "new", "ArrayList", "<>", "(", ")", ";", "String", "line", ";", "// Example lines:", "// \\tat io.apiman.gateway.engine.es.ESRegistry$1.completed(ESRegistry.java:79)", "// \\tat org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)\\r\\n", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "line", ".", "startsWith", "(", "\"\\tat \"", ")", ")", "{", "//$NON-NLS-1$", "int", "openParenIdx", "=", "line", ".", "indexOf", "(", "'", "'", ")", ";", "int", "closeParenIdx", "=", "line", ".", "indexOf", "(", "'", "'", ")", ";", "String", "classAndMethod", "=", "line", ".", "substring", "(", "4", ",", "openParenIdx", ")", ";", "String", "fileAndLineNum", "=", "line", ".", "substring", "(", "openParenIdx", "+", "1", ",", "closeParenIdx", ")", ";", "String", "className", "=", "classAndMethod", ".", "substring", "(", "0", ",", "classAndMethod", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "String", "methodName", "=", "classAndMethod", ".", "substring", "(", "classAndMethod", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ";", "String", "[", "]", "split", "=", "fileAndLineNum", ".", "split", "(", "\":\"", ")", ";", "//$NON-NLS-1$", "if", "(", "split", ".", "length", "==", "1", ")", "{", "elements", ".", "add", "(", "new", "StackTraceElement", "(", "className", ",", "methodName", ",", "fileAndLineNum", ",", "-", "1", ")", ")", ";", "}", "else", "{", "String", "fileName", "=", "split", "[", "0", "]", ";", "String", "lineNum", "=", "split", "[", "1", "]", ";", "elements", ".", "add", "(", "new", "StackTraceElement", "(", "className", ",", "methodName", ",", "fileName", ",", "new", "Integer", "(", "lineNum", ")", ")", ")", ";", "}", "}", "}", "return", "elements", ".", "toArray", "(", "new", "StackTraceElement", "[", "elements", ".", "size", "(", ")", "]", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "}" ]
Parses a stack trace from the given string. @param stacktrace
[ "Parses", "a", "stack", "trace", "from", "the", "given", "string", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/gateway/src/main/java/io/apiman/manager/api/gateway/rest/GatewayClient.java#L309-L339
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_volume_volumeId_PUT
public OvhVolume project_serviceName_volume_volumeId_PUT(String serviceName, String volumeId, String description, String name) throws IOException { """ Update a volume REST: PUT /cloud/project/{serviceName}/volume/{volumeId} @param description [required] Volume description @param name [required] Volume name @param serviceName [required] Project id @param volumeId [required] Volume id """ String qPath = "/cloud/project/{serviceName}/volume/{volumeId}"; StringBuilder sb = path(qPath, serviceName, volumeId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "name", name); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhVolume.class); }
java
public OvhVolume project_serviceName_volume_volumeId_PUT(String serviceName, String volumeId, String description, String name) throws IOException { String qPath = "/cloud/project/{serviceName}/volume/{volumeId}"; StringBuilder sb = path(qPath, serviceName, volumeId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "name", name); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhVolume.class); }
[ "public", "OvhVolume", "project_serviceName_volume_volumeId_PUT", "(", "String", "serviceName", ",", "String", "volumeId", ",", "String", "description", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/volume/{volumeId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "volumeId", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"description\"", ",", "description", ")", ";", "addBody", "(", "o", ",", "\"name\"", ",", "name", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhVolume", ".", "class", ")", ";", "}" ]
Update a volume REST: PUT /cloud/project/{serviceName}/volume/{volumeId} @param description [required] Volume description @param name [required] Volume name @param serviceName [required] Project id @param volumeId [required] Volume id
[ "Update", "a", "volume" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1135-L1143
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.beginCreateOrUpdateAsync
public Observable<EventSubscriptionInner> beginCreateOrUpdateAsync(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) { """ Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope. @param scope The identifier of the resource to which the event subscription needs to be created or updated. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription. Event subscription names must be between 3 and 64 characters in length and should use alphanumeric letters only. @param eventSubscriptionInfo Event subscription properties containing the destination and filter information @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventSubscriptionInner object """ return beginCreateOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() { @Override public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) { return response.body(); } }); }
java
public Observable<EventSubscriptionInner> beginCreateOrUpdateAsync(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) { return beginCreateOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() { @Override public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventSubscriptionInner", ">", "beginCreateOrUpdateAsync", "(", "String", "scope", ",", "String", "eventSubscriptionName", ",", "EventSubscriptionInner", "eventSubscriptionInfo", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "scope", ",", "eventSubscriptionName", ",", "eventSubscriptionInfo", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "EventSubscriptionInner", ">", ",", "EventSubscriptionInner", ">", "(", ")", "{", "@", "Override", "public", "EventSubscriptionInner", "call", "(", "ServiceResponse", "<", "EventSubscriptionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope. @param scope The identifier of the resource to which the event subscription needs to be created or updated. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription. Event subscription names must be between 3 and 64 characters in length and should use alphanumeric letters only. @param eventSubscriptionInfo Event subscription properties containing the destination and filter information @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventSubscriptionInner object
[ "Create", "or", "update", "an", "event", "subscription", ".", "Asynchronously", "creates", "a", "new", "event", "subscription", "or", "updates", "an", "existing", "event", "subscription", "based", "on", "the", "specified", "scope", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L342-L349
apache/flink
flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java
MemorySegment.putIntLittleEndian
public final void putIntLittleEndian(int index, int value) { """ Writes the given int value (32bit, 4 bytes) to the given position in little endian byte order. This method's speed depends on the system's native byte order, and it is possibly slower than {@link #putInt(int, int)}. For most cases (such as transient storage in memory or serialization for I/O and network), it suffices to know that the byte order in which the value is written is the same as the one in which it is read, and {@link #putInt(int, int)} is the preferable choice. @param index The position at which the value will be written. @param value The int value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 4. """ if (LITTLE_ENDIAN) { putInt(index, value); } else { putInt(index, Integer.reverseBytes(value)); } }
java
public final void putIntLittleEndian(int index, int value) { if (LITTLE_ENDIAN) { putInt(index, value); } else { putInt(index, Integer.reverseBytes(value)); } }
[ "public", "final", "void", "putIntLittleEndian", "(", "int", "index", ",", "int", "value", ")", "{", "if", "(", "LITTLE_ENDIAN", ")", "{", "putInt", "(", "index", ",", "value", ")", ";", "}", "else", "{", "putInt", "(", "index", ",", "Integer", ".", "reverseBytes", "(", "value", ")", ")", ";", "}", "}" ]
Writes the given int value (32bit, 4 bytes) to the given position in little endian byte order. This method's speed depends on the system's native byte order, and it is possibly slower than {@link #putInt(int, int)}. For most cases (such as transient storage in memory or serialization for I/O and network), it suffices to know that the byte order in which the value is written is the same as the one in which it is read, and {@link #putInt(int, int)} is the preferable choice. @param index The position at which the value will be written. @param value The int value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 4.
[ "Writes", "the", "given", "int", "value", "(", "32bit", "4", "bytes", ")", "to", "the", "given", "position", "in", "little", "endian", "byte", "order", ".", "This", "method", "s", "speed", "depends", "on", "the", "system", "s", "native", "byte", "order", "and", "it", "is", "possibly", "slower", "than", "{", "@link", "#putInt", "(", "int", "int", ")", "}", ".", "For", "most", "cases", "(", "such", "as", "transient", "storage", "in", "memory", "or", "serialization", "for", "I", "/", "O", "and", "network", ")", "it", "suffices", "to", "know", "that", "the", "byte", "order", "in", "which", "the", "value", "is", "written", "is", "the", "same", "as", "the", "one", "in", "which", "it", "is", "read", "and", "{", "@link", "#putInt", "(", "int", "int", ")", "}", "is", "the", "preferable", "choice", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L790-L796
sockeqwe/AdapterDelegates
library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java
AdapterDelegatesManager.getItemViewType
public int getItemViewType(@NonNull T items, int position) { """ Must be called from {@link RecyclerView.Adapter#getItemViewType(int)}. Internally it scans all the registered {@link AdapterDelegate} and picks the right one to return the ViewType integer. @param items Adapter's data source @param position the position in adapters data source @return the ViewType (integer). Returns {@link #FALLBACK_DELEGATE_VIEW_TYPE} in case that the fallback adapter delegate should be used @throws NullPointerException if no {@link AdapterDelegate} has been found that is responsible for the given data element in data set (No {@link AdapterDelegate} for the given ViewType) @throws NullPointerException if items is null """ if (items == null) { throw new NullPointerException("Items datasource is null!"); } int delegatesCount = delegates.size(); for (int i = 0; i < delegatesCount; i++) { AdapterDelegate<T> delegate = delegates.valueAt(i); if (delegate.isForViewType(items, position)) { return delegates.keyAt(i); } } if (fallbackDelegate != null) { return FALLBACK_DELEGATE_VIEW_TYPE; } throw new NullPointerException( "No AdapterDelegate added that matches position=" + position + " in data source"); }
java
public int getItemViewType(@NonNull T items, int position) { if (items == null) { throw new NullPointerException("Items datasource is null!"); } int delegatesCount = delegates.size(); for (int i = 0; i < delegatesCount; i++) { AdapterDelegate<T> delegate = delegates.valueAt(i); if (delegate.isForViewType(items, position)) { return delegates.keyAt(i); } } if (fallbackDelegate != null) { return FALLBACK_DELEGATE_VIEW_TYPE; } throw new NullPointerException( "No AdapterDelegate added that matches position=" + position + " in data source"); }
[ "public", "int", "getItemViewType", "(", "@", "NonNull", "T", "items", ",", "int", "position", ")", "{", "if", "(", "items", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Items datasource is null!\"", ")", ";", "}", "int", "delegatesCount", "=", "delegates", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "delegatesCount", ";", "i", "++", ")", "{", "AdapterDelegate", "<", "T", ">", "delegate", "=", "delegates", ".", "valueAt", "(", "i", ")", ";", "if", "(", "delegate", ".", "isForViewType", "(", "items", ",", "position", ")", ")", "{", "return", "delegates", ".", "keyAt", "(", "i", ")", ";", "}", "}", "if", "(", "fallbackDelegate", "!=", "null", ")", "{", "return", "FALLBACK_DELEGATE_VIEW_TYPE", ";", "}", "throw", "new", "NullPointerException", "(", "\"No AdapterDelegate added that matches position=\"", "+", "position", "+", "\" in data source\"", ")", ";", "}" ]
Must be called from {@link RecyclerView.Adapter#getItemViewType(int)}. Internally it scans all the registered {@link AdapterDelegate} and picks the right one to return the ViewType integer. @param items Adapter's data source @param position the position in adapters data source @return the ViewType (integer). Returns {@link #FALLBACK_DELEGATE_VIEW_TYPE} in case that the fallback adapter delegate should be used @throws NullPointerException if no {@link AdapterDelegate} has been found that is responsible for the given data element in data set (No {@link AdapterDelegate} for the given ViewType) @throws NullPointerException if items is null
[ "Must", "be", "called", "from", "{", "@link", "RecyclerView", ".", "Adapter#getItemViewType", "(", "int", ")", "}", ".", "Internally", "it", "scans", "all", "the", "registered", "{", "@link", "AdapterDelegate", "}", "and", "picks", "the", "right", "one", "to", "return", "the", "ViewType", "integer", "." ]
train
https://github.com/sockeqwe/AdapterDelegates/blob/d18dc609415e5d17a3354bddf4bae62440e017af/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java#L214-L234
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/gremlin/optimizer/GremlinQueryOptimizer.java
GremlinQueryOptimizer.copyWithNewLeafNode
public static GroovyExpression copyWithNewLeafNode(AbstractFunctionExpression expr, GroovyExpression newLeaf) { """ Recursively copies and follows the caller hierarchy of the expression until we come to a function call with a null caller. The caller of that expression is set to newLeaf. @param expr @param newLeaf @return the updated (/copied) expression """ AbstractFunctionExpression result = (AbstractFunctionExpression)expr.copy(); //remove leading anonymous traversal expression, if there is one if(FACTORY.isLeafAnonymousTraversalExpression(expr)) { result = (AbstractFunctionExpression)newLeaf; } else { GroovyExpression newCaller = null; if (expr.getCaller() == null) { newCaller = newLeaf; } else { newCaller = copyWithNewLeafNode((AbstractFunctionExpression)result.getCaller(), newLeaf); } result.setCaller(newCaller); } return result; }
java
public static GroovyExpression copyWithNewLeafNode(AbstractFunctionExpression expr, GroovyExpression newLeaf) { AbstractFunctionExpression result = (AbstractFunctionExpression)expr.copy(); //remove leading anonymous traversal expression, if there is one if(FACTORY.isLeafAnonymousTraversalExpression(expr)) { result = (AbstractFunctionExpression)newLeaf; } else { GroovyExpression newCaller = null; if (expr.getCaller() == null) { newCaller = newLeaf; } else { newCaller = copyWithNewLeafNode((AbstractFunctionExpression)result.getCaller(), newLeaf); } result.setCaller(newCaller); } return result; }
[ "public", "static", "GroovyExpression", "copyWithNewLeafNode", "(", "AbstractFunctionExpression", "expr", ",", "GroovyExpression", "newLeaf", ")", "{", "AbstractFunctionExpression", "result", "=", "(", "AbstractFunctionExpression", ")", "expr", ".", "copy", "(", ")", ";", "//remove leading anonymous traversal expression, if there is one", "if", "(", "FACTORY", ".", "isLeafAnonymousTraversalExpression", "(", "expr", ")", ")", "{", "result", "=", "(", "AbstractFunctionExpression", ")", "newLeaf", ";", "}", "else", "{", "GroovyExpression", "newCaller", "=", "null", ";", "if", "(", "expr", ".", "getCaller", "(", ")", "==", "null", ")", "{", "newCaller", "=", "newLeaf", ";", "}", "else", "{", "newCaller", "=", "copyWithNewLeafNode", "(", "(", "AbstractFunctionExpression", ")", "result", ".", "getCaller", "(", ")", ",", "newLeaf", ")", ";", "}", "result", ".", "setCaller", "(", "newCaller", ")", ";", "}", "return", "result", ";", "}" ]
Recursively copies and follows the caller hierarchy of the expression until we come to a function call with a null caller. The caller of that expression is set to newLeaf. @param expr @param newLeaf @return the updated (/copied) expression
[ "Recursively", "copies", "and", "follows", "the", "caller", "hierarchy", "of", "the", "expression", "until", "we", "come", "to", "a", "function", "call", "with", "a", "null", "caller", ".", "The", "caller", "of", "that", "expression", "is", "set", "to", "newLeaf", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/optimizer/GremlinQueryOptimizer.java#L242-L260
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_promotionCode_generate_POST
public OvhTask packName_promotionCode_generate_POST(String packName) throws IOException { """ Creates a task to generate a new promotion code REST: POST /pack/xdsl/{packName}/promotionCode/generate @param packName [required] The internal name of your pack """ String qPath = "/pack/xdsl/{packName}/promotionCode/generate"; StringBuilder sb = path(qPath, packName); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTask.class); }
java
public OvhTask packName_promotionCode_generate_POST(String packName) throws IOException { String qPath = "/pack/xdsl/{packName}/promotionCode/generate"; StringBuilder sb = path(qPath, packName); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "packName_promotionCode_generate_POST", "(", "String", "packName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/promotionCode/generate\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Creates a task to generate a new promotion code REST: POST /pack/xdsl/{packName}/promotionCode/generate @param packName [required] The internal name of your pack
[ "Creates", "a", "task", "to", "generate", "a", "new", "promotion", "code" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L801-L806
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java
PoissonDistribution.poissonPDFm1
public static double poissonPDFm1(double x_plus_1, double lambda) { """ Compute the poisson distribution PDF with an offset of + 1 <p> pdf(x_plus_1 - 1, lambda) @param x_plus_1 x+1 @param lambda Lambda @return pdf """ if(Double.isInfinite(lambda)) { return 0.; } if(x_plus_1 > 1) { return rawProbability(x_plus_1 - 1, lambda); } if(lambda > Math.abs(x_plus_1 - 1) * MathUtil.LOG2 * Double.MAX_EXPONENT / 1e-14) { return FastMath.exp(-lambda - GammaDistribution.logGamma(x_plus_1)); } else { return rawProbability(x_plus_1, lambda) * (x_plus_1 / lambda); } }
java
public static double poissonPDFm1(double x_plus_1, double lambda) { if(Double.isInfinite(lambda)) { return 0.; } if(x_plus_1 > 1) { return rawProbability(x_plus_1 - 1, lambda); } if(lambda > Math.abs(x_plus_1 - 1) * MathUtil.LOG2 * Double.MAX_EXPONENT / 1e-14) { return FastMath.exp(-lambda - GammaDistribution.logGamma(x_plus_1)); } else { return rawProbability(x_plus_1, lambda) * (x_plus_1 / lambda); } }
[ "public", "static", "double", "poissonPDFm1", "(", "double", "x_plus_1", ",", "double", "lambda", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "lambda", ")", ")", "{", "return", "0.", ";", "}", "if", "(", "x_plus_1", ">", "1", ")", "{", "return", "rawProbability", "(", "x_plus_1", "-", "1", ",", "lambda", ")", ";", "}", "if", "(", "lambda", ">", "Math", ".", "abs", "(", "x_plus_1", "-", "1", ")", "*", "MathUtil", ".", "LOG2", "*", "Double", ".", "MAX_EXPONENT", "/", "1e-14", ")", "{", "return", "FastMath", ".", "exp", "(", "-", "lambda", "-", "GammaDistribution", ".", "logGamma", "(", "x_plus_1", ")", ")", ";", "}", "else", "{", "return", "rawProbability", "(", "x_plus_1", ",", "lambda", ")", "*", "(", "x_plus_1", "/", "lambda", ")", ";", "}", "}" ]
Compute the poisson distribution PDF with an offset of + 1 <p> pdf(x_plus_1 - 1, lambda) @param x_plus_1 x+1 @param lambda Lambda @return pdf
[ "Compute", "the", "poisson", "distribution", "PDF", "with", "an", "offset", "of", "+", "1", "<p", ">", "pdf", "(", "x_plus_1", "-", "1", "lambda", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java#L288-L301
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.toLegacyType
public static String toLegacyType(String keyword, String value) { """ <strong>[icu]</strong> Converts the specified keyword value (BCP 47 Unicode locale extension type, or legacy type or type alias) to the canonical legacy type. For example, the legacy type "phonebook" is returned for the input BCP 47 Unicode locale extension type "phonebk" with the keyword "collation" (or "co"). <p> When the specified keyword is not recognized, but the specified value satisfies the syntax of legacy key, or when the specified keyword allows 'variable' type and the specified value satisfies the syntax, the lower-case version of the input value will be returned. For example, <code>toLegacyType("Foo", "Bar")</code> returns "bar", <code>toLegacyType("vt", "00A4")</code> returns "00a4". @param keyword the locale keyword (either legacy keyword such as "collation" or BCP 47 Unicode locale extension key such as "co"). @param value the locale keyword value (either BCP 47 Unicode locale extension type such as "phonebk" or legacy keyword value such as "phonebook"). @return the well-formed legacy type, or null if the specified keyword value cannot be mapped to a well-formed legacy type. @see #toUnicodeLocaleType(String, String) """ String legacyType = KeyTypeData.toLegacyType(keyword, value, null, null); if (legacyType == null) { // Checks if the specified locale type is well-formed with the legacy locale syntax. // // Note: // Neither ICU nor LDML/CLDR provides the definition of keyword syntax. // However, a type should not contain '=' obviously. For now, all existing // types are using ASCII alphabetic letters with a few symbol letters. We won't // add any new type that is not compatible with the BCP 47 syntax except timezone // IDs. For now, we assume a valid type start with [0-9a-zA-Z], but may contain // '-' '_' '/' in the middle. if (value.matches("[0-9a-zA-Z]+([_/\\-][0-9a-zA-Z]+)*")) { legacyType = AsciiUtil.toLowerString(value); } } return legacyType; }
java
public static String toLegacyType(String keyword, String value) { String legacyType = KeyTypeData.toLegacyType(keyword, value, null, null); if (legacyType == null) { // Checks if the specified locale type is well-formed with the legacy locale syntax. // // Note: // Neither ICU nor LDML/CLDR provides the definition of keyword syntax. // However, a type should not contain '=' obviously. For now, all existing // types are using ASCII alphabetic letters with a few symbol letters. We won't // add any new type that is not compatible with the BCP 47 syntax except timezone // IDs. For now, we assume a valid type start with [0-9a-zA-Z], but may contain // '-' '_' '/' in the middle. if (value.matches("[0-9a-zA-Z]+([_/\\-][0-9a-zA-Z]+)*")) { legacyType = AsciiUtil.toLowerString(value); } } return legacyType; }
[ "public", "static", "String", "toLegacyType", "(", "String", "keyword", ",", "String", "value", ")", "{", "String", "legacyType", "=", "KeyTypeData", ".", "toLegacyType", "(", "keyword", ",", "value", ",", "null", ",", "null", ")", ";", "if", "(", "legacyType", "==", "null", ")", "{", "// Checks if the specified locale type is well-formed with the legacy locale syntax.", "//", "// Note:", "// Neither ICU nor LDML/CLDR provides the definition of keyword syntax.", "// However, a type should not contain '=' obviously. For now, all existing", "// types are using ASCII alphabetic letters with a few symbol letters. We won't", "// add any new type that is not compatible with the BCP 47 syntax except timezone", "// IDs. For now, we assume a valid type start with [0-9a-zA-Z], but may contain", "// '-' '_' '/' in the middle.", "if", "(", "value", ".", "matches", "(", "\"[0-9a-zA-Z]+([_/\\\\-][0-9a-zA-Z]+)*\"", ")", ")", "{", "legacyType", "=", "AsciiUtil", ".", "toLowerString", "(", "value", ")", ";", "}", "}", "return", "legacyType", ";", "}" ]
<strong>[icu]</strong> Converts the specified keyword value (BCP 47 Unicode locale extension type, or legacy type or type alias) to the canonical legacy type. For example, the legacy type "phonebook" is returned for the input BCP 47 Unicode locale extension type "phonebk" with the keyword "collation" (or "co"). <p> When the specified keyword is not recognized, but the specified value satisfies the syntax of legacy key, or when the specified keyword allows 'variable' type and the specified value satisfies the syntax, the lower-case version of the input value will be returned. For example, <code>toLegacyType("Foo", "Bar")</code> returns "bar", <code>toLegacyType("vt", "00A4")</code> returns "00a4". @param keyword the locale keyword (either legacy keyword such as "collation" or BCP 47 Unicode locale extension key such as "co"). @param value the locale keyword value (either BCP 47 Unicode locale extension type such as "phonebk" or legacy keyword value such as "phonebook"). @return the well-formed legacy type, or null if the specified keyword value cannot be mapped to a well-formed legacy type. @see #toUnicodeLocaleType(String, String)
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Converts", "the", "specified", "keyword", "value", "(", "BCP", "47", "Unicode", "locale", "extension", "type", "or", "legacy", "type", "or", "type", "alias", ")", "to", "the", "canonical", "legacy", "type", ".", "For", "example", "the", "legacy", "type", "phonebook", "is", "returned", "for", "the", "input", "BCP", "47", "Unicode", "locale", "extension", "type", "phonebk", "with", "the", "keyword", "collation", "(", "or", "co", ")", ".", "<p", ">", "When", "the", "specified", "keyword", "is", "not", "recognized", "but", "the", "specified", "value", "satisfies", "the", "syntax", "of", "legacy", "key", "or", "when", "the", "specified", "keyword", "allows", "variable", "type", "and", "the", "specified", "value", "satisfies", "the", "syntax", "the", "lower", "-", "case", "version", "of", "the", "input", "value", "will", "be", "returned", ".", "For", "example", "<code", ">", "toLegacyType", "(", "Foo", "Bar", ")", "<", "/", "code", ">", "returns", "bar", "<code", ">", "toLegacyType", "(", "vt", "00A4", ")", "<", "/", "code", ">", "returns", "00a4", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L3416-L3433
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java
MultiMap.addValues
public void addValues(Object name, String[] values) { """ Add values to multi valued entry. If the entry is single valued, it is converted to the first value of a multi valued entry. @param name The entry key. @param values The String array of multiple values. """ Object lo = super.get(name); Object ln = LazyList.addCollection(lo,Arrays.asList(values)); if (lo!=ln) super.put(name,ln); }
java
public void addValues(Object name, String[] values) { Object lo = super.get(name); Object ln = LazyList.addCollection(lo,Arrays.asList(values)); if (lo!=ln) super.put(name,ln); }
[ "public", "void", "addValues", "(", "Object", "name", ",", "String", "[", "]", "values", ")", "{", "Object", "lo", "=", "super", ".", "get", "(", "name", ")", ";", "Object", "ln", "=", "LazyList", ".", "addCollection", "(", "lo", ",", "Arrays", ".", "asList", "(", "values", ")", ")", ";", "if", "(", "lo", "!=", "ln", ")", "super", ".", "put", "(", "name", ",", "ln", ")", ";", "}" ]
Add values to multi valued entry. If the entry is single valued, it is converted to the first value of a multi valued entry. @param name The entry key. @param values The String array of multiple values.
[ "Add", "values", "to", "multi", "valued", "entry", ".", "If", "the", "entry", "is", "single", "valued", "it", "is", "converted", "to", "the", "first", "value", "of", "a", "multi", "valued", "entry", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java#L213-L219
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java
FtpFileUtil.executeCommandOnFTPServer
public static String executeCommandOnFTPServer(String hostName, Integer port, String userName, String password, String command, String commandArgs) { """ Execute command with supplied arguments on the FTP server. @param hostName the FTP server host name to connect @param port the port to connect @param userName the user name @param password the password @param command the command to execute. @param commandArgs the command argument(s), if any. @return reply string from FTP server after the command has been executed. @throws RuntimeException in case any exception has been thrown. """ String result = null; if (StringUtils.isNotBlank(command)) { FTPClient ftpClient = new FTPClient(); String errorMessage = "Unable to connect and execute %s command with argumments '%s' for FTP server '%s'."; try { connectAndLoginOnFTPServer(ftpClient, hostName, port, userName, password); // execute command if (StringUtils.isBlank(commandArgs)) { ftpClient.sendCommand(command); } else { ftpClient.sendCommand(command, commandArgs); } validatResponse(ftpClient); result = ftpClient.getReplyString(); } catch (IOException ex) { throw new RuntimeException(String.format(errorMessage, command, commandArgs, hostName), ex); } finally { disconnectAndLogoutFromFTPServer(ftpClient, hostName); } } return result; }
java
public static String executeCommandOnFTPServer(String hostName, Integer port, String userName, String password, String command, String commandArgs) { String result = null; if (StringUtils.isNotBlank(command)) { FTPClient ftpClient = new FTPClient(); String errorMessage = "Unable to connect and execute %s command with argumments '%s' for FTP server '%s'."; try { connectAndLoginOnFTPServer(ftpClient, hostName, port, userName, password); // execute command if (StringUtils.isBlank(commandArgs)) { ftpClient.sendCommand(command); } else { ftpClient.sendCommand(command, commandArgs); } validatResponse(ftpClient); result = ftpClient.getReplyString(); } catch (IOException ex) { throw new RuntimeException(String.format(errorMessage, command, commandArgs, hostName), ex); } finally { disconnectAndLogoutFromFTPServer(ftpClient, hostName); } } return result; }
[ "public", "static", "String", "executeCommandOnFTPServer", "(", "String", "hostName", ",", "Integer", "port", ",", "String", "userName", ",", "String", "password", ",", "String", "command", ",", "String", "commandArgs", ")", "{", "String", "result", "=", "null", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "command", ")", ")", "{", "FTPClient", "ftpClient", "=", "new", "FTPClient", "(", ")", ";", "String", "errorMessage", "=", "\"Unable to connect and execute %s command with argumments '%s' for FTP server '%s'.\"", ";", "try", "{", "connectAndLoginOnFTPServer", "(", "ftpClient", ",", "hostName", ",", "port", ",", "userName", ",", "password", ")", ";", "// execute command", "if", "(", "StringUtils", ".", "isBlank", "(", "commandArgs", ")", ")", "{", "ftpClient", ".", "sendCommand", "(", "command", ")", ";", "}", "else", "{", "ftpClient", ".", "sendCommand", "(", "command", ",", "commandArgs", ")", ";", "}", "validatResponse", "(", "ftpClient", ")", ";", "result", "=", "ftpClient", ".", "getReplyString", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "String", ".", "format", "(", "errorMessage", ",", "command", ",", "commandArgs", ",", "hostName", ")", ",", "ex", ")", ";", "}", "finally", "{", "disconnectAndLogoutFromFTPServer", "(", "ftpClient", ",", "hostName", ")", ";", "}", "}", "return", "result", ";", "}" ]
Execute command with supplied arguments on the FTP server. @param hostName the FTP server host name to connect @param port the port to connect @param userName the user name @param password the password @param command the command to execute. @param commandArgs the command argument(s), if any. @return reply string from FTP server after the command has been executed. @throws RuntimeException in case any exception has been thrown.
[ "Execute", "command", "with", "supplied", "arguments", "on", "the", "FTP", "server", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java#L55-L82
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/GPXRead.java
GPXRead.readGPX
public static void readGPX(Connection connection, String fileName, String tableReference, boolean deleteTables) throws IOException, SQLException { """ Copy data from GPX File into a new table in specified connection. @param connection Active connection @param tableReference [[catalog.]schema.]table reference @param fileName File path of the SHP file @param deleteTables true to delete the existing tables @throws java.io.IOException @throws java.sql.SQLException """ File file = URIUtilities.fileFromString(fileName); if (FileUtil.isFileImportable(file, "gpx")) { GPXDriverFunction gpxdf = new GPXDriverFunction(); gpxdf.importFile(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), deleteTables); } }
java
public static void readGPX(Connection connection, String fileName, String tableReference, boolean deleteTables) throws IOException, SQLException { File file = URIUtilities.fileFromString(fileName); if (FileUtil.isFileImportable(file, "gpx")) { GPXDriverFunction gpxdf = new GPXDriverFunction(); gpxdf.importFile(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), deleteTables); } }
[ "public", "static", "void", "readGPX", "(", "Connection", "connection", ",", "String", "fileName", ",", "String", "tableReference", ",", "boolean", "deleteTables", ")", "throws", "IOException", ",", "SQLException", "{", "File", "file", "=", "URIUtilities", ".", "fileFromString", "(", "fileName", ")", ";", "if", "(", "FileUtil", ".", "isFileImportable", "(", "file", ",", "\"gpx\"", ")", ")", "{", "GPXDriverFunction", "gpxdf", "=", "new", "GPXDriverFunction", "(", ")", ";", "gpxdf", ".", "importFile", "(", "connection", ",", "tableReference", ",", "URIUtilities", ".", "fileFromString", "(", "fileName", ")", ",", "new", "EmptyProgressVisitor", "(", ")", ",", "deleteTables", ")", ";", "}", "}" ]
Copy data from GPX File into a new table in specified connection. @param connection Active connection @param tableReference [[catalog.]schema.]table reference @param fileName File path of the SHP file @param deleteTables true to delete the existing tables @throws java.io.IOException @throws java.sql.SQLException
[ "Copy", "data", "from", "GPX", "File", "into", "a", "new", "table", "in", "specified", "connection", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/GPXRead.java#L63-L69
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java
BinaryRowProtocol.getInternalBoolean
public boolean getInternalBoolean(ColumnInformation columnInfo) throws SQLException { """ Get boolean from raw binary format. @param columnInfo column information @return boolean value @throws SQLException if column type doesn't permit conversion """ if (lastValueWasNull()) { return false; } switch (columnInfo.getColumnType()) { case BIT: return parseBit() != 0; case TINYINT: return getInternalTinyInt(columnInfo) != 0; case SMALLINT: case YEAR: return getInternalSmallInt(columnInfo) != 0; case INTEGER: case MEDIUMINT: return getInternalMediumInt(columnInfo) != 0; case BIGINT: return getInternalLong(columnInfo) != 0; case FLOAT: return getInternalFloat(columnInfo) != 0; case DOUBLE: return getInternalDouble(columnInfo) != 0; case DECIMAL: case OLDDECIMAL: return getInternalBigDecimal(columnInfo).longValue() != 0; default: final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8); return !("false".equals(rawVal) || "0".equals(rawVal)); } }
java
public boolean getInternalBoolean(ColumnInformation columnInfo) throws SQLException { if (lastValueWasNull()) { return false; } switch (columnInfo.getColumnType()) { case BIT: return parseBit() != 0; case TINYINT: return getInternalTinyInt(columnInfo) != 0; case SMALLINT: case YEAR: return getInternalSmallInt(columnInfo) != 0; case INTEGER: case MEDIUMINT: return getInternalMediumInt(columnInfo) != 0; case BIGINT: return getInternalLong(columnInfo) != 0; case FLOAT: return getInternalFloat(columnInfo) != 0; case DOUBLE: return getInternalDouble(columnInfo) != 0; case DECIMAL: case OLDDECIMAL: return getInternalBigDecimal(columnInfo).longValue() != 0; default: final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8); return !("false".equals(rawVal) || "0".equals(rawVal)); } }
[ "public", "boolean", "getInternalBoolean", "(", "ColumnInformation", "columnInfo", ")", "throws", "SQLException", "{", "if", "(", "lastValueWasNull", "(", ")", ")", "{", "return", "false", ";", "}", "switch", "(", "columnInfo", ".", "getColumnType", "(", ")", ")", "{", "case", "BIT", ":", "return", "parseBit", "(", ")", "!=", "0", ";", "case", "TINYINT", ":", "return", "getInternalTinyInt", "(", "columnInfo", ")", "!=", "0", ";", "case", "SMALLINT", ":", "case", "YEAR", ":", "return", "getInternalSmallInt", "(", "columnInfo", ")", "!=", "0", ";", "case", "INTEGER", ":", "case", "MEDIUMINT", ":", "return", "getInternalMediumInt", "(", "columnInfo", ")", "!=", "0", ";", "case", "BIGINT", ":", "return", "getInternalLong", "(", "columnInfo", ")", "!=", "0", ";", "case", "FLOAT", ":", "return", "getInternalFloat", "(", "columnInfo", ")", "!=", "0", ";", "case", "DOUBLE", ":", "return", "getInternalDouble", "(", "columnInfo", ")", "!=", "0", ";", "case", "DECIMAL", ":", "case", "OLDDECIMAL", ":", "return", "getInternalBigDecimal", "(", "columnInfo", ")", ".", "longValue", "(", ")", "!=", "0", ";", "default", ":", "final", "String", "rawVal", "=", "new", "String", "(", "buf", ",", "pos", ",", "length", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "return", "!", "(", "\"false\"", ".", "equals", "(", "rawVal", ")", "||", "\"0\"", ".", "equals", "(", "rawVal", ")", ")", ";", "}", "}" ]
Get boolean from raw binary format. @param columnInfo column information @return boolean value @throws SQLException if column type doesn't permit conversion
[ "Get", "boolean", "from", "raw", "binary", "format", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L1077-L1105
craftercms/core
src/main/java/org/craftercms/core/cache/impl/store/MapCacheStoreAdapter.java
MapCacheStoreAdapter.addScope
public void addScope(String scope, int maxItemsInMemory) throws Exception { """ Adds a new scope. The scope is an instance of {@link ConcurrentHashMap}. @param scope the name of the scope @param maxItemsInMemory the maximum number of items in memory, before they are evicted @throws Exception """ // Ignore maxItemsInMemory, since we don't run an eviction algorithm. scopeCaches.put(scope, new ConcurrentHashMap<Object, CacheItem>()); }
java
public void addScope(String scope, int maxItemsInMemory) throws Exception { // Ignore maxItemsInMemory, since we don't run an eviction algorithm. scopeCaches.put(scope, new ConcurrentHashMap<Object, CacheItem>()); }
[ "public", "void", "addScope", "(", "String", "scope", ",", "int", "maxItemsInMemory", ")", "throws", "Exception", "{", "// Ignore maxItemsInMemory, since we don't run an eviction algorithm.", "scopeCaches", ".", "put", "(", "scope", ",", "new", "ConcurrentHashMap", "<", "Object", ",", "CacheItem", ">", "(", ")", ")", ";", "}" ]
Adds a new scope. The scope is an instance of {@link ConcurrentHashMap}. @param scope the name of the scope @param maxItemsInMemory the maximum number of items in memory, before they are evicted @throws Exception
[ "Adds", "a", "new", "scope", ".", "The", "scope", "is", "an", "instance", "of", "{", "@link", "ConcurrentHashMap", "}", "." ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/cache/impl/store/MapCacheStoreAdapter.java#L83-L86