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
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java
PoolOperations.removeNodesFromPool
public void removeNodesFromPool(String poolId, Collection<ComputeNode> computeNodes) throws BatchErrorException, IOException { """ Removes the specified compute nodes from the specified pool. @param poolId The ID of the pool. @param computeNodes The compute nodes to remove from the pool. @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. """ removeNodesFromPool(poolId, computeNodes, null, null, null); }
java
public void removeNodesFromPool(String poolId, Collection<ComputeNode> computeNodes) throws BatchErrorException, IOException { removeNodesFromPool(poolId, computeNodes, null, null, null); }
[ "public", "void", "removeNodesFromPool", "(", "String", "poolId", ",", "Collection", "<", "ComputeNode", ">", "computeNodes", ")", "throws", "BatchErrorException", ",", "IOException", "{", "removeNodesFromPool", "(", "poolId", ",", "computeNodes", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Removes the specified compute nodes from the specified pool. @param poolId The ID of the pool. @param computeNodes The compute nodes to remove from the pool. @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.
[ "Removes", "the", "specified", "compute", "nodes", "from", "the", "specified", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L930-L933
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.removeNull
public static <T> T[] removeNull(T[] array) { """ 去除{@code null} 元素 @param array 数组 @return 处理后的数组 @since 3.2.2 """ return filter(array, new Editor<T>() { @Override public T edit(T t) { // 返回null便不加入集合 return t; } }); }
java
public static <T> T[] removeNull(T[] array) { return filter(array, new Editor<T>() { @Override public T edit(T t) { // 返回null便不加入集合 return t; } }); }
[ "public", "static", "<", "T", ">", "T", "[", "]", "removeNull", "(", "T", "[", "]", "array", ")", "{", "return", "filter", "(", "array", ",", "new", "Editor", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "T", "edit", "(", "T", "t", ")", "{", "// 返回null便不加入集合\r", "return", "t", ";", "}", "}", ")", ";", "}" ]
去除{@code null} 元素 @param array 数组 @return 处理后的数组 @since 3.2.2
[ "去除", "{", "@code", "null", "}", "元素" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L781-L789
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java
BusinessProcess.startTask
public Task startTask(String taskId, boolean beginConversation) { """ @see #startTask(String) this method allows to start a conversation if no conversation is active """ if(beginConversation) { Conversation conversation = conversationInstance.get(); if(conversation.isTransient()) { conversation.begin(); } } return startTask(taskId); }
java
public Task startTask(String taskId, boolean beginConversation) { if(beginConversation) { Conversation conversation = conversationInstance.get(); if(conversation.isTransient()) { conversation.begin(); } } return startTask(taskId); }
[ "public", "Task", "startTask", "(", "String", "taskId", ",", "boolean", "beginConversation", ")", "{", "if", "(", "beginConversation", ")", "{", "Conversation", "conversation", "=", "conversationInstance", ".", "get", "(", ")", ";", "if", "(", "conversation", ".", "isTransient", "(", ")", ")", "{", "conversation", ".", "begin", "(", ")", ";", "}", "}", "return", "startTask", "(", "taskId", ")", ";", "}" ]
@see #startTask(String) this method allows to start a conversation if no conversation is active
[ "@see", "#startTask", "(", "String", ")" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java#L312-L320
dottydingo/hyperion
core/src/main/java/com/dottydingo/hyperion/core/endpoint/pipeline/phase/CreatePhase.java
CreatePhase.processCollectionRequest
protected void processCollectionRequest(HyperionContext hyperionContext) { """ Process a multi-item request @param hyperionContext The context """ EndpointRequest request = hyperionContext.getEndpointRequest(); EndpointResponse response = hyperionContext.getEndpointResponse(); ApiVersionPlugin<ApiObject<Serializable>,PersistentObject<Serializable>,Serializable> apiVersionPlugin = hyperionContext.getVersionPlugin(); EntityPlugin plugin = hyperionContext.getEntityPlugin(); List<ApiObject<Serializable>> clientObjects = null; try { clientObjects = marshaller.unmarshallCollection(request.getInputStream(), apiVersionPlugin.getApiClass()); } catch (WriteLimitException e) { throw new BadRequestException(messageSource.getErrorMessage(ERROR_WRITE_LIMIT,hyperionContext.getLocale(),e.getWriteLimit()),e); } catch (MarshallingException e) { throw new BadRequestException(messageSource.getErrorMessage(ERROR_READING_REQUEST,hyperionContext.getLocale(),e.getMessage()),e); } PersistenceContext persistenceContext = buildPersistenceContext(hyperionContext); Set<String> fieldSet = persistenceContext.getRequestedFields(); if(fieldSet != null) fieldSet.add("id"); List<ApiObject> saved = plugin.getPersistenceOperations().createOrUpdateItems(clientObjects, persistenceContext); processChangeEvents(hyperionContext,persistenceContext); response.setResponseCode(200); EntityList<ApiObject> entityResponse = new EntityList<>(); entityResponse.setEntries(saved); hyperionContext.setResult(entityResponse); }
java
protected void processCollectionRequest(HyperionContext hyperionContext) { EndpointRequest request = hyperionContext.getEndpointRequest(); EndpointResponse response = hyperionContext.getEndpointResponse(); ApiVersionPlugin<ApiObject<Serializable>,PersistentObject<Serializable>,Serializable> apiVersionPlugin = hyperionContext.getVersionPlugin(); EntityPlugin plugin = hyperionContext.getEntityPlugin(); List<ApiObject<Serializable>> clientObjects = null; try { clientObjects = marshaller.unmarshallCollection(request.getInputStream(), apiVersionPlugin.getApiClass()); } catch (WriteLimitException e) { throw new BadRequestException(messageSource.getErrorMessage(ERROR_WRITE_LIMIT,hyperionContext.getLocale(),e.getWriteLimit()),e); } catch (MarshallingException e) { throw new BadRequestException(messageSource.getErrorMessage(ERROR_READING_REQUEST,hyperionContext.getLocale(),e.getMessage()),e); } PersistenceContext persistenceContext = buildPersistenceContext(hyperionContext); Set<String> fieldSet = persistenceContext.getRequestedFields(); if(fieldSet != null) fieldSet.add("id"); List<ApiObject> saved = plugin.getPersistenceOperations().createOrUpdateItems(clientObjects, persistenceContext); processChangeEvents(hyperionContext,persistenceContext); response.setResponseCode(200); EntityList<ApiObject> entityResponse = new EntityList<>(); entityResponse.setEntries(saved); hyperionContext.setResult(entityResponse); }
[ "protected", "void", "processCollectionRequest", "(", "HyperionContext", "hyperionContext", ")", "{", "EndpointRequest", "request", "=", "hyperionContext", ".", "getEndpointRequest", "(", ")", ";", "EndpointResponse", "response", "=", "hyperionContext", ".", "getEndpointResponse", "(", ")", ";", "ApiVersionPlugin", "<", "ApiObject", "<", "Serializable", ">", ",", "PersistentObject", "<", "Serializable", ">", ",", "Serializable", ">", "apiVersionPlugin", "=", "hyperionContext", ".", "getVersionPlugin", "(", ")", ";", "EntityPlugin", "plugin", "=", "hyperionContext", ".", "getEntityPlugin", "(", ")", ";", "List", "<", "ApiObject", "<", "Serializable", ">", ">", "clientObjects", "=", "null", ";", "try", "{", "clientObjects", "=", "marshaller", ".", "unmarshallCollection", "(", "request", ".", "getInputStream", "(", ")", ",", "apiVersionPlugin", ".", "getApiClass", "(", ")", ")", ";", "}", "catch", "(", "WriteLimitException", "e", ")", "{", "throw", "new", "BadRequestException", "(", "messageSource", ".", "getErrorMessage", "(", "ERROR_WRITE_LIMIT", ",", "hyperionContext", ".", "getLocale", "(", ")", ",", "e", ".", "getWriteLimit", "(", ")", ")", ",", "e", ")", ";", "}", "catch", "(", "MarshallingException", "e", ")", "{", "throw", "new", "BadRequestException", "(", "messageSource", ".", "getErrorMessage", "(", "ERROR_READING_REQUEST", ",", "hyperionContext", ".", "getLocale", "(", ")", ",", "e", ".", "getMessage", "(", ")", ")", ",", "e", ")", ";", "}", "PersistenceContext", "persistenceContext", "=", "buildPersistenceContext", "(", "hyperionContext", ")", ";", "Set", "<", "String", ">", "fieldSet", "=", "persistenceContext", ".", "getRequestedFields", "(", ")", ";", "if", "(", "fieldSet", "!=", "null", ")", "fieldSet", ".", "add", "(", "\"id\"", ")", ";", "List", "<", "ApiObject", ">", "saved", "=", "plugin", ".", "getPersistenceOperations", "(", ")", ".", "createOrUpdateItems", "(", "clientObjects", ",", "persistenceContext", ")", ";", "processChangeEvents", "(", "hyperionContext", ",", "persistenceContext", ")", ";", "response", ".", "setResponseCode", "(", "200", ")", ";", "EntityList", "<", "ApiObject", ">", "entityResponse", "=", "new", "EntityList", "<>", "(", ")", ";", "entityResponse", ".", "setEntries", "(", "saved", ")", ";", "hyperionContext", ".", "setResult", "(", "entityResponse", ")", ";", "}" ]
Process a multi-item request @param hyperionContext The context
[ "Process", "a", "multi", "-", "item", "request" ]
train
https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/core/src/main/java/com/dottydingo/hyperion/core/endpoint/pipeline/phase/CreatePhase.java#L85-L122
bazaarvoice/emodb
table/src/main/java/com/bazaarvoice/emodb/table/db/tableset/DistributedTableSerializer.java
DistributedTableSerializer.loadFromNode
private Set<Long> loadFromNode(String path, OutputStream out) throws KeeperException.NoNodeException { """ Loads the table data from the path and writes it to the output stream. Returns the set of UUIDs associated with the table, just like {@link #loadAndSerialize(long, java.io.OutputStream)}. """ try { // Get the cached representation of this table byte[] data = _curator.getData().forPath(path); DataInputStream in = new DataInputStream(new ByteArrayInputStream(data)); int uuidCountOrExceptionCode = in.readInt(); // A negative first integer indicates an exception condition. if (uuidCountOrExceptionCode < 0) { String exceptionJson = new String(data, 4, data.length - 4, Charsets.UTF_8); switch (uuidCountOrExceptionCode) { case UNKNOWN_TABLE: throw JsonHelper.fromJson(exceptionJson, UnknownTableException.class); case DROPPED_TABLE: throw JsonHelper.fromJson(exceptionJson, DroppedTableException.class); } } // Load the UUIDs for this table Set<Long> uuids = Sets.newHashSet(); for (int i=0; i < uuidCountOrExceptionCode; i++) { uuids.add(in.readLong()); } // Copy the remaining bytes as the content ByteStreams.copy(in, out); return uuids; } catch (Throwable t) { Throwables.propagateIfInstanceOf(t, KeeperException.NoNodeException.class); throw Throwables.propagate(t); } }
java
private Set<Long> loadFromNode(String path, OutputStream out) throws KeeperException.NoNodeException { try { // Get the cached representation of this table byte[] data = _curator.getData().forPath(path); DataInputStream in = new DataInputStream(new ByteArrayInputStream(data)); int uuidCountOrExceptionCode = in.readInt(); // A negative first integer indicates an exception condition. if (uuidCountOrExceptionCode < 0) { String exceptionJson = new String(data, 4, data.length - 4, Charsets.UTF_8); switch (uuidCountOrExceptionCode) { case UNKNOWN_TABLE: throw JsonHelper.fromJson(exceptionJson, UnknownTableException.class); case DROPPED_TABLE: throw JsonHelper.fromJson(exceptionJson, DroppedTableException.class); } } // Load the UUIDs for this table Set<Long> uuids = Sets.newHashSet(); for (int i=0; i < uuidCountOrExceptionCode; i++) { uuids.add(in.readLong()); } // Copy the remaining bytes as the content ByteStreams.copy(in, out); return uuids; } catch (Throwable t) { Throwables.propagateIfInstanceOf(t, KeeperException.NoNodeException.class); throw Throwables.propagate(t); } }
[ "private", "Set", "<", "Long", ">", "loadFromNode", "(", "String", "path", ",", "OutputStream", "out", ")", "throws", "KeeperException", ".", "NoNodeException", "{", "try", "{", "// Get the cached representation of this table", "byte", "[", "]", "data", "=", "_curator", ".", "getData", "(", ")", ".", "forPath", "(", "path", ")", ";", "DataInputStream", "in", "=", "new", "DataInputStream", "(", "new", "ByteArrayInputStream", "(", "data", ")", ")", ";", "int", "uuidCountOrExceptionCode", "=", "in", ".", "readInt", "(", ")", ";", "// A negative first integer indicates an exception condition.", "if", "(", "uuidCountOrExceptionCode", "<", "0", ")", "{", "String", "exceptionJson", "=", "new", "String", "(", "data", ",", "4", ",", "data", ".", "length", "-", "4", ",", "Charsets", ".", "UTF_8", ")", ";", "switch", "(", "uuidCountOrExceptionCode", ")", "{", "case", "UNKNOWN_TABLE", ":", "throw", "JsonHelper", ".", "fromJson", "(", "exceptionJson", ",", "UnknownTableException", ".", "class", ")", ";", "case", "DROPPED_TABLE", ":", "throw", "JsonHelper", ".", "fromJson", "(", "exceptionJson", ",", "DroppedTableException", ".", "class", ")", ";", "}", "}", "// Load the UUIDs for this table", "Set", "<", "Long", ">", "uuids", "=", "Sets", ".", "newHashSet", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "uuidCountOrExceptionCode", ";", "i", "++", ")", "{", "uuids", ".", "add", "(", "in", ".", "readLong", "(", ")", ")", ";", "}", "// Copy the remaining bytes as the content", "ByteStreams", ".", "copy", "(", "in", ",", "out", ")", ";", "return", "uuids", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "Throwables", ".", "propagateIfInstanceOf", "(", "t", ",", "KeeperException", ".", "NoNodeException", ".", "class", ")", ";", "throw", "Throwables", ".", "propagate", "(", "t", ")", ";", "}", "}" ]
Loads the table data from the path and writes it to the output stream. Returns the set of UUIDs associated with the table, just like {@link #loadAndSerialize(long, java.io.OutputStream)}.
[ "Loads", "the", "table", "data", "from", "the", "path", "and", "writes", "it", "to", "the", "output", "stream", ".", "Returns", "the", "set", "of", "UUIDs", "associated", "with", "the", "table", "just", "like", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/tableset/DistributedTableSerializer.java#L119-L151
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java
TurboProjectReader.readTask
private Task readTask(ChildTaskContainer parent, Integer id) { """ Read data for an individual task from the tables in a PEP file. @param parent parent task @param id task ID @return task instance """ Table a0 = getTable("A0TAB"); Table a1 = getTable("A1TAB"); Table a2 = getTable("A2TAB"); Table a3 = getTable("A3TAB"); Table a4 = getTable("A4TAB"); Task task = parent.addTask(); MapRow a1Row = a1.find(id); MapRow a2Row = a2.find(id); setFields(A0TAB_FIELDS, a0.find(id), task); setFields(A1TAB_FIELDS, a1Row, task); setFields(A2TAB_FIELDS, a2Row, task); setFields(A3TAB_FIELDS, a3.find(id), task); setFields(A5TAB_FIELDS, a4.find(id), task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); if (task.getName() == null) { task.setName(task.getText(1)); } m_eventManager.fireTaskReadEvent(task); return task; }
java
private Task readTask(ChildTaskContainer parent, Integer id) { Table a0 = getTable("A0TAB"); Table a1 = getTable("A1TAB"); Table a2 = getTable("A2TAB"); Table a3 = getTable("A3TAB"); Table a4 = getTable("A4TAB"); Task task = parent.addTask(); MapRow a1Row = a1.find(id); MapRow a2Row = a2.find(id); setFields(A0TAB_FIELDS, a0.find(id), task); setFields(A1TAB_FIELDS, a1Row, task); setFields(A2TAB_FIELDS, a2Row, task); setFields(A3TAB_FIELDS, a3.find(id), task); setFields(A5TAB_FIELDS, a4.find(id), task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); if (task.getName() == null) { task.setName(task.getText(1)); } m_eventManager.fireTaskReadEvent(task); return task; }
[ "private", "Task", "readTask", "(", "ChildTaskContainer", "parent", ",", "Integer", "id", ")", "{", "Table", "a0", "=", "getTable", "(", "\"A0TAB\"", ")", ";", "Table", "a1", "=", "getTable", "(", "\"A1TAB\"", ")", ";", "Table", "a2", "=", "getTable", "(", "\"A2TAB\"", ")", ";", "Table", "a3", "=", "getTable", "(", "\"A3TAB\"", ")", ";", "Table", "a4", "=", "getTable", "(", "\"A4TAB\"", ")", ";", "Task", "task", "=", "parent", ".", "addTask", "(", ")", ";", "MapRow", "a1Row", "=", "a1", ".", "find", "(", "id", ")", ";", "MapRow", "a2Row", "=", "a2", ".", "find", "(", "id", ")", ";", "setFields", "(", "A0TAB_FIELDS", ",", "a0", ".", "find", "(", "id", ")", ",", "task", ")", ";", "setFields", "(", "A1TAB_FIELDS", ",", "a1Row", ",", "task", ")", ";", "setFields", "(", "A2TAB_FIELDS", ",", "a2Row", ",", "task", ")", ";", "setFields", "(", "A3TAB_FIELDS", ",", "a3", ".", "find", "(", "id", ")", ",", "task", ")", ";", "setFields", "(", "A5TAB_FIELDS", ",", "a4", ".", "find", "(", "id", ")", ",", "task", ")", ";", "task", ".", "setStart", "(", "task", ".", "getEarlyStart", "(", ")", ")", ";", "task", ".", "setFinish", "(", "task", ".", "getEarlyFinish", "(", ")", ")", ";", "if", "(", "task", ".", "getName", "(", ")", "==", "null", ")", "{", "task", ".", "setName", "(", "task", ".", "getText", "(", "1", ")", ")", ";", "}", "m_eventManager", ".", "fireTaskReadEvent", "(", "task", ")", ";", "return", "task", ";", "}" ]
Read data for an individual task from the tables in a PEP file. @param parent parent task @param id task ID @return task instance
[ "Read", "data", "for", "an", "individual", "task", "from", "the", "tables", "in", "a", "PEP", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L370-L398
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.addEntries
public Jar addEntries(Path path, Path dirOrZip) throws IOException { """ Adds a directory (with all its subdirectories) or the contents of a zip/JAR to this JAR. @param path the path within the JAR where the root of the directory will be placed, or {@code null} for the JAR's root @param dirOrZip the directory to add as an entry or a zip/JAR file whose contents will be extracted and added as entries @return {@code this} """ return addEntries(path, dirOrZip, null); }
java
public Jar addEntries(Path path, Path dirOrZip) throws IOException { return addEntries(path, dirOrZip, null); }
[ "public", "Jar", "addEntries", "(", "Path", "path", ",", "Path", "dirOrZip", ")", "throws", "IOException", "{", "return", "addEntries", "(", "path", ",", "dirOrZip", ",", "null", ")", ";", "}" ]
Adds a directory (with all its subdirectories) or the contents of a zip/JAR to this JAR. @param path the path within the JAR where the root of the directory will be placed, or {@code null} for the JAR's root @param dirOrZip the directory to add as an entry or a zip/JAR file whose contents will be extracted and added as entries @return {@code this}
[ "Adds", "a", "directory", "(", "with", "all", "its", "subdirectories", ")", "or", "the", "contents", "of", "a", "zip", "/", "JAR", "to", "this", "JAR", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L410-L412
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJBLinkResolver.java
EJBLinkResolver.getRemoteHomeReference
private Object getRemoteHomeReference(EJSHome home, String interfaceName) throws EJBException, NoSuchObjectException { """ Encapsulates the common code and exception handling for obtaining a remote home reference (Stub) for the specified home interface, for lookup or injection. <p> @param home the internal home object of the referenced ejb. @param interfaceName the remote home interface to be injected. """ Object retObj = null; try { checkHomeSupported(home, interfaceName); EJBRuntime runtime = home.getContainer().getEJBRuntime(); runtime.checkRemoteSupported(home, interfaceName); EJSWrapper wrapper = home.getWrapper().getRemoteWrapper(); retObj = runtime.getRemoteReference(wrapper); } catch (Throwable ex) { // ClassNotFoundException, CreateException, and NoSuchObjectException // must be caught here... but basically all failures that may occur // while creating the bean instance must cause the injection to fail. FFDCFilter.processException(ex, CLASS_NAME + ".getRemoteHomeReference", "281", this); EJBException ejbex = ExceptionUtil.EJBException ("Failure obtaining remote home reference of " + home.getJ2EEName() + " of type " + interfaceName, ex); // TODO : Tr.error if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getRemoteHomeReference: " + ejbex); throw ejbex; } // This should never occur, but does cover the following 2 possibilites: // 1) one of the above factory calls returns null (unlikely) // 2) an attempt is being made to inject an MDB or 2.1 Entity (not supported) if (retObj == null) { EJBException ejbex = new EJBException ("Unable to obtain remote reference of " + home.getJ2EEName() + " of type " + interfaceName); // TODO : Tr.error if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getRemoteHomeReference: " + ejbex); throw ejbex; } return retObj; }
java
private Object getRemoteHomeReference(EJSHome home, String interfaceName) throws EJBException, NoSuchObjectException { Object retObj = null; try { checkHomeSupported(home, interfaceName); EJBRuntime runtime = home.getContainer().getEJBRuntime(); runtime.checkRemoteSupported(home, interfaceName); EJSWrapper wrapper = home.getWrapper().getRemoteWrapper(); retObj = runtime.getRemoteReference(wrapper); } catch (Throwable ex) { // ClassNotFoundException, CreateException, and NoSuchObjectException // must be caught here... but basically all failures that may occur // while creating the bean instance must cause the injection to fail. FFDCFilter.processException(ex, CLASS_NAME + ".getRemoteHomeReference", "281", this); EJBException ejbex = ExceptionUtil.EJBException ("Failure obtaining remote home reference of " + home.getJ2EEName() + " of type " + interfaceName, ex); // TODO : Tr.error if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getRemoteHomeReference: " + ejbex); throw ejbex; } // This should never occur, but does cover the following 2 possibilites: // 1) one of the above factory calls returns null (unlikely) // 2) an attempt is being made to inject an MDB or 2.1 Entity (not supported) if (retObj == null) { EJBException ejbex = new EJBException ("Unable to obtain remote reference of " + home.getJ2EEName() + " of type " + interfaceName); // TODO : Tr.error if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getRemoteHomeReference: " + ejbex); throw ejbex; } return retObj; }
[ "private", "Object", "getRemoteHomeReference", "(", "EJSHome", "home", ",", "String", "interfaceName", ")", "throws", "EJBException", ",", "NoSuchObjectException", "{", "Object", "retObj", "=", "null", ";", "try", "{", "checkHomeSupported", "(", "home", ",", "interfaceName", ")", ";", "EJBRuntime", "runtime", "=", "home", ".", "getContainer", "(", ")", ".", "getEJBRuntime", "(", ")", ";", "runtime", ".", "checkRemoteSupported", "(", "home", ",", "interfaceName", ")", ";", "EJSWrapper", "wrapper", "=", "home", ".", "getWrapper", "(", ")", ".", "getRemoteWrapper", "(", ")", ";", "retObj", "=", "runtime", ".", "getRemoteReference", "(", "wrapper", ")", ";", "}", "catch", "(", "Throwable", "ex", ")", "{", "// ClassNotFoundException, CreateException, and NoSuchObjectException", "// must be caught here... but basically all failures that may occur", "// while creating the bean instance must cause the injection to fail.", "FFDCFilter", ".", "processException", "(", "ex", ",", "CLASS_NAME", "+", "\".getRemoteHomeReference\"", ",", "\"281\"", ",", "this", ")", ";", "EJBException", "ejbex", "=", "ExceptionUtil", ".", "EJBException", "(", "\"Failure obtaining remote home reference of \"", "+", "home", ".", "getJ2EEName", "(", ")", "+", "\" of type \"", "+", "interfaceName", ",", "ex", ")", ";", "// TODO : Tr.error", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"getRemoteHomeReference: \"", "+", "ejbex", ")", ";", "throw", "ejbex", ";", "}", "// This should never occur, but does cover the following 2 possibilites:", "// 1) one of the above factory calls returns null (unlikely)", "// 2) an attempt is being made to inject an MDB or 2.1 Entity (not supported)", "if", "(", "retObj", "==", "null", ")", "{", "EJBException", "ejbex", "=", "new", "EJBException", "(", "\"Unable to obtain remote reference of \"", "+", "home", ".", "getJ2EEName", "(", ")", "+", "\" of type \"", "+", "interfaceName", ")", ";", "// TODO : Tr.error", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"getRemoteHomeReference: \"", "+", "ejbex", ")", ";", "throw", "ejbex", ";", "}", "return", "retObj", ";", "}" ]
Encapsulates the common code and exception handling for obtaining a remote home reference (Stub) for the specified home interface, for lookup or injection. <p> @param home the internal home object of the referenced ejb. @param interfaceName the remote home interface to be injected.
[ "Encapsulates", "the", "common", "code", "and", "exception", "handling", "for", "obtaining", "a", "remote", "home", "reference", "(", "Stub", ")", "for", "the", "specified", "home", "interface", "for", "lookup", "or", "injection", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJBLinkResolver.java#L588-L635
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java
DataContextUtils.replaceDataReferencesInString
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data, final Converter<String, String> converter, boolean failOnUnexpanded) { """ Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context @param input input string @param data data context map @param converter converter to encode/convert the expanded values @param failOnUnexpanded true to fail if a reference is not found @return string with values substituted, or original string """ return replaceDataReferencesInString(input, data, converter, failOnUnexpanded, false); }
java
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data, final Converter<String, String> converter, boolean failOnUnexpanded) { return replaceDataReferencesInString(input, data, converter, failOnUnexpanded, false); }
[ "public", "static", "String", "replaceDataReferencesInString", "(", "final", "String", "input", ",", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "data", ",", "final", "Converter", "<", "String", ",", "String", ">", "converter", ",", "boolean", "failOnUnexpanded", ")", "{", "return", "replaceDataReferencesInString", "(", "input", ",", "data", ",", "converter", ",", "failOnUnexpanded", ",", "false", ")", ";", "}" ]
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context @param input input string @param data data context map @param converter converter to encode/convert the expanded values @param failOnUnexpanded true to fail if a reference is not found @return string with values substituted, or original string
[ "Replace", "the", "embedded", "properties", "of", "the", "form", "$", "{", "key", ".", "name", "}", "in", "the", "input", "Strings", "with", "the", "value", "from", "the", "data", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L285-L288
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java
AnnotationUtils.findAnnotation
public static <T extends Annotation> T findAnnotation(Method m, Class<?> clazz, Class<T> annotationClazz) { """ Returns the annotation object for the specified annotation class of either the method if it can be found, or of the given class object. First the annotation is searched via the method {@link #findAnnotation(java.lang.reflect.Method, java.lang.Class) }. If the annotation can not be found, the method {@link #findAnnotation(java.lang.Class, java.lang.Class) } is used to find the annotation on class level. @param <T> The annotation type @param m The method in which to look for the annotation @param clazz The class in which to look for the annotation if it can not be found on method level @param annotationClazz The type of the annotation to look for @return The annotation with the given type if found, otherwise null """ final T result = findAnnotation(m, annotationClazz); return result != null ? result : findAnnotation(clazz, annotationClazz); }
java
public static <T extends Annotation> T findAnnotation(Method m, Class<?> clazz, Class<T> annotationClazz) { final T result = findAnnotation(m, annotationClazz); return result != null ? result : findAnnotation(clazz, annotationClazz); }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "T", "findAnnotation", "(", "Method", "m", ",", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "T", ">", "annotationClazz", ")", "{", "final", "T", "result", "=", "findAnnotation", "(", "m", ",", "annotationClazz", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "findAnnotation", "(", "clazz", ",", "annotationClazz", ")", ";", "}" ]
Returns the annotation object for the specified annotation class of either the method if it can be found, or of the given class object. First the annotation is searched via the method {@link #findAnnotation(java.lang.reflect.Method, java.lang.Class) }. If the annotation can not be found, the method {@link #findAnnotation(java.lang.Class, java.lang.Class) } is used to find the annotation on class level. @param <T> The annotation type @param m The method in which to look for the annotation @param clazz The class in which to look for the annotation if it can not be found on method level @param annotationClazz The type of the annotation to look for @return The annotation with the given type if found, otherwise null
[ "Returns", "the", "annotation", "object", "for", "the", "specified", "annotation", "class", "of", "either", "the", "method", "if", "it", "can", "be", "found", "or", "of", "the", "given", "class", "object", ".", "First", "the", "annotation", "is", "searched", "via", "the", "method", "{", "@link", "#findAnnotation", "(", "java", ".", "lang", ".", "reflect", ".", "Method", "java", ".", "lang", ".", "Class", ")", "}", ".", "If", "the", "annotation", "can", "not", "be", "found", "the", "method", "{", "@link", "#findAnnotation", "(", "java", ".", "lang", ".", "Class", "java", ".", "lang", ".", "Class", ")", "}", "is", "used", "to", "find", "the", "annotation", "on", "class", "level", "." ]
train
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java#L148-L151
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java
StringSupport.writeToOutputStream
public static void writeToOutputStream(String s, OutputStream output) throws IOException { """ Writes the contents of a string to an output stream. @param s @param output @throws IOException """ writeToOutputStream(s, output, null); }
java
public static void writeToOutputStream(String s, OutputStream output) throws IOException { writeToOutputStream(s, output, null); }
[ "public", "static", "void", "writeToOutputStream", "(", "String", "s", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "writeToOutputStream", "(", "s", ",", "output", ",", "null", ")", ";", "}" ]
Writes the contents of a string to an output stream. @param s @param output @throws IOException
[ "Writes", "the", "contents", "of", "a", "string", "to", "an", "output", "stream", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L471-L473
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/XMLUtils.java
XMLUtils.formatXMLContent
public static String formatXMLContent(String content) throws TransformerFactoryConfigurationError, TransformerException { """ Parse and pretty print a XML content. @param content the XML content to format @return the formated version of the passed XML content @throws TransformerFactoryConfigurationError when failing to create a {@link TransformerFactoryConfigurationError} @throws TransformerException when failing to transform the content @since 5.2M1 """ Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); StreamResult result = new StreamResult(new StringWriter()); // Use a SAX Source instead of a StreamSource so that we can control the XMLReader used and set up one that // doesn't resolve entities (and thus doesn't go out on the internet to fetch DTDs!). SAXSource source = new SAXSource(new InputSource(new StringReader(content))); try { XMLReader reader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); reader.setEntityResolver(new org.xml.sax.EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // Return an empty resolved entity. Note that we don't return null since this would tell the reader // to go on the internet to fetch the DTD. return new InputSource(new StringReader("")); } }); source.setXMLReader(reader); } catch (Exception e) { throw new TransformerException(String.format( "Failed to create XML Reader while pretty-printing content [%s]", content), e); } transformer.transform(source, result); return result.getWriter().toString(); }
java
public static String formatXMLContent(String content) throws TransformerFactoryConfigurationError, TransformerException { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); StreamResult result = new StreamResult(new StringWriter()); // Use a SAX Source instead of a StreamSource so that we can control the XMLReader used and set up one that // doesn't resolve entities (and thus doesn't go out on the internet to fetch DTDs!). SAXSource source = new SAXSource(new InputSource(new StringReader(content))); try { XMLReader reader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); reader.setEntityResolver(new org.xml.sax.EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // Return an empty resolved entity. Note that we don't return null since this would tell the reader // to go on the internet to fetch the DTD. return new InputSource(new StringReader("")); } }); source.setXMLReader(reader); } catch (Exception e) { throw new TransformerException(String.format( "Failed to create XML Reader while pretty-printing content [%s]", content), e); } transformer.transform(source, result); return result.getWriter().toString(); }
[ "public", "static", "String", "formatXMLContent", "(", "String", "content", ")", "throws", "TransformerFactoryConfigurationError", ",", "TransformerException", "{", "Transformer", "transformer", "=", "TransformerFactory", ".", "newInstance", "(", ")", ".", "newTransformer", "(", ")", ";", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "\"yes\"", ")", ";", "transformer", ".", "setOutputProperty", "(", "\"{http://xml.apache.org/xslt}indent-amount\"", ",", "\"2\"", ")", ";", "StreamResult", "result", "=", "new", "StreamResult", "(", "new", "StringWriter", "(", ")", ")", ";", "// Use a SAX Source instead of a StreamSource so that we can control the XMLReader used and set up one that", "// doesn't resolve entities (and thus doesn't go out on the internet to fetch DTDs!).", "SAXSource", "source", "=", "new", "SAXSource", "(", "new", "InputSource", "(", "new", "StringReader", "(", "content", ")", ")", ")", ";", "try", "{", "XMLReader", "reader", "=", "org", ".", "xml", ".", "sax", ".", "helpers", ".", "XMLReaderFactory", ".", "createXMLReader", "(", ")", ";", "reader", ".", "setEntityResolver", "(", "new", "org", ".", "xml", ".", "sax", ".", "EntityResolver", "(", ")", "{", "@", "Override", "public", "InputSource", "resolveEntity", "(", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", ",", "IOException", "{", "// Return an empty resolved entity. Note that we don't return null since this would tell the reader", "// to go on the internet to fetch the DTD.", "return", "new", "InputSource", "(", "new", "StringReader", "(", "\"\"", ")", ")", ";", "}", "}", ")", ";", "source", ".", "setXMLReader", "(", "reader", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "TransformerException", "(", "String", ".", "format", "(", "\"Failed to create XML Reader while pretty-printing content [%s]\"", ",", "content", ")", ",", "e", ")", ";", "}", "transformer", ".", "transform", "(", "source", ",", "result", ")", ";", "return", "result", ".", "getWriter", "(", ")", ".", "toString", "(", ")", ";", "}" ]
Parse and pretty print a XML content. @param content the XML content to format @return the formated version of the passed XML content @throws TransformerFactoryConfigurationError when failing to create a {@link TransformerFactoryConfigurationError} @throws TransformerException when failing to transform the content @since 5.2M1
[ "Parse", "and", "pretty", "print", "a", "XML", "content", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/XMLUtils.java#L450-L483
mgormley/pacaya
src/main/java/edu/jhu/pacaya/autodiff/Toposort.java
Toposort.checkIsFullCut
public static <T> void checkIsFullCut(Set<T> inputSet, T root, Deps<T> deps) { """ Checks that the given inputSet defines a full cut through the graph rooted at the given root. """ // Check that the input set defines a full cut through the graph with outMod as root. HashSet<T> visited = new HashSet<T>(); // Mark the inputSet as visited. If it is a valid leaf set, then leaves will be empty upon // completion of the DFS. visited.addAll(inputSet); HashSet<T> leaves = dfs(root, visited, deps); if (leaves.size() != 0) { throw new IllegalStateException("Input set is not a valid leaf set for the given output module. Extra leaves: " + leaves); } }
java
public static <T> void checkIsFullCut(Set<T> inputSet, T root, Deps<T> deps) { // Check that the input set defines a full cut through the graph with outMod as root. HashSet<T> visited = new HashSet<T>(); // Mark the inputSet as visited. If it is a valid leaf set, then leaves will be empty upon // completion of the DFS. visited.addAll(inputSet); HashSet<T> leaves = dfs(root, visited, deps); if (leaves.size() != 0) { throw new IllegalStateException("Input set is not a valid leaf set for the given output module. Extra leaves: " + leaves); } }
[ "public", "static", "<", "T", ">", "void", "checkIsFullCut", "(", "Set", "<", "T", ">", "inputSet", ",", "T", "root", ",", "Deps", "<", "T", ">", "deps", ")", "{", "// Check that the input set defines a full cut through the graph with outMod as root.", "HashSet", "<", "T", ">", "visited", "=", "new", "HashSet", "<", "T", ">", "(", ")", ";", "// Mark the inputSet as visited. If it is a valid leaf set, then leaves will be empty upon", "// completion of the DFS.", "visited", ".", "addAll", "(", "inputSet", ")", ";", "HashSet", "<", "T", ">", "leaves", "=", "dfs", "(", "root", ",", "visited", ",", "deps", ")", ";", "if", "(", "leaves", ".", "size", "(", ")", "!=", "0", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Input set is not a valid leaf set for the given output module. Extra leaves: \"", "+", "leaves", ")", ";", "}", "}" ]
Checks that the given inputSet defines a full cut through the graph rooted at the given root.
[ "Checks", "that", "the", "given", "inputSet", "defines", "a", "full", "cut", "through", "the", "graph", "rooted", "at", "the", "given", "root", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/Toposort.java#L128-L138
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.appendDocumentXmlDeclaration
protected boolean appendDocumentXmlDeclaration(StringBuilder sb, Document doc) { """ Appends the XML declaration for {@link #getShortString} or {@link #appendFullDocumentHeader} if it contains non-default values. @param sb the builder to append to @return true if the XML declaration has been appended @since XMLUnit 2.4.0 """ if ("1.0".equals(doc.getXmlVersion()) && doc.getXmlEncoding() == null && !doc.getXmlStandalone()) { // only default values => ignore return false; } sb.append("<?xml version=\""); sb.append(doc.getXmlVersion()); sb.append("\""); if (doc.getXmlEncoding() != null) { sb.append(" encoding=\""); sb.append(doc.getXmlEncoding()); sb.append("\""); } if (doc.getXmlStandalone()) { sb.append(" standalone=\"yes\""); } sb.append("?>"); return true; }
java
protected boolean appendDocumentXmlDeclaration(StringBuilder sb, Document doc) { if ("1.0".equals(doc.getXmlVersion()) && doc.getXmlEncoding() == null && !doc.getXmlStandalone()) { // only default values => ignore return false; } sb.append("<?xml version=\""); sb.append(doc.getXmlVersion()); sb.append("\""); if (doc.getXmlEncoding() != null) { sb.append(" encoding=\""); sb.append(doc.getXmlEncoding()); sb.append("\""); } if (doc.getXmlStandalone()) { sb.append(" standalone=\"yes\""); } sb.append("?>"); return true; }
[ "protected", "boolean", "appendDocumentXmlDeclaration", "(", "StringBuilder", "sb", ",", "Document", "doc", ")", "{", "if", "(", "\"1.0\"", ".", "equals", "(", "doc", ".", "getXmlVersion", "(", ")", ")", "&&", "doc", ".", "getXmlEncoding", "(", ")", "==", "null", "&&", "!", "doc", ".", "getXmlStandalone", "(", ")", ")", "{", "// only default values => ignore", "return", "false", ";", "}", "sb", ".", "append", "(", "\"<?xml version=\\\"\"", ")", ";", "sb", ".", "append", "(", "doc", ".", "getXmlVersion", "(", ")", ")", ";", "sb", ".", "append", "(", "\"\\\"\"", ")", ";", "if", "(", "doc", ".", "getXmlEncoding", "(", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "\" encoding=\\\"\"", ")", ";", "sb", ".", "append", "(", "doc", ".", "getXmlEncoding", "(", ")", ")", ";", "sb", ".", "append", "(", "\"\\\"\"", ")", ";", "}", "if", "(", "doc", ".", "getXmlStandalone", "(", ")", ")", "{", "sb", ".", "append", "(", "\" standalone=\\\"yes\\\"\"", ")", ";", "}", "sb", ".", "append", "(", "\"?>\"", ")", ";", "return", "true", ";", "}" ]
Appends the XML declaration for {@link #getShortString} or {@link #appendFullDocumentHeader} if it contains non-default values. @param sb the builder to append to @return true if the XML declaration has been appended @since XMLUnit 2.4.0
[ "Appends", "the", "XML", "declaration", "for", "{", "@link", "#getShortString", "}", "or", "{", "@link", "#appendFullDocumentHeader", "}", "if", "it", "contains", "non", "-", "default", "values", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L176-L194
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/ColumnLayout.java
ColumnLayout.setAlignment
public void setAlignment(final int col, final Alignment alignment) { """ Sets the alignment of the given column. An IndexOutOfBoundsException will be thrown if col is out of bounds. @param col the index of the column to set the alignment of. @param alignment the alignment to set. """ columnAlignments[col] = alignment == null ? Alignment.LEFT : alignment; }
java
public void setAlignment(final int col, final Alignment alignment) { columnAlignments[col] = alignment == null ? Alignment.LEFT : alignment; }
[ "public", "void", "setAlignment", "(", "final", "int", "col", ",", "final", "Alignment", "alignment", ")", "{", "columnAlignments", "[", "col", "]", "=", "alignment", "==", "null", "?", "Alignment", ".", "LEFT", ":", "alignment", ";", "}" ]
Sets the alignment of the given column. An IndexOutOfBoundsException will be thrown if col is out of bounds. @param col the index of the column to set the alignment of. @param alignment the alignment to set.
[ "Sets", "the", "alignment", "of", "the", "given", "column", ".", "An", "IndexOutOfBoundsException", "will", "be", "thrown", "if", "col", "is", "out", "of", "bounds", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/ColumnLayout.java#L188-L190
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GraphEditorWindow.java
GraphEditorWindow.main
public static void main(String[] argv) { """ Simple test case for the gradient painter @param argv The arguments supplied at the command line """ JFrame frame = new JFrame("Whiskas Gradient Editor"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); main.setBackground(Color.CYAN); frame.getContentPane().add(main); // GraphEditorWindow bottom = new GraphEditorWindow(); ArrayList curve = new ArrayList(); curve.add(new Vector2f(0.0f, 0.0f)); curve.add(new Vector2f(1.0f, 255.0f)); LinearInterpolator test = new ConfigurableEmitter("bla").new LinearInterpolator( curve, 0, 255); bottom.registerValue(test, "Test"); curve = new ArrayList(); curve.add(new Vector2f(0.0f, 255.0f)); curve.add(new Vector2f(1.0f, 0.0f)); test = new ConfigurableEmitter("bla").new LinearInterpolator(curve, 0, 255); bottom.registerValue(test, "Test 2"); main.add(bottom); frame.pack(); frame.setVisible(true); frame.setSize(600, 300); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); }
java
public static void main(String[] argv) { JFrame frame = new JFrame("Whiskas Gradient Editor"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); main.setBackground(Color.CYAN); frame.getContentPane().add(main); // GraphEditorWindow bottom = new GraphEditorWindow(); ArrayList curve = new ArrayList(); curve.add(new Vector2f(0.0f, 0.0f)); curve.add(new Vector2f(1.0f, 255.0f)); LinearInterpolator test = new ConfigurableEmitter("bla").new LinearInterpolator( curve, 0, 255); bottom.registerValue(test, "Test"); curve = new ArrayList(); curve.add(new Vector2f(0.0f, 255.0f)); curve.add(new Vector2f(1.0f, 0.0f)); test = new ConfigurableEmitter("bla").new LinearInterpolator(curve, 0, 255); bottom.registerValue(test, "Test 2"); main.add(bottom); frame.pack(); frame.setVisible(true); frame.setSize(600, 300); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "argv", ")", "{", "JFrame", "frame", "=", "new", "JFrame", "(", "\"Whiskas Gradient Editor\"", ")", ";", "frame", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "EXIT_ON_CLOSE", ")", ";", "JPanel", "main", "=", "new", "JPanel", "(", ")", ";", "main", ".", "setLayout", "(", "new", "BoxLayout", "(", "main", ",", "BoxLayout", ".", "Y_AXIS", ")", ")", ";", "main", ".", "setBackground", "(", "Color", ".", "CYAN", ")", ";", "frame", ".", "getContentPane", "(", ")", ".", "add", "(", "main", ")", ";", "//\r", "GraphEditorWindow", "bottom", "=", "new", "GraphEditorWindow", "(", ")", ";", "ArrayList", "curve", "=", "new", "ArrayList", "(", ")", ";", "curve", ".", "add", "(", "new", "Vector2f", "(", "0.0f", ",", "0.0f", ")", ")", ";", "curve", ".", "add", "(", "new", "Vector2f", "(", "1.0f", ",", "255.0f", ")", ")", ";", "LinearInterpolator", "test", "=", "new", "ConfigurableEmitter", "(", "\"bla\"", ")", ".", "new", "LinearInterpolator", "(", "curve", ",", "0", ",", "255", ")", ";", "bottom", ".", "registerValue", "(", "test", ",", "\"Test\"", ")", ";", "curve", "=", "new", "ArrayList", "(", ")", ";", "curve", ".", "add", "(", "new", "Vector2f", "(", "0.0f", ",", "255.0f", ")", ")", ";", "curve", ".", "add", "(", "new", "Vector2f", "(", "1.0f", ",", "0.0f", ")", ")", ";", "test", "=", "new", "ConfigurableEmitter", "(", "\"bla\"", ")", ".", "new", "LinearInterpolator", "(", "curve", ",", "0", ",", "255", ")", ";", "bottom", ".", "registerValue", "(", "test", ",", "\"Test 2\"", ")", ";", "main", ".", "add", "(", "bottom", ")", ";", "frame", ".", "pack", "(", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "frame", ".", "setSize", "(", "600", ",", "300", ")", ";", "frame", ".", "addWindowListener", "(", "new", "WindowAdapter", "(", ")", "{", "public", "void", "windowClosing", "(", "WindowEvent", "e", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "}", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "}" ]
Simple test case for the gradient painter @param argv The arguments supplied at the command line
[ "Simple", "test", "case", "for", "the", "gradient", "painter" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GraphEditorWindow.java#L1094-L1132
mangstadt/biweekly
src/main/java/biweekly/util/com/google/ical/iter/Generators.java
Generators.serialYearGenerator
static ThrottledGenerator serialYearGenerator(final int interval, final DateValue dtStart) { """ Constructs a generator that generates years successively counting from the first year passed in. @param interval number of years to advance each step @param dtStart the start date @return the year in dtStart the first time called and interval + last return value on subsequent calls """ return new ThrottledGenerator() { //the last year seen int year = dtStart.year() - interval; int throttle = MAX_YEARS_BETWEEN_INSTANCES; @Override boolean generate(DTBuilder builder) throws IteratorShortCircuitingException { /* * Make sure things halt even if the RRULE is bad. For example, * the following rules should halt: * * FREQ=YEARLY;BYMONTHDAY=30;BYMONTH=2 */ if (--throttle < 0) { throw IteratorShortCircuitingException.instance(); } year += interval; builder.year = year; return true; } @Override void workDone() { this.throttle = MAX_YEARS_BETWEEN_INSTANCES; } @Override public String toString() { return "serialYearGenerator:" + interval; } }; }
java
static ThrottledGenerator serialYearGenerator(final int interval, final DateValue dtStart) { return new ThrottledGenerator() { //the last year seen int year = dtStart.year() - interval; int throttle = MAX_YEARS_BETWEEN_INSTANCES; @Override boolean generate(DTBuilder builder) throws IteratorShortCircuitingException { /* * Make sure things halt even if the RRULE is bad. For example, * the following rules should halt: * * FREQ=YEARLY;BYMONTHDAY=30;BYMONTH=2 */ if (--throttle < 0) { throw IteratorShortCircuitingException.instance(); } year += interval; builder.year = year; return true; } @Override void workDone() { this.throttle = MAX_YEARS_BETWEEN_INSTANCES; } @Override public String toString() { return "serialYearGenerator:" + interval; } }; }
[ "static", "ThrottledGenerator", "serialYearGenerator", "(", "final", "int", "interval", ",", "final", "DateValue", "dtStart", ")", "{", "return", "new", "ThrottledGenerator", "(", ")", "{", "//the last year seen", "int", "year", "=", "dtStart", ".", "year", "(", ")", "-", "interval", ";", "int", "throttle", "=", "MAX_YEARS_BETWEEN_INSTANCES", ";", "@", "Override", "boolean", "generate", "(", "DTBuilder", "builder", ")", "throws", "IteratorShortCircuitingException", "{", "/*\n\t\t\t\t * Make sure things halt even if the RRULE is bad. For example,\n\t\t\t\t * the following rules should halt:\n\t\t\t\t * \n\t\t\t\t * FREQ=YEARLY;BYMONTHDAY=30;BYMONTH=2\n\t\t\t\t */", "if", "(", "--", "throttle", "<", "0", ")", "{", "throw", "IteratorShortCircuitingException", ".", "instance", "(", ")", ";", "}", "year", "+=", "interval", ";", "builder", ".", "year", "=", "year", ";", "return", "true", ";", "}", "@", "Override", "void", "workDone", "(", ")", "{", "this", ".", "throttle", "=", "MAX_YEARS_BETWEEN_INSTANCES", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"serialYearGenerator:\"", "+", "interval", ";", "}", "}", ";", "}" ]
Constructs a generator that generates years successively counting from the first year passed in. @param interval number of years to advance each step @param dtStart the start date @return the year in dtStart the first time called and interval + last return value on subsequent calls
[ "Constructs", "a", "generator", "that", "generates", "years", "successively", "counting", "from", "the", "first", "year", "passed", "in", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/Generators.java#L80-L113
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.expectPrivate
@SuppressWarnings("all") public static synchronized <T> IExpectationSetters<T> expectPrivate(Object instance, String methodName, Class<?>[] parameterTypes, Object... arguments) throws Exception { """ Used to specify expectations on private methods. Use this method to handle overloaded methods. """ if (arguments == null) { arguments = new Object[0]; } if (instance == null) { throw new IllegalArgumentException("instance cannot be null."); } else if (arguments.length != parameterTypes.length) { throw new IllegalArgumentException( "The length of the arguments must be equal to the number of parameter types."); } Method foundMethod = Whitebox.getMethod(instance.getClass(), methodName, parameterTypes); WhiteboxImpl.throwExceptionIfMethodWasNotFound(instance.getClass(), methodName, foundMethod, parameterTypes); return doExpectPrivate(instance, foundMethod, arguments); }
java
@SuppressWarnings("all") public static synchronized <T> IExpectationSetters<T> expectPrivate(Object instance, String methodName, Class<?>[] parameterTypes, Object... arguments) throws Exception { if (arguments == null) { arguments = new Object[0]; } if (instance == null) { throw new IllegalArgumentException("instance cannot be null."); } else if (arguments.length != parameterTypes.length) { throw new IllegalArgumentException( "The length of the arguments must be equal to the number of parameter types."); } Method foundMethod = Whitebox.getMethod(instance.getClass(), methodName, parameterTypes); WhiteboxImpl.throwExceptionIfMethodWasNotFound(instance.getClass(), methodName, foundMethod, parameterTypes); return doExpectPrivate(instance, foundMethod, arguments); }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "static", "synchronized", "<", "T", ">", "IExpectationSetters", "<", "T", ">", "expectPrivate", "(", "Object", "instance", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ",", "Object", "...", "arguments", ")", "throws", "Exception", "{", "if", "(", "arguments", "==", "null", ")", "{", "arguments", "=", "new", "Object", "[", "0", "]", ";", "}", "if", "(", "instance", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"instance cannot be null.\"", ")", ";", "}", "else", "if", "(", "arguments", ".", "length", "!=", "parameterTypes", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The length of the arguments must be equal to the number of parameter types.\"", ")", ";", "}", "Method", "foundMethod", "=", "Whitebox", ".", "getMethod", "(", "instance", ".", "getClass", "(", ")", ",", "methodName", ",", "parameterTypes", ")", ";", "WhiteboxImpl", ".", "throwExceptionIfMethodWasNotFound", "(", "instance", ".", "getClass", "(", ")", ",", "methodName", ",", "foundMethod", ",", "parameterTypes", ")", ";", "return", "doExpectPrivate", "(", "instance", ",", "foundMethod", ",", "arguments", ")", ";", "}" ]
Used to specify expectations on private methods. Use this method to handle overloaded methods.
[ "Used", "to", "specify", "expectations", "on", "private", "methods", ".", "Use", "this", "method", "to", "handle", "overloaded", "methods", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1158-L1178
GerdHolz/TOVAL
src/de/invation/code/toval/validate/Validate.java
Validate.notEmpty
public static void notEmpty(String string, String message) { """ Checks if the given String is empty. @param string The String to validate. @param message The error message to include in the Exception in case the validation fails. @throws ParameterException if the given String is empty. """ if(!validation) return; notNull(message); notNull(string, message); if(string.length() == 0) throw new ParameterException(ErrorCode.EMPTY, message); }
java
public static void notEmpty(String string, String message) { if(!validation) return; notNull(message); notNull(string, message); if(string.length() == 0) throw new ParameterException(ErrorCode.EMPTY, message); }
[ "public", "static", "void", "notEmpty", "(", "String", "string", ",", "String", "message", ")", "{", "if", "(", "!", "validation", ")", "return", ";", "notNull", "(", "message", ")", ";", "notNull", "(", "string", ",", "message", ")", ";", "if", "(", "string", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "ParameterException", "(", "ErrorCode", ".", "EMPTY", ",", "message", ")", ";", "}" ]
Checks if the given String is empty. @param string The String to validate. @param message The error message to include in the Exception in case the validation fails. @throws ParameterException if the given String is empty.
[ "Checks", "if", "the", "given", "String", "is", "empty", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L125-L131
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCustomPrebuiltDomain
public OperationStatus deleteCustomPrebuiltDomain(UUID appId, String versionId, String domainName) { """ Deletes a prebuilt domain's models from the application. @param appId The application ID. @param versionId The version ID. @param domainName Domain name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return deleteCustomPrebuiltDomainWithServiceResponseAsync(appId, versionId, domainName).toBlocking().single().body(); }
java
public OperationStatus deleteCustomPrebuiltDomain(UUID appId, String versionId, String domainName) { return deleteCustomPrebuiltDomainWithServiceResponseAsync(appId, versionId, domainName).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteCustomPrebuiltDomain", "(", "UUID", "appId", ",", "String", "versionId", ",", "String", "domainName", ")", "{", "return", "deleteCustomPrebuiltDomainWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "domainName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Deletes a prebuilt domain's models from the application. @param appId The application ID. @param versionId The version ID. @param domainName Domain name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Deletes", "a", "prebuilt", "domain", "s", "models", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6149-L6151
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/SortedList.java
SortedList.updateItemAt
public void updateItemAt(int index, T item) { """ Updates the item at the given index and calls {@link Callback#onChanged(int, int)} and/or {@link Callback#onMoved(int, int)} if necessary. <p> You can use this method if you need to change an existing Item such that its position in the list may change. <p> If the new object is a different object (<code>get(index) != item</code>) and {@link Callback#areContentsTheSame(Object, Object)} returns <code>true</code>, SortedList avoids calling {@link Callback#onChanged(int, int)} otherwise it calls {@link Callback#onChanged(int, int)}. <p> If the new position of the item is different than the provided <code>index</code>, SortedList calls {@link Callback#onMoved(int, int)}. @param index The index of the item to replace @param item The item to replace the item at the given Index. @see #add(Object) """ final T existing = get(index); // assume changed if the same object is given back boolean contentsChanged = existing == item || !mCallback.areContentsTheSame(existing, item); if (existing != item) { // different items, we can use comparison and may avoid lookup final int cmp = mCallback.compare(existing, item); if (cmp == 0) { mData[index] = item; if (contentsChanged) { mCallback.onChanged(index, 1); } return; } } if (contentsChanged) { mCallback.onChanged(index, 1); } // TODO this done in 1 pass to avoid shifting twice. removeItemAtIndex(index, false); int newIndex = add(item, false); if (index != newIndex) { mCallback.onMoved(index, newIndex); } }
java
public void updateItemAt(int index, T item) { final T existing = get(index); // assume changed if the same object is given back boolean contentsChanged = existing == item || !mCallback.areContentsTheSame(existing, item); if (existing != item) { // different items, we can use comparison and may avoid lookup final int cmp = mCallback.compare(existing, item); if (cmp == 0) { mData[index] = item; if (contentsChanged) { mCallback.onChanged(index, 1); } return; } } if (contentsChanged) { mCallback.onChanged(index, 1); } // TODO this done in 1 pass to avoid shifting twice. removeItemAtIndex(index, false); int newIndex = add(item, false); if (index != newIndex) { mCallback.onMoved(index, newIndex); } }
[ "public", "void", "updateItemAt", "(", "int", "index", ",", "T", "item", ")", "{", "final", "T", "existing", "=", "get", "(", "index", ")", ";", "// assume changed if the same object is given back", "boolean", "contentsChanged", "=", "existing", "==", "item", "||", "!", "mCallback", ".", "areContentsTheSame", "(", "existing", ",", "item", ")", ";", "if", "(", "existing", "!=", "item", ")", "{", "// different items, we can use comparison and may avoid lookup", "final", "int", "cmp", "=", "mCallback", ".", "compare", "(", "existing", ",", "item", ")", ";", "if", "(", "cmp", "==", "0", ")", "{", "mData", "[", "index", "]", "=", "item", ";", "if", "(", "contentsChanged", ")", "{", "mCallback", ".", "onChanged", "(", "index", ",", "1", ")", ";", "}", "return", ";", "}", "}", "if", "(", "contentsChanged", ")", "{", "mCallback", ".", "onChanged", "(", "index", ",", "1", ")", ";", "}", "// TODO this done in 1 pass to avoid shifting twice.", "removeItemAtIndex", "(", "index", ",", "false", ")", ";", "int", "newIndex", "=", "add", "(", "item", ",", "false", ")", ";", "if", "(", "index", "!=", "newIndex", ")", "{", "mCallback", ".", "onMoved", "(", "index", ",", "newIndex", ")", ";", "}", "}" ]
Updates the item at the given index and calls {@link Callback#onChanged(int, int)} and/or {@link Callback#onMoved(int, int)} if necessary. <p> You can use this method if you need to change an existing Item such that its position in the list may change. <p> If the new object is a different object (<code>get(index) != item</code>) and {@link Callback#areContentsTheSame(Object, Object)} returns <code>true</code>, SortedList avoids calling {@link Callback#onChanged(int, int)} otherwise it calls {@link Callback#onChanged(int, int)}. <p> If the new position of the item is different than the provided <code>index</code>, SortedList calls {@link Callback#onMoved(int, int)}. @param index The index of the item to replace @param item The item to replace the item at the given Index. @see #add(Object)
[ "Updates", "the", "item", "at", "the", "given", "index", "and", "calls", "{", "@link", "Callback#onChanged", "(", "int", "int", ")", "}", "and", "/", "or", "{", "@link", "Callback#onMoved", "(", "int", "int", ")", "}", "if", "necessary", ".", "<p", ">", "You", "can", "use", "this", "method", "if", "you", "need", "to", "change", "an", "existing", "Item", "such", "that", "its", "position", "in", "the", "list", "may", "change", ".", "<p", ">", "If", "the", "new", "object", "is", "a", "different", "object", "(", "<code", ">", "get", "(", "index", ")", "!", "=", "item<", "/", "code", ">", ")", "and", "{", "@link", "Callback#areContentsTheSame", "(", "Object", "Object", ")", "}", "returns", "<code", ">", "true<", "/", "code", ">", "SortedList", "avoids", "calling", "{", "@link", "Callback#onChanged", "(", "int", "int", ")", "}", "otherwise", "it", "calls", "{", "@link", "Callback#onChanged", "(", "int", "int", ")", "}", ".", "<p", ">", "If", "the", "new", "position", "of", "the", "item", "is", "different", "than", "the", "provided", "<code", ">", "index<", "/", "code", ">", "SortedList", "calls", "{", "@link", "Callback#onMoved", "(", "int", "int", ")", "}", "." ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/SortedList.java#L268-L292
UrielCh/ovh-java-sdk
ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java
ApiOvhPrice.xdsl_options_installation_option_GET
public OvhPrice xdsl_options_installation_option_GET(net.minidev.ovh.api.price.xdsl.options.OvhInstallationEnum option) throws IOException { """ Get the price of options installation fee REST: GET /price/xdsl/options/installation/{option} @param option [required] The option """ String qPath = "/price/xdsl/options/installation/{option}"; StringBuilder sb = path(qPath, option); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
java
public OvhPrice xdsl_options_installation_option_GET(net.minidev.ovh.api.price.xdsl.options.OvhInstallationEnum option) throws IOException { String qPath = "/price/xdsl/options/installation/{option}"; StringBuilder sb = path(qPath, option); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
[ "public", "OvhPrice", "xdsl_options_installation_option_GET", "(", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "price", ".", "xdsl", ".", "options", ".", "OvhInstallationEnum", "option", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/price/xdsl/options/installation/{option}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "option", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhPrice", ".", "class", ")", ";", "}" ]
Get the price of options installation fee REST: GET /price/xdsl/options/installation/{option} @param option [required] The option
[ "Get", "the", "price", "of", "options", "installation", "fee" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L76-L81
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/MapImpl.java
MapImpl.setMapController
public void setMapController(MapController mapController) { """ Apply a new {@link MapController} on the map. This controller will handle all mouse-events that are global for the map. Only one controller can be set at any given time. When a controller is active on the map, using this method, any fall-back controller is automatically disabled. @param mapController The new {@link MapController} object. If null is passed, then the active controller is again disabled. At that time the fall-back controller is again activated. """ if (mapController != null) { mapController.setMap(this); mapWidget.setController(new JsController(mapWidget, mapController)); } else { mapWidget.setController(null); } }
java
public void setMapController(MapController mapController) { if (mapController != null) { mapController.setMap(this); mapWidget.setController(new JsController(mapWidget, mapController)); } else { mapWidget.setController(null); } }
[ "public", "void", "setMapController", "(", "MapController", "mapController", ")", "{", "if", "(", "mapController", "!=", "null", ")", "{", "mapController", ".", "setMap", "(", "this", ")", ";", "mapWidget", ".", "setController", "(", "new", "JsController", "(", "mapWidget", ",", "mapController", ")", ")", ";", "}", "else", "{", "mapWidget", ".", "setController", "(", "null", ")", ";", "}", "}" ]
Apply a new {@link MapController} on the map. This controller will handle all mouse-events that are global for the map. Only one controller can be set at any given time. When a controller is active on the map, using this method, any fall-back controller is automatically disabled. @param mapController The new {@link MapController} object. If null is passed, then the active controller is again disabled. At that time the fall-back controller is again activated.
[ "Apply", "a", "new", "{", "@link", "MapController", "}", "on", "the", "map", ".", "This", "controller", "will", "handle", "all", "mouse", "-", "events", "that", "are", "global", "for", "the", "map", ".", "Only", "one", "controller", "can", "be", "set", "at", "any", "given", "time", ".", "When", "a", "controller", "is", "active", "on", "the", "map", "using", "this", "method", "any", "fall", "-", "back", "controller", "is", "automatically", "disabled", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/MapImpl.java#L133-L140
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java
LocalUnitsManager.searchUnitMap
public static void searchUnitMap(Consumer<Map<String, Unit>> consumer) { """ Iterate {@link #searchUnitMap} thread-safely. @param consumer the operation for the unit map. """ readWriteLock.readLock().lock(); try { consumer.accept(Collections.unmodifiableMap(searchUnitMap)); } finally { readWriteLock.readLock().unlock(); } }
java
public static void searchUnitMap(Consumer<Map<String, Unit>> consumer) { readWriteLock.readLock().lock(); try { consumer.accept(Collections.unmodifiableMap(searchUnitMap)); } finally { readWriteLock.readLock().unlock(); } }
[ "public", "static", "void", "searchUnitMap", "(", "Consumer", "<", "Map", "<", "String", ",", "Unit", ">", ">", "consumer", ")", "{", "readWriteLock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "consumer", ".", "accept", "(", "Collections", ".", "unmodifiableMap", "(", "searchUnitMap", ")", ")", ";", "}", "finally", "{", "readWriteLock", ".", "readLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Iterate {@link #searchUnitMap} thread-safely. @param consumer the operation for the unit map.
[ "Iterate", "{", "@link", "#searchUnitMap", "}", "thread", "-", "safely", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java#L227-L234
google/closure-compiler
src/com/google/javascript/jscomp/JSModuleGraph.java
JSModuleGraph.dependsOn
public boolean dependsOn(JSModule src, JSModule m) { """ Determines whether this module depends on a given module. Note that a module never depends on itself, as that dependency would be cyclic. """ return src != m && selfPlusTransitiveDeps[src.getIndex()].get(m.getIndex()); }
java
public boolean dependsOn(JSModule src, JSModule m) { return src != m && selfPlusTransitiveDeps[src.getIndex()].get(m.getIndex()); }
[ "public", "boolean", "dependsOn", "(", "JSModule", "src", ",", "JSModule", "m", ")", "{", "return", "src", "!=", "m", "&&", "selfPlusTransitiveDeps", "[", "src", ".", "getIndex", "(", ")", "]", ".", "get", "(", "m", ".", "getIndex", "(", ")", ")", ";", "}" ]
Determines whether this module depends on a given module. Note that a module never depends on itself, as that dependency would be cyclic.
[ "Determines", "whether", "this", "module", "depends", "on", "a", "given", "module", ".", "Note", "that", "a", "module", "never", "depends", "on", "itself", "as", "that", "dependency", "would", "be", "cyclic", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModuleGraph.java#L339-L341
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java
Metric.setDatapoints
public void setDatapoints(Map<Long, Double> datapoints) { """ Deletes the current set of data points and replaces them with a new set. @param datapoints The new set of data points. If null or empty, only the deletion of the current set of data points is performed. """ _datapoints.clear(); if (datapoints != null) { _datapoints.putAll(datapoints); } }
java
public void setDatapoints(Map<Long, Double> datapoints) { _datapoints.clear(); if (datapoints != null) { _datapoints.putAll(datapoints); } }
[ "public", "void", "setDatapoints", "(", "Map", "<", "Long", ",", "Double", ">", "datapoints", ")", "{", "_datapoints", ".", "clear", "(", ")", ";", "if", "(", "datapoints", "!=", "null", ")", "{", "_datapoints", ".", "putAll", "(", "datapoints", ")", ";", "}", "}" ]
Deletes the current set of data points and replaces them with a new set. @param datapoints The new set of data points. If null or empty, only the deletion of the current set of data points is performed.
[ "Deletes", "the", "current", "set", "of", "data", "points", "and", "replaces", "them", "with", "a", "new", "set", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L157-L162
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java
TermOfUsePanel.newLiabilityPanel
protected Component newLiabilityPanel(final String id, final IModel<HeaderContentListModelBean> model) { """ Factory method for creating the new {@link Component} for the liability. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the liability. @param id the id @param model the model @return the new {@link Component} for the liability """ return new LiabilityPanel(id, Model.of(model.getObject())); }
java
protected Component newLiabilityPanel(final String id, final IModel<HeaderContentListModelBean> model) { return new LiabilityPanel(id, Model.of(model.getObject())); }
[ "protected", "Component", "newLiabilityPanel", "(", "final", "String", "id", ",", "final", "IModel", "<", "HeaderContentListModelBean", ">", "model", ")", "{", "return", "new", "LiabilityPanel", "(", "id", ",", "Model", ".", "of", "(", "model", ".", "getObject", "(", ")", ")", ")", ";", "}" ]
Factory method for creating the new {@link Component} for the liability. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the liability. @param id the id @param model the model @return the new {@link Component} for the liability
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "for", "the", "liability", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of", "a", "new", "{", "@link", "Component", "}", "for", "the", "liability", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L312-L316
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateComponentAvailability
private void updateComponentAvailability(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, Availability availability) { """ Updates a charging station's component availability. @param chargingStationId the charging station's id. @param componentId the component's id. @param component the component type. @param availability the the charging station's new availability. """ if (!component.equals(ChargingStationComponent.EVSE) || !(componentId instanceof EvseId)) { return; } ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId.getId())) { evse.setAvailability(availability); break; } } repository.createOrUpdate(chargingStation); } }
java
private void updateComponentAvailability(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, Availability availability) { if (!component.equals(ChargingStationComponent.EVSE) || !(componentId instanceof EvseId)) { return; } ChargingStation chargingStation = repository.findOne(chargingStationId.getId()); if (chargingStation != null) { for (Evse evse : chargingStation.getEvses()) { if (evse.getEvseId().equals(componentId.getId())) { evse.setAvailability(availability); break; } } repository.createOrUpdate(chargingStation); } }
[ "private", "void", "updateComponentAvailability", "(", "ChargingStationId", "chargingStationId", ",", "ComponentId", "componentId", ",", "ChargingStationComponent", "component", ",", "Availability", "availability", ")", "{", "if", "(", "!", "component", ".", "equals", "(", "ChargingStationComponent", ".", "EVSE", ")", "||", "!", "(", "componentId", "instanceof", "EvseId", ")", ")", "{", "return", ";", "}", "ChargingStation", "chargingStation", "=", "repository", ".", "findOne", "(", "chargingStationId", ".", "getId", "(", ")", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "for", "(", "Evse", "evse", ":", "chargingStation", ".", "getEvses", "(", ")", ")", "{", "if", "(", "evse", ".", "getEvseId", "(", ")", ".", "equals", "(", "componentId", ".", "getId", "(", ")", ")", ")", "{", "evse", ".", "setAvailability", "(", "availability", ")", ";", "break", ";", "}", "}", "repository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "}" ]
Updates a charging station's component availability. @param chargingStationId the charging station's id. @param componentId the component's id. @param component the component type. @param availability the the charging station's new availability.
[ "Updates", "a", "charging", "station", "s", "component", "availability", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L383-L399
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
AbstractDefinitionDeployer.generateDefinitionId
protected String generateDefinitionId(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition) { """ create an id for the definition. The default is to ask the {@link IdGenerator} and add the definition key and version if that does not exceed 64 characters. You might want to hook in your own implementation here. """ String nextId = idGenerator.getNextId(); String definitionKey = newDefinition.getKey(); int definitionVersion = newDefinition.getVersion(); String definitionId = definitionKey + ":" + definitionVersion + ":" + nextId; // ACT-115: maximum id length is 64 characters if (definitionId.length() > 64) { definitionId = nextId; } return definitionId; }
java
protected String generateDefinitionId(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition) { String nextId = idGenerator.getNextId(); String definitionKey = newDefinition.getKey(); int definitionVersion = newDefinition.getVersion(); String definitionId = definitionKey + ":" + definitionVersion + ":" + nextId; // ACT-115: maximum id length is 64 characters if (definitionId.length() > 64) { definitionId = nextId; } return definitionId; }
[ "protected", "String", "generateDefinitionId", "(", "DeploymentEntity", "deployment", ",", "DefinitionEntity", "newDefinition", ",", "DefinitionEntity", "latestDefinition", ")", "{", "String", "nextId", "=", "idGenerator", ".", "getNextId", "(", ")", ";", "String", "definitionKey", "=", "newDefinition", ".", "getKey", "(", ")", ";", "int", "definitionVersion", "=", "newDefinition", ".", "getVersion", "(", ")", ";", "String", "definitionId", "=", "definitionKey", "+", "\":\"", "+", "definitionVersion", "+", "\":\"", "+", "nextId", ";", "// ACT-115: maximum id length is 64 characters", "if", "(", "definitionId", ".", "length", "(", ")", ">", "64", ")", "{", "definitionId", "=", "nextId", ";", "}", "return", "definitionId", ";", "}" ]
create an id for the definition. The default is to ask the {@link IdGenerator} and add the definition key and version if that does not exceed 64 characters. You might want to hook in your own implementation here.
[ "create", "an", "id", "for", "the", "definition", ".", "The", "default", "is", "to", "ask", "the", "{" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java#L336-L351
BioPAX/Paxtools
paxtools-core/src/main/java/org/biopax/paxtools/controller/Merger.java
Merger.visit
public void visit(BioPAXElement domain, Object range, Model model, PropertyEditor editor) { """ Checks whether <em>model</em> contains <em>bpe</em> element, and if it does, then it updates the value of the equivalent element for <em>bpe</em> by using the specific <em>editor</em>. @param domain owner @param range property value @param model model containing the equivalent element's equivalent @param editor biopax property editor specific for the value type to be updated """ if (range instanceof BioPAXElement) { BioPAXElement bpe = (BioPAXElement) range; // do nothing if you already inserted this if (!model.contains(bpe)) { //if there is an identical if (model.getByID(bpe.getUri()) != null) { if (editor.isMultipleCardinality()) { editor.removeValueFromBean(bpe, domain); } editor.setValueToBean(getIdentical(bpe), domain); } } } }
java
public void visit(BioPAXElement domain, Object range, Model model, PropertyEditor editor) { if (range instanceof BioPAXElement) { BioPAXElement bpe = (BioPAXElement) range; // do nothing if you already inserted this if (!model.contains(bpe)) { //if there is an identical if (model.getByID(bpe.getUri()) != null) { if (editor.isMultipleCardinality()) { editor.removeValueFromBean(bpe, domain); } editor.setValueToBean(getIdentical(bpe), domain); } } } }
[ "public", "void", "visit", "(", "BioPAXElement", "domain", ",", "Object", "range", ",", "Model", "model", ",", "PropertyEditor", "editor", ")", "{", "if", "(", "range", "instanceof", "BioPAXElement", ")", "{", "BioPAXElement", "bpe", "=", "(", "BioPAXElement", ")", "range", ";", "// do nothing if you already inserted this", "if", "(", "!", "model", ".", "contains", "(", "bpe", ")", ")", "{", "//if there is an identical", "if", "(", "model", ".", "getByID", "(", "bpe", ".", "getUri", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "editor", ".", "isMultipleCardinality", "(", ")", ")", "{", "editor", ".", "removeValueFromBean", "(", "bpe", ",", "domain", ")", ";", "}", "editor", ".", "setValueToBean", "(", "getIdentical", "(", "bpe", ")", ",", "domain", ")", ";", "}", "}", "}", "}" ]
Checks whether <em>model</em> contains <em>bpe</em> element, and if it does, then it updates the value of the equivalent element for <em>bpe</em> by using the specific <em>editor</em>. @param domain owner @param range property value @param model model containing the equivalent element's equivalent @param editor biopax property editor specific for the value type to be updated
[ "Checks", "whether", "<em", ">", "model<", "/", "em", ">", "contains", "<em", ">", "bpe<", "/", "em", ">", "element", "and", "if", "it", "does", "then", "it", "updates", "the", "value", "of", "the", "equivalent", "element", "for", "<em", ">", "bpe<", "/", "em", ">", "by", "using", "the", "specific", "<em", ">", "editor<", "/", "em", ">", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/Merger.java#L60-L80
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.makeNewEntry
protected void makeNewEntry( final CmsClientSitemapEntry parent, final I_CmsSimpleCallback<CmsClientSitemapEntry> callback) { """ Creates a new client sitemap entry bean to use for the RPC call which actually creates the entry on the server side.<p> @param parent the parent entry @param callback the callback to execute """ ensureUniqueName(parent, NEW_ENTRY_NAME, new I_CmsSimpleCallback<String>() { public void execute(String urlName) { CmsClientSitemapEntry newEntry = new CmsClientSitemapEntry(); //newEntry.setTitle(urlName); newEntry.setName(urlName); String sitePath = parent.getSitePath() + urlName + "/"; newEntry.setSitePath(sitePath); newEntry.setVfsPath(null); newEntry.setPosition(0); newEntry.setNew(true); newEntry.setInNavigation(true); newEntry.setResourceTypeName("folder"); newEntry.getOwnProperties().put( CmsClientProperty.PROPERTY_TITLE, new CmsClientProperty(CmsClientProperty.PROPERTY_TITLE, NEW_ENTRY_NAME, NEW_ENTRY_NAME)); callback.execute(newEntry); } }); }
java
protected void makeNewEntry( final CmsClientSitemapEntry parent, final I_CmsSimpleCallback<CmsClientSitemapEntry> callback) { ensureUniqueName(parent, NEW_ENTRY_NAME, new I_CmsSimpleCallback<String>() { public void execute(String urlName) { CmsClientSitemapEntry newEntry = new CmsClientSitemapEntry(); //newEntry.setTitle(urlName); newEntry.setName(urlName); String sitePath = parent.getSitePath() + urlName + "/"; newEntry.setSitePath(sitePath); newEntry.setVfsPath(null); newEntry.setPosition(0); newEntry.setNew(true); newEntry.setInNavigation(true); newEntry.setResourceTypeName("folder"); newEntry.getOwnProperties().put( CmsClientProperty.PROPERTY_TITLE, new CmsClientProperty(CmsClientProperty.PROPERTY_TITLE, NEW_ENTRY_NAME, NEW_ENTRY_NAME)); callback.execute(newEntry); } }); }
[ "protected", "void", "makeNewEntry", "(", "final", "CmsClientSitemapEntry", "parent", ",", "final", "I_CmsSimpleCallback", "<", "CmsClientSitemapEntry", ">", "callback", ")", "{", "ensureUniqueName", "(", "parent", ",", "NEW_ENTRY_NAME", ",", "new", "I_CmsSimpleCallback", "<", "String", ">", "(", ")", "{", "public", "void", "execute", "(", "String", "urlName", ")", "{", "CmsClientSitemapEntry", "newEntry", "=", "new", "CmsClientSitemapEntry", "(", ")", ";", "//newEntry.setTitle(urlName);", "newEntry", ".", "setName", "(", "urlName", ")", ";", "String", "sitePath", "=", "parent", ".", "getSitePath", "(", ")", "+", "urlName", "+", "\"/\"", ";", "newEntry", ".", "setSitePath", "(", "sitePath", ")", ";", "newEntry", ".", "setVfsPath", "(", "null", ")", ";", "newEntry", ".", "setPosition", "(", "0", ")", ";", "newEntry", ".", "setNew", "(", "true", ")", ";", "newEntry", ".", "setInNavigation", "(", "true", ")", ";", "newEntry", ".", "setResourceTypeName", "(", "\"folder\"", ")", ";", "newEntry", ".", "getOwnProperties", "(", ")", ".", "put", "(", "CmsClientProperty", ".", "PROPERTY_TITLE", ",", "new", "CmsClientProperty", "(", "CmsClientProperty", ".", "PROPERTY_TITLE", ",", "NEW_ENTRY_NAME", ",", "NEW_ENTRY_NAME", ")", ")", ";", "callback", ".", "execute", "(", "newEntry", ")", ";", "}", "}", ")", ";", "}" ]
Creates a new client sitemap entry bean to use for the RPC call which actually creates the entry on the server side.<p> @param parent the parent entry @param callback the callback to execute
[ "Creates", "a", "new", "client", "sitemap", "entry", "bean", "to", "use", "for", "the", "RPC", "call", "which", "actually", "creates", "the", "entry", "on", "the", "server", "side", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L2266-L2291
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/Fetcher.java
Fetcher.loadEntity
protected <T> T loadEntity(EntityConvertor<BE, E, T> conversion) throws EntityNotFoundException, RelationNotFoundException { """ Loads the entity from the backend and let's the caller do some conversion on either the backend representation of the entity or the converted entity (both of these are required even during the loading so no unnecessary work is done by providing both of the to the caller). @param conversion the conversion function taking the backend entity as well as the model entity @param <T> the result type @return the converted result of loading the entity @throws EntityNotFoundException @throws RelationNotFoundException """ return inTx(tx -> { BE result = tx.querySingle(context.select().get()); if (result == null) { throwNotFoundException(); } E entity = tx.convert(result, context.entityClass); if (!isApplicable(entity)) { throwNotFoundException(); } return conversion.convert(result, entity, tx); }); }
java
protected <T> T loadEntity(EntityConvertor<BE, E, T> conversion) throws EntityNotFoundException, RelationNotFoundException { return inTx(tx -> { BE result = tx.querySingle(context.select().get()); if (result == null) { throwNotFoundException(); } E entity = tx.convert(result, context.entityClass); if (!isApplicable(entity)) { throwNotFoundException(); } return conversion.convert(result, entity, tx); }); }
[ "protected", "<", "T", ">", "T", "loadEntity", "(", "EntityConvertor", "<", "BE", ",", "E", ",", "T", ">", "conversion", ")", "throws", "EntityNotFoundException", ",", "RelationNotFoundException", "{", "return", "inTx", "(", "tx", "->", "{", "BE", "result", "=", "tx", ".", "querySingle", "(", "context", ".", "select", "(", ")", ".", "get", "(", ")", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throwNotFoundException", "(", ")", ";", "}", "E", "entity", "=", "tx", ".", "convert", "(", "result", ",", "context", ".", "entityClass", ")", ";", "if", "(", "!", "isApplicable", "(", "entity", ")", ")", "{", "throwNotFoundException", "(", ")", ";", "}", "return", "conversion", ".", "convert", "(", "result", ",", "entity", ",", "tx", ")", ";", "}", ")", ";", "}" ]
Loads the entity from the backend and let's the caller do some conversion on either the backend representation of the entity or the converted entity (both of these are required even during the loading so no unnecessary work is done by providing both of the to the caller). @param conversion the conversion function taking the backend entity as well as the model entity @param <T> the result type @return the converted result of loading the entity @throws EntityNotFoundException @throws RelationNotFoundException
[ "Loads", "the", "entity", "from", "the", "backend", "and", "let", "s", "the", "caller", "do", "some", "conversion", "on", "either", "the", "backend", "representation", "of", "the", "entity", "or", "the", "converted", "entity", "(", "both", "of", "these", "are", "required", "even", "during", "the", "loading", "so", "no", "unnecessary", "work", "is", "done", "by", "providing", "both", "of", "the", "to", "the", "caller", ")", "." ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/Fetcher.java#L69-L87
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/HullWhiteModelWithConstantCoeff.java
HullWhiteModelWithConstantCoeff.getShortRateConditionalVariance
public double getShortRateConditionalVariance(double time, double maturity) { """ Calculates the variance \( \mathop{Var}(r(t) \vert r(s) ) \), that is \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \) where \( a \) is the meanReversion and \( \sigma \) is the short rate instantaneous volatility. @param time The parameter s in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \) @param maturity The parameter t in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \) @return The integrated square volatility. """ return volatility*volatility * (1 - Math.exp(-2*meanReversion*(maturity-time))) / (2*meanReversion); }
java
public double getShortRateConditionalVariance(double time, double maturity) { return volatility*volatility * (1 - Math.exp(-2*meanReversion*(maturity-time))) / (2*meanReversion); }
[ "public", "double", "getShortRateConditionalVariance", "(", "double", "time", ",", "double", "maturity", ")", "{", "return", "volatility", "*", "volatility", "*", "(", "1", "-", "Math", ".", "exp", "(", "-", "2", "*", "meanReversion", "*", "(", "maturity", "-", "time", ")", ")", ")", "/", "(", "2", "*", "meanReversion", ")", ";", "}" ]
Calculates the variance \( \mathop{Var}(r(t) \vert r(s) ) \), that is \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \) where \( a \) is the meanReversion and \( \sigma \) is the short rate instantaneous volatility. @param time The parameter s in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \) @param maturity The parameter t in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \) @return The integrated square volatility.
[ "Calculates", "the", "variance", "\\", "(", "\\", "mathop", "{", "Var", "}", "(", "r", "(", "t", ")", "\\", "vert", "r", "(", "s", ")", ")", "\\", ")", "that", "is", "\\", "(", "\\", "int_", "{", "s", "}", "^", "{", "t", "}", "\\", "sigma^", "{", "2", "}", "(", "\\", "tau", ")", "\\", "exp", "(", "-", "2", "\\", "cdot", "a", "\\", "cdot", "(", "t", "-", "\\", "tau", "))", "\\", "\\", "mathrm", "{", "d", "}", "\\", "tau", "\\", ")", "where", "\\", "(", "a", "\\", ")", "is", "the", "meanReversion", "and", "\\", "(", "\\", "sigma", "\\", ")", "is", "the", "short", "rate", "instantaneous", "volatility", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/HullWhiteModelWithConstantCoeff.java#L344-L347
apache/spark
common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java
JavaUtils.byteStringAs
public static long byteStringAs(String str, ByteUnit unit) { """ Convert a passed byte string (e.g. 50b, 100kb, or 250mb) to the given. If no suffix is provided, a direct conversion to the provided unit is attempted. """ String lower = str.toLowerCase(Locale.ROOT).trim(); try { Matcher m = Pattern.compile("([0-9]+)([a-z]+)?").matcher(lower); Matcher fractionMatcher = Pattern.compile("([0-9]+\\.[0-9]+)([a-z]+)?").matcher(lower); if (m.matches()) { long val = Long.parseLong(m.group(1)); String suffix = m.group(2); // Check for invalid suffixes if (suffix != null && !byteSuffixes.containsKey(suffix)) { throw new NumberFormatException("Invalid suffix: \"" + suffix + "\""); } // If suffix is valid use that, otherwise none was provided and use the default passed return unit.convertFrom(val, suffix != null ? byteSuffixes.get(suffix) : unit); } else if (fractionMatcher.matches()) { throw new NumberFormatException("Fractional values are not supported. Input was: " + fractionMatcher.group(1)); } else { throw new NumberFormatException("Failed to parse byte string: " + str); } } catch (NumberFormatException e) { String byteError = "Size must be specified as bytes (b), " + "kibibytes (k), mebibytes (m), gibibytes (g), tebibytes (t), or pebibytes(p). " + "E.g. 50b, 100k, or 250m."; throw new NumberFormatException(byteError + "\n" + e.getMessage()); } }
java
public static long byteStringAs(String str, ByteUnit unit) { String lower = str.toLowerCase(Locale.ROOT).trim(); try { Matcher m = Pattern.compile("([0-9]+)([a-z]+)?").matcher(lower); Matcher fractionMatcher = Pattern.compile("([0-9]+\\.[0-9]+)([a-z]+)?").matcher(lower); if (m.matches()) { long val = Long.parseLong(m.group(1)); String suffix = m.group(2); // Check for invalid suffixes if (suffix != null && !byteSuffixes.containsKey(suffix)) { throw new NumberFormatException("Invalid suffix: \"" + suffix + "\""); } // If suffix is valid use that, otherwise none was provided and use the default passed return unit.convertFrom(val, suffix != null ? byteSuffixes.get(suffix) : unit); } else if (fractionMatcher.matches()) { throw new NumberFormatException("Fractional values are not supported. Input was: " + fractionMatcher.group(1)); } else { throw new NumberFormatException("Failed to parse byte string: " + str); } } catch (NumberFormatException e) { String byteError = "Size must be specified as bytes (b), " + "kibibytes (k), mebibytes (m), gibibytes (g), tebibytes (t), or pebibytes(p). " + "E.g. 50b, 100k, or 250m."; throw new NumberFormatException(byteError + "\n" + e.getMessage()); } }
[ "public", "static", "long", "byteStringAs", "(", "String", "str", ",", "ByteUnit", "unit", ")", "{", "String", "lower", "=", "str", ".", "toLowerCase", "(", "Locale", ".", "ROOT", ")", ".", "trim", "(", ")", ";", "try", "{", "Matcher", "m", "=", "Pattern", ".", "compile", "(", "\"([0-9]+)([a-z]+)?\"", ")", ".", "matcher", "(", "lower", ")", ";", "Matcher", "fractionMatcher", "=", "Pattern", ".", "compile", "(", "\"([0-9]+\\\\.[0-9]+)([a-z]+)?\"", ")", ".", "matcher", "(", "lower", ")", ";", "if", "(", "m", ".", "matches", "(", ")", ")", "{", "long", "val", "=", "Long", ".", "parseLong", "(", "m", ".", "group", "(", "1", ")", ")", ";", "String", "suffix", "=", "m", ".", "group", "(", "2", ")", ";", "// Check for invalid suffixes", "if", "(", "suffix", "!=", "null", "&&", "!", "byteSuffixes", ".", "containsKey", "(", "suffix", ")", ")", "{", "throw", "new", "NumberFormatException", "(", "\"Invalid suffix: \\\"\"", "+", "suffix", "+", "\"\\\"\"", ")", ";", "}", "// If suffix is valid use that, otherwise none was provided and use the default passed", "return", "unit", ".", "convertFrom", "(", "val", ",", "suffix", "!=", "null", "?", "byteSuffixes", ".", "get", "(", "suffix", ")", ":", "unit", ")", ";", "}", "else", "if", "(", "fractionMatcher", ".", "matches", "(", ")", ")", "{", "throw", "new", "NumberFormatException", "(", "\"Fractional values are not supported. Input was: \"", "+", "fractionMatcher", ".", "group", "(", "1", ")", ")", ";", "}", "else", "{", "throw", "new", "NumberFormatException", "(", "\"Failed to parse byte string: \"", "+", "str", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "String", "byteError", "=", "\"Size must be specified as bytes (b), \"", "+", "\"kibibytes (k), mebibytes (m), gibibytes (g), tebibytes (t), or pebibytes(p). \"", "+", "\"E.g. 50b, 100k, or 250m.\"", ";", "throw", "new", "NumberFormatException", "(", "byteError", "+", "\"\\n\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Convert a passed byte string (e.g. 50b, 100kb, or 250mb) to the given. If no suffix is provided, a direct conversion to the provided unit is attempted.
[ "Convert", "a", "passed", "byte", "string", "(", "e", ".", "g", ".", "50b", "100kb", "or", "250mb", ")", "to", "the", "given", ".", "If", "no", "suffix", "is", "provided", "a", "direct", "conversion", "to", "the", "provided", "unit", "is", "attempted", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L276-L308
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java
AbstractCommand.getButtonManager
private CommandFaceButtonManager getButtonManager(String faceDescriptorId) { """ Returns the {@link CommandFaceButtonManager} for the given faceDescriptorId. @param faceDescriptorId id of the {@link CommandFaceDescriptor}. @return the {@link CommandFaceButtonManager} managing buttons configured with the {@link CommandFaceDescriptor}. """ if (this.faceButtonManagers == null) { this.faceButtonManagers = new AbstractCachingMapDecorator() { protected Object create(Object key) { return new CommandFaceButtonManager(AbstractCommand.this, (String) key); } }; } CommandFaceButtonManager m = (CommandFaceButtonManager) this.faceButtonManagers.get(faceDescriptorId); return m; }
java
private CommandFaceButtonManager getButtonManager(String faceDescriptorId) { if (this.faceButtonManagers == null) { this.faceButtonManagers = new AbstractCachingMapDecorator() { protected Object create(Object key) { return new CommandFaceButtonManager(AbstractCommand.this, (String) key); } }; } CommandFaceButtonManager m = (CommandFaceButtonManager) this.faceButtonManagers.get(faceDescriptorId); return m; }
[ "private", "CommandFaceButtonManager", "getButtonManager", "(", "String", "faceDescriptorId", ")", "{", "if", "(", "this", ".", "faceButtonManagers", "==", "null", ")", "{", "this", ".", "faceButtonManagers", "=", "new", "AbstractCachingMapDecorator", "(", ")", "{", "protected", "Object", "create", "(", "Object", "key", ")", "{", "return", "new", "CommandFaceButtonManager", "(", "AbstractCommand", ".", "this", ",", "(", "String", ")", "key", ")", ";", "}", "}", ";", "}", "CommandFaceButtonManager", "m", "=", "(", "CommandFaceButtonManager", ")", "this", ".", "faceButtonManagers", ".", "get", "(", "faceDescriptorId", ")", ";", "return", "m", ";", "}" ]
Returns the {@link CommandFaceButtonManager} for the given faceDescriptorId. @param faceDescriptorId id of the {@link CommandFaceDescriptor}. @return the {@link CommandFaceButtonManager} managing buttons configured with the {@link CommandFaceDescriptor}.
[ "Returns", "the", "{", "@link", "CommandFaceButtonManager", "}", "for", "the", "given", "faceDescriptorId", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java#L945-L955
Twitter4J/Twitter4J
twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java
TwitterObjectFactory.registerJSONObject
static <T> T registerJSONObject(T key, Object json) { """ associate a raw JSON form to the current thread<br> @since Twitter4J 2.1.7 """ registeredAtleastOnce = true; rawJsonMap.get().put(key, json); return key; }
java
static <T> T registerJSONObject(T key, Object json) { registeredAtleastOnce = true; rawJsonMap.get().put(key, json); return key; }
[ "static", "<", "T", ">", "T", "registerJSONObject", "(", "T", "key", ",", "Object", "json", ")", "{", "registeredAtleastOnce", "=", "true", ";", "rawJsonMap", ".", "get", "(", ")", ".", "put", "(", "key", ",", "json", ")", ";", "return", "key", ";", "}" ]
associate a raw JSON form to the current thread<br> @since Twitter4J 2.1.7
[ "associate", "a", "raw", "JSON", "form", "to", "the", "current", "thread<br", ">" ]
train
https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L340-L344
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_phonebooks_bookKey_export_GET
public OvhPcsFile serviceName_phonebooks_bookKey_export_GET(String serviceName, String bookKey, OvhContactsExportFormatsEnum format) throws IOException { """ Export the phonebook's contacts REST: GET /sms/{serviceName}/phonebooks/{bookKey}/export @param format [required] Format of the file @param serviceName [required] The internal name of your SMS offer @param bookKey [required] Identifier of the phonebook """ String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/export"; StringBuilder sb = path(qPath, serviceName, bookKey); query(sb, "format", format); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPcsFile.class); }
java
public OvhPcsFile serviceName_phonebooks_bookKey_export_GET(String serviceName, String bookKey, OvhContactsExportFormatsEnum format) throws IOException { String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/export"; StringBuilder sb = path(qPath, serviceName, bookKey); query(sb, "format", format); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPcsFile.class); }
[ "public", "OvhPcsFile", "serviceName_phonebooks_bookKey_export_GET", "(", "String", "serviceName", ",", "String", "bookKey", ",", "OvhContactsExportFormatsEnum", "format", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/phonebooks/{bookKey}/export\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "bookKey", ")", ";", "query", "(", "sb", ",", "\"format\"", ",", "format", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhPcsFile", ".", "class", ")", ";", "}" ]
Export the phonebook's contacts REST: GET /sms/{serviceName}/phonebooks/{bookKey}/export @param format [required] Format of the file @param serviceName [required] The internal name of your SMS offer @param bookKey [required] Identifier of the phonebook
[ "Export", "the", "phonebook", "s", "contacts" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1071-L1077
undertow-io/undertow
core/src/main/java/io/undertow/protocols/http2/Http2Channel.java
Http2Channel.createInitialUpgradeResponseStream
public Http2HeadersStreamSinkChannel createInitialUpgradeResponseStream() { """ Creates a response stream to respond to the initial HTTP upgrade @return """ if (lastGoodStreamId != 0) { throw new IllegalStateException(); } lastGoodStreamId = 1; Http2HeadersStreamSinkChannel stream = new Http2HeadersStreamSinkChannel(this, 1); StreamHolder streamHolder = new StreamHolder(stream); streamHolder.sourceClosed = true; currentStreams.put(1, streamHolder); receiveConcurrentStreamsAtomicUpdater.getAndIncrement(this); return stream; }
java
public Http2HeadersStreamSinkChannel createInitialUpgradeResponseStream() { if (lastGoodStreamId != 0) { throw new IllegalStateException(); } lastGoodStreamId = 1; Http2HeadersStreamSinkChannel stream = new Http2HeadersStreamSinkChannel(this, 1); StreamHolder streamHolder = new StreamHolder(stream); streamHolder.sourceClosed = true; currentStreams.put(1, streamHolder); receiveConcurrentStreamsAtomicUpdater.getAndIncrement(this); return stream; }
[ "public", "Http2HeadersStreamSinkChannel", "createInitialUpgradeResponseStream", "(", ")", "{", "if", "(", "lastGoodStreamId", "!=", "0", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "lastGoodStreamId", "=", "1", ";", "Http2HeadersStreamSinkChannel", "stream", "=", "new", "Http2HeadersStreamSinkChannel", "(", "this", ",", "1", ")", ";", "StreamHolder", "streamHolder", "=", "new", "StreamHolder", "(", "stream", ")", ";", "streamHolder", ".", "sourceClosed", "=", "true", ";", "currentStreams", ".", "put", "(", "1", ",", "streamHolder", ")", ";", "receiveConcurrentStreamsAtomicUpdater", ".", "getAndIncrement", "(", "this", ")", ";", "return", "stream", ";", "}" ]
Creates a response stream to respond to the initial HTTP upgrade @return
[ "Creates", "a", "response", "stream", "to", "respond", "to", "the", "initial", "HTTP", "upgrade" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/protocols/http2/Http2Channel.java#L1085-L1097
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java
GenericCollectionTypeResolver.extractType
private static Class<?> extractType(Type type, Class<?> source, int typeIndex, Map<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel, int nestingLevel, int currentLevel) { """ Extract the generic type from the given Type object. @param type the Type to check @param source the source collection/map Class that we check @param typeIndex the index of the actual type argument @param nestingLevel the nesting level of the target type @param currentLevel the current nested level @return the generic type as Class, or {@code null} if none """ Type resolvedType = type; if (type instanceof TypeVariable && typeVariableMap != null) { Type mappedType = typeVariableMap.get(type); if (mappedType != null) { resolvedType = mappedType; } } if (resolvedType instanceof ParameterizedType) { return extractTypeFromParameterizedType((ParameterizedType) resolvedType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel); } else if (resolvedType instanceof Class) { return extractTypeFromClass((Class) resolvedType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel); } else if (resolvedType instanceof GenericArrayType) { Type compType = ((GenericArrayType) resolvedType).getGenericComponentType(); return extractType(compType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel + 1); } else { return null; } }
java
private static Class<?> extractType(Type type, Class<?> source, int typeIndex, Map<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel, int nestingLevel, int currentLevel) { Type resolvedType = type; if (type instanceof TypeVariable && typeVariableMap != null) { Type mappedType = typeVariableMap.get(type); if (mappedType != null) { resolvedType = mappedType; } } if (resolvedType instanceof ParameterizedType) { return extractTypeFromParameterizedType((ParameterizedType) resolvedType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel); } else if (resolvedType instanceof Class) { return extractTypeFromClass((Class) resolvedType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel); } else if (resolvedType instanceof GenericArrayType) { Type compType = ((GenericArrayType) resolvedType).getGenericComponentType(); return extractType(compType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel + 1); } else { return null; } }
[ "private", "static", "Class", "<", "?", ">", "extractType", "(", "Type", "type", ",", "Class", "<", "?", ">", "source", ",", "int", "typeIndex", ",", "Map", "<", "TypeVariable", ",", "Type", ">", "typeVariableMap", ",", "Map", "<", "Integer", ",", "Integer", ">", "typeIndexesPerLevel", ",", "int", "nestingLevel", ",", "int", "currentLevel", ")", "{", "Type", "resolvedType", "=", "type", ";", "if", "(", "type", "instanceof", "TypeVariable", "&&", "typeVariableMap", "!=", "null", ")", "{", "Type", "mappedType", "=", "typeVariableMap", ".", "get", "(", "type", ")", ";", "if", "(", "mappedType", "!=", "null", ")", "{", "resolvedType", "=", "mappedType", ";", "}", "}", "if", "(", "resolvedType", "instanceof", "ParameterizedType", ")", "{", "return", "extractTypeFromParameterizedType", "(", "(", "ParameterizedType", ")", "resolvedType", ",", "source", ",", "typeIndex", ",", "typeVariableMap", ",", "typeIndexesPerLevel", ",", "nestingLevel", ",", "currentLevel", ")", ";", "}", "else", "if", "(", "resolvedType", "instanceof", "Class", ")", "{", "return", "extractTypeFromClass", "(", "(", "Class", ")", "resolvedType", ",", "source", ",", "typeIndex", ",", "typeVariableMap", ",", "typeIndexesPerLevel", ",", "nestingLevel", ",", "currentLevel", ")", ";", "}", "else", "if", "(", "resolvedType", "instanceof", "GenericArrayType", ")", "{", "Type", "compType", "=", "(", "(", "GenericArrayType", ")", "resolvedType", ")", ".", "getGenericComponentType", "(", ")", ";", "return", "extractType", "(", "compType", ",", "source", ",", "typeIndex", ",", "typeVariableMap", ",", "typeIndexesPerLevel", ",", "nestingLevel", ",", "currentLevel", "+", "1", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Extract the generic type from the given Type object. @param type the Type to check @param source the source collection/map Class that we check @param typeIndex the index of the actual type argument @param nestingLevel the nesting level of the target type @param currentLevel the current nested level @return the generic type as Class, or {@code null} if none
[ "Extract", "the", "generic", "type", "from", "the", "given", "Type", "object", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L320-L346
xedin/disruptor_thrift_server
src/main/java/com/thinkaurelius/thrift/util/mem/Memory.java
Memory.setBytes
public void setBytes(long memoryOffset, ByteBuffer buffer) { """ Transfers count bytes from buffer to Memory @param memoryOffset start offset in the memory @param buffer the data buffer """ if (buffer == null) throw new NullPointerException(); else if (buffer.remaining() == 0) return; int bufferOffset = buffer.position(); checkPosition(memoryOffset); long end = memoryOffset + buffer.remaining(); checkPosition(end - 1); while (memoryOffset < end) { unsafe.putByte(peer + memoryOffset, buffer.get(bufferOffset)); memoryOffset++; bufferOffset++; } }
java
public void setBytes(long memoryOffset, ByteBuffer buffer) { if (buffer == null) throw new NullPointerException(); else if (buffer.remaining() == 0) return; int bufferOffset = buffer.position(); checkPosition(memoryOffset); long end = memoryOffset + buffer.remaining(); checkPosition(end - 1); while (memoryOffset < end) { unsafe.putByte(peer + memoryOffset, buffer.get(bufferOffset)); memoryOffset++; bufferOffset++; } }
[ "public", "void", "setBytes", "(", "long", "memoryOffset", ",", "ByteBuffer", "buffer", ")", "{", "if", "(", "buffer", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "else", "if", "(", "buffer", ".", "remaining", "(", ")", "==", "0", ")", "return", ";", "int", "bufferOffset", "=", "buffer", ".", "position", "(", ")", ";", "checkPosition", "(", "memoryOffset", ")", ";", "long", "end", "=", "memoryOffset", "+", "buffer", ".", "remaining", "(", ")", ";", "checkPosition", "(", "end", "-", "1", ")", ";", "while", "(", "memoryOffset", "<", "end", ")", "{", "unsafe", ".", "putByte", "(", "peer", "+", "memoryOffset", ",", "buffer", ".", "get", "(", "bufferOffset", ")", ")", ";", "memoryOffset", "++", ";", "bufferOffset", "++", ";", "}", "}" ]
Transfers count bytes from buffer to Memory @param memoryOffset start offset in the memory @param buffer the data buffer
[ "Transfers", "count", "bytes", "from", "buffer", "to", "Memory" ]
train
https://github.com/xedin/disruptor_thrift_server/blob/5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c/src/main/java/com/thinkaurelius/thrift/util/mem/Memory.java#L142-L160
liferay/com-liferay-commerce
commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java
CPDefinitionGroupedEntryPersistenceImpl.findByUUID_G
@Override public CPDefinitionGroupedEntry findByUUID_G(String uuid, long groupId) throws NoSuchCPDefinitionGroupedEntryException { """ Returns the cp definition grouped entry where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPDefinitionGroupedEntryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp definition grouped entry @throws NoSuchCPDefinitionGroupedEntryException if a matching cp definition grouped entry could not be found """ CPDefinitionGroupedEntry cpDefinitionGroupedEntry = fetchByUUID_G(uuid, groupId); if (cpDefinitionGroupedEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDefinitionGroupedEntryException(msg.toString()); } return cpDefinitionGroupedEntry; }
java
@Override public CPDefinitionGroupedEntry findByUUID_G(String uuid, long groupId) throws NoSuchCPDefinitionGroupedEntryException { CPDefinitionGroupedEntry cpDefinitionGroupedEntry = fetchByUUID_G(uuid, groupId); if (cpDefinitionGroupedEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDefinitionGroupedEntryException(msg.toString()); } return cpDefinitionGroupedEntry; }
[ "@", "Override", "public", "CPDefinitionGroupedEntry", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCPDefinitionGroupedEntryException", "{", "CPDefinitionGroupedEntry", "cpDefinitionGroupedEntry", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "cpDefinitionGroupedEntry", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"uuid=\"", ")", ";", "msg", ".", "append", "(", "uuid", ")", ";", "msg", ".", "append", "(", "\", groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchCPDefinitionGroupedEntryException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "cpDefinitionGroupedEntry", ";", "}" ]
Returns the cp definition grouped entry where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPDefinitionGroupedEntryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp definition grouped entry @throws NoSuchCPDefinitionGroupedEntryException if a matching cp definition grouped entry could not be found
[ "Returns", "the", "cp", "definition", "grouped", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPDefinitionGroupedEntryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L670-L697
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/TextGroupElement.java
TextGroupElement.addChild
public void addChild(String text, Position position) { """ Add a child text element. @param text the child text to add @param position the position of the child relative to this parent """ this.children.add(new Child(text, position)); }
java
public void addChild(String text, Position position) { this.children.add(new Child(text, position)); }
[ "public", "void", "addChild", "(", "String", "text", ",", "Position", "position", ")", "{", "this", ".", "children", ".", "add", "(", "new", "Child", "(", "text", ",", "position", ")", ")", ";", "}" ]
Add a child text element. @param text the child text to add @param position the position of the child relative to this parent
[ "Add", "a", "child", "text", "element", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/TextGroupElement.java#L117-L119
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/PageSection.java
PageSection.simpleHeader
public static Header simpleHeader(final String text, final TextStyle ts) { """ Create a simple header, with a styled text @param text the text @param ts the style @return the header """ return new SimplePageSectionBuilder().text(Text.styledContent(text, ts)).buildHeader(); }
java
public static Header simpleHeader(final String text, final TextStyle ts) { return new SimplePageSectionBuilder().text(Text.styledContent(text, ts)).buildHeader(); }
[ "public", "static", "Header", "simpleHeader", "(", "final", "String", "text", ",", "final", "TextStyle", "ts", ")", "{", "return", "new", "SimplePageSectionBuilder", "(", ")", ".", "text", "(", "Text", ".", "styledContent", "(", "text", ",", "ts", ")", ")", ".", "buildHeader", "(", ")", ";", "}" ]
Create a simple header, with a styled text @param text the text @param ts the style @return the header
[ "Create", "a", "simple", "header", "with", "a", "styled", "text" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/PageSection.java#L116-L118
recommenders/rival
rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticsRunner.java
StatisticsRunner.readLine
public static void readLine(final String format, final String line, final Map<String, Map<String, Double>> mapMetricUserValue, final Set<String> usersToAvoid) { """ Read a line from the metric file. @param format The format of the file. @param line The line. @param mapMetricUserValue Map where metric values for each user will be stored. @param usersToAvoid User ids to be avoided in the subsequent significance testing (e.g., 'all') """ String[] toks = line.split("\t"); // default (also trec_eval) format: metric \t user|all \t value if (format.equals("default")) { String metric = toks[0]; String user = toks[1]; Double score = Double.parseDouble(toks[2]); if (usersToAvoid.contains(user)) { return; } Map<String, Double> userValueMap = mapMetricUserValue.get(metric); if (userValueMap == null) { userValueMap = new HashMap<String, Double>(); mapMetricUserValue.put(metric, userValueMap); } userValueMap.put(user, score); } }
java
public static void readLine(final String format, final String line, final Map<String, Map<String, Double>> mapMetricUserValue, final Set<String> usersToAvoid) { String[] toks = line.split("\t"); // default (also trec_eval) format: metric \t user|all \t value if (format.equals("default")) { String metric = toks[0]; String user = toks[1]; Double score = Double.parseDouble(toks[2]); if (usersToAvoid.contains(user)) { return; } Map<String, Double> userValueMap = mapMetricUserValue.get(metric); if (userValueMap == null) { userValueMap = new HashMap<String, Double>(); mapMetricUserValue.put(metric, userValueMap); } userValueMap.put(user, score); } }
[ "public", "static", "void", "readLine", "(", "final", "String", "format", ",", "final", "String", "line", ",", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "Double", ">", ">", "mapMetricUserValue", ",", "final", "Set", "<", "String", ">", "usersToAvoid", ")", "{", "String", "[", "]", "toks", "=", "line", ".", "split", "(", "\"\\t\"", ")", ";", "// default (also trec_eval) format: metric \\t user|all \\t value", "if", "(", "format", ".", "equals", "(", "\"default\"", ")", ")", "{", "String", "metric", "=", "toks", "[", "0", "]", ";", "String", "user", "=", "toks", "[", "1", "]", ";", "Double", "score", "=", "Double", ".", "parseDouble", "(", "toks", "[", "2", "]", ")", ";", "if", "(", "usersToAvoid", ".", "contains", "(", "user", ")", ")", "{", "return", ";", "}", "Map", "<", "String", ",", "Double", ">", "userValueMap", "=", "mapMetricUserValue", ".", "get", "(", "metric", ")", ";", "if", "(", "userValueMap", "==", "null", ")", "{", "userValueMap", "=", "new", "HashMap", "<", "String", ",", "Double", ">", "(", ")", ";", "mapMetricUserValue", ".", "put", "(", "metric", ",", "userValueMap", ")", ";", "}", "userValueMap", ".", "put", "(", "user", ",", "score", ")", ";", "}", "}" ]
Read a line from the metric file. @param format The format of the file. @param line The line. @param mapMetricUserValue Map where metric values for each user will be stored. @param usersToAvoid User ids to be avoided in the subsequent significance testing (e.g., 'all')
[ "Read", "a", "line", "from", "the", "metric", "file", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticsRunner.java#L263-L280
sematext/ActionGenerator
ag-player-solr/src/main/java/com/sematext/ag/solr/util/XMLUtils.java
XMLUtils.getSolrAddDocument
public static String getSolrAddDocument(Map<String, String> values) { """ Returns Apache Solr add command. @param values values to include @return XML as String """ StringBuilder builder = new StringBuilder(); builder.append("<add><doc>"); for (Map.Entry<String, String> pair : values.entrySet()) { XMLUtils.addSolrField(builder, pair); } builder.append("</doc></add>"); return builder.toString(); }
java
public static String getSolrAddDocument(Map<String, String> values) { StringBuilder builder = new StringBuilder(); builder.append("<add><doc>"); for (Map.Entry<String, String> pair : values.entrySet()) { XMLUtils.addSolrField(builder, pair); } builder.append("</doc></add>"); return builder.toString(); }
[ "public", "static", "String", "getSolrAddDocument", "(", "Map", "<", "String", ",", "String", ">", "values", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "\"<add><doc>\"", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "pair", ":", "values", ".", "entrySet", "(", ")", ")", "{", "XMLUtils", ".", "addSolrField", "(", "builder", ",", "pair", ")", ";", "}", "builder", ".", "append", "(", "\"</doc></add>\"", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Returns Apache Solr add command. @param values values to include @return XML as String
[ "Returns", "Apache", "Solr", "add", "command", "." ]
train
https://github.com/sematext/ActionGenerator/blob/10f4a3e680f20d7d151f5d40e6758aeb072d474f/ag-player-solr/src/main/java/com/sematext/ag/solr/util/XMLUtils.java#L37-L45
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java
SchedulingSupport.calculateOffsetInMs
public static long calculateOffsetInMs(int intervalInMinutes, int offsetInMinutes) { """ Reformulates negative offsets or offsets larger than interval. @param intervalInMinutes @param offsetInMinutes @return offset in milliseconds """ while (offsetInMinutes < 0) { offsetInMinutes = intervalInMinutes + offsetInMinutes; } while (offsetInMinutes > intervalInMinutes) { offsetInMinutes -= intervalInMinutes; } return offsetInMinutes * MINUTE_IN_MS; }
java
public static long calculateOffsetInMs(int intervalInMinutes, int offsetInMinutes) { while (offsetInMinutes < 0) { offsetInMinutes = intervalInMinutes + offsetInMinutes; } while (offsetInMinutes > intervalInMinutes) { offsetInMinutes -= intervalInMinutes; } return offsetInMinutes * MINUTE_IN_MS; }
[ "public", "static", "long", "calculateOffsetInMs", "(", "int", "intervalInMinutes", ",", "int", "offsetInMinutes", ")", "{", "while", "(", "offsetInMinutes", "<", "0", ")", "{", "offsetInMinutes", "=", "intervalInMinutes", "+", "offsetInMinutes", ";", "}", "while", "(", "offsetInMinutes", ">", "intervalInMinutes", ")", "{", "offsetInMinutes", "-=", "intervalInMinutes", ";", "}", "return", "offsetInMinutes", "*", "MINUTE_IN_MS", ";", "}" ]
Reformulates negative offsets or offsets larger than interval. @param intervalInMinutes @param offsetInMinutes @return offset in milliseconds
[ "Reformulates", "negative", "offsets", "or", "offsets", "larger", "than", "interval", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java#L68-L76
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getDouble
public double getDouble(String name, double defaultValue) { """ Returns the double value for the specified name. If the name does not exist or the value for the name can not be interpreted as a double, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue """ try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Double.parseDouble(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse double for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
java
public double getDouble(String name, double defaultValue) { try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Double.parseDouble(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse double for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
[ "public", "double", "getDouble", "(", "String", "name", ",", "double", "defaultValue", ")", "{", "try", "{", "String", "value", "=", "getString", "(", "name", ",", "null", ")", ";", "if", "(", "!", "StringUtils", ".", "isNullOrEmpty", "(", "value", ")", ")", "{", "return", "Double", ".", "parseDouble", "(", "value", ".", "trim", "(", ")", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "log", ".", "warn", "(", "\"Failed to parse double for \"", "+", "name", "+", "USING_DEFAULT_OF", "+", "defaultValue", ")", ";", "}", "return", "defaultValue", ";", "}" ]
Returns the double value for the specified name. If the name does not exist or the value for the name can not be interpreted as a double, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue
[ "Returns", "the", "double", "value", "for", "the", "specified", "name", ".", "If", "the", "name", "does", "not", "exist", "or", "the", "value", "for", "the", "name", "can", "not", "be", "interpreted", "as", "a", "double", "the", "defaultValue", "is", "returned", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L564-L576
killbill/killbill
invoice/src/main/java/org/killbill/billing/invoice/usage/ContiguousIntervalUsageInArrear.java
ContiguousIntervalUsageInArrear.computeMissingItemsAndNextNotificationDate
public UsageInArrearItemsAndNextNotificationDate computeMissingItemsAndNextNotificationDate(final List<InvoiceItem> existingUsage) throws CatalogApiException, InvoiceApiException { """ Compute the missing usage invoice items based on what should be billed and what has been billed ($ amount comparison). @param existingUsage existing on disk usage items for the subscription @throws CatalogApiException """ Preconditions.checkState(isBuilt.get()); if (transitionTimes.size() < 2) { return new UsageInArrearItemsAndNextNotificationDate(ImmutableList.<InvoiceItem>of(), ImmutableSet.of(), computeNextNotificationDate()); } final List<InvoiceItem> result = Lists.newLinkedList(); final RolledUpUnitsWithTracking allUsageWithTracking = getRolledUpUsage(); final List<RolledUpUsage> allUsage = allUsageWithTracking.getUsage(); final Set<TrackingRecordId> allTrackingIds = allUsageWithTracking.getTrackingIds(); final Set<TrackingRecordId> existingTrackingIds = extractTrackingIds(allExistingTrackingIds); final Set<TrackingRecordId> newTrackingIds = Sets.filter(allTrackingIds, new Predicate<TrackingRecordId>() { @Override public boolean apply(final TrackingRecordId allRecord) { return ! Iterables.any(existingTrackingIds, new Predicate<TrackingRecordId>() { @Override public boolean apply(final TrackingRecordId existingRecord) { return existingRecord.isSimilarRecord(allRecord); } }); } }); // Each RolledUpUsage 'ru' is for a specific time period and across all units for (final RolledUpUsage ru : allUsage) { // // Previously billed items: // // 1. Retrieves current price amount billed for that period of time (and usage section) final Iterable<InvoiceItem> billedItems = getBilledItems(ru.getStart(), ru.getEnd(), existingUsage); // 2. Verify whether previously built items have the item_details section final boolean areAllBilledItemsWithDetails = areAllBilledItemsWithDetails(billedItems); // 3. verify if we already billed that period - use to decide whether we should include $0 items when there is nothing to bill for. final boolean isPeriodPreviouslyBilled = !Iterables.isEmpty(billedItems); // 4. Computes total billed usage amount final BigDecimal billedUsage = computeBilledUsage(billedItems); final List<RolledUpUnit> rolledUpUnits = ru.getRolledUpUnits(); final UsageInArrearAggregate toBeBilledUsageDetails = getToBeBilledUsageDetails(rolledUpUnits, billedItems, areAllBilledItemsWithDetails); final BigDecimal toBeBilledUsageUnrounded = toBeBilledUsageDetails.getAmount(); // See https://github.com/killbill/killbill/issues/1124 final BigDecimal toBeBilledUsage = KillBillMoney.of(toBeBilledUsageUnrounded, getCurrency()); populateResults(ru.getStart(), ru.getEnd(), billedUsage, toBeBilledUsage, toBeBilledUsageDetails, areAllBilledItemsWithDetails, isPeriodPreviouslyBilled, result); } final LocalDate nextNotificationDate = computeNextNotificationDate(); return new UsageInArrearItemsAndNextNotificationDate(result, newTrackingIds, nextNotificationDate); }
java
public UsageInArrearItemsAndNextNotificationDate computeMissingItemsAndNextNotificationDate(final List<InvoiceItem> existingUsage) throws CatalogApiException, InvoiceApiException { Preconditions.checkState(isBuilt.get()); if (transitionTimes.size() < 2) { return new UsageInArrearItemsAndNextNotificationDate(ImmutableList.<InvoiceItem>of(), ImmutableSet.of(), computeNextNotificationDate()); } final List<InvoiceItem> result = Lists.newLinkedList(); final RolledUpUnitsWithTracking allUsageWithTracking = getRolledUpUsage(); final List<RolledUpUsage> allUsage = allUsageWithTracking.getUsage(); final Set<TrackingRecordId> allTrackingIds = allUsageWithTracking.getTrackingIds(); final Set<TrackingRecordId> existingTrackingIds = extractTrackingIds(allExistingTrackingIds); final Set<TrackingRecordId> newTrackingIds = Sets.filter(allTrackingIds, new Predicate<TrackingRecordId>() { @Override public boolean apply(final TrackingRecordId allRecord) { return ! Iterables.any(existingTrackingIds, new Predicate<TrackingRecordId>() { @Override public boolean apply(final TrackingRecordId existingRecord) { return existingRecord.isSimilarRecord(allRecord); } }); } }); // Each RolledUpUsage 'ru' is for a specific time period and across all units for (final RolledUpUsage ru : allUsage) { // // Previously billed items: // // 1. Retrieves current price amount billed for that period of time (and usage section) final Iterable<InvoiceItem> billedItems = getBilledItems(ru.getStart(), ru.getEnd(), existingUsage); // 2. Verify whether previously built items have the item_details section final boolean areAllBilledItemsWithDetails = areAllBilledItemsWithDetails(billedItems); // 3. verify if we already billed that period - use to decide whether we should include $0 items when there is nothing to bill for. final boolean isPeriodPreviouslyBilled = !Iterables.isEmpty(billedItems); // 4. Computes total billed usage amount final BigDecimal billedUsage = computeBilledUsage(billedItems); final List<RolledUpUnit> rolledUpUnits = ru.getRolledUpUnits(); final UsageInArrearAggregate toBeBilledUsageDetails = getToBeBilledUsageDetails(rolledUpUnits, billedItems, areAllBilledItemsWithDetails); final BigDecimal toBeBilledUsageUnrounded = toBeBilledUsageDetails.getAmount(); // See https://github.com/killbill/killbill/issues/1124 final BigDecimal toBeBilledUsage = KillBillMoney.of(toBeBilledUsageUnrounded, getCurrency()); populateResults(ru.getStart(), ru.getEnd(), billedUsage, toBeBilledUsage, toBeBilledUsageDetails, areAllBilledItemsWithDetails, isPeriodPreviouslyBilled, result); } final LocalDate nextNotificationDate = computeNextNotificationDate(); return new UsageInArrearItemsAndNextNotificationDate(result, newTrackingIds, nextNotificationDate); }
[ "public", "UsageInArrearItemsAndNextNotificationDate", "computeMissingItemsAndNextNotificationDate", "(", "final", "List", "<", "InvoiceItem", ">", "existingUsage", ")", "throws", "CatalogApiException", ",", "InvoiceApiException", "{", "Preconditions", ".", "checkState", "(", "isBuilt", ".", "get", "(", ")", ")", ";", "if", "(", "transitionTimes", ".", "size", "(", ")", "<", "2", ")", "{", "return", "new", "UsageInArrearItemsAndNextNotificationDate", "(", "ImmutableList", ".", "<", "InvoiceItem", ">", "of", "(", ")", ",", "ImmutableSet", ".", "of", "(", ")", ",", "computeNextNotificationDate", "(", ")", ")", ";", "}", "final", "List", "<", "InvoiceItem", ">", "result", "=", "Lists", ".", "newLinkedList", "(", ")", ";", "final", "RolledUpUnitsWithTracking", "allUsageWithTracking", "=", "getRolledUpUsage", "(", ")", ";", "final", "List", "<", "RolledUpUsage", ">", "allUsage", "=", "allUsageWithTracking", ".", "getUsage", "(", ")", ";", "final", "Set", "<", "TrackingRecordId", ">", "allTrackingIds", "=", "allUsageWithTracking", ".", "getTrackingIds", "(", ")", ";", "final", "Set", "<", "TrackingRecordId", ">", "existingTrackingIds", "=", "extractTrackingIds", "(", "allExistingTrackingIds", ")", ";", "final", "Set", "<", "TrackingRecordId", ">", "newTrackingIds", "=", "Sets", ".", "filter", "(", "allTrackingIds", ",", "new", "Predicate", "<", "TrackingRecordId", ">", "(", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "final", "TrackingRecordId", "allRecord", ")", "{", "return", "!", "Iterables", ".", "any", "(", "existingTrackingIds", ",", "new", "Predicate", "<", "TrackingRecordId", ">", "(", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "final", "TrackingRecordId", "existingRecord", ")", "{", "return", "existingRecord", ".", "isSimilarRecord", "(", "allRecord", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "// Each RolledUpUsage 'ru' is for a specific time period and across all units", "for", "(", "final", "RolledUpUsage", "ru", ":", "allUsage", ")", "{", "//", "// Previously billed items:", "//", "// 1. Retrieves current price amount billed for that period of time (and usage section)", "final", "Iterable", "<", "InvoiceItem", ">", "billedItems", "=", "getBilledItems", "(", "ru", ".", "getStart", "(", ")", ",", "ru", ".", "getEnd", "(", ")", ",", "existingUsage", ")", ";", "// 2. Verify whether previously built items have the item_details section", "final", "boolean", "areAllBilledItemsWithDetails", "=", "areAllBilledItemsWithDetails", "(", "billedItems", ")", ";", "// 3. verify if we already billed that period - use to decide whether we should include $0 items when there is nothing to bill for.", "final", "boolean", "isPeriodPreviouslyBilled", "=", "!", "Iterables", ".", "isEmpty", "(", "billedItems", ")", ";", "// 4. Computes total billed usage amount", "final", "BigDecimal", "billedUsage", "=", "computeBilledUsage", "(", "billedItems", ")", ";", "final", "List", "<", "RolledUpUnit", ">", "rolledUpUnits", "=", "ru", ".", "getRolledUpUnits", "(", ")", ";", "final", "UsageInArrearAggregate", "toBeBilledUsageDetails", "=", "getToBeBilledUsageDetails", "(", "rolledUpUnits", ",", "billedItems", ",", "areAllBilledItemsWithDetails", ")", ";", "final", "BigDecimal", "toBeBilledUsageUnrounded", "=", "toBeBilledUsageDetails", ".", "getAmount", "(", ")", ";", "// See https://github.com/killbill/killbill/issues/1124", "final", "BigDecimal", "toBeBilledUsage", "=", "KillBillMoney", ".", "of", "(", "toBeBilledUsageUnrounded", ",", "getCurrency", "(", ")", ")", ";", "populateResults", "(", "ru", ".", "getStart", "(", ")", ",", "ru", ".", "getEnd", "(", ")", ",", "billedUsage", ",", "toBeBilledUsage", ",", "toBeBilledUsageDetails", ",", "areAllBilledItemsWithDetails", ",", "isPeriodPreviouslyBilled", ",", "result", ")", ";", "}", "final", "LocalDate", "nextNotificationDate", "=", "computeNextNotificationDate", "(", ")", ";", "return", "new", "UsageInArrearItemsAndNextNotificationDate", "(", "result", ",", "newTrackingIds", ",", "nextNotificationDate", ")", ";", "}" ]
Compute the missing usage invoice items based on what should be billed and what has been billed ($ amount comparison). @param existingUsage existing on disk usage items for the subscription @throws CatalogApiException
[ "Compute", "the", "missing", "usage", "invoice", "items", "based", "on", "what", "should", "be", "billed", "and", "what", "has", "been", "billed", "(", "$", "amount", "comparison", ")", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/usage/ContiguousIntervalUsageInArrear.java#L188-L246
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setStart
public void setStart(int index, Date value) { """ Set a start value. @param index start index (1-10) @param value start value """ set(selectField(TaskFieldLists.CUSTOM_START, index), value); }
java
public void setStart(int index, Date value) { set(selectField(TaskFieldLists.CUSTOM_START, index), value); }
[ "public", "void", "setStart", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "CUSTOM_START", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a start value. @param index start index (1-10) @param value start value
[ "Set", "a", "start", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L2499-L2502
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PKeyArea.java
PKeyArea.doWrite
public void doWrite(FieldTable table, KeyAreaInfo keyArea, BaseBuffer bufferNew) throws DBException { """ Add this record (Always called from the record class). @param table The basetable. @param keyArea The key area. @param bufferNew The buffer to add. @exception DBException File exception. """ BaseBuffer bufferSeek = this.doSeek("==", table, keyArea); if (bufferSeek != null) // if (this.GetUniqueKeyCode() == DBConstants.UNIQUE) // Success means this one already exists throw new DBException(Constants.DUPLICATE_KEY); this.insertCurrent(table, keyArea, bufferNew, +1); // Point to next HIGHER key }
java
public void doWrite(FieldTable table, KeyAreaInfo keyArea, BaseBuffer bufferNew) throws DBException { BaseBuffer bufferSeek = this.doSeek("==", table, keyArea); if (bufferSeek != null) // if (this.GetUniqueKeyCode() == DBConstants.UNIQUE) // Success means this one already exists throw new DBException(Constants.DUPLICATE_KEY); this.insertCurrent(table, keyArea, bufferNew, +1); // Point to next HIGHER key }
[ "public", "void", "doWrite", "(", "FieldTable", "table", ",", "KeyAreaInfo", "keyArea", ",", "BaseBuffer", "bufferNew", ")", "throws", "DBException", "{", "BaseBuffer", "bufferSeek", "=", "this", ".", "doSeek", "(", "\"==\"", ",", "table", ",", "keyArea", ")", ";", "if", "(", "bufferSeek", "!=", "null", ")", "// if (this.GetUniqueKeyCode() == DBConstants.UNIQUE) // Success means this one already exists", "throw", "new", "DBException", "(", "Constants", ".", "DUPLICATE_KEY", ")", ";", "this", ".", "insertCurrent", "(", "table", ",", "keyArea", ",", "bufferNew", ",", "+", "1", ")", ";", "// Point to next HIGHER key", "}" ]
Add this record (Always called from the record class). @param table The basetable. @param keyArea The key area. @param bufferNew The buffer to add. @exception DBException File exception.
[ "Add", "this", "record", "(", "Always", "called", "from", "the", "record", "class", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PKeyArea.java#L160-L166
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByHomePhone
public Iterable<DContact> queryByHomePhone(Object parent, java.lang.String homePhone) { """ query-by method for field homePhone @param homePhone the specified attribute @return an Iterable of DContacts for the specified homePhone """ return queryByField(parent, DContactMapper.Field.HOMEPHONE.getFieldName(), homePhone); }
java
public Iterable<DContact> queryByHomePhone(Object parent, java.lang.String homePhone) { return queryByField(parent, DContactMapper.Field.HOMEPHONE.getFieldName(), homePhone); }
[ "public", "Iterable", "<", "DContact", ">", "queryByHomePhone", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "homePhone", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "HOMEPHONE", ".", "getFieldName", "(", ")", ",", "homePhone", ")", ";", "}" ]
query-by method for field homePhone @param homePhone the specified attribute @return an Iterable of DContacts for the specified homePhone
[ "query", "-", "by", "method", "for", "field", "homePhone" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L178-L180
alkacon/opencms-core
src/org/opencms/search/CmsSearchIndex.java
CmsSearchIndex.appendDateLastModifiedFilter
protected BooleanQuery.Builder appendDateLastModifiedFilter( BooleanQuery.Builder filter, long startTime, long endTime) { """ Appends a date of last modification filter to the given filter clause that matches the given time range.<p> If the start time is equal to {@link Long#MIN_VALUE} and the end time is equal to {@link Long#MAX_VALUE} than the original filter is left unchanged.<p> The original filter parameter is extended and also provided as return value.<p> @param filter the filter to extend @param startTime start time of the range to search in @param endTime end time of the range to search in @return the extended filter clause """ // create special optimized sub-filter for the date last modified search Query dateFilter = createDateRangeFilter(CmsSearchField.FIELD_DATE_LASTMODIFIED_LOOKUP, startTime, endTime); if (dateFilter != null) { // extend main filter with the created date filter filter.add(new BooleanClause(dateFilter, BooleanClause.Occur.MUST)); } return filter; }
java
protected BooleanQuery.Builder appendDateLastModifiedFilter( BooleanQuery.Builder filter, long startTime, long endTime) { // create special optimized sub-filter for the date last modified search Query dateFilter = createDateRangeFilter(CmsSearchField.FIELD_DATE_LASTMODIFIED_LOOKUP, startTime, endTime); if (dateFilter != null) { // extend main filter with the created date filter filter.add(new BooleanClause(dateFilter, BooleanClause.Occur.MUST)); } return filter; }
[ "protected", "BooleanQuery", ".", "Builder", "appendDateLastModifiedFilter", "(", "BooleanQuery", ".", "Builder", "filter", ",", "long", "startTime", ",", "long", "endTime", ")", "{", "// create special optimized sub-filter for the date last modified search", "Query", "dateFilter", "=", "createDateRangeFilter", "(", "CmsSearchField", ".", "FIELD_DATE_LASTMODIFIED_LOOKUP", ",", "startTime", ",", "endTime", ")", ";", "if", "(", "dateFilter", "!=", "null", ")", "{", "// extend main filter with the created date filter", "filter", ".", "add", "(", "new", "BooleanClause", "(", "dateFilter", ",", "BooleanClause", ".", "Occur", ".", "MUST", ")", ")", ";", "}", "return", "filter", ";", "}" ]
Appends a date of last modification filter to the given filter clause that matches the given time range.<p> If the start time is equal to {@link Long#MIN_VALUE} and the end time is equal to {@link Long#MAX_VALUE} than the original filter is left unchanged.<p> The original filter parameter is extended and also provided as return value.<p> @param filter the filter to extend @param startTime start time of the range to search in @param endTime end time of the range to search in @return the extended filter clause
[ "Appends", "a", "date", "of", "last", "modification", "filter", "to", "the", "given", "filter", "clause", "that", "matches", "the", "given", "time", "range", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1337-L1350
OpenLiberty/open-liberty
dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java
AppBndAuthorizationTableService.updateMissingGroupAccessId
private String updateMissingGroupAccessId(AuthzTableContainer maps, Group group, String groupNameFromRole) { """ Update the map for the specified group name. If the accessID is successfully computed, the map will be updated with the accessID. If the accessID can not be computed due to the user not being found, INVALID_ACCESS_ID will be stored. @param maps @param group @param groupNameFromRole @return """ String accessIdFromRole; accessIdFromRole = getMissingAccessId(group); if (accessIdFromRole != null) { maps.groupToAccessIdMap.put(groupNameFromRole, accessIdFromRole); } else { // Unable to compute the accessId, store an invalid access ID indicate this // and avoid future attempts maps.groupToAccessIdMap.put(groupNameFromRole, INVALID_ACCESS_ID); } return accessIdFromRole; }
java
private String updateMissingGroupAccessId(AuthzTableContainer maps, Group group, String groupNameFromRole) { String accessIdFromRole; accessIdFromRole = getMissingAccessId(group); if (accessIdFromRole != null) { maps.groupToAccessIdMap.put(groupNameFromRole, accessIdFromRole); } else { // Unable to compute the accessId, store an invalid access ID indicate this // and avoid future attempts maps.groupToAccessIdMap.put(groupNameFromRole, INVALID_ACCESS_ID); } return accessIdFromRole; }
[ "private", "String", "updateMissingGroupAccessId", "(", "AuthzTableContainer", "maps", ",", "Group", "group", ",", "String", "groupNameFromRole", ")", "{", "String", "accessIdFromRole", ";", "accessIdFromRole", "=", "getMissingAccessId", "(", "group", ")", ";", "if", "(", "accessIdFromRole", "!=", "null", ")", "{", "maps", ".", "groupToAccessIdMap", ".", "put", "(", "groupNameFromRole", ",", "accessIdFromRole", ")", ";", "}", "else", "{", "// Unable to compute the accessId, store an invalid access ID indicate this", "// and avoid future attempts", "maps", ".", "groupToAccessIdMap", ".", "put", "(", "groupNameFromRole", ",", "INVALID_ACCESS_ID", ")", ";", "}", "return", "accessIdFromRole", ";", "}" ]
Update the map for the specified group name. If the accessID is successfully computed, the map will be updated with the accessID. If the accessID can not be computed due to the user not being found, INVALID_ACCESS_ID will be stored. @param maps @param group @param groupNameFromRole @return
[ "Update", "the", "map", "for", "the", "specified", "group", "name", ".", "If", "the", "accessID", "is", "successfully", "computed", "the", "map", "will", "be", "updated", "with", "the", "accessID", ".", "If", "the", "accessID", "can", "not", "be", "computed", "due", "to", "the", "user", "not", "being", "found", "INVALID_ACCESS_ID", "will", "be", "stored", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java#L408-L419
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/CueList.java
CueList.sortEntries
private List<Entry> sortEntries(List<Entry> loadedEntries) { """ Sorts the entries into the order we want to present them in, which is by position, with hot cues coming after ordinary memory points if both exist at the same position, which often happens. @param loadedEntries the unsorted entries we have loaded from a dbserver message, metadata cache, or rekordbox database export @return an immutable list of the collections in the proper order """ Collections.sort(loadedEntries, new Comparator<Entry>() { @Override public int compare(Entry entry1, Entry entry2) { int result = (int) (entry1.cuePosition - entry2.cuePosition); if (result == 0) { int h1 = (entry1.hotCueNumber != 0) ? 1 : 0; int h2 = (entry2.hotCueNumber != 0) ? 1 : 0; result = h1 - h2; } return result; } }); return Collections.unmodifiableList(loadedEntries); }
java
private List<Entry> sortEntries(List<Entry> loadedEntries) { Collections.sort(loadedEntries, new Comparator<Entry>() { @Override public int compare(Entry entry1, Entry entry2) { int result = (int) (entry1.cuePosition - entry2.cuePosition); if (result == 0) { int h1 = (entry1.hotCueNumber != 0) ? 1 : 0; int h2 = (entry2.hotCueNumber != 0) ? 1 : 0; result = h1 - h2; } return result; } }); return Collections.unmodifiableList(loadedEntries); }
[ "private", "List", "<", "Entry", ">", "sortEntries", "(", "List", "<", "Entry", ">", "loadedEntries", ")", "{", "Collections", ".", "sort", "(", "loadedEntries", ",", "new", "Comparator", "<", "Entry", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Entry", "entry1", ",", "Entry", "entry2", ")", "{", "int", "result", "=", "(", "int", ")", "(", "entry1", ".", "cuePosition", "-", "entry2", ".", "cuePosition", ")", ";", "if", "(", "result", "==", "0", ")", "{", "int", "h1", "=", "(", "entry1", ".", "hotCueNumber", "!=", "0", ")", "?", "1", ":", "0", ";", "int", "h2", "=", "(", "entry2", ".", "hotCueNumber", "!=", "0", ")", "?", "1", ":", "0", ";", "result", "=", "h1", "-", "h2", ";", "}", "return", "result", ";", "}", "}", ")", ";", "return", "Collections", ".", "unmodifiableList", "(", "loadedEntries", ")", ";", "}" ]
Sorts the entries into the order we want to present them in, which is by position, with hot cues coming after ordinary memory points if both exist at the same position, which often happens. @param loadedEntries the unsorted entries we have loaded from a dbserver message, metadata cache, or rekordbox database export @return an immutable list of the collections in the proper order
[ "Sorts", "the", "entries", "into", "the", "order", "we", "want", "to", "present", "them", "in", "which", "is", "by", "position", "with", "hot", "cues", "coming", "after", "ordinary", "memory", "points", "if", "both", "exist", "at", "the", "same", "position", "which", "often", "happens", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CueList.java#L204-L218
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java
JobsInner.getOutput
public InputStream getOutput(String resourceGroupName, String automationAccountName, String jobId) { """ Retrieve the job output identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the InputStream object if successful. """ return getOutputWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body(); }
java
public InputStream getOutput(String resourceGroupName, String automationAccountName, String jobId) { return getOutputWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body(); }
[ "public", "InputStream", "getOutput", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "jobId", ")", "{", "return", "getOutputWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "jobId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve the job output identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the InputStream object if successful.
[ "Retrieve", "the", "job", "output", "identified", "by", "job", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java#L119-L121
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java
ConstructState.addConstructState
public void addConstructState(Constructs construct, ConstructState constructState) { """ See {@link #addConstructState(Constructs, ConstructState, Optional)}. This method uses no infix. """ addConstructState(construct, constructState, Optional.<String>absent()); }
java
public void addConstructState(Constructs construct, ConstructState constructState) { addConstructState(construct, constructState, Optional.<String>absent()); }
[ "public", "void", "addConstructState", "(", "Constructs", "construct", ",", "ConstructState", "constructState", ")", "{", "addConstructState", "(", "construct", ",", "constructState", ",", "Optional", ".", "<", "String", ">", "absent", "(", ")", ")", ";", "}" ]
See {@link #addConstructState(Constructs, ConstructState, Optional)}. This method uses no infix.
[ "See", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java#L82-L84
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/CompiledTemplate.java
CompiledTemplate.exists
public static boolean exists(Compiler c, String name, CompilationUnit from) { """ Test to see of the template can be loaded before CompiledTemplate can be constructed. """ String fqName = getFullyQualifiedName(resolveName(name, from)); try { c.loadClass(fqName); return true; } catch (ClassNotFoundException nx) { try { c.loadClass(resolveName(name, from)); // Try standard path as a last resort return true; } catch (ClassNotFoundException nx2) { return false; } } }
java
public static boolean exists(Compiler c, String name, CompilationUnit from) { String fqName = getFullyQualifiedName(resolveName(name, from)); try { c.loadClass(fqName); return true; } catch (ClassNotFoundException nx) { try { c.loadClass(resolveName(name, from)); // Try standard path as a last resort return true; } catch (ClassNotFoundException nx2) { return false; } } }
[ "public", "static", "boolean", "exists", "(", "Compiler", "c", ",", "String", "name", ",", "CompilationUnit", "from", ")", "{", "String", "fqName", "=", "getFullyQualifiedName", "(", "resolveName", "(", "name", ",", "from", ")", ")", ";", "try", "{", "c", ".", "loadClass", "(", "fqName", ")", ";", "return", "true", ";", "}", "catch", "(", "ClassNotFoundException", "nx", ")", "{", "try", "{", "c", ".", "loadClass", "(", "resolveName", "(", "name", ",", "from", ")", ")", ";", "// Try standard path as a last resort", "return", "true", ";", "}", "catch", "(", "ClassNotFoundException", "nx2", ")", "{", "return", "false", ";", "}", "}", "}" ]
Test to see of the template can be loaded before CompiledTemplate can be constructed.
[ "Test", "to", "see", "of", "the", "template", "can", "be", "loaded", "before", "CompiledTemplate", "can", "be", "constructed", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/CompiledTemplate.java#L126-L141
infinispan/infinispan
query/src/main/java/org/infinispan/query/impl/LifecycleManager.java
LifecycleManager.checkIndexableClasses
private void checkIndexableClasses(SearchIntegrator searchFactory, Set<Class<?>> indexedEntities) { """ Check that the indexable classes declared by the user are really indexable. """ for (Class<?> c : indexedEntities) { if (searchFactory.getIndexBinding(new PojoIndexedTypeIdentifier(c)) == null) { throw log.classNotIndexable(c.getName()); } } }
java
private void checkIndexableClasses(SearchIntegrator searchFactory, Set<Class<?>> indexedEntities) { for (Class<?> c : indexedEntities) { if (searchFactory.getIndexBinding(new PojoIndexedTypeIdentifier(c)) == null) { throw log.classNotIndexable(c.getName()); } } }
[ "private", "void", "checkIndexableClasses", "(", "SearchIntegrator", "searchFactory", ",", "Set", "<", "Class", "<", "?", ">", ">", "indexedEntities", ")", "{", "for", "(", "Class", "<", "?", ">", "c", ":", "indexedEntities", ")", "{", "if", "(", "searchFactory", ".", "getIndexBinding", "(", "new", "PojoIndexedTypeIdentifier", "(", "c", ")", ")", "==", "null", ")", "{", "throw", "log", ".", "classNotIndexable", "(", "c", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
Check that the indexable classes declared by the user are really indexable.
[ "Check", "that", "the", "indexable", "classes", "declared", "by", "the", "user", "are", "really", "indexable", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java#L269-L275
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/ssl/ssl_stats.java
ssl_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { """ <pre> converts nitro response into object and returns the object array in case of get request. </pre> """ ssl_stats[] resources = new ssl_stats[1]; ssl_response result = (ssl_response) service.get_payload_formatter().string_to_resource(ssl_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.ssl; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { ssl_stats[] resources = new ssl_stats[1]; ssl_response result = (ssl_response) service.get_payload_formatter().string_to_resource(ssl_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.ssl; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ssl_stats", "[", "]", "resources", "=", "new", "ssl_stats", "[", "1", "]", ";", "ssl_response", "result", "=", "(", "ssl_response", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "ssl_response", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "444", ")", "{", "service", ".", "clear_session", "(", ")", ";", "}", "if", "(", "result", ".", "severity", "!=", "null", ")", "{", "if", "(", "result", ".", "severity", ".", "equals", "(", "\"ERROR\"", ")", ")", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "else", "{", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "}", "resources", "[", "0", "]", "=", "result", ".", "ssl", ";", "return", "resources", ";", "}" ]
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/ssl/ssl_stats.java#L2397-L2416
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.longToBytes
static public int longToBytes(long l, byte[] buffer, int index) { """ This function converts a long into its corresponding byte format and inserts it into the specified buffer at the specified index. @param l The long to be converted. @param buffer The byte array. @param index The index in the array to begin inserting bytes. @return The number of bytes inserted. """ int length = buffer.length - index; if (length > 8) length = 8; for (int i = 0; i < length; i++) { buffer[index + length - i - 1] = (byte) (l >> (i * 8)); } return length; }
java
static public int longToBytes(long l, byte[] buffer, int index) { int length = buffer.length - index; if (length > 8) length = 8; for (int i = 0; i < length; i++) { buffer[index + length - i - 1] = (byte) (l >> (i * 8)); } return length; }
[ "static", "public", "int", "longToBytes", "(", "long", "l", ",", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "int", "length", "=", "buffer", ".", "length", "-", "index", ";", "if", "(", "length", ">", "8", ")", "length", "=", "8", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", "[", "index", "+", "length", "-", "i", "-", "1", "]", "=", "(", "byte", ")", "(", "l", ">>", "(", "i", "*", "8", ")", ")", ";", "}", "return", "length", ";", "}" ]
This function converts a long into its corresponding byte format and inserts it into the specified buffer at the specified index. @param l The long to be converted. @param buffer The byte array. @param index The index in the array to begin inserting bytes. @return The number of bytes inserted.
[ "This", "function", "converts", "a", "long", "into", "its", "corresponding", "byte", "format", "and", "inserts", "it", "into", "the", "specified", "buffer", "at", "the", "specified", "index", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L280-L287
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java
MavenProjectScannerPlugin.addProjectDetails
private void addProjectDetails(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, Scanner scanner) { """ Add project specific information. @param project The project. @param projectDescriptor The project descriptor. """ ScannerContext scannerContext = scanner.getContext(); addParent(project, projectDescriptor, scannerContext); addModules(project, projectDescriptor, scannerContext); addModel(project, projectDescriptor, scanner); }
java
private void addProjectDetails(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, Scanner scanner) { ScannerContext scannerContext = scanner.getContext(); addParent(project, projectDescriptor, scannerContext); addModules(project, projectDescriptor, scannerContext); addModel(project, projectDescriptor, scanner); }
[ "private", "void", "addProjectDetails", "(", "MavenProject", "project", ",", "MavenProjectDirectoryDescriptor", "projectDescriptor", ",", "Scanner", "scanner", ")", "{", "ScannerContext", "scannerContext", "=", "scanner", ".", "getContext", "(", ")", ";", "addParent", "(", "project", ",", "projectDescriptor", ",", "scannerContext", ")", ";", "addModules", "(", "project", ",", "projectDescriptor", ",", "scannerContext", ")", ";", "addModel", "(", "project", ",", "projectDescriptor", ",", "scanner", ")", ";", "}" ]
Add project specific information. @param project The project. @param projectDescriptor The project descriptor.
[ "Add", "project", "specific", "information", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java#L199-L204
opentable/otj-logging
core/src/main/java/com/opentable/logging/CommonLogHolder.java
CommonLogHolder.setEnvironment
public static void setEnvironment(String otEnv, String otEnvType, String otEnvLocation, String otEnvFlavor) { """ Mock out the environment. You probably don't want to do this. """ OT_ENV = otEnv; OT_ENV_TYPE = otEnvType; OT_ENV_LOCATION = otEnvLocation; OT_ENV_FLAVOR = otEnvFlavor; }
java
public static void setEnvironment(String otEnv, String otEnvType, String otEnvLocation, String otEnvFlavor) { OT_ENV = otEnv; OT_ENV_TYPE = otEnvType; OT_ENV_LOCATION = otEnvLocation; OT_ENV_FLAVOR = otEnvFlavor; }
[ "public", "static", "void", "setEnvironment", "(", "String", "otEnv", ",", "String", "otEnvType", ",", "String", "otEnvLocation", ",", "String", "otEnvFlavor", ")", "{", "OT_ENV", "=", "otEnv", ";", "OT_ENV_TYPE", "=", "otEnvType", ";", "OT_ENV_LOCATION", "=", "otEnvLocation", ";", "OT_ENV_FLAVOR", "=", "otEnvFlavor", ";", "}" ]
Mock out the environment. You probably don't want to do this.
[ "Mock", "out", "the", "environment", ".", "You", "probably", "don", "t", "want", "to", "do", "this", "." ]
train
https://github.com/opentable/otj-logging/blob/eaa74c877c4721ddb9af8eb7fe1612166f7ac14d/core/src/main/java/com/opentable/logging/CommonLogHolder.java#L70-L75
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendColName
protected boolean appendColName(TableAlias aTableAlias, PathInfo aPathInfo, boolean translate, StringBuffer buf) { """ Add the Column to the StringBuffer <br> @param aTableAlias @param aPathInfo @param translate flag to indicate translation of pathInfo @param buf @return true if appended """ String prefix = aPathInfo.prefix; String suffix = aPathInfo.suffix; String colName = getColName(aTableAlias, aPathInfo, translate); if (prefix != null) // rebuild function contains ( { buf.append(prefix); } buf.append(colName); if (suffix != null) // rebuild function { buf.append(suffix); } return true; }
java
protected boolean appendColName(TableAlias aTableAlias, PathInfo aPathInfo, boolean translate, StringBuffer buf) { String prefix = aPathInfo.prefix; String suffix = aPathInfo.suffix; String colName = getColName(aTableAlias, aPathInfo, translate); if (prefix != null) // rebuild function contains ( { buf.append(prefix); } buf.append(colName); if (suffix != null) // rebuild function { buf.append(suffix); } return true; }
[ "protected", "boolean", "appendColName", "(", "TableAlias", "aTableAlias", ",", "PathInfo", "aPathInfo", ",", "boolean", "translate", ",", "StringBuffer", "buf", ")", "{", "String", "prefix", "=", "aPathInfo", ".", "prefix", ";", "String", "suffix", "=", "aPathInfo", ".", "suffix", ";", "String", "colName", "=", "getColName", "(", "aTableAlias", ",", "aPathInfo", ",", "translate", ")", ";", "if", "(", "prefix", "!=", "null", ")", "// rebuild function contains (\r", "{", "buf", ".", "append", "(", "prefix", ")", ";", "}", "buf", ".", "append", "(", "colName", ")", ";", "if", "(", "suffix", "!=", "null", ")", "// rebuild function\r", "{", "buf", ".", "append", "(", "suffix", ")", ";", "}", "return", "true", ";", "}" ]
Add the Column to the StringBuffer <br> @param aTableAlias @param aPathInfo @param translate flag to indicate translation of pathInfo @param buf @return true if appended
[ "Add", "the", "Column", "to", "the", "StringBuffer", "<br", ">" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L314-L333
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java
SerializerBase.addXSLAttribute
public void addXSLAttribute(String name, final String value, final String uri) { """ Adds the given xsl:attribute to the set of collected attributes, but only if there is a currently open element. @param name the attribute's qualified name (prefix:localName) @param value the value of the attribute @param uri the URI that the prefix of the name points to """ if (m_elemContext.m_startTagOpen) { final String patchedName = patchName(name); final String localName = getLocalName(patchedName); addAttributeAlways(uri,localName, patchedName, "CDATA", value, true); } }
java
public void addXSLAttribute(String name, final String value, final String uri) { if (m_elemContext.m_startTagOpen) { final String patchedName = patchName(name); final String localName = getLocalName(patchedName); addAttributeAlways(uri,localName, patchedName, "CDATA", value, true); } }
[ "public", "void", "addXSLAttribute", "(", "String", "name", ",", "final", "String", "value", ",", "final", "String", "uri", ")", "{", "if", "(", "m_elemContext", ".", "m_startTagOpen", ")", "{", "final", "String", "patchedName", "=", "patchName", "(", "name", ")", ";", "final", "String", "localName", "=", "getLocalName", "(", "patchedName", ")", ";", "addAttributeAlways", "(", "uri", ",", "localName", ",", "patchedName", ",", "\"CDATA\"", ",", "value", ",", "true", ")", ";", "}", "}" ]
Adds the given xsl:attribute to the set of collected attributes, but only if there is a currently open element. @param name the attribute's qualified name (prefix:localName) @param value the value of the attribute @param uri the URI that the prefix of the name points to
[ "Adds", "the", "given", "xsl", ":", "attribute", "to", "the", "set", "of", "collected", "attributes", "but", "only", "if", "there", "is", "a", "currently", "open", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L464-L473
structurizr/java
structurizr-core/src/com/structurizr/model/Container.java
Container.addComponent
public Component addComponent(String name, String type, String description, String technology) { """ Adds a component to this container. @param name the name of the component @param type a String describing the fully qualified name of the primary type of the component @param description a description of the component @param technology the technology of the component @return the resulting Component instance @throws IllegalArgumentException if the component name is null or empty, or a component with the same name already exists """ return getModel().addComponentOfType(this, name, type, description, technology); }
java
public Component addComponent(String name, String type, String description, String technology) { return getModel().addComponentOfType(this, name, type, description, technology); }
[ "public", "Component", "addComponent", "(", "String", "name", ",", "String", "type", ",", "String", "description", ",", "String", "technology", ")", "{", "return", "getModel", "(", ")", ".", "addComponentOfType", "(", "this", ",", "name", ",", "type", ",", "description", ",", "technology", ")", ";", "}" ]
Adds a component to this container. @param name the name of the component @param type a String describing the fully qualified name of the primary type of the component @param description a description of the component @param technology the technology of the component @return the resulting Component instance @throws IllegalArgumentException if the component name is null or empty, or a component with the same name already exists
[ "Adds", "a", "component", "to", "this", "container", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Container.java#L113-L115
andriusvelykis/reflow-maven-skin
reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java
HtmlTool.generateUniqueId
private static String generateUniqueId(Set<String> ids, String idBase) { """ Generated a unique ID within the given set of IDs. Appends an incrementing number for duplicates. @param ids @param idBase @return """ String id = idBase; int counter = 1; while (ids.contains(id)) { id = idBase + String.valueOf(counter++); } // put the newly generated one into the set ids.add(id); return id; }
java
private static String generateUniqueId(Set<String> ids, String idBase) { String id = idBase; int counter = 1; while (ids.contains(id)) { id = idBase + String.valueOf(counter++); } // put the newly generated one into the set ids.add(id); return id; }
[ "private", "static", "String", "generateUniqueId", "(", "Set", "<", "String", ">", "ids", ",", "String", "idBase", ")", "{", "String", "id", "=", "idBase", ";", "int", "counter", "=", "1", ";", "while", "(", "ids", ".", "contains", "(", "id", ")", ")", "{", "id", "=", "idBase", "+", "String", ".", "valueOf", "(", "counter", "++", ")", ";", "}", "// put the newly generated one into the set", "ids", ".", "add", "(", "id", ")", ";", "return", "id", ";", "}" ]
Generated a unique ID within the given set of IDs. Appends an incrementing number for duplicates. @param ids @param idBase @return
[ "Generated", "a", "unique", "ID", "within", "the", "given", "set", "of", "IDs", ".", "Appends", "an", "incrementing", "number", "for", "duplicates", "." ]
train
https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L1065-L1075
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuPointerSetAttribute
public static int cuPointerSetAttribute(Pointer value, int attribute, CUdeviceptr ptr) { """ Set attributes on a previously allocated memory region<br> <br> The supported attributes are: <br> <ul> <li>CU_POINTER_ATTRIBUTE_SYNC_MEMOPS: A boolean attribute that can either be set (1) or unset (0). When set, the region of memory that ptr points to is guaranteed to always synchronize memory operations that are synchronous. If there are some previously initiated synchronous memory operations that are pending when this attribute is set, the function does not return until those memory operations are complete. See further documentation in the section titled "API synchronization behavior" to learn more about cases when synchronous memory operations can exhibit asynchronous behavior. value will be considered as a pointer to an unsigned integer to which this attribute is to be set. </li> </ul> @param value Pointer to memory containing the value to be set @param attribute Pointer attribute to set @param ptr Pointer to a memory region allocated using CUDA memory allocation APIs @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_DEVICE @see JCudaDriver#cuPointerGetAttribute, @see JCudaDriver#cuPointerGetAttributes, @see JCudaDriver#cuMemAlloc, @see JCudaDriver#cuMemFree, @see JCudaDriver#cuMemAllocHost, @see JCudaDriver#cuMemFreeHost, @see JCudaDriver#cuMemHostAlloc, @see JCudaDriver#cuMemHostRegister, @see JCudaDriver#cuMemHostUnregister """ return checkResult(cuPointerSetAttributeNative(value, attribute, ptr)); }
java
public static int cuPointerSetAttribute(Pointer value, int attribute, CUdeviceptr ptr) { return checkResult(cuPointerSetAttributeNative(value, attribute, ptr)); }
[ "public", "static", "int", "cuPointerSetAttribute", "(", "Pointer", "value", ",", "int", "attribute", ",", "CUdeviceptr", "ptr", ")", "{", "return", "checkResult", "(", "cuPointerSetAttributeNative", "(", "value", ",", "attribute", ",", "ptr", ")", ")", ";", "}" ]
Set attributes on a previously allocated memory region<br> <br> The supported attributes are: <br> <ul> <li>CU_POINTER_ATTRIBUTE_SYNC_MEMOPS: A boolean attribute that can either be set (1) or unset (0). When set, the region of memory that ptr points to is guaranteed to always synchronize memory operations that are synchronous. If there are some previously initiated synchronous memory operations that are pending when this attribute is set, the function does not return until those memory operations are complete. See further documentation in the section titled "API synchronization behavior" to learn more about cases when synchronous memory operations can exhibit asynchronous behavior. value will be considered as a pointer to an unsigned integer to which this attribute is to be set. </li> </ul> @param value Pointer to memory containing the value to be set @param attribute Pointer attribute to set @param ptr Pointer to a memory region allocated using CUDA memory allocation APIs @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_DEVICE @see JCudaDriver#cuPointerGetAttribute, @see JCudaDriver#cuPointerGetAttributes, @see JCudaDriver#cuMemAlloc, @see JCudaDriver#cuMemFree, @see JCudaDriver#cuMemAllocHost, @see JCudaDriver#cuMemFreeHost, @see JCudaDriver#cuMemHostAlloc, @see JCudaDriver#cuMemHostRegister, @see JCudaDriver#cuMemHostUnregister
[ "Set", "attributes", "on", "a", "previously", "allocated", "memory", "region<br", ">", "<br", ">", "The", "supported", "attributes", "are", ":", "<br", ">", "<ul", ">", "<li", ">", "CU_POINTER_ATTRIBUTE_SYNC_MEMOPS", ":" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L14293-L14296
JavaMoney/jsr354-api
src/main/java/javax/money/convert/ConversionContext.java
ConversionContext.from
public static ConversionContext from(ProviderContext providerContext, RateType rateType) { """ Creates a new ConversionContext for the given {@link ProviderContext} and the given {@link RateType}. <p> <i>Note:</i> for adding additional attributes use {@link javax.money.convert.ConversionContextBuilder (ProviderContext, RateType)}. @param providerContext the provider context, not null. @param rateType the rate type, not null. @return a corresponding instance of ConversionContext. """ return ConversionContextBuilder.create(providerContext, rateType).build(); }
java
public static ConversionContext from(ProviderContext providerContext, RateType rateType) { return ConversionContextBuilder.create(providerContext, rateType).build(); }
[ "public", "static", "ConversionContext", "from", "(", "ProviderContext", "providerContext", ",", "RateType", "rateType", ")", "{", "return", "ConversionContextBuilder", ".", "create", "(", "providerContext", ",", "rateType", ")", ".", "build", "(", ")", ";", "}" ]
Creates a new ConversionContext for the given {@link ProviderContext} and the given {@link RateType}. <p> <i>Note:</i> for adding additional attributes use {@link javax.money.convert.ConversionContextBuilder (ProviderContext, RateType)}. @param providerContext the provider context, not null. @param rateType the rate type, not null. @return a corresponding instance of ConversionContext.
[ "Creates", "a", "new", "ConversionContext", "for", "the", "given", "{", "@link", "ProviderContext", "}", "and", "the", "given", "{", "@link", "RateType", "}", ".", "<p", ">", "<i", ">", "Note", ":", "<", "/", "i", ">", "for", "adding", "additional", "attributes", "use", "{", "@link", "javax", ".", "money", ".", "convert", ".", "ConversionContextBuilder", "(", "ProviderContext", "RateType", ")", "}", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ConversionContext.java#L139-L141
Wikidata/Wikidata-Toolkit
wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataFetcher.java
WikibaseDataFetcher.getEntityDocumentsByTitle
public Map<String, EntityDocument> getEntityDocumentsByTitle( String siteKey, String... titles) throws MediaWikiApiErrorException, IOException { """ Fetches the documents for the entities that have pages of the given titles on the given site. Site keys should be some site identifier known to the Wikibase site that is queried, such as "enwiki" for Wikidata.org. <p> Note: This method will not work properly if a filter is set for sites that excludes the requested site. @param siteKey wiki site id, e.g. "enwiki" @param titles list of string titles (e.g. "Douglas Adams") of requested entities @return map from titles for which data could be found to the documents that were retrieved @throws MediaWikiApiErrorException @throws IOException """ return getEntityDocumentsByTitle(siteKey, Arrays.asList(titles)); }
java
public Map<String, EntityDocument> getEntityDocumentsByTitle( String siteKey, String... titles) throws MediaWikiApiErrorException, IOException { return getEntityDocumentsByTitle(siteKey, Arrays.asList(titles)); }
[ "public", "Map", "<", "String", ",", "EntityDocument", ">", "getEntityDocumentsByTitle", "(", "String", "siteKey", ",", "String", "...", "titles", ")", "throws", "MediaWikiApiErrorException", ",", "IOException", "{", "return", "getEntityDocumentsByTitle", "(", "siteKey", ",", "Arrays", ".", "asList", "(", "titles", ")", ")", ";", "}" ]
Fetches the documents for the entities that have pages of the given titles on the given site. Site keys should be some site identifier known to the Wikibase site that is queried, such as "enwiki" for Wikidata.org. <p> Note: This method will not work properly if a filter is set for sites that excludes the requested site. @param siteKey wiki site id, e.g. "enwiki" @param titles list of string titles (e.g. "Douglas Adams") of requested entities @return map from titles for which data could be found to the documents that were retrieved @throws MediaWikiApiErrorException @throws IOException
[ "Fetches", "the", "documents", "for", "the", "entities", "that", "have", "pages", "of", "the", "given", "titles", "on", "the", "given", "site", ".", "Site", "keys", "should", "be", "some", "site", "identifier", "known", "to", "the", "Wikibase", "site", "that", "is", "queried", "such", "as", "enwiki", "for", "Wikidata", ".", "org", ".", "<p", ">", "Note", ":", "This", "method", "will", "not", "work", "properly", "if", "a", "filter", "is", "set", "for", "sites", "that", "excludes", "the", "requested", "site", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WikibaseDataFetcher.java#L234-L237
lightblueseas/vintage-time
src/main/java/de/alpharogroup/date/ParseDateExtensions.java
ParseDateExtensions.parseToString
public static String parseToString(final Date date, final String format, final Locale locale) { """ The Method parseToString(Date, String) formats the given Date to the given Format. For Example: Date date =new Date(System.currentTimeMillis()); String format = "dd.MM.yyyy HH:mm:ss"; String now = UtilDate.parseToString(date, format); System.out.println(now); The output would be something like this:'15.07.2005 14:12:00' @param date The Date to format to a String @param format The Format for the date @param locale The Locale object in which Language to get the format string. @return The formated String """ final DateFormat df = new SimpleDateFormat(format, locale); return df.format(date); }
java
public static String parseToString(final Date date, final String format, final Locale locale) { final DateFormat df = new SimpleDateFormat(format, locale); return df.format(date); }
[ "public", "static", "String", "parseToString", "(", "final", "Date", "date", ",", "final", "String", "format", ",", "final", "Locale", "locale", ")", "{", "final", "DateFormat", "df", "=", "new", "SimpleDateFormat", "(", "format", ",", "locale", ")", ";", "return", "df", ".", "format", "(", "date", ")", ";", "}" ]
The Method parseToString(Date, String) formats the given Date to the given Format. For Example: Date date =new Date(System.currentTimeMillis()); String format = "dd.MM.yyyy HH:mm:ss"; String now = UtilDate.parseToString(date, format); System.out.println(now); The output would be something like this:'15.07.2005 14:12:00' @param date The Date to format to a String @param format The Format for the date @param locale The Locale object in which Language to get the format string. @return The formated String
[ "The", "Method", "parseToString", "(", "Date", "String", ")", "formats", "the", "given", "Date", "to", "the", "given", "Format", ".", "For", "Example", ":", "Date", "date", "=", "new", "Date", "(", "System", ".", "currentTimeMillis", "()", ")", ";", "String", "format", "=", "dd", ".", "MM", ".", "yyyy", "HH", ":", "mm", ":", "ss", ";", "String", "now", "=", "UtilDate", ".", "parseToString", "(", "date", "format", ")", ";", "System", ".", "out", ".", "println", "(", "now", ")", ";", "The", "output", "would", "be", "something", "like", "this", ":", "15", ".", "07", ".", "2005", "14", ":", "12", ":", "00" ]
train
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L183-L187
amzn/ion-java
src/com/amazon/ion/util/IonTextUtils.java
IonTextUtils.printSymbol
public static void printSymbol(Appendable out, CharSequence text) throws IOException { """ Prints the text as an Ion symbol, including surrounding single-quotes if they are necessary. Operator symbols such as {@code '+'} are quoted. If the {@code text} is null, this prints {@code null.symbol}. @param out the stream to receive the Ion data. @param text the symbol text; may be {@code null}. @throws IOException if the {@link Appendable} throws an exception. @see #printSymbol(CharSequence) """ if (text == null) { out.append("null.symbol"); } else if (symbolNeedsQuoting(text, true)) { printQuotedSymbol(out, text); } else { out.append(text); } }
java
public static void printSymbol(Appendable out, CharSequence text) throws IOException { if (text == null) { out.append("null.symbol"); } else if (symbolNeedsQuoting(text, true)) { printQuotedSymbol(out, text); } else { out.append(text); } }
[ "public", "static", "void", "printSymbol", "(", "Appendable", "out", ",", "CharSequence", "text", ")", "throws", "IOException", "{", "if", "(", "text", "==", "null", ")", "{", "out", ".", "append", "(", "\"null.symbol\"", ")", ";", "}", "else", "if", "(", "symbolNeedsQuoting", "(", "text", ",", "true", ")", ")", "{", "printQuotedSymbol", "(", "out", ",", "text", ")", ";", "}", "else", "{", "out", ".", "append", "(", "text", ")", ";", "}", "}" ]
Prints the text as an Ion symbol, including surrounding single-quotes if they are necessary. Operator symbols such as {@code '+'} are quoted. If the {@code text} is null, this prints {@code null.symbol}. @param out the stream to receive the Ion data. @param text the symbol text; may be {@code null}. @throws IOException if the {@link Appendable} throws an exception. @see #printSymbol(CharSequence)
[ "Prints", "the", "text", "as", "an", "Ion", "symbol", "including", "surrounding", "single", "-", "quotes", "if", "they", "are", "necessary", ".", "Operator", "symbols", "such", "as", "{", "@code", "+", "}", "are", "quoted", ".", "If", "the", "{", "@code", "text", "}", "is", "null", "this", "prints", "{", "@code", "null", ".", "symbol", "}", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L577-L592
i-net-software/jlessc
src/com/inet/lib/less/CssFormatter.java
CssFormatter.appendColor
CssFormatter appendColor( double color, @Nullable String hint ) { """ Append a color. In inline mode it is ever a 6 digit RGB value. @param color the color value @param hint the original spelling of the color if not calculated @return this """ if( !inlineMode && hint != null ) { output.append( hint ); } else { int argb = ColorUtils.argb( color ); output.append( '#' ); appendHex( argb, 6 ); } return this; }
java
CssFormatter appendColor( double color, @Nullable String hint ) { if( !inlineMode && hint != null ) { output.append( hint ); } else { int argb = ColorUtils.argb( color ); output.append( '#' ); appendHex( argb, 6 ); } return this; }
[ "CssFormatter", "appendColor", "(", "double", "color", ",", "@", "Nullable", "String", "hint", ")", "{", "if", "(", "!", "inlineMode", "&&", "hint", "!=", "null", ")", "{", "output", ".", "append", "(", "hint", ")", ";", "}", "else", "{", "int", "argb", "=", "ColorUtils", ".", "argb", "(", "color", ")", ";", "output", ".", "append", "(", "'", "'", ")", ";", "appendHex", "(", "argb", ",", "6", ")", ";", "}", "return", "this", ";", "}" ]
Append a color. In inline mode it is ever a 6 digit RGB value. @param color the color value @param hint the original spelling of the color if not calculated @return this
[ "Append", "a", "color", ".", "In", "inline", "mode", "it", "is", "ever", "a", "6", "digit", "RGB", "value", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L624-L633
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/service/ReportService.java
ReportService.setUniqueFilename
public void setUniqueFilename(ReportModel model, String baseFilename, String extension) { """ Gets a unique filename (that has not been used before in the output folder) for this report and sets it on the report model. """ model.setReportFilename(this.getUniqueFilename(baseFilename, extension, true, null)); }
java
public void setUniqueFilename(ReportModel model, String baseFilename, String extension) { model.setReportFilename(this.getUniqueFilename(baseFilename, extension, true, null)); }
[ "public", "void", "setUniqueFilename", "(", "ReportModel", "model", ",", "String", "baseFilename", ",", "String", "extension", ")", "{", "model", ".", "setReportFilename", "(", "this", ".", "getUniqueFilename", "(", "baseFilename", ",", "extension", ",", "true", ",", "null", ")", ")", ";", "}" ]
Gets a unique filename (that has not been used before in the output folder) for this report and sets it on the report model.
[ "Gets", "a", "unique", "filename", "(", "that", "has", "not", "been", "used", "before", "in", "the", "output", "folder", ")", "for", "this", "report", "and", "sets", "it", "on", "the", "report", "model", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/ReportService.java#L96-L99
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java
Dropbox.buildContentUrl
private String buildContentUrl( String methodPath, CPath path ) { """ Url encodes blob path, and concatenate to content endpoint to get full URL @param methodPath @param path @return URL """ return CONTENT_END_POINT + '/' + methodPath + '/' + scope + path.getUrlEncoded(); }
java
private String buildContentUrl( String methodPath, CPath path ) { return CONTENT_END_POINT + '/' + methodPath + '/' + scope + path.getUrlEncoded(); }
[ "private", "String", "buildContentUrl", "(", "String", "methodPath", ",", "CPath", "path", ")", "{", "return", "CONTENT_END_POINT", "+", "'", "'", "+", "methodPath", "+", "'", "'", "+", "scope", "+", "path", ".", "getUrlEncoded", "(", ")", ";", "}" ]
Url encodes blob path, and concatenate to content endpoint to get full URL @param methodPath @param path @return URL
[ "Url", "encodes", "blob", "path", "and", "concatenate", "to", "content", "endpoint", "to", "get", "full", "URL" ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java#L407-L410
beanshell/beanshell
src/main/java/bsh/BSHBinaryExpression.java
BSHBinaryExpression.getVariableAtNode
private Variable getVariableAtNode(int index, CallStack callstack) throws UtilEvalError { """ Get Variable for value at specified index. @param index 0 for lhs val1 else 1 @param callstack the evaluation call stack @return the variable in call stack name space for the ambiguous node text @throws UtilEvalError thrown by getVariableImpl. """ Node nameNode = null; if (jjtGetChild(index).jjtGetNumChildren() > 0 && (nameNode = jjtGetChild(index).jjtGetChild(0)) instanceof BSHAmbiguousName) return callstack.top().getVariableImpl( ((BSHAmbiguousName) nameNode).text, true); return null; }
java
private Variable getVariableAtNode(int index, CallStack callstack) throws UtilEvalError { Node nameNode = null; if (jjtGetChild(index).jjtGetNumChildren() > 0 && (nameNode = jjtGetChild(index).jjtGetChild(0)) instanceof BSHAmbiguousName) return callstack.top().getVariableImpl( ((BSHAmbiguousName) nameNode).text, true); return null; }
[ "private", "Variable", "getVariableAtNode", "(", "int", "index", ",", "CallStack", "callstack", ")", "throws", "UtilEvalError", "{", "Node", "nameNode", "=", "null", ";", "if", "(", "jjtGetChild", "(", "index", ")", ".", "jjtGetNumChildren", "(", ")", ">", "0", "&&", "(", "nameNode", "=", "jjtGetChild", "(", "index", ")", ".", "jjtGetChild", "(", "0", ")", ")", "instanceof", "BSHAmbiguousName", ")", "return", "callstack", ".", "top", "(", ")", ".", "getVariableImpl", "(", "(", "(", "BSHAmbiguousName", ")", "nameNode", ")", ".", "text", ",", "true", ")", ";", "return", "null", ";", "}" ]
Get Variable for value at specified index. @param index 0 for lhs val1 else 1 @param callstack the evaluation call stack @return the variable in call stack name space for the ambiguous node text @throws UtilEvalError thrown by getVariableImpl.
[ "Get", "Variable", "for", "value", "at", "specified", "index", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/BSHBinaryExpression.java#L133-L141
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc_fat_postgresql/fat/src/com/ibm/ws/jdbc/fat/postgresql/CustomPostgreSQLContainer.java
CustomPostgreSQLContainer.withConfigOption
public SELF withConfigOption(String key, String value) { """ Add additional configuration options that should be used for this container. @param key The PostgreSQL configuration option key. For example: "max_connections" @param value The PostgreSQL configuration option value. For example: "200" @return this """ if (key == null) { throw new java.lang.NullPointerException("key marked @NonNull but is null"); } if (value == null) { throw new java.lang.NullPointerException("value marked @NonNull but is null"); } options.put(key, value); return self(); }
java
public SELF withConfigOption(String key, String value) { if (key == null) { throw new java.lang.NullPointerException("key marked @NonNull but is null"); } if (value == null) { throw new java.lang.NullPointerException("value marked @NonNull but is null"); } options.put(key, value); return self(); }
[ "public", "SELF", "withConfigOption", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "java", ".", "lang", ".", "NullPointerException", "(", "\"key marked @NonNull but is null\"", ")", ";", "}", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "java", ".", "lang", ".", "NullPointerException", "(", "\"value marked @NonNull but is null\"", ")", ";", "}", "options", ".", "put", "(", "key", ",", "value", ")", ";", "return", "self", "(", ")", ";", "}" ]
Add additional configuration options that should be used for this container. @param key The PostgreSQL configuration option key. For example: "max_connections" @param value The PostgreSQL configuration option value. For example: "200" @return this
[ "Add", "additional", "configuration", "options", "that", "should", "be", "used", "for", "this", "container", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc_fat_postgresql/fat/src/com/ibm/ws/jdbc/fat/postgresql/CustomPostgreSQLContainer.java#L26-L35
openengsb/openengsb
components/util/src/main/java/org/openengsb/core/util/CipherUtils.java
CipherUtils.generateKey
public static SecretKey generateKey(String algorithm, int keySize) { """ Generate a {@link SecretKey} for the given symmetric algorithm and keysize Example: CipherUtils.generateKeyPair("AES", 128) """ KeyGenerator secretKeyGenerator; try { secretKeyGenerator = KeyGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } secretKeyGenerator.init(keySize); return secretKeyGenerator.generateKey(); }
java
public static SecretKey generateKey(String algorithm, int keySize) { KeyGenerator secretKeyGenerator; try { secretKeyGenerator = KeyGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } secretKeyGenerator.init(keySize); return secretKeyGenerator.generateKey(); }
[ "public", "static", "SecretKey", "generateKey", "(", "String", "algorithm", ",", "int", "keySize", ")", "{", "KeyGenerator", "secretKeyGenerator", ";", "try", "{", "secretKeyGenerator", "=", "KeyGenerator", ".", "getInstance", "(", "algorithm", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "secretKeyGenerator", ".", "init", "(", "keySize", ")", ";", "return", "secretKeyGenerator", ".", "generateKey", "(", ")", ";", "}" ]
Generate a {@link SecretKey} for the given symmetric algorithm and keysize Example: CipherUtils.generateKeyPair("AES", 128)
[ "Generate", "a", "{", "@link", "SecretKey", "}", "for", "the", "given", "symmetric", "algorithm", "and", "keysize" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/CipherUtils.java#L189-L198
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ClassUtils.java
ClassUtils.notInstanceOf
@NullSafe @SuppressWarnings("all") public static boolean notInstanceOf(Object obj, Class... types) { """ Determines whether the Object is an instance of any of the Class types and returns false if it is. @param obj the Object of the instanceof comparison. @param types an array of Class types used in the instanceof comparison. @return a true boolean value iff the Object is not an instance of any of the Class types. @see #instanceOf(Object, Class) """ boolean result = true; for (int index = 0; result && index < ArrayUtils.nullSafeLength(types); index++) { result &= !instanceOf(obj, types[index]); } return result; }
java
@NullSafe @SuppressWarnings("all") public static boolean notInstanceOf(Object obj, Class... types) { boolean result = true; for (int index = 0; result && index < ArrayUtils.nullSafeLength(types); index++) { result &= !instanceOf(obj, types[index]); } return result; }
[ "@", "NullSafe", "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "static", "boolean", "notInstanceOf", "(", "Object", "obj", ",", "Class", "...", "types", ")", "{", "boolean", "result", "=", "true", ";", "for", "(", "int", "index", "=", "0", ";", "result", "&&", "index", "<", "ArrayUtils", ".", "nullSafeLength", "(", "types", ")", ";", "index", "++", ")", "{", "result", "&=", "!", "instanceOf", "(", "obj", ",", "types", "[", "index", "]", ")", ";", "}", "return", "result", ";", "}" ]
Determines whether the Object is an instance of any of the Class types and returns false if it is. @param obj the Object of the instanceof comparison. @param types an array of Class types used in the instanceof comparison. @return a true boolean value iff the Object is not an instance of any of the Class types. @see #instanceOf(Object, Class)
[ "Determines", "whether", "the", "Object", "is", "an", "instance", "of", "any", "of", "the", "Class", "types", "and", "returns", "false", "if", "it", "is", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L813-L824
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Annotations.java
Annotations.plays
public static boolean plays(Role role, String r) { """ Checks if one role is played. @param role the role to check @param r the expected role @return true or false. """ if (r == null) { throw new IllegalArgumentException("null role"); } if (role == null) { return false; } return role.value().contains(r); }
java
public static boolean plays(Role role, String r) { if (r == null) { throw new IllegalArgumentException("null role"); } if (role == null) { return false; } return role.value().contains(r); }
[ "public", "static", "boolean", "plays", "(", "Role", "role", ",", "String", "r", ")", "{", "if", "(", "r", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"null role\"", ")", ";", "}", "if", "(", "role", "==", "null", ")", "{", "return", "false", ";", "}", "return", "role", ".", "value", "(", ")", ".", "contains", "(", "r", ")", ";", "}" ]
Checks if one role is played. @param role the role to check @param r the expected role @return true or false.
[ "Checks", "if", "one", "role", "is", "played", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Annotations.java#L43-L51
VoltDB/voltdb
src/frontend/org/voltdb/planner/PlanAssembler.java
PlanAssembler.deleteIsTruncate
static private boolean deleteIsTruncate(ParsedDeleteStmt stmt, AbstractPlanNode plan) { """ Returns true if this DELETE can be executed in the EE as a truncate operation """ if (!(plan instanceof SeqScanPlanNode)) { return false; } // Assume all index scans have filters in this context, so only consider seq scans. SeqScanPlanNode seqScanNode = (SeqScanPlanNode)plan; if (seqScanNode.getPredicate() != null) { return false; } if (stmt.hasLimitOrOffset()) { return false; } return true; }
java
static private boolean deleteIsTruncate(ParsedDeleteStmt stmt, AbstractPlanNode plan) { if (!(plan instanceof SeqScanPlanNode)) { return false; } // Assume all index scans have filters in this context, so only consider seq scans. SeqScanPlanNode seqScanNode = (SeqScanPlanNode)plan; if (seqScanNode.getPredicate() != null) { return false; } if (stmt.hasLimitOrOffset()) { return false; } return true; }
[ "static", "private", "boolean", "deleteIsTruncate", "(", "ParsedDeleteStmt", "stmt", ",", "AbstractPlanNode", "plan", ")", "{", "if", "(", "!", "(", "plan", "instanceof", "SeqScanPlanNode", ")", ")", "{", "return", "false", ";", "}", "// Assume all index scans have filters in this context, so only consider seq scans.", "SeqScanPlanNode", "seqScanNode", "=", "(", "SeqScanPlanNode", ")", "plan", ";", "if", "(", "seqScanNode", ".", "getPredicate", "(", ")", "!=", "null", ")", "{", "return", "false", ";", "}", "if", "(", "stmt", ".", "hasLimitOrOffset", "(", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Returns true if this DELETE can be executed in the EE as a truncate operation
[ "Returns", "true", "if", "this", "DELETE", "can", "be", "executed", "in", "the", "EE", "as", "a", "truncate", "operation" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/PlanAssembler.java#L1298-L1314
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/utils/URIUtil.java
URIUtil.getQueryParameter
public static String getQueryParameter( URI uri, String name ) { """ Retrieves a query param in a URL according to a key. If several parameters are to be retrieved from the same URI, better use <code>parseQueryString( uri.getRawQuery() )</code>. @param uri @param name @return parameter value (if found) ; null if not found or no = after name. """ Map<String, String> params = parseQueryParameters( uri.getRawQuery() ); return params.get( name ); }
java
public static String getQueryParameter( URI uri, String name ) { Map<String, String> params = parseQueryParameters( uri.getRawQuery() ); return params.get( name ); }
[ "public", "static", "String", "getQueryParameter", "(", "URI", "uri", ",", "String", "name", ")", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "parseQueryParameters", "(", "uri", ".", "getRawQuery", "(", ")", ")", ";", "return", "params", ".", "get", "(", "name", ")", ";", "}" ]
Retrieves a query param in a URL according to a key. If several parameters are to be retrieved from the same URI, better use <code>parseQueryString( uri.getRawQuery() )</code>. @param uri @param name @return parameter value (if found) ; null if not found or no = after name.
[ "Retrieves", "a", "query", "param", "in", "a", "URL", "according", "to", "a", "key", "." ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/URIUtil.java#L121-L125
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_fax_serviceName_screenLists_POST
public OvhFaxScreen billingAccount_fax_serviceName_screenLists_POST(String billingAccount, String serviceName, String[] blacklistedNumbers, String[] blacklistedTSI, OvhFaxScreenListTypeEnum filteringList, String[] whitelistedNumbers, String[] whitelistedTSI) throws IOException { """ Create a new fax ScreenLists REST: POST /telephony/{billingAccount}/fax/{serviceName}/screenLists @param whitelistedNumbers [required] List of numbers allowed to send a fax @param whitelistedTSI [required] List of logins (TSI or ID) allowed to send a fax @param blacklistedNumbers [required] List of numbers not allowed to send a fax @param blacklistedTSI [required] List of logins (TSI or ID) not allowed to send a fax @param filteringList [required] Which list is active (blackist, whitelist or none) @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/fax/{serviceName}/screenLists"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "blacklistedNumbers", blacklistedNumbers); addBody(o, "blacklistedTSI", blacklistedTSI); addBody(o, "filteringList", filteringList); addBody(o, "whitelistedNumbers", whitelistedNumbers); addBody(o, "whitelistedTSI", whitelistedTSI); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFaxScreen.class); }
java
public OvhFaxScreen billingAccount_fax_serviceName_screenLists_POST(String billingAccount, String serviceName, String[] blacklistedNumbers, String[] blacklistedTSI, OvhFaxScreenListTypeEnum filteringList, String[] whitelistedNumbers, String[] whitelistedTSI) throws IOException { String qPath = "/telephony/{billingAccount}/fax/{serviceName}/screenLists"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "blacklistedNumbers", blacklistedNumbers); addBody(o, "blacklistedTSI", blacklistedTSI); addBody(o, "filteringList", filteringList); addBody(o, "whitelistedNumbers", whitelistedNumbers); addBody(o, "whitelistedTSI", whitelistedTSI); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFaxScreen.class); }
[ "public", "OvhFaxScreen", "billingAccount_fax_serviceName_screenLists_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "[", "]", "blacklistedNumbers", ",", "String", "[", "]", "blacklistedTSI", ",", "OvhFaxScreenListTypeEnum", "filteringList", ",", "String", "[", "]", "whitelistedNumbers", ",", "String", "[", "]", "whitelistedTSI", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/fax/{serviceName}/screenLists\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"blacklistedNumbers\"", ",", "blacklistedNumbers", ")", ";", "addBody", "(", "o", ",", "\"blacklistedTSI\"", ",", "blacklistedTSI", ")", ";", "addBody", "(", "o", ",", "\"filteringList\"", ",", "filteringList", ")", ";", "addBody", "(", "o", ",", "\"whitelistedNumbers\"", ",", "whitelistedNumbers", ")", ";", "addBody", "(", "o", ",", "\"whitelistedTSI\"", ",", "whitelistedTSI", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhFaxScreen", ".", "class", ")", ";", "}" ]
Create a new fax ScreenLists REST: POST /telephony/{billingAccount}/fax/{serviceName}/screenLists @param whitelistedNumbers [required] List of numbers allowed to send a fax @param whitelistedTSI [required] List of logins (TSI or ID) allowed to send a fax @param blacklistedNumbers [required] List of numbers not allowed to send a fax @param blacklistedTSI [required] List of logins (TSI or ID) not allowed to send a fax @param filteringList [required] Which list is active (blackist, whitelist or none) @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Create", "a", "new", "fax", "ScreenLists" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4462-L4473
looly/hutool
hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java
ProxyUtil.newProxyInstance
public static <T> T newProxyInstance(InvocationHandler invocationHandler, Class<?>... interfaces) { """ 创建动态代理对象 @param <T> 被代理对象类型 @param invocationHandler {@link InvocationHandler} ,被代理类通过实现此接口提供动态代理功能 @param interfaces 代理类中需要实现的被代理类的接口方法 @return 代理类 """ return newProxyInstance(ClassUtil.getClassLoader(), invocationHandler, interfaces); }
java
public static <T> T newProxyInstance(InvocationHandler invocationHandler, Class<?>... interfaces) { return newProxyInstance(ClassUtil.getClassLoader(), invocationHandler, interfaces); }
[ "public", "static", "<", "T", ">", "T", "newProxyInstance", "(", "InvocationHandler", "invocationHandler", ",", "Class", "<", "?", ">", "...", "interfaces", ")", "{", "return", "newProxyInstance", "(", "ClassUtil", ".", "getClassLoader", "(", ")", ",", "invocationHandler", ",", "interfaces", ")", ";", "}" ]
创建动态代理对象 @param <T> 被代理对象类型 @param invocationHandler {@link InvocationHandler} ,被代理类通过实现此接口提供动态代理功能 @param interfaces 代理类中需要实现的被代理类的接口方法 @return 代理类
[ "创建动态代理对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java#L70-L72
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.oddsFromTo
public static Interval oddsFromTo(int from, int to) { """ Returns an Interval representing the odd values from the value from to the value to. """ if (from % 2 == 0) { if (from < to) { from++; } else { from--; } } if (to % 2 == 0) { if (to > from) { to--; } else { to++; } } return Interval.fromToBy(from, to, to > from ? 2 : -2); }
java
public static Interval oddsFromTo(int from, int to) { if (from % 2 == 0) { if (from < to) { from++; } else { from--; } } if (to % 2 == 0) { if (to > from) { to--; } else { to++; } } return Interval.fromToBy(from, to, to > from ? 2 : -2); }
[ "public", "static", "Interval", "oddsFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "%", "2", "==", "0", ")", "{", "if", "(", "from", "<", "to", ")", "{", "from", "++", ";", "}", "else", "{", "from", "--", ";", "}", "}", "if", "(", "to", "%", "2", "==", "0", ")", "{", "if", "(", "to", ">", "from", ")", "{", "to", "--", ";", "}", "else", "{", "to", "++", ";", "}", "}", "return", "Interval", ".", "fromToBy", "(", "from", ",", "to", ",", "to", ">", "from", "?", "2", ":", "-", "2", ")", ";", "}" ]
Returns an Interval representing the odd values from the value from to the value to.
[ "Returns", "an", "Interval", "representing", "the", "odd", "values", "from", "the", "value", "from", "to", "the", "value", "to", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L218-L243
ag-gipp/MathMLTools
mathml-utils/src/main/java/com/formulasearchengine/mathmltools/nativetools/CommandExecutor.java
CommandExecutor.exec
public NativeResponse exec(long timeout, TimeUnit unit, Level logLevel) { """ Combination of everything before. @param timeout a @param unit a @param logLevel a @return a """ return internalexec(timeout, unit, logLevel); }
java
public NativeResponse exec(long timeout, TimeUnit unit, Level logLevel) { return internalexec(timeout, unit, logLevel); }
[ "public", "NativeResponse", "exec", "(", "long", "timeout", ",", "TimeUnit", "unit", ",", "Level", "logLevel", ")", "{", "return", "internalexec", "(", "timeout", ",", "unit", ",", "logLevel", ")", ";", "}" ]
Combination of everything before. @param timeout a @param unit a @param logLevel a @return a
[ "Combination", "of", "everything", "before", "." ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-utils/src/main/java/com/formulasearchengine/mathmltools/nativetools/CommandExecutor.java#L186-L188
LearnLib/automatalib
util/src/main/java/net/automatalib/util/graphs/scc/SCCs.java
SCCs.findSCCs
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> listener) { """ Find all strongly-connected components in a graph. When a new SCC is found, the {@link SCCListener#foundSCC(java.util.Collection)} method is invoked. The listener object may hence not be null. <p> Tarjan's algorithm is used for realizing the SCC search. @param graph the graph @param listener the SCC listener @see TarjanSCCVisitor """ TarjanSCCVisitor<N, E> vis = new TarjanSCCVisitor<>(graph, listener); for (N node : graph) { if (!vis.hasVisited(node)) { GraphTraversal.depthFirst(graph, node, vis); } } }
java
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> listener) { TarjanSCCVisitor<N, E> vis = new TarjanSCCVisitor<>(graph, listener); for (N node : graph) { if (!vis.hasVisited(node)) { GraphTraversal.depthFirst(graph, node, vis); } } }
[ "public", "static", "<", "N", ",", "E", ">", "void", "findSCCs", "(", "Graph", "<", "N", ",", "E", ">", "graph", ",", "SCCListener", "<", "N", ">", "listener", ")", "{", "TarjanSCCVisitor", "<", "N", ",", "E", ">", "vis", "=", "new", "TarjanSCCVisitor", "<>", "(", "graph", ",", "listener", ")", ";", "for", "(", "N", "node", ":", "graph", ")", "{", "if", "(", "!", "vis", ".", "hasVisited", "(", "node", ")", ")", "{", "GraphTraversal", ".", "depthFirst", "(", "graph", ",", "node", ",", "vis", ")", ";", "}", "}", "}" ]
Find all strongly-connected components in a graph. When a new SCC is found, the {@link SCCListener#foundSCC(java.util.Collection)} method is invoked. The listener object may hence not be null. <p> Tarjan's algorithm is used for realizing the SCC search. @param graph the graph @param listener the SCC listener @see TarjanSCCVisitor
[ "Find", "all", "strongly", "-", "connected", "components", "in", "a", "graph", ".", "When", "a", "new", "SCC", "is", "found", "the", "{", "@link", "SCCListener#foundSCC", "(", "java", ".", "util", ".", "Collection", ")", "}", "method", "is", "invoked", ".", "The", "listener", "object", "may", "hence", "not", "be", "null", ".", "<p", ">", "Tarjan", "s", "algorithm", "is", "used", "for", "realizing", "the", "SCC", "search", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/graphs/scc/SCCs.java#L69-L76
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java
AbstractWisdomWatcherMojo.getOutputFile
public File getOutputFile(File input) { """ Gets the output files for the given input file. Unlike {@link #getOutputFile(java.io.File, String)}, this method does not change the output file's extension. If the file is already in an output directory, the file is returned as it is. <p> This method does not check for the existence of the file, just computes its {@link java.io.File} object. @param input the input file @return the output file """ File source; File destination; if (input.getAbsolutePath().startsWith(getInternalAssetsDirectory().getAbsolutePath())) { source = getInternalAssetsDirectory(); destination = getInternalAssetOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getExternalAssetsDirectory().getAbsolutePath())) { source = getExternalAssetsDirectory(); destination = getExternalAssetsOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getInternalAssetOutputDirectory().getAbsolutePath())) { return input; } else if (input.getAbsolutePath().startsWith(getExternalAssetsOutputDirectory().getAbsolutePath())) { return input; } else { throw new IllegalArgumentException("Cannot determine the output file for " + input.getAbsolutePath() + "," + " the file is not in a resource directory"); } String path = input.getParentFile().getAbsolutePath().substring(source.getAbsolutePath().length()); return new File(destination, path + File.separator + input.getName()); }
java
public File getOutputFile(File input) { File source; File destination; if (input.getAbsolutePath().startsWith(getInternalAssetsDirectory().getAbsolutePath())) { source = getInternalAssetsDirectory(); destination = getInternalAssetOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getExternalAssetsDirectory().getAbsolutePath())) { source = getExternalAssetsDirectory(); destination = getExternalAssetsOutputDirectory(); } else if (input.getAbsolutePath().startsWith(getInternalAssetOutputDirectory().getAbsolutePath())) { return input; } else if (input.getAbsolutePath().startsWith(getExternalAssetsOutputDirectory().getAbsolutePath())) { return input; } else { throw new IllegalArgumentException("Cannot determine the output file for " + input.getAbsolutePath() + "," + " the file is not in a resource directory"); } String path = input.getParentFile().getAbsolutePath().substring(source.getAbsolutePath().length()); return new File(destination, path + File.separator + input.getName()); }
[ "public", "File", "getOutputFile", "(", "File", "input", ")", "{", "File", "source", ";", "File", "destination", ";", "if", "(", "input", ".", "getAbsolutePath", "(", ")", ".", "startsWith", "(", "getInternalAssetsDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ")", "{", "source", "=", "getInternalAssetsDirectory", "(", ")", ";", "destination", "=", "getInternalAssetOutputDirectory", "(", ")", ";", "}", "else", "if", "(", "input", ".", "getAbsolutePath", "(", ")", ".", "startsWith", "(", "getExternalAssetsDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ")", "{", "source", "=", "getExternalAssetsDirectory", "(", ")", ";", "destination", "=", "getExternalAssetsOutputDirectory", "(", ")", ";", "}", "else", "if", "(", "input", ".", "getAbsolutePath", "(", ")", ".", "startsWith", "(", "getInternalAssetOutputDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ")", "{", "return", "input", ";", "}", "else", "if", "(", "input", ".", "getAbsolutePath", "(", ")", ".", "startsWith", "(", "getExternalAssetsOutputDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ")", "{", "return", "input", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot determine the output file for \"", "+", "input", ".", "getAbsolutePath", "(", ")", "+", "\",\"", "+", "\" the file is not in a resource directory\"", ")", ";", "}", "String", "path", "=", "input", ".", "getParentFile", "(", ")", ".", "getAbsolutePath", "(", ")", ".", "substring", "(", "source", ".", "getAbsolutePath", "(", ")", ".", "length", "(", ")", ")", ";", "return", "new", "File", "(", "destination", ",", "path", "+", "File", ".", "separator", "+", "input", ".", "getName", "(", ")", ")", ";", "}" ]
Gets the output files for the given input file. Unlike {@link #getOutputFile(java.io.File, String)}, this method does not change the output file's extension. If the file is already in an output directory, the file is returned as it is. <p> This method does not check for the existence of the file, just computes its {@link java.io.File} object. @param input the input file @return the output file
[ "Gets", "the", "output", "files", "for", "the", "given", "input", "file", ".", "Unlike", "{", "@link", "#getOutputFile", "(", "java", ".", "io", ".", "File", "String", ")", "}", "this", "method", "does", "not", "change", "the", "output", "file", "s", "extension", ".", "If", "the", "file", "is", "already", "in", "an", "output", "directory", "the", "file", "is", "returned", "as", "it", "is", ".", "<p", ">", "This", "method", "does", "not", "check", "for", "the", "existence", "of", "the", "file", "just", "computes", "its", "{", "@link", "java", ".", "io", ".", "File", "}", "object", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java#L140-L159
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java
FoxHttpClientBuilder.setFoxHttpInterceptors
public FoxHttpClientBuilder setFoxHttpInterceptors(Map<FoxHttpInterceptorType, ArrayList<FoxHttpInterceptor>> foxHttpInterceptors) { """ Define a map of FoxHttpInterceptors <i>This will override the existing map of interceptors</i> @param foxHttpInterceptors Map of interceptors @return FoxHttpClientBuilder (this) """ foxHttpClient.setFoxHttpInterceptors(foxHttpInterceptors); return this; }
java
public FoxHttpClientBuilder setFoxHttpInterceptors(Map<FoxHttpInterceptorType, ArrayList<FoxHttpInterceptor>> foxHttpInterceptors) { foxHttpClient.setFoxHttpInterceptors(foxHttpInterceptors); return this; }
[ "public", "FoxHttpClientBuilder", "setFoxHttpInterceptors", "(", "Map", "<", "FoxHttpInterceptorType", ",", "ArrayList", "<", "FoxHttpInterceptor", ">", ">", "foxHttpInterceptors", ")", "{", "foxHttpClient", ".", "setFoxHttpInterceptors", "(", "foxHttpInterceptors", ")", ";", "return", "this", ";", "}" ]
Define a map of FoxHttpInterceptors <i>This will override the existing map of interceptors</i> @param foxHttpInterceptors Map of interceptors @return FoxHttpClientBuilder (this)
[ "Define", "a", "map", "of", "FoxHttpInterceptors", "<i", ">", "This", "will", "override", "the", "existing", "map", "of", "interceptors<", "/", "i", ">" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java#L120-L123
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/PropertyVisitor.java
PropertyVisitor.classImplementsOrExtends
private boolean classImplementsOrExtends(final Class<?> is, final Class<?> should) { """ Checks if a {@link Class} implements a specified interface. @param is The class that should be checked if it implements an interface. @param should The interface that should be checked for. @return {@code true} if the class implements the interface {@code false} otherwise. """ if (is.equals(should)) { return true; } for (final Class<?> clazz : is.getInterfaces()) { if (classImplementsOrExtends(clazz, should)) { return true; } } final Class<?> superClass = is.getSuperclass(); if (superClass != null && !superClass.equals(Object.class)) { return classImplementsOrExtends(superClass, should); } return false; }
java
private boolean classImplementsOrExtends(final Class<?> is, final Class<?> should) { if (is.equals(should)) { return true; } for (final Class<?> clazz : is.getInterfaces()) { if (classImplementsOrExtends(clazz, should)) { return true; } } final Class<?> superClass = is.getSuperclass(); if (superClass != null && !superClass.equals(Object.class)) { return classImplementsOrExtends(superClass, should); } return false; }
[ "private", "boolean", "classImplementsOrExtends", "(", "final", "Class", "<", "?", ">", "is", ",", "final", "Class", "<", "?", ">", "should", ")", "{", "if", "(", "is", ".", "equals", "(", "should", ")", ")", "{", "return", "true", ";", "}", "for", "(", "final", "Class", "<", "?", ">", "clazz", ":", "is", ".", "getInterfaces", "(", ")", ")", "{", "if", "(", "classImplementsOrExtends", "(", "clazz", ",", "should", ")", ")", "{", "return", "true", ";", "}", "}", "final", "Class", "<", "?", ">", "superClass", "=", "is", ".", "getSuperclass", "(", ")", ";", "if", "(", "superClass", "!=", "null", "&&", "!", "superClass", ".", "equals", "(", "Object", ".", "class", ")", ")", "{", "return", "classImplementsOrExtends", "(", "superClass", ",", "should", ")", ";", "}", "return", "false", ";", "}" ]
Checks if a {@link Class} implements a specified interface. @param is The class that should be checked if it implements an interface. @param should The interface that should be checked for. @return {@code true} if the class implements the interface {@code false} otherwise.
[ "Checks", "if", "a", "{", "@link", "Class", "}", "implements", "a", "specified", "interface", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/PropertyVisitor.java#L310-L324
openbase/jul
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGProcessor.java
SVGProcessor.loadSVGIconFromUri
public static List<SVGPath> loadSVGIconFromUri(final String uri, final Class clazz) throws CouldNotPerformException { """ Method tries to build one or more SVGPaths out of the given uri. By this the content is interpreted as svg xml and new SVGPath instances are generated for each found path element @param uri the svg xml file @return a list of SVGPaths instances where each is representing one found path element @throws CouldNotPerformException is thrown if the file does not exist or it does not contain any path elements. """ try { InputStream inputStream = clazz.getResourceAsStream(uri); if (inputStream == null) { inputStream = clazz.getClassLoader().getResourceAsStream(uri); if (inputStream == null) { throw new NotAvailableException(uri); } } return generateSvgPathList(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); } catch (final Exception ex) { throw new CouldNotPerformException("Could not load URI[" + uri + "]", ex); } }
java
public static List<SVGPath> loadSVGIconFromUri(final String uri, final Class clazz) throws CouldNotPerformException { try { InputStream inputStream = clazz.getResourceAsStream(uri); if (inputStream == null) { inputStream = clazz.getClassLoader().getResourceAsStream(uri); if (inputStream == null) { throw new NotAvailableException(uri); } } return generateSvgPathList(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); } catch (final Exception ex) { throw new CouldNotPerformException("Could not load URI[" + uri + "]", ex); } }
[ "public", "static", "List", "<", "SVGPath", ">", "loadSVGIconFromUri", "(", "final", "String", "uri", ",", "final", "Class", "clazz", ")", "throws", "CouldNotPerformException", "{", "try", "{", "InputStream", "inputStream", "=", "clazz", ".", "getResourceAsStream", "(", "uri", ")", ";", "if", "(", "inputStream", "==", "null", ")", "{", "inputStream", "=", "clazz", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "uri", ")", ";", "if", "(", "inputStream", "==", "null", ")", "{", "throw", "new", "NotAvailableException", "(", "uri", ")", ";", "}", "}", "return", "generateSvgPathList", "(", "IOUtils", ".", "toString", "(", "inputStream", ",", "StandardCharsets", ".", "UTF_8", ")", ")", ";", "}", "catch", "(", "final", "Exception", "ex", ")", "{", "throw", "new", "CouldNotPerformException", "(", "\"Could not load URI[\"", "+", "uri", "+", "\"]\"", ",", "ex", ")", ";", "}", "}" ]
Method tries to build one or more SVGPaths out of the given uri. By this the content is interpreted as svg xml and new SVGPath instances are generated for each found path element @param uri the svg xml file @return a list of SVGPaths instances where each is representing one found path element @throws CouldNotPerformException is thrown if the file does not exist or it does not contain any path elements.
[ "Method", "tries", "to", "build", "one", "or", "more", "SVGPaths", "out", "of", "the", "given", "uri", ".", "By", "this", "the", "content", "is", "interpreted", "as", "svg", "xml", "and", "new", "SVGPath", "instances", "are", "generated", "for", "each", "found", "path", "element" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGProcessor.java#L59-L73
google/closure-templates
java/src/com/google/template/soy/jbcsrc/JbcSrcValueFactory.java
JbcSrcValueFactory.isOrContains
private boolean isOrContains(SoyType type, SoyType.Kind kind) { """ Returns true if the type is the given kind or contains the given kind. """ if (type.getKind() == kind) { return true; } if (type.getKind() == SoyType.Kind.UNION) { for (SoyType member : ((UnionType) type).getMembers()) { if (member.getKind() == kind) { return true; } } } return false; }
java
private boolean isOrContains(SoyType type, SoyType.Kind kind) { if (type.getKind() == kind) { return true; } if (type.getKind() == SoyType.Kind.UNION) { for (SoyType member : ((UnionType) type).getMembers()) { if (member.getKind() == kind) { return true; } } } return false; }
[ "private", "boolean", "isOrContains", "(", "SoyType", "type", ",", "SoyType", ".", "Kind", "kind", ")", "{", "if", "(", "type", ".", "getKind", "(", ")", "==", "kind", ")", "{", "return", "true", ";", "}", "if", "(", "type", ".", "getKind", "(", ")", "==", "SoyType", ".", "Kind", ".", "UNION", ")", "{", "for", "(", "SoyType", "member", ":", "(", "(", "UnionType", ")", "type", ")", ".", "getMembers", "(", ")", ")", "{", "if", "(", "member", ".", "getKind", "(", ")", "==", "kind", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Returns true if the type is the given kind or contains the given kind.
[ "Returns", "true", "if", "the", "type", "is", "the", "given", "kind", "or", "contains", "the", "given", "kind", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/JbcSrcValueFactory.java#L740-L752
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.encodeHeaders
public void encodeHeaders(int streamId, ByteBuf out, Http2Headers headers, SensitivityDetector sensitivityDetector) throws Http2Exception { """ Encode the header field into the header block. <strong>The given {@link CharSequence}s must be immutable!</strong> """ if (ignoreMaxHeaderListSize) { encodeHeadersIgnoreMaxHeaderListSize(out, headers, sensitivityDetector); } else { encodeHeadersEnforceMaxHeaderListSize(streamId, out, headers, sensitivityDetector); } }
java
public void encodeHeaders(int streamId, ByteBuf out, Http2Headers headers, SensitivityDetector sensitivityDetector) throws Http2Exception { if (ignoreMaxHeaderListSize) { encodeHeadersIgnoreMaxHeaderListSize(out, headers, sensitivityDetector); } else { encodeHeadersEnforceMaxHeaderListSize(streamId, out, headers, sensitivityDetector); } }
[ "public", "void", "encodeHeaders", "(", "int", "streamId", ",", "ByteBuf", "out", ",", "Http2Headers", "headers", ",", "SensitivityDetector", "sensitivityDetector", ")", "throws", "Http2Exception", "{", "if", "(", "ignoreMaxHeaderListSize", ")", "{", "encodeHeadersIgnoreMaxHeaderListSize", "(", "out", ",", "headers", ",", "sensitivityDetector", ")", ";", "}", "else", "{", "encodeHeadersEnforceMaxHeaderListSize", "(", "streamId", ",", "out", ",", "headers", ",", "sensitivityDetector", ")", ";", "}", "}" ]
Encode the header field into the header block. <strong>The given {@link CharSequence}s must be immutable!</strong>
[ "Encode", "the", "header", "field", "into", "the", "header", "block", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L101-L108
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemsetAsync
public static int cudaMemsetAsync(Pointer devPtr, int value, long count, cudaStream_t stream) { """ Initializes or sets device memory to a value. <pre> cudaError_t cudaMemsetAsync ( void* devPtr, int value, size_t count, cudaStream_t stream = 0 ) </pre> <div> <p>Initializes or sets device memory to a value. Fills the first <tt>count</tt> bytes of the memory area pointed to by <tt>devPtr</tt> with the constant byte value <tt>value</tt>. </p> <p>cudaMemsetAsync() is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero <tt>stream</tt> argument. If <tt>stream</tt> is non-zero, the operation may overlap with operations in other streams. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> </ul> </div> </p> </div> @param devPtr Pointer to device memory @param value Value to set for each byte of specified memory @param count Size in bytes to set @param stream Stream identifier @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer @see JCuda#cudaMemset @see JCuda#cudaMemset2D @see JCuda#cudaMemset3D @see JCuda#cudaMemset2DAsync @see JCuda#cudaMemset3DAsync """ return checkResult(cudaMemsetAsyncNative(devPtr, value, count, stream)); }
java
public static int cudaMemsetAsync(Pointer devPtr, int value, long count, cudaStream_t stream) { return checkResult(cudaMemsetAsyncNative(devPtr, value, count, stream)); }
[ "public", "static", "int", "cudaMemsetAsync", "(", "Pointer", "devPtr", ",", "int", "value", ",", "long", "count", ",", "cudaStream_t", "stream", ")", "{", "return", "checkResult", "(", "cudaMemsetAsyncNative", "(", "devPtr", ",", "value", ",", "count", ",", "stream", ")", ")", ";", "}" ]
Initializes or sets device memory to a value. <pre> cudaError_t cudaMemsetAsync ( void* devPtr, int value, size_t count, cudaStream_t stream = 0 ) </pre> <div> <p>Initializes or sets device memory to a value. Fills the first <tt>count</tt> bytes of the memory area pointed to by <tt>devPtr</tt> with the constant byte value <tt>value</tt>. </p> <p>cudaMemsetAsync() is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero <tt>stream</tt> argument. If <tt>stream</tt> is non-zero, the operation may overlap with operations in other streams. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> </ul> </div> </p> </div> @param devPtr Pointer to device memory @param value Value to set for each byte of specified memory @param count Size in bytes to set @param stream Stream identifier @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer @see JCuda#cudaMemset @see JCuda#cudaMemset2D @see JCuda#cudaMemset3D @see JCuda#cudaMemset2DAsync @see JCuda#cudaMemset3DAsync
[ "Initializes", "or", "sets", "device", "memory", "to", "a", "value", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L2916-L2919
mailin-api/sendinblue-java-mvn
src/main/java/com/sendinblue/Sendinblue.java
Sendinblue.add_users_list
public String add_users_list(Map<String, Object> data) { """ /* Add already existing users in the SendinBlue contacts to the list. @param {Object} data contains json objects as a key value pair from HashMap. @options data {Integer} id: Id of list to link users in it [Mandatory] @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts. Example: "[email protected]". You can use commas to separate multiple users [Mandatory] """ String id = data.get("id").toString(); Gson gson = new Gson(); String json = gson.toJson(data); return post("list/" + id + "/users", json); }
java
public String add_users_list(Map<String, Object> data) { String id = data.get("id").toString(); Gson gson = new Gson(); String json = gson.toJson(data); return post("list/" + id + "/users", json); }
[ "public", "String", "add_users_list", "(", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "String", "id", "=", "data", ".", "get", "(", "\"id\"", ")", ".", "toString", "(", ")", ";", "Gson", "gson", "=", "new", "Gson", "(", ")", ";", "String", "json", "=", "gson", ".", "toJson", "(", "data", ")", ";", "return", "post", "(", "\"list/\"", "+", "id", "+", "\"/users\"", ",", "json", ")", ";", "}" ]
/* Add already existing users in the SendinBlue contacts to the list. @param {Object} data contains json objects as a key value pair from HashMap. @options data {Integer} id: Id of list to link users in it [Mandatory] @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts. Example: "[email protected]". You can use commas to separate multiple users [Mandatory]
[ "/", "*", "Add", "already", "existing", "users", "in", "the", "SendinBlue", "contacts", "to", "the", "list", "." ]
train
https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L653-L658
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optCharSequence
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static CharSequence optCharSequence(@Nullable Bundle bundle, @Nullable String key, @Nullable CharSequence fallback) { """ Returns a optional {@link CharSequence} value. In other words, returns the value mapped by key if it exists and is a {@link CharSequence}. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @param fallback fallback value. @return a {@link CharSequence} value if exists, fallback value otherwise. @see android.os.Bundle#getCharSequence(String, CharSequence) """ if (bundle == null) { return fallback; } return bundle.getCharSequence(key, fallback); }
java
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static CharSequence optCharSequence(@Nullable Bundle bundle, @Nullable String key, @Nullable CharSequence fallback) { if (bundle == null) { return fallback; } return bundle.getCharSequence(key, fallback); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB_MR1", ")", "public", "static", "CharSequence", "optCharSequence", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ",", "@", "Nullable", "CharSequence", "fallback", ")", "{", "if", "(", "bundle", "==", "null", ")", "{", "return", "fallback", ";", "}", "return", "bundle", ".", "getCharSequence", "(", "key", ",", "fallback", ")", ";", "}" ]
Returns a optional {@link CharSequence} value. In other words, returns the value mapped by key if it exists and is a {@link CharSequence}. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @param fallback fallback value. @return a {@link CharSequence} value if exists, fallback value otherwise. @see android.os.Bundle#getCharSequence(String, CharSequence)
[ "Returns", "a", "optional", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L343-L349
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/operators/OperatorForEachFuture.java
OperatorForEachFuture.forEachFuture
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext, Action1<? super Throwable> onError) { """ Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future. @param <T> the element type of the Observable @param source the source Observable @param onNext the action to call with each emitted element @param onError the action to call when an exception is emitted @return the Future representing the entire for-each operation """ return forEachFuture(source, onNext, onError, Functionals.empty()); }
java
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext, Action1<? super Throwable> onError) { return forEachFuture(source, onNext, onError, Functionals.empty()); }
[ "public", "static", "<", "T", ">", "FutureTask", "<", "Void", ">", "forEachFuture", "(", "Observable", "<", "?", "extends", "T", ">", "source", ",", "Action1", "<", "?", "super", "T", ">", "onNext", ",", "Action1", "<", "?", "super", "Throwable", ">", "onError", ")", "{", "return", "forEachFuture", "(", "source", ",", "onNext", ",", "onError", ",", "Functionals", ".", "empty", "(", ")", ")", ";", "}" ]
Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future. @param <T> the element type of the Observable @param source the source Observable @param onNext the action to call with each emitted element @param onError the action to call when an exception is emitted @return the Future representing the entire for-each operation
[ "Subscribes", "to", "the", "given", "source", "and", "calls", "the", "callback", "for", "each", "emitted", "item", "and", "surfaces", "the", "completion", "or", "error", "through", "a", "Future", "." ]
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/OperatorForEachFuture.java#L59-L64
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java
LongTuples.createSubTuple
static MutableLongTuple createSubTuple( MutableLongTuple parent, int fromIndex, int toIndex) { """ Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple """ return new MutableSubLongTuple(parent, fromIndex, toIndex); }
java
static MutableLongTuple createSubTuple( MutableLongTuple parent, int fromIndex, int toIndex) { return new MutableSubLongTuple(parent, fromIndex, toIndex); }
[ "static", "MutableLongTuple", "createSubTuple", "(", "MutableLongTuple", "parent", ",", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "return", "new", "MutableSubLongTuple", "(", "parent", ",", "fromIndex", ",", "toIndex", ")", ";", "}" ]
Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple
[ "Creates", "a", "new", "tuple", "that", "is", "a", "<i", ">", "view<", "/", "i", ">", "on", "the", "specified", "portion", "of", "the", "given", "parent", ".", "Changes", "in", "the", "parent", "will", "be", "visible", "in", "the", "returned", "tuple", "and", "vice", "versa", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java#L250-L254
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/animation/TransitionAnimation.java
TransitionAnimation.prepareAnimation
protected void prepareAnimation(@NonNull StateController sharedController, @IntRange(from = -1) final int duration) { """ Called before {@link StateController#startController()} to configure the animation. @param sharedController A shared {@link StateController} to reduce resource usage. @param duration Duration of the animation, -1 if sharedController's duration should not be overridden. """ if (isAnimating()) { return; } setAnimating(true); getTransition().startTransition(mReverse ? 1 : 0); mController = sharedController; if (duration != -1) { mController.setAnimationDuration(duration); } mController.addAnimation(this); }
java
protected void prepareAnimation(@NonNull StateController sharedController, @IntRange(from = -1) final int duration) { if (isAnimating()) { return; } setAnimating(true); getTransition().startTransition(mReverse ? 1 : 0); mController = sharedController; if (duration != -1) { mController.setAnimationDuration(duration); } mController.addAnimation(this); }
[ "protected", "void", "prepareAnimation", "(", "@", "NonNull", "StateController", "sharedController", ",", "@", "IntRange", "(", "from", "=", "-", "1", ")", "final", "int", "duration", ")", "{", "if", "(", "isAnimating", "(", ")", ")", "{", "return", ";", "}", "setAnimating", "(", "true", ")", ";", "getTransition", "(", ")", ".", "startTransition", "(", "mReverse", "?", "1", ":", "0", ")", ";", "mController", "=", "sharedController", ";", "if", "(", "duration", "!=", "-", "1", ")", "{", "mController", ".", "setAnimationDuration", "(", "duration", ")", ";", "}", "mController", ".", "addAnimation", "(", "this", ")", ";", "}" ]
Called before {@link StateController#startController()} to configure the animation. @param sharedController A shared {@link StateController} to reduce resource usage. @param duration Duration of the animation, -1 if sharedController's duration should not be overridden.
[ "Called", "before", "{", "@link", "StateController#startController", "()", "}", "to", "configure", "the", "animation", "." ]
train
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/animation/TransitionAnimation.java#L95-L107
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java
VirtualNetworksInner.getByResourceGroup
public VirtualNetworkInner getByResourceGroup(String resourceGroupName, String virtualNetworkName) { """ Gets the specified virtual network by resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @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 VirtualNetworkInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkName).toBlocking().single().body(); }
java
public VirtualNetworkInner getByResourceGroup(String resourceGroupName, String virtualNetworkName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkName).toBlocking().single().body(); }
[ "public", "VirtualNetworkInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets the specified virtual network by resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @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 VirtualNetworkInner object if successful.
[ "Gets", "the", "specified", "virtual", "network", "by", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L289-L291
pedrovgs/DraggablePanel
draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java
DraggableView.slideHorizontally
public void slideHorizontally(float slideOffset, float drawerPosition, int width) { """ Slide the view based on scroll of the nav drawer. "setEnableTouch" user prevents click to expand while the drawer is moving, it will be set to false when the @slideOffset is bigger than MIN_SLIDE_OFFSET. When the slideOffset is bigger than 0.1 and dragView isn't close, set the dragView to minimized. It's only possible to maximize the view when @slideOffset is equals to 0.0, in other words, closed. @param slideOffset Value between 0 and 1, represent the value of slide: 0.0 is equal to close drawer and 1.0 equals open drawer. @param drawerPosition Represent the position of nav drawer on X axis. @param width Width of nav drawer """ if (slideOffset > MIN_SLIDE_OFFSET && !isClosed() && isMaximized()) { minimize(); } setTouchEnabled(slideOffset <= MIN_SLIDE_OFFSET); ViewHelper.setX(this, width - Math.abs(drawerPosition)); }
java
public void slideHorizontally(float slideOffset, float drawerPosition, int width) { if (slideOffset > MIN_SLIDE_OFFSET && !isClosed() && isMaximized()) { minimize(); } setTouchEnabled(slideOffset <= MIN_SLIDE_OFFSET); ViewHelper.setX(this, width - Math.abs(drawerPosition)); }
[ "public", "void", "slideHorizontally", "(", "float", "slideOffset", ",", "float", "drawerPosition", ",", "int", "width", ")", "{", "if", "(", "slideOffset", ">", "MIN_SLIDE_OFFSET", "&&", "!", "isClosed", "(", ")", "&&", "isMaximized", "(", ")", ")", "{", "minimize", "(", ")", ";", "}", "setTouchEnabled", "(", "slideOffset", "<=", "MIN_SLIDE_OFFSET", ")", ";", "ViewHelper", ".", "setX", "(", "this", ",", "width", "-", "Math", ".", "abs", "(", "drawerPosition", ")", ")", ";", "}" ]
Slide the view based on scroll of the nav drawer. "setEnableTouch" user prevents click to expand while the drawer is moving, it will be set to false when the @slideOffset is bigger than MIN_SLIDE_OFFSET. When the slideOffset is bigger than 0.1 and dragView isn't close, set the dragView to minimized. It's only possible to maximize the view when @slideOffset is equals to 0.0, in other words, closed. @param slideOffset Value between 0 and 1, represent the value of slide: 0.0 is equal to close drawer and 1.0 equals open drawer. @param drawerPosition Represent the position of nav drawer on X axis. @param width Width of nav drawer
[ "Slide", "the", "view", "based", "on", "scroll", "of", "the", "nav", "drawer", ".", "setEnableTouch", "user", "prevents", "click", "to", "expand", "while", "the", "drawer", "is", "moving", "it", "will", "be", "set", "to", "false", "when", "the", "@slideOffset", "is", "bigger", "than", "MIN_SLIDE_OFFSET", ".", "When", "the", "slideOffset", "is", "bigger", "than", "0", ".", "1", "and", "dragView", "isn", "t", "close", "set", "the", "dragView", "to", "minimized", ".", "It", "s", "only", "possible", "to", "maximize", "the", "view", "when", "@slideOffset", "is", "equals", "to", "0", ".", "0", "in", "other", "words", "closed", "." ]
train
https://github.com/pedrovgs/DraggablePanel/blob/6b6d1806fa4140113f31307a2571bf02435aa53a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java#L159-L165