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
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/FileUtils.java
FileUtils.dirIsUseable
public static boolean dirIsUseable(final String aDirName, final String aPermString) { """ Tests that the supplied directory exists and can be used according to the supplied permissions string (e.g., 'rwx'). @param aDirName A name of a directory on the file system @param aPermString A string representing the desired permissions of the directory @return True if the directory is okay to be used; else, false """ final File dir = new File(aDirName); if (!dir.exists() && !dir.mkdirs()) { return false; } else if ("r".contains(aPermString)) { return dir.canRead(); } else if ("w".contains(aPermString)) { return dir.canWrite(); } else if ("x".contains(aPermString)) { return dir.canExecute(); } else { return true; } }
java
public static boolean dirIsUseable(final String aDirName, final String aPermString) { final File dir = new File(aDirName); if (!dir.exists() && !dir.mkdirs()) { return false; } else if ("r".contains(aPermString)) { return dir.canRead(); } else if ("w".contains(aPermString)) { return dir.canWrite(); } else if ("x".contains(aPermString)) { return dir.canExecute(); } else { return true; } }
[ "public", "static", "boolean", "dirIsUseable", "(", "final", "String", "aDirName", ",", "final", "String", "aPermString", ")", "{", "final", "File", "dir", "=", "new", "File", "(", "aDirName", ")", ";", "if", "(", "!", "dir", ".", "exists", "(", ")", "&&", "!", "dir", ".", "mkdirs", "(", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "\"r\"", ".", "contains", "(", "aPermString", ")", ")", "{", "return", "dir", ".", "canRead", "(", ")", ";", "}", "else", "if", "(", "\"w\"", ".", "contains", "(", "aPermString", ")", ")", "{", "return", "dir", ".", "canWrite", "(", ")", ";", "}", "else", "if", "(", "\"x\"", ".", "contains", "(", "aPermString", ")", ")", "{", "return", "dir", ".", "canExecute", "(", ")", ";", "}", "else", "{", "return", "true", ";", "}", "}" ]
Tests that the supplied directory exists and can be used according to the supplied permissions string (e.g., 'rwx'). @param aDirName A name of a directory on the file system @param aPermString A string representing the desired permissions of the directory @return True if the directory is okay to be used; else, false
[ "Tests", "that", "the", "supplied", "directory", "exists", "and", "can", "be", "used", "according", "to", "the", "supplied", "permissions", "string", "(", "e", ".", "g", ".", "rwx", ")", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L621-L635
OpenLiberty/open-liberty
dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/SessionInfo.java
SessionInfo.encodeURL
public static String encodeURL(String url, SessionInfo info) { """ Encode session information into the provided URL. This will replace any existing session in that URL. @param url @param info @return String """ // could be /path/page#fragment?query // could be /page/page;session=existing#fragment?query // where fragment and query are both optional HttpSession session = info.getSession(); if (null == session) { return url; } final String id = session.getId(); final String target = info.getSessionConfig().getURLRewritingMarker(); URLParser parser = new URLParser(url, target); StringBuilder sb = new StringBuilder(); if (-1 != parser.idMarker) { // a session exists in the URL, overlay this ID sb.append(url); int start = parser.idMarker + target.length(); if (start + 23 < url.length()) { sb.replace(start, start + 23, id); } else { // invalid length on existing session, just remove that // TODO: what if a fragment or query string was after the // invalid session data sb.setLength(parser.idMarker); sb.append(target).append(id); } } else { // add session data to the URL if (-1 != parser.fragmentMarker) { // prepend it before the uri fragment sb.append(url, 0, parser.fragmentMarker); sb.append(target).append(id); sb.append(url, parser.fragmentMarker, url.length()); } else if (-1 != parser.queryMarker) { // prepend it before the query data sb.append(url, 0, parser.queryMarker); sb.append(target).append(id); sb.append(url, parser.queryMarker, url.length()); } else { // just a uri sb.append(url).append(target).append(id); } } return sb.toString(); }
java
public static String encodeURL(String url, SessionInfo info) { // could be /path/page#fragment?query // could be /page/page;session=existing#fragment?query // where fragment and query are both optional HttpSession session = info.getSession(); if (null == session) { return url; } final String id = session.getId(); final String target = info.getSessionConfig().getURLRewritingMarker(); URLParser parser = new URLParser(url, target); StringBuilder sb = new StringBuilder(); if (-1 != parser.idMarker) { // a session exists in the URL, overlay this ID sb.append(url); int start = parser.idMarker + target.length(); if (start + 23 < url.length()) { sb.replace(start, start + 23, id); } else { // invalid length on existing session, just remove that // TODO: what if a fragment or query string was after the // invalid session data sb.setLength(parser.idMarker); sb.append(target).append(id); } } else { // add session data to the URL if (-1 != parser.fragmentMarker) { // prepend it before the uri fragment sb.append(url, 0, parser.fragmentMarker); sb.append(target).append(id); sb.append(url, parser.fragmentMarker, url.length()); } else if (-1 != parser.queryMarker) { // prepend it before the query data sb.append(url, 0, parser.queryMarker); sb.append(target).append(id); sb.append(url, parser.queryMarker, url.length()); } else { // just a uri sb.append(url).append(target).append(id); } } return sb.toString(); }
[ "public", "static", "String", "encodeURL", "(", "String", "url", ",", "SessionInfo", "info", ")", "{", "// could be /path/page#fragment?query", "// could be /page/page;session=existing#fragment?query", "// where fragment and query are both optional", "HttpSession", "session", "=", "info", ".", "getSession", "(", ")", ";", "if", "(", "null", "==", "session", ")", "{", "return", "url", ";", "}", "final", "String", "id", "=", "session", ".", "getId", "(", ")", ";", "final", "String", "target", "=", "info", ".", "getSessionConfig", "(", ")", ".", "getURLRewritingMarker", "(", ")", ";", "URLParser", "parser", "=", "new", "URLParser", "(", "url", ",", "target", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "-", "1", "!=", "parser", ".", "idMarker", ")", "{", "// a session exists in the URL, overlay this ID", "sb", ".", "append", "(", "url", ")", ";", "int", "start", "=", "parser", ".", "idMarker", "+", "target", ".", "length", "(", ")", ";", "if", "(", "start", "+", "23", "<", "url", ".", "length", "(", ")", ")", "{", "sb", ".", "replace", "(", "start", ",", "start", "+", "23", ",", "id", ")", ";", "}", "else", "{", "// invalid length on existing session, just remove that", "// TODO: what if a fragment or query string was after the", "// invalid session data", "sb", ".", "setLength", "(", "parser", ".", "idMarker", ")", ";", "sb", ".", "append", "(", "target", ")", ".", "append", "(", "id", ")", ";", "}", "}", "else", "{", "// add session data to the URL", "if", "(", "-", "1", "!=", "parser", ".", "fragmentMarker", ")", "{", "// prepend it before the uri fragment", "sb", ".", "append", "(", "url", ",", "0", ",", "parser", ".", "fragmentMarker", ")", ";", "sb", ".", "append", "(", "target", ")", ".", "append", "(", "id", ")", ";", "sb", ".", "append", "(", "url", ",", "parser", ".", "fragmentMarker", ",", "url", ".", "length", "(", ")", ")", ";", "}", "else", "if", "(", "-", "1", "!=", "parser", ".", "queryMarker", ")", "{", "// prepend it before the query data", "sb", ".", "append", "(", "url", ",", "0", ",", "parser", ".", "queryMarker", ")", ";", "sb", ".", "append", "(", "target", ")", ".", "append", "(", "id", ")", ";", "sb", ".", "append", "(", "url", ",", "parser", ".", "queryMarker", ",", "url", ".", "length", "(", ")", ")", ";", "}", "else", "{", "// just a uri", "sb", ".", "append", "(", "url", ")", ".", "append", "(", "target", ")", ".", "append", "(", "id", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Encode session information into the provided URL. This will replace any existing session in that URL. @param url @param info @return String
[ "Encode", "session", "information", "into", "the", "provided", "URL", ".", "This", "will", "replace", "any", "existing", "session", "in", "that", "URL", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/session/internal/SessionInfo.java#L117-L162
KyoriPowered/lunar
src/main/java/net/kyori/lunar/graph/MoreGraphs.java
MoreGraphs.orderedTopologicalSort
public static <T extends Comparable<? super T>> @NonNull List<T> orderedTopologicalSort(final @NonNull Graph<T> graph) { """ Sorts a directed acyclic graph into a list. <p>The particular order of elements without prerequisites is determined by the natural order.</p> @param graph the graph to be sorted @param <T> the node type, implementing {@link Comparable} @return the sorted list @throws CyclePresentException if the graph has cycles @throws IllegalArgumentException if the graph is not directed or allows self loops """ return topologicalSort(graph, SortType.comparable()); }
java
public static <T extends Comparable<? super T>> @NonNull List<T> orderedTopologicalSort(final @NonNull Graph<T> graph) { return topologicalSort(graph, SortType.comparable()); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "@", "NonNull", "List", "<", "T", ">", "orderedTopologicalSort", "(", "final", "@", "NonNull", "Graph", "<", "T", ">", "graph", ")", "{", "return", "topologicalSort", "(", "graph", ",", "SortType", ".", "comparable", "(", ")", ")", ";", "}" ]
Sorts a directed acyclic graph into a list. <p>The particular order of elements without prerequisites is determined by the natural order.</p> @param graph the graph to be sorted @param <T> the node type, implementing {@link Comparable} @return the sorted list @throws CyclePresentException if the graph has cycles @throws IllegalArgumentException if the graph is not directed or allows self loops
[ "Sorts", "a", "directed", "acyclic", "graph", "into", "a", "list", "." ]
train
https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/graph/MoreGraphs.java#L87-L89
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountAssembliesInner.java
IntegrationAccountAssembliesInner.listContentCallbackUrlAsync
public Observable<WorkflowTriggerCallbackUrlInner> listContentCallbackUrlAsync(String resourceGroupName, String integrationAccountName, String assemblyArtifactName) { """ Get the content callback url for an integration account assembly. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param assemblyArtifactName The assembly artifact name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowTriggerCallbackUrlInner object """ return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, assemblyArtifactName).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() { @Override public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) { return response.body(); } }); }
java
public Observable<WorkflowTriggerCallbackUrlInner> listContentCallbackUrlAsync(String resourceGroupName, String integrationAccountName, String assemblyArtifactName) { return listContentCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, assemblyArtifactName).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() { @Override public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkflowTriggerCallbackUrlInner", ">", "listContentCallbackUrlAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "assemblyArtifactName", ")", "{", "return", "listContentCallbackUrlWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ",", "assemblyArtifactName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "WorkflowTriggerCallbackUrlInner", ">", ",", "WorkflowTriggerCallbackUrlInner", ">", "(", ")", "{", "@", "Override", "public", "WorkflowTriggerCallbackUrlInner", "call", "(", "ServiceResponse", "<", "WorkflowTriggerCallbackUrlInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the content callback url for an integration account assembly. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param assemblyArtifactName The assembly artifact name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowTriggerCallbackUrlInner object
[ "Get", "the", "content", "callback", "url", "for", "an", "integration", "account", "assembly", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountAssembliesInner.java#L499-L506
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/event/MapEventPublisherImpl.java
MapEventPublisherImpl.publishWanEvent
protected void publishWanEvent(String mapName, ReplicationEventObject event) { """ Publishes the {@code event} to the {@link WanReplicationPublisher} configured for this map. @param mapName the map name @param event the event """ MapContainer mapContainer = mapServiceContext.getMapContainer(mapName); WanReplicationPublisher wanReplicationPublisher = mapContainer.getWanReplicationPublisher(); if (isOwnedPartition(event.getKey())) { wanReplicationPublisher.publishReplicationEvent(SERVICE_NAME, event); } else { wanReplicationPublisher.publishReplicationEventBackup(SERVICE_NAME, event); } }
java
protected void publishWanEvent(String mapName, ReplicationEventObject event) { MapContainer mapContainer = mapServiceContext.getMapContainer(mapName); WanReplicationPublisher wanReplicationPublisher = mapContainer.getWanReplicationPublisher(); if (isOwnedPartition(event.getKey())) { wanReplicationPublisher.publishReplicationEvent(SERVICE_NAME, event); } else { wanReplicationPublisher.publishReplicationEventBackup(SERVICE_NAME, event); } }
[ "protected", "void", "publishWanEvent", "(", "String", "mapName", ",", "ReplicationEventObject", "event", ")", "{", "MapContainer", "mapContainer", "=", "mapServiceContext", ".", "getMapContainer", "(", "mapName", ")", ";", "WanReplicationPublisher", "wanReplicationPublisher", "=", "mapContainer", ".", "getWanReplicationPublisher", "(", ")", ";", "if", "(", "isOwnedPartition", "(", "event", ".", "getKey", "(", ")", ")", ")", "{", "wanReplicationPublisher", ".", "publishReplicationEvent", "(", "SERVICE_NAME", ",", "event", ")", ";", "}", "else", "{", "wanReplicationPublisher", ".", "publishReplicationEventBackup", "(", "SERVICE_NAME", ",", "event", ")", ";", "}", "}" ]
Publishes the {@code event} to the {@link WanReplicationPublisher} configured for this map. @param mapName the map name @param event the event
[ "Publishes", "the", "{", "@code", "event", "}", "to", "the", "{", "@link", "WanReplicationPublisher", "}", "configured", "for", "this", "map", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/event/MapEventPublisherImpl.java#L122-L130
loldevs/riotapi
spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java
MappedDataCache.await
public void await(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { """ Waits until the key has been assigned a value, up to the specified maximum. @param k THe key to wait for. @param timeout The maximum time to wait. @param unit The time unit of the timeout. @throws InterruptedException @throws TimeoutException """ if (!acquireLock(k).await(timeout, unit)) { throw new TimeoutException("Wait time for retrieving value for key " + k + " exceeded " + timeout + " " + unit); } }
java
public void await(K k, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { if (!acquireLock(k).await(timeout, unit)) { throw new TimeoutException("Wait time for retrieving value for key " + k + " exceeded " + timeout + " " + unit); } }
[ "public", "void", "await", "(", "K", "k", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "if", "(", "!", "acquireLock", "(", "k", ")", ".", "await", "(", "timeout", ",", "unit", ")", ")", "{", "throw", "new", "TimeoutException", "(", "\"Wait time for retrieving value for key \"", "+", "k", "+", "\" exceeded \"", "+", "timeout", "+", "\" \"", "+", "unit", ")", ";", "}", "}" ]
Waits until the key has been assigned a value, up to the specified maximum. @param k THe key to wait for. @param timeout The maximum time to wait. @param unit The time unit of the timeout. @throws InterruptedException @throws TimeoutException
[ "Waits", "until", "the", "key", "has", "been", "assigned", "a", "value", "up", "to", "the", "specified", "maximum", "." ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/spectator/src/main/java/net/boreeas/riotapi/spectator/MappedDataCache.java#L104-L108
amlinv/registry-utils
src/main/java/com/amlinv/registry/util/listener/SimpleSynchronousNotificationExecutor.java
SimpleSynchronousNotificationExecutor.firePutNotification
public void firePutNotification(Iterator<RegistryListener<K, V>> listeners, K putKey, V putValue) { """ Fire notification of a new entry added to the registry. @param putKey key identifying the entry in the registry. @param putValue value of the entry in the registry. """ while (listeners.hasNext() ) { listeners.next().onPutEntry(putKey, putValue); } }
java
public void firePutNotification(Iterator<RegistryListener<K, V>> listeners, K putKey, V putValue) { while (listeners.hasNext() ) { listeners.next().onPutEntry(putKey, putValue); } }
[ "public", "void", "firePutNotification", "(", "Iterator", "<", "RegistryListener", "<", "K", ",", "V", ">", ">", "listeners", ",", "K", "putKey", ",", "V", "putValue", ")", "{", "while", "(", "listeners", ".", "hasNext", "(", ")", ")", "{", "listeners", ".", "next", "(", ")", ".", "onPutEntry", "(", "putKey", ",", "putValue", ")", ";", "}", "}" ]
Fire notification of a new entry added to the registry. @param putKey key identifying the entry in the registry. @param putValue value of the entry in the registry.
[ "Fire", "notification", "of", "a", "new", "entry", "added", "to", "the", "registry", "." ]
train
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/listener/SimpleSynchronousNotificationExecutor.java#L39-L43
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.makeHeap
public static void makeHeap(Quicksortable q, int size) { """ Makes a heap with the elements [0, size) of q @param q The quicksortable to transform into a heap. @param size The size of the quicksortable. """ for (int i = (size-1)/2; i >= 0; i--) { heapifyDown(q, i, size); } }
java
public static void makeHeap(Quicksortable q, int size) { for (int i = (size-1)/2; i >= 0; i--) { heapifyDown(q, i, size); } }
[ "public", "static", "void", "makeHeap", "(", "Quicksortable", "q", ",", "int", "size", ")", "{", "for", "(", "int", "i", "=", "(", "size", "-", "1", ")", "/", "2", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "heapifyDown", "(", "q", ",", "i", ",", "size", ")", ";", "}", "}" ]
Makes a heap with the elements [0, size) of q @param q The quicksortable to transform into a heap. @param size The size of the quicksortable.
[ "Makes", "a", "heap", "with", "the", "elements", "[", "0", "size", ")", "of", "q" ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L307-L311
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java
AbstractTriangle3F.getPointOnGround
public Point3f getPointOnGround(Point2D point, CoordinateSystem3D system) { """ Replies the projection on the triangle that is representing a ground. <p> Assuming that the triangle is representing a face of a terrain/ground, this function compute the position on the ground just below the given position. The input of this function is the coordinate of a point on the horizontal plane. @param point is the point to project on the triangle. @param system is the coordinate system to use for determining the up coordinate. @return the position on the ground. """ return getPointOnGround(point.getX(), point.getY(), system); }
java
public Point3f getPointOnGround(Point2D point, CoordinateSystem3D system) { return getPointOnGround(point.getX(), point.getY(), system); }
[ "public", "Point3f", "getPointOnGround", "(", "Point2D", "point", ",", "CoordinateSystem3D", "system", ")", "{", "return", "getPointOnGround", "(", "point", ".", "getX", "(", ")", ",", "point", ".", "getY", "(", ")", ",", "system", ")", ";", "}" ]
Replies the projection on the triangle that is representing a ground. <p> Assuming that the triangle is representing a face of a terrain/ground, this function compute the position on the ground just below the given position. The input of this function is the coordinate of a point on the horizontal plane. @param point is the point to project on the triangle. @param system is the coordinate system to use for determining the up coordinate. @return the position on the ground.
[ "Replies", "the", "projection", "on", "the", "triangle", "that", "is", "representing", "a", "ground", ".", "<p", ">", "Assuming", "that", "the", "triangle", "is", "representing", "a", "face", "of", "a", "terrain", "/", "ground", "this", "function", "compute", "the", "position", "on", "the", "ground", "just", "below", "the", "given", "position", ".", "The", "input", "of", "this", "function", "is", "the", "coordinate", "of", "a", "point", "on", "the", "horizontal", "plane", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java#L2265-L2267
bazaarvoice/emodb
mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java
HadoopDataStoreManager.asCloseableDataStore
private CloseableDataStore asCloseableDataStore(final DataStore dataStore, final Optional<Runnable> onClose) { """ Creates a proxy which delegates all DataStore operations to the provided instance and delegates the Closeable's close() method to the provided Runnable if necessary. """ return (CloseableDataStore) Proxy.newProxyInstance( DataStore.class.getClassLoader(), new Class[] { CloseableDataStore.class }, new AbstractInvocationHandler() { @Override protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { if ("close".equals(method.getName())) { if (onClose.isPresent()) { onClose.get().run(); } return null; } else { return method.invoke(dataStore, args); } } }); }
java
private CloseableDataStore asCloseableDataStore(final DataStore dataStore, final Optional<Runnable> onClose) { return (CloseableDataStore) Proxy.newProxyInstance( DataStore.class.getClassLoader(), new Class[] { CloseableDataStore.class }, new AbstractInvocationHandler() { @Override protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { if ("close".equals(method.getName())) { if (onClose.isPresent()) { onClose.get().run(); } return null; } else { return method.invoke(dataStore, args); } } }); }
[ "private", "CloseableDataStore", "asCloseableDataStore", "(", "final", "DataStore", "dataStore", ",", "final", "Optional", "<", "Runnable", ">", "onClose", ")", "{", "return", "(", "CloseableDataStore", ")", "Proxy", ".", "newProxyInstance", "(", "DataStore", ".", "class", ".", "getClassLoader", "(", ")", ",", "new", "Class", "[", "]", "{", "CloseableDataStore", ".", "class", "}", ",", "new", "AbstractInvocationHandler", "(", ")", "{", "@", "Override", "protected", "Object", "handleInvocation", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "if", "(", "\"close\"", ".", "equals", "(", "method", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "onClose", ".", "isPresent", "(", ")", ")", "{", "onClose", ".", "get", "(", ")", ".", "run", "(", ")", ";", "}", "return", "null", ";", "}", "else", "{", "return", "method", ".", "invoke", "(", "dataStore", ",", "args", ")", ";", "}", "}", "}", ")", ";", "}" ]
Creates a proxy which delegates all DataStore operations to the provided instance and delegates the Closeable's close() method to the provided Runnable if necessary.
[ "Creates", "a", "proxy", "which", "delegates", "all", "DataStore", "operations", "to", "the", "provided", "instance", "and", "delegates", "the", "Closeable", "s", "close", "()", "method", "to", "the", "provided", "Runnable", "if", "necessary", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java#L177-L194
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.executeLargeUpdate
@Override public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException { """ Identical to executeLargeUpdate(String sql, int autoGeneratedKeys) with autoGeneratedKeys = Statement.RETURN_GENERATED_KEYS set. @param sql sql command @param columnNames columns names @return update counts @throws SQLException if any error occur during execution """ return executeLargeUpdate(sql, Statement.RETURN_GENERATED_KEYS); }
java
@Override public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException { return executeLargeUpdate(sql, Statement.RETURN_GENERATED_KEYS); }
[ "@", "Override", "public", "long", "executeLargeUpdate", "(", "String", "sql", ",", "String", "[", "]", "columnNames", ")", "throws", "SQLException", "{", "return", "executeLargeUpdate", "(", "sql", ",", "Statement", ".", "RETURN_GENERATED_KEYS", ")", ";", "}" ]
Identical to executeLargeUpdate(String sql, int autoGeneratedKeys) with autoGeneratedKeys = Statement.RETURN_GENERATED_KEYS set. @param sql sql command @param columnNames columns names @return update counts @throws SQLException if any error occur during execution
[ "Identical", "to", "executeLargeUpdate", "(", "String", "sql", "int", "autoGeneratedKeys", ")", "with", "autoGeneratedKeys", "=", "Statement", ".", "RETURN_GENERATED_KEYS", "set", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L670-L673
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
Start.checkOneArg
private void checkOneArg(List<String> args, int index) throws OptionException { """ Check the one arg option. Error and exit if one argument is not provided. """ if ((index + 1) >= args.size() || args.get(index + 1).startsWith("-d")) { String text = messager.getText("main.requires_argument", args.get(index)); throw new OptionException(CMDERR, this::usage, text); } }
java
private void checkOneArg(List<String> args, int index) throws OptionException { if ((index + 1) >= args.size() || args.get(index + 1).startsWith("-d")) { String text = messager.getText("main.requires_argument", args.get(index)); throw new OptionException(CMDERR, this::usage, text); } }
[ "private", "void", "checkOneArg", "(", "List", "<", "String", ">", "args", ",", "int", "index", ")", "throws", "OptionException", "{", "if", "(", "(", "index", "+", "1", ")", ">=", "args", ".", "size", "(", ")", "||", "args", ".", "get", "(", "index", "+", "1", ")", ".", "startsWith", "(", "\"-d\"", ")", ")", "{", "String", "text", "=", "messager", ".", "getText", "(", "\"main.requires_argument\"", ",", "args", ".", "get", "(", "index", ")", ")", ";", "throw", "new", "OptionException", "(", "CMDERR", ",", "this", "::", "usage", ",", "text", ")", ";", "}", "}" ]
Check the one arg option. Error and exit if one argument is not provided.
[ "Check", "the", "one", "arg", "option", ".", "Error", "and", "exit", "if", "one", "argument", "is", "not", "provided", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java#L870-L875
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.slurpFile
public static String slurpFile(File file, String encoding) throws IOException { """ Returns all the text in the given File. @param file The file to read from @param encoding The character encoding to assume. This may be null, and the platform default character encoding is used. """ return IOUtils.slurpReader(IOUtils.encodedInputStreamReader( new FileInputStream(file), encoding)); }
java
public static String slurpFile(File file, String encoding) throws IOException { return IOUtils.slurpReader(IOUtils.encodedInputStreamReader( new FileInputStream(file), encoding)); }
[ "public", "static", "String", "slurpFile", "(", "File", "file", ",", "String", "encoding", ")", "throws", "IOException", "{", "return", "IOUtils", ".", "slurpReader", "(", "IOUtils", ".", "encodedInputStreamReader", "(", "new", "FileInputStream", "(", "file", ")", ",", "encoding", ")", ")", ";", "}" ]
Returns all the text in the given File. @param file The file to read from @param encoding The character encoding to assume. This may be null, and the platform default character encoding is used.
[ "Returns", "all", "the", "text", "in", "the", "given", "File", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L696-L699
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarChooseEditorModeButton.java
CmsToolbarChooseEditorModeButton.createContextMenu
public CmsContextMenu createContextMenu() { """ Creates the menu widget for this button.<p> @return the menu widget """ m_entries = new ArrayList<I_CmsContextMenuEntry>(); m_entries.add( new EditorModeEntry( Messages.get().key(Messages.GUI_ONLY_NAVIGATION_BUTTON_TITLE_0), EditorMode.navigation)); m_entries.add( new EditorModeEntry(Messages.get().key(Messages.GUI_NON_NAVIGATION_BUTTON_TITLE_0), EditorMode.vfs)); m_entries.add( new EditorModeEntry(Messages.get().key(Messages.GUI_ONLY_GALLERIES_BUTTON_TITLE_0), EditorMode.galleries)); if (CmsCoreProvider.get().getUserInfo().isCategoryManager()) { m_entries.add( new EditorModeEntry( Messages.get().key(Messages.GUI_CONTEXTMENU_CATEGORY_MODE_0), EditorMode.categories)); } if (m_canEditModelPages) { m_entries.add(new EditorModeEntry(Messages.get().key(Messages.GUI_MODEL_PAGES_0), EditorMode.modelpages)); } if (CmsSitemapView.getInstance().getController().isLocaleComparisonEnabled()) { m_entries.add( new EditorModeEntry(Messages.get().key(Messages.GUI_LOCALECOMPARE_MODE_0), EditorMode.compareLocales)); } CmsContextMenu menu = new CmsContextMenu(m_entries, false, getPopup()); return menu; }
java
public CmsContextMenu createContextMenu() { m_entries = new ArrayList<I_CmsContextMenuEntry>(); m_entries.add( new EditorModeEntry( Messages.get().key(Messages.GUI_ONLY_NAVIGATION_BUTTON_TITLE_0), EditorMode.navigation)); m_entries.add( new EditorModeEntry(Messages.get().key(Messages.GUI_NON_NAVIGATION_BUTTON_TITLE_0), EditorMode.vfs)); m_entries.add( new EditorModeEntry(Messages.get().key(Messages.GUI_ONLY_GALLERIES_BUTTON_TITLE_0), EditorMode.galleries)); if (CmsCoreProvider.get().getUserInfo().isCategoryManager()) { m_entries.add( new EditorModeEntry( Messages.get().key(Messages.GUI_CONTEXTMENU_CATEGORY_MODE_0), EditorMode.categories)); } if (m_canEditModelPages) { m_entries.add(new EditorModeEntry(Messages.get().key(Messages.GUI_MODEL_PAGES_0), EditorMode.modelpages)); } if (CmsSitemapView.getInstance().getController().isLocaleComparisonEnabled()) { m_entries.add( new EditorModeEntry(Messages.get().key(Messages.GUI_LOCALECOMPARE_MODE_0), EditorMode.compareLocales)); } CmsContextMenu menu = new CmsContextMenu(m_entries, false, getPopup()); return menu; }
[ "public", "CmsContextMenu", "createContextMenu", "(", ")", "{", "m_entries", "=", "new", "ArrayList", "<", "I_CmsContextMenuEntry", ">", "(", ")", ";", "m_entries", ".", "add", "(", "new", "EditorModeEntry", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_ONLY_NAVIGATION_BUTTON_TITLE_0", ")", ",", "EditorMode", ".", "navigation", ")", ")", ";", "m_entries", ".", "add", "(", "new", "EditorModeEntry", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_NON_NAVIGATION_BUTTON_TITLE_0", ")", ",", "EditorMode", ".", "vfs", ")", ")", ";", "m_entries", ".", "add", "(", "new", "EditorModeEntry", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_ONLY_GALLERIES_BUTTON_TITLE_0", ")", ",", "EditorMode", ".", "galleries", ")", ")", ";", "if", "(", "CmsCoreProvider", ".", "get", "(", ")", ".", "getUserInfo", "(", ")", ".", "isCategoryManager", "(", ")", ")", "{", "m_entries", ".", "add", "(", "new", "EditorModeEntry", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_CONTEXTMENU_CATEGORY_MODE_0", ")", ",", "EditorMode", ".", "categories", ")", ")", ";", "}", "if", "(", "m_canEditModelPages", ")", "{", "m_entries", ".", "add", "(", "new", "EditorModeEntry", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_MODEL_PAGES_0", ")", ",", "EditorMode", ".", "modelpages", ")", ")", ";", "}", "if", "(", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getController", "(", ")", ".", "isLocaleComparisonEnabled", "(", ")", ")", "{", "m_entries", ".", "add", "(", "new", "EditorModeEntry", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_LOCALECOMPARE_MODE_0", ")", ",", "EditorMode", ".", "compareLocales", ")", ")", ";", "}", "CmsContextMenu", "menu", "=", "new", "CmsContextMenu", "(", "m_entries", ",", "false", ",", "getPopup", "(", ")", ")", ";", "return", "menu", ";", "}" ]
Creates the menu widget for this button.<p> @return the menu widget
[ "Creates", "the", "menu", "widget", "for", "this", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarChooseEditorModeButton.java#L151-L178
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/AjaxSlider.java
AjaxSlider.setAjaxStartEvent
public void setAjaxStartEvent(ISliderAjaxEvent ajaxStartEvent) { """ Sets the call-back for the AJAX Start Event. @param ajaxStartEvent The ISliderAjaxEvent. """ this.ajaxEvents.put(SliderAjaxEvent.ajaxStartEvent, ajaxStartEvent); setSlideEvent(new SliderAjaxJsScopeUiEvent(this, SliderAjaxEvent.ajaxStartEvent)); }
java
public void setAjaxStartEvent(ISliderAjaxEvent ajaxStartEvent) { this.ajaxEvents.put(SliderAjaxEvent.ajaxStartEvent, ajaxStartEvent); setSlideEvent(new SliderAjaxJsScopeUiEvent(this, SliderAjaxEvent.ajaxStartEvent)); }
[ "public", "void", "setAjaxStartEvent", "(", "ISliderAjaxEvent", "ajaxStartEvent", ")", "{", "this", ".", "ajaxEvents", ".", "put", "(", "SliderAjaxEvent", ".", "ajaxStartEvent", ",", "ajaxStartEvent", ")", ";", "setSlideEvent", "(", "new", "SliderAjaxJsScopeUiEvent", "(", "this", ",", "SliderAjaxEvent", ".", "ajaxStartEvent", ")", ")", ";", "}" ]
Sets the call-back for the AJAX Start Event. @param ajaxStartEvent The ISliderAjaxEvent.
[ "Sets", "the", "call", "-", "back", "for", "the", "AJAX", "Start", "Event", "." ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/AjaxSlider.java#L318-L322
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/TransactionManager.java
TransactionManager.rollbackPartial
void rollbackPartial(Session session, int start, long timestamp) { """ rollback the row actions from start index in list and the given timestamp """ Object[] list = session.rowActionList.getArray(); int limit = session.rowActionList.size(); if (start == limit) { return; } for (int i = start; i < limit; i++) { RowAction action = (RowAction) list[i]; if (action != null) { action.rollback(session, timestamp); } else { System.out.println("null action in rollback " + start); } } // rolled back transactions can always be merged as they have never been // seen by other sessions mergeRolledBackTransaction(session.rowActionList.getArray(), start, limit); rowActionMapRemoveTransaction(session.rowActionList.getArray(), start, limit, false); session.rowActionList.setSize(start); }
java
void rollbackPartial(Session session, int start, long timestamp) { Object[] list = session.rowActionList.getArray(); int limit = session.rowActionList.size(); if (start == limit) { return; } for (int i = start; i < limit; i++) { RowAction action = (RowAction) list[i]; if (action != null) { action.rollback(session, timestamp); } else { System.out.println("null action in rollback " + start); } } // rolled back transactions can always be merged as they have never been // seen by other sessions mergeRolledBackTransaction(session.rowActionList.getArray(), start, limit); rowActionMapRemoveTransaction(session.rowActionList.getArray(), start, limit, false); session.rowActionList.setSize(start); }
[ "void", "rollbackPartial", "(", "Session", "session", ",", "int", "start", ",", "long", "timestamp", ")", "{", "Object", "[", "]", "list", "=", "session", ".", "rowActionList", ".", "getArray", "(", ")", ";", "int", "limit", "=", "session", ".", "rowActionList", ".", "size", "(", ")", ";", "if", "(", "start", "==", "limit", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "start", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "RowAction", "action", "=", "(", "RowAction", ")", "list", "[", "i", "]", ";", "if", "(", "action", "!=", "null", ")", "{", "action", ".", "rollback", "(", "session", ",", "timestamp", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"null action in rollback \"", "+", "start", ")", ";", "}", "}", "// rolled back transactions can always be merged as they have never been", "// seen by other sessions", "mergeRolledBackTransaction", "(", "session", ".", "rowActionList", ".", "getArray", "(", ")", ",", "start", ",", "limit", ")", ";", "rowActionMapRemoveTransaction", "(", "session", ".", "rowActionList", ".", "getArray", "(", ")", ",", "start", ",", "limit", ",", "false", ")", ";", "session", ".", "rowActionList", ".", "setSize", "(", "start", ")", ";", "}" ]
rollback the row actions from start index in list and the given timestamp
[ "rollback", "the", "row", "actions", "from", "start", "index", "in", "list", "and", "the", "given", "timestamp" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TransactionManager.java#L436-L462
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.between
public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound) { """ Crates new {@link Predicate} for {@code RANGE [lowerBound TO upperBound]} @param lowerBound @param upperBound @return """ return between(lowerBound, upperBound, true, true); }
java
public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound) { return between(lowerBound, upperBound, true, true); }
[ "public", "Criteria", "between", "(", "@", "Nullable", "Object", "lowerBound", ",", "@", "Nullable", "Object", "upperBound", ")", "{", "return", "between", "(", "lowerBound", ",", "upperBound", ",", "true", ",", "true", ")", ";", "}" ]
Crates new {@link Predicate} for {@code RANGE [lowerBound TO upperBound]} @param lowerBound @param upperBound @return
[ "Crates", "new", "{", "@link", "Predicate", "}", "for", "{", "@code", "RANGE", "[", "lowerBound", "TO", "upperBound", "]", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L401-L403
kiegroup/jbpm
jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
NodeInstanceImpl.executeAction
protected void executeAction(Action action) { """ This method is used in both instances of the {@link ExtendedNodeInstanceImpl} and {@link ActionNodeInstance} instances in order to handle exceptions thrown when executing actions. @param action An {@link Action} instance. """ ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime()); context.setNodeInstance(this); try { action.execute(context); } catch (Exception e) { String exceptionName = e.getClass().getName(); ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance) resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, exceptionName); if (exceptionScopeInstance == null) { throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e); } exceptionScopeInstance.handleException(exceptionName, e); cancel(); } }
java
protected void executeAction(Action action) { ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime()); context.setNodeInstance(this); try { action.execute(context); } catch (Exception e) { String exceptionName = e.getClass().getName(); ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance) resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, exceptionName); if (exceptionScopeInstance == null) { throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e); } exceptionScopeInstance.handleException(exceptionName, e); cancel(); } }
[ "protected", "void", "executeAction", "(", "Action", "action", ")", "{", "ProcessContext", "context", "=", "new", "ProcessContext", "(", "getProcessInstance", "(", ")", ".", "getKnowledgeRuntime", "(", ")", ")", ";", "context", ".", "setNodeInstance", "(", "this", ")", ";", "try", "{", "action", ".", "execute", "(", "context", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "exceptionName", "=", "e", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "ExceptionScopeInstance", "exceptionScopeInstance", "=", "(", "ExceptionScopeInstance", ")", "resolveContextInstance", "(", "ExceptionScope", ".", "EXCEPTION_SCOPE", ",", "exceptionName", ")", ";", "if", "(", "exceptionScopeInstance", "==", "null", ")", "{", "throw", "new", "WorkflowRuntimeException", "(", "this", ",", "getProcessInstance", "(", ")", ",", "\"Unable to execute Action: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "exceptionScopeInstance", ".", "handleException", "(", "exceptionName", ",", "e", ")", ";", "cancel", "(", ")", ";", "}", "}" ]
This method is used in both instances of the {@link ExtendedNodeInstanceImpl} and {@link ActionNodeInstance} instances in order to handle exceptions thrown when executing actions. @param action An {@link Action} instance.
[ "This", "method", "is", "used", "in", "both", "instances", "of", "the", "{", "@link", "ExtendedNodeInstanceImpl", "}", "and", "{", "@link", "ActionNodeInstance", "}", "instances", "in", "order", "to", "handle", "exceptions", "thrown", "when", "executing", "actions", "." ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java#L220-L236
landawn/AbacusUtil
src/com/landawn/abacus/util/Matth.java
Matth.multiplyExact
public static int multiplyExact(int a, int b) { """ Returns the product of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a * b} overflows in signed {@code int} arithmetic """ long result = (long) a * b; checkNoOverflow(result == (int) result); return (int) result; }
java
public static int multiplyExact(int a, int b) { long result = (long) a * b; checkNoOverflow(result == (int) result); return (int) result; }
[ "public", "static", "int", "multiplyExact", "(", "int", "a", ",", "int", "b", ")", "{", "long", "result", "=", "(", "long", ")", "a", "*", "b", ";", "checkNoOverflow", "(", "result", "==", "(", "int", ")", "result", ")", ";", "return", "(", "int", ")", "result", ";", "}" ]
Returns the product of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a * b} overflows in signed {@code int} arithmetic
[ "Returns", "the", "product", "of", "{", "@code", "a", "}", "and", "{", "@code", "b", "}", "provided", "it", "does", "not", "overflow", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1415-L1419
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/StringUtils.java
StringUtils.append2digits
public static void append2digits(StringBuilder buf, int i) { """ Append 2 digits (zero padded) to the StringBuilder @param buf the buffer to append to @param i the value to append """ if (i < 100) { buf.append((char) (i / 10 + '0')); buf.append((char) (i % 10 + '0')); } }
java
public static void append2digits(StringBuilder buf, int i) { if (i < 100) { buf.append((char) (i / 10 + '0')); buf.append((char) (i % 10 + '0')); } }
[ "public", "static", "void", "append2digits", "(", "StringBuilder", "buf", ",", "int", "i", ")", "{", "if", "(", "i", "<", "100", ")", "{", "buf", ".", "append", "(", "(", "char", ")", "(", "i", "/", "10", "+", "'", "'", ")", ")", ";", "buf", ".", "append", "(", "(", "char", ")", "(", "i", "%", "10", "+", "'", "'", ")", ")", ";", "}", "}" ]
Append 2 digits (zero padded) to the StringBuilder @param buf the buffer to append to @param i the value to append
[ "Append", "2", "digits", "(", "zero", "padded", ")", "to", "the", "StringBuilder" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/StringUtils.java#L720-L725
andriusvelykis/reflow-maven-skin
reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java
HtmlTool.anchorToId
private static void anchorToId(Element heading, Element anchor) { """ Moves anchor name to heading id, if one does not exist. Removes the anchor. @param heading @param anchor """ if ("a".equals(anchor.tagName()) && heading.id().isEmpty()) { String aName = anchor.attr("name"); if (!aName.isEmpty()) { // set the anchor name as heading ID heading.attr("id", aName); // remove the anchor anchor.remove(); } } }
java
private static void anchorToId(Element heading, Element anchor) { if ("a".equals(anchor.tagName()) && heading.id().isEmpty()) { String aName = anchor.attr("name"); if (!aName.isEmpty()) { // set the anchor name as heading ID heading.attr("id", aName); // remove the anchor anchor.remove(); } } }
[ "private", "static", "void", "anchorToId", "(", "Element", "heading", ",", "Element", "anchor", ")", "{", "if", "(", "\"a\"", ".", "equals", "(", "anchor", ".", "tagName", "(", ")", ")", "&&", "heading", ".", "id", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "String", "aName", "=", "anchor", ".", "attr", "(", "\"name\"", ")", ";", "if", "(", "!", "aName", ".", "isEmpty", "(", ")", ")", "{", "// set the anchor name as heading ID", "heading", ".", "attr", "(", "\"id\"", ",", "aName", ")", ";", "// remove the anchor", "anchor", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Moves anchor name to heading id, if one does not exist. Removes the anchor. @param heading @param anchor
[ "Moves", "anchor", "name", "to", "heading", "id", "if", "one", "does", "not", "exist", ".", "Removes", "the", "anchor", "." ]
train
https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L954-L966
aws/aws-sdk-java
aws-java-sdk-discovery/src/main/java/com/amazonaws/services/applicationdiscovery/model/ListConfigurationsResult.java
ListConfigurationsResult.withConfigurations
public ListConfigurationsResult withConfigurations(java.util.Collection<java.util.Map<String, String>> configurations) { """ <p> Returns configuration details, including the configuration ID, attribute names, and attribute values. </p> @param configurations Returns configuration details, including the configuration ID, attribute names, and attribute values. @return Returns a reference to this object so that method calls can be chained together. """ setConfigurations(configurations); return this; }
java
public ListConfigurationsResult withConfigurations(java.util.Collection<java.util.Map<String, String>> configurations) { setConfigurations(configurations); return this; }
[ "public", "ListConfigurationsResult", "withConfigurations", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "configurations", ")", "{", "setConfigurations", "(", "configurations", ")", ";", "return", "this", ";", "}" ]
<p> Returns configuration details, including the configuration ID, attribute names, and attribute values. </p> @param configurations Returns configuration details, including the configuration ID, attribute names, and attribute values. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Returns", "configuration", "details", "including", "the", "configuration", "ID", "attribute", "names", "and", "attribute", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-discovery/src/main/java/com/amazonaws/services/applicationdiscovery/model/ListConfigurationsResult.java#L101-L104
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java
VdmRuntimeError.patternFail
public static void patternFail(int number, String msg, ILexLocation location) throws PatternMatchException { """ Throw a PatternMatchException with the given message. @param number @param msg @param location @throws PatternMatchException """ throw new PatternMatchException(number, msg, location); }
java
public static void patternFail(int number, String msg, ILexLocation location) throws PatternMatchException { throw new PatternMatchException(number, msg, location); }
[ "public", "static", "void", "patternFail", "(", "int", "number", ",", "String", "msg", ",", "ILexLocation", "location", ")", "throws", "PatternMatchException", "{", "throw", "new", "PatternMatchException", "(", "number", ",", "msg", ",", "location", ")", ";", "}" ]
Throw a PatternMatchException with the given message. @param number @param msg @param location @throws PatternMatchException
[ "Throw", "a", "PatternMatchException", "with", "the", "given", "message", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java#L45-L49
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/integration/WSHelper.java
WSHelper.getRequiredAttachment
public static <A> A getRequiredAttachment( final Deployment dep, final Class< A > key ) { """ Returns required attachment value from webservice deployment. @param <A> expected value @param dep webservice deployment @param key attachment key @return required attachment @throws IllegalStateException if attachment value is null """ final A value = dep.getAttachment( key ); if ( value == null ) { throw Messages.MESSAGES.cannotFindAttachmentInDeployment(key, dep.getSimpleName()); } return value; }
java
public static <A> A getRequiredAttachment( final Deployment dep, final Class< A > key ) { final A value = dep.getAttachment( key ); if ( value == null ) { throw Messages.MESSAGES.cannotFindAttachmentInDeployment(key, dep.getSimpleName()); } return value; }
[ "public", "static", "<", "A", ">", "A", "getRequiredAttachment", "(", "final", "Deployment", "dep", ",", "final", "Class", "<", "A", ">", "key", ")", "{", "final", "A", "value", "=", "dep", ".", "getAttachment", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "Messages", ".", "MESSAGES", ".", "cannotFindAttachmentInDeployment", "(", "key", ",", "dep", ".", "getSimpleName", "(", ")", ")", ";", "}", "return", "value", ";", "}" ]
Returns required attachment value from webservice deployment. @param <A> expected value @param dep webservice deployment @param key attachment key @return required attachment @throws IllegalStateException if attachment value is null
[ "Returns", "required", "attachment", "value", "from", "webservice", "deployment", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/integration/WSHelper.java#L62-L70
fnklabs/draenei
src/main/java/com/fnklabs/draenei/orm/CacheableDataProvider.java
CacheableDataProvider.executeOnEntry
public <ReturnValue> ReturnValue executeOnEntry(@NotNull Entry entry, @NotNull CacheEntryProcessor<Long, Entry, ReturnValue> entryProcessor) { """ Execute entry processor on entry cache @param entry Entry on which will be executed entry processor @param entryProcessor Entry processor that must be executed @param <ReturnValue> ClassType @return Return value from entry processor """ long key = buildHashCode(entry); if (!cache.containsKey(key)) { List<Object> primaryKeys = getPrimaryKeys(entry); List<Entry> entries = super.fetch(primaryKeys); Optional<Entry> first = entries.stream().findFirst(); if (first.isPresent()) { cache.putIfAbsent(key, first.get()); } } return cache.invoke(key, entryProcessor); }
java
public <ReturnValue> ReturnValue executeOnEntry(@NotNull Entry entry, @NotNull CacheEntryProcessor<Long, Entry, ReturnValue> entryProcessor) { long key = buildHashCode(entry); if (!cache.containsKey(key)) { List<Object> primaryKeys = getPrimaryKeys(entry); List<Entry> entries = super.fetch(primaryKeys); Optional<Entry> first = entries.stream().findFirst(); if (first.isPresent()) { cache.putIfAbsent(key, first.get()); } } return cache.invoke(key, entryProcessor); }
[ "public", "<", "ReturnValue", ">", "ReturnValue", "executeOnEntry", "(", "@", "NotNull", "Entry", "entry", ",", "@", "NotNull", "CacheEntryProcessor", "<", "Long", ",", "Entry", ",", "ReturnValue", ">", "entryProcessor", ")", "{", "long", "key", "=", "buildHashCode", "(", "entry", ")", ";", "if", "(", "!", "cache", ".", "containsKey", "(", "key", ")", ")", "{", "List", "<", "Object", ">", "primaryKeys", "=", "getPrimaryKeys", "(", "entry", ")", ";", "List", "<", "Entry", ">", "entries", "=", "super", ".", "fetch", "(", "primaryKeys", ")", ";", "Optional", "<", "Entry", ">", "first", "=", "entries", ".", "stream", "(", ")", ".", "findFirst", "(", ")", ";", "if", "(", "first", ".", "isPresent", "(", ")", ")", "{", "cache", ".", "putIfAbsent", "(", "key", ",", "first", ".", "get", "(", ")", ")", ";", "}", "}", "return", "cache", ".", "invoke", "(", "key", ",", "entryProcessor", ")", ";", "}" ]
Execute entry processor on entry cache @param entry Entry on which will be executed entry processor @param entryProcessor Entry processor that must be executed @param <ReturnValue> ClassType @return Return value from entry processor
[ "Execute", "entry", "processor", "on", "entry", "cache" ]
train
https://github.com/fnklabs/draenei/blob/0a8cac54f1f635be3e2950375a23291d38453ae8/src/main/java/com/fnklabs/draenei/orm/CacheableDataProvider.java#L130-L146
fabric8io/mockwebserver
src/main/java/io/fabric8/mockwebserver/crud/CrudDispatcher.java
CrudDispatcher.handleCreate
public MockResponse handleCreate(String path, String s) { """ Adds the specified object to the in-memory db. @param path @param s @return """ MockResponse response = new MockResponse(); AttributeSet features = AttributeSet.merge(attributeExtractor.fromPath(path), attributeExtractor.fromResource(s)); map.put(features, s); response.setBody(s); response.setResponseCode(202); return response; }
java
public MockResponse handleCreate(String path, String s) { MockResponse response = new MockResponse(); AttributeSet features = AttributeSet.merge(attributeExtractor.fromPath(path), attributeExtractor.fromResource(s)); map.put(features, s); response.setBody(s); response.setResponseCode(202); return response; }
[ "public", "MockResponse", "handleCreate", "(", "String", "path", ",", "String", "s", ")", "{", "MockResponse", "response", "=", "new", "MockResponse", "(", ")", ";", "AttributeSet", "features", "=", "AttributeSet", ".", "merge", "(", "attributeExtractor", ".", "fromPath", "(", "path", ")", ",", "attributeExtractor", ".", "fromResource", "(", "s", ")", ")", ";", "map", ".", "put", "(", "features", ",", "s", ")", ";", "response", ".", "setBody", "(", "s", ")", ";", "response", ".", "setResponseCode", "(", "202", ")", ";", "return", "response", ";", "}" ]
Adds the specified object to the in-memory db. @param path @param s @return
[ "Adds", "the", "specified", "object", "to", "the", "in", "-", "memory", "db", "." ]
train
https://github.com/fabric8io/mockwebserver/blob/ca14c6dd2ec8e2425585a548d5c0d993332b9d2f/src/main/java/io/fabric8/mockwebserver/crud/CrudDispatcher.java#L62-L69
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addSourceLineRange
@Nonnull public BugInstance addSourceLineRange(BytecodeScanningDetector visitor, int startPC, int endPC) { """ Add a source line annotation describing the source line numbers for a range of instructions in the method being visited by the given visitor. Note that if the method does not have line number information, then no source line annotation will be added. @param visitor a BetterVisitor which is visiting the method @param startPC the bytecode offset of the start instruction in the range @param endPC the bytecode offset of the end instruction in the range @return this object """ SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstructionRange(visitor.getClassContext(), visitor, startPC, endPC); requireNonNull(sourceLineAnnotation); add(sourceLineAnnotation); return this; }
java
@Nonnull public BugInstance addSourceLineRange(BytecodeScanningDetector visitor, int startPC, int endPC) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstructionRange(visitor.getClassContext(), visitor, startPC, endPC); requireNonNull(sourceLineAnnotation); add(sourceLineAnnotation); return this; }
[ "@", "Nonnull", "public", "BugInstance", "addSourceLineRange", "(", "BytecodeScanningDetector", "visitor", ",", "int", "startPC", ",", "int", "endPC", ")", "{", "SourceLineAnnotation", "sourceLineAnnotation", "=", "SourceLineAnnotation", ".", "fromVisitedInstructionRange", "(", "visitor", ".", "getClassContext", "(", ")", ",", "visitor", ",", "startPC", ",", "endPC", ")", ";", "requireNonNull", "(", "sourceLineAnnotation", ")", ";", "add", "(", "sourceLineAnnotation", ")", ";", "return", "this", ";", "}" ]
Add a source line annotation describing the source line numbers for a range of instructions in the method being visited by the given visitor. Note that if the method does not have line number information, then no source line annotation will be added. @param visitor a BetterVisitor which is visiting the method @param startPC the bytecode offset of the start instruction in the range @param endPC the bytecode offset of the end instruction in the range @return this object
[ "Add", "a", "source", "line", "annotation", "describing", "the", "source", "line", "numbers", "for", "a", "range", "of", "instructions", "in", "the", "method", "being", "visited", "by", "the", "given", "visitor", ".", "Note", "that", "if", "the", "method", "does", "not", "have", "line", "number", "information", "then", "no", "source", "line", "annotation", "will", "be", "added", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1771-L1778
samskivert/samskivert
src/main/java/com/samskivert/util/ConfigUtil.java
ConfigUtil.loadInheritedProperties
public static void loadInheritedProperties (String path, Properties target) throws IOException { """ Like {@link #loadInheritedProperties(String)} but loads the properties into the supplied target object. """ loadInheritedProperties(path, ConfigUtil.class.getClassLoader(), target); }
java
public static void loadInheritedProperties (String path, Properties target) throws IOException { loadInheritedProperties(path, ConfigUtil.class.getClassLoader(), target); }
[ "public", "static", "void", "loadInheritedProperties", "(", "String", "path", ",", "Properties", "target", ")", "throws", "IOException", "{", "loadInheritedProperties", "(", "path", ",", "ConfigUtil", ".", "class", ".", "getClassLoader", "(", ")", ",", "target", ")", ";", "}" ]
Like {@link #loadInheritedProperties(String)} but loads the properties into the supplied target object.
[ "Like", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L214-L218
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/WriteExcelUtils.java
WriteExcelUtils.writeWorkBook
public static <T> void writeWorkBook(File file, int excelType, List<T> beans, String dateFormat) throws WriteExcelException { """ 向工作簿中写入beans,所有bean写在一个Sheet中,默认以bean中的所有属性作为标题且写入第0行,0-based。并输出到指定file中 @param file 指定Excel输出文件 @param excelType 输出Excel文件类型{@link #XLSX}或者{@link #XLS},此类型必须与file文件名后缀匹配 @param beans 指定写入的Beans(或者泛型为Map) @param dateFormat 日期格式 @throws WriteExcelException """ if (beans == null || beans.isEmpty()) { throw new WriteExcelException("beans参数不能为空"); } Map<String, Object> map = null; if (beans.get(0) instanceof Map) { map = (Map<String, Object>) beans.get(0); } else { map = CommonUtils.toMap(beans.get(0)); } if (map == null) { throw new WriteExcelException("获取bean属性失败"); } List<String> properties = new ArrayList<String>(); properties.addAll(map.keySet()); WriteExcelUtils.writeWorkBook(file, excelType, beans, properties, properties, dateFormat); }
java
public static <T> void writeWorkBook(File file, int excelType, List<T> beans, String dateFormat) throws WriteExcelException { if (beans == null || beans.isEmpty()) { throw new WriteExcelException("beans参数不能为空"); } Map<String, Object> map = null; if (beans.get(0) instanceof Map) { map = (Map<String, Object>) beans.get(0); } else { map = CommonUtils.toMap(beans.get(0)); } if (map == null) { throw new WriteExcelException("获取bean属性失败"); } List<String> properties = new ArrayList<String>(); properties.addAll(map.keySet()); WriteExcelUtils.writeWorkBook(file, excelType, beans, properties, properties, dateFormat); }
[ "public", "static", "<", "T", ">", "void", "writeWorkBook", "(", "File", "file", ",", "int", "excelType", ",", "List", "<", "T", ">", "beans", ",", "String", "dateFormat", ")", "throws", "WriteExcelException", "{", "if", "(", "beans", "==", "null", "||", "beans", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "WriteExcelException", "(", "\"beans参数不能为空\");", "", "", "}", "Map", "<", "String", ",", "Object", ">", "map", "=", "null", ";", "if", "(", "beans", ".", "get", "(", "0", ")", "instanceof", "Map", ")", "{", "map", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "beans", ".", "get", "(", "0", ")", ";", "}", "else", "{", "map", "=", "CommonUtils", ".", "toMap", "(", "beans", ".", "get", "(", "0", ")", ")", ";", "}", "if", "(", "map", "==", "null", ")", "{", "throw", "new", "WriteExcelException", "(", "\"获取bean属性失败\");", "", "", "}", "List", "<", "String", ">", "properties", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "properties", ".", "addAll", "(", "map", ".", "keySet", "(", ")", ")", ";", "WriteExcelUtils", ".", "writeWorkBook", "(", "file", ",", "excelType", ",", "beans", ",", "properties", ",", "properties", ",", "dateFormat", ")", ";", "}" ]
向工作簿中写入beans,所有bean写在一个Sheet中,默认以bean中的所有属性作为标题且写入第0行,0-based。并输出到指定file中 @param file 指定Excel输出文件 @param excelType 输出Excel文件类型{@link #XLSX}或者{@link #XLS},此类型必须与file文件名后缀匹配 @param beans 指定写入的Beans(或者泛型为Map) @param dateFormat 日期格式 @throws WriteExcelException
[ "向工作簿中写入beans,所有bean写在一个Sheet中", "默认以bean中的所有属性作为标题且写入第0行,0", "-", "based。并输出到指定file中" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/WriteExcelUtils.java#L241-L258
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.beginSuspendAsync
public Observable<Page<SiteInner>> beginSuspendAsync(final String resourceGroupName, final String name) { """ Suspend an App Service Environment. Suspend an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object """ return beginSuspendWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); }
java
public Observable<Page<SiteInner>> beginSuspendAsync(final String resourceGroupName, final String name) { return beginSuspendWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SiteInner", ">", ">", "beginSuspendAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "beginSuspendWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", ",", "Page", "<", "SiteInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "SiteInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Suspend an App Service Environment. Suspend an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object
[ "Suspend", "an", "App", "Service", "Environment", ".", "Suspend", "an", "App", "Service", "Environment", "." ]
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/AppServiceEnvironmentsInner.java#L4620-L4628
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/DocumentAutoFormatter.java
DocumentAutoFormatter.formatRegion
protected void formatRegion(IXtextDocument document, int offset, int length) { """ Called for formatting a region. @param document the document to format. @param offset the offset of the text to format. @param length the length of the text. """ try { final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset)); final int endLineIndex = document.getLineOfOffset(offset + length); int regionLength = 0; for (int i = startLineIndex; i <= endLineIndex; ++i) { regionLength += document.getLineLength(i); } if (regionLength > 0) { final int startOffset = document.getLineOffset(startLineIndex); for (final IRegion region : document.computePartitioning(startOffset, regionLength)) { this.contentFormatter.format(document, region); } } } catch (BadLocationException exception) { Exceptions.sneakyThrow(exception); } }
java
protected void formatRegion(IXtextDocument document, int offset, int length) { try { final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset)); final int endLineIndex = document.getLineOfOffset(offset + length); int regionLength = 0; for (int i = startLineIndex; i <= endLineIndex; ++i) { regionLength += document.getLineLength(i); } if (regionLength > 0) { final int startOffset = document.getLineOffset(startLineIndex); for (final IRegion region : document.computePartitioning(startOffset, regionLength)) { this.contentFormatter.format(document, region); } } } catch (BadLocationException exception) { Exceptions.sneakyThrow(exception); } }
[ "protected", "void", "formatRegion", "(", "IXtextDocument", "document", ",", "int", "offset", ",", "int", "length", ")", "{", "try", "{", "final", "int", "startLineIndex", "=", "document", ".", "getLineOfOffset", "(", "previousSiblingChar", "(", "document", ",", "offset", ")", ")", ";", "final", "int", "endLineIndex", "=", "document", ".", "getLineOfOffset", "(", "offset", "+", "length", ")", ";", "int", "regionLength", "=", "0", ";", "for", "(", "int", "i", "=", "startLineIndex", ";", "i", "<=", "endLineIndex", ";", "++", "i", ")", "{", "regionLength", "+=", "document", ".", "getLineLength", "(", "i", ")", ";", "}", "if", "(", "regionLength", ">", "0", ")", "{", "final", "int", "startOffset", "=", "document", ".", "getLineOffset", "(", "startLineIndex", ")", ";", "for", "(", "final", "IRegion", "region", ":", "document", ".", "computePartitioning", "(", "startOffset", ",", "regionLength", ")", ")", "{", "this", ".", "contentFormatter", ".", "format", "(", "document", ",", "region", ")", ";", "}", "}", "}", "catch", "(", "BadLocationException", "exception", ")", "{", "Exceptions", ".", "sneakyThrow", "(", "exception", ")", ";", "}", "}" ]
Called for formatting a region. @param document the document to format. @param offset the offset of the text to format. @param length the length of the text.
[ "Called", "for", "formatting", "a", "region", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/DocumentAutoFormatter.java#L113-L130
tempodb/tempodb-java
src/main/java/com/tempodb/Client.java
Client.readDataPoints
public Cursor<DataPoint> readDataPoints(Series series, Interval interval) { """ Returns a cursor of datapoints specified by series. <p>The system default timezone is used for the returned DateTimes. @param series The series @param interval An interval of time for the query (start/end datetimes) @return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request. @see Cursor @since 1.0.0 """ return readDataPoints(series, interval, DateTimeZone.getDefault(), null, null); }
java
public Cursor<DataPoint> readDataPoints(Series series, Interval interval) { return readDataPoints(series, interval, DateTimeZone.getDefault(), null, null); }
[ "public", "Cursor", "<", "DataPoint", ">", "readDataPoints", "(", "Series", "series", ",", "Interval", "interval", ")", "{", "return", "readDataPoints", "(", "series", ",", "interval", ",", "DateTimeZone", ".", "getDefault", "(", ")", ",", "null", ",", "null", ")", ";", "}" ]
Returns a cursor of datapoints specified by series. <p>The system default timezone is used for the returned DateTimes. @param series The series @param interval An interval of time for the query (start/end datetimes) @return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request. @see Cursor @since 1.0.0
[ "Returns", "a", "cursor", "of", "datapoints", "specified", "by", "series", ".", "<p", ">", "The", "system", "default", "timezone", "is", "used", "for", "the", "returned", "DateTimes", "." ]
train
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L607-L609
hedyn/wsonrpc
wsonrpc-core/src/main/java/net/apexes/wsonrpc/core/JsonRpcControl.java
JsonRpcControl.invoke
public void invoke(String serviceName, String methodName, Object[] args, String id, Transport transport) throws IOException, WsonrpcException { """ 远程调用方法。 @param serviceName 服务名 @param methodName 方法名 @param args 参数 @param id 请求ID @param transport {@link Transport}实例 @throws IOException @throws WsonrpcException """ if (methodName == null) { throw new NullPointerException("methodName"); } String method; if (serviceName == null) { method = methodName; } else { method = serviceName + "." + methodName; } Node[] params = null; if (args != null) { params = new Node[args.length]; for (int i = 0; i < args.length; i++) { params[i] = jsonImpl.convert(args[i]); } } transmit(transport, new JsonRpcRequest(id, method, params)); }
java
public void invoke(String serviceName, String methodName, Object[] args, String id, Transport transport) throws IOException, WsonrpcException { if (methodName == null) { throw new NullPointerException("methodName"); } String method; if (serviceName == null) { method = methodName; } else { method = serviceName + "." + methodName; } Node[] params = null; if (args != null) { params = new Node[args.length]; for (int i = 0; i < args.length; i++) { params[i] = jsonImpl.convert(args[i]); } } transmit(transport, new JsonRpcRequest(id, method, params)); }
[ "public", "void", "invoke", "(", "String", "serviceName", ",", "String", "methodName", ",", "Object", "[", "]", "args", ",", "String", "id", ",", "Transport", "transport", ")", "throws", "IOException", ",", "WsonrpcException", "{", "if", "(", "methodName", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"methodName\"", ")", ";", "}", "String", "method", ";", "if", "(", "serviceName", "==", "null", ")", "{", "method", "=", "methodName", ";", "}", "else", "{", "method", "=", "serviceName", "+", "\".\"", "+", "methodName", ";", "}", "Node", "[", "]", "params", "=", "null", ";", "if", "(", "args", "!=", "null", ")", "{", "params", "=", "new", "Node", "[", "args", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "params", "[", "i", "]", "=", "jsonImpl", ".", "convert", "(", "args", "[", "i", "]", ")", ";", "}", "}", "transmit", "(", "transport", ",", "new", "JsonRpcRequest", "(", "id", ",", "method", ",", "params", ")", ")", ";", "}" ]
远程调用方法。 @param serviceName 服务名 @param methodName 方法名 @param args 参数 @param id 请求ID @param transport {@link Transport}实例 @throws IOException @throws WsonrpcException
[ "远程调用方法。" ]
train
https://github.com/hedyn/wsonrpc/blob/decbaad4cb8145590bab039d5cfe12437ada0d0a/wsonrpc-core/src/main/java/net/apexes/wsonrpc/core/JsonRpcControl.java#L118-L139
belaban/JGroups
src/org/jgroups/Message.java
Message.readFromSkipPayload
public int readFromSkipPayload(ByteArrayDataInputStream in) throws IOException, ClassNotFoundException { """ Reads the message's contents from an input stream, but skips the buffer and instead returns the position (offset) at which the buffer starts """ // 1. read the leading byte first byte leading=in.readByte(); // 2. the flags flags=in.readShort(); // 3. dest_addr if(Util.isFlagSet(leading, DEST_SET)) dest=Util.readAddress(in); // 4. src_addr if(Util.isFlagSet(leading, SRC_SET)) sender=Util.readAddress(in); // 5. headers int len=in.readShort(); headers=createHeaders(len); for(int i=0; i < len; i++) { short id=in.readShort(); Header hdr=readHeader(in).setProtId(id); this.headers[i]=hdr; } // 6. buf if(!Util.isFlagSet(leading, BUF_SET)) return -1; length=in.readInt(); return in.position(); }
java
public int readFromSkipPayload(ByteArrayDataInputStream in) throws IOException, ClassNotFoundException { // 1. read the leading byte first byte leading=in.readByte(); // 2. the flags flags=in.readShort(); // 3. dest_addr if(Util.isFlagSet(leading, DEST_SET)) dest=Util.readAddress(in); // 4. src_addr if(Util.isFlagSet(leading, SRC_SET)) sender=Util.readAddress(in); // 5. headers int len=in.readShort(); headers=createHeaders(len); for(int i=0; i < len; i++) { short id=in.readShort(); Header hdr=readHeader(in).setProtId(id); this.headers[i]=hdr; } // 6. buf if(!Util.isFlagSet(leading, BUF_SET)) return -1; length=in.readInt(); return in.position(); }
[ "public", "int", "readFromSkipPayload", "(", "ByteArrayDataInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "// 1. read the leading byte first", "byte", "leading", "=", "in", ".", "readByte", "(", ")", ";", "// 2. the flags", "flags", "=", "in", ".", "readShort", "(", ")", ";", "// 3. dest_addr", "if", "(", "Util", ".", "isFlagSet", "(", "leading", ",", "DEST_SET", ")", ")", "dest", "=", "Util", ".", "readAddress", "(", "in", ")", ";", "// 4. src_addr", "if", "(", "Util", ".", "isFlagSet", "(", "leading", ",", "SRC_SET", ")", ")", "sender", "=", "Util", ".", "readAddress", "(", "in", ")", ";", "// 5. headers", "int", "len", "=", "in", ".", "readShort", "(", ")", ";", "headers", "=", "createHeaders", "(", "len", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "short", "id", "=", "in", ".", "readShort", "(", ")", ";", "Header", "hdr", "=", "readHeader", "(", "in", ")", ".", "setProtId", "(", "id", ")", ";", "this", ".", "headers", "[", "i", "]", "=", "hdr", ";", "}", "// 6. buf", "if", "(", "!", "Util", ".", "isFlagSet", "(", "leading", ",", "BUF_SET", ")", ")", "return", "-", "1", ";", "length", "=", "in", ".", "readInt", "(", ")", ";", "return", "in", ".", "position", "(", ")", ";", "}" ]
Reads the message's contents from an input stream, but skips the buffer and instead returns the position (offset) at which the buffer starts
[ "Reads", "the", "message", "s", "contents", "from", "an", "input", "stream", "but", "skips", "the", "buffer", "and", "instead", "returns", "the", "position", "(", "offset", ")", "at", "which", "the", "buffer", "starts" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L726-L757
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/SerializableSaltedHasher.java
SerializableSaltedHasher.hashObjWithSalt
HashCode hashObjWithSalt(T object, int moreSalt) { """ hashes the object with an additional salt. For purpose of the cuckoo filter, this is used when the hash generated for an item is all zeros. All zeros is the same as an empty bucket, so obviously it's not a valid tag. """ Hasher hashInst = hasher.newHasher(); hashInst.putObject(object, funnel); hashInst.putLong(seedNSalt); hashInst.putInt(moreSalt); return hashInst.hash(); }
java
HashCode hashObjWithSalt(T object, int moreSalt) { Hasher hashInst = hasher.newHasher(); hashInst.putObject(object, funnel); hashInst.putLong(seedNSalt); hashInst.putInt(moreSalt); return hashInst.hash(); }
[ "HashCode", "hashObjWithSalt", "(", "T", "object", ",", "int", "moreSalt", ")", "{", "Hasher", "hashInst", "=", "hasher", ".", "newHasher", "(", ")", ";", "hashInst", ".", "putObject", "(", "object", ",", "funnel", ")", ";", "hashInst", ".", "putLong", "(", "seedNSalt", ")", ";", "hashInst", ".", "putInt", "(", "moreSalt", ")", ";", "return", "hashInst", ".", "hash", "(", ")", ";", "}" ]
hashes the object with an additional salt. For purpose of the cuckoo filter, this is used when the hash generated for an item is all zeros. All zeros is the same as an empty bucket, so obviously it's not a valid tag.
[ "hashes", "the", "object", "with", "an", "additional", "salt", ".", "For", "purpose", "of", "the", "cuckoo", "filter", "this", "is", "used", "when", "the", "hash", "generated", "for", "an", "item", "is", "all", "zeros", ".", "All", "zeros", "is", "the", "same", "as", "an", "empty", "bucket", "so", "obviously", "it", "s", "not", "a", "valid", "tag", "." ]
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/SerializableSaltedHasher.java#L121-L127
Kurento/kurento-module-creator
src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java
ExpressionParser.versionOf
private Version versionOf(int major, int minor, int patch) { """ Creates a {@code Version} instance for the specified integers. @param major the major version number @param minor the minor version number @param patch the patch version number @return the version for the specified integers """ return Version.forIntegers(major, minor, patch); }
java
private Version versionOf(int major, int minor, int patch) { return Version.forIntegers(major, minor, patch); }
[ "private", "Version", "versionOf", "(", "int", "major", ",", "int", "minor", ",", "int", "patch", ")", "{", "return", "Version", ".", "forIntegers", "(", "major", ",", "minor", ",", "patch", ")", ";", "}" ]
Creates a {@code Version} instance for the specified integers. @param major the major version number @param minor the minor version number @param patch the patch version number @return the version for the specified integers
[ "Creates", "a", "{", "@code", "Version", "}", "instance", "for", "the", "specified", "integers", "." ]
train
https://github.com/Kurento/kurento-module-creator/blob/c371516c665b902b5476433496a5aefcbca86d64/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L397-L399
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/validation/ValidationUtility.java
ValidationUtility.validateRELS
private static void validateRELS(PID pid, String dsId, InputStream content) throws ValidationException { """ validate relationships datastream @param pid @param dsId @param content @throws ValidationException """ logger.debug("Validating " + dsId + " datastream"); new RelsValidator().validate(pid, dsId, content); logger.debug(dsId + " datastream is valid"); }
java
private static void validateRELS(PID pid, String dsId, InputStream content) throws ValidationException { logger.debug("Validating " + dsId + " datastream"); new RelsValidator().validate(pid, dsId, content); logger.debug(dsId + " datastream is valid"); }
[ "private", "static", "void", "validateRELS", "(", "PID", "pid", ",", "String", "dsId", ",", "InputStream", "content", ")", "throws", "ValidationException", "{", "logger", ".", "debug", "(", "\"Validating \"", "+", "dsId", "+", "\" datastream\"", ")", ";", "new", "RelsValidator", "(", ")", ".", "validate", "(", "pid", ",", "dsId", ",", "content", ")", ";", "logger", ".", "debug", "(", "dsId", "+", "\" datastream is valid\"", ")", ";", "}" ]
validate relationships datastream @param pid @param dsId @param content @throws ValidationException
[ "validate", "relationships", "datastream" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/ValidationUtility.java#L181-L186
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTupleCollections.java
DoubleTupleCollections.standardDeviation
public static MutableDoubleTuple standardDeviation( Collection<? extends DoubleTuple> tuples, MutableDoubleTuple result) { """ Returns the component-wise standard deviation of the given collection of {@link DoubleTuple} objects. The method will compute the arithmetic mean, and then compute the actual result with the {@link #standardDeviationFromMean} method. @param tuples The input tuples @param result The result tuple @return The result, or <code>null</code> if the given collection is empty @throws IllegalArgumentException If the given result is not <code>null</code>, and has a {@link Tuple#getSize() size} that is different from that of the input tuples. """ if (tuples.isEmpty()) { return null; } DoubleTuple mean = arithmeticMean(tuples, null); return standardDeviationFromMean(tuples, mean, result); }
java
public static MutableDoubleTuple standardDeviation( Collection<? extends DoubleTuple> tuples, MutableDoubleTuple result) { if (tuples.isEmpty()) { return null; } DoubleTuple mean = arithmeticMean(tuples, null); return standardDeviationFromMean(tuples, mean, result); }
[ "public", "static", "MutableDoubleTuple", "standardDeviation", "(", "Collection", "<", "?", "extends", "DoubleTuple", ">", "tuples", ",", "MutableDoubleTuple", "result", ")", "{", "if", "(", "tuples", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "DoubleTuple", "mean", "=", "arithmeticMean", "(", "tuples", ",", "null", ")", ";", "return", "standardDeviationFromMean", "(", "tuples", ",", "mean", ",", "result", ")", ";", "}" ]
Returns the component-wise standard deviation of the given collection of {@link DoubleTuple} objects. The method will compute the arithmetic mean, and then compute the actual result with the {@link #standardDeviationFromMean} method. @param tuples The input tuples @param result The result tuple @return The result, or <code>null</code> if the given collection is empty @throws IllegalArgumentException If the given result is not <code>null</code>, and has a {@link Tuple#getSize() size} that is different from that of the input tuples.
[ "Returns", "the", "component", "-", "wise", "standard", "deviation", "of", "the", "given", "collection", "of", "{", "@link", "DoubleTuple", "}", "objects", ".", "The", "method", "will", "compute", "the", "arithmetic", "mean", "and", "then", "compute", "the", "actual", "result", "with", "the", "{", "@link", "#standardDeviationFromMean", "}", "method", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/d/DoubleTupleCollections.java#L578-L588
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/Maps.java
Maps.putIntoValueHashSet
public static <K, V> void putIntoValueHashSet(Map<K, Set<V>> map, K key, V value) { """ Adds the value to the HashSet given by map.get(key), creating a new HashMap if needed. """ CollectionFactory<V> factory = CollectionFactory.hashSetFactory(); putIntoValueCollection(map, key, value, factory); }
java
public static <K, V> void putIntoValueHashSet(Map<K, Set<V>> map, K key, V value) { CollectionFactory<V> factory = CollectionFactory.hashSetFactory(); putIntoValueCollection(map, key, value, factory); }
[ "public", "static", "<", "K", ",", "V", ">", "void", "putIntoValueHashSet", "(", "Map", "<", "K", ",", "Set", "<", "V", ">", ">", "map", ",", "K", "key", ",", "V", "value", ")", "{", "CollectionFactory", "<", "V", ">", "factory", "=", "CollectionFactory", ".", "hashSetFactory", "(", ")", ";", "putIntoValueCollection", "(", "map", ",", "key", ",", "value", ",", "factory", ")", ";", "}" ]
Adds the value to the HashSet given by map.get(key), creating a new HashMap if needed.
[ "Adds", "the", "value", "to", "the", "HashSet", "given", "by", "map", ".", "get", "(", "key", ")", "creating", "a", "new", "HashMap", "if", "needed", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Maps.java#L25-L28
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java
VirtualWANsInner.getByResourceGroupAsync
public Observable<VirtualWANInner> getByResourceGroupAsync(String resourceGroupName, String virtualWANName) { """ Retrieves the details of a VirtualWAN. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWANName The name of the VirtualWAN being retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualWANInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualWANName).map(new Func1<ServiceResponse<VirtualWANInner>, VirtualWANInner>() { @Override public VirtualWANInner call(ServiceResponse<VirtualWANInner> response) { return response.body(); } }); }
java
public Observable<VirtualWANInner> getByResourceGroupAsync(String resourceGroupName, String virtualWANName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualWANName).map(new Func1<ServiceResponse<VirtualWANInner>, VirtualWANInner>() { @Override public VirtualWANInner call(ServiceResponse<VirtualWANInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualWANInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "virtualWANName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualWANName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualWANInner", ">", ",", "VirtualWANInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualWANInner", "call", "(", "ServiceResponse", "<", "VirtualWANInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieves the details of a VirtualWAN. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWANName The name of the VirtualWAN being retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualWANInner object
[ "Retrieves", "the", "details", "of", "a", "VirtualWAN", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java#L151-L158
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectHolder.java
VCProjectHolder.getVCProjectHolder
public static VCProjectHolder getVCProjectHolder( File inputFile, boolean isSolution, Map<String, String> envVariables ) { """ Find or create a container for parsed Visual C++ projects. If a container has already been created for the given {@code inputFile} that container is returned; otherwise a new container is created. @param inputFile the file to parse, it can be a Visual Studio solution (containing Visual C++ projects) or a standalone Visual C++ project @param isSolution {@code true} if {@code inputFile} is a solution, {@code false} if it is a standalone project @param envVariables a map containing environment variable values to substitute while parsing the properties of Visual C++ projects (such as values for {@code SolutionDir}, {@code Platform}, {@code Configuration}, or for any environment variable expressed as {@code $(variable)} in the project properties); note that these values will <em>override</em> the defaults provided by the OS or set by {@link VCProjectHolder#getParsedProjects} @return the container for parsed Visual C++ projects """ VCProjectHolder vcProjectHolder = VCPROJECT_HOLDERS.get( inputFile ); if ( vcProjectHolder == null ) { vcProjectHolder = new VCProjectHolder( inputFile, isSolution, envVariables ); VCPROJECT_HOLDERS.put( inputFile, vcProjectHolder ); } return vcProjectHolder; }
java
public static VCProjectHolder getVCProjectHolder( File inputFile, boolean isSolution, Map<String, String> envVariables ) { VCProjectHolder vcProjectHolder = VCPROJECT_HOLDERS.get( inputFile ); if ( vcProjectHolder == null ) { vcProjectHolder = new VCProjectHolder( inputFile, isSolution, envVariables ); VCPROJECT_HOLDERS.put( inputFile, vcProjectHolder ); } return vcProjectHolder; }
[ "public", "static", "VCProjectHolder", "getVCProjectHolder", "(", "File", "inputFile", ",", "boolean", "isSolution", ",", "Map", "<", "String", ",", "String", ">", "envVariables", ")", "{", "VCProjectHolder", "vcProjectHolder", "=", "VCPROJECT_HOLDERS", ".", "get", "(", "inputFile", ")", ";", "if", "(", "vcProjectHolder", "==", "null", ")", "{", "vcProjectHolder", "=", "new", "VCProjectHolder", "(", "inputFile", ",", "isSolution", ",", "envVariables", ")", ";", "VCPROJECT_HOLDERS", ".", "put", "(", "inputFile", ",", "vcProjectHolder", ")", ";", "}", "return", "vcProjectHolder", ";", "}" ]
Find or create a container for parsed Visual C++ projects. If a container has already been created for the given {@code inputFile} that container is returned; otherwise a new container is created. @param inputFile the file to parse, it can be a Visual Studio solution (containing Visual C++ projects) or a standalone Visual C++ project @param isSolution {@code true} if {@code inputFile} is a solution, {@code false} if it is a standalone project @param envVariables a map containing environment variable values to substitute while parsing the properties of Visual C++ projects (such as values for {@code SolutionDir}, {@code Platform}, {@code Configuration}, or for any environment variable expressed as {@code $(variable)} in the project properties); note that these values will <em>override</em> the defaults provided by the OS or set by {@link VCProjectHolder#getParsedProjects} @return the container for parsed Visual C++ projects
[ "Find", "or", "create", "a", "container", "for", "parsed", "Visual", "C", "++", "projects", ".", "If", "a", "container", "has", "already", "been", "created", "for", "the", "given", "{" ]
train
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectHolder.java#L71-L83
timols/java-gitlab-api
src/main/java/org/gitlab/api/http/Query.java
Query.appendIf
public Query appendIf(final String name, final GitlabAccessLevel value) throws UnsupportedEncodingException { """ Conditionally append a parameter to the query if the value of the parameter is not null @param name Parameter name @param value Parameter value @return this @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded """ if (value != null) { append(name, Integer.toString(value.accessValue)); } return this; }
java
public Query appendIf(final String name, final GitlabAccessLevel value) throws UnsupportedEncodingException { if (value != null) { append(name, Integer.toString(value.accessValue)); } return this; }
[ "public", "Query", "appendIf", "(", "final", "String", "name", ",", "final", "GitlabAccessLevel", "value", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "value", "!=", "null", ")", "{", "append", "(", "name", ",", "Integer", ".", "toString", "(", "value", ".", "accessValue", ")", ")", ";", "}", "return", "this", ";", "}" ]
Conditionally append a parameter to the query if the value of the parameter is not null @param name Parameter name @param value Parameter value @return this @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
[ "Conditionally", "append", "a", "parameter", "to", "the", "query", "if", "the", "value", "of", "the", "parameter", "is", "not", "null" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/http/Query.java#L70-L75
bugsnag/bugsnag-java
bugsnag/src/main/java/com/bugsnag/BugsnagAppender.java
BugsnagAppender.populateContextData
private void populateContextData(Report report, ILoggingEvent event) { """ Adds logging context values to the given report meta data @param report The report being sent to Bugsnag @param event The logging event """ Map<String, String> propertyMap = event.getMDCPropertyMap(); if (propertyMap != null) { // Loop through all the keys and put them in the correct tabs for (Map.Entry<String, String> entry : propertyMap.entrySet()) { report.addToTab("Context", entry.getKey(), entry.getValue()); } } }
java
private void populateContextData(Report report, ILoggingEvent event) { Map<String, String> propertyMap = event.getMDCPropertyMap(); if (propertyMap != null) { // Loop through all the keys and put them in the correct tabs for (Map.Entry<String, String> entry : propertyMap.entrySet()) { report.addToTab("Context", entry.getKey(), entry.getValue()); } } }
[ "private", "void", "populateContextData", "(", "Report", "report", ",", "ILoggingEvent", "event", ")", "{", "Map", "<", "String", ",", "String", ">", "propertyMap", "=", "event", ".", "getMDCPropertyMap", "(", ")", ";", "if", "(", "propertyMap", "!=", "null", ")", "{", "// Loop through all the keys and put them in the correct tabs", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "propertyMap", ".", "entrySet", "(", ")", ")", "{", "report", ".", "addToTab", "(", "\"Context\"", ",", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}" ]
Adds logging context values to the given report meta data @param report The report being sent to Bugsnag @param event The logging event
[ "Adds", "logging", "context", "values", "to", "the", "given", "report", "meta", "data" ]
train
https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/BugsnagAppender.java#L146-L156
OpenHFT/Chronicle-Map
src/main/java/net/openhft/chronicle/hash/impl/util/math/Precision.java
Precision.isEquals
public static boolean isEquals(final double x, final double y, final int maxUlps) { """ Returns true if both arguments are equal or within the range of allowed error (inclusive). <p> Two float numbers are considered equal if there are {@code (maxUlps - 1)} (or fewer) floating point numbers between them, i.e. two adjacent floating point numbers are considered equal. </p> <p> Adapted from <a href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/"> Bruce Dawson</a> </p> @param x first value @param y second value @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}. @return {@code true} if there are fewer than {@code maxUlps} floating point values between {@code x} and {@code y}. """ final long xInt = Double.doubleToRawLongBits(x); final long yInt = Double.doubleToRawLongBits(y); final boolean isEqual; if (((xInt ^ yInt) & SGN_MASK) == 0L) { // number have same sign, there is no risk of overflow isEqual = Math.abs(xInt - yInt) <= maxUlps; } else { // number have opposite signs, take care of overflow final long deltaPlus; final long deltaMinus; if (xInt < yInt) { deltaPlus = yInt - POSITIVE_ZERO_DOUBLE_BITS; deltaMinus = xInt - NEGATIVE_ZERO_DOUBLE_BITS; } else { deltaPlus = xInt - POSITIVE_ZERO_DOUBLE_BITS; deltaMinus = yInt - NEGATIVE_ZERO_DOUBLE_BITS; } if (deltaPlus > maxUlps) { isEqual = false; } else { isEqual = deltaMinus <= (maxUlps - deltaPlus); } } return isEqual && !Double.isNaN(x) && !Double.isNaN(y); }
java
public static boolean isEquals(final double x, final double y, final int maxUlps) { final long xInt = Double.doubleToRawLongBits(x); final long yInt = Double.doubleToRawLongBits(y); final boolean isEqual; if (((xInt ^ yInt) & SGN_MASK) == 0L) { // number have same sign, there is no risk of overflow isEqual = Math.abs(xInt - yInt) <= maxUlps; } else { // number have opposite signs, take care of overflow final long deltaPlus; final long deltaMinus; if (xInt < yInt) { deltaPlus = yInt - POSITIVE_ZERO_DOUBLE_BITS; deltaMinus = xInt - NEGATIVE_ZERO_DOUBLE_BITS; } else { deltaPlus = xInt - POSITIVE_ZERO_DOUBLE_BITS; deltaMinus = yInt - NEGATIVE_ZERO_DOUBLE_BITS; } if (deltaPlus > maxUlps) { isEqual = false; } else { isEqual = deltaMinus <= (maxUlps - deltaPlus); } } return isEqual && !Double.isNaN(x) && !Double.isNaN(y); }
[ "public", "static", "boolean", "isEquals", "(", "final", "double", "x", ",", "final", "double", "y", ",", "final", "int", "maxUlps", ")", "{", "final", "long", "xInt", "=", "Double", ".", "doubleToRawLongBits", "(", "x", ")", ";", "final", "long", "yInt", "=", "Double", ".", "doubleToRawLongBits", "(", "y", ")", ";", "final", "boolean", "isEqual", ";", "if", "(", "(", "(", "xInt", "^", "yInt", ")", "&", "SGN_MASK", ")", "==", "0L", ")", "{", "// number have same sign, there is no risk of overflow", "isEqual", "=", "Math", ".", "abs", "(", "xInt", "-", "yInt", ")", "<=", "maxUlps", ";", "}", "else", "{", "// number have opposite signs, take care of overflow", "final", "long", "deltaPlus", ";", "final", "long", "deltaMinus", ";", "if", "(", "xInt", "<", "yInt", ")", "{", "deltaPlus", "=", "yInt", "-", "POSITIVE_ZERO_DOUBLE_BITS", ";", "deltaMinus", "=", "xInt", "-", "NEGATIVE_ZERO_DOUBLE_BITS", ";", "}", "else", "{", "deltaPlus", "=", "xInt", "-", "POSITIVE_ZERO_DOUBLE_BITS", ";", "deltaMinus", "=", "yInt", "-", "NEGATIVE_ZERO_DOUBLE_BITS", ";", "}", "if", "(", "deltaPlus", ">", "maxUlps", ")", "{", "isEqual", "=", "false", ";", "}", "else", "{", "isEqual", "=", "deltaMinus", "<=", "(", "maxUlps", "-", "deltaPlus", ")", ";", "}", "}", "return", "isEqual", "&&", "!", "Double", ".", "isNaN", "(", "x", ")", "&&", "!", "Double", ".", "isNaN", "(", "y", ")", ";", "}" ]
Returns true if both arguments are equal or within the range of allowed error (inclusive). <p> Two float numbers are considered equal if there are {@code (maxUlps - 1)} (or fewer) floating point numbers between them, i.e. two adjacent floating point numbers are considered equal. </p> <p> Adapted from <a href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/"> Bruce Dawson</a> </p> @param x first value @param y second value @param maxUlps {@code (maxUlps - 1)} is the number of floating point values between {@code x} and {@code y}. @return {@code true} if there are fewer than {@code maxUlps} floating point values between {@code x} and {@code y}.
[ "Returns", "true", "if", "both", "arguments", "are", "equal", "or", "within", "the", "range", "of", "allowed", "error", "(", "inclusive", ")", ".", "<p", ">", "Two", "float", "numbers", "are", "considered", "equal", "if", "there", "are", "{", "@code", "(", "maxUlps", "-", "1", ")", "}", "(", "or", "fewer", ")", "floating", "point", "numbers", "between", "them", "i", ".", "e", ".", "two", "adjacent", "floating", "point", "numbers", "are", "considered", "equal", ".", "<", "/", "p", ">", "<p", ">", "Adapted", "from", "<a", "href", "=", "http", ":", "//", "randomascii", ".", "wordpress", ".", "com", "/", "2012", "/", "02", "/", "25", "/", "comparing", "-", "floating", "-", "point", "-", "numbers", "-", "2012", "-", "edition", "/", ">", "Bruce", "Dawson<", "/", "a", ">", "<", "/", "p", ">" ]
train
https://github.com/OpenHFT/Chronicle-Map/blob/0b09733cc96302f96be4394a261699eeb021fe37/src/main/java/net/openhft/chronicle/hash/impl/util/math/Precision.java#L72-L102
protostuff/protostuff
protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java
JsonIOUtil.parseListFrom
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException { """ Parses the {@code messages} from the stream using the given {@code schema}. <p> The {@link LinkedBuffer}'s internal byte array will be used when reading the message. """ final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), in, false); final JsonParser parser = newJsonParser(in, buffer.buffer, 0, 0, false, context); try { return parseListFrom(parser, schema, numeric); } finally { parser.close(); } }
java
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException { final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), in, false); final JsonParser parser = newJsonParser(in, buffer.buffer, 0, 0, false, context); try { return parseListFrom(parser, schema, numeric); } finally { parser.close(); } }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "parseListFrom", "(", "InputStream", "in", ",", "Schema", "<", "T", ">", "schema", ",", "boolean", "numeric", ",", "LinkedBuffer", "buffer", ")", "throws", "IOException", "{", "final", "IOContext", "context", "=", "new", "IOContext", "(", "DEFAULT_JSON_FACTORY", ".", "_getBufferRecycler", "(", ")", ",", "in", ",", "false", ")", ";", "final", "JsonParser", "parser", "=", "newJsonParser", "(", "in", ",", "buffer", ".", "buffer", ",", "0", ",", "0", ",", "false", ",", "context", ")", ";", "try", "{", "return", "parseListFrom", "(", "parser", ",", "schema", ",", "numeric", ")", ";", "}", "finally", "{", "parser", ".", "close", "(", ")", ";", "}", "}" ]
Parses the {@code messages} from the stream using the given {@code schema}. <p> The {@link LinkedBuffer}'s internal byte array will be used when reading the message.
[ "Parses", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java#L587-L601
Azure/autorest-clientruntime-for-java
azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java
Utils.removeFromList
public static void removeFromList(List<String> list, String value) { """ Removes a value from the list. @param list the list @param value value to remove """ int foundIndex = -1; int i = 0; for (String id : list) { if (id.equalsIgnoreCase(value)) { foundIndex = i; break; } i++; } if (foundIndex != -1) { list.remove(foundIndex); } }
java
public static void removeFromList(List<String> list, String value) { int foundIndex = -1; int i = 0; for (String id : list) { if (id.equalsIgnoreCase(value)) { foundIndex = i; break; } i++; } if (foundIndex != -1) { list.remove(foundIndex); } }
[ "public", "static", "void", "removeFromList", "(", "List", "<", "String", ">", "list", ",", "String", "value", ")", "{", "int", "foundIndex", "=", "-", "1", ";", "int", "i", "=", "0", ";", "for", "(", "String", "id", ":", "list", ")", "{", "if", "(", "id", ".", "equalsIgnoreCase", "(", "value", ")", ")", "{", "foundIndex", "=", "i", ";", "break", ";", "}", "i", "++", ";", "}", "if", "(", "foundIndex", "!=", "-", "1", ")", "{", "list", ".", "remove", "(", "foundIndex", ")", ";", "}", "}" ]
Removes a value from the list. @param list the list @param value value to remove
[ "Removes", "a", "value", "from", "the", "list", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L192-L205
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java
Validator.expectMin
public void expectMin(String name, double minLength) { """ Validates a given field to have a minimum length @param name The field to check @param minLength The minimum length """ expectMin(name, minLength, messages.get(Validation.MIN_KEY.name(), name, minLength)); }
java
public void expectMin(String name, double minLength) { expectMin(name, minLength, messages.get(Validation.MIN_KEY.name(), name, minLength)); }
[ "public", "void", "expectMin", "(", "String", "name", ",", "double", "minLength", ")", "{", "expectMin", "(", "name", ",", "minLength", ",", "messages", ".", "get", "(", "Validation", ".", "MIN_KEY", ".", "name", "(", ")", ",", "name", ",", "minLength", ")", ")", ";", "}" ]
Validates a given field to have a minimum length @param name The field to check @param minLength The minimum length
[ "Validates", "a", "given", "field", "to", "have", "a", "minimum", "length" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L85-L87
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.cleanupOldPaths
private void cleanupOldPaths(String oldSitepath, String newSitepath) { """ Cleans up wrong path references.<p> @param oldSitepath the old sitepath @param newSitepath the new sitepath """ // use a separate list to avoid concurrent changes List<CmsClientSitemapEntry> entries = new ArrayList<CmsClientSitemapEntry>(m_entriesById.values()); for (CmsClientSitemapEntry entry : entries) { if (entry.getSitePath().startsWith(oldSitepath)) { String currentPath = entry.getSitePath(); String updatedSitePath = CmsStringUtil.joinPaths( newSitepath, currentPath.substring(oldSitepath.length())); entry.updateSitePath(updatedSitePath, this); } } }
java
private void cleanupOldPaths(String oldSitepath, String newSitepath) { // use a separate list to avoid concurrent changes List<CmsClientSitemapEntry> entries = new ArrayList<CmsClientSitemapEntry>(m_entriesById.values()); for (CmsClientSitemapEntry entry : entries) { if (entry.getSitePath().startsWith(oldSitepath)) { String currentPath = entry.getSitePath(); String updatedSitePath = CmsStringUtil.joinPaths( newSitepath, currentPath.substring(oldSitepath.length())); entry.updateSitePath(updatedSitePath, this); } } }
[ "private", "void", "cleanupOldPaths", "(", "String", "oldSitepath", ",", "String", "newSitepath", ")", "{", "// use a separate list to avoid concurrent changes", "List", "<", "CmsClientSitemapEntry", ">", "entries", "=", "new", "ArrayList", "<", "CmsClientSitemapEntry", ">", "(", "m_entriesById", ".", "values", "(", ")", ")", ";", "for", "(", "CmsClientSitemapEntry", "entry", ":", "entries", ")", "{", "if", "(", "entry", ".", "getSitePath", "(", ")", ".", "startsWith", "(", "oldSitepath", ")", ")", "{", "String", "currentPath", "=", "entry", ".", "getSitePath", "(", ")", ";", "String", "updatedSitePath", "=", "CmsStringUtil", ".", "joinPaths", "(", "newSitepath", ",", "currentPath", ".", "substring", "(", "oldSitepath", ".", "length", "(", ")", ")", ")", ";", "entry", ".", "updateSitePath", "(", "updatedSitePath", ",", "this", ")", ";", "}", "}", "}" ]
Cleans up wrong path references.<p> @param oldSitepath the old sitepath @param newSitepath the new sitepath
[ "Cleans", "up", "wrong", "path", "references", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L2327-L2340
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPRedirectDeflateEncoder.java
Pac4jHTTPRedirectDeflateEncoder.generateSignature
protected String generateSignature(Credential signingCredential, String algorithmURI, String queryString) throws MessageEncodingException { """ Generates the signature over the query string. @param signingCredential credential that will be used to sign query string @param algorithmURI algorithm URI of the signing credential @param queryString query string to be signed @return base64 encoded signature of query string @throws MessageEncodingException there is an error computing the signature """ log.debug(String.format("Generating signature with key type '%s', algorithm URI '%s' over query string '%s'", CredentialSupport.extractSigningKey(signingCredential).getAlgorithm(), algorithmURI, queryString)); String b64Signature; try { byte[] rawSignature = XMLSigningUtil.signWithURI(signingCredential, algorithmURI, queryString.getBytes(StandardCharsets.UTF_8)); b64Signature = Base64Support.encode(rawSignature, Base64Support.UNCHUNKED); log.debug("Generated digital signature value (base64-encoded) {}", b64Signature); } catch (final org.opensaml.security.SecurityException e) { throw new MessageEncodingException("Unable to sign URL query string", e); } return b64Signature; }
java
protected String generateSignature(Credential signingCredential, String algorithmURI, String queryString) throws MessageEncodingException { log.debug(String.format("Generating signature with key type '%s', algorithm URI '%s' over query string '%s'", CredentialSupport.extractSigningKey(signingCredential).getAlgorithm(), algorithmURI, queryString)); String b64Signature; try { byte[] rawSignature = XMLSigningUtil.signWithURI(signingCredential, algorithmURI, queryString.getBytes(StandardCharsets.UTF_8)); b64Signature = Base64Support.encode(rawSignature, Base64Support.UNCHUNKED); log.debug("Generated digital signature value (base64-encoded) {}", b64Signature); } catch (final org.opensaml.security.SecurityException e) { throw new MessageEncodingException("Unable to sign URL query string", e); } return b64Signature; }
[ "protected", "String", "generateSignature", "(", "Credential", "signingCredential", ",", "String", "algorithmURI", ",", "String", "queryString", ")", "throws", "MessageEncodingException", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"Generating signature with key type '%s', algorithm URI '%s' over query string '%s'\"", ",", "CredentialSupport", ".", "extractSigningKey", "(", "signingCredential", ")", ".", "getAlgorithm", "(", ")", ",", "algorithmURI", ",", "queryString", ")", ")", ";", "String", "b64Signature", ";", "try", "{", "byte", "[", "]", "rawSignature", "=", "XMLSigningUtil", ".", "signWithURI", "(", "signingCredential", ",", "algorithmURI", ",", "queryString", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ")", ";", "b64Signature", "=", "Base64Support", ".", "encode", "(", "rawSignature", ",", "Base64Support", ".", "UNCHUNKED", ")", ";", "log", ".", "debug", "(", "\"Generated digital signature value (base64-encoded) {}\"", ",", "b64Signature", ")", ";", "}", "catch", "(", "final", "org", ".", "opensaml", ".", "security", ".", "SecurityException", "e", ")", "{", "throw", "new", "MessageEncodingException", "(", "\"Unable to sign URL query string\"", ",", "e", ")", ";", "}", "return", "b64Signature", ";", "}" ]
Generates the signature over the query string. @param signingCredential credential that will be used to sign query string @param algorithmURI algorithm URI of the signing credential @param queryString query string to be signed @return base64 encoded signature of query string @throws MessageEncodingException there is an error computing the signature
[ "Generates", "the", "signature", "over", "the", "query", "string", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPRedirectDeflateEncoder.java#L247-L264
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java
AbstractCollQuery.innerJoin
public <P> Q innerJoin(Path<? extends Collection<P>> target, Path<P> alias) { """ Define an inner join from the Collection typed path to the alias @param <P> type of expression @param target target of the join @param alias alias for the join target @return current object """ getMetadata().addJoin(JoinType.INNERJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
java
public <P> Q innerJoin(Path<? extends Collection<P>> target, Path<P> alias) { getMetadata().addJoin(JoinType.INNERJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
[ "public", "<", "P", ">", "Q", "innerJoin", "(", "Path", "<", "?", "extends", "Collection", "<", "P", ">", ">", "target", ",", "Path", "<", "P", ">", "alias", ")", "{", "getMetadata", "(", ")", ".", "addJoin", "(", "JoinType", ".", "INNERJOIN", ",", "createAlias", "(", "target", ",", "alias", ")", ")", ";", "return", "queryMixin", ".", "getSelf", "(", ")", ";", "}" ]
Define an inner join from the Collection typed path to the alias @param <P> type of expression @param target target of the join @param alias alias for the join target @return current object
[ "Define", "an", "inner", "join", "from", "the", "Collection", "typed", "path", "to", "the", "alias" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java#L127-L130
Erudika/para
para-core/src/main/java/com/erudika/para/rest/GenericExceptionMapper.java
GenericExceptionMapper.getExceptionResponse
public static Response getExceptionResponse(final int status, final String msg) { """ Returns an exception/error response as a JSON object. @param status HTTP status code @param msg message @return a JSON object """ return Response.status(status).entity(new LinkedHashMap<String, Object>() { private static final long serialVersionUID = 1L; { put("code", status); put("message", msg); } }).type(MediaType.APPLICATION_JSON).build(); }
java
public static Response getExceptionResponse(final int status, final String msg) { return Response.status(status).entity(new LinkedHashMap<String, Object>() { private static final long serialVersionUID = 1L; { put("code", status); put("message", msg); } }).type(MediaType.APPLICATION_JSON).build(); }
[ "public", "static", "Response", "getExceptionResponse", "(", "final", "int", "status", ",", "final", "String", "msg", ")", "{", "return", "Response", ".", "status", "(", "status", ")", ".", "entity", "(", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", ")", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "{", "put", "(", "\"code\"", ",", "status", ")", ";", "put", "(", "\"message\"", ",", "msg", ")", ";", "}", "}", ")", ".", "type", "(", "MediaType", ".", "APPLICATION_JSON", ")", ".", "build", "(", ")", ";", "}" ]
Returns an exception/error response as a JSON object. @param status HTTP status code @param msg message @return a JSON object
[ "Returns", "an", "exception", "/", "error", "response", "as", "a", "JSON", "object", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/rest/GenericExceptionMapper.java#L68-L76
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.throwUnrecognizedInputIfAny
private void throwUnrecognizedInputIfAny( StringBuilder builder, int ch ) { """ Throw an unrecognized input exception if there content in the StringBuilder. @param builder the StringBuilder @param ch the last character """ if( !isWhitespace( builder ) ) { throw createException( "Unrecognized input: '" + trim( builder ) + (char)ch + "'" ); } builder.setLength( 0 ); }
java
private void throwUnrecognizedInputIfAny( StringBuilder builder, int ch ) { if( !isWhitespace( builder ) ) { throw createException( "Unrecognized input: '" + trim( builder ) + (char)ch + "'" ); } builder.setLength( 0 ); }
[ "private", "void", "throwUnrecognizedInputIfAny", "(", "StringBuilder", "builder", ",", "int", "ch", ")", "{", "if", "(", "!", "isWhitespace", "(", "builder", ")", ")", "{", "throw", "createException", "(", "\"Unrecognized input: '\"", "+", "trim", "(", "builder", ")", "+", "(", "char", ")", "ch", "+", "\"'\"", ")", ";", "}", "builder", ".", "setLength", "(", "0", ")", ";", "}" ]
Throw an unrecognized input exception if there content in the StringBuilder. @param builder the StringBuilder @param ch the last character
[ "Throw", "an", "unrecognized", "input", "exception", "if", "there", "content", "in", "the", "StringBuilder", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1391-L1396
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java
CommonOps_DSCC.sumCols
public static DMatrixRMaj sumCols(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) { """ <p> Computes the sum of each column in the input matrix and returns the results in a vector:<br> <br> b<sub>j</sub> = sum(i=1:m ; a<sub>ij</sub>) </p> @param input Input matrix @param output Optional storage for output. Reshaped into a row vector. Modified. @return Vector containing the sum of each column """ if( output == null ) { output = new DMatrixRMaj(1,input.numCols); } else { output.reshape(1,input.numCols); } for (int col = 0; col < input.numCols; col++) { int idx0 = input.col_idx[col]; int idx1 = input.col_idx[col + 1]; double sum = 0; for (int i = idx0; i < idx1; i++) { sum += input.nz_values[i]; } output.data[col] = sum; } return output; }
java
public static DMatrixRMaj sumCols(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) { if( output == null ) { output = new DMatrixRMaj(1,input.numCols); } else { output.reshape(1,input.numCols); } for (int col = 0; col < input.numCols; col++) { int idx0 = input.col_idx[col]; int idx1 = input.col_idx[col + 1]; double sum = 0; for (int i = idx0; i < idx1; i++) { sum += input.nz_values[i]; } output.data[col] = sum; } return output; }
[ "public", "static", "DMatrixRMaj", "sumCols", "(", "DMatrixSparseCSC", "input", ",", "@", "Nullable", "DMatrixRMaj", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "new", "DMatrixRMaj", "(", "1", ",", "input", ".", "numCols", ")", ";", "}", "else", "{", "output", ".", "reshape", "(", "1", ",", "input", ".", "numCols", ")", ";", "}", "for", "(", "int", "col", "=", "0", ";", "col", "<", "input", ".", "numCols", ";", "col", "++", ")", "{", "int", "idx0", "=", "input", ".", "col_idx", "[", "col", "]", ";", "int", "idx1", "=", "input", ".", "col_idx", "[", "col", "+", "1", "]", ";", "double", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "idx0", ";", "i", "<", "idx1", ";", "i", "++", ")", "{", "sum", "+=", "input", ".", "nz_values", "[", "i", "]", ";", "}", "output", ".", "data", "[", "col", "]", "=", "sum", ";", "}", "return", "output", ";", "}" ]
<p> Computes the sum of each column in the input matrix and returns the results in a vector:<br> <br> b<sub>j</sub> = sum(i=1:m ; a<sub>ij</sub>) </p> @param input Input matrix @param output Optional storage for output. Reshaped into a row vector. Modified. @return Vector containing the sum of each column
[ "<p", ">", "Computes", "the", "sum", "of", "each", "column", "in", "the", "input", "matrix", "and", "returns", "the", "results", "in", "a", "vector", ":", "<br", ">", "<br", ">", "b<sub", ">", "j<", "/", "sub", ">", "=", "sum", "(", "i", "=", "1", ":", "m", ";", "a<sub", ">", "ij<", "/", "sub", ">", ")", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L1288-L1308
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.isConsiderateMethod
boolean isConsiderateMethod(Collection<String> methodProceeds, ExecutableElement methodElement) { """ Return if the method have to considerate<br> The method is public,<br> Not annotated by TransientDataService<br> Not static and not from Object herited. @param methodProceeds @param methodElement @return """ // int argNum methodElement.getParameters().size(); String signature = methodElement.getSimpleName().toString(); // + "(" + argNum + ")"; // Check if method ith same signature has been already proceed. if (methodProceeds.contains(signature)) { return false; } // Herited from Object TypeElement objectElement = environment.getElementUtils().getTypeElement(Object.class.getName()); if (objectElement.getEnclosedElements().contains(methodElement)) { return false; } // Static, not public ? if (!methodElement.getModifiers().contains(Modifier.PUBLIC) || methodElement.getModifiers().contains(Modifier.STATIC)) { return false; } // TransientDataService ? List<? extends AnnotationMirror> annotationMirrors = methodElement.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().toString().equals(TransientDataService.class.getName())) { return false; } } methodProceeds.add(signature); return true; }
java
boolean isConsiderateMethod(Collection<String> methodProceeds, ExecutableElement methodElement) { // int argNum methodElement.getParameters().size(); String signature = methodElement.getSimpleName().toString(); // + "(" + argNum + ")"; // Check if method ith same signature has been already proceed. if (methodProceeds.contains(signature)) { return false; } // Herited from Object TypeElement objectElement = environment.getElementUtils().getTypeElement(Object.class.getName()); if (objectElement.getEnclosedElements().contains(methodElement)) { return false; } // Static, not public ? if (!methodElement.getModifiers().contains(Modifier.PUBLIC) || methodElement.getModifiers().contains(Modifier.STATIC)) { return false; } // TransientDataService ? List<? extends AnnotationMirror> annotationMirrors = methodElement.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().toString().equals(TransientDataService.class.getName())) { return false; } } methodProceeds.add(signature); return true; }
[ "boolean", "isConsiderateMethod", "(", "Collection", "<", "String", ">", "methodProceeds", ",", "ExecutableElement", "methodElement", ")", "{", "//\t\tint argNum methodElement.getParameters().size();\r", "String", "signature", "=", "methodElement", ".", "getSimpleName", "(", ")", ".", "toString", "(", ")", ";", "// + \"(\" + argNum + \")\";\r", "// Check if method ith same signature has been already proceed.\r", "if", "(", "methodProceeds", ".", "contains", "(", "signature", ")", ")", "{", "return", "false", ";", "}", "// Herited from Object\r", "TypeElement", "objectElement", "=", "environment", ".", "getElementUtils", "(", ")", ".", "getTypeElement", "(", "Object", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "objectElement", ".", "getEnclosedElements", "(", ")", ".", "contains", "(", "methodElement", ")", ")", "{", "return", "false", ";", "}", "// Static, not public ?\r", "if", "(", "!", "methodElement", ".", "getModifiers", "(", ")", ".", "contains", "(", "Modifier", ".", "PUBLIC", ")", "||", "methodElement", ".", "getModifiers", "(", ")", ".", "contains", "(", "Modifier", ".", "STATIC", ")", ")", "{", "return", "false", ";", "}", "// TransientDataService ?\r", "List", "<", "?", "extends", "AnnotationMirror", ">", "annotationMirrors", "=", "methodElement", ".", "getAnnotationMirrors", "(", ")", ";", "for", "(", "AnnotationMirror", "annotationMirror", ":", "annotationMirrors", ")", "{", "if", "(", "annotationMirror", ".", "getAnnotationType", "(", ")", ".", "toString", "(", ")", ".", "equals", "(", "TransientDataService", ".", "class", ".", "getName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "methodProceeds", ".", "add", "(", "signature", ")", ";", "return", "true", ";", "}" ]
Return if the method have to considerate<br> The method is public,<br> Not annotated by TransientDataService<br> Not static and not from Object herited. @param methodProceeds @param methodElement @return
[ "Return", "if", "the", "method", "have", "to", "considerate<br", ">", "The", "method", "is", "public", "<br", ">", "Not", "annotated", "by", "TransientDataService<br", ">", "Not", "static", "and", "not", "from", "Object", "herited", "." ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L169-L194
cdapio/tigon
tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java
DatumWriterGenerator.getEncodeMethod
private Method getEncodeMethod(TypeToken<?> outputType, Schema schema) { """ Returns the encode method for the given type and schema. The same method will be returned if the same type and schema has been passed to the method before. @param outputType Type information of the data type for output @param schema Schema to use for output. @return A method for encoding the given output type and schema. """ String key = String.format("%s%s", normalizeTypeName(outputType), schema.getSchemaHash()); Method method = encodeMethods.get(key); if (method != null) { return method; } // Generate the encode method (value, encoder, schema, set) TypeToken<?> callOutputType = getCallTypeToken(outputType, schema); String methodName = String.format("encode%s", key); method = getMethod(void.class, methodName, callOutputType.getRawType(), Encoder.class, Schema.class, Set.class); // Put the method into map first before generating the body in order to support recursive data type. encodeMethods.put(key, method); String methodSignature = Signatures.getMethodSignature(method, new TypeToken[]{ callOutputType, null, null, new TypeToken<Set<Object>>() { }}); GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PRIVATE, method, methodSignature, new Type[]{Type.getType(IOException.class)}, classWriter); generateEncodeBody(mg, schema, outputType, 0, 1, 2, 3); mg.returnValue(); mg.endMethod(); return method; }
java
private Method getEncodeMethod(TypeToken<?> outputType, Schema schema) { String key = String.format("%s%s", normalizeTypeName(outputType), schema.getSchemaHash()); Method method = encodeMethods.get(key); if (method != null) { return method; } // Generate the encode method (value, encoder, schema, set) TypeToken<?> callOutputType = getCallTypeToken(outputType, schema); String methodName = String.format("encode%s", key); method = getMethod(void.class, methodName, callOutputType.getRawType(), Encoder.class, Schema.class, Set.class); // Put the method into map first before generating the body in order to support recursive data type. encodeMethods.put(key, method); String methodSignature = Signatures.getMethodSignature(method, new TypeToken[]{ callOutputType, null, null, new TypeToken<Set<Object>>() { }}); GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PRIVATE, method, methodSignature, new Type[]{Type.getType(IOException.class)}, classWriter); generateEncodeBody(mg, schema, outputType, 0, 1, 2, 3); mg.returnValue(); mg.endMethod(); return method; }
[ "private", "Method", "getEncodeMethod", "(", "TypeToken", "<", "?", ">", "outputType", ",", "Schema", "schema", ")", "{", "String", "key", "=", "String", ".", "format", "(", "\"%s%s\"", ",", "normalizeTypeName", "(", "outputType", ")", ",", "schema", ".", "getSchemaHash", "(", ")", ")", ";", "Method", "method", "=", "encodeMethods", ".", "get", "(", "key", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "return", "method", ";", "}", "// Generate the encode method (value, encoder, schema, set)", "TypeToken", "<", "?", ">", "callOutputType", "=", "getCallTypeToken", "(", "outputType", ",", "schema", ")", ";", "String", "methodName", "=", "String", ".", "format", "(", "\"encode%s\"", ",", "key", ")", ";", "method", "=", "getMethod", "(", "void", ".", "class", ",", "methodName", ",", "callOutputType", ".", "getRawType", "(", ")", ",", "Encoder", ".", "class", ",", "Schema", ".", "class", ",", "Set", ".", "class", ")", ";", "// Put the method into map first before generating the body in order to support recursive data type.", "encodeMethods", ".", "put", "(", "key", ",", "method", ")", ";", "String", "methodSignature", "=", "Signatures", ".", "getMethodSignature", "(", "method", ",", "new", "TypeToken", "[", "]", "{", "callOutputType", ",", "null", ",", "null", ",", "new", "TypeToken", "<", "Set", "<", "Object", ">", ">", "(", ")", "{", "}", "}", ")", ";", "GeneratorAdapter", "mg", "=", "new", "GeneratorAdapter", "(", "Opcodes", ".", "ACC_PRIVATE", ",", "method", ",", "methodSignature", ",", "new", "Type", "[", "]", "{", "Type", ".", "getType", "(", "IOException", ".", "class", ")", "}", ",", "classWriter", ")", ";", "generateEncodeBody", "(", "mg", ",", "schema", ",", "outputType", ",", "0", ",", "1", ",", "2", ",", "3", ")", ";", "mg", ".", "returnValue", "(", ")", ";", "mg", ".", "endMethod", "(", ")", ";", "return", "method", ";", "}" ]
Returns the encode method for the given type and schema. The same method will be returned if the same type and schema has been passed to the method before. @param outputType Type information of the data type for output @param schema Schema to use for output. @return A method for encoding the given output type and schema.
[ "Returns", "the", "encode", "method", "for", "the", "given", "type", "and", "schema", ".", "The", "same", "method", "will", "be", "returned", "if", "the", "same", "type", "and", "schema", "has", "been", "passed", "to", "the", "method", "before", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java#L285-L312
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java
LocaleData.getExemplarSet
public static UnicodeSet getExemplarSet(ULocale locale, int options) { """ Returns the set of exemplar characters for a locale. Equivalent to calling {@link #getExemplarSet(ULocale, int, int)} with the extype == {@link #ES_STANDARD}. @param locale Locale for which the exemplar character set is to be retrieved. @param options Bitmask for options to apply to the exemplar pattern. Specify zero to retrieve the exemplar set as it is defined in the locale data. Specify UnicodeSet.CASE to retrieve a case-folded exemplar set. See {@link UnicodeSet#applyPattern(String, int)} for a complete list of valid options. The IGNORE_SPACE bit is always set, regardless of the value of 'options'. @return The set of exemplar characters for the given locale. """ return LocaleData.getInstance(locale).getExemplarSet(options, ES_STANDARD); }
java
public static UnicodeSet getExemplarSet(ULocale locale, int options) { return LocaleData.getInstance(locale).getExemplarSet(options, ES_STANDARD); }
[ "public", "static", "UnicodeSet", "getExemplarSet", "(", "ULocale", "locale", ",", "int", "options", ")", "{", "return", "LocaleData", ".", "getInstance", "(", "locale", ")", ".", "getExemplarSet", "(", "options", ",", "ES_STANDARD", ")", ";", "}" ]
Returns the set of exemplar characters for a locale. Equivalent to calling {@link #getExemplarSet(ULocale, int, int)} with the extype == {@link #ES_STANDARD}. @param locale Locale for which the exemplar character set is to be retrieved. @param options Bitmask for options to apply to the exemplar pattern. Specify zero to retrieve the exemplar set as it is defined in the locale data. Specify UnicodeSet.CASE to retrieve a case-folded exemplar set. See {@link UnicodeSet#applyPattern(String, int)} for a complete list of valid options. The IGNORE_SPACE bit is always set, regardless of the value of 'options'. @return The set of exemplar characters for the given locale.
[ "Returns", "the", "set", "of", "exemplar", "characters", "for", "a", "locale", ".", "Equivalent", "to", "calling", "{", "@link", "#getExemplarSet", "(", "ULocale", "int", "int", ")", "}", "with", "the", "extype", "==", "{", "@link", "#ES_STANDARD", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L134-L136
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java
CmsGalleriesTab.addChildren
protected void addChildren(CmsTreeItem parent, List<CmsGalleryTreeEntry> children, List<String> selectedGalleries) { """ Adds children to the gallery tree and select the galleries.<p> @param parent the parent item @param children the list of children @param selectedGalleries the list of galleries to select """ if (children != null) { for (CmsGalleryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = createTreeItem(child, selectedGalleries, true); if ((selectedGalleries != null) && selectedGalleries.contains(child.getPath())) { parent.setOpen(true); openParents(parent); } parent.addChild(treeItem); addChildren(treeItem, child.getChildren(), selectedGalleries); } } }
java
protected void addChildren(CmsTreeItem parent, List<CmsGalleryTreeEntry> children, List<String> selectedGalleries) { if (children != null) { for (CmsGalleryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = createTreeItem(child, selectedGalleries, true); if ((selectedGalleries != null) && selectedGalleries.contains(child.getPath())) { parent.setOpen(true); openParents(parent); } parent.addChild(treeItem); addChildren(treeItem, child.getChildren(), selectedGalleries); } } }
[ "protected", "void", "addChildren", "(", "CmsTreeItem", "parent", ",", "List", "<", "CmsGalleryTreeEntry", ">", "children", ",", "List", "<", "String", ">", "selectedGalleries", ")", "{", "if", "(", "children", "!=", "null", ")", "{", "for", "(", "CmsGalleryTreeEntry", "child", ":", "children", ")", "{", "// set the category tree item and add to parent tree item", "CmsTreeItem", "treeItem", "=", "createTreeItem", "(", "child", ",", "selectedGalleries", ",", "true", ")", ";", "if", "(", "(", "selectedGalleries", "!=", "null", ")", "&&", "selectedGalleries", ".", "contains", "(", "child", ".", "getPath", "(", ")", ")", ")", "{", "parent", ".", "setOpen", "(", "true", ")", ";", "openParents", "(", "parent", ")", ";", "}", "parent", ".", "addChild", "(", "treeItem", ")", ";", "addChildren", "(", "treeItem", ",", "child", ".", "getChildren", "(", ")", ",", "selectedGalleries", ")", ";", "}", "}", "}" ]
Adds children to the gallery tree and select the galleries.<p> @param parent the parent item @param children the list of children @param selectedGalleries the list of galleries to select
[ "Adds", "children", "to", "the", "gallery", "tree", "and", "select", "the", "galleries", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleriesTab.java#L448-L462
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/StringUtil.java
StringUtil.lastIndexOf
public static int lastIndexOf(String input, char ch, int offset) { """ Like a String.lastIndexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling @param input to check the indexOf on @param ch character to find the index of @param offset offset to start the reading from the end @return index of the character, or -1 if not found """ for (int i = input.length() - 1 - offset; i >= 0; i--) { if (input.charAt(i) == ch) { return i; } } return -1; }
java
public static int lastIndexOf(String input, char ch, int offset) { for (int i = input.length() - 1 - offset; i >= 0; i--) { if (input.charAt(i) == ch) { return i; } } return -1; }
[ "public", "static", "int", "lastIndexOf", "(", "String", "input", ",", "char", "ch", ",", "int", "offset", ")", "{", "for", "(", "int", "i", "=", "input", ".", "length", "(", ")", "-", "1", "-", "offset", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "input", ".", "charAt", "(", "i", ")", "==", "ch", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Like a String.lastIndexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling @param input to check the indexOf on @param ch character to find the index of @param offset offset to start the reading from the end @return index of the character, or -1 if not found
[ "Like", "a", "String", ".", "lastIndexOf", "but", "without", "MIN_SUPPLEMENTARY_CODE_POINT", "handling" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L238-L245
opentok/Opentok-Java-SDK
src/main/java/com/opentok/Broadcast.java
Broadcast.unpack
@JsonProperty("broadcastUrls") private void unpack(Map<String,Object> broadcastUrls) { """ Details on the HLS and RTMP broadcast streams. For an HLS stream, the URL is provided. See the <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/">OpenTok live streaming broadcast developer guide</a> for more information on how to use this URL. For each RTMP stream, the RTMP server URL and stream name are provided, along with the RTMP stream's status. """ if (broadcastUrls == null) return; hls = (String)broadcastUrls.get("hls"); ArrayList<Map<String,String>> rtmpResponse = (ArrayList<Map<String,String>>)broadcastUrls.get("rtmp"); if (rtmpResponse == null || rtmpResponse.size() == 0) return; for ( Map<String,String> element : rtmpResponse) { Rtmp rtmp = new Rtmp(); rtmp.setId(element.get("id")); rtmp.setServerUrl(element.get("serverUrl")); rtmp.setStreamName(element.get("streamName")); this.rtmpList.add(rtmp); } }
java
@JsonProperty("broadcastUrls") private void unpack(Map<String,Object> broadcastUrls) { if (broadcastUrls == null) return; hls = (String)broadcastUrls.get("hls"); ArrayList<Map<String,String>> rtmpResponse = (ArrayList<Map<String,String>>)broadcastUrls.get("rtmp"); if (rtmpResponse == null || rtmpResponse.size() == 0) return; for ( Map<String,String> element : rtmpResponse) { Rtmp rtmp = new Rtmp(); rtmp.setId(element.get("id")); rtmp.setServerUrl(element.get("serverUrl")); rtmp.setStreamName(element.get("streamName")); this.rtmpList.add(rtmp); } }
[ "@", "JsonProperty", "(", "\"broadcastUrls\"", ")", "private", "void", "unpack", "(", "Map", "<", "String", ",", "Object", ">", "broadcastUrls", ")", "{", "if", "(", "broadcastUrls", "==", "null", ")", "return", ";", "hls", "=", "(", "String", ")", "broadcastUrls", ".", "get", "(", "\"hls\"", ")", ";", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", "rtmpResponse", "=", "(", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", ")", "broadcastUrls", ".", "get", "(", "\"rtmp\"", ")", ";", "if", "(", "rtmpResponse", "==", "null", "||", "rtmpResponse", ".", "size", "(", ")", "==", "0", ")", "return", ";", "for", "(", "Map", "<", "String", ",", "String", ">", "element", ":", "rtmpResponse", ")", "{", "Rtmp", "rtmp", "=", "new", "Rtmp", "(", ")", ";", "rtmp", ".", "setId", "(", "element", ".", "get", "(", "\"id\"", ")", ")", ";", "rtmp", ".", "setServerUrl", "(", "element", ".", "get", "(", "\"serverUrl\"", ")", ")", ";", "rtmp", ".", "setStreamName", "(", "element", ".", "get", "(", "\"streamName\"", ")", ")", ";", "this", ".", "rtmpList", ".", "add", "(", "rtmp", ")", ";", "}", "}" ]
Details on the HLS and RTMP broadcast streams. For an HLS stream, the URL is provided. See the <a href="https://tokbox.com/developer/guides/broadcast/live-streaming/">OpenTok live streaming broadcast developer guide</a> for more information on how to use this URL. For each RTMP stream, the RTMP server URL and stream name are provided, along with the RTMP stream's status.
[ "Details", "on", "the", "HLS", "and", "RTMP", "broadcast", "streams", ".", "For", "an", "HLS", "stream", "the", "URL", "is", "provided", ".", "See", "the", "<a", "href", "=", "https", ":", "//", "tokbox", ".", "com", "/", "developer", "/", "guides", "/", "broadcast", "/", "live", "-", "streaming", "/", ">", "OpenTok", "live", "streaming", "broadcast", "developer", "guide<", "/", "a", ">", "for", "more", "information", "on", "how", "to", "use", "this", "URL", ".", "For", "each", "RTMP", "stream", "the", "RTMP", "server", "URL", "and", "stream", "name", "are", "provided", "along", "with", "the", "RTMP", "stream", "s", "status", "." ]
train
https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/Broadcast.java#L105-L118
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.partialHeapSort
public static void partialHeapSort(Quicksortable q, int k, int size) { """ finds the lowest k elements of q and stores them in sorted order at the beginning of q by turning q into a heap. @param q The quicksortable to heapsort. @param k The number of elements to sort at the beginning of the quicksortable. @param size The size of the quicksortable. """ makeHeap(q, size); for (int i = 0; i < k; i++) { q.swap(0, size-i-1); heapifyDown(q, 0, size-i-1); } vecswap(q, 0, size-k, k); reverse(q, k); }
java
public static void partialHeapSort(Quicksortable q, int k, int size) { makeHeap(q, size); for (int i = 0; i < k; i++) { q.swap(0, size-i-1); heapifyDown(q, 0, size-i-1); } vecswap(q, 0, size-k, k); reverse(q, k); }
[ "public", "static", "void", "partialHeapSort", "(", "Quicksortable", "q", ",", "int", "k", ",", "int", "size", ")", "{", "makeHeap", "(", "q", ",", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "k", ";", "i", "++", ")", "{", "q", ".", "swap", "(", "0", ",", "size", "-", "i", "-", "1", ")", ";", "heapifyDown", "(", "q", ",", "0", ",", "size", "-", "i", "-", "1", ")", ";", "}", "vecswap", "(", "q", ",", "0", ",", "size", "-", "k", ",", "k", ")", ";", "reverse", "(", "q", ",", "k", ")", ";", "}" ]
finds the lowest k elements of q and stores them in sorted order at the beginning of q by turning q into a heap. @param q The quicksortable to heapsort. @param k The number of elements to sort at the beginning of the quicksortable. @param size The size of the quicksortable.
[ "finds", "the", "lowest", "k", "elements", "of", "q", "and", "stores", "them", "in", "sorted", "order", "at", "the", "beginning", "of", "q", "by", "turning", "q", "into", "a", "heap", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L290-L298
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java
JobScheduleOperations.listJobSchedules
public PagedList<CloudJobSchedule> listJobSchedules(DetailLevel detailLevel) throws BatchErrorException, IOException { """ Lists the {@link CloudJobSchedule job schedules} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link CloudJobSchedule} objects. @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. """ return listJobSchedules(detailLevel, null); }
java
public PagedList<CloudJobSchedule> listJobSchedules(DetailLevel detailLevel) throws BatchErrorException, IOException { return listJobSchedules(detailLevel, null); }
[ "public", "PagedList", "<", "CloudJobSchedule", ">", "listJobSchedules", "(", "DetailLevel", "detailLevel", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listJobSchedules", "(", "detailLevel", ",", "null", ")", ";", "}" ]
Lists the {@link CloudJobSchedule job schedules} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link CloudJobSchedule} objects. @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.
[ "Lists", "the", "{", "@link", "CloudJobSchedule", "job", "schedules", "}", "in", "the", "Batch", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L432-L434
playn/playn
core/src/playn/core/Surface.java
Surface.drawLine
public Surface drawLine (float x0, float y0, float x1, float y1, float width) { """ Fills a line between the specified coordinates, of the specified display unit width. """ // swap the line end points if x1 is less than x0 if (x1 < x0) { float temp = x0; x0 = x1; x1 = temp; temp = y0; y0 = y1; y1 = temp; } float dx = x1 - x0, dy = y1 - y0; float length = FloatMath.sqrt(dx * dx + dy * dy); float wx = dx * (width / 2) / length; float wy = dy * (width / 2) / length; AffineTransform xf = new AffineTransform(); xf.setRotation(FloatMath.atan2(dy, dx)); xf.setTranslation(x0 + wy, y0 - wx); Transforms.multiply(tx(), xf, xf); if (patternTex != null) { batch.addQuad(patternTex, tint, xf, 0, 0, length, width); } else { batch.addQuad(colorTex, Tint.combine(fillColor, tint), xf, 0, 0, length, width); } return this; }
java
public Surface drawLine (float x0, float y0, float x1, float y1, float width) { // swap the line end points if x1 is less than x0 if (x1 < x0) { float temp = x0; x0 = x1; x1 = temp; temp = y0; y0 = y1; y1 = temp; } float dx = x1 - x0, dy = y1 - y0; float length = FloatMath.sqrt(dx * dx + dy * dy); float wx = dx * (width / 2) / length; float wy = dy * (width / 2) / length; AffineTransform xf = new AffineTransform(); xf.setRotation(FloatMath.atan2(dy, dx)); xf.setTranslation(x0 + wy, y0 - wx); Transforms.multiply(tx(), xf, xf); if (patternTex != null) { batch.addQuad(patternTex, tint, xf, 0, 0, length, width); } else { batch.addQuad(colorTex, Tint.combine(fillColor, tint), xf, 0, 0, length, width); } return this; }
[ "public", "Surface", "drawLine", "(", "float", "x0", ",", "float", "y0", ",", "float", "x1", ",", "float", "y1", ",", "float", "width", ")", "{", "// swap the line end points if x1 is less than x0", "if", "(", "x1", "<", "x0", ")", "{", "float", "temp", "=", "x0", ";", "x0", "=", "x1", ";", "x1", "=", "temp", ";", "temp", "=", "y0", ";", "y0", "=", "y1", ";", "y1", "=", "temp", ";", "}", "float", "dx", "=", "x1", "-", "x0", ",", "dy", "=", "y1", "-", "y0", ";", "float", "length", "=", "FloatMath", ".", "sqrt", "(", "dx", "*", "dx", "+", "dy", "*", "dy", ")", ";", "float", "wx", "=", "dx", "*", "(", "width", "/", "2", ")", "/", "length", ";", "float", "wy", "=", "dy", "*", "(", "width", "/", "2", ")", "/", "length", ";", "AffineTransform", "xf", "=", "new", "AffineTransform", "(", ")", ";", "xf", ".", "setRotation", "(", "FloatMath", ".", "atan2", "(", "dy", ",", "dx", ")", ")", ";", "xf", ".", "setTranslation", "(", "x0", "+", "wy", ",", "y0", "-", "wx", ")", ";", "Transforms", ".", "multiply", "(", "tx", "(", ")", ",", "xf", ",", "xf", ")", ";", "if", "(", "patternTex", "!=", "null", ")", "{", "batch", ".", "addQuad", "(", "patternTex", ",", "tint", ",", "xf", ",", "0", ",", "0", ",", "length", ",", "width", ")", ";", "}", "else", "{", "batch", ".", "addQuad", "(", "colorTex", ",", "Tint", ".", "combine", "(", "fillColor", ",", "tint", ")", ",", "xf", ",", "0", ",", "0", ",", "length", ",", "width", ")", ";", "}", "return", "this", ";", "}" ]
Fills a line between the specified coordinates, of the specified display unit width.
[ "Fills", "a", "line", "between", "the", "specified", "coordinates", "of", "the", "specified", "display", "unit", "width", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Surface.java#L353-L380
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml10
public static void escapeXml10(final Reader reader, final Writer writer) throws IOException { """ <p> Perform an XML 1.0 level 2 (markup-significant and all non-ASCII chars) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt></li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by replacing those chars by the corresponding XML Character Entity References (e.g. <tt>'&amp;lt;'</tt>) when such CER exists for the replaced character, and replacing by a hexadecimal character reference (e.g. <tt>'&amp;#x2430;'</tt>) when there there is no CER for the replaced character. </p> <p> This method calls {@link #escapeXml10(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li> <li><tt>level</tt>: {@link org.unbescape.xml.XmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ escapeXml(reader, writer, XmlEscapeSymbols.XML10_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT); }
java
public static void escapeXml10(final Reader reader, final Writer writer) throws IOException { escapeXml(reader, writer, XmlEscapeSymbols.XML10_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeXml10", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeXml", "(", "reader", ",", "writer", ",", "XmlEscapeSymbols", ".", "XML10_SYMBOLS", ",", "XmlEscapeType", ".", "CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA", ",", "XmlEscapeLevel", ".", "LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT", ")", ";", "}" ]
<p> Perform an XML 1.0 level 2 (markup-significant and all non-ASCII chars) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt></li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by replacing those chars by the corresponding XML Character Entity References (e.g. <tt>'&amp;lt;'</tt>) when such CER exists for the replaced character, and replacing by a hexadecimal character reference (e.g. <tt>'&amp;#x2430;'</tt>) when there there is no CER for the replaced character. </p> <p> This method calls {@link #escapeXml10(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li> <li><tt>level</tt>: {@link org.unbescape.xml.XmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "an", "XML", "1", ".", "0", "level", "2", "(", "markup", "-", "significant", "and", "all", "non", "-", "ASCII", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "2<", "/", "em", ">", "means", "this", "method", "will", "escape", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "The", "five", "markup", "-", "significant", "characters", ":", "<tt", ">", "&lt", ";", "<", "/", "tt", ">", "<tt", ">", "&gt", ";", "<", "/", "tt", ">", "<tt", ">", "&amp", ";", "<", "/", "tt", ">", "<tt", ">", "&quot", ";", "<", "/", "tt", ">", "and", "<tt", ">", "&#39", ";", "<", "/", "tt", ">", "<", "/", "li", ">", "<li", ">", "All", "non", "ASCII", "characters", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "escape", "will", "be", "performed", "by", "replacing", "those", "chars", "by", "the", "corresponding", "XML", "Character", "Entity", "References", "(", "e", ".", "g", ".", "<tt", ">", "&amp", ";", "lt", ";", "<", "/", "tt", ">", ")", "when", "such", "CER", "exists", "for", "the", "replaced", "character", "and", "replacing", "by", "a", "hexadecimal", "character", "reference", "(", "e", ".", "g", ".", "<tt", ">", "&amp", ";", "#x2430", ";", "<", "/", "tt", ">", ")", "when", "there", "there", "is", "no", "CER", "for", "the", "replaced", "character", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapeXml10", "(", "Reader", "Writer", "XmlEscapeType", "XmlEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "type<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "xml", ".", "XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA", "}", "<", "/", "li", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "xml", ".", "XmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1403-L1408
Erudika/para
para-server/src/main/java/com/erudika/para/rest/RestUtils.java
RestUtils.getOverwriteResponse
public static Response getOverwriteResponse(App app, String id, String type, InputStream is) { """ Overwrite response as JSON. @param id the object id @param type type of the object to create @param is entity input stream @param app the app object @return a status code 200 or 400 """ try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(), RestUtils.class, "crud", "overwrite")) { ParaObject content; Response entityRes = getEntity(is, Map.class); if (entityRes.getStatusInfo() == Response.Status.OK) { Map<String, Object> newContent = (Map<String, Object>) entityRes.getEntity(); if (!StringUtils.isBlank(type)) { newContent.put(Config._TYPE, type); } content = ParaObjectUtils.setAnnotatedFields(newContent); if (app != null && content != null && !StringUtils.isBlank(id) && isNotAnApp(type)) { warnIfUserTypeDetected(type); content.setType(type); content.setAppid(app.getAppIdentifier()); content.setId(id); setCreatorid(app, content); int typesCount = app.getDatatypes().size(); app.addDatatypes(content); // The reason why we do two validation passes is because we want to return // the errors through the API and notify the end user. // This is the primary validation pass (validates not only core POJOS but also user defined objects). String[] errors = validateObject(app, content); if (errors.length == 0 && checkIfUserCanModifyObject(app, content)) { // Secondary validation pass called here. Object is validated again before being created // See: IndexAndCacheAspect.java CoreUtils.getInstance().overwrite(app.getAppIdentifier(), content); // new type added so update app object if (typesCount < app.getDatatypes().size()) { app.update(); } return Response.ok(content).build(); } return getStatusResponse(Response.Status.BAD_REQUEST, errors); } return getStatusResponse(Response.Status.BAD_REQUEST, "Failed to overwrite object."); } return entityRes; } }
java
public static Response getOverwriteResponse(App app, String id, String type, InputStream is) { try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(), RestUtils.class, "crud", "overwrite")) { ParaObject content; Response entityRes = getEntity(is, Map.class); if (entityRes.getStatusInfo() == Response.Status.OK) { Map<String, Object> newContent = (Map<String, Object>) entityRes.getEntity(); if (!StringUtils.isBlank(type)) { newContent.put(Config._TYPE, type); } content = ParaObjectUtils.setAnnotatedFields(newContent); if (app != null && content != null && !StringUtils.isBlank(id) && isNotAnApp(type)) { warnIfUserTypeDetected(type); content.setType(type); content.setAppid(app.getAppIdentifier()); content.setId(id); setCreatorid(app, content); int typesCount = app.getDatatypes().size(); app.addDatatypes(content); // The reason why we do two validation passes is because we want to return // the errors through the API and notify the end user. // This is the primary validation pass (validates not only core POJOS but also user defined objects). String[] errors = validateObject(app, content); if (errors.length == 0 && checkIfUserCanModifyObject(app, content)) { // Secondary validation pass called here. Object is validated again before being created // See: IndexAndCacheAspect.java CoreUtils.getInstance().overwrite(app.getAppIdentifier(), content); // new type added so update app object if (typesCount < app.getDatatypes().size()) { app.update(); } return Response.ok(content).build(); } return getStatusResponse(Response.Status.BAD_REQUEST, errors); } return getStatusResponse(Response.Status.BAD_REQUEST, "Failed to overwrite object."); } return entityRes; } }
[ "public", "static", "Response", "getOverwriteResponse", "(", "App", "app", ",", "String", "id", ",", "String", "type", ",", "InputStream", "is", ")", "{", "try", "(", "final", "Metrics", ".", "Context", "context", "=", "Metrics", ".", "time", "(", "app", "==", "null", "?", "null", ":", "app", ".", "getAppid", "(", ")", ",", "RestUtils", ".", "class", ",", "\"crud\"", ",", "\"overwrite\"", ")", ")", "{", "ParaObject", "content", ";", "Response", "entityRes", "=", "getEntity", "(", "is", ",", "Map", ".", "class", ")", ";", "if", "(", "entityRes", ".", "getStatusInfo", "(", ")", "==", "Response", ".", "Status", ".", "OK", ")", "{", "Map", "<", "String", ",", "Object", ">", "newContent", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "entityRes", ".", "getEntity", "(", ")", ";", "if", "(", "!", "StringUtils", ".", "isBlank", "(", "type", ")", ")", "{", "newContent", ".", "put", "(", "Config", ".", "_TYPE", ",", "type", ")", ";", "}", "content", "=", "ParaObjectUtils", ".", "setAnnotatedFields", "(", "newContent", ")", ";", "if", "(", "app", "!=", "null", "&&", "content", "!=", "null", "&&", "!", "StringUtils", ".", "isBlank", "(", "id", ")", "&&", "isNotAnApp", "(", "type", ")", ")", "{", "warnIfUserTypeDetected", "(", "type", ")", ";", "content", ".", "setType", "(", "type", ")", ";", "content", ".", "setAppid", "(", "app", ".", "getAppIdentifier", "(", ")", ")", ";", "content", ".", "setId", "(", "id", ")", ";", "setCreatorid", "(", "app", ",", "content", ")", ";", "int", "typesCount", "=", "app", ".", "getDatatypes", "(", ")", ".", "size", "(", ")", ";", "app", ".", "addDatatypes", "(", "content", ")", ";", "// The reason why we do two validation passes is because we want to return", "// the errors through the API and notify the end user.", "// This is the primary validation pass (validates not only core POJOS but also user defined objects).", "String", "[", "]", "errors", "=", "validateObject", "(", "app", ",", "content", ")", ";", "if", "(", "errors", ".", "length", "==", "0", "&&", "checkIfUserCanModifyObject", "(", "app", ",", "content", ")", ")", "{", "// Secondary validation pass called here. Object is validated again before being created", "// See: IndexAndCacheAspect.java", "CoreUtils", ".", "getInstance", "(", ")", ".", "overwrite", "(", "app", ".", "getAppIdentifier", "(", ")", ",", "content", ")", ";", "// new type added so update app object", "if", "(", "typesCount", "<", "app", ".", "getDatatypes", "(", ")", ".", "size", "(", ")", ")", "{", "app", ".", "update", "(", ")", ";", "}", "return", "Response", ".", "ok", "(", "content", ")", ".", "build", "(", ")", ";", "}", "return", "getStatusResponse", "(", "Response", ".", "Status", ".", "BAD_REQUEST", ",", "errors", ")", ";", "}", "return", "getStatusResponse", "(", "Response", ".", "Status", ".", "BAD_REQUEST", ",", "\"Failed to overwrite object.\"", ")", ";", "}", "return", "entityRes", ";", "}", "}" ]
Overwrite response as JSON. @param id the object id @param type type of the object to create @param is entity input stream @param app the app object @return a status code 200 or 400
[ "Overwrite", "response", "as", "JSON", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L366-L405
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java
XPathContext.getDTMXRTreeFrag
public DTMXRTreeFrag getDTMXRTreeFrag(int dtmIdentity) { """ Gets DTMXRTreeFrag object if one has already been created. Creates new DTMXRTreeFrag object and adds to m_DTMXRTreeFrags HashMap, otherwise. @param dtmIdentity @return DTMXRTreeFrag """ if(m_DTMXRTreeFrags == null){ m_DTMXRTreeFrags = new HashMap(); } if(m_DTMXRTreeFrags.containsKey(new Integer(dtmIdentity))){ return (DTMXRTreeFrag)m_DTMXRTreeFrags.get(new Integer(dtmIdentity)); }else{ final DTMXRTreeFrag frag = new DTMXRTreeFrag(dtmIdentity,this); m_DTMXRTreeFrags.put(new Integer(dtmIdentity),frag); return frag ; } }
java
public DTMXRTreeFrag getDTMXRTreeFrag(int dtmIdentity){ if(m_DTMXRTreeFrags == null){ m_DTMXRTreeFrags = new HashMap(); } if(m_DTMXRTreeFrags.containsKey(new Integer(dtmIdentity))){ return (DTMXRTreeFrag)m_DTMXRTreeFrags.get(new Integer(dtmIdentity)); }else{ final DTMXRTreeFrag frag = new DTMXRTreeFrag(dtmIdentity,this); m_DTMXRTreeFrags.put(new Integer(dtmIdentity),frag); return frag ; } }
[ "public", "DTMXRTreeFrag", "getDTMXRTreeFrag", "(", "int", "dtmIdentity", ")", "{", "if", "(", "m_DTMXRTreeFrags", "==", "null", ")", "{", "m_DTMXRTreeFrags", "=", "new", "HashMap", "(", ")", ";", "}", "if", "(", "m_DTMXRTreeFrags", ".", "containsKey", "(", "new", "Integer", "(", "dtmIdentity", ")", ")", ")", "{", "return", "(", "DTMXRTreeFrag", ")", "m_DTMXRTreeFrags", ".", "get", "(", "new", "Integer", "(", "dtmIdentity", ")", ")", ";", "}", "else", "{", "final", "DTMXRTreeFrag", "frag", "=", "new", "DTMXRTreeFrag", "(", "dtmIdentity", ",", "this", ")", ";", "m_DTMXRTreeFrags", ".", "put", "(", "new", "Integer", "(", "dtmIdentity", ")", ",", "frag", ")", ";", "return", "frag", ";", "}", "}" ]
Gets DTMXRTreeFrag object if one has already been created. Creates new DTMXRTreeFrag object and adds to m_DTMXRTreeFrags HashMap, otherwise. @param dtmIdentity @return DTMXRTreeFrag
[ "Gets", "DTMXRTreeFrag", "object", "if", "one", "has", "already", "been", "created", ".", "Creates", "new", "DTMXRTreeFrag", "object", "and", "adds", "to", "m_DTMXRTreeFrags", "HashMap", "otherwise", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L1322-L1334
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.applyPattern
@Deprecated public UnicodeSet applyPattern(String pattern, ParsePosition pos, SymbolTable symbols, int options) { """ Parses the given pattern, starting at the given position. The character at pattern.charAt(pos.getIndex()) must be '[', or the parse fails. Parsing continues until the corresponding closing ']'. If a syntax error is encountered between the opening and closing brace, the parse fails. Upon return from a successful parse, the ParsePosition is updated to point to the character following the closing ']', and an inversion list for the parsed pattern is returned. This method calls itself recursively to parse embedded subpatterns. @param pattern the string containing the pattern to be parsed. The portion of the string from pos.getIndex(), which must be a '[', to the corresponding closing ']', is parsed. @param pos upon entry, the position at which to being parsing. The character at pattern.charAt(pos.getIndex()) must be a '['. Upon return from a successful parse, pos.getIndex() is either the character after the closing ']' of the parsed pattern, or pattern.length() if the closing ']' is the last character of the pattern string. @return an inversion list for the parsed substring of <code>pattern</code> @exception java.lang.IllegalArgumentException if the parse fails. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android """ // Need to build the pattern in a temporary string because // _applyPattern calls add() etc., which set pat to empty. boolean parsePositionWasNull = pos == null; if (parsePositionWasNull) { pos = new ParsePosition(0); } StringBuilder rebuiltPat = new StringBuilder(); RuleCharacterIterator chars = new RuleCharacterIterator(pattern, symbols, pos); applyPattern(chars, symbols, rebuiltPat, options); if (chars.inVariable()) { syntaxError(chars, "Extra chars in variable value"); } pat = rebuiltPat.toString(); if (parsePositionWasNull) { int i = pos.getIndex(); // Skip over trailing whitespace if ((options & IGNORE_SPACE) != 0) { i = PatternProps.skipWhiteSpace(pattern, i); } if (i != pattern.length()) { throw new IllegalArgumentException("Parse of \"" + pattern + "\" failed at " + i); } } return this; }
java
@Deprecated public UnicodeSet applyPattern(String pattern, ParsePosition pos, SymbolTable symbols, int options) { // Need to build the pattern in a temporary string because // _applyPattern calls add() etc., which set pat to empty. boolean parsePositionWasNull = pos == null; if (parsePositionWasNull) { pos = new ParsePosition(0); } StringBuilder rebuiltPat = new StringBuilder(); RuleCharacterIterator chars = new RuleCharacterIterator(pattern, symbols, pos); applyPattern(chars, symbols, rebuiltPat, options); if (chars.inVariable()) { syntaxError(chars, "Extra chars in variable value"); } pat = rebuiltPat.toString(); if (parsePositionWasNull) { int i = pos.getIndex(); // Skip over trailing whitespace if ((options & IGNORE_SPACE) != 0) { i = PatternProps.skipWhiteSpace(pattern, i); } if (i != pattern.length()) { throw new IllegalArgumentException("Parse of \"" + pattern + "\" failed at " + i); } } return this; }
[ "@", "Deprecated", "public", "UnicodeSet", "applyPattern", "(", "String", "pattern", ",", "ParsePosition", "pos", ",", "SymbolTable", "symbols", ",", "int", "options", ")", "{", "// Need to build the pattern in a temporary string because", "// _applyPattern calls add() etc., which set pat to empty.", "boolean", "parsePositionWasNull", "=", "pos", "==", "null", ";", "if", "(", "parsePositionWasNull", ")", "{", "pos", "=", "new", "ParsePosition", "(", "0", ")", ";", "}", "StringBuilder", "rebuiltPat", "=", "new", "StringBuilder", "(", ")", ";", "RuleCharacterIterator", "chars", "=", "new", "RuleCharacterIterator", "(", "pattern", ",", "symbols", ",", "pos", ")", ";", "applyPattern", "(", "chars", ",", "symbols", ",", "rebuiltPat", ",", "options", ")", ";", "if", "(", "chars", ".", "inVariable", "(", ")", ")", "{", "syntaxError", "(", "chars", ",", "\"Extra chars in variable value\"", ")", ";", "}", "pat", "=", "rebuiltPat", ".", "toString", "(", ")", ";", "if", "(", "parsePositionWasNull", ")", "{", "int", "i", "=", "pos", ".", "getIndex", "(", ")", ";", "// Skip over trailing whitespace", "if", "(", "(", "options", "&", "IGNORE_SPACE", ")", "!=", "0", ")", "{", "i", "=", "PatternProps", ".", "skipWhiteSpace", "(", "pattern", ",", "i", ")", ";", "}", "if", "(", "i", "!=", "pattern", ".", "length", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parse of \\\"\"", "+", "pattern", "+", "\"\\\" failed at \"", "+", "i", ")", ";", "}", "}", "return", "this", ";", "}" ]
Parses the given pattern, starting at the given position. The character at pattern.charAt(pos.getIndex()) must be '[', or the parse fails. Parsing continues until the corresponding closing ']'. If a syntax error is encountered between the opening and closing brace, the parse fails. Upon return from a successful parse, the ParsePosition is updated to point to the character following the closing ']', and an inversion list for the parsed pattern is returned. This method calls itself recursively to parse embedded subpatterns. @param pattern the string containing the pattern to be parsed. The portion of the string from pos.getIndex(), which must be a '[', to the corresponding closing ']', is parsed. @param pos upon entry, the position at which to being parsing. The character at pattern.charAt(pos.getIndex()) must be a '['. Upon return from a successful parse, pos.getIndex() is either the character after the closing ']' of the parsed pattern, or pattern.length() if the closing ']' is the last character of the pattern string. @return an inversion list for the parsed substring of <code>pattern</code> @exception java.lang.IllegalArgumentException if the parse fails. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Parses", "the", "given", "pattern", "starting", "at", "the", "given", "position", ".", "The", "character", "at", "pattern", ".", "charAt", "(", "pos", ".", "getIndex", "()", ")", "must", "be", "[", "or", "the", "parse", "fails", ".", "Parsing", "continues", "until", "the", "corresponding", "closing", "]", ".", "If", "a", "syntax", "error", "is", "encountered", "between", "the", "opening", "and", "closing", "brace", "the", "parse", "fails", ".", "Upon", "return", "from", "a", "successful", "parse", "the", "ParsePosition", "is", "updated", "to", "point", "to", "the", "character", "following", "the", "closing", "]", "and", "an", "inversion", "list", "for", "the", "parsed", "pattern", "is", "returned", ".", "This", "method", "calls", "itself", "recursively", "to", "parse", "embedded", "subpatterns", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L2339-L2374
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariable.java
RandomVariableUniqueVariable.constructRandomVariableUniqueVariable
private void constructRandomVariableUniqueVariable(RandomVariable randomVariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, OperatorType parentOperatorType) { """ Function calls {@link RandomVariableUniqueVariableFactory} to use the given {@link RandomVariableFromDoubleArray} and save it to its internal ArrayList. The index of the object will be give to the new {@link RandomVariableUniqueVariable} object. @param randomVariable @param isConstant """ /* * by calling the method in the factory it will produce a new object of RandomVariable and * the new item will be stored in its factory internal array list */ RandomVariable normalrandomvariable = factory.createRandomVariable(randomVariable, isConstant, parentVariables, parentOperatorType); /* by construction this object can be up-casted to RandomVariableUniqueVariable */ RandomVariableUniqueVariable newrandomvariableuniquevariable = (RandomVariableUniqueVariable)normalrandomvariable; /* now we have access to the internal variables of the new RandomVarialeUniqueVariable */ variableID = newrandomvariableuniquevariable.getVariableID(); this.isConstant = newrandomvariableuniquevariable.isConstant(); parentsVariables = newrandomvariableuniquevariable.getParentVariables(); this.parentOperatorType = newrandomvariableuniquevariable.getParentOperatorType(); }
java
private void constructRandomVariableUniqueVariable(RandomVariable randomVariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, OperatorType parentOperatorType){ /* * by calling the method in the factory it will produce a new object of RandomVariable and * the new item will be stored in its factory internal array list */ RandomVariable normalrandomvariable = factory.createRandomVariable(randomVariable, isConstant, parentVariables, parentOperatorType); /* by construction this object can be up-casted to RandomVariableUniqueVariable */ RandomVariableUniqueVariable newrandomvariableuniquevariable = (RandomVariableUniqueVariable)normalrandomvariable; /* now we have access to the internal variables of the new RandomVarialeUniqueVariable */ variableID = newrandomvariableuniquevariable.getVariableID(); this.isConstant = newrandomvariableuniquevariable.isConstant(); parentsVariables = newrandomvariableuniquevariable.getParentVariables(); this.parentOperatorType = newrandomvariableuniquevariable.getParentOperatorType(); }
[ "private", "void", "constructRandomVariableUniqueVariable", "(", "RandomVariable", "randomVariable", ",", "boolean", "isConstant", ",", "ArrayList", "<", "RandomVariableUniqueVariable", ">", "parentVariables", ",", "OperatorType", "parentOperatorType", ")", "{", "/*\r\n\t\t * by calling the method in the factory it will produce a new object of RandomVariable and\r\n\t\t * the new item will be stored in its factory internal array list\r\n\t\t */", "RandomVariable", "normalrandomvariable", "=", "factory", ".", "createRandomVariable", "(", "randomVariable", ",", "isConstant", ",", "parentVariables", ",", "parentOperatorType", ")", ";", "/* by construction this object can be up-casted to RandomVariableUniqueVariable */", "RandomVariableUniqueVariable", "newrandomvariableuniquevariable", "=", "(", "RandomVariableUniqueVariable", ")", "normalrandomvariable", ";", "/* now we have access to the internal variables of the new RandomVarialeUniqueVariable */", "variableID", "=", "newrandomvariableuniquevariable", ".", "getVariableID", "(", ")", ";", "this", ".", "isConstant", "=", "newrandomvariableuniquevariable", ".", "isConstant", "(", ")", ";", "parentsVariables", "=", "newrandomvariableuniquevariable", ".", "getParentVariables", "(", ")", ";", "this", ".", "parentOperatorType", "=", "newrandomvariableuniquevariable", ".", "getParentOperatorType", "(", ")", ";", "}" ]
Function calls {@link RandomVariableUniqueVariableFactory} to use the given {@link RandomVariableFromDoubleArray} and save it to its internal ArrayList. The index of the object will be give to the new {@link RandomVariableUniqueVariable} object. @param randomVariable @param isConstant
[ "Function", "calls", "{", "@link", "RandomVariableUniqueVariableFactory", "}", "to", "use", "the", "given", "{", "@link", "RandomVariableFromDoubleArray", "}", "and", "save", "it", "to", "its", "internal", "ArrayList", ".", "The", "index", "of", "the", "object", "will", "be", "give", "to", "the", "new", "{", "@link", "RandomVariableUniqueVariable", "}", "object", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariable.java#L85-L100
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java
RegistriesInner.listCredentials
public RegistryListCredentialsResultInner listCredentials(String resourceGroupName, String registryName) { """ Lists the login credentials for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RegistryListCredentialsResultInner object if successful. """ return listCredentialsWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); }
java
public RegistryListCredentialsResultInner listCredentials(String resourceGroupName, String registryName) { return listCredentialsWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); }
[ "public", "RegistryListCredentialsResultInner", "listCredentials", "(", "String", "resourceGroupName", ",", "String", "registryName", ")", "{", "return", "listCredentialsWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Lists the login credentials for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RegistryListCredentialsResultInner object if successful.
[ "Lists", "the", "login", "credentials", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java#L875-L877
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java
SyncGroupsInner.refreshHubSchema
public void refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { """ Refreshes a hub database schema. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().last().body(); }
java
public void refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().last().body(); }
[ "public", "void", "refreshHubSchema", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "syncGroupName", ")", "{", "refreshHubSchemaWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "syncGroupName", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Refreshes a hub database schema. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Refreshes", "a", "hub", "database", "schema", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java#L270-L272
aboutsip/pkts
pkts-core/src/main/java/io/pkts/packet/impl/IPv4PacketImpl.java
IPv4PacketImpl.setIP
private void setIP(final int startIndex, final String address) { """ Very naive initial implementation. Should be changed to do a better job and its performance probably can go up a lot as well. @param startIndex @param address """ final String[] parts = address.split("\\."); this.headers.setByte(startIndex + 0, (byte) Integer.parseInt(parts[0])); this.headers.setByte(startIndex + 1, (byte) Integer.parseInt(parts[1])); this.headers.setByte(startIndex + 2, (byte) Integer.parseInt(parts[2])); this.headers.setByte(startIndex + 3, (byte) Integer.parseInt(parts[3])); reCalculateChecksum(); }
java
private void setIP(final int startIndex, final String address) { final String[] parts = address.split("\\."); this.headers.setByte(startIndex + 0, (byte) Integer.parseInt(parts[0])); this.headers.setByte(startIndex + 1, (byte) Integer.parseInt(parts[1])); this.headers.setByte(startIndex + 2, (byte) Integer.parseInt(parts[2])); this.headers.setByte(startIndex + 3, (byte) Integer.parseInt(parts[3])); reCalculateChecksum(); }
[ "private", "void", "setIP", "(", "final", "int", "startIndex", ",", "final", "String", "address", ")", "{", "final", "String", "[", "]", "parts", "=", "address", ".", "split", "(", "\"\\\\.\"", ")", ";", "this", ".", "headers", ".", "setByte", "(", "startIndex", "+", "0", ",", "(", "byte", ")", "Integer", ".", "parseInt", "(", "parts", "[", "0", "]", ")", ")", ";", "this", ".", "headers", ".", "setByte", "(", "startIndex", "+", "1", ",", "(", "byte", ")", "Integer", ".", "parseInt", "(", "parts", "[", "1", "]", ")", ")", ";", "this", ".", "headers", ".", "setByte", "(", "startIndex", "+", "2", ",", "(", "byte", ")", "Integer", ".", "parseInt", "(", "parts", "[", "2", "]", ")", ")", ";", "this", ".", "headers", ".", "setByte", "(", "startIndex", "+", "3", ",", "(", "byte", ")", "Integer", ".", "parseInt", "(", "parts", "[", "3", "]", ")", ")", ";", "reCalculateChecksum", "(", ")", ";", "}" ]
Very naive initial implementation. Should be changed to do a better job and its performance probably can go up a lot as well. @param startIndex @param address
[ "Very", "naive", "initial", "implementation", ".", "Should", "be", "changed", "to", "do", "a", "better", "job", "and", "its", "performance", "probably", "can", "go", "up", "a", "lot", "as", "well", "." ]
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-core/src/main/java/io/pkts/packet/impl/IPv4PacketImpl.java#L220-L227
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.getState
public TransitionableState getState(final Flow flow, final String stateId) { """ Gets state. @param flow the flow @param stateId the state id @return the state """ return getState(flow, stateId, TransitionableState.class); }
java
public TransitionableState getState(final Flow flow, final String stateId) { return getState(flow, stateId, TransitionableState.class); }
[ "public", "TransitionableState", "getState", "(", "final", "Flow", "flow", ",", "final", "String", "stateId", ")", "{", "return", "getState", "(", "flow", ",", "stateId", ",", "TransitionableState", ".", "class", ")", ";", "}" ]
Gets state. @param flow the flow @param stateId the state id @return the state
[ "Gets", "state", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L741-L743
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/support/SwidUtils.java
SwidUtils.generateSwidFileName
public static String generateSwidFileName(final String regId, final String productName, final String uniqueSoftwareId) { """ <p> Generate SWID tag file name. </p> <p> Example: <code>&lt;regid&gt;_&lt;product_name&gt;‐&lt;unique_software_identifier&gt;.swidtag</code> </p> @param regId the regid value @param productName the product name @param uniqueSoftwareId the unique software identifier @return SWID tag file name """ return generateSwidFileName(regId, productName, uniqueSoftwareId, null); }
java
public static String generateSwidFileName(final String regId, final String productName, final String uniqueSoftwareId) { return generateSwidFileName(regId, productName, uniqueSoftwareId, null); }
[ "public", "static", "String", "generateSwidFileName", "(", "final", "String", "regId", ",", "final", "String", "productName", ",", "final", "String", "uniqueSoftwareId", ")", "{", "return", "generateSwidFileName", "(", "regId", ",", "productName", ",", "uniqueSoftwareId", ",", "null", ")", ";", "}" ]
<p> Generate SWID tag file name. </p> <p> Example: <code>&lt;regid&gt;_&lt;product_name&gt;‐&lt;unique_software_identifier&gt;.swidtag</code> </p> @param regId the regid value @param productName the product name @param uniqueSoftwareId the unique software identifier @return SWID tag file name
[ "<p", ">", "Generate", "SWID", "tag", "file", "name", ".", "<", "/", "p", ">", "<p", ">", "Example", ":", "<code", ">", "&lt", ";", "regid&gt", ";", "_&lt", ";", "product_name&gt", ";", "‐&lt", ";", "unique_software_identifier&gt", ";", ".", "swidtag<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/SwidUtils.java#L113-L116
jbundle/jbundle
base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java
NameValue.getNameValueNode
public NameValue getNameValueNode(String strName, Object objValue, boolean bAddIfNotFound) { """ Get my child value node (that matches this value). @param objValue The value to find/match. @param bAddIfNotFound Add this value if it was not found. @return Return this child value node. """ Map<String,NameValue> map = this.getValueMap(bAddIfNotFound); if (map == null) return null; NameValue value = (NameValue)map.get(this.getKey(strName, objValue)); if (value == null) if (bAddIfNotFound) this.addNameValueNode(value = new NameValue(strName, objValue)); return value; }
java
public NameValue getNameValueNode(String strName, Object objValue, boolean bAddIfNotFound) { Map<String,NameValue> map = this.getValueMap(bAddIfNotFound); if (map == null) return null; NameValue value = (NameValue)map.get(this.getKey(strName, objValue)); if (value == null) if (bAddIfNotFound) this.addNameValueNode(value = new NameValue(strName, objValue)); return value; }
[ "public", "NameValue", "getNameValueNode", "(", "String", "strName", ",", "Object", "objValue", ",", "boolean", "bAddIfNotFound", ")", "{", "Map", "<", "String", ",", "NameValue", ">", "map", "=", "this", ".", "getValueMap", "(", "bAddIfNotFound", ")", ";", "if", "(", "map", "==", "null", ")", "return", "null", ";", "NameValue", "value", "=", "(", "NameValue", ")", "map", ".", "get", "(", "this", ".", "getKey", "(", "strName", ",", "objValue", ")", ")", ";", "if", "(", "value", "==", "null", ")", "if", "(", "bAddIfNotFound", ")", "this", ".", "addNameValueNode", "(", "value", "=", "new", "NameValue", "(", "strName", ",", "objValue", ")", ")", ";", "return", "value", ";", "}" ]
Get my child value node (that matches this value). @param objValue The value to find/match. @param bAddIfNotFound Add this value if it was not found. @return Return this child value node.
[ "Get", "my", "child", "value", "node", "(", "that", "matches", "this", "value", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L186-L196
line/armeria
core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java
TypeSignature.ofContainer
public static TypeSignature ofContainer(String containerTypeName, Iterable<TypeSignature> elementTypeSignatures) { """ Creates a new container type with the specified container type name and the type signatures of the elements it contains. @throws IllegalArgumentException if the specified type name is not valid or {@code elementTypeSignatures} is empty. """ checkBaseTypeName(containerTypeName, "containerTypeName"); requireNonNull(elementTypeSignatures, "elementTypeSignatures"); final List<TypeSignature> elementTypeSignaturesCopy = ImmutableList.copyOf(elementTypeSignatures); checkArgument(!elementTypeSignaturesCopy.isEmpty(), "elementTypeSignatures is empty."); return new TypeSignature(containerTypeName, elementTypeSignaturesCopy); }
java
public static TypeSignature ofContainer(String containerTypeName, Iterable<TypeSignature> elementTypeSignatures) { checkBaseTypeName(containerTypeName, "containerTypeName"); requireNonNull(elementTypeSignatures, "elementTypeSignatures"); final List<TypeSignature> elementTypeSignaturesCopy = ImmutableList.copyOf(elementTypeSignatures); checkArgument(!elementTypeSignaturesCopy.isEmpty(), "elementTypeSignatures is empty."); return new TypeSignature(containerTypeName, elementTypeSignaturesCopy); }
[ "public", "static", "TypeSignature", "ofContainer", "(", "String", "containerTypeName", ",", "Iterable", "<", "TypeSignature", ">", "elementTypeSignatures", ")", "{", "checkBaseTypeName", "(", "containerTypeName", ",", "\"containerTypeName\"", ")", ";", "requireNonNull", "(", "elementTypeSignatures", ",", "\"elementTypeSignatures\"", ")", ";", "final", "List", "<", "TypeSignature", ">", "elementTypeSignaturesCopy", "=", "ImmutableList", ".", "copyOf", "(", "elementTypeSignatures", ")", ";", "checkArgument", "(", "!", "elementTypeSignaturesCopy", ".", "isEmpty", "(", ")", ",", "\"elementTypeSignatures is empty.\"", ")", ";", "return", "new", "TypeSignature", "(", "containerTypeName", ",", "elementTypeSignaturesCopy", ")", ";", "}" ]
Creates a new container type with the specified container type name and the type signatures of the elements it contains. @throws IllegalArgumentException if the specified type name is not valid or {@code elementTypeSignatures} is empty.
[ "Creates", "a", "new", "container", "type", "with", "the", "specified", "container", "type", "name", "and", "the", "type", "signatures", "of", "the", "elements", "it", "contains", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java#L91-L98
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/related/dublin/DublinCoreMetadata.java
DublinCoreMetadata.hasColumn
public static boolean hasColumn(UserTable<?> table, DublinCoreType type) { """ Check if the table has a column for the Dublin Core Type term @param table user table @param type Dublin Core Type @return true if has column """ boolean hasColumn = table.hasColumn(type.getName()); if (!hasColumn) { for (String synonym : type.getSynonyms()) { hasColumn = table.hasColumn(synonym); if (hasColumn) { break; } } } return hasColumn; }
java
public static boolean hasColumn(UserTable<?> table, DublinCoreType type) { boolean hasColumn = table.hasColumn(type.getName()); if (!hasColumn) { for (String synonym : type.getSynonyms()) { hasColumn = table.hasColumn(synonym); if (hasColumn) { break; } } } return hasColumn; }
[ "public", "static", "boolean", "hasColumn", "(", "UserTable", "<", "?", ">", "table", ",", "DublinCoreType", "type", ")", "{", "boolean", "hasColumn", "=", "table", ".", "hasColumn", "(", "type", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "hasColumn", ")", "{", "for", "(", "String", "synonym", ":", "type", ".", "getSynonyms", "(", ")", ")", "{", "hasColumn", "=", "table", ".", "hasColumn", "(", "synonym", ")", ";", "if", "(", "hasColumn", ")", "{", "break", ";", "}", "}", "}", "return", "hasColumn", ";", "}" ]
Check if the table has a column for the Dublin Core Type term @param table user table @param type Dublin Core Type @return true if has column
[ "Check", "if", "the", "table", "has", "a", "column", "for", "the", "Dublin", "Core", "Type", "term" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/dublin/DublinCoreMetadata.java#L24-L38
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addSuccessJobStarted
public FessMessages addSuccessJobStarted(String property, String arg0) { """ Add the created action message for the key 'success.job_started' with parameters. <pre> message: Started job {0}. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull) """ assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_started, arg0)); return this; }
java
public FessMessages addSuccessJobStarted(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(SUCCESS_job_started, arg0)); return this; }
[ "public", "FessMessages", "addSuccessJobStarted", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "SUCCESS_job_started", ",", "arg0", ")", ")", ";", "return", "this", ";", "}" ]
Add the created action message for the key 'success.job_started' with parameters. <pre> message: Started job {0}. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "success", ".", "job_started", "with", "parameters", ".", "<pre", ">", "message", ":", "Started", "job", "{", "0", "}", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2405-L2409
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java
JXMapViewer.zoomToBestFit
public void zoomToBestFit(Set<GeoPosition> positions, double maxFraction) { """ Zoom and center the map to a best fit around the input GeoPositions. Best fit is defined as the most zoomed-in possible view where both the width and height of a bounding box around the positions take up no more than maxFraction of the viewport width or height respectively. @param positions A set of GeoPositions to calculate the new zoom from @param maxFraction the maximum fraction of the viewport that should be covered """ if (positions.isEmpty()) return; if (maxFraction <= 0 || maxFraction > 1) throw new IllegalArgumentException("maxFraction must be between 0 and 1"); TileFactory tileFactory = getTileFactory(); TileFactoryInfo info = tileFactory.getInfo(); if(info == null) return; // set to central position initially GeoPosition centre = computeGeoCenter(positions); setCenterPosition(centre); if (positions.size() == 1) return; // repeatedly zoom in until we find the first zoom level where either the width or height // of the points takes up more than the max fraction of the viewport // start with zoomed out at maximum int bestZoom = info.getMaximumZoomLevel(); Rectangle2D viewport = getViewportBounds(); Rectangle2D bounds = generateBoundingRect(positions, bestZoom); // is this zoom still OK? while (bestZoom >= info.getMinimumZoomLevel() && bounds.getWidth() < viewport.getWidth() * maxFraction && bounds.getHeight() < viewport.getHeight() * maxFraction) { bestZoom--; bounds = generateBoundingRect(positions, bestZoom); } setZoom(bestZoom + 1); }
java
public void zoomToBestFit(Set<GeoPosition> positions, double maxFraction) { if (positions.isEmpty()) return; if (maxFraction <= 0 || maxFraction > 1) throw new IllegalArgumentException("maxFraction must be between 0 and 1"); TileFactory tileFactory = getTileFactory(); TileFactoryInfo info = tileFactory.getInfo(); if(info == null) return; // set to central position initially GeoPosition centre = computeGeoCenter(positions); setCenterPosition(centre); if (positions.size() == 1) return; // repeatedly zoom in until we find the first zoom level where either the width or height // of the points takes up more than the max fraction of the viewport // start with zoomed out at maximum int bestZoom = info.getMaximumZoomLevel(); Rectangle2D viewport = getViewportBounds(); Rectangle2D bounds = generateBoundingRect(positions, bestZoom); // is this zoom still OK? while (bestZoom >= info.getMinimumZoomLevel() && bounds.getWidth() < viewport.getWidth() * maxFraction && bounds.getHeight() < viewport.getHeight() * maxFraction) { bestZoom--; bounds = generateBoundingRect(positions, bestZoom); } setZoom(bestZoom + 1); }
[ "public", "void", "zoomToBestFit", "(", "Set", "<", "GeoPosition", ">", "positions", ",", "double", "maxFraction", ")", "{", "if", "(", "positions", ".", "isEmpty", "(", ")", ")", "return", ";", "if", "(", "maxFraction", "<=", "0", "||", "maxFraction", ">", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"maxFraction must be between 0 and 1\"", ")", ";", "TileFactory", "tileFactory", "=", "getTileFactory", "(", ")", ";", "TileFactoryInfo", "info", "=", "tileFactory", ".", "getInfo", "(", ")", ";", "if", "(", "info", "==", "null", ")", "return", ";", "// set to central position initially\r", "GeoPosition", "centre", "=", "computeGeoCenter", "(", "positions", ")", ";", "setCenterPosition", "(", "centre", ")", ";", "if", "(", "positions", ".", "size", "(", ")", "==", "1", ")", "return", ";", "// repeatedly zoom in until we find the first zoom level where either the width or height\r", "// of the points takes up more than the max fraction of the viewport\r", "// start with zoomed out at maximum\r", "int", "bestZoom", "=", "info", ".", "getMaximumZoomLevel", "(", ")", ";", "Rectangle2D", "viewport", "=", "getViewportBounds", "(", ")", ";", "Rectangle2D", "bounds", "=", "generateBoundingRect", "(", "positions", ",", "bestZoom", ")", ";", "// is this zoom still OK?\r", "while", "(", "bestZoom", ">=", "info", ".", "getMinimumZoomLevel", "(", ")", "&&", "bounds", ".", "getWidth", "(", ")", "<", "viewport", ".", "getWidth", "(", ")", "*", "maxFraction", "&&", "bounds", ".", "getHeight", "(", ")", "<", "viewport", ".", "getHeight", "(", ")", "*", "maxFraction", ")", "{", "bestZoom", "--", ";", "bounds", "=", "generateBoundingRect", "(", "positions", ",", "bestZoom", ")", ";", "}", "setZoom", "(", "bestZoom", "+", "1", ")", ";", "}" ]
Zoom and center the map to a best fit around the input GeoPositions. Best fit is defined as the most zoomed-in possible view where both the width and height of a bounding box around the positions take up no more than maxFraction of the viewport width or height respectively. @param positions A set of GeoPositions to calculate the new zoom from @param maxFraction the maximum fraction of the viewport that should be covered
[ "Zoom", "and", "center", "the", "map", "to", "a", "best", "fit", "around", "the", "input", "GeoPositions", ".", "Best", "fit", "is", "defined", "as", "the", "most", "zoomed", "-", "in", "possible", "view", "where", "both", "the", "width", "and", "height", "of", "a", "bounding", "box", "around", "the", "positions", "take", "up", "no", "more", "than", "maxFraction", "of", "the", "viewport", "width", "or", "height", "respectively", "." ]
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L686-L727
tweea/matrixjavalib-main-common
src/main/java/net/matrix/lang/Objects2.java
Objects2.isNull
public static <T> T isNull(final T value, final T replacement) { """ 如果对象值是 null 返回替代对象,否则返回对象本身。 @param value 对象 @param replacement 替代对象 @param <T> 对象类型 @return 结果 """ if (value == null) { return replacement; } return value; }
java
public static <T> T isNull(final T value, final T replacement) { if (value == null) { return replacement; } return value; }
[ "public", "static", "<", "T", ">", "T", "isNull", "(", "final", "T", "value", ",", "final", "T", "replacement", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "replacement", ";", "}", "return", "value", ";", "}" ]
如果对象值是 null 返回替代对象,否则返回对象本身。 @param value 对象 @param replacement 替代对象 @param <T> 对象类型 @return 结果
[ "如果对象值是", "null", "返回替代对象,否则返回对象本身。" ]
train
https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/lang/Objects2.java#L28-L33
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/algorithm/impl/AbstractGeneticAlgorithm.java
AbstractGeneticAlgorithm.checkNumberOfParents
protected void checkNumberOfParents(List<S> population, int numberOfParentsForCrossover) { """ A crossover operator is applied to a number of parents, and it assumed that the population contains a valid number of solutions. This method checks that. @param population @param numberOfParentsForCrossover """ if ((population.size() % numberOfParentsForCrossover) != 0) { throw new JMetalException("Wrong number of parents: the remainder if the " + "population size (" + population.size() + ") is not divisible by " + numberOfParentsForCrossover) ; } }
java
protected void checkNumberOfParents(List<S> population, int numberOfParentsForCrossover) { if ((population.size() % numberOfParentsForCrossover) != 0) { throw new JMetalException("Wrong number of parents: the remainder if the " + "population size (" + population.size() + ") is not divisible by " + numberOfParentsForCrossover) ; } }
[ "protected", "void", "checkNumberOfParents", "(", "List", "<", "S", ">", "population", ",", "int", "numberOfParentsForCrossover", ")", "{", "if", "(", "(", "population", ".", "size", "(", ")", "%", "numberOfParentsForCrossover", ")", "!=", "0", ")", "{", "throw", "new", "JMetalException", "(", "\"Wrong number of parents: the remainder if the \"", "+", "\"population size (\"", "+", "population", ".", "size", "(", ")", "+", "\") is not divisible by \"", "+", "numberOfParentsForCrossover", ")", ";", "}", "}" ]
A crossover operator is applied to a number of parents, and it assumed that the population contains a valid number of solutions. This method checks that. @param population @param numberOfParentsForCrossover
[ "A", "crossover", "operator", "is", "applied", "to", "a", "number", "of", "parents", "and", "it", "assumed", "that", "the", "population", "contains", "a", "valid", "number", "of", "solutions", ".", "This", "method", "checks", "that", "." ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/algorithm/impl/AbstractGeneticAlgorithm.java#L122-L128
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java
FineUploader5Session.addCustomHeaders
@Nonnull public FineUploader5Session addCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { """ Any additional headers you would like included with the GET request sent to your server. Ignored in IE9 and IE8 if the endpoint is cross-origin. @param aCustomHeaders Custom headers to be added. @return this """ m_aSessionCustomHeaders.addAll (aCustomHeaders); return this; }
java
@Nonnull public FineUploader5Session addCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { m_aSessionCustomHeaders.addAll (aCustomHeaders); return this; }
[ "@", "Nonnull", "public", "FineUploader5Session", "addCustomHeaders", "(", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aCustomHeaders", ")", "{", "m_aSessionCustomHeaders", ".", "addAll", "(", "aCustomHeaders", ")", ";", "return", "this", ";", "}" ]
Any additional headers you would like included with the GET request sent to your server. Ignored in IE9 and IE8 if the endpoint is cross-origin. @param aCustomHeaders Custom headers to be added. @return this
[ "Any", "additional", "headers", "you", "would", "like", "included", "with", "the", "GET", "request", "sent", "to", "your", "server", ".", "Ignored", "in", "IE9", "and", "IE8", "if", "the", "endpoint", "is", "cross", "-", "origin", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java#L79-L84
chennaione/sugar
library/src/main/java/com/orm/helper/MultiDexHelper.java
MultiDexHelper.getSourcePaths
public static List<String> getSourcePaths() throws PackageManager.NameNotFoundException, IOException { """ get all the dex path @return all the dex path, including the ones in the newly added instant-run folder @throws PackageManager.NameNotFoundException @throws IOException """ ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), 0); File sourceApk = new File(applicationInfo.sourceDir); File dexDir = new File(applicationInfo.dataDir, SECONDARY_FOLDER_NAME); File instantRunDir = new File(applicationInfo.dataDir, INSTANT_RUN_DEX_DIR_PATH); //default instant-run dir List<String> sourcePaths = new ArrayList<>(); sourcePaths.add(applicationInfo.sourceDir); //add the default apk path if (instantRunDir.exists()) { //check if app using instant run for(final File dexFile : instantRunDir.listFiles()) { //add all sources from instan-run sourcePaths.add(dexFile.getAbsolutePath()); } } //the prefix of extracted file, ie: test.classes String extractedFilePrefix = sourceApk.getName() + EXTRACTED_NAME_EXT; //the total dex numbers int totalDexNumber = getMultiDexPreferences().getInt(KEY_DEX_NUMBER, 1); for (int secondaryNumber = 2; secondaryNumber <= totalDexNumber; secondaryNumber++) { //for each dex file, ie: test.classes2.zip, test.classes3.zip... String fileName = extractedFilePrefix + secondaryNumber + EXTRACTED_SUFFIX; File extractedFile = new File(dexDir, fileName); if (extractedFile.isFile()) { sourcePaths.add(extractedFile.getAbsolutePath()); //we ignore the verify zip part } } return sourcePaths; }
java
public static List<String> getSourcePaths() throws PackageManager.NameNotFoundException, IOException { ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), 0); File sourceApk = new File(applicationInfo.sourceDir); File dexDir = new File(applicationInfo.dataDir, SECONDARY_FOLDER_NAME); File instantRunDir = new File(applicationInfo.dataDir, INSTANT_RUN_DEX_DIR_PATH); //default instant-run dir List<String> sourcePaths = new ArrayList<>(); sourcePaths.add(applicationInfo.sourceDir); //add the default apk path if (instantRunDir.exists()) { //check if app using instant run for(final File dexFile : instantRunDir.listFiles()) { //add all sources from instan-run sourcePaths.add(dexFile.getAbsolutePath()); } } //the prefix of extracted file, ie: test.classes String extractedFilePrefix = sourceApk.getName() + EXTRACTED_NAME_EXT; //the total dex numbers int totalDexNumber = getMultiDexPreferences().getInt(KEY_DEX_NUMBER, 1); for (int secondaryNumber = 2; secondaryNumber <= totalDexNumber; secondaryNumber++) { //for each dex file, ie: test.classes2.zip, test.classes3.zip... String fileName = extractedFilePrefix + secondaryNumber + EXTRACTED_SUFFIX; File extractedFile = new File(dexDir, fileName); if (extractedFile.isFile()) { sourcePaths.add(extractedFile.getAbsolutePath()); //we ignore the verify zip part } } return sourcePaths; }
[ "public", "static", "List", "<", "String", ">", "getSourcePaths", "(", ")", "throws", "PackageManager", ".", "NameNotFoundException", ",", "IOException", "{", "ApplicationInfo", "applicationInfo", "=", "getPackageManager", "(", ")", ".", "getApplicationInfo", "(", "getPackageName", "(", ")", ",", "0", ")", ";", "File", "sourceApk", "=", "new", "File", "(", "applicationInfo", ".", "sourceDir", ")", ";", "File", "dexDir", "=", "new", "File", "(", "applicationInfo", ".", "dataDir", ",", "SECONDARY_FOLDER_NAME", ")", ";", "File", "instantRunDir", "=", "new", "File", "(", "applicationInfo", ".", "dataDir", ",", "INSTANT_RUN_DEX_DIR_PATH", ")", ";", "//default instant-run dir", "List", "<", "String", ">", "sourcePaths", "=", "new", "ArrayList", "<>", "(", ")", ";", "sourcePaths", ".", "add", "(", "applicationInfo", ".", "sourceDir", ")", ";", "//add the default apk path", "if", "(", "instantRunDir", ".", "exists", "(", ")", ")", "{", "//check if app using instant run", "for", "(", "final", "File", "dexFile", ":", "instantRunDir", ".", "listFiles", "(", ")", ")", "{", "//add all sources from instan-run", "sourcePaths", ".", "add", "(", "dexFile", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "}", "//the prefix of extracted file, ie: test.classes", "String", "extractedFilePrefix", "=", "sourceApk", ".", "getName", "(", ")", "+", "EXTRACTED_NAME_EXT", ";", "//the total dex numbers", "int", "totalDexNumber", "=", "getMultiDexPreferences", "(", ")", ".", "getInt", "(", "KEY_DEX_NUMBER", ",", "1", ")", ";", "for", "(", "int", "secondaryNumber", "=", "2", ";", "secondaryNumber", "<=", "totalDexNumber", ";", "secondaryNumber", "++", ")", "{", "//for each dex file, ie: test.classes2.zip, test.classes3.zip...", "String", "fileName", "=", "extractedFilePrefix", "+", "secondaryNumber", "+", "EXTRACTED_SUFFIX", ";", "File", "extractedFile", "=", "new", "File", "(", "dexDir", ",", "fileName", ")", ";", "if", "(", "extractedFile", ".", "isFile", "(", ")", ")", "{", "sourcePaths", ".", "add", "(", "extractedFile", ".", "getAbsolutePath", "(", ")", ")", ";", "//we ignore the verify zip part", "}", "}", "return", "sourcePaths", ";", "}" ]
get all the dex path @return all the dex path, including the ones in the newly added instant-run folder @throws PackageManager.NameNotFoundException @throws IOException
[ "get", "all", "the", "dex", "path" ]
train
https://github.com/chennaione/sugar/blob/2ff1b9d5b11563346b69b4e97324107ff680a61a/library/src/main/java/com/orm/helper/MultiDexHelper.java#L52-L83
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/decompiler/DecompilerUtil.java
DecompilerUtil.getOutputDirectoryForClass
static File getOutputDirectoryForClass(GraphContext context, JavaClassFileModel fileModel) { """ Returns an appropriate output directory for the decompiled data based upon the provided {@link JavaClassFileModel}. This should be the top-level directory for the package (eg, /tmp/project/foo for the file /tmp/project/foo/com/example/Foo.class). This could be the same directory as the file itself, if the file is already in the output directory. If the .class file is referencing a file in the input directory, then this will be a classes folder underneath the output directory. """ final File result; WindupConfigurationModel configuration = WindupConfigurationService.getConfigurationModel(context); File inputPath = fileModel.getProjectModel().getRootProjectModel().getRootFileModel().asFile(); if (PathUtil.isInSubDirectory(inputPath, fileModel.asFile())) { String outputPath = configuration.getOutputPath().getFilePath(); result = Paths.get(outputPath).resolve("classes").toFile(); } else { String packageName = fileModel.getPackageName(); if (StringUtils.isBlank(packageName)) return fileModel.asFile().getParentFile(); String[] packageComponents = packageName.split("\\."); File rootFile = fileModel.asFile().getParentFile(); for (int i = 0; i < packageComponents.length; i++) { rootFile = rootFile.getParentFile(); } result = rootFile; } return result; }
java
static File getOutputDirectoryForClass(GraphContext context, JavaClassFileModel fileModel) { final File result; WindupConfigurationModel configuration = WindupConfigurationService.getConfigurationModel(context); File inputPath = fileModel.getProjectModel().getRootProjectModel().getRootFileModel().asFile(); if (PathUtil.isInSubDirectory(inputPath, fileModel.asFile())) { String outputPath = configuration.getOutputPath().getFilePath(); result = Paths.get(outputPath).resolve("classes").toFile(); } else { String packageName = fileModel.getPackageName(); if (StringUtils.isBlank(packageName)) return fileModel.asFile().getParentFile(); String[] packageComponents = packageName.split("\\."); File rootFile = fileModel.asFile().getParentFile(); for (int i = 0; i < packageComponents.length; i++) { rootFile = rootFile.getParentFile(); } result = rootFile; } return result; }
[ "static", "File", "getOutputDirectoryForClass", "(", "GraphContext", "context", ",", "JavaClassFileModel", "fileModel", ")", "{", "final", "File", "result", ";", "WindupConfigurationModel", "configuration", "=", "WindupConfigurationService", ".", "getConfigurationModel", "(", "context", ")", ";", "File", "inputPath", "=", "fileModel", ".", "getProjectModel", "(", ")", ".", "getRootProjectModel", "(", ")", ".", "getRootFileModel", "(", ")", ".", "asFile", "(", ")", ";", "if", "(", "PathUtil", ".", "isInSubDirectory", "(", "inputPath", ",", "fileModel", ".", "asFile", "(", ")", ")", ")", "{", "String", "outputPath", "=", "configuration", ".", "getOutputPath", "(", ")", ".", "getFilePath", "(", ")", ";", "result", "=", "Paths", ".", "get", "(", "outputPath", ")", ".", "resolve", "(", "\"classes\"", ")", ".", "toFile", "(", ")", ";", "}", "else", "{", "String", "packageName", "=", "fileModel", ".", "getPackageName", "(", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "packageName", ")", ")", "return", "fileModel", ".", "asFile", "(", ")", ".", "getParentFile", "(", ")", ";", "String", "[", "]", "packageComponents", "=", "packageName", ".", "split", "(", "\"\\\\.\"", ")", ";", "File", "rootFile", "=", "fileModel", ".", "asFile", "(", ")", ".", "getParentFile", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "packageComponents", ".", "length", ";", "i", "++", ")", "{", "rootFile", "=", "rootFile", ".", "getParentFile", "(", ")", ";", "}", "result", "=", "rootFile", ";", "}", "return", "result", ";", "}" ]
Returns an appropriate output directory for the decompiled data based upon the provided {@link JavaClassFileModel}. This should be the top-level directory for the package (eg, /tmp/project/foo for the file /tmp/project/foo/com/example/Foo.class). This could be the same directory as the file itself, if the file is already in the output directory. If the .class file is referencing a file in the input directory, then this will be a classes folder underneath the output directory.
[ "Returns", "an", "appropriate", "output", "directory", "for", "the", "decompiled", "data", "based", "upon", "the", "provided", "{", "@link", "JavaClassFileModel", "}", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/decompiler/DecompilerUtil.java#L26-L52
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Site.java
Site.addCookie
public Site addCookie(String name, String value) { """ Add a cookie with domain {@link #getDomain()} @param name name @param value value @return this """ defaultCookies.put(name, value); return this; }
java
public Site addCookie(String name, String value) { defaultCookies.put(name, value); return this; }
[ "public", "Site", "addCookie", "(", "String", "name", ",", "String", "value", ")", "{", "defaultCookies", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a cookie with domain {@link #getDomain()} @param name name @param value value @return this
[ "Add", "a", "cookie", "with", "domain", "{", "@link", "#getDomain", "()", "}" ]
train
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java#L66-L69
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java
DiagonalMatrix.set
public void set(int row, int col, double val) { """ {@inheritDoc} @throws IllegalArgumentException if {@code row != col} """ checkIndices(row, col); if (row != col) { throw new IllegalArgumentException( "cannot set non-diagonal elements in a DiagonalMatrix"); } values[row] = val; }
java
public void set(int row, int col, double val) { checkIndices(row, col); if (row != col) { throw new IllegalArgumentException( "cannot set non-diagonal elements in a DiagonalMatrix"); } values[row] = val; }
[ "public", "void", "set", "(", "int", "row", ",", "int", "col", ",", "double", "val", ")", "{", "checkIndices", "(", "row", ",", "col", ")", ";", "if", "(", "row", "!=", "col", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"cannot set non-diagonal elements in a DiagonalMatrix\"", ")", ";", "}", "values", "[", "row", "]", "=", "val", ";", "}" ]
{@inheritDoc} @throws IllegalArgumentException if {@code row != col}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java#L150-L158
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4ExecutionFuture.java
JDBC4ExecutionFuture.get
@Override public ClientResponse get() throws InterruptedException, ExecutionException { """ Waits if necessary for the computation to complete, and then retrieves its result. @return the computed result. @throws CancellationException if the computation was cancelled. @throws ExecutionException if the computation threw an exception. @throws InterruptedException if the current thread was interrupted while waiting. """ try { return get(this.timeout, TimeUnit.MILLISECONDS); } catch (TimeoutException to) { this.status.compareAndSet(STATUS_RUNNING, STATUS_TIMEOUT); throw new ExecutionException(to); } }
java
@Override public ClientResponse get() throws InterruptedException, ExecutionException { try { return get(this.timeout, TimeUnit.MILLISECONDS); } catch (TimeoutException to) { this.status.compareAndSet(STATUS_RUNNING, STATUS_TIMEOUT); throw new ExecutionException(to); } }
[ "@", "Override", "public", "ClientResponse", "get", "(", ")", "throws", "InterruptedException", ",", "ExecutionException", "{", "try", "{", "return", "get", "(", "this", ".", "timeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "catch", "(", "TimeoutException", "to", ")", "{", "this", ".", "status", ".", "compareAndSet", "(", "STATUS_RUNNING", ",", "STATUS_TIMEOUT", ")", ";", "throw", "new", "ExecutionException", "(", "to", ")", ";", "}", "}" ]
Waits if necessary for the computation to complete, and then retrieves its result. @return the computed result. @throws CancellationException if the computation was cancelled. @throws ExecutionException if the computation threw an exception. @throws InterruptedException if the current thread was interrupted while waiting.
[ "Waits", "if", "necessary", "for", "the", "computation", "to", "complete", "and", "then", "retrieves", "its", "result", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4ExecutionFuture.java#L96-L104
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.listCertificateVersions
public PagedList<CertificateItem> listCertificateVersions(final String vaultBaseUrl, final String certificateName, final Integer maxresults) { """ List the versions of a certificate. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param certificateName The name of the certificate @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @return the PagedList&lt;CertificateItem&gt; if successful. """ return getCertificateVersions(vaultBaseUrl, certificateName, maxresults); }
java
public PagedList<CertificateItem> listCertificateVersions(final String vaultBaseUrl, final String certificateName, final Integer maxresults) { return getCertificateVersions(vaultBaseUrl, certificateName, maxresults); }
[ "public", "PagedList", "<", "CertificateItem", ">", "listCertificateVersions", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "certificateName", ",", "final", "Integer", "maxresults", ")", "{", "return", "getCertificateVersions", "(", "vaultBaseUrl", ",", "certificateName", ",", "maxresults", ")", ";", "}" ]
List the versions of a certificate. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param certificateName The name of the certificate @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @return the PagedList&lt;CertificateItem&gt; if successful.
[ "List", "the", "versions", "of", "a", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1578-L1581
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/media/Graphics.java
Graphics.rotateImage
public static void rotateImage(File input, File output, String format, int degrees) throws IOException { """ Rotate a file a given number of degrees @param input input image file @param output the output image fiel @param format the format (png, jpg, gif, etc.) @param degrees angle to rotote @throws IOException """ BufferedImage inputImage = ImageIO.read(input); Graphics2D g = (Graphics2D) inputImage.getGraphics(); g.drawImage(inputImage, 0, 0, null); AffineTransform at = new AffineTransform(); // scale image //at.scale(2.0, 2.0); // rotate 45 degrees around image center at.rotate(degrees * Math.PI / 180.0, inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); //at.rotate(Math.toRadians(degrees), inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); /* * translate to make sure the rotation doesn't cut off any image data */ AffineTransform translationTransform; translationTransform = findTranslation(at, inputImage); at.preConcatenate(translationTransform); // instantiate and apply transformation filter BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); BufferedImage destinationBI = bio.filter(inputImage, null); ImageIO.write(destinationBI, format, output); }
java
public static void rotateImage(File input, File output, String format, int degrees) throws IOException { BufferedImage inputImage = ImageIO.read(input); Graphics2D g = (Graphics2D) inputImage.getGraphics(); g.drawImage(inputImage, 0, 0, null); AffineTransform at = new AffineTransform(); // scale image //at.scale(2.0, 2.0); // rotate 45 degrees around image center at.rotate(degrees * Math.PI / 180.0, inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); //at.rotate(Math.toRadians(degrees), inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0); /* * translate to make sure the rotation doesn't cut off any image data */ AffineTransform translationTransform; translationTransform = findTranslation(at, inputImage); at.preConcatenate(translationTransform); // instantiate and apply transformation filter BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); BufferedImage destinationBI = bio.filter(inputImage, null); ImageIO.write(destinationBI, format, output); }
[ "public", "static", "void", "rotateImage", "(", "File", "input", ",", "File", "output", ",", "String", "format", ",", "int", "degrees", ")", "throws", "IOException", "{", "BufferedImage", "inputImage", "=", "ImageIO", ".", "read", "(", "input", ")", ";", "Graphics2D", "g", "=", "(", "Graphics2D", ")", "inputImage", ".", "getGraphics", "(", ")", ";", "g", ".", "drawImage", "(", "inputImage", ",", "0", ",", "0", ",", "null", ")", ";", "AffineTransform", "at", "=", "new", "AffineTransform", "(", ")", ";", "// scale image\r", "//at.scale(2.0, 2.0);\r", "// rotate 45 degrees around image center\r", "at", ".", "rotate", "(", "degrees", "*", "Math", ".", "PI", "/", "180.0", ",", "inputImage", ".", "getWidth", "(", ")", "/", "2.0", ",", "inputImage", ".", "getHeight", "(", ")", "/", "2.0", ")", ";", "//at.rotate(Math.toRadians(degrees), inputImage.getWidth() / 2.0, inputImage.getHeight() / 2.0);\r", "/*\r\n\t\t * translate to make sure the rotation doesn't cut off any image data\r\n\t\t */", "AffineTransform", "translationTransform", ";", "translationTransform", "=", "findTranslation", "(", "at", ",", "inputImage", ")", ";", "at", ".", "preConcatenate", "(", "translationTransform", ")", ";", "// instantiate and apply transformation filter\r", "BufferedImageOp", "bio", "=", "new", "AffineTransformOp", "(", "at", ",", "AffineTransformOp", ".", "TYPE_BILINEAR", ")", ";", "BufferedImage", "destinationBI", "=", "bio", ".", "filter", "(", "inputImage", ",", "null", ")", ";", "ImageIO", ".", "write", "(", "destinationBI", ",", "format", ",", "output", ")", ";", "}" ]
Rotate a file a given number of degrees @param input input image file @param output the output image fiel @param format the format (png, jpg, gif, etc.) @param degrees angle to rotote @throws IOException
[ "Rotate", "a", "file", "a", "given", "number", "of", "degrees" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/media/Graphics.java#L36-L70
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
JsonPath.read
@SuppressWarnings( { """ Applies this JsonPath to the provided json string @param json a json string @param <T> expected return type @return list of objects matched by the given path """"unchecked"}) public <T> T read(String json) { return read(json, Configuration.defaultConfiguration()); }
java
@SuppressWarnings({"unchecked"}) public <T> T read(String json) { return read(json, Configuration.defaultConfiguration()); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "<", "T", ">", "T", "read", "(", "String", "json", ")", "{", "return", "read", "(", "json", ",", "Configuration", ".", "defaultConfiguration", "(", ")", ")", ";", "}" ]
Applies this JsonPath to the provided json string @param json a json string @param <T> expected return type @return list of objects matched by the given path
[ "Applies", "this", "JsonPath", "to", "the", "provided", "json", "string" ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L323-L326
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java
ManagementClient.createSubscription
public SubscriptionDescription createSubscription(String topicPath, String subscriptionName) throws ServiceBusException, InterruptedException { """ Creates a new subscription for a given topic in the service namespace with the given name. See {@link SubscriptionDescription} for default values of subscription properties. @param topicPath - The name of the topic relative to the service namespace base address. @param subscriptionName - The name of the subscription. @return {@link SubscriptionDescription} of the newly created subscription. @throws IllegalArgumentException - Entity name is null, empty, too long or uses illegal characters. @throws MessagingEntityAlreadyExistsException - An entity with the same name exists under the same service namespace. @throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout @throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details. @throws ServerBusyException - The server is busy. You should wait before you retry the operation. @throws ServiceBusException - An internal error or an unexpected exception occurred. @throws QuotaExceededException - Either the specified size in the description is not supported or the maximum allowed quota has been reached. @throws InterruptedException if the current thread was interrupted """ return Utils.completeFuture(this.asyncClient.createSubscriptionAsync(topicPath, subscriptionName)); }
java
public SubscriptionDescription createSubscription(String topicPath, String subscriptionName) throws ServiceBusException, InterruptedException { return Utils.completeFuture(this.asyncClient.createSubscriptionAsync(topicPath, subscriptionName)); }
[ "public", "SubscriptionDescription", "createSubscription", "(", "String", "topicPath", ",", "String", "subscriptionName", ")", "throws", "ServiceBusException", ",", "InterruptedException", "{", "return", "Utils", ".", "completeFuture", "(", "this", ".", "asyncClient", ".", "createSubscriptionAsync", "(", "topicPath", ",", "subscriptionName", ")", ")", ";", "}" ]
Creates a new subscription for a given topic in the service namespace with the given name. See {@link SubscriptionDescription} for default values of subscription properties. @param topicPath - The name of the topic relative to the service namespace base address. @param subscriptionName - The name of the subscription. @return {@link SubscriptionDescription} of the newly created subscription. @throws IllegalArgumentException - Entity name is null, empty, too long or uses illegal characters. @throws MessagingEntityAlreadyExistsException - An entity with the same name exists under the same service namespace. @throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout @throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details. @throws ServerBusyException - The server is busy. You should wait before you retry the operation. @throws ServiceBusException - An internal error or an unexpected exception occurred. @throws QuotaExceededException - Either the specified size in the description is not supported or the maximum allowed quota has been reached. @throws InterruptedException if the current thread was interrupted
[ "Creates", "a", "new", "subscription", "for", "a", "given", "topic", "in", "the", "service", "namespace", "with", "the", "given", "name", ".", "See", "{" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java#L399-L401
app55/app55-java
src/support/java/com/googlecode/openbeans/Encoder.java
Encoder.writeStatement
public void writeStatement(Statement oldStat) { """ Write a statement of old objects. <p> A new statement is created by using the new versions of the target and arguments. If any of the objects do not have its new copy yet, <code>writeObject()</code> is called to create one. </p> <p> The new statement is then executed to change the state of the new object. </p> @param oldStat a statement of old objects """ if (oldStat == null) { throw new NullPointerException(); } Statement newStat = createNewStatement(oldStat); try { // execute newStat newStat.execute(); } catch (Exception e) { listener.exceptionThrown(new Exception("failed to write statement: " + oldStat, e)); //$NON-NLS-1$ } }
java
public void writeStatement(Statement oldStat) { if (oldStat == null) { throw new NullPointerException(); } Statement newStat = createNewStatement(oldStat); try { // execute newStat newStat.execute(); } catch (Exception e) { listener.exceptionThrown(new Exception("failed to write statement: " + oldStat, e)); //$NON-NLS-1$ } }
[ "public", "void", "writeStatement", "(", "Statement", "oldStat", ")", "{", "if", "(", "oldStat", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "Statement", "newStat", "=", "createNewStatement", "(", "oldStat", ")", ";", "try", "{", "// execute newStat", "newStat", ".", "execute", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "listener", ".", "exceptionThrown", "(", "new", "Exception", "(", "\"failed to write statement: \"", "+", "oldStat", ",", "e", ")", ")", ";", "//$NON-NLS-1$", "}", "}" ]
Write a statement of old objects. <p> A new statement is created by using the new versions of the target and arguments. If any of the objects do not have its new copy yet, <code>writeObject()</code> is called to create one. </p> <p> The new statement is then executed to change the state of the new object. </p> @param oldStat a statement of old objects
[ "Write", "a", "statement", "of", "old", "objects", ".", "<p", ">", "A", "new", "statement", "is", "created", "by", "using", "the", "new", "versions", "of", "the", "target", "and", "arguments", ".", "If", "any", "of", "the", "objects", "do", "not", "have", "its", "new", "copy", "yet", "<code", ">", "writeObject", "()", "<", "/", "code", ">", "is", "called", "to", "create", "one", ".", "<", "/", "p", ">", "<p", ">", "The", "new", "statement", "is", "then", "executed", "to", "change", "the", "state", "of", "the", "new", "object", ".", "<", "/", "p", ">" ]
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/Encoder.java#L440-L456
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfAction.java
PdfAction.gotoEmbedded
public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow) { """ Creates a GoToE action to an embedded file. @param filename the root document of the target (null if the target is in the same document) @param target a path to the target document of this action @param dest the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString @param newWindow if true, the destination document should be opened in a new window @return a GoToE action """ PdfAction action = new PdfAction(); action.put(PdfName.S, PdfName.GOTOE); action.put(PdfName.T, target); action.put(PdfName.D, dest); action.put(PdfName.NEWWINDOW, new PdfBoolean(newWindow)); if (filename != null) { action.put(PdfName.F, new PdfString(filename)); } return action; }
java
public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow) { PdfAction action = new PdfAction(); action.put(PdfName.S, PdfName.GOTOE); action.put(PdfName.T, target); action.put(PdfName.D, dest); action.put(PdfName.NEWWINDOW, new PdfBoolean(newWindow)); if (filename != null) { action.put(PdfName.F, new PdfString(filename)); } return action; }
[ "public", "static", "PdfAction", "gotoEmbedded", "(", "String", "filename", ",", "PdfTargetDictionary", "target", ",", "PdfObject", "dest", ",", "boolean", "newWindow", ")", "{", "PdfAction", "action", "=", "new", "PdfAction", "(", ")", ";", "action", ".", "put", "(", "PdfName", ".", "S", ",", "PdfName", ".", "GOTOE", ")", ";", "action", ".", "put", "(", "PdfName", ".", "T", ",", "target", ")", ";", "action", ".", "put", "(", "PdfName", ".", "D", ",", "dest", ")", ";", "action", ".", "put", "(", "PdfName", ".", "NEWWINDOW", ",", "new", "PdfBoolean", "(", "newWindow", ")", ")", ";", "if", "(", "filename", "!=", "null", ")", "{", "action", ".", "put", "(", "PdfName", ".", "F", ",", "new", "PdfString", "(", "filename", ")", ")", ";", "}", "return", "action", ";", "}" ]
Creates a GoToE action to an embedded file. @param filename the root document of the target (null if the target is in the same document) @param target a path to the target document of this action @param dest the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString @param newWindow if true, the destination document should be opened in a new window @return a GoToE action
[ "Creates", "a", "GoToE", "action", "to", "an", "embedded", "file", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L523-L533
jayantk/jklol
src/com/jayantkrish/jklol/ccg/CcgParse.java
CcgParse.getPreUnaryLogicalForm
private Expression2 getPreUnaryLogicalForm() { """ Gets the logical form for this parse without applying the unary rule (if any) at the root. @return """ if (isTerminal()) { Expression2 logicalForm = lexiconEntry.getCategory().getLogicalForm(); return logicalForm; } else { Expression2 leftLogicalForm = left.getLogicalForm(); Expression2 rightLogicalForm = right.getLogicalForm(); return getCombinatorLogicalForm(leftLogicalForm, rightLogicalForm); } }
java
private Expression2 getPreUnaryLogicalForm() { if (isTerminal()) { Expression2 logicalForm = lexiconEntry.getCategory().getLogicalForm(); return logicalForm; } else { Expression2 leftLogicalForm = left.getLogicalForm(); Expression2 rightLogicalForm = right.getLogicalForm(); return getCombinatorLogicalForm(leftLogicalForm, rightLogicalForm); } }
[ "private", "Expression2", "getPreUnaryLogicalForm", "(", ")", "{", "if", "(", "isTerminal", "(", ")", ")", "{", "Expression2", "logicalForm", "=", "lexiconEntry", ".", "getCategory", "(", ")", ".", "getLogicalForm", "(", ")", ";", "return", "logicalForm", ";", "}", "else", "{", "Expression2", "leftLogicalForm", "=", "left", ".", "getLogicalForm", "(", ")", ";", "Expression2", "rightLogicalForm", "=", "right", ".", "getLogicalForm", "(", ")", ";", "return", "getCombinatorLogicalForm", "(", "leftLogicalForm", ",", "rightLogicalForm", ")", ";", "}", "}" ]
Gets the logical form for this parse without applying the unary rule (if any) at the root. @return
[ "Gets", "the", "logical", "form", "for", "this", "parse", "without", "applying", "the", "unary", "rule", "(", "if", "any", ")", "at", "the", "root", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/CcgParse.java#L289-L299
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java
DatatypeFactory.newDurationDayTime
public Duration newDurationDayTime( final boolean isPositive, final int day, final int hour, final int minute, final int second) { """ <p>Create a <code>Duration</code> of type <code>xdt:dayTimeDuration</code> using the specified <code>day</code>, <code>hour</code>, <code>minute</code> and <code>second</code> as defined in <a href="http://www.w3.org/TR/xpath-datamodel#dt-dayTimeDuration"> XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration</a>.</p> <p>The datatype <code>xdt:dayTimeDuration</code> is a subtype of <code>xs:duration</code> whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace <code>http://www.w3.org/2003/11/xpath-datatypes</code>.</p> <p>A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.</p> @param isPositive Set to <code>false</code> to create a negative duration. When the length of the duration is zero, this parameter will be ignored. @param day Day of <code>Duration</code>. @param hour Hour of <code>Duration</code>. @param minute Minute of <code>Duration</code>. @param second Second of <code>Duration</code>. @return New <code>Duration</code> created with the specified <code>day</code>, <code>hour</code>, <code>minute</code> and <code>second</code>. @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. """ return newDuration(isPositive, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, day, hour, minute, second); }
java
public Duration newDurationDayTime( final boolean isPositive, final int day, final int hour, final int minute, final int second) { return newDuration(isPositive, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, day, hour, minute, second); }
[ "public", "Duration", "newDurationDayTime", "(", "final", "boolean", "isPositive", ",", "final", "int", "day", ",", "final", "int", "hour", ",", "final", "int", "minute", ",", "final", "int", "second", ")", "{", "return", "newDuration", "(", "isPositive", ",", "DatatypeConstants", ".", "FIELD_UNDEFINED", ",", "DatatypeConstants", ".", "FIELD_UNDEFINED", ",", "day", ",", "hour", ",", "minute", ",", "second", ")", ";", "}" ]
<p>Create a <code>Duration</code> of type <code>xdt:dayTimeDuration</code> using the specified <code>day</code>, <code>hour</code>, <code>minute</code> and <code>second</code> as defined in <a href="http://www.w3.org/TR/xpath-datamodel#dt-dayTimeDuration"> XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration</a>.</p> <p>The datatype <code>xdt:dayTimeDuration</code> is a subtype of <code>xs:duration</code> whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace <code>http://www.w3.org/2003/11/xpath-datatypes</code>.</p> <p>A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.</p> @param isPositive Set to <code>false</code> to create a negative duration. When the length of the duration is zero, this parameter will be ignored. @param day Day of <code>Duration</code>. @param hour Hour of <code>Duration</code>. @param minute Minute of <code>Duration</code>. @param second Second of <code>Duration</code>. @return New <code>Duration</code> created with the specified <code>day</code>, <code>hour</code>, <code>minute</code> and <code>second</code>. @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>.
[ "<p", ">", "Create", "a", "<code", ">", "Duration<", "/", "code", ">", "of", "type", "<code", ">", "xdt", ":", "dayTimeDuration<", "/", "code", ">", "using", "the", "specified", "<code", ">", "day<", "/", "code", ">", "<code", ">", "hour<", "/", "code", ">", "<code", ">", "minute<", "/", "code", ">", "and", "<code", ">", "second<", "/", "code", ">", "as", "defined", "in", "<a", "href", "=", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "xpath", "-", "datamodel#dt", "-", "dayTimeDuration", ">", "XQuery", "1", ".", "0", "and", "XPath", "2", ".", "0", "Data", "Model", "xdt", ":", "dayTimeDuration<", "/", "a", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java#L508-L517
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/refer/References.java
References.getRequired
public <T> List<T> getRequired(Class<T> type, Object locator) throws ReferenceException { """ Gets all component references that match specified locator. At least one component reference must be present and matching to the specified type. If it doesn't the method throws an error. @param type the Class type that defined the type of the result. @param locator the locator to find references by. @return a list with matching component references. @throws ReferenceException when no references found. """ return find(type, locator, true); }
java
public <T> List<T> getRequired(Class<T> type, Object locator) throws ReferenceException { return find(type, locator, true); }
[ "public", "<", "T", ">", "List", "<", "T", ">", "getRequired", "(", "Class", "<", "T", ">", "type", ",", "Object", "locator", ")", "throws", "ReferenceException", "{", "return", "find", "(", "type", ",", "locator", ",", "true", ")", ";", "}" ]
Gets all component references that match specified locator. At least one component reference must be present and matching to the specified type. If it doesn't the method throws an error. @param type the Class type that defined the type of the result. @param locator the locator to find references by. @return a list with matching component references. @throws ReferenceException when no references found.
[ "Gets", "all", "component", "references", "that", "match", "specified", "locator", ".", "At", "least", "one", "component", "reference", "must", "be", "present", "and", "matching", "to", "the", "specified", "type", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/References.java#L277-L279
JodaOrg/joda-time
src/main/java/org/joda/time/Duration.java
Duration.withDurationAdded
public Duration withDurationAdded(ReadableDuration durationToAdd, int scalar) { """ Returns a new duration with this length plus that specified multiplied by the scalar. This instance is immutable and is not altered. <p> If the addition is zero, this instance is returned. @param durationToAdd the duration to add to this one, null means zero @param scalar the amount of times to add, such as -1 to subtract once @return the new duration instance """ if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
java
public Duration withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
[ "public", "Duration", "withDurationAdded", "(", "ReadableDuration", "durationToAdd", ",", "int", "scalar", ")", "{", "if", "(", "durationToAdd", "==", "null", "||", "scalar", "==", "0", ")", "{", "return", "this", ";", "}", "return", "withDurationAdded", "(", "durationToAdd", ".", "getMillis", "(", ")", ",", "scalar", ")", ";", "}" ]
Returns a new duration with this length plus that specified multiplied by the scalar. This instance is immutable and is not altered. <p> If the addition is zero, this instance is returned. @param durationToAdd the duration to add to this one, null means zero @param scalar the amount of times to add, such as -1 to subtract once @return the new duration instance
[ "Returns", "a", "new", "duration", "with", "this", "length", "plus", "that", "specified", "multiplied", "by", "the", "scalar", ".", "This", "instance", "is", "immutable", "and", "is", "not", "altered", ".", "<p", ">", "If", "the", "addition", "is", "zero", "this", "instance", "is", "returned", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Duration.java#L409-L414
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
SqlValidatorImpl.validateOrderList
protected void validateOrderList(SqlSelect select) { """ Validates the ORDER BY clause of a SELECT statement. @param select Select statement """ // ORDER BY is validated in a scope where aliases in the SELECT clause // are visible. For example, "SELECT empno AS x FROM emp ORDER BY x" // is valid. SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Objects.requireNonNull(orderScope); List<SqlNode> expandList = new ArrayList<>(); for (SqlNode orderItem : orderList) { SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem); } SqlNodeList expandedOrderList = new SqlNodeList( expandList, orderList.getParserPosition()); select.setOrderBy(expandedOrderList); for (SqlNode orderItem : expandedOrderList) { validateOrderItem(select, orderItem); } }
java
protected void validateOrderList(SqlSelect select) { // ORDER BY is validated in a scope where aliases in the SELECT clause // are visible. For example, "SELECT empno AS x FROM emp ORDER BY x" // is valid. SqlNodeList orderList = select.getOrderList(); if (orderList == null) { return; } if (!shouldAllowIntermediateOrderBy()) { if (!cursorSet.contains(select)) { throw newValidationError(select, RESOURCE.invalidOrderByPos()); } } final SqlValidatorScope orderScope = getOrderScope(select); Objects.requireNonNull(orderScope); List<SqlNode> expandList = new ArrayList<>(); for (SqlNode orderItem : orderList) { SqlNode expandedOrderItem = expand(orderItem, orderScope); expandList.add(expandedOrderItem); } SqlNodeList expandedOrderList = new SqlNodeList( expandList, orderList.getParserPosition()); select.setOrderBy(expandedOrderList); for (SqlNode orderItem : expandedOrderList) { validateOrderItem(select, orderItem); } }
[ "protected", "void", "validateOrderList", "(", "SqlSelect", "select", ")", "{", "// ORDER BY is validated in a scope where aliases in the SELECT clause", "// are visible. For example, \"SELECT empno AS x FROM emp ORDER BY x\"", "// is valid.", "SqlNodeList", "orderList", "=", "select", ".", "getOrderList", "(", ")", ";", "if", "(", "orderList", "==", "null", ")", "{", "return", ";", "}", "if", "(", "!", "shouldAllowIntermediateOrderBy", "(", ")", ")", "{", "if", "(", "!", "cursorSet", ".", "contains", "(", "select", ")", ")", "{", "throw", "newValidationError", "(", "select", ",", "RESOURCE", ".", "invalidOrderByPos", "(", ")", ")", ";", "}", "}", "final", "SqlValidatorScope", "orderScope", "=", "getOrderScope", "(", "select", ")", ";", "Objects", ".", "requireNonNull", "(", "orderScope", ")", ";", "List", "<", "SqlNode", ">", "expandList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "SqlNode", "orderItem", ":", "orderList", ")", "{", "SqlNode", "expandedOrderItem", "=", "expand", "(", "orderItem", ",", "orderScope", ")", ";", "expandList", ".", "add", "(", "expandedOrderItem", ")", ";", "}", "SqlNodeList", "expandedOrderList", "=", "new", "SqlNodeList", "(", "expandList", ",", "orderList", ".", "getParserPosition", "(", ")", ")", ";", "select", ".", "setOrderBy", "(", "expandedOrderList", ")", ";", "for", "(", "SqlNode", "orderItem", ":", "expandedOrderList", ")", "{", "validateOrderItem", "(", "select", ",", "orderItem", ")", ";", "}", "}" ]
Validates the ORDER BY clause of a SELECT statement. @param select Select statement
[ "Validates", "the", "ORDER", "BY", "clause", "of", "a", "SELECT", "statement", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3812-L3842
talsma-ict/umldoclet
src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java
UriUtils.addHttpParam
public static URI addHttpParam(URI uri, String name, String value) { """ This method adds a query parameter to an existing URI and takes care of proper encoding etc. <p> Since query parameters are scheme-specific, this method only applies to URI's with the following schemes: <ol> <li>{@code "http"}</li> <li>{@code "https"}</li> </ol> @param uri The URI to add an HTTP parameter to @param name The name of the parameter to add @param value The value of the parameter to add @return The URI to which a parameter may have been added """ if (uri != null && name != null && value != null && ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))) { final String base = uri.toASCIIString(); final int queryIdx = base.indexOf('?'); final int fragmentIdx = base.indexOf('#', queryIdx < 0 ? 0 : queryIdx); StringBuilder newUri = new StringBuilder(fragmentIdx >= 0 ? base.substring(0, fragmentIdx) : base); newUri.append(queryIdx < 0 ? '?' : '&'); appendEncoded(newUri, name); newUri.append('='); appendEncoded(newUri, value); if (fragmentIdx >= 0) newUri.append(base, fragmentIdx, base.length()); return URI.create(newUri.toString()); } return uri; }
java
public static URI addHttpParam(URI uri, String name, String value) { if (uri != null && name != null && value != null && ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))) { final String base = uri.toASCIIString(); final int queryIdx = base.indexOf('?'); final int fragmentIdx = base.indexOf('#', queryIdx < 0 ? 0 : queryIdx); StringBuilder newUri = new StringBuilder(fragmentIdx >= 0 ? base.substring(0, fragmentIdx) : base); newUri.append(queryIdx < 0 ? '?' : '&'); appendEncoded(newUri, name); newUri.append('='); appendEncoded(newUri, value); if (fragmentIdx >= 0) newUri.append(base, fragmentIdx, base.length()); return URI.create(newUri.toString()); } return uri; }
[ "public", "static", "URI", "addHttpParam", "(", "URI", "uri", ",", "String", "name", ",", "String", "value", ")", "{", "if", "(", "uri", "!=", "null", "&&", "name", "!=", "null", "&&", "value", "!=", "null", "&&", "(", "\"http\"", ".", "equals", "(", "uri", ".", "getScheme", "(", ")", ")", "||", "\"https\"", ".", "equals", "(", "uri", ".", "getScheme", "(", ")", ")", ")", ")", "{", "final", "String", "base", "=", "uri", ".", "toASCIIString", "(", ")", ";", "final", "int", "queryIdx", "=", "base", ".", "indexOf", "(", "'", "'", ")", ";", "final", "int", "fragmentIdx", "=", "base", ".", "indexOf", "(", "'", "'", ",", "queryIdx", "<", "0", "?", "0", ":", "queryIdx", ")", ";", "StringBuilder", "newUri", "=", "new", "StringBuilder", "(", "fragmentIdx", ">=", "0", "?", "base", ".", "substring", "(", "0", ",", "fragmentIdx", ")", ":", "base", ")", ";", "newUri", ".", "append", "(", "queryIdx", "<", "0", "?", "'", "'", ":", "'", "'", ")", ";", "appendEncoded", "(", "newUri", ",", "name", ")", ";", "newUri", ".", "append", "(", "'", "'", ")", ";", "appendEncoded", "(", "newUri", ",", "value", ")", ";", "if", "(", "fragmentIdx", ">=", "0", ")", "newUri", ".", "append", "(", "base", ",", "fragmentIdx", ",", "base", ".", "length", "(", ")", ")", ";", "return", "URI", ".", "create", "(", "newUri", ".", "toString", "(", ")", ")", ";", "}", "return", "uri", ";", "}" ]
This method adds a query parameter to an existing URI and takes care of proper encoding etc. <p> Since query parameters are scheme-specific, this method only applies to URI's with the following schemes: <ol> <li>{@code "http"}</li> <li>{@code "https"}</li> </ol> @param uri The URI to add an HTTP parameter to @param name The name of the parameter to add @param value The value of the parameter to add @return The URI to which a parameter may have been added
[ "This", "method", "adds", "a", "query", "parameter", "to", "an", "existing", "URI", "and", "takes", "care", "of", "proper", "encoding", "etc", ".", "<p", ">", "Since", "query", "parameters", "are", "scheme", "-", "specific", "this", "method", "only", "applies", "to", "URI", "s", "with", "the", "following", "schemes", ":", "<ol", ">", "<li", ">", "{", "@code", "http", "}", "<", "/", "li", ">", "<li", ">", "{", "@code", "https", "}", "<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java#L70-L84
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.splitAfterLast
public GP splitAfterLast(ST obj, PT startPoint) { """ Split this path and retains the first part of the part in this object and reply the second part. The last occurence of the specified element will be in the first part. <p>This function removes until the <i>last occurence</i> of the given object. @param obj is the segment to search for. @param startPoint is the starting point of the searched segment. @return the rest of the path after the last occurence of the given element. """ return splitAt(lastIndexOf(obj, startPoint), false); }
java
public GP splitAfterLast(ST obj, PT startPoint) { return splitAt(lastIndexOf(obj, startPoint), false); }
[ "public", "GP", "splitAfterLast", "(", "ST", "obj", ",", "PT", "startPoint", ")", "{", "return", "splitAt", "(", "lastIndexOf", "(", "obj", ",", "startPoint", ")", ",", "false", ")", ";", "}" ]
Split this path and retains the first part of the part in this object and reply the second part. The last occurence of the specified element will be in the first part. <p>This function removes until the <i>last occurence</i> of the given object. @param obj is the segment to search for. @param startPoint is the starting point of the searched segment. @return the rest of the path after the last occurence of the given element.
[ "Split", "this", "path", "and", "retains", "the", "first", "part", "of", "the", "part", "in", "this", "object", "and", "reply", "the", "second", "part", ".", "The", "last", "occurence", "of", "the", "specified", "element", "will", "be", "in", "the", "first", "part", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1172-L1174
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/SortedPositionLinks.java
SortedPositionLinks.lowerBound
private int lowerBound(JoinFilterFunction searchFunction, int[] links, int first, int last, int probePosition, Page allProbeChannelsPage) { """ Find the first element in position links that is NOT smaller than probePosition """ int middle; int step; int count = last - first; while (count > 0) { step = count / 2; middle = first + step; if (!applySearchFunction(searchFunction, links, middle, probePosition, allProbeChannelsPage)) { first = ++middle; count -= step + 1; } else { count = step; } } return first; }
java
private int lowerBound(JoinFilterFunction searchFunction, int[] links, int first, int last, int probePosition, Page allProbeChannelsPage) { int middle; int step; int count = last - first; while (count > 0) { step = count / 2; middle = first + step; if (!applySearchFunction(searchFunction, links, middle, probePosition, allProbeChannelsPage)) { first = ++middle; count -= step + 1; } else { count = step; } } return first; }
[ "private", "int", "lowerBound", "(", "JoinFilterFunction", "searchFunction", ",", "int", "[", "]", "links", ",", "int", "first", ",", "int", "last", ",", "int", "probePosition", ",", "Page", "allProbeChannelsPage", ")", "{", "int", "middle", ";", "int", "step", ";", "int", "count", "=", "last", "-", "first", ";", "while", "(", "count", ">", "0", ")", "{", "step", "=", "count", "/", "2", ";", "middle", "=", "first", "+", "step", ";", "if", "(", "!", "applySearchFunction", "(", "searchFunction", ",", "links", ",", "middle", ",", "probePosition", ",", "allProbeChannelsPage", ")", ")", "{", "first", "=", "++", "middle", ";", "count", "-=", "step", "+", "1", ";", "}", "else", "{", "count", "=", "step", ";", "}", "}", "return", "first", ";", "}" ]
Find the first element in position links that is NOT smaller than probePosition
[ "Find", "the", "first", "element", "in", "position", "links", "that", "is", "NOT", "smaller", "than", "probePosition" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/SortedPositionLinks.java#L259-L276
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java
JmxUtils.getAppJawrConfigMBeanObjectName
public static ObjectName getAppJawrConfigMBeanObjectName(ServletContext servletContext, String mBeanPrefix) { """ Returns the object name for the Jawr Application configuration Manager MBean @param servletContext the servelt context @param mBeanPrefix the MBean prefix @return the object name for the Jawr configuration Manager MBean """ return getMBeanObjectName(getContextPath(servletContext), JAWR_APP_CONFIG_MANAGER_TYPE, mBeanPrefix, null); }
java
public static ObjectName getAppJawrConfigMBeanObjectName(ServletContext servletContext, String mBeanPrefix) { return getMBeanObjectName(getContextPath(servletContext), JAWR_APP_CONFIG_MANAGER_TYPE, mBeanPrefix, null); }
[ "public", "static", "ObjectName", "getAppJawrConfigMBeanObjectName", "(", "ServletContext", "servletContext", ",", "String", "mBeanPrefix", ")", "{", "return", "getMBeanObjectName", "(", "getContextPath", "(", "servletContext", ")", ",", "JAWR_APP_CONFIG_MANAGER_TYPE", ",", "mBeanPrefix", ",", "null", ")", ";", "}" ]
Returns the object name for the Jawr Application configuration Manager MBean @param servletContext the servelt context @param mBeanPrefix the MBean prefix @return the object name for the Jawr configuration Manager MBean
[ "Returns", "the", "object", "name", "for", "the", "Jawr", "Application", "configuration", "Manager", "MBean" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L201-L204