repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyImpl_CustomFieldSerializer.java
OWLAnnotationPropertyImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationPropertyImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnnotationPropertyImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLAnnotationPropertyImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationPropertyImpl_CustomFieldSerializer.java#L83-L86
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.wab/src/com/ibm/ws/app/manager/wab/internal/WAB.java
WAB.setState
private boolean setState(State newState) { switch (newState) { case DEPLOYED: return changeState(State.DEPLOYING, State.DEPLOYED); case DEPLOYING: //can move from either UNDEPLOYED or FAILED into DEPLOYING state return (changeState(State.UNDEPLOYED, State.DEPLOYING) || changeState(State.FAILED, State.DEPLOYING)); case UNDEPLOYING: return changeState(State.DEPLOYED, State.UNDEPLOYING); case UNDEPLOYED: return changeState(State.UNDEPLOYING, State.UNDEPLOYED); case FAILED: return changeState(State.DEPLOYING, State.FAILED); default: return false; } }
java
private boolean setState(State newState) { switch (newState) { case DEPLOYED: return changeState(State.DEPLOYING, State.DEPLOYED); case DEPLOYING: //can move from either UNDEPLOYED or FAILED into DEPLOYING state return (changeState(State.UNDEPLOYED, State.DEPLOYING) || changeState(State.FAILED, State.DEPLOYING)); case UNDEPLOYING: return changeState(State.DEPLOYED, State.UNDEPLOYING); case UNDEPLOYED: return changeState(State.UNDEPLOYING, State.UNDEPLOYED); case FAILED: return changeState(State.DEPLOYING, State.FAILED); default: return false; } }
[ "private", "boolean", "setState", "(", "State", "newState", ")", "{", "switch", "(", "newState", ")", "{", "case", "DEPLOYED", ":", "return", "changeState", "(", "State", ".", "DEPLOYING", ",", "State", ".", "DEPLOYED", ")", ";", "case", "DEPLOYING", ":", ...
state should only transition while the terminated lock is held. @param newState @return
[ "state", "should", "only", "transition", "while", "the", "terminated", "lock", "is", "held", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.wab/src/com/ibm/ws/app/manager/wab/internal/WAB.java#L262-L278
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/metadata/BookKeeperJournalMetadataManager.java
BookKeeperJournalMetadataManager.deleteLedgerMetadata
public boolean deleteLedgerMetadata(EditLogLedgerMetadata ledger, int version) throws IOException { String ledgerPath = fullyQualifiedPathForLedger(ledger); try { zooKeeper.delete(ledgerPath, version); return true; } catch (KeeperException.NoNodeException e) { LOG.warn(ledgerPath + " does not exist. Returning false, ignoring " + e); } catch (KeeperException.BadVersionException e) { keeperException("Unable to delete " + ledgerPath + ", version does not match." + " Updated by another process?", e); } catch (KeeperException e) { keeperException("Unrecoverable ZooKeeper error deleting " + ledgerPath, e); } catch (InterruptedException e) { interruptedException("Interrupted deleting " + ledgerPath, e); } return false; }
java
public boolean deleteLedgerMetadata(EditLogLedgerMetadata ledger, int version) throws IOException { String ledgerPath = fullyQualifiedPathForLedger(ledger); try { zooKeeper.delete(ledgerPath, version); return true; } catch (KeeperException.NoNodeException e) { LOG.warn(ledgerPath + " does not exist. Returning false, ignoring " + e); } catch (KeeperException.BadVersionException e) { keeperException("Unable to delete " + ledgerPath + ", version does not match." + " Updated by another process?", e); } catch (KeeperException e) { keeperException("Unrecoverable ZooKeeper error deleting " + ledgerPath, e); } catch (InterruptedException e) { interruptedException("Interrupted deleting " + ledgerPath, e); } return false; }
[ "public", "boolean", "deleteLedgerMetadata", "(", "EditLogLedgerMetadata", "ledger", ",", "int", "version", ")", "throws", "IOException", "{", "String", "ledgerPath", "=", "fullyQualifiedPathForLedger", "(", "ledger", ")", ";", "try", "{", "zooKeeper", ".", "delete"...
Removes ledger-related Metadata from BookKeeper. Does not delete the ledger itself. @param ledger The object for the ledger metadata that we want to delete from BookKeeper @param version The version of the ledger metadata (or -1 to delete any version). Used as a way to guard against deleting a ledger metadata that is being updated by another process. @return True if the process successfully deletes the metadata objection, false if it has already been deleted by another process. @throws IOException If there is an error communicating to ZooKeeper or if the metadata object has been modified within ZooKeeper by another process (version mis-match).
[ "Removes", "ledger", "-", "related", "Metadata", "from", "BookKeeper", ".", "Does", "not", "delete", "the", "ledger", "itself", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/metadata/BookKeeperJournalMetadataManager.java#L218-L237
rhuss/jolokia
agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServerUtil.java
JolokiaMBeanServerUtil.getJolokiaMBeanServer
public static MBeanServer getJolokiaMBeanServer() { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); MBeanServer jolokiaMBeanServer; try { jolokiaMBeanServer = (MBeanServer) server.getAttribute(createObjectName(JolokiaMBeanServerHolderMBean.OBJECT_NAME), JOLOKIA_MBEAN_SERVER_ATTRIBUTE); } catch (InstanceNotFoundException exp) { // should be probably locked, but for simplicity reasons and because // the probability of a clash is fairly low (can happen only once), it's omitted // here. Note, that server.getAttribute() itself is threadsafe. jolokiaMBeanServer = registerJolokiaMBeanServerHolderMBean(server); } catch (JMException e) { throw new IllegalStateException("Internal: Cannot get JolokiaMBean server via JMX lookup: " + e,e); } return jolokiaMBeanServer; }
java
public static MBeanServer getJolokiaMBeanServer() { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); MBeanServer jolokiaMBeanServer; try { jolokiaMBeanServer = (MBeanServer) server.getAttribute(createObjectName(JolokiaMBeanServerHolderMBean.OBJECT_NAME), JOLOKIA_MBEAN_SERVER_ATTRIBUTE); } catch (InstanceNotFoundException exp) { // should be probably locked, but for simplicity reasons and because // the probability of a clash is fairly low (can happen only once), it's omitted // here. Note, that server.getAttribute() itself is threadsafe. jolokiaMBeanServer = registerJolokiaMBeanServerHolderMBean(server); } catch (JMException e) { throw new IllegalStateException("Internal: Cannot get JolokiaMBean server via JMX lookup: " + e,e); } return jolokiaMBeanServer; }
[ "public", "static", "MBeanServer", "getJolokiaMBeanServer", "(", ")", "{", "MBeanServer", "server", "=", "ManagementFactory", ".", "getPlatformMBeanServer", "(", ")", ";", "MBeanServer", "jolokiaMBeanServer", ";", "try", "{", "jolokiaMBeanServer", "=", "(", "MBeanServ...
Lookup the JolokiaMBean server via a JMX lookup to the Jolokia-internal MBean exposing this MBeanServer @return the Jolokia MBeanServer or null if not yet available present
[ "Lookup", "the", "JolokiaMBean", "server", "via", "a", "JMX", "lookup", "to", "the", "Jolokia", "-", "internal", "MBean", "exposing", "this", "MBeanServer" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServerUtil.java#L42-L58
haifengl/smile
core/src/main/java/smile/association/FPGrowth.java
FPGrowth.grow
private long grow(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, HeaderTableItem header, int[] itemset, int[] localItemSupport, int[] prefixItemset) { long n = 1; int support = header.count; int item = header.id; itemset = insert(itemset, item); collect(out, list, ttree, itemset, support); if (header.node.next == null) { FPTree.Node node = header.node; n += grow(out, list, ttree, node.parent, itemset, support); } else { // Count singles in linked list if (getLocalItemSupport(header.node, localItemSupport)) { // Create local FP tree FPTree fptree = getLocalFPTree(header.node, localItemSupport, prefixItemset); // Mine new FP-tree n += grow(out, list, ttree, fptree, itemset, localItemSupport, prefixItemset); } } return n; }
java
private long grow(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, HeaderTableItem header, int[] itemset, int[] localItemSupport, int[] prefixItemset) { long n = 1; int support = header.count; int item = header.id; itemset = insert(itemset, item); collect(out, list, ttree, itemset, support); if (header.node.next == null) { FPTree.Node node = header.node; n += grow(out, list, ttree, node.parent, itemset, support); } else { // Count singles in linked list if (getLocalItemSupport(header.node, localItemSupport)) { // Create local FP tree FPTree fptree = getLocalFPTree(header.node, localItemSupport, prefixItemset); // Mine new FP-tree n += grow(out, list, ttree, fptree, itemset, localItemSupport, prefixItemset); } } return n; }
[ "private", "long", "grow", "(", "PrintStream", "out", ",", "List", "<", "ItemSet", ">", "list", ",", "TotalSupportTree", "ttree", ",", "HeaderTableItem", "header", ",", "int", "[", "]", "itemset", ",", "int", "[", "]", "localItemSupport", ",", "int", "[", ...
Mines FP-tree with respect to a single element in the header table. @param header the header table item of interest. @param itemset the item set represented by the current FP-tree.
[ "Mines", "FP", "-", "tree", "with", "respect", "to", "a", "single", "element", "in", "the", "header", "table", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/FPGrowth.java#L393-L415
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/MemberSelectorManager.java
MemberSelectorManager.resetAll
public void resetAll(MemberId leader, Collection<MemberId> members) { MemberId oldLeader = this.leader; this.leader = leader; this.members = Lists.newLinkedList(members); selectors.forEach(s -> s.reset(leader, this.members)); if (!Objects.equals(oldLeader, leader)) { leaderChangeListeners.forEach(l -> l.accept(leader)); } }
java
public void resetAll(MemberId leader, Collection<MemberId> members) { MemberId oldLeader = this.leader; this.leader = leader; this.members = Lists.newLinkedList(members); selectors.forEach(s -> s.reset(leader, this.members)); if (!Objects.equals(oldLeader, leader)) { leaderChangeListeners.forEach(l -> l.accept(leader)); } }
[ "public", "void", "resetAll", "(", "MemberId", "leader", ",", "Collection", "<", "MemberId", ">", "members", ")", "{", "MemberId", "oldLeader", "=", "this", ".", "leader", ";", "this", ".", "leader", "=", "leader", ";", "this", ".", "members", "=", "List...
Resets all child selectors. @param leader The current cluster leader. @param members The collection of all active members.
[ "Resets", "all", "child", "selectors", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/MemberSelectorManager.java#L99-L107
bazaarvoice/emodb
event/src/main/java/com/bazaarvoice/emodb/event/dedup/DefaultDedupEventStore.java
DefaultDedupEventStore.getQueueReadWrite
@Nullable private DedupQueue getQueueReadWrite(String queue, Duration waitDuration) { return _ownerGroup.startIfOwner(queue, waitDuration); }
java
@Nullable private DedupQueue getQueueReadWrite(String queue, Duration waitDuration) { return _ownerGroup.startIfOwner(queue, waitDuration); }
[ "@", "Nullable", "private", "DedupQueue", "getQueueReadWrite", "(", "String", "queue", ",", "Duration", "waitDuration", ")", "{", "return", "_ownerGroup", ".", "startIfOwner", "(", "queue", ",", "waitDuration", ")", ";", "}" ]
Returns the mutable persistent sorted queue if managed by this JVM, {@code null} otherwise.
[ "Returns", "the", "mutable", "persistent", "sorted", "queue", "if", "managed", "by", "this", "JVM", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/event/dedup/DefaultDedupEventStore.java#L162-L165
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java
FutureManagementChannel.openChannel
final Channel openChannel(final Connection connection, final String serviceType, final OptionMap options, final Long deadline) throws IOException { final IoFuture<Channel> futureChannel = connection.openChannel(serviceType, options); long waitTime = deadline == null ? 10000 : Math.max(10000, deadline - System.currentTimeMillis()); futureChannel.await(waitTime, TimeUnit.MILLISECONDS); if (futureChannel.getStatus() == IoFuture.Status.WAITING) { futureChannel.cancel(); throw ProtocolLogger.ROOT_LOGGER.channelTimedOut(); } return futureChannel.get(); }
java
final Channel openChannel(final Connection connection, final String serviceType, final OptionMap options, final Long deadline) throws IOException { final IoFuture<Channel> futureChannel = connection.openChannel(serviceType, options); long waitTime = deadline == null ? 10000 : Math.max(10000, deadline - System.currentTimeMillis()); futureChannel.await(waitTime, TimeUnit.MILLISECONDS); if (futureChannel.getStatus() == IoFuture.Status.WAITING) { futureChannel.cancel(); throw ProtocolLogger.ROOT_LOGGER.channelTimedOut(); } return futureChannel.get(); }
[ "final", "Channel", "openChannel", "(", "final", "Connection", "connection", ",", "final", "String", "serviceType", ",", "final", "OptionMap", "options", ",", "final", "Long", "deadline", ")", "throws", "IOException", "{", "final", "IoFuture", "<", "Channel", ">...
Open a channel. @param connection the connection @param serviceType the service type @param options the channel options @param deadline time, in ms since the epoch, by which the channel must be created, or {@code null} if the caller is not imposing a specific deadline. Ignored if less than 10s from the current time, with 10s used as the default if this is {@code null} @return the opened channel @throws IOException if there is a remoting problem opening the channel or it cannot be opened in a reasonable amount of time
[ "Open", "a", "channel", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java#L169-L178
xcesco/kripton
kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java
XMLParser.readComment
private String readComment(boolean returnText) throws IOException, KriptonRuntimeException { read(START_COMMENT); if (relaxed) { return readUntil(END_COMMENT, returnText); } String commentText = readUntil(COMMENT_DOUBLE_DASH, returnText); if (peekCharacter() != '>') { throw new KriptonRuntimeException("Comments may not contain --", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null); } position++; return commentText; }
java
private String readComment(boolean returnText) throws IOException, KriptonRuntimeException { read(START_COMMENT); if (relaxed) { return readUntil(END_COMMENT, returnText); } String commentText = readUntil(COMMENT_DOUBLE_DASH, returnText); if (peekCharacter() != '>') { throw new KriptonRuntimeException("Comments may not contain --", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null); } position++; return commentText; }
[ "private", "String", "readComment", "(", "boolean", "returnText", ")", "throws", "IOException", ",", "KriptonRuntimeException", "{", "read", "(", "START_COMMENT", ")", ";", "if", "(", "relaxed", ")", "{", "return", "readUntil", "(", "END_COMMENT", ",", "returnTe...
Read comment. @param returnText the return text @return the string @throws IOException Signals that an I/O exception has occurred. @throws KriptonRuntimeException the kripton runtime exception
[ "Read", "comment", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java#L717-L730
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsync
public static <R> FuncN<Observable<R>> toAsync(FuncN<? extends R> func) { return toAsync(func, Schedulers.computation()); }
java
public static <R> FuncN<Observable<R>> toAsync(FuncN<? extends R> func) { return toAsync(func, Schedulers.computation()); }
[ "public", "static", "<", "R", ">", "FuncN", "<", "Observable", "<", "R", ">", ">", "toAsync", "(", "FuncN", "<", "?", "extends", "R", ">", "func", ")", "{", "return", "toAsync", "(", "func", ",", "Schedulers", ".", "computation", "(", ")", ")", ";"...
Convert a synchronous function call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt=""> @param <R> the result type @param func the function to convert @return a function that returns an Observable that executes the {@code func} and emits its returned value @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
[ "Convert", "a", "synchronous", "function", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki"...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L734-L736
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.readBySax
public static void readBySax(String path, int sheetIndex, RowHandler rowHandler) { BufferedInputStream in = null; try { in = FileUtil.getInputStream(path); readBySax(in, sheetIndex, rowHandler); } finally { IoUtil.close(in); } }
java
public static void readBySax(String path, int sheetIndex, RowHandler rowHandler) { BufferedInputStream in = null; try { in = FileUtil.getInputStream(path); readBySax(in, sheetIndex, rowHandler); } finally { IoUtil.close(in); } }
[ "public", "static", "void", "readBySax", "(", "String", "path", ",", "int", "sheetIndex", ",", "RowHandler", "rowHandler", ")", "{", "BufferedInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "FileUtil", ".", "getInputStream", "(", "path", ")", ...
通过Sax方式读取Excel,同时支持03和07格式 @param path Excel文件路径 @param sheetIndex sheet序号 @param rowHandler 行处理器 @since 3.2.0
[ "通过Sax方式读取Excel,同时支持03和07格式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L35-L43
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
ImageLoaderCurrent.processINodesUC
private void processINodesUC(DataInputStream in, ImageVisitor v, boolean skipBlocks) throws IOException { int numINUC = in.readInt(); v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION, ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC); for(int i = 0; i < numINUC; i++) { checkInterruption(); v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION); byte [] name = FSImageSerialization.readBytes(in); String n = new String(name, "UTF8"); v.visit(ImageElement.INODE_PATH, n); if (LayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) { v.visit(ImageElement.INODE_ID, in.readLong()); } v.visit(ImageElement.REPLICATION, in.readShort()); v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong())); v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong()); int numBlocks = in.readInt(); processBlocks(in, v, numBlocks, skipBlocks); processPermission(in, v); v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in)); v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in)); // Skip over the datanode descriptors, which are still stored in the // file but are not used by the datanode or loaded into memory int numLocs = in.readInt(); for(int j = 0; j < numLocs; j++) { in.readShort(); in.readLong(); in.readLong(); in.readLong(); in.readInt(); FSImageSerialization.readString(in); FSImageSerialization.readString(in); WritableUtils.readEnum(in, AdminStates.class); } v.leaveEnclosingElement(); // INodeUnderConstruction } v.leaveEnclosingElement(); // INodesUnderConstruction }
java
private void processINodesUC(DataInputStream in, ImageVisitor v, boolean skipBlocks) throws IOException { int numINUC = in.readInt(); v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION, ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC); for(int i = 0; i < numINUC; i++) { checkInterruption(); v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION); byte [] name = FSImageSerialization.readBytes(in); String n = new String(name, "UTF8"); v.visit(ImageElement.INODE_PATH, n); if (LayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) { v.visit(ImageElement.INODE_ID, in.readLong()); } v.visit(ImageElement.REPLICATION, in.readShort()); v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong())); v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong()); int numBlocks = in.readInt(); processBlocks(in, v, numBlocks, skipBlocks); processPermission(in, v); v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in)); v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in)); // Skip over the datanode descriptors, which are still stored in the // file but are not used by the datanode or loaded into memory int numLocs = in.readInt(); for(int j = 0; j < numLocs; j++) { in.readShort(); in.readLong(); in.readLong(); in.readLong(); in.readInt(); FSImageSerialization.readString(in); FSImageSerialization.readString(in); WritableUtils.readEnum(in, AdminStates.class); } v.leaveEnclosingElement(); // INodeUnderConstruction } v.leaveEnclosingElement(); // INodesUnderConstruction }
[ "private", "void", "processINodesUC", "(", "DataInputStream", "in", ",", "ImageVisitor", "v", ",", "boolean", "skipBlocks", ")", "throws", "IOException", "{", "int", "numINUC", "=", "in", ".", "readInt", "(", ")", ";", "v", ".", "visitEnclosingElement", "(", ...
Process the INodes under construction section of the fsimage. @param in DataInputStream to process @param v Visitor to walk over inodes @param skipBlocks Walk over each block?
[ "Process", "the", "INodes", "under", "construction", "section", "of", "the", "fsimage", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java#L202-L250
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.removePanels
private static void removePanels(TabbedPanel2 tabbedPanel, List<AbstractPanel> panels) { for (AbstractPanel panel : panels) { removeTabPanel(tabbedPanel, panel); } tabbedPanel.revalidate(); }
java
private static void removePanels(TabbedPanel2 tabbedPanel, List<AbstractPanel> panels) { for (AbstractPanel panel : panels) { removeTabPanel(tabbedPanel, panel); } tabbedPanel.revalidate(); }
[ "private", "static", "void", "removePanels", "(", "TabbedPanel2", "tabbedPanel", ",", "List", "<", "AbstractPanel", ">", "panels", ")", "{", "for", "(", "AbstractPanel", "panel", ":", "panels", ")", "{", "removeTabPanel", "(", "tabbedPanel", ",", "panel", ")",...
Removes the given {@code panels} from the given {@code tabbedPanel}. <p> After removing all the panels the tabbed panel is revalidated. @param tabbedPanel the tabbed panel to remove the panels @param panels the panels to remove @see #addPanel(TabbedPanel2, AbstractPanel, boolean) @see javax.swing.JComponent#revalidate()
[ "Removes", "the", "given", "{", "@code", "panels", "}", "from", "the", "given", "{", "@code", "tabbedPanel", "}", ".", "<p", ">", "After", "removing", "all", "the", "panels", "the", "tabbed", "panel", "is", "revalidated", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L978-L983
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_role_roleId_member_username_GET
public OvhMember serviceName_role_roleId_member_username_GET(String serviceName, String roleId, String username) throws IOException { String qPath = "/dbaas/logs/{serviceName}/role/{roleId}/member/{username}"; StringBuilder sb = path(qPath, serviceName, roleId, username); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhMember.class); }
java
public OvhMember serviceName_role_roleId_member_username_GET(String serviceName, String roleId, String username) throws IOException { String qPath = "/dbaas/logs/{serviceName}/role/{roleId}/member/{username}"; StringBuilder sb = path(qPath, serviceName, roleId, username); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhMember.class); }
[ "public", "OvhMember", "serviceName_role_roleId_member_username_GET", "(", "String", "serviceName", ",", "String", "roleId", ",", "String", "username", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/role/{roleId}/member/{username}\"", ...
Returns the member metadata REST: GET /dbaas/logs/{serviceName}/role/{roleId}/member/{username} @param serviceName [required] Service name @param roleId [required] Role ID @param username [required] Username
[ "Returns", "the", "member", "metadata" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L930-L935
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.drawSheared
public void drawSheared(float x,float y, float hshear, float vshear, Color filter) { if (alpha != 1) { if (filter == null) { filter = Color.white; } filter = new Color(filter); filter.a *= alpha; } if (filter != null) { filter.bind(); } texture.bind(); GL.glTranslatef(x, y, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); init(); GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(0, 0, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(hshear, height, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(width + hshear, height + vshear, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(width, vshear, 0); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x, -y, 0); }
java
public void drawSheared(float x,float y, float hshear, float vshear, Color filter) { if (alpha != 1) { if (filter == null) { filter = Color.white; } filter = new Color(filter); filter.a *= alpha; } if (filter != null) { filter.bind(); } texture.bind(); GL.glTranslatef(x, y, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); init(); GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(0, 0, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(hshear, height, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(width + hshear, height + vshear, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(width, vshear, 0); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x, -y, 0); }
[ "public", "void", "drawSheared", "(", "float", "x", ",", "float", "y", ",", "float", "hshear", ",", "float", "vshear", ",", "Color", "filter", ")", "{", "if", "(", "alpha", "!=", "1", ")", "{", "if", "(", "filter", "==", "null", ")", "{", "filter",...
Draw this image at a specified location and size @param x The x location to draw the image at @param y The y location to draw the image at @param hshear The amount to shear the bottom points by horizontally @param vshear The amount to shear the right points by vertically @param filter The colour filter to apply
[ "Draw", "this", "image", "at", "a", "specified", "location", "and", "size" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L709-L751
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/ArrayUtil.java
ArrayUtil.startsWith
public static boolean startsWith(Object array1[], Object array2[]){ return equals(array1, 0, array2, 0, array2.length); }
java
public static boolean startsWith(Object array1[], Object array2[]){ return equals(array1, 0, array2, 0, array2.length); }
[ "public", "static", "boolean", "startsWith", "(", "Object", "array1", "[", "]", ",", "Object", "array2", "[", "]", ")", "{", "return", "equals", "(", "array1", ",", "0", ",", "array2", ",", "0", ",", "array2", ".", "length", ")", ";", "}" ]
Returns true if <code>array1</code> starts with <code>array2</code>
[ "Returns", "true", "if", "<code", ">", "array1<", "/", "code", ">", "starts", "with", "<code", ">", "array2<", "/", "code", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/ArrayUtil.java#L119-L121
pavlospt/RxFile
rxfile/src/main/java/com/pavlospt/rxfile/RxFile.java
RxFile.createFilesFromClipData
public static Observable<List<File>> createFilesFromClipData(final Context context, final ClipData clipData) { return createFilesFromClipData(context, clipData, MimeMap.UrlConnection); }
java
public static Observable<List<File>> createFilesFromClipData(final Context context, final ClipData clipData) { return createFilesFromClipData(context, clipData, MimeMap.UrlConnection); }
[ "public", "static", "Observable", "<", "List", "<", "File", ">", ">", "createFilesFromClipData", "(", "final", "Context", "context", ",", "final", "ClipData", "clipData", ")", "{", "return", "createFilesFromClipData", "(", "context", ",", "clipData", ",", "MimeM...
/* Create a copy of the files found under the ClipData item passed from MultiSelection, in the Library's cache folder. The mime type of the resource will be determined by URLConnection.guessContentTypeFromName() method.
[ "/", "*", "Create", "a", "copy", "of", "the", "files", "found", "under", "the", "ClipData", "item", "passed", "from", "MultiSelection", "in", "the", "Library", "s", "cache", "folder", "." ]
train
https://github.com/pavlospt/RxFile/blob/54210b02631f4b27d31bea040eca86183136cf46/rxfile/src/main/java/com/pavlospt/rxfile/RxFile.java#L136-L140
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java
RingBuffer.tryPublishEvents
public boolean tryPublishEvents(EventTranslatorVararg<E> translator, Object[]... args) { return tryPublishEvents(translator, 0, args.length, args); }
java
public boolean tryPublishEvents(EventTranslatorVararg<E> translator, Object[]... args) { return tryPublishEvents(translator, 0, args.length, args); }
[ "public", "boolean", "tryPublishEvents", "(", "EventTranslatorVararg", "<", "E", ">", "translator", ",", "Object", "[", "]", "...", "args", ")", "{", "return", "tryPublishEvents", "(", "translator", ",", "0", ",", "args", ".", "length", ",", "args", ")", "...
Allows a variable number of user supplied arguments per event. @param translator The user specified translation for the event @param args User supplied arguments, one Object[] per event. @return true if the value was published, false if there was insufficient capacity. @see #publishEvents(com.lmax.disruptor.EventTranslator[])
[ "Allows", "a", "variable", "number", "of", "user", "supplied", "arguments", "per", "event", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java#L787-L789
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.zipFile
private static void zipFile(final File srcFile, final String destPath, final ZipOutputStream out) throws IOException { final byte[] buf = new byte[1024]; try (final InputStream in = new BufferedInputStream(new FileInputStream(srcFile))) { final ZipEntry zipEntry = new ZipEntry(concatPathAndFilename(destPath, srcFile.getName(), File.separator)); zipEntry.setTime(srcFile.lastModified()); out.putNextEntry(zipEntry); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); } }
java
private static void zipFile(final File srcFile, final String destPath, final ZipOutputStream out) throws IOException { final byte[] buf = new byte[1024]; try (final InputStream in = new BufferedInputStream(new FileInputStream(srcFile))) { final ZipEntry zipEntry = new ZipEntry(concatPathAndFilename(destPath, srcFile.getName(), File.separator)); zipEntry.setTime(srcFile.lastModified()); out.putNextEntry(zipEntry); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); } }
[ "private", "static", "void", "zipFile", "(", "final", "File", "srcFile", ",", "final", "String", "destPath", ",", "final", "ZipOutputStream", "out", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "buf", "=", "new", "byte", "[", "1024", "]", ...
Adds a file to a ZIP output stream. @param srcFile File to add - Cannot be <code>null</code>. @param destPath Path to use for the file - May be <code>null</code> or empty. @param out Destination stream - Cannot be <code>null</code>. @throws IOException Error writing to the output stream.
[ "Adds", "a", "file", "to", "a", "ZIP", "output", "stream", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1297-L1310
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.beginPowerOffAsync
public Observable<OperationStatusResponseInner> beginPowerOffAsync(String resourceGroupName, String vmScaleSetName) { return beginPowerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginPowerOffAsync(String resourceGroupName, String vmScaleSetName) { return beginPowerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginPowerOffAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "beginPowerOffWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", "....
Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "Power", "off", "(", "stop", ")", "one", "or", "more", "virtual", "machines", "in", "a", "VM", "scale", "set", ".", "Note", "that", "resources", "are", "still", "attached", "and", "you", "are", "getting", "charged", "for", "the", "resources", ".", "Inste...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1901-L1908
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/XYCurve.java
XYCurve.addAndSimplify
public void addAndSimplify(double x, double y) { // simplify curve when possible: final int len = data.size(); if (len >= 4) { // Look at the previous 2 points final double l1x = data.get(len - 4); final double l1y = data.get(len - 3); final double l2x = data.get(len - 2); final double l2y = data.get(len - 1); // Differences: final double ldx = l2x - l1x; final double ldy = l2y - l1y; final double cdx = x - l2x; final double cdy = y - l2y; // X simplification if ((ldx == 0) && (cdx == 0)) { data.remove(len - 2, 2); } // horizontal simplification else if ((ldy == 0) && (cdy == 0)) { data.remove(len - 2, 2); } // diagonal simplification else if (ldy > 0 && cdy > 0) { if (Math.abs((ldx / ldy) - (cdx / cdy)) < THRESHOLD) { data.remove(len - 2, 2); } } } add(x, y); }
java
public void addAndSimplify(double x, double y) { // simplify curve when possible: final int len = data.size(); if (len >= 4) { // Look at the previous 2 points final double l1x = data.get(len - 4); final double l1y = data.get(len - 3); final double l2x = data.get(len - 2); final double l2y = data.get(len - 1); // Differences: final double ldx = l2x - l1x; final double ldy = l2y - l1y; final double cdx = x - l2x; final double cdy = y - l2y; // X simplification if ((ldx == 0) && (cdx == 0)) { data.remove(len - 2, 2); } // horizontal simplification else if ((ldy == 0) && (cdy == 0)) { data.remove(len - 2, 2); } // diagonal simplification else if (ldy > 0 && cdy > 0) { if (Math.abs((ldx / ldy) - (cdx / cdy)) < THRESHOLD) { data.remove(len - 2, 2); } } } add(x, y); }
[ "public", "void", "addAndSimplify", "(", "double", "x", ",", "double", "y", ")", "{", "// simplify curve when possible:", "final", "int", "len", "=", "data", ".", "size", "(", ")", ";", "if", "(", "len", ">=", "4", ")", "{", "// Look at the previous 2 points...
Add a coordinate pair, performing curve simplification if possible. @param x X coordinate @param y Y coordinate
[ "Add", "a", "coordinate", "pair", "performing", "curve", "simplification", "if", "possible", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/XYCurve.java#L149-L179
openbase/jul
exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java
ExceptionPrinter.printHistory
public static <T extends Throwable> void printHistory(final String message, final T th, final PrintStream stream) { printHistory(new CouldNotPerformException(message, th), new SystemPrinter(stream)); }
java
public static <T extends Throwable> void printHistory(final String message, final T th, final PrintStream stream) { printHistory(new CouldNotPerformException(message, th), new SystemPrinter(stream)); }
[ "public", "static", "<", "T", "extends", "Throwable", ">", "void", "printHistory", "(", "final", "String", "message", ",", "final", "T", "th", ",", "final", "PrintStream", "stream", ")", "{", "printHistory", "(", "new", "CouldNotPerformException", "(", "messag...
Print Exception messages without stack trace in non debug mode. Method prints recursive all messages of the given exception stack to get a history overview of the causes. In verbose mode (app -v) the stacktrace is printed in the end of history. The given message and the exception are bundled as new CouldNotPerformException and further processed. @param <T> Exception type @param message the reason why this exception occurs. @param th the exception cause. @param stream the stream used for printing the message history e.g. System.out or. System.err
[ "Print", "Exception", "messages", "without", "stack", "trace", "in", "non", "debug", "mode", ".", "Method", "prints", "recursive", "all", "messages", "of", "the", "given", "exception", "stack", "to", "get", "a", "history", "overview", "of", "the", "causes", ...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java#L237-L239
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java
ElasticPoolsInner.beginUpdate
public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); }
java
public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); }
[ "public", "ElasticPoolInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "elasticPoolName", ",", "ElasticPoolUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Updates an existing elastic pool. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param elasticPoolName The name of the elastic pool to be updated. @param parameters The required parameters for updating an elastic pool. @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 ElasticPoolInner object if successful.
[ "Updates", "an", "existing", "elastic", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java#L382-L384
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java
GridBagLayoutBuilder.appendLeftLabel
public GridBagLayoutBuilder appendLeftLabel(String labelKey, int colSpan) { final JLabel label = createLabel(labelKey); label.setHorizontalAlignment(SwingConstants.LEFT); return appendLabel(label, colSpan); }
java
public GridBagLayoutBuilder appendLeftLabel(String labelKey, int colSpan) { final JLabel label = createLabel(labelKey); label.setHorizontalAlignment(SwingConstants.LEFT); return appendLabel(label, colSpan); }
[ "public", "GridBagLayoutBuilder", "appendLeftLabel", "(", "String", "labelKey", ",", "int", "colSpan", ")", "{", "final", "JLabel", "label", "=", "createLabel", "(", "labelKey", ")", ";", "label", ".", "setHorizontalAlignment", "(", "SwingConstants", ".", "LEFT", ...
Appends a left-justified label to the end of the given line, using the provided string as the key to look in the {@link #setComponentFactory(ComponentFactory) ComponentFactory's}message bundle for the text to use. @param labelKey the key into the message bundle; if not found the key is used as the text to display @param colSpan the number of columns to span @return "this" to make it easier to string together append calls
[ "Appends", "a", "left", "-", "justified", "label", "to", "the", "end", "of", "the", "given", "line", "using", "the", "provided", "string", "as", "the", "key", "to", "look", "in", "the", "{", "@link", "#setComponentFactory", "(", "ComponentFactory", ")", "C...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L535-L539
Erudika/para
para-server/src/main/java/com/erudika/para/rest/RestUtils.java
RestUtils.readResourcePath
public static ParaObject readResourcePath(String appid, String path) { if (StringUtils.isBlank(appid) || StringUtils.isBlank(path) || !path.contains("/")) { return null; } try { URI uri = new URI(path); if (path.length() > 1) { path = path.startsWith("/") ? uri.getPath().substring(1) : uri.getPath(); String[] parts = path.split("/"); String id; if (parts.length == 1) { id = parts[0]; // case: {id} } else if (parts.length >= 2) { id = parts[1]; // case: {type}/{id}/... } else { return null; } return Para.getDAO().read(appid, id); } } catch (Exception e) { logger.debug("Invalid resource path {}: {}", path, e); } return null; }
java
public static ParaObject readResourcePath(String appid, String path) { if (StringUtils.isBlank(appid) || StringUtils.isBlank(path) || !path.contains("/")) { return null; } try { URI uri = new URI(path); if (path.length() > 1) { path = path.startsWith("/") ? uri.getPath().substring(1) : uri.getPath(); String[] parts = path.split("/"); String id; if (parts.length == 1) { id = parts[0]; // case: {id} } else if (parts.length >= 2) { id = parts[1]; // case: {type}/{id}/... } else { return null; } return Para.getDAO().read(appid, id); } } catch (Exception e) { logger.debug("Invalid resource path {}: {}", path, e); } return null; }
[ "public", "static", "ParaObject", "readResourcePath", "(", "String", "appid", ",", "String", "path", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "appid", ")", "||", "StringUtils", ".", "isBlank", "(", "path", ")", "||", "!", "path", ".", "co...
Reads an object from a given resource path. Assumes that the "id" is located after the first slash "/" like this: {type}/{id}/... @param appid app id @param path resource path @return the object found at this path or null
[ "Reads", "an", "object", "from", "a", "given", "resource", "path", ".", "Assumes", "that", "the", "id", "is", "located", "after", "the", "first", "slash", "/", "like", "this", ":", "{", "type", "}", "/", "{", "id", "}", "/", "..." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L168-L191
FINRAOS/JTAF-ExtWebDriver
src/main/java/org/finra/jtaf/ewd/widget/element/Element.java
Element.waitForNotVisible
public void waitForNotVisible(final long time) throws WidgetException { try { waitForCommand(new ITimerCallback() { @Override public boolean execute() throws WidgetException { return !isVisible(); } @Override public String toString() { return "Waiting for element with locator: " + locator + " to not be visible"; } }, time); } catch (Exception e) { throw new WidgetException("Error while waiting for element to be not visible", locator, e); } }
java
public void waitForNotVisible(final long time) throws WidgetException { try { waitForCommand(new ITimerCallback() { @Override public boolean execute() throws WidgetException { return !isVisible(); } @Override public String toString() { return "Waiting for element with locator: " + locator + " to not be visible"; } }, time); } catch (Exception e) { throw new WidgetException("Error while waiting for element to be not visible", locator, e); } }
[ "public", "void", "waitForNotVisible", "(", "final", "long", "time", ")", "throws", "WidgetException", "{", "try", "{", "waitForCommand", "(", "new", "ITimerCallback", "(", ")", "{", "@", "Override", "public", "boolean", "execute", "(", ")", "throws", "WidgetE...
Waits for specific element at locator to be not visible within period of specified time @param time Milliseconds @throws WidgetException
[ "Waits", "for", "specific", "element", "at", "locator", "to", "be", "not", "visible", "within", "period", "of", "specified", "time" ]
train
https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/widget/element/Element.java#L417-L434
intellimate/Izou
src/main/java/org/intellimate/izou/security/SocketPermissionModule.java
SocketPermissionModule.checkPermission
@Override public void checkPermission(Permission permission, AddOnModel addon) throws IzouPermissionException { for (String socket : allowedSocketConnections) { if (permission.getName().contains(socket)) { return; } } if (isRegistered(addon)) return; Function<PluginDescriptor, Boolean> checkPermission = descriptor -> { if (descriptor.getAddOnProperties() == null) throw new IzouPermissionException("addon_config.properties not found for addon:" + addon); try { return descriptor.getAddOnProperties().getProperty("socket_connection") != null && descriptor.getAddOnProperties().getProperty("socket_connection").trim().equals("true") && descriptor.getAddOnProperties().getProperty("socket_usage_descripton") != null && !descriptor.getAddOnProperties().getProperty("socket_usage_descripton").trim().equals("null") && !descriptor.getAddOnProperties().getProperty("socket_usage_descripton").trim().isEmpty(); } catch (NullPointerException e) { return false; } }; String exceptionMessage = "Socket Permission Denied: " + addon + "is not registered to " + "use socket connections, please add the required information to the addon_config.properties " + "file of your addOn."; registerOrThrow(addon, () -> new IzouSocketPermissionException(exceptionMessage), checkPermission); }
java
@Override public void checkPermission(Permission permission, AddOnModel addon) throws IzouPermissionException { for (String socket : allowedSocketConnections) { if (permission.getName().contains(socket)) { return; } } if (isRegistered(addon)) return; Function<PluginDescriptor, Boolean> checkPermission = descriptor -> { if (descriptor.getAddOnProperties() == null) throw new IzouPermissionException("addon_config.properties not found for addon:" + addon); try { return descriptor.getAddOnProperties().getProperty("socket_connection") != null && descriptor.getAddOnProperties().getProperty("socket_connection").trim().equals("true") && descriptor.getAddOnProperties().getProperty("socket_usage_descripton") != null && !descriptor.getAddOnProperties().getProperty("socket_usage_descripton").trim().equals("null") && !descriptor.getAddOnProperties().getProperty("socket_usage_descripton").trim().isEmpty(); } catch (NullPointerException e) { return false; } }; String exceptionMessage = "Socket Permission Denied: " + addon + "is not registered to " + "use socket connections, please add the required information to the addon_config.properties " + "file of your addOn."; registerOrThrow(addon, () -> new IzouSocketPermissionException(exceptionMessage), checkPermission); }
[ "@", "Override", "public", "void", "checkPermission", "(", "Permission", "permission", ",", "AddOnModel", "addon", ")", "throws", "IzouPermissionException", "{", "for", "(", "String", "socket", ":", "allowedSocketConnections", ")", "{", "if", "(", "permission", "....
Checks if the given addOn is allowed to access the requested service and registers them if not yet registered. @param permission the Permission to check @param addon the identifiable to check @throws IzouPermissionException thrown if the addOn is not allowed to access its requested service
[ "Checks", "if", "the", "given", "addOn", "is", "allowed", "to", "access", "the", "requested", "service", "and", "registers", "them", "if", "not", "yet", "registered", "." ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/SocketPermissionModule.java#L54-L83
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java
VirtualCdj.findMatchingAddress
private InterfaceAddress findMatchingAddress(DeviceAnnouncement aDevice, NetworkInterface networkInterface) { for (InterfaceAddress address : networkInterface.getInterfaceAddresses()) { if ((address.getBroadcast() != null) && Util.sameNetwork(address.getNetworkPrefixLength(), aDevice.getAddress(), address.getAddress())) { return address; } } return null; }
java
private InterfaceAddress findMatchingAddress(DeviceAnnouncement aDevice, NetworkInterface networkInterface) { for (InterfaceAddress address : networkInterface.getInterfaceAddresses()) { if ((address.getBroadcast() != null) && Util.sameNetwork(address.getNetworkPrefixLength(), aDevice.getAddress(), address.getAddress())) { return address; } } return null; }
[ "private", "InterfaceAddress", "findMatchingAddress", "(", "DeviceAnnouncement", "aDevice", ",", "NetworkInterface", "networkInterface", ")", "{", "for", "(", "InterfaceAddress", "address", ":", "networkInterface", ".", "getInterfaceAddresses", "(", ")", ")", "{", "if",...
Scan a network interface to find if it has an address space which matches the device we are trying to reach. If so, return the address specification. @param aDevice the DJ Link device we are trying to communicate with @param networkInterface the network interface we are testing @return the address which can be used to communicate with the device on the interface, or null
[ "Scan", "a", "network", "interface", "to", "find", "if", "it", "has", "an", "address", "space", "which", "matches", "the", "device", "we", "are", "trying", "to", "reach", ".", "If", "so", "return", "the", "address", "specification", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L477-L485
ontop/ontop
mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/serializer/TurtleWriter.java
TurtleWriter.put
void put(String subject, String predicate, String object) { // Subject to Predicates map ArrayList<String> predicateList = subjectToPredicates.get(subject); if (predicateList == null) { predicateList = new ArrayList<String>(); } insert(predicateList, predicate); subjectToPredicates.put(subject, predicateList); // Predicate to Objects map ArrayList<String> objectList = predicateToObjects.get(predicate + "_" + subject); // predicate that appears in 2 different subjects should not have all objects assigned to both subjects if (objectList == null) { objectList = new ArrayList<String>(); } objectList.add(object); predicateToObjects.put(predicate + "_" + subject, objectList); }
java
void put(String subject, String predicate, String object) { // Subject to Predicates map ArrayList<String> predicateList = subjectToPredicates.get(subject); if (predicateList == null) { predicateList = new ArrayList<String>(); } insert(predicateList, predicate); subjectToPredicates.put(subject, predicateList); // Predicate to Objects map ArrayList<String> objectList = predicateToObjects.get(predicate + "_" + subject); // predicate that appears in 2 different subjects should not have all objects assigned to both subjects if (objectList == null) { objectList = new ArrayList<String>(); } objectList.add(object); predicateToObjects.put(predicate + "_" + subject, objectList); }
[ "void", "put", "(", "String", "subject", ",", "String", "predicate", ",", "String", "object", ")", "{", "// Subject to Predicates map", "ArrayList", "<", "String", ">", "predicateList", "=", "subjectToPredicates", ".", "get", "(", "subject", ")", ";", "if", "(...
Adding the subject, predicate and object components to this container. @param subject The subject term of the Function. @param predicate The Function predicate. @param object The object term of the Function.
[ "Adding", "the", "subject", "predicate", "and", "object", "components", "to", "this", "container", "." ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/serializer/TurtleWriter.java#L72-L88
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/PairtreeUtils.java
PairtreeUtils.getEncapsulatingDir
public static String getEncapsulatingDir(final String aBasePath, final String aPtPath) throws InvalidPathException { return getEncapsulatingDir(removeBasePath(aBasePath, aPtPath)); }
java
public static String getEncapsulatingDir(final String aBasePath, final String aPtPath) throws InvalidPathException { return getEncapsulatingDir(removeBasePath(aBasePath, aPtPath)); }
[ "public", "static", "String", "getEncapsulatingDir", "(", "final", "String", "aBasePath", ",", "final", "String", "aPtPath", ")", "throws", "InvalidPathException", "{", "return", "getEncapsulatingDir", "(", "removeBasePath", "(", "aBasePath", ",", "aPtPath", ")", ")...
Extracts the encapsulating directory from the supplied Pairtree path, using the supplied base path. @param aBasePath A base path for the Pairtree path @param aPtPath The Pairtree path @return The name of the encapsulating directory @throws InvalidPathException If there is a problem extracting the encapsulating directory
[ "Extracts", "the", "encapsulating", "directory", "from", "the", "supplied", "Pairtree", "path", "using", "the", "supplied", "base", "path", "." ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/PairtreeUtils.java#L236-L239
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/FixedQuantilesCallback.java
FixedQuantilesCallback.createBuckets
@Override protected Buckets createBuckets(Stopwatch stopwatch) { return createBuckets(stopwatch, min * SimonClock.NANOS_IN_MILLIS, max * SimonClock.NANOS_IN_MILLIS, bucketNb); }
java
@Override protected Buckets createBuckets(Stopwatch stopwatch) { return createBuckets(stopwatch, min * SimonClock.NANOS_IN_MILLIS, max * SimonClock.NANOS_IN_MILLIS, bucketNb); }
[ "@", "Override", "protected", "Buckets", "createBuckets", "(", "Stopwatch", "stopwatch", ")", "{", "return", "createBuckets", "(", "stopwatch", ",", "min", "*", "SimonClock", ".", "NANOS_IN_MILLIS", ",", "max", "*", "SimonClock", ".", "NANOS_IN_MILLIS", ",", "bu...
Create buckets using callback attributes @param stopwatch Target stopwatch @return Created buckets
[ "Create", "buckets", "using", "callback", "attributes" ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/FixedQuantilesCallback.java#L49-L52
DDTH/ddth-tsc
ddth-tsc-core/src/main/java/com/github/ddth/tsc/redis/ShardedRedisCounterFactory.java
ShardedRedisCounterFactory.newJedisPool
public static ShardedJedisPool newJedisPool(String hostsAndPorts, String password, long timeoutMs) { final int maxTotal = Runtime.getRuntime().availableProcessors(); final int maxIdle = maxTotal / 2; JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setMaxTotal(maxTotal); poolConfig.setMinIdle(1); poolConfig.setMaxIdle(maxIdle > 0 ? maxIdle : 1); poolConfig.setMaxWaitMillis(timeoutMs); // poolConfig.setTestOnBorrow(true); poolConfig.setTestWhileIdle(true); List<JedisShardInfo> shards = new ArrayList<>(); String[] hapList = hostsAndPorts.split("[,;\\s]+"); for (String hostAndPort : hapList) { String[] tokens = hostAndPort.split(":"); String host = tokens.length > 0 ? tokens[0] : Protocol.DEFAULT_HOST; int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : Protocol.DEFAULT_PORT; JedisShardInfo shardInfo = new JedisShardInfo(host, port); shardInfo.setPassword(password); shards.add(shardInfo); } ShardedJedisPool jedisPool = new ShardedJedisPool(poolConfig, shards); return jedisPool; }
java
public static ShardedJedisPool newJedisPool(String hostsAndPorts, String password, long timeoutMs) { final int maxTotal = Runtime.getRuntime().availableProcessors(); final int maxIdle = maxTotal / 2; JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setMaxTotal(maxTotal); poolConfig.setMinIdle(1); poolConfig.setMaxIdle(maxIdle > 0 ? maxIdle : 1); poolConfig.setMaxWaitMillis(timeoutMs); // poolConfig.setTestOnBorrow(true); poolConfig.setTestWhileIdle(true); List<JedisShardInfo> shards = new ArrayList<>(); String[] hapList = hostsAndPorts.split("[,;\\s]+"); for (String hostAndPort : hapList) { String[] tokens = hostAndPort.split(":"); String host = tokens.length > 0 ? tokens[0] : Protocol.DEFAULT_HOST; int port = tokens.length > 1 ? Integer.parseInt(tokens[1]) : Protocol.DEFAULT_PORT; JedisShardInfo shardInfo = new JedisShardInfo(host, port); shardInfo.setPassword(password); shards.add(shardInfo); } ShardedJedisPool jedisPool = new ShardedJedisPool(poolConfig, shards); return jedisPool; }
[ "public", "static", "ShardedJedisPool", "newJedisPool", "(", "String", "hostsAndPorts", ",", "String", "password", ",", "long", "timeoutMs", ")", "{", "final", "int", "maxTotal", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "availableProcessors", "(", ")", ...
Creates a new {@link ShardedJedisPool}. @param hostsAndPorts format {@code host1:port1,host2:port2...} @param password @param timeoutMs @return
[ "Creates", "a", "new", "{", "@link", "ShardedJedisPool", "}", "." ]
train
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/redis/ShardedRedisCounterFactory.java#L52-L78
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/format/impl/MediaFormatHandlerImpl.java
MediaFormatHandlerImpl.detectMediaFormat
@Override public MediaFormat detectMediaFormat(@Nullable String extension, long fileSize, long width, long height) { SortedSet<MediaFormat> matchingFormats = detectMediaFormats(extension, fileSize, width, height); return !matchingFormats.isEmpty() ? matchingFormats.first() : null; }
java
@Override public MediaFormat detectMediaFormat(@Nullable String extension, long fileSize, long width, long height) { SortedSet<MediaFormat> matchingFormats = detectMediaFormats(extension, fileSize, width, height); return !matchingFormats.isEmpty() ? matchingFormats.first() : null; }
[ "@", "Override", "public", "MediaFormat", "detectMediaFormat", "(", "@", "Nullable", "String", "extension", ",", "long", "fileSize", ",", "long", "width", ",", "long", "height", ")", "{", "SortedSet", "<", "MediaFormat", ">", "matchingFormats", "=", "detectMedia...
Detect matching media format. @param extension File extension @param fileSize File size @param width Image width (or 0 if not image) @param height Image height (or 0 if not image) @return Media format or null if no matching media format found
[ "Detect", "matching", "media", "format", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/format/impl/MediaFormatHandlerImpl.java#L260-L264
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsUndoChanges.java
CmsUndoChanges.resourceOriginalPath
public static String resourceOriginalPath(CmsObject cms, String resourceName) { CmsProject proj = cms.getRequestContext().getCurrentProject(); try { CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); String result = cms.getSitePath(resource); cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); result = cms.getSitePath(cms.readResource(resource.getStructureId())); // remove '/' if needed if (result.charAt(result.length() - 1) == '/') { if (resourceName.charAt(resourceName.length() - 1) != '/') { result = result.substring(0, result.length() - 1); } } return result; } catch (CmsException e) { return null; } finally { cms.getRequestContext().setCurrentProject(proj); } }
java
public static String resourceOriginalPath(CmsObject cms, String resourceName) { CmsProject proj = cms.getRequestContext().getCurrentProject(); try { CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); String result = cms.getSitePath(resource); cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); result = cms.getSitePath(cms.readResource(resource.getStructureId())); // remove '/' if needed if (result.charAt(result.length() - 1) == '/') { if (resourceName.charAt(resourceName.length() - 1) != '/') { result = result.substring(0, result.length() - 1); } } return result; } catch (CmsException e) { return null; } finally { cms.getRequestContext().setCurrentProject(proj); } }
[ "public", "static", "String", "resourceOriginalPath", "(", "CmsObject", "cms", ",", "String", "resourceName", ")", "{", "CmsProject", "proj", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentProject", "(", ")", ";", "try", "{", "CmsResource", "r...
Returns the original path of given resource, that is the online path for the resource. If it differs from the offline path, the resource has been moved.<p> @param cms the cms context @param resourceName a site relative resource name @return the online path, or <code>null</code> if resource has not been published
[ "Returns", "the", "original", "path", "of", "given", "resource", "that", "is", "the", "online", "path", "for", "the", "resource", ".", "If", "it", "differs", "from", "the", "offline", "path", "the", "resource", "has", "been", "moved", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsUndoChanges.java#L128-L148
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/query/PartitionScanRunner.java
PartitionScanRunner.run
public QueryableEntriesSegment run(String mapName, Predicate predicate, int partitionId, int tableIndex, int fetchSize) { int lastIndex = tableIndex; final List<QueryableEntry> resultList = new LinkedList<>(); final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); final RecordStore recordStore = partitionContainer.getRecordStore(mapName); final Extractors extractors = mapServiceContext.getExtractors(mapName); while (resultList.size() < fetchSize && lastIndex >= 0) { final MapEntriesWithCursor cursor = recordStore.fetchEntries(lastIndex, fetchSize - resultList.size()); lastIndex = cursor.getNextTableIndexToReadFrom(); final Collection<? extends Entry<Data, Data>> entries = cursor.getBatch(); if (entries.isEmpty()) { break; } for (Entry<Data, Data> entry : entries) { QueryableEntry queryEntry = new LazyMapEntry(entry.getKey(), entry.getValue(), serializationService, extractors); if (predicate.apply(queryEntry)) { resultList.add(queryEntry); } } } return new QueryableEntriesSegment(resultList, lastIndex); }
java
public QueryableEntriesSegment run(String mapName, Predicate predicate, int partitionId, int tableIndex, int fetchSize) { int lastIndex = tableIndex; final List<QueryableEntry> resultList = new LinkedList<>(); final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); final RecordStore recordStore = partitionContainer.getRecordStore(mapName); final Extractors extractors = mapServiceContext.getExtractors(mapName); while (resultList.size() < fetchSize && lastIndex >= 0) { final MapEntriesWithCursor cursor = recordStore.fetchEntries(lastIndex, fetchSize - resultList.size()); lastIndex = cursor.getNextTableIndexToReadFrom(); final Collection<? extends Entry<Data, Data>> entries = cursor.getBatch(); if (entries.isEmpty()) { break; } for (Entry<Data, Data> entry : entries) { QueryableEntry queryEntry = new LazyMapEntry(entry.getKey(), entry.getValue(), serializationService, extractors); if (predicate.apply(queryEntry)) { resultList.add(queryEntry); } } } return new QueryableEntriesSegment(resultList, lastIndex); }
[ "public", "QueryableEntriesSegment", "run", "(", "String", "mapName", ",", "Predicate", "predicate", ",", "int", "partitionId", ",", "int", "tableIndex", ",", "int", "fetchSize", ")", "{", "int", "lastIndex", "=", "tableIndex", ";", "final", "List", "<", "Quer...
Executes the predicate on a partition chunk. The offset in the partition is defined by the {@code tableIndex} and the soft limit is defined by the {@code fetchSize}. The method returns the matched entries and an index from which new entries can be fetched which allows for efficient iteration of query results. <p> <b>NOTE</b> Iterating the map should be done only when the {@link IMap} is not being mutated and the cluster is stable (there are no migrations or membership changes). In other cases, the iterator may not return some entries or may return an entry twice. @param mapName the map name @param predicate the predicate which the entries must match @param partitionId the partition which is queried @param tableIndex the index from which entries are queried @param fetchSize the soft limit for the number of entries to fetch @return entries matching the predicate and a table index from which new entries can be fetched
[ "Executes", "the", "predicate", "on", "a", "partition", "chunk", ".", "The", "offset", "in", "the", "partition", "is", "defined", "by", "the", "{", "@code", "tableIndex", "}", "and", "the", "soft", "limit", "is", "defined", "by", "the", "{", "@code", "fe...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/query/PartitionScanRunner.java#L135-L157
ozimov/cirneco
hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/base/IsBetweenLowerBoundInclusive.java
IsBetweenLowerBoundInclusive.betweenLowerBoundInclusive
public static <T extends Comparable<T>> Matcher<T> betweenLowerBoundInclusive(final T from, final T to) { return new IsBetweenLowerBoundInclusive(from, to); }
java
public static <T extends Comparable<T>> Matcher<T> betweenLowerBoundInclusive(final T from, final T to) { return new IsBetweenLowerBoundInclusive(from, to); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "T", ">", ">", "Matcher", "<", "T", ">", "betweenLowerBoundInclusive", "(", "final", "T", "from", ",", "final", "T", "to", ")", "{", "return", "new", "IsBetweenLowerBoundInclusive", "(", "from", "...
Creates a matcher for {@code T}s that matches when the <code>compareTo()</code> method returns a value between <code>from</code> and <code>to</code>, both included. <p> <p> <p> <p> <p>For example: <p> <p> <p> <p> <pre>assertThat(10, betweenLowerBoundInclusive(10, 11))</pre> will return true. while: <pre>assertThat(11, betweenLowerBoundInclusive(10, 11))</pre> will return false.
[ "Creates", "a", "matcher", "for", "{", "@code", "T", "}", "s", "that", "matches", "when", "the", "<code", ">", "compareTo", "()", "<", "/", "code", ">", "method", "returns", "a", "value", "between", "<code", ">", "from<", "/", "code", ">", "and", "<c...
train
https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/base/IsBetweenLowerBoundInclusive.java#L53-L55
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java
KunderaQuery.parseOrdering
private void parseOrdering(String ordering) { final String comma = ","; final String space = " "; StringTokenizer tokenizer = new StringTokenizer(ordering, comma); sortOrders = new ArrayList<KunderaQuery.SortOrdering>(); while (tokenizer.hasMoreTokens()) { String order = (String) tokenizer.nextElement(); StringTokenizer token = new StringTokenizer(order, space); SortOrder orderType = SortOrder.ASC; String colName = (String) token.nextElement(); while (token.hasMoreElements()) { String nextOrder = (String) token.nextElement(); // more spaces given. if (StringUtils.isNotBlank(nextOrder)) { try { orderType = SortOrder.valueOf(nextOrder.toUpperCase()); } catch (IllegalArgumentException e) { logger.error("Error while parsing order by clause:"); throw new JPQLParseException("Invalid sort order provided:" + nextOrder); } } } sortOrders.add(new SortOrdering(colName, orderType)); } }
java
private void parseOrdering(String ordering) { final String comma = ","; final String space = " "; StringTokenizer tokenizer = new StringTokenizer(ordering, comma); sortOrders = new ArrayList<KunderaQuery.SortOrdering>(); while (tokenizer.hasMoreTokens()) { String order = (String) tokenizer.nextElement(); StringTokenizer token = new StringTokenizer(order, space); SortOrder orderType = SortOrder.ASC; String colName = (String) token.nextElement(); while (token.hasMoreElements()) { String nextOrder = (String) token.nextElement(); // more spaces given. if (StringUtils.isNotBlank(nextOrder)) { try { orderType = SortOrder.valueOf(nextOrder.toUpperCase()); } catch (IllegalArgumentException e) { logger.error("Error while parsing order by clause:"); throw new JPQLParseException("Invalid sort order provided:" + nextOrder); } } } sortOrders.add(new SortOrdering(colName, orderType)); } }
[ "private", "void", "parseOrdering", "(", "String", "ordering", ")", "{", "final", "String", "comma", "=", "\",\"", ";", "final", "String", "space", "=", "\" \"", ";", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "ordering", ",", "comma",...
Parses the ordering @See Order By Clause. @param ordering the ordering
[ "Parses", "the", "ordering", "@See", "Order", "By", "Clause", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java#L1195-L1223
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java
SVGUtil.setAtt
public static void setAtt(Element el, String name, double d) { el.setAttribute(name, fmt(d)); }
java
public static void setAtt(Element el, String name, double d) { el.setAttribute(name, fmt(d)); }
[ "public", "static", "void", "setAtt", "(", "Element", "el", ",", "String", "name", ",", "double", "d", ")", "{", "el", ".", "setAttribute", "(", "name", ",", "fmt", "(", "d", ")", ")", ";", "}" ]
Set a SVG attribute @param el element @param name attribute name @param d double value
[ "Set", "a", "SVG", "attribute" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L294-L296
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsVfsSitemapService.java
CmsVfsSitemapService.createNewResourceInfo
private CmsNewResourceInfo createNewResourceInfo(CmsObject cms, CmsResource modelResource, Locale locale) throws CmsException { // if model page got overwritten by another resource, reread from site path if (!cms.existsResource(modelResource.getStructureId(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { modelResource = cms.readResource(cms.getSitePath(modelResource), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); } int typeId = modelResource.getTypeId(); String name = OpenCms.getResourceManager().getResourceType(typeId).getTypeName(); String title = cms.readPropertyObject( modelResource, CmsPropertyDefinition.PROPERTY_TITLE, false, locale).getValue(); String description = cms.readPropertyObject( modelResource, CmsPropertyDefinition.PROPERTY_DESCRIPTION, false, locale).getValue(); boolean editable = false; try { CmsResource freshModelResource = cms.readResource( modelResource.getStructureId(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); editable = cms.hasPermissions( freshModelResource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.DEFAULT); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } CmsNewResourceInfo info = new CmsNewResourceInfo( typeId, name, title, description, modelResource.getStructureId(), editable, description); info.setBigIconClasses(CmsIconUtil.getIconClasses(name, null, false)); Float navpos = null; try { CmsProperty navposProp = cms.readPropertyObject(modelResource, CmsPropertyDefinition.PROPERTY_NAVPOS, true); String navposStr = navposProp.getValue(); if (navposStr != null) { try { navpos = Float.valueOf(navposStr); } catch (NumberFormatException e) { // noop } } } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } info.setNavPos(navpos); info.setDate( CmsDateUtil.getDate(new Date(modelResource.getDateLastModified()), DateFormat.LONG, getWorkplaceLocale())); info.setVfsPath(modelResource.getRootPath()); return info; }
java
private CmsNewResourceInfo createNewResourceInfo(CmsObject cms, CmsResource modelResource, Locale locale) throws CmsException { // if model page got overwritten by another resource, reread from site path if (!cms.existsResource(modelResource.getStructureId(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { modelResource = cms.readResource(cms.getSitePath(modelResource), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); } int typeId = modelResource.getTypeId(); String name = OpenCms.getResourceManager().getResourceType(typeId).getTypeName(); String title = cms.readPropertyObject( modelResource, CmsPropertyDefinition.PROPERTY_TITLE, false, locale).getValue(); String description = cms.readPropertyObject( modelResource, CmsPropertyDefinition.PROPERTY_DESCRIPTION, false, locale).getValue(); boolean editable = false; try { CmsResource freshModelResource = cms.readResource( modelResource.getStructureId(), CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); editable = cms.hasPermissions( freshModelResource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.DEFAULT); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } CmsNewResourceInfo info = new CmsNewResourceInfo( typeId, name, title, description, modelResource.getStructureId(), editable, description); info.setBigIconClasses(CmsIconUtil.getIconClasses(name, null, false)); Float navpos = null; try { CmsProperty navposProp = cms.readPropertyObject(modelResource, CmsPropertyDefinition.PROPERTY_NAVPOS, true); String navposStr = navposProp.getValue(); if (navposStr != null) { try { navpos = Float.valueOf(navposStr); } catch (NumberFormatException e) { // noop } } } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); } info.setNavPos(navpos); info.setDate( CmsDateUtil.getDate(new Date(modelResource.getDateLastModified()), DateFormat.LONG, getWorkplaceLocale())); info.setVfsPath(modelResource.getRootPath()); return info; }
[ "private", "CmsNewResourceInfo", "createNewResourceInfo", "(", "CmsObject", "cms", ",", "CmsResource", "modelResource", ",", "Locale", "locale", ")", "throws", "CmsException", "{", "// if model page got overwritten by another resource, reread from site path", "if", "(", "!", ...
Creates a new resource info to a given model page resource.<p> @param cms the current CMS context @param modelResource the model page resource @param locale the locale used for retrieving descriptions/titles @return the new resource info @throws CmsException if something goes wrong
[ "Creates", "a", "new", "resource", "info", "to", "a", "given", "model", "page", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L1914-L1976
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java
SslContextBuilder.trustManager
public SslContextBuilder trustManager(InputStream trustCertCollectionInputStream) { try { return trustManager(SslContext.toX509Certificates(trustCertCollectionInputStream)); } catch (Exception e) { throw new IllegalArgumentException("Input stream does not contain valid certificates.", e); } }
java
public SslContextBuilder trustManager(InputStream trustCertCollectionInputStream) { try { return trustManager(SslContext.toX509Certificates(trustCertCollectionInputStream)); } catch (Exception e) { throw new IllegalArgumentException("Input stream does not contain valid certificates.", e); } }
[ "public", "SslContextBuilder", "trustManager", "(", "InputStream", "trustCertCollectionInputStream", ")", "{", "try", "{", "return", "trustManager", "(", "SslContext", ".", "toX509Certificates", "(", "trustCertCollectionInputStream", ")", ")", ";", "}", "catch", "(", ...
Trusted certificates for verifying the remote endpoint's certificate. The input stream should contain an X.509 certificate collection in PEM format. {@code null} uses the system default.
[ "Trusted", "certificates", "for", "verifying", "the", "remote", "endpoint", "s", "certificate", ".", "The", "input", "stream", "should", "contain", "an", "X", ".", "509", "certificate", "collection", "in", "PEM", "format", ".", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L191-L197
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/curves/PrecisionRecallCurve.java
PrecisionRecallCurve.getConfusionMatrixAtThreshold
public Confusion getConfusionMatrixAtThreshold(double threshold) { Point p = getPointAtThreshold(threshold); int idx = p.idx; int tn = totalCount - (tpCount[idx] + fpCount[idx] + fnCount[idx]); return new Confusion(p, tpCount[idx], fpCount[idx], fnCount[idx], tn); }
java
public Confusion getConfusionMatrixAtThreshold(double threshold) { Point p = getPointAtThreshold(threshold); int idx = p.idx; int tn = totalCount - (tpCount[idx] + fpCount[idx] + fnCount[idx]); return new Confusion(p, tpCount[idx], fpCount[idx], fnCount[idx], tn); }
[ "public", "Confusion", "getConfusionMatrixAtThreshold", "(", "double", "threshold", ")", "{", "Point", "p", "=", "getPointAtThreshold", "(", "threshold", ")", ";", "int", "idx", "=", "p", ".", "idx", ";", "int", "tn", "=", "totalCount", "-", "(", "tpCount", ...
Get the binary confusion matrix for the given threshold. As per {@link #getPointAtThreshold(double)}, if the threshold is not found exactly, the next highest threshold exceeding the requested threshold is returned @param threshold Threshold at which to get the confusion matrix @return Binary confusion matrix
[ "Get", "the", "binary", "confusion", "matrix", "for", "the", "given", "threshold", ".", "As", "per", "{", "@link", "#getPointAtThreshold", "(", "double", ")", "}", "if", "the", "threshold", "is", "not", "found", "exactly", "the", "next", "highest", "threshol...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/curves/PrecisionRecallCurve.java#L209-L214
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java
MavenModelScannerPlugin.addProfiles
private void addProfiles(MavenPomDescriptor pomDescriptor, Model model, ScannerContext scannerContext) { List<Profile> profiles = model.getProfiles(); Store store = scannerContext.getStore(); for (Profile profile : profiles) { MavenProfileDescriptor mavenProfileDescriptor = store.create(MavenProfileDescriptor.class); pomDescriptor.getProfiles().add(mavenProfileDescriptor); mavenProfileDescriptor.setId(profile.getId()); addProperties(mavenProfileDescriptor, profile.getProperties(), store); addModules(mavenProfileDescriptor, profile.getModules(), store); addPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addManagedPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addDependencies(mavenProfileDescriptor, ProfileDeclaresDependencyDescriptor.class, ProfileManagesDependencyDescriptor.class, profile, scannerContext); addActivation(mavenProfileDescriptor, profile.getActivation(), store); addRepository(of(mavenProfileDescriptor), profile.getRepositories(), store); } }
java
private void addProfiles(MavenPomDescriptor pomDescriptor, Model model, ScannerContext scannerContext) { List<Profile> profiles = model.getProfiles(); Store store = scannerContext.getStore(); for (Profile profile : profiles) { MavenProfileDescriptor mavenProfileDescriptor = store.create(MavenProfileDescriptor.class); pomDescriptor.getProfiles().add(mavenProfileDescriptor); mavenProfileDescriptor.setId(profile.getId()); addProperties(mavenProfileDescriptor, profile.getProperties(), store); addModules(mavenProfileDescriptor, profile.getModules(), store); addPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addManagedPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addDependencies(mavenProfileDescriptor, ProfileDeclaresDependencyDescriptor.class, ProfileManagesDependencyDescriptor.class, profile, scannerContext); addActivation(mavenProfileDescriptor, profile.getActivation(), store); addRepository(of(mavenProfileDescriptor), profile.getRepositories(), store); } }
[ "private", "void", "addProfiles", "(", "MavenPomDescriptor", "pomDescriptor", ",", "Model", "model", ",", "ScannerContext", "scannerContext", ")", "{", "List", "<", "Profile", ">", "profiles", "=", "model", ".", "getProfiles", "(", ")", ";", "Store", "store", ...
Adds information about defined profile. @param pomDescriptor The descriptor for the current POM. @param model The Maven Model. @param scannerContext The scanner context.
[ "Adds", "information", "about", "defined", "profile", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L564-L579
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/JavaWriterHelper.java
JavaWriterHelper.writeJava2File
public static void writeJava2File(Filer filer, String packageName, TypeSpec typeSpec) throws IOException { JavaFile target = JavaFile.builder(packageName, typeSpec).skipJavaLangImports(true).build(); target.writeTo(filer); }
java
public static void writeJava2File(Filer filer, String packageName, TypeSpec typeSpec) throws IOException { JavaFile target = JavaFile.builder(packageName, typeSpec).skipJavaLangImports(true).build(); target.writeTo(filer); }
[ "public", "static", "void", "writeJava2File", "(", "Filer", "filer", ",", "String", "packageName", ",", "TypeSpec", "typeSpec", ")", "throws", "IOException", "{", "JavaFile", "target", "=", "JavaFile", ".", "builder", "(", "packageName", ",", "typeSpec", ")", ...
Write java 2 file. @param filer the filer @param packageName the package name @param typeSpec the type spec @throws IOException Signals that an I/O exception has occurred.
[ "Write", "java", "2", "file", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/JavaWriterHelper.java#L28-L31
Ordinastie/MalisisCore
src/main/java/net/malisis/core/inventory/message/InventoryActionMessage.java
InventoryActionMessage.sendAction
@SideOnly(Side.CLIENT) public static void sendAction(ActionType action, int inventoryId, int slotNumber, int code) { int windowId = Utils.getClientPlayer().openContainer.windowId; Packet packet = new Packet(action, inventoryId, slotNumber, code, windowId); MalisisCore.network.sendToServer(packet); }
java
@SideOnly(Side.CLIENT) public static void sendAction(ActionType action, int inventoryId, int slotNumber, int code) { int windowId = Utils.getClientPlayer().openContainer.windowId; Packet packet = new Packet(action, inventoryId, slotNumber, code, windowId); MalisisCore.network.sendToServer(packet); }
[ "@", "SideOnly", "(", "Side", ".", "CLIENT", ")", "public", "static", "void", "sendAction", "(", "ActionType", "action", ",", "int", "inventoryId", ",", "int", "slotNumber", ",", "int", "code", ")", "{", "int", "windowId", "=", "Utils", ".", "getClientPlay...
Sends GUI action to the server {@link MalisisInventoryContainer}. @param action the action @param inventoryId the inventory id @param slotNumber the slot number @param code the code
[ "Sends", "GUI", "action", "to", "the", "server", "{", "@link", "MalisisInventoryContainer", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/message/InventoryActionMessage.java#L81-L87
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
ThreadLocalRandom.doubles
public DoubleStream doubles(long streamSize) { if (streamSize < 0L) throw new IllegalArgumentException(BAD_SIZE); return StreamSupport.doubleStream (new RandomDoublesSpliterator (0L, streamSize, Double.MAX_VALUE, 0.0), false); }
java
public DoubleStream doubles(long streamSize) { if (streamSize < 0L) throw new IllegalArgumentException(BAD_SIZE); return StreamSupport.doubleStream (new RandomDoublesSpliterator (0L, streamSize, Double.MAX_VALUE, 0.0), false); }
[ "public", "DoubleStream", "doubles", "(", "long", "streamSize", ")", "{", "if", "(", "streamSize", "<", "0L", ")", "throw", "new", "IllegalArgumentException", "(", "BAD_SIZE", ")", ";", "return", "StreamSupport", ".", "doubleStream", "(", "new", "RandomDoublesSp...
Returns a stream producing the given {@code streamSize} number of pseudorandom {@code double} values, each between zero (inclusive) and one (exclusive). @param streamSize the number of values to generate @return a stream of {@code double} values @throws IllegalArgumentException if {@code streamSize} is less than zero @since 1.8
[ "Returns", "a", "stream", "producing", "the", "given", "{", "@code", "streamSize", "}", "number", "of", "pseudorandom", "{", "@code", "double", "}", "values", "each", "between", "zero", "(", "inclusive", ")", "and", "one", "(", "exclusive", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L651-L658
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarOutputStream.java
JarOutputStream.get16
private static int get16(byte[] b, int off) { return Byte.toUnsignedInt(b[off]) | ( Byte.toUnsignedInt(b[off+1]) << 8); }
java
private static int get16(byte[] b, int off) { return Byte.toUnsignedInt(b[off]) | ( Byte.toUnsignedInt(b[off+1]) << 8); }
[ "private", "static", "int", "get16", "(", "byte", "[", "]", "b", ",", "int", "off", ")", "{", "return", "Byte", ".", "toUnsignedInt", "(", "b", "[", "off", "]", ")", "|", "(", "Byte", ".", "toUnsignedInt", "(", "b", "[", "off", "+", "1", "]", "...
/* Fetches unsigned 16-bit value from byte array at specified offset. The bytes are assumed to be in Intel (little-endian) byte order.
[ "/", "*", "Fetches", "unsigned", "16", "-", "bit", "value", "from", "byte", "array", "at", "specified", "offset", ".", "The", "bytes", "are", "assumed", "to", "be", "in", "Intel", "(", "little", "-", "endian", ")", "byte", "order", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarOutputStream.java#L137-L139
Sciss/abc4j
abc/src/main/java/abc/ui/swing/ScoreTemplate.java
ScoreTemplate.setPosition
public void setPosition(byte[] fields, byte vert, byte horiz) { for (byte field : fields) { setVisible(field, true); Position p = new Position(vert, horiz); byte[] p1f = getPosition(field); Position p1 = p1f == null ? null : new Position(p1f[0], p1f[1]); // fix HHR if (!p.equals(p1)) { Iterator it = m_fieldsPosition.values().iterator(); Byte B = field; while (it.hasNext()) { Vector v = (Vector) it.next(); if (v.contains(B)) v.remove(B); } //don't know why get(p) doesn't work, p.toString() is ok if (m_fieldsPosition.get(p) == null) m_fieldsPosition.put(p, new Vector()); Vector v = (Vector) m_fieldsPosition.get(p); v.add(B); } } notifyListeners(); }
java
public void setPosition(byte[] fields, byte vert, byte horiz) { for (byte field : fields) { setVisible(field, true); Position p = new Position(vert, horiz); byte[] p1f = getPosition(field); Position p1 = p1f == null ? null : new Position(p1f[0], p1f[1]); // fix HHR if (!p.equals(p1)) { Iterator it = m_fieldsPosition.values().iterator(); Byte B = field; while (it.hasNext()) { Vector v = (Vector) it.next(); if (v.contains(B)) v.remove(B); } //don't know why get(p) doesn't work, p.toString() is ok if (m_fieldsPosition.get(p) == null) m_fieldsPosition.put(p, new Vector()); Vector v = (Vector) m_fieldsPosition.get(p); v.add(B); } } notifyListeners(); }
[ "public", "void", "setPosition", "(", "byte", "[", "]", "fields", ",", "byte", "vert", ",", "byte", "horiz", ")", "{", "for", "(", "byte", "field", ":", "fields", ")", "{", "setVisible", "(", "field", ",", "true", ")", ";", "Position", "p", "=", "n...
Sets the position of several fields @param fields array of {@link ScoreElements} constants @param vert one of {@link VerticalPosition} constants @param horiz one of {@link HorizontalPosition} constants
[ "Sets", "the", "position", "of", "several", "fields" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreTemplate.java#L834-L856
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/translation/CdsTranslator.java
CdsTranslator.checkLocations
private boolean checkLocations(long length, CompoundLocation<Location> locations) { for(Location location : locations.getLocations()){ if(location instanceof RemoteLocation) continue; if(location.getIntBeginPosition() == null || location.getIntBeginPosition() < 0){ return false; } if(location.getIntEndPosition() == null || location.getIntEndPosition() > length){ return false; } } return true; }
java
private boolean checkLocations(long length, CompoundLocation<Location> locations) { for(Location location : locations.getLocations()){ if(location instanceof RemoteLocation) continue; if(location.getIntBeginPosition() == null || location.getIntBeginPosition() < 0){ return false; } if(location.getIntEndPosition() == null || location.getIntEndPosition() > length){ return false; } } return true; }
[ "private", "boolean", "checkLocations", "(", "long", "length", ",", "CompoundLocation", "<", "Location", ">", "locations", ")", "{", "for", "(", "Location", "location", ":", "locations", ".", "getLocations", "(", ")", ")", "{", "if", "(", "location", "instan...
Checks that the locations are within the sequence length @param length @param locations @return
[ "Checks", "that", "the", "locations", "are", "within", "the", "sequence", "length" ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/translation/CdsTranslator.java#L248-L262
alkacon/opencms-core
src/org/opencms/db/generic/CmsSqlManager.java
CmsSqlManager.getPreparedStatementForSql
public PreparedStatement getPreparedStatementForSql(Connection con, String query) throws SQLException { // unfortunately, this wrapper is essential, because some JDBC driver // implementations don't accept the delegated objects of DBCP's connection pool. return con.prepareStatement(query); }
java
public PreparedStatement getPreparedStatementForSql(Connection con, String query) throws SQLException { // unfortunately, this wrapper is essential, because some JDBC driver // implementations don't accept the delegated objects of DBCP's connection pool. return con.prepareStatement(query); }
[ "public", "PreparedStatement", "getPreparedStatementForSql", "(", "Connection", "con", ",", "String", "query", ")", "throws", "SQLException", "{", "// unfortunately, this wrapper is essential, because some JDBC driver", "// implementations don't accept the delegated objects of DBCP's con...
Returns a PreparedStatement for a JDBC connection specified by the SQL query.<p> @param con the JDBC connection @param query the SQL query @return PreparedStatement a new PreparedStatement containing the pre-compiled SQL statement @throws SQLException if a database access error occurs
[ "Returns", "a", "PreparedStatement", "for", "a", "JDBC", "connection", "specified", "by", "the", "SQL", "query", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsSqlManager.java#L286-L291
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/servlet/AbstractObjectDeliveryHttpHandler.java
AbstractObjectDeliveryHttpHandler._initialFillSet
private static void _initialFillSet (@Nonnull final ICommonsOrderedSet <String> aSet, @Nullable final String sItemList, final boolean bUnify) { ValueEnforcer.notNull (aSet, "Set"); if (!aSet.isEmpty ()) throw new IllegalArgumentException ("The provided set must be empty, but it is not: " + aSet); if (StringHelper.hasText (sItemList)) { // Perform some default replacements to avoid updating all references at // once before splitting final String sRealItemList = StringHelper.replaceAll (sItemList, EXTENSION_MACRO_WEB_DEFAULT, "js,css,png,jpg,jpeg,gif,eot,svg,ttf,woff,woff2,map"); for (final String sItem : StringHelper.getExploded (',', sRealItemList)) { String sRealItem = sItem.trim (); if (bUnify) sRealItem = getUnifiedItem (sRealItem); // Add only non-empty items if (StringHelper.hasText (sRealItem)) aSet.add (sRealItem); } } }
java
private static void _initialFillSet (@Nonnull final ICommonsOrderedSet <String> aSet, @Nullable final String sItemList, final boolean bUnify) { ValueEnforcer.notNull (aSet, "Set"); if (!aSet.isEmpty ()) throw new IllegalArgumentException ("The provided set must be empty, but it is not: " + aSet); if (StringHelper.hasText (sItemList)) { // Perform some default replacements to avoid updating all references at // once before splitting final String sRealItemList = StringHelper.replaceAll (sItemList, EXTENSION_MACRO_WEB_DEFAULT, "js,css,png,jpg,jpeg,gif,eot,svg,ttf,woff,woff2,map"); for (final String sItem : StringHelper.getExploded (',', sRealItemList)) { String sRealItem = sItem.trim (); if (bUnify) sRealItem = getUnifiedItem (sRealItem); // Add only non-empty items if (StringHelper.hasText (sRealItem)) aSet.add (sRealItem); } } }
[ "private", "static", "void", "_initialFillSet", "(", "@", "Nonnull", "final", "ICommonsOrderedSet", "<", "String", ">", "aSet", ",", "@", "Nullable", "final", "String", "sItemList", ",", "final", "boolean", "bUnify", ")", "{", "ValueEnforcer", ".", "notNull", ...
Helper function to convert the configuration string to a collection. @param aSet The set to be filled. May not be <code>null</code>. @param sItemList The string to be separated to a list. Each item is separated by a ",". @param bUnify To unify the found item by converting them all to lowercase. This makes only sense for file extensions but not for file names. This unification is only relevant because of the case insensitive file system on Windows machines.
[ "Helper", "function", "to", "convert", "the", "configuration", "string", "to", "a", "collection", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/servlet/AbstractObjectDeliveryHttpHandler.java#L122-L149
loldevs/riotapi
spectator/src/main/java/net/boreeas/riotapi/spectator/GameEncryptionData.java
GameEncryptionData.getCipher
public Cipher getCipher() throws GeneralSecurityException { Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "Blowfish")); return cipher; }
java
public Cipher getCipher() throws GeneralSecurityException { Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "Blowfish")); return cipher; }
[ "public", "Cipher", "getCipher", "(", ")", "throws", "GeneralSecurityException", "{", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "\"Blowfish/ECB/PKCS5Padding\"", ")", ";", "cipher", ".", "init", "(", "Cipher", ".", "DECRYPT_MODE", ",", "new", "S...
Creates a cipher for decrypting data with the specified key. @return A Blowfish/ECB/PKCS5Padding cipher in decryption mode. @throws GeneralSecurityException
[ "Creates", "a", "cipher", "for", "decrypting", "data", "with", "the", "specified", "key", "." ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/spectator/src/main/java/net/boreeas/riotapi/spectator/GameEncryptionData.java#L41-L46
overview/mime-types
src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java
MimeTypeDetector.detectMimeTypeAsync
public CompletionStage<String> detectMimeTypeAsync(final Path path) { String filename = path.getFileName().toString(); Supplier<CompletionStage<byte[]>> supplier = () -> { final CompletableFuture<byte[]> futureBytes = new CompletableFuture<byte[]>(); AsynchronousFileChannel channel; try { channel = AsynchronousFileChannel.open(path, StandardOpenOption.READ); } catch (IOException e) { futureBytes.completeExceptionally(new GetBytesException(e)); return futureBytes; } final ByteBuffer buf = ByteBuffer.allocate(getMaxGetBytesLength()); channel.read(buf, 0, futureBytes, new CompletionHandler<Integer, CompletableFuture<byte[]>>() { @Override public void completed(Integer nBytes, CompletableFuture<byte[]> f) { if (nBytes == -1) nBytes = 0; // handle empty file byte[] bytes = new byte[nBytes]; buf.rewind(); buf.get(bytes, 0, nBytes); f.complete(bytes); } @Override public void failed(Throwable exc, CompletableFuture<byte[]> f) { f.completeExceptionally(new GetBytesException(exc)); } }); return futureBytes; }; return detectMimeTypeAsync(filename, supplier); }
java
public CompletionStage<String> detectMimeTypeAsync(final Path path) { String filename = path.getFileName().toString(); Supplier<CompletionStage<byte[]>> supplier = () -> { final CompletableFuture<byte[]> futureBytes = new CompletableFuture<byte[]>(); AsynchronousFileChannel channel; try { channel = AsynchronousFileChannel.open(path, StandardOpenOption.READ); } catch (IOException e) { futureBytes.completeExceptionally(new GetBytesException(e)); return futureBytes; } final ByteBuffer buf = ByteBuffer.allocate(getMaxGetBytesLength()); channel.read(buf, 0, futureBytes, new CompletionHandler<Integer, CompletableFuture<byte[]>>() { @Override public void completed(Integer nBytes, CompletableFuture<byte[]> f) { if (nBytes == -1) nBytes = 0; // handle empty file byte[] bytes = new byte[nBytes]; buf.rewind(); buf.get(bytes, 0, nBytes); f.complete(bytes); } @Override public void failed(Throwable exc, CompletableFuture<byte[]> f) { f.completeExceptionally(new GetBytesException(exc)); } }); return futureBytes; }; return detectMimeTypeAsync(filename, supplier); }
[ "public", "CompletionStage", "<", "String", ">", "detectMimeTypeAsync", "(", "final", "Path", "path", ")", "{", "String", "filename", "=", "path", ".", "getFileName", "(", ")", ".", "toString", "(", ")", ";", "Supplier", "<", "CompletionStage", "<", "byte", ...
Determines the MIME type of a file. <p> The file must exist and be readable. </p> <p> The CompletionStage may return a {@link ExecutionException} which is caused by a {@link GetBytesException}. (That, in turn, will wrap a {@link IOException} or other exception that prevented getBytesAsync() from working. </p> @param path A file that exists and is readable @return a MIME type such as {@literal "text/plain"} @see #detectMimeType(String, Callable)
[ "Determines", "the", "MIME", "type", "of", "a", "file", "." ]
train
https://github.com/overview/mime-types/blob/d5c45302049c0cd5e634a50954304d8ddeb9abb4/src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java#L279-L312
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemset2D
public static int cudaMemset2D(Pointer mem, long pitch, int c, long width, long height) { return checkResult(cudaMemset2DNative(mem, pitch, c, width, height)); }
java
public static int cudaMemset2D(Pointer mem, long pitch, int c, long width, long height) { return checkResult(cudaMemset2DNative(mem, pitch, c, width, height)); }
[ "public", "static", "int", "cudaMemset2D", "(", "Pointer", "mem", ",", "long", "pitch", ",", "int", "c", ",", "long", "width", ",", "long", "height", ")", "{", "return", "checkResult", "(", "cudaMemset2DNative", "(", "mem", ",", "pitch", ",", "c", ",", ...
Initializes or sets device memory to a value. <pre> cudaError_t cudaMemset2D ( void* devPtr, size_t pitch, int value, size_t width, size_t height ) </pre> <div> <p>Initializes or sets device memory to a value. Sets to the specified value <tt>value</tt> a matrix (<tt>height</tt> rows of <tt>width</tt> bytes each) pointed to by <tt>dstPtr</tt>. <tt>pitch</tt> is the width in bytes of the 2D array pointed to by <tt>dstPtr</tt>, including any padding added to the end of each row. This function performs fastest when the pitch is one that has been passed back by cudaMallocPitch(). </p> <p>Note that this function is asynchronous with respect to the host unless <tt>devPtr</tt> refers to pinned host memory. </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 2D device memory @param pitch Pitch in bytes of 2D device memory @param value Value to set for each byte of specified memory @param width Width of matrix set (columns in bytes) @param height Height of matrix set (rows) @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer @see JCuda#cudaMemset @see JCuda#cudaMemset3D @see JCuda#cudaMemsetAsync @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#L6264-L6267
blackducksoftware/blackduck-common
src/main/java/com/synopsys/integration/blackduck/codelocation/signaturescanner/command/ScannerZipInstaller.java
ScannerZipInstaller.installOrUpdateScanner
public void installOrUpdateScanner(File installDirectory) throws BlackDuckIntegrationException { File scannerExpansionDirectory = new File(installDirectory, ScannerZipInstaller.BLACK_DUCK_SIGNATURE_SCANNER_INSTALL_DIRECTORY); scannerExpansionDirectory.mkdirs(); File versionFile = null; try { versionFile = retrieveVersionFile(scannerExpansionDirectory); } catch (IOException e) { throw new BlackDuckIntegrationException("Trying to install the scanner but could not create the version file: " + e.getMessage()); } String downloadUrl = getDownloadUrl(); try { downloadIfModified(scannerExpansionDirectory, versionFile, downloadUrl); } catch (Exception e) { throw new BlackDuckIntegrationException("The Black Duck Signature Scanner could not be downloaded successfully: " + e.getMessage()); } logger.info("The Black Duck Signature Scanner downloaded/found successfully: " + installDirectory.getAbsolutePath()); }
java
public void installOrUpdateScanner(File installDirectory) throws BlackDuckIntegrationException { File scannerExpansionDirectory = new File(installDirectory, ScannerZipInstaller.BLACK_DUCK_SIGNATURE_SCANNER_INSTALL_DIRECTORY); scannerExpansionDirectory.mkdirs(); File versionFile = null; try { versionFile = retrieveVersionFile(scannerExpansionDirectory); } catch (IOException e) { throw new BlackDuckIntegrationException("Trying to install the scanner but could not create the version file: " + e.getMessage()); } String downloadUrl = getDownloadUrl(); try { downloadIfModified(scannerExpansionDirectory, versionFile, downloadUrl); } catch (Exception e) { throw new BlackDuckIntegrationException("The Black Duck Signature Scanner could not be downloaded successfully: " + e.getMessage()); } logger.info("The Black Duck Signature Scanner downloaded/found successfully: " + installDirectory.getAbsolutePath()); }
[ "public", "void", "installOrUpdateScanner", "(", "File", "installDirectory", ")", "throws", "BlackDuckIntegrationException", "{", "File", "scannerExpansionDirectory", "=", "new", "File", "(", "installDirectory", ",", "ScannerZipInstaller", ".", "BLACK_DUCK_SIGNATURE_SCANNER_I...
The Black Duck Signature Scanner will be download if it has not previously been downloaded or if it has been updated on the server. The absolute path to the install location will be returned if it was downloaded or found successfully, otherwise an Optional.empty will be returned and the log will contain details concerning the failure.
[ "The", "Black", "Duck", "Signature", "Scanner", "will", "be", "download", "if", "it", "has", "not", "previously", "been", "downloaded", "or", "if", "it", "has", "been", "updated", "on", "the", "server", ".", "The", "absolute", "path", "to", "the", "install...
train
https://github.com/blackducksoftware/blackduck-common/blob/4ea4e90b52b75470b71c597b65cf4e2d73887bcc/src/main/java/com/synopsys/integration/blackduck/codelocation/signaturescanner/command/ScannerZipInstaller.java#L100-L119
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/visitor/generator/GeneratorUtils.java
GeneratorUtils.generateLocalVariables
public static void generateLocalVariables(JavaCodeWriter out, Element jspElement, String pageContextVar) throws JspCoreException { if (hasUseBean(jspElement)) { out.println("HttpSession session = "+pageContextVar+".getSession();"); out.println("ServletContext application = "+pageContextVar+".getServletContext();"); } if (hasUseBean(jspElement) || hasIncludeAction(jspElement) || hasSetProperty(jspElement) || hasForwardAction(jspElement)) { out.println("HttpServletRequest request = (HttpServletRequest)"+pageContextVar+".getRequest();"); } if (hasIncludeAction(jspElement)) { out.println("HttpServletResponse response = (HttpServletResponse)"+pageContextVar+".getResponse();"); } }
java
public static void generateLocalVariables(JavaCodeWriter out, Element jspElement, String pageContextVar) throws JspCoreException { if (hasUseBean(jspElement)) { out.println("HttpSession session = "+pageContextVar+".getSession();"); out.println("ServletContext application = "+pageContextVar+".getServletContext();"); } if (hasUseBean(jspElement) || hasIncludeAction(jspElement) || hasSetProperty(jspElement) || hasForwardAction(jspElement)) { out.println("HttpServletRequest request = (HttpServletRequest)"+pageContextVar+".getRequest();"); } if (hasIncludeAction(jspElement)) { out.println("HttpServletResponse response = (HttpServletResponse)"+pageContextVar+".getResponse();"); } }
[ "public", "static", "void", "generateLocalVariables", "(", "JavaCodeWriter", "out", ",", "Element", "jspElement", ",", "String", "pageContextVar", ")", "throws", "JspCoreException", "{", "if", "(", "hasUseBean", "(", "jspElement", ")", ")", "{", "out", ".", "pri...
PK65013 - already know if this isTagFile or not and pageContextVar is set accordingly
[ "PK65013", "-", "already", "know", "if", "this", "isTagFile", "or", "not", "and", "pageContextVar", "is", "set", "accordingly" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/visitor/generator/GeneratorUtils.java#L161-L172
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java
AmqpChannel.bindQueue
public AmqpChannel bindQueue(String queue, String exchange, String routingKey, boolean noWait, AmqpArguments arguments) { Object[] args = {0, queue, exchange, routingKey, noWait, arguments}; WrappedByteBuffer bodyArg = null; HashMap<String, Object> headersArg = null; String methodName = "bindQueue"; String methodId = "50" + "20"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] methodArguments = {this, amqpMethod, this.id, args, bodyArg, headersArg}; boolean hasnowait = false; for (int i = 0; i < amqpMethod.allParameters.size(); i++) { String argname = amqpMethod.allParameters.get(i).name; if (argname == "noWait") { hasnowait = true; break; } } if (client.getReadyState() == ReadyState.OPEN) { asyncClient.enqueueAction(methodName, "channelWrite", methodArguments, null, null); } if (hasnowait && noWait) { asyncClient.enqueueAction("nowait", null, null, null, null); } return this; }
java
public AmqpChannel bindQueue(String queue, String exchange, String routingKey, boolean noWait, AmqpArguments arguments) { Object[] args = {0, queue, exchange, routingKey, noWait, arguments}; WrappedByteBuffer bodyArg = null; HashMap<String, Object> headersArg = null; String methodName = "bindQueue"; String methodId = "50" + "20"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] methodArguments = {this, amqpMethod, this.id, args, bodyArg, headersArg}; boolean hasnowait = false; for (int i = 0; i < amqpMethod.allParameters.size(); i++) { String argname = amqpMethod.allParameters.get(i).name; if (argname == "noWait") { hasnowait = true; break; } } if (client.getReadyState() == ReadyState.OPEN) { asyncClient.enqueueAction(methodName, "channelWrite", methodArguments, null, null); } if (hasnowait && noWait) { asyncClient.enqueueAction("nowait", null, null, null, null); } return this; }
[ "public", "AmqpChannel", "bindQueue", "(", "String", "queue", ",", "String", "exchange", ",", "String", "routingKey", ",", "boolean", "noWait", ",", "AmqpArguments", "arguments", ")", "{", "Object", "[", "]", "args", "=", "{", "0", ",", "queue", ",", "exch...
* This method binds a queue to an exchange. Until a queue is bound it will not receive any messages. In a classic messaging model, store-and-forward queues are bound to a direct exchange and subscription queues are bound to a topic exchange.
[ "*", "This", "method", "binds", "a", "queue", "to", "an", "exchange", ".", "Until", "a", "queue", "is", "bound", "it", "will", "not", "receive", "any", "messages", ".", "In", "a", "classic", "messaging", "model", "store", "-", "and", "-", "forward", "q...
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L600-L627
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/PropertiesField.java
PropertiesField.addPropertiesFieldBehavior
public void addPropertiesFieldBehavior(BaseField fldDisplay, String strProperty) { FieldListener listener = new CopyConvertersHandler(new PropertiesConverter(this, strProperty)); listener.setRespondsToMode(DBConstants.INIT_MOVE, false); listener.setRespondsToMode(DBConstants.READ_MOVE, false); fldDisplay.addListener(listener); listener = new CopyConvertersHandler(fldDisplay, new PropertiesConverter(this, strProperty)); this.addListener(listener); }
java
public void addPropertiesFieldBehavior(BaseField fldDisplay, String strProperty) { FieldListener listener = new CopyConvertersHandler(new PropertiesConverter(this, strProperty)); listener.setRespondsToMode(DBConstants.INIT_MOVE, false); listener.setRespondsToMode(DBConstants.READ_MOVE, false); fldDisplay.addListener(listener); listener = new CopyConvertersHandler(fldDisplay, new PropertiesConverter(this, strProperty)); this.addListener(listener); }
[ "public", "void", "addPropertiesFieldBehavior", "(", "BaseField", "fldDisplay", ",", "String", "strProperty", ")", "{", "FieldListener", "listener", "=", "new", "CopyConvertersHandler", "(", "new", "PropertiesConverter", "(", "this", ",", "strProperty", ")", ")", ";...
Add the behaviors to sync this property to this virtual field.
[ "Add", "the", "behaviors", "to", "sync", "this", "property", "to", "this", "virtual", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L616-L624
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
InternalUtils.lookupField
public static Field lookupField( Class parentClass, String fieldName ) { try { return parentClass.getDeclaredField( fieldName ); } catch ( NoSuchFieldException e ) { Class superClass = parentClass.getSuperclass(); return superClass != null ? lookupField( superClass, fieldName ) : null; } }
java
public static Field lookupField( Class parentClass, String fieldName ) { try { return parentClass.getDeclaredField( fieldName ); } catch ( NoSuchFieldException e ) { Class superClass = parentClass.getSuperclass(); return superClass != null ? lookupField( superClass, fieldName ) : null; } }
[ "public", "static", "Field", "lookupField", "(", "Class", "parentClass", ",", "String", "fieldName", ")", "{", "try", "{", "return", "parentClass", ".", "getDeclaredField", "(", "fieldName", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", ...
Get a Field in a Class. @param parentClass the Class in which to find the Field. @param fieldName the name of the Field. @return the Field with the given name, or <code>null</code> if the field does not exist.
[ "Get", "a", "Field", "in", "a", "Class", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L285-L294
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.oneToManyWithoutControl
public <D> D oneToManyWithoutControl(Class<D> destinationClass, final T source) { try{ return this.<D,T>getJMapper(relationalOneToManyMapper,destinationClass).getDestinationWithoutControl(source); } catch (Exception e) { return (D) this.destinationClassControl(e,destinationClass); } }
java
public <D> D oneToManyWithoutControl(Class<D> destinationClass, final T source) { try{ return this.<D,T>getJMapper(relationalOneToManyMapper,destinationClass).getDestinationWithoutControl(source); } catch (Exception e) { return (D) this.destinationClassControl(e,destinationClass); } }
[ "public", "<", "D", ">", "D", "oneToManyWithoutControl", "(", "Class", "<", "D", ">", "destinationClass", ",", "final", "T", "source", ")", "{", "try", "{", "return", "this", ".", "<", "D", ",", "T", ">", "getJMapper", "(", "relationalOneToManyMapper", "...
This method returns a new instance of Target Class with this setting: <table summary =""> <tr> <td><code>NullPointerControl</code></td><td><code>NOT_ANY</code></td> </tr><tr> <td><code>MappingType</code> of Destination</td><td><code>ALL_FIELDS</code></td> </tr><tr> <td><code>MappingType</code> of Source</td><td><code>ALL_FIELDS</code></td> </tr> </table> @param source instance of Configured Class that contains the data @return new instance of Target Class @see NullPointerControl @see MappingType
[ "This", "method", "returns", "a", "new", "instance", "of", "Target", "Class", "with", "this", "setting", ":", "<table", "summary", "=", ">", "<tr", ">", "<td", ">", "<code", ">", "NullPointerControl<", "/", "code", ">", "<", "/", "td", ">", "<td", ">",...
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L557-L560
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/restart/FixedDelayRestartStrategy.java
FixedDelayRestartStrategy.createFactory
public static FixedDelayRestartStrategyFactory createFactory(Configuration configuration) throws Exception { int maxAttempts = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 1); String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY); long delay; try { delay = Duration.apply(delayString).toMillis(); } catch (NumberFormatException nfe) { throw new Exception("Invalid config value for " + ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString + ". Value must be a valid duration (such as '100 milli' or '10 s')"); } return new FixedDelayRestartStrategyFactory(maxAttempts, delay); }
java
public static FixedDelayRestartStrategyFactory createFactory(Configuration configuration) throws Exception { int maxAttempts = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, 1); String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY); long delay; try { delay = Duration.apply(delayString).toMillis(); } catch (NumberFormatException nfe) { throw new Exception("Invalid config value for " + ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString + ". Value must be a valid duration (such as '100 milli' or '10 s')"); } return new FixedDelayRestartStrategyFactory(maxAttempts, delay); }
[ "public", "static", "FixedDelayRestartStrategyFactory", "createFactory", "(", "Configuration", "configuration", ")", "throws", "Exception", "{", "int", "maxAttempts", "=", "configuration", ".", "getInteger", "(", "ConfigConstants", ".", "RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS"...
Creates a FixedDelayRestartStrategy from the given Configuration. @param configuration Configuration containing the parameter values for the restart strategy @return Initialized instance of FixedDelayRestartStrategy @throws Exception
[ "Creates", "a", "FixedDelayRestartStrategy", "from", "the", "given", "Configuration", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/restart/FixedDelayRestartStrategy.java#L75-L91
UrielCh/ovh-java-sdk
ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java
ApiOvhPrice.dedicatedCloud_2018v2_rbx2a_infrastructure_filer_hourly_filerProfile_GET
public OvhPrice dedicatedCloud_2018v2_rbx2a_infrastructure_filer_hourly_filerProfile_GET(net.minidev.ovh.api.price.dedicatedcloud._2018v2.rbx2a.infrastructure.filer.OvhHourlyEnum filerProfile) throws IOException { String qPath = "/price/dedicatedCloud/2018v2/rbx2a/infrastructure/filer/hourly/{filerProfile}"; StringBuilder sb = path(qPath, filerProfile); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
java
public OvhPrice dedicatedCloud_2018v2_rbx2a_infrastructure_filer_hourly_filerProfile_GET(net.minidev.ovh.api.price.dedicatedcloud._2018v2.rbx2a.infrastructure.filer.OvhHourlyEnum filerProfile) throws IOException { String qPath = "/price/dedicatedCloud/2018v2/rbx2a/infrastructure/filer/hourly/{filerProfile}"; StringBuilder sb = path(qPath, filerProfile); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
[ "public", "OvhPrice", "dedicatedCloud_2018v2_rbx2a_infrastructure_filer_hourly_filerProfile_GET", "(", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "price", ".", "dedicatedcloud", ".", "_2018v2", ".", "rbx2a", ".", "infrastructure", ".", "filer", ".", "OvhHourl...
Get price of dedicated Cloud hourly filer ressources REST: GET /price/dedicatedCloud/2018v2/rbx2a/infrastructure/filer/hourly/{filerProfile} @param filerProfile [required] type of the hourly ressources you want to order
[ "Get", "price", "of", "dedicated", "Cloud", "hourly", "filer", "ressources" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L4327-L4332
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/EncodingInfo.java
EncodingInfo.isInEncoding
public boolean isInEncoding(char high, char low) { if (m_encoding == null) { m_encoding = new EncodingImpl(); // One could put alternate logic in here to // instantiate another object that implements the // InEncoding interface. For example if the JRE is 1.4 or up // we could have an object that uses JRE 1.4 methods } return m_encoding.isInEncoding(high, low); }
java
public boolean isInEncoding(char high, char low) { if (m_encoding == null) { m_encoding = new EncodingImpl(); // One could put alternate logic in here to // instantiate another object that implements the // InEncoding interface. For example if the JRE is 1.4 or up // we could have an object that uses JRE 1.4 methods } return m_encoding.isInEncoding(high, low); }
[ "public", "boolean", "isInEncoding", "(", "char", "high", ",", "char", "low", ")", "{", "if", "(", "m_encoding", "==", "null", ")", "{", "m_encoding", "=", "new", "EncodingImpl", "(", ")", ";", "// One could put alternate logic in here to", "// instantiate another...
This is not a public API. It returns true if the character formed by the high/low pair is in the encoding. @param high a char that the a high char of a high/low surrogate pair. @param low a char that is the low char of a high/low surrogate pair. <p> This method is not a public API. @xsl.usage internal
[ "This", "is", "not", "a", "public", "API", ".", "It", "returns", "true", "if", "the", "character", "formed", "by", "the", "high", "/", "low", "pair", "is", "in", "the", "encoding", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/EncodingInfo.java#L125-L135
Netflix/spectator
spectator-ext-ipc/src/jmh/java/com/netflix/spectator/ipc/SeqServerGroup.java
SeqServerGroup.parse
public static SeqServerGroup parse(String asg) { int d1 = asg.indexOf('-'); int d2 = asg.indexOf('-', d1 + 1); int dN = asg.lastIndexOf('-'); if (dN < 0 || !isSequence(asg, dN)) { dN = asg.length(); } return new SeqServerGroup(asg, d1, d2, dN); }
java
public static SeqServerGroup parse(String asg) { int d1 = asg.indexOf('-'); int d2 = asg.indexOf('-', d1 + 1); int dN = asg.lastIndexOf('-'); if (dN < 0 || !isSequence(asg, dN)) { dN = asg.length(); } return new SeqServerGroup(asg, d1, d2, dN); }
[ "public", "static", "SeqServerGroup", "parse", "(", "String", "asg", ")", "{", "int", "d1", "=", "asg", ".", "indexOf", "(", "'", "'", ")", ";", "int", "d2", "=", "asg", ".", "indexOf", "(", "'", "'", ",", "d1", "+", "1", ")", ";", "int", "dN",...
Create a new instance of a server group object by parsing the group name.
[ "Create", "a", "new", "instance", "of", "a", "server", "group", "object", "by", "parsing", "the", "group", "name", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/jmh/java/com/netflix/spectator/ipc/SeqServerGroup.java#L34-L42
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/Window.java
Window.writeDefaultWindowToLocation
public static void writeDefaultWindowToLocation( String locationPath, Window window ) throws IOException { writeWindowFile(locationPath + File.separator + GrassLegacyConstans.PERMANENT_MAPSET + File.separator + GrassLegacyConstans.DEFAULT_WIND, window); }
java
public static void writeDefaultWindowToLocation( String locationPath, Window window ) throws IOException { writeWindowFile(locationPath + File.separator + GrassLegacyConstans.PERMANENT_MAPSET + File.separator + GrassLegacyConstans.DEFAULT_WIND, window); }
[ "public", "static", "void", "writeDefaultWindowToLocation", "(", "String", "locationPath", ",", "Window", "window", ")", "throws", "IOException", "{", "writeWindowFile", "(", "locationPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "PERMANENT_MA...
Write default region window to the PERMANENT mapset @param locationPath the path to the location folder @param the active Window object @throws IOException
[ "Write", "default", "region", "window", "to", "the", "PERMANENT", "mapset" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/Window.java#L491-L494
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.removeByLtD_S
@Override public void removeByLtD_S(Date displayDate, int status) { for (CPInstance cpInstance : findByLtD_S(displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpInstance); } }
java
@Override public void removeByLtD_S(Date displayDate, int status) { for (CPInstance cpInstance : findByLtD_S(displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpInstance); } }
[ "@", "Override", "public", "void", "removeByLtD_S", "(", "Date", "displayDate", ",", "int", "status", ")", "{", "for", "(", "CPInstance", "cpInstance", ":", "findByLtD_S", "(", "displayDate", ",", "status", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ...
Removes all the cp instances where displayDate &lt; &#63; and status = &#63; from the database. @param displayDate the display date @param status the status
[ "Removes", "all", "the", "cp", "instances", "where", "displayDate", "&lt", ";", "&#63", ";", "and", "status", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L6119-L6125
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java
ExecuteSQLQueryBuilder.validateScript
public ExecuteSQLQueryBuilder validateScript(Resource scriptResource, String type) { return validateScript(scriptResource, type, FileUtils.getDefaultCharset()); }
java
public ExecuteSQLQueryBuilder validateScript(Resource scriptResource, String type) { return validateScript(scriptResource, type, FileUtils.getDefaultCharset()); }
[ "public", "ExecuteSQLQueryBuilder", "validateScript", "(", "Resource", "scriptResource", ",", "String", "type", ")", "{", "return", "validateScript", "(", "scriptResource", ",", "type", ",", "FileUtils", ".", "getDefaultCharset", "(", ")", ")", ";", "}" ]
Validate SQL result set via validation script, for instance Groovy. @param scriptResource @param type
[ "Validate", "SQL", "result", "set", "via", "validation", "script", "for", "instance", "Groovy", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java#L187-L189
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/NameUtil.java
NameUtil.getHomeRemoteImplClassName
public static String getHomeRemoteImplClassName(EnterpriseBean enterpriseBean, boolean isPost11DD) // d114199 { String homeInterfaceName = getHomeInterfaceName(enterpriseBean); if (homeInterfaceName == null) { return null; } String remoteInterfaceName = getRemoteInterfaceName(enterpriseBean); // d147362 String packageName = packageName(remoteInterfaceName); // d147362 String homeName = encodeBeanInterfacesName(enterpriseBean, isPost11DD, false, true, false); //d114199 d147734 StringBuffer result = new StringBuffer(); if (packageName != null) { result.append(packageName); result.append('.'); } result.append(homeRemotePrefix); result.append(getUniquePrefix(enterpriseBean)); result.append(homeName); return result.toString(); }
java
public static String getHomeRemoteImplClassName(EnterpriseBean enterpriseBean, boolean isPost11DD) // d114199 { String homeInterfaceName = getHomeInterfaceName(enterpriseBean); if (homeInterfaceName == null) { return null; } String remoteInterfaceName = getRemoteInterfaceName(enterpriseBean); // d147362 String packageName = packageName(remoteInterfaceName); // d147362 String homeName = encodeBeanInterfacesName(enterpriseBean, isPost11DD, false, true, false); //d114199 d147734 StringBuffer result = new StringBuffer(); if (packageName != null) { result.append(packageName); result.append('.'); } result.append(homeRemotePrefix); result.append(getUniquePrefix(enterpriseBean)); result.append(homeName); return result.toString(); }
[ "public", "static", "String", "getHomeRemoteImplClassName", "(", "EnterpriseBean", "enterpriseBean", ",", "boolean", "isPost11DD", ")", "// d114199", "{", "String", "homeInterfaceName", "=", "getHomeInterfaceName", "(", "enterpriseBean", ")", ";", "if", "(", "homeInterf...
Return the name of the deployed class that implements the home interface of the bean. <p> @param enterpriseBean bean impl class @param isPost11DD true if bean is defined using later than 1.1 deployment description.
[ "Return", "the", "name", "of", "the", "deployed", "class", "that", "implements", "the", "home", "interface", "of", "the", "bean", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/NameUtil.java#L267-L288
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/ProjectManager.java
ProjectManager.getProjectByKey
public Project getProjectByKey(String projectKey) throws RedmineException { return transport.getObject(Project.class, projectKey, new BasicNameValuePair("include", "trackers")); }
java
public Project getProjectByKey(String projectKey) throws RedmineException { return transport.getObject(Project.class, projectKey, new BasicNameValuePair("include", "trackers")); }
[ "public", "Project", "getProjectByKey", "(", "String", "projectKey", ")", "throws", "RedmineException", "{", "return", "transport", ".", "getObject", "(", "Project", ".", "class", ",", "projectKey", ",", "new", "BasicNameValuePair", "(", "\"include\"", ",", "\"tra...
@param projectKey string key like "project-ABC", NOT a database numeric ID @return Redmine's project @throws RedmineAuthenticationException invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments. @throws NotFoundException the project with the given key is not found @throws RedmineException
[ "@param", "projectKey", "string", "key", "like", "project", "-", "ABC", "NOT", "a", "database", "numeric", "ID" ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/ProjectManager.java#L82-L85
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/features/FilterUtilities.java
FilterUtilities.getBboxFilter
public static Filter getBboxFilter( String attribute, double west, double east, double south, double north ) throws CQLException { if (attribute == null) { attribute = "the_geom"; } StringBuilder sB = new StringBuilder(); sB.append("BBOX("); sB.append(attribute); sB.append(","); sB.append(west); sB.append(","); sB.append(south); sB.append(","); sB.append(east); sB.append(","); sB.append(north); sB.append(")"); Filter bboxFilter = CQL.toFilter(sB.toString()); return bboxFilter; }
java
public static Filter getBboxFilter( String attribute, double west, double east, double south, double north ) throws CQLException { if (attribute == null) { attribute = "the_geom"; } StringBuilder sB = new StringBuilder(); sB.append("BBOX("); sB.append(attribute); sB.append(","); sB.append(west); sB.append(","); sB.append(south); sB.append(","); sB.append(east); sB.append(","); sB.append(north); sB.append(")"); Filter bboxFilter = CQL.toFilter(sB.toString()); return bboxFilter; }
[ "public", "static", "Filter", "getBboxFilter", "(", "String", "attribute", ",", "double", "west", ",", "double", "east", ",", "double", "south", ",", "double", "north", ")", "throws", "CQLException", "{", "if", "(", "attribute", "==", "null", ")", "{", "at...
Create a bounding box filter from the bounds coordinates. @param attribute the geometry attribute or null in the case of default "the_geom". @param west western bound coordinate. @param east eastern bound coordinate. @param south southern bound coordinate. @param north northern bound coordinate. @return the filter. @throws CQLException
[ "Create", "a", "bounding", "box", "filter", "from", "the", "bounds", "coordinates", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/features/FilterUtilities.java#L64-L87
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigFactory.java
XMLConfigFactory.createFileFromResource
static void createFileFromResource(String resource, Resource file, String password) throws IOException { SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), "write file:" + file); file.delete(); InputStream is = InfoImpl.class.getResourceAsStream(resource); if (is == null) throw new IOException("file [" + resource + "] does not exist."); file.createNewFile(); IOUtil.copy(is, file, true); }
java
static void createFileFromResource(String resource, Resource file, String password) throws IOException { SystemOut.printDate(SystemUtil.getPrintWriter(SystemUtil.OUT), "write file:" + file); file.delete(); InputStream is = InfoImpl.class.getResourceAsStream(resource); if (is == null) throw new IOException("file [" + resource + "] does not exist."); file.createNewFile(); IOUtil.copy(is, file, true); }
[ "static", "void", "createFileFromResource", "(", "String", "resource", ",", "Resource", "file", ",", "String", "password", ")", "throws", "IOException", "{", "SystemOut", ".", "printDate", "(", "SystemUtil", ".", "getPrintWriter", "(", "SystemUtil", ".", "OUT", ...
creates a File and his content froma a resurce @param resource @param file @param password @throws IOException
[ "creates", "a", "File", "and", "his", "content", "froma", "a", "resurce" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigFactory.java#L270-L278
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.getVariable
public Variable getVariable(Object projectIdOrPath, String key) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); return (response.readEntity(Variable.class)); }
java
public Variable getVariable(Object projectIdOrPath, String key) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "variables", key); return (response.readEntity(Variable.class)); }
[ "public", "Variable", "getVariable", "(", "Object", "projectIdOrPath", ",", "String", "key", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "getPro...
Get the details of a project variable. <pre><code>GitLab Endpoint: GET /projects/:id/variables/:key</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param key the key of an existing variable, required @return the Variable instance for the specified variable @throws GitLabApiException if any exception occurs
[ "Get", "the", "details", "of", "a", "project", "variable", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2466-L2469
openengsb/openengsb
api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java
TransformationDescription.splitField
public void splitField(String sourceField, String targetField, String splitString, String index) { TransformationStep step = new TransformationStep(); step.setTargetField(targetField); step.setSourceFields(sourceField); step.setOperationParameter(TransformationConstants.SPLIT_PARAM, splitString); step.setOperationParameter(TransformationConstants.INDEX_PARAM, index); step.setOperationName("split"); steps.add(step); }
java
public void splitField(String sourceField, String targetField, String splitString, String index) { TransformationStep step = new TransformationStep(); step.setTargetField(targetField); step.setSourceFields(sourceField); step.setOperationParameter(TransformationConstants.SPLIT_PARAM, splitString); step.setOperationParameter(TransformationConstants.INDEX_PARAM, index); step.setOperationName("split"); steps.add(step); }
[ "public", "void", "splitField", "(", "String", "sourceField", ",", "String", "targetField", ",", "String", "splitString", ",", "String", "index", ")", "{", "TransformationStep", "step", "=", "new", "TransformationStep", "(", ")", ";", "step", ".", "setTargetFiel...
Adds a split transformation step to the transformation description. The value of the source field is split based on the split string into parts. Based on the given index, the result will be set to the target field. The index needs to be an integer value. All fields need to be of the type String.
[ "Adds", "a", "split", "transformation", "step", "to", "the", "transformation", "description", ".", "The", "value", "of", "the", "source", "field", "is", "split", "based", "on", "the", "split", "string", "into", "parts", ".", "Based", "on", "the", "given", ...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java#L95-L103
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.obliqueZ
public Matrix3f obliqueZ(float a, float b, Matrix3f dest) { dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m20 = m00 * a + m10 * b + m20; dest.m21 = m01 * a + m11 * b + m21; dest.m22 = m02 * a + m12 * b + m22; return dest; }
java
public Matrix3f obliqueZ(float a, float b, Matrix3f dest) { dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m20 = m00 * a + m10 * b + m20; dest.m21 = m01 * a + m11 * b + m21; dest.m22 = m02 * a + m12 * b + m22; return dest; }
[ "public", "Matrix3f", "obliqueZ", "(", "float", "a", ",", "float", "b", ",", "Matrix3f", "dest", ")", "{", "dest", ".", "m00", "=", "m00", ";", "dest", ".", "m01", "=", "m01", ";", "dest", ".", "m02", "=", "m02", ";", "dest", ".", "m10", "=", "...
Apply an oblique projection transformation to this matrix with the given values for <code>a</code> and <code>b</code> and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the oblique transformation matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the oblique transformation will be applied first! <p> The oblique transformation is defined as: <pre> x' = x + a*z y' = y + a*z z' = z </pre> or in matrix form: <pre> 1 0 a 0 1 b 0 0 1 </pre> @param a the value for the z factor that applies to x @param b the value for the z factor that applies to y @param dest will hold the result @return dest
[ "Apply", "an", "oblique", "projection", "transformation", "to", "this", "matrix", "with", "the", "given", "values", "for", "<code", ">", "a<", "/", "code", ">", "and", "<code", ">", "b<", "/", "code", ">", "and", "store", "the", "result", "in", "<code", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L4180-L4191
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
DynamicJasperHelper.visitSubreports
@SuppressWarnings("unchecked") protected static void visitSubreports(DynamicReport dr, Map _parameters) { for (DJGroup group : dr.getColumnsGroups()) { //Header Subreports for (Subreport subreport : group.getHeaderSubreports()) { if (subreport.getDynamicReport() != null) { visitSubreport(dr, subreport); visitSubreports(subreport.getDynamicReport(), _parameters); } } //Footer Subreports for (Subreport subreport : group.getFooterSubreports()) { if (subreport.getDynamicReport() != null) { visitSubreport(dr, subreport); visitSubreports(subreport.getDynamicReport(), _parameters); } } } }
java
@SuppressWarnings("unchecked") protected static void visitSubreports(DynamicReport dr, Map _parameters) { for (DJGroup group : dr.getColumnsGroups()) { //Header Subreports for (Subreport subreport : group.getHeaderSubreports()) { if (subreport.getDynamicReport() != null) { visitSubreport(dr, subreport); visitSubreports(subreport.getDynamicReport(), _parameters); } } //Footer Subreports for (Subreport subreport : group.getFooterSubreports()) { if (subreport.getDynamicReport() != null) { visitSubreport(dr, subreport); visitSubreports(subreport.getDynamicReport(), _parameters); } } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "static", "void", "visitSubreports", "(", "DynamicReport", "dr", ",", "Map", "_parameters", ")", "{", "for", "(", "DJGroup", "group", ":", "dr", ".", "getColumnsGroups", "(", ")", ")", "{", "//...
Performs any needed operation on subreports after they are built like ensuring proper subreport with if "fitToParentPrintableArea" flag is set to true @param dr @param _parameters @throws JRException
[ "Performs", "any", "needed", "operation", "on", "subreports", "after", "they", "are", "built", "like", "ensuring", "proper", "subreport", "with", "if", "fitToParentPrintableArea", "flag", "is", "set", "to", "true" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L553-L573
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getUsers
public void getUsers(String startFrom, boolean forward, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGCWFUSR LOOKUP", null, startFrom, forward ? 1 : -1, null, null, "A"); toRecipients(lst, false, startFrom, result); }
java
public void getUsers(String startFrom, boolean forward, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGCWFUSR LOOKUP", null, startFrom, forward ? 1 : -1, null, null, "A"); toRecipients(lst, false, startFrom, result); }
[ "public", "void", "getUsers", "(", "String", "startFrom", ",", "boolean", "forward", ",", "Collection", "<", "Recipient", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWFUSR LOOKUP\"", ",", "null", ...
Returns a bolus of users. @param startFrom Starting entry. @param forward Direction of traversal. @param result Result of lookup.
[ "Returns", "a", "bolus", "of", "users", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L74-L77
reinert/requestor
requestor/core/requestor-api/src/main/java/io/reinert/requestor/uri/UriBuilderImpl.java
UriBuilderImpl.assertNotNull
private void assertNotNull(Object value, String message) throws IllegalArgumentException { if (value == null) { throw new IllegalArgumentException(message); } }
java
private void assertNotNull(Object value, String message) throws IllegalArgumentException { if (value == null) { throw new IllegalArgumentException(message); } }
[ "private", "void", "assertNotNull", "(", "Object", "value", ",", "String", "message", ")", "throws", "IllegalArgumentException", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that the value is not null. @param value the value @param message the message to include with any exceptions @throws IllegalArgumentException if value is null
[ "Assert", "that", "the", "value", "is", "not", "null", "." ]
train
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/uri/UriBuilderImpl.java#L317-L321
netty/netty
resolver/src/main/java/io/netty/resolver/AddressResolverGroup.java
AddressResolverGroup.getResolver
public AddressResolver<T> getResolver(final EventExecutor executor) { if (executor == null) { throw new NullPointerException("executor"); } if (executor.isShuttingDown()) { throw new IllegalStateException("executor not accepting a task"); } AddressResolver<T> r; synchronized (resolvers) { r = resolvers.get(executor); if (r == null) { final AddressResolver<T> newResolver; try { newResolver = newResolver(executor); } catch (Exception e) { throw new IllegalStateException("failed to create a new resolver", e); } resolvers.put(executor, newResolver); executor.terminationFuture().addListener(new FutureListener<Object>() { @Override public void operationComplete(Future<Object> future) throws Exception { synchronized (resolvers) { resolvers.remove(executor); } newResolver.close(); } }); r = newResolver; } } return r; }
java
public AddressResolver<T> getResolver(final EventExecutor executor) { if (executor == null) { throw new NullPointerException("executor"); } if (executor.isShuttingDown()) { throw new IllegalStateException("executor not accepting a task"); } AddressResolver<T> r; synchronized (resolvers) { r = resolvers.get(executor); if (r == null) { final AddressResolver<T> newResolver; try { newResolver = newResolver(executor); } catch (Exception e) { throw new IllegalStateException("failed to create a new resolver", e); } resolvers.put(executor, newResolver); executor.terminationFuture().addListener(new FutureListener<Object>() { @Override public void operationComplete(Future<Object> future) throws Exception { synchronized (resolvers) { resolvers.remove(executor); } newResolver.close(); } }); r = newResolver; } } return r; }
[ "public", "AddressResolver", "<", "T", ">", "getResolver", "(", "final", "EventExecutor", "executor", ")", "{", "if", "(", "executor", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"executor\"", ")", ";", "}", "if", "(", "executor", ...
Returns the {@link AddressResolver} associated with the specified {@link EventExecutor}. If there's no associated resolved found, this method creates and returns a new resolver instance created by {@link #newResolver(EventExecutor)} so that the new resolver is reused on another {@link #getResolver(EventExecutor)} call with the same {@link EventExecutor}.
[ "Returns", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver/src/main/java/io/netty/resolver/AddressResolverGroup.java#L54-L90
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/schema/SchemaService.java
SchemaService.getApplication
public ApplicationDefinition getApplication(Tenant tenant, String appName) { checkServiceState(); return getApplicationDefinition(tenant, appName); }
java
public ApplicationDefinition getApplication(Tenant tenant, String appName) { checkServiceState(); return getApplicationDefinition(tenant, appName); }
[ "public", "ApplicationDefinition", "getApplication", "(", "Tenant", "tenant", ",", "String", "appName", ")", "{", "checkServiceState", "(", ")", ";", "return", "getApplicationDefinition", "(", "tenant", ",", "appName", ")", ";", "}" ]
Return the {@link ApplicationDefinition} for the application in the given tenant. Null is returned if no application is found with the given name and tenant. @return The {@link ApplicationDefinition} for the given application or null if no no such application is defined in the default tenant.
[ "Return", "the", "{", "@link", "ApplicationDefinition", "}", "for", "the", "application", "in", "the", "given", "tenant", ".", "Null", "is", "returned", "if", "no", "application", "is", "found", "with", "the", "given", "name", "and", "tenant", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/schema/SchemaService.java#L178-L181
rometools/rome
rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java
FileBasedCollection.addMediaEntry
public String addMediaEntry(final Entry entry, final String slug, final InputStream is) throws Exception { synchronized (FileStore.getFileStore()) { // Save media file temp file final Content content = entry.getContents().get(0); if (entry.getTitle() == null) { entry.setTitle(slug); } final String fileName = createFileName(slug != null ? slug : entry.getTitle(), content.getType()); final File tempFile = File.createTempFile(fileName, "tmp"); final FileOutputStream fos = new FileOutputStream(tempFile); Utilities.copyInputToOutput(is, fos); fos.close(); // Save media file final FileInputStream fis = new FileInputStream(tempFile); saveMediaFile(fileName, content.getType(), tempFile.length(), fis); fis.close(); final File resourceFile = new File(getEntryMediaPath(fileName)); // Create media-link entry updateTimestamps(entry); // Save media-link entry final String entryPath = getEntryPath(fileName); final OutputStream os = FileStore.getFileStore().getFileOutputStream(entryPath); updateMediaEntryAppLinks(entry, resourceFile.getName(), true); Atom10Generator.serializeEntry(entry, new OutputStreamWriter(os, "UTF-8")); os.flush(); os.close(); // Update feed with new entry final Feed f = getFeedDocument(); updateMediaEntryAppLinks(entry, resourceFile.getName(), false); updateFeedDocumentWithNewEntry(f, entry); return getEntryEditURI(fileName, false, true); } }
java
public String addMediaEntry(final Entry entry, final String slug, final InputStream is) throws Exception { synchronized (FileStore.getFileStore()) { // Save media file temp file final Content content = entry.getContents().get(0); if (entry.getTitle() == null) { entry.setTitle(slug); } final String fileName = createFileName(slug != null ? slug : entry.getTitle(), content.getType()); final File tempFile = File.createTempFile(fileName, "tmp"); final FileOutputStream fos = new FileOutputStream(tempFile); Utilities.copyInputToOutput(is, fos); fos.close(); // Save media file final FileInputStream fis = new FileInputStream(tempFile); saveMediaFile(fileName, content.getType(), tempFile.length(), fis); fis.close(); final File resourceFile = new File(getEntryMediaPath(fileName)); // Create media-link entry updateTimestamps(entry); // Save media-link entry final String entryPath = getEntryPath(fileName); final OutputStream os = FileStore.getFileStore().getFileOutputStream(entryPath); updateMediaEntryAppLinks(entry, resourceFile.getName(), true); Atom10Generator.serializeEntry(entry, new OutputStreamWriter(os, "UTF-8")); os.flush(); os.close(); // Update feed with new entry final Feed f = getFeedDocument(); updateMediaEntryAppLinks(entry, resourceFile.getName(), false); updateFeedDocumentWithNewEntry(f, entry); return getEntryEditURI(fileName, false, true); } }
[ "public", "String", "addMediaEntry", "(", "final", "Entry", "entry", ",", "final", "String", "slug", ",", "final", "InputStream", "is", ")", "throws", "Exception", "{", "synchronized", "(", "FileStore", ".", "getFileStore", "(", ")", ")", "{", "// Save media f...
Add media entry to collection. Accepts a media file to be added to collection. The file will be saved to disk in a directory under the collection's directory and the path will follow the pattern <code>[collection-plural]/[entryid]/media/[entryid]</code>. An Atom entry will be created to store metadata for the entry and it will exist at the path <code>[collection-plural]/[entryid]/entry.xml</code>. The entry will be added to the collection's feed in [collection-plural]/feed.xml. @param entry Entry object @param slug String to be used in file-name @param is Source of media data @throws java.lang.Exception On Error @return Location URI of entry
[ "Add", "media", "entry", "to", "collection", ".", "Accepts", "a", "media", "file", "to", "be", "added", "to", "collection", ".", "The", "file", "will", "be", "saved", "to", "disk", "in", "a", "directory", "under", "the", "collection", "s", "directory", "...
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java#L226-L264
GerdHolz/TOVAL
src/de/invation/code/toval/os/LinuxUtils.java
LinuxUtils.registerFileExtension
@Override public boolean registerFileExtension(String mimeTypeName, String fileTypeExtension, String application) throws OSException { // TODO create mime-info in /usr/share/mime/packages // TODO add MIME type to .desktop file // not possible due to missing permissions? throw new UnsupportedOperationException("Not supported."); }
java
@Override public boolean registerFileExtension(String mimeTypeName, String fileTypeExtension, String application) throws OSException { // TODO create mime-info in /usr/share/mime/packages // TODO add MIME type to .desktop file // not possible due to missing permissions? throw new UnsupportedOperationException("Not supported."); }
[ "@", "Override", "public", "boolean", "registerFileExtension", "(", "String", "mimeTypeName", ",", "String", "fileTypeExtension", ",", "String", "application", ")", "throws", "OSException", "{", "// TODO create mime-info in /usr/share/mime/packages", "// TODO add MIME type to ....
Registers a new file extension. @param mimeTypeName MIME type of the file extension. Must be atomic, e.g. <code>foocorp.fooapp.v1</code>. @param fileTypeExtension File extension with leading dot, e.g. <code>.bar</code>. @param application Path to the application, which should open the new file extension. @return <code>true</code> if registration was successful, <code>false</code> otherwise. @throws OSException
[ "Registers", "a", "new", "file", "extension", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/LinuxUtils.java#L141-L147
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java
JournalCreator.purgeObject
public Date purgeObject(Context context, String pid, String logMessage) throws ServerException { try { CreatorJournalEntry cje = new CreatorJournalEntry(METHOD_PURGE_OBJECT, context); cje.addArgument(ARGUMENT_NAME_PID, pid); cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage); return (Date) cje.invokeAndClose(delegate, writer); } catch (JournalException e) { throw new GeneralException("Problem creating the Journal", e); } }
java
public Date purgeObject(Context context, String pid, String logMessage) throws ServerException { try { CreatorJournalEntry cje = new CreatorJournalEntry(METHOD_PURGE_OBJECT, context); cje.addArgument(ARGUMENT_NAME_PID, pid); cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage); return (Date) cje.invokeAndClose(delegate, writer); } catch (JournalException e) { throw new GeneralException("Problem creating the Journal", e); } }
[ "public", "Date", "purgeObject", "(", "Context", "context", ",", "String", "pid", ",", "String", "logMessage", ")", "throws", "ServerException", "{", "try", "{", "CreatorJournalEntry", "cje", "=", "new", "CreatorJournalEntry", "(", "METHOD_PURGE_OBJECT", ",", "con...
Create a journal entry, add the arguments, and invoke the method.
[ "Create", "a", "journal", "entry", "add", "the", "arguments", "and", "invoke", "the", "method", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java#L148-L160
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java
ConvolutionUtils.cnn1dMaskReduction
public static INDArray cnn1dMaskReduction(INDArray in, int kernel, int stride, int padding, int dilation, ConvolutionMode cm){ Preconditions.checkState(in.rank()==2, "Rank must be 2 for cnn1d mask array - shape ", in.shape()); if(cm == ConvolutionMode.Same && stride == 1 ){ return in; } if(!Shape.hasDefaultStridesForShape(in)){ in = in.dup(); } INDArray reshaped4d = in.reshape(in.size(0), 1, in.size(1), 1); int[] outSize; int[] pad; int[] k = new int[]{kernel,1}; int[] s = new int[]{stride, 1}; int[] d = new int[]{dilation, 1}; if (cm == ConvolutionMode.Same) { outSize = ConvolutionUtils.getOutputSize(reshaped4d, k, s, null, cm, d); //Also performs validation } else { pad = new int[]{padding, 0}; outSize = ConvolutionUtils.getOutputSize(reshaped4d, k, s, pad, cm, d); //Also performs validation } int outH = outSize[0]; INDArray output = Nd4j.createUninitialized(new int[]{(int)in.size(0), 1, outH, 1}, 'c'); Op op = new LegacyPooling2D(reshaped4d, kernel, 1, stride, 1, padding, 0, dilation, 1, cm == ConvolutionMode.Same, LegacyPooling2D.Pooling2DType.MAX, 0.0, output); Nd4j.getExecutioner().exec(op); return output.reshape('c', in.size(0), outH); }
java
public static INDArray cnn1dMaskReduction(INDArray in, int kernel, int stride, int padding, int dilation, ConvolutionMode cm){ Preconditions.checkState(in.rank()==2, "Rank must be 2 for cnn1d mask array - shape ", in.shape()); if(cm == ConvolutionMode.Same && stride == 1 ){ return in; } if(!Shape.hasDefaultStridesForShape(in)){ in = in.dup(); } INDArray reshaped4d = in.reshape(in.size(0), 1, in.size(1), 1); int[] outSize; int[] pad; int[] k = new int[]{kernel,1}; int[] s = new int[]{stride, 1}; int[] d = new int[]{dilation, 1}; if (cm == ConvolutionMode.Same) { outSize = ConvolutionUtils.getOutputSize(reshaped4d, k, s, null, cm, d); //Also performs validation } else { pad = new int[]{padding, 0}; outSize = ConvolutionUtils.getOutputSize(reshaped4d, k, s, pad, cm, d); //Also performs validation } int outH = outSize[0]; INDArray output = Nd4j.createUninitialized(new int[]{(int)in.size(0), 1, outH, 1}, 'c'); Op op = new LegacyPooling2D(reshaped4d, kernel, 1, stride, 1, padding, 0, dilation, 1, cm == ConvolutionMode.Same, LegacyPooling2D.Pooling2DType.MAX, 0.0, output); Nd4j.getExecutioner().exec(op); return output.reshape('c', in.size(0), outH); }
[ "public", "static", "INDArray", "cnn1dMaskReduction", "(", "INDArray", "in", ",", "int", "kernel", ",", "int", "stride", ",", "int", "padding", ",", "int", "dilation", ",", "ConvolutionMode", "cm", ")", "{", "Preconditions", ".", "checkState", "(", "in", "."...
Given a mask array for a 1D CNN layer of shape [minibatch, sequenceLength], reduce the mask according to the 1D CNN layer configuration. Unlike RNN layers, 1D CNN layers may down-sample the data; consequently, we need to down-sample the mask array in the same way, to maintain the correspondence between the masks and the output activations @param in Input size @param kernel Kernel size @param stride Stride @param padding Padding @param dilation Dilation @param cm Convolution mode @return Reduced mask
[ "Given", "a", "mask", "array", "for", "a", "1D", "CNN", "layer", "of", "shape", "[", "minibatch", "sequenceLength", "]", "reduce", "the", "mask", "according", "to", "the", "1D", "CNN", "layer", "configuration", ".", "Unlike", "RNN", "layers", "1D", "CNN", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java#L614-L645
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getColorDigit
private int getColorDigit( int idx, CssFormatter formatter ) { Expression expression = get( idx ); double d = expression.doubleValue( formatter ); if( expression.getDataType( formatter ) == PERCENT ) { d *= 2.55; } return colorDigit(d); }
java
private int getColorDigit( int idx, CssFormatter formatter ) { Expression expression = get( idx ); double d = expression.doubleValue( formatter ); if( expression.getDataType( formatter ) == PERCENT ) { d *= 2.55; } return colorDigit(d); }
[ "private", "int", "getColorDigit", "(", "int", "idx", ",", "CssFormatter", "formatter", ")", "{", "Expression", "expression", "=", "get", "(", "idx", ")", ";", "double", "d", "=", "expression", ".", "doubleValue", "(", "formatter", ")", ";", "if", "(", "...
Get the idx parameter from the parameter list as color digit. @param idx the index starting with 0 @param formatter current formatter @return the expression
[ "Get", "the", "idx", "parameter", "from", "the", "parameter", "list", "as", "color", "digit", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L899-L906
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.createVideoReviewsWithServiceResponseAsync
public Observable<ServiceResponse<List<String>>> createVideoReviewsWithServiceResponseAsync(String teamName, String contentType, List<CreateVideoReviewsBodyItem> createVideoReviewsBody, CreateVideoReviewsOptionalParameter createVideoReviewsOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (teamName == null) { throw new IllegalArgumentException("Parameter teamName is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (createVideoReviewsBody == null) { throw new IllegalArgumentException("Parameter createVideoReviewsBody is required and cannot be null."); } Validator.validate(createVideoReviewsBody); final String subTeam = createVideoReviewsOptionalParameter != null ? createVideoReviewsOptionalParameter.subTeam() : null; return createVideoReviewsWithServiceResponseAsync(teamName, contentType, createVideoReviewsBody, subTeam); }
java
public Observable<ServiceResponse<List<String>>> createVideoReviewsWithServiceResponseAsync(String teamName, String contentType, List<CreateVideoReviewsBodyItem> createVideoReviewsBody, CreateVideoReviewsOptionalParameter createVideoReviewsOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (teamName == null) { throw new IllegalArgumentException("Parameter teamName is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (createVideoReviewsBody == null) { throw new IllegalArgumentException("Parameter createVideoReviewsBody is required and cannot be null."); } Validator.validate(createVideoReviewsBody); final String subTeam = createVideoReviewsOptionalParameter != null ? createVideoReviewsOptionalParameter.subTeam() : null; return createVideoReviewsWithServiceResponseAsync(teamName, contentType, createVideoReviewsBody, subTeam); }
[ "public", "Observable", "<", "ServiceResponse", "<", "List", "<", "String", ">", ">", ">", "createVideoReviewsWithServiceResponseAsync", "(", "String", "teamName", ",", "String", "contentType", ",", "List", "<", "CreateVideoReviewsBodyItem", ">", "createVideoReviewsBody...
The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint. &lt;h3&gt;CallBack Schemas &lt;/h3&gt; &lt;h4&gt;Review Completion CallBack Sample&lt;/h4&gt; &lt;p&gt; {&lt;br/&gt; "ReviewId": "&lt;Review Id&gt;",&lt;br/&gt; "ModifiedOn": "2016-10-11T22:36:32.9934851Z",&lt;br/&gt; "ModifiedBy": "&lt;Name of the Reviewer&gt;",&lt;br/&gt; "CallBackType": "Review",&lt;br/&gt; "ContentId": "&lt;The ContentId that was specified input&gt;",&lt;br/&gt; "Metadata": {&lt;br/&gt; "adultscore": "0.xxx",&lt;br/&gt; "a": "False",&lt;br/&gt; "racyscore": "0.xxx",&lt;br/&gt; "r": "True"&lt;br/&gt; },&lt;br/&gt; "ReviewerResultTags": {&lt;br/&gt; "a": "False",&lt;br/&gt; "r": "True"&lt;br/&gt; }&lt;br/&gt; }&lt;br/&gt; &lt;/p&gt;. @param teamName Your team name. @param contentType The content type. @param createVideoReviewsBody Body for create reviews API @param createVideoReviewsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;String&gt; object
[ "The", "reviews", "created", "would", "show", "up", "for", "Reviewers", "on", "your", "team", ".", "As", "Reviewers", "complete", "reviewing", "results", "of", "the", "Review", "would", "be", "POSTED", "(", "i", ".", "e", ".", "HTTP", "POST", ")", "on", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L2019-L2036
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.eachFile
public static void eachFile(final Path self, final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException { //throws FileNotFoundException, IllegalArgumentException { checkDir(self); // TODO GroovyDoc doesn't parse this file as our java.g doesn't handle this JDK7 syntax try (DirectoryStream<Path> stream = Files.newDirectoryStream(self)) { for (Path path : stream) { if (fileType == FileType.ANY || (fileType != FileType.FILES && Files.isDirectory(path)) || (fileType != FileType.DIRECTORIES && Files.isRegularFile(path))) { closure.call(path); } } } }
java
public static void eachFile(final Path self, final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") final Closure closure) throws IOException { //throws FileNotFoundException, IllegalArgumentException { checkDir(self); // TODO GroovyDoc doesn't parse this file as our java.g doesn't handle this JDK7 syntax try (DirectoryStream<Path> stream = Files.newDirectoryStream(self)) { for (Path path : stream) { if (fileType == FileType.ANY || (fileType != FileType.FILES && Files.isDirectory(path)) || (fileType != FileType.DIRECTORIES && Files.isRegularFile(path))) { closure.call(path); } } } }
[ "public", "static", "void", "eachFile", "(", "final", "Path", "self", ",", "final", "FileType", "fileType", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.nio.file.Path\"", ")", "final", "Closure", "closu...
Invokes the closure for each 'child' file in this 'parent' folder/directory. Both regular files and subfolders/subdirectories can be processed depending on the fileType enum value. @param self a Path (that happens to be a folder/directory) @param fileType if normal files or directories or both should be processed @param closure the closure to invoke @throws java.io.FileNotFoundException if the given directory does not exist @throws IllegalArgumentException if the provided Path object does not represent a directory @since 2.3.0
[ "Invokes", "the", "closure", "for", "each", "child", "file", "in", "this", "parent", "folder", "/", "directory", ".", "Both", "regular", "files", "and", "subfolders", "/", "subdirectories", "can", "be", "processed", "depending", "on", "the", "fileType", "enum"...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L859-L873
ManfredTremmel/gwt-bean-validators
gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/CollectionUtils.java
CollectionUtils.findValueOfType
@GwtIncompatible("incompatible method") @Nullable public static Object findValueOfType(final Collection<?> collection, final Class<?>[] types) { if (CollectionUtils.isEmpty(collection) || ObjectUtils.isEmpty(types)) { return null; } for (final Class<?> type : types) { final Object value = CollectionUtils.findValueOfType(collection, type); if (value != null) { return value; } } return null; }
java
@GwtIncompatible("incompatible method") @Nullable public static Object findValueOfType(final Collection<?> collection, final Class<?>[] types) { if (CollectionUtils.isEmpty(collection) || ObjectUtils.isEmpty(types)) { return null; } for (final Class<?> type : types) { final Object value = CollectionUtils.findValueOfType(collection, type); if (value != null) { return value; } } return null; }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "@", "Nullable", "public", "static", "Object", "findValueOfType", "(", "final", "Collection", "<", "?", ">", "collection", ",", "final", "Class", "<", "?", ">", "[", "]", "types", ")", "{", "if", ...
Find a single value of one of the given types in the given Collection: searching the Collection for a value of the first type, then searching for a value of the second type, etc. @param collection the collection to search @param types the types to look for, in prioritized order @return a value of one of the given types found if there is a clear match, or {@code null} if none or more than one such value found
[ "Find", "a", "single", "value", "of", "one", "of", "the", "given", "types", "in", "the", "given", "Collection", ":", "searching", "the", "Collection", "for", "a", "value", "of", "the", "first", "type", "then", "searching", "for", "a", "value", "of", "the...
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/CollectionUtils.java#L272-L285
groovy/groovy-core
src/main/org/codehaus/groovy/vmplugin/v5/PluginDefaultGroovyMethods.java
PluginDefaultGroovyMethods.leftShift
public static StringBuilder leftShift(StringBuilder self, Object value) { if (value instanceof CharSequence) return self.append((CharSequence)value); else return self.append(value); }
java
public static StringBuilder leftShift(StringBuilder self, Object value) { if (value instanceof CharSequence) return self.append((CharSequence)value); else return self.append(value); }
[ "public", "static", "StringBuilder", "leftShift", "(", "StringBuilder", "self", ",", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "CharSequence", ")", "return", "self", ".", "append", "(", "(", "CharSequence", ")", "value", ")", ";", "else"...
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuilder. @param self a StringBuilder @param value a value to append @return the StringBuilder on which this operation was invoked
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "append", "multiple", "objects", "as", "string", "representations", "to", "a", "StringBuilder", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/vmplugin/v5/PluginDefaultGroovyMethods.java#L98-L103
Azure/azure-sdk-for-java
locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java
ManagementLocksInner.getByScope
public ManagementLockObjectInner getByScope(String scope, String lockName) { return getByScopeWithServiceResponseAsync(scope, lockName).toBlocking().single().body(); }
java
public ManagementLockObjectInner getByScope(String scope, String lockName) { return getByScopeWithServiceResponseAsync(scope, lockName).toBlocking().single().body(); }
[ "public", "ManagementLockObjectInner", "getByScope", "(", "String", "scope", ",", "String", "lockName", ")", "{", "return", "getByScopeWithServiceResponseAsync", "(", "scope", ",", "lockName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body...
Get a management lock by scope. @param scope The scope for the lock. @param lockName The name of lock. @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 ManagementLockObjectInner object if successful.
[ "Get", "a", "management", "lock", "by", "scope", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L600-L602
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java
RTMPProtocolDecoder.decodeAction
private Invoke decodeAction(Encoding encoding, IoBuffer in, Header header) { // for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use in.mark(); byte tmp = in.get(); in.reset(); Input input; if (encoding == Encoding.AMF3 && tmp == AMF.TYPE_AMF3_OBJECT) { input = new org.red5.io.amf3.Input(in); ((org.red5.io.amf3.Input) input).enforceAMF3(); } else { input = new org.red5.io.amf.Input(in); } // get the action String action = Deserializer.deserialize(input, String.class); if (action == null) { throw new RuntimeException("Action was null"); } if (log.isTraceEnabled()) { log.trace("Action: {}", action); } // instance the invoke Invoke invoke = new Invoke(); // set the transaction id invoke.setTransactionId(readTransactionId(input)); // reset and decode parameters input.reset(); // get / set the parameters if there any Object[] params = in.hasRemaining() ? handleParameters(in, invoke, input) : new Object[0]; // determine service information final int dotIndex = action.lastIndexOf('.'); String serviceName = (dotIndex == -1) ? null : action.substring(0, dotIndex); // pull off the prefixes since java doesn't allow this on a method name if (serviceName != null && (serviceName.startsWith("@") || serviceName.startsWith("|"))) { serviceName = serviceName.substring(1); } String serviceMethod = (dotIndex == -1) ? action : action.substring(dotIndex + 1, action.length()); // pull off the prefixes since java doesnt allow this on a method name if (serviceMethod.startsWith("@") || serviceMethod.startsWith("|")) { serviceMethod = serviceMethod.substring(1); } // create the pending call for invoke PendingCall call = new PendingCall(serviceName, serviceMethod, params); invoke.setCall(call); return invoke; }
java
private Invoke decodeAction(Encoding encoding, IoBuffer in, Header header) { // for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use in.mark(); byte tmp = in.get(); in.reset(); Input input; if (encoding == Encoding.AMF3 && tmp == AMF.TYPE_AMF3_OBJECT) { input = new org.red5.io.amf3.Input(in); ((org.red5.io.amf3.Input) input).enforceAMF3(); } else { input = new org.red5.io.amf.Input(in); } // get the action String action = Deserializer.deserialize(input, String.class); if (action == null) { throw new RuntimeException("Action was null"); } if (log.isTraceEnabled()) { log.trace("Action: {}", action); } // instance the invoke Invoke invoke = new Invoke(); // set the transaction id invoke.setTransactionId(readTransactionId(input)); // reset and decode parameters input.reset(); // get / set the parameters if there any Object[] params = in.hasRemaining() ? handleParameters(in, invoke, input) : new Object[0]; // determine service information final int dotIndex = action.lastIndexOf('.'); String serviceName = (dotIndex == -1) ? null : action.substring(0, dotIndex); // pull off the prefixes since java doesn't allow this on a method name if (serviceName != null && (serviceName.startsWith("@") || serviceName.startsWith("|"))) { serviceName = serviceName.substring(1); } String serviceMethod = (dotIndex == -1) ? action : action.substring(dotIndex + 1, action.length()); // pull off the prefixes since java doesnt allow this on a method name if (serviceMethod.startsWith("@") || serviceMethod.startsWith("|")) { serviceMethod = serviceMethod.substring(1); } // create the pending call for invoke PendingCall call = new PendingCall(serviceName, serviceMethod, params); invoke.setCall(call); return invoke; }
[ "private", "Invoke", "decodeAction", "(", "Encoding", "encoding", ",", "IoBuffer", "in", ",", "Header", "header", ")", "{", "// for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use\r", "in", ".", "mark", "(",...
Decode the 'action' for a supplied an Invoke. @param encoding AMF encoding @param in buffer @param header data header @return notify
[ "Decode", "the", "action", "for", "a", "supplied", "an", "Invoke", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java#L752-L796
RestComm/sip-servlets
containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipNamingContextListener.java
SipNamingContextListener.removeSipSessionsUtil
public static void removeSipSessionsUtil(Context envCtx, String appName, SipSessionsUtil sipSessionsUtil) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(SIP_SESSIONS_UTIL_JNDI_NAME); } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } } }
java
public static void removeSipSessionsUtil(Context envCtx, String appName, SipSessionsUtil sipSessionsUtil) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(SIP_SESSIONS_UTIL_JNDI_NAME); } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } } }
[ "public", "static", "void", "removeSipSessionsUtil", "(", "Context", "envCtx", ",", "String", "appName", ",", "SipSessionsUtil", "sipSessionsUtil", ")", "{", "if", "(", "envCtx", "!=", "null", ")", "{", "try", "{", "javax", ".", "naming", ".", "Context", "si...
Removes the sip sessions util binding from the jndi mapping @param appName the application name subcontext @param sipSessionsUtil the sip sessions util to remove
[ "Removes", "the", "sip", "sessions", "util", "binding", "from", "the", "jndi", "mapping" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipNamingContextListener.java#L229-L238
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/ResultSetUtility.java
ResultSetUtility.columnToPropertyName
protected String columnToPropertyName(ResultSetMetaData rsmd, int col) throws SQLException{ String columnName = rsmd.getColumnLabel(col); if (null == columnName || 0 == columnName.length()) { columnName = rsmd.getColumnName(col); } return columnNameToPropertyName(columnName); }
java
protected String columnToPropertyName(ResultSetMetaData rsmd, int col) throws SQLException{ String columnName = rsmd.getColumnLabel(col); if (null == columnName || 0 == columnName.length()) { columnName = rsmd.getColumnName(col); } return columnNameToPropertyName(columnName); }
[ "protected", "String", "columnToPropertyName", "(", "ResultSetMetaData", "rsmd", ",", "int", "col", ")", "throws", "SQLException", "{", "String", "columnName", "=", "rsmd", ".", "getColumnLabel", "(", "col", ")", ";", "if", "(", "null", "==", "columnName", "||...
Convert column name to property name for a column, for example, THIS_IS_1ST_COLUMN_$$ will become thisIs1stColumn @param rsmd the metadata @param col the column number @return for example, THIS_IS_1ST_COLUMN_$$ will become thisIs1stColumn @throws SQLException
[ "Convert", "column", "name", "to", "property", "name", "for", "a", "column", "for", "example", "THIS_IS_1ST_COLUMN_$$", "will", "become", "thisIs1stColumn" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/ResultSetUtility.java#L294-L300
alkacon/opencms-core
src/org/opencms/ui/apps/sitemanager/CmsEditSiteForm.java
CmsEditSiteForm.getParameterString
private String getParameterString(Entry<String, String> parameter) { return parameter.getKey() + "=" + parameter.getValue(); }
java
private String getParameterString(Entry<String, String> parameter) { return parameter.getKey() + "=" + parameter.getValue(); }
[ "private", "String", "getParameterString", "(", "Entry", "<", "String", ",", "String", ">", "parameter", ")", "{", "return", "parameter", ".", "getKey", "(", ")", "+", "\"=\"", "+", "parameter", ".", "getValue", "(", ")", ";", "}" ]
Map entry of parameter to String representation.<p> @param parameter Entry holding parameter info. @return the parameter formatted as string
[ "Map", "entry", "of", "parameter", "to", "String", "representation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsEditSiteForm.java#L1784-L1787
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/common/SystemConfiguration.java
SystemConfiguration.getObjectAttributeValueAsProperties
public Properties getObjectAttributeValueAsProperties(final String _key) throws EFapsException { final Properties ret = new Properties(); final String value = getValue(_key, ConfType.OBJATTR); if (value != null) { try { ret.load(new StringReader(value)); } catch (final IOException e) { throw new EFapsException(SystemConfiguration.class, "getObjectAttributeValueAsProperties", e); } } return ret; }
java
public Properties getObjectAttributeValueAsProperties(final String _key) throws EFapsException { final Properties ret = new Properties(); final String value = getValue(_key, ConfType.OBJATTR); if (value != null) { try { ret.load(new StringReader(value)); } catch (final IOException e) { throw new EFapsException(SystemConfiguration.class, "getObjectAttributeValueAsProperties", e); } } return ret; }
[ "public", "Properties", "getObjectAttributeValueAsProperties", "(", "final", "String", "_key", ")", "throws", "EFapsException", "{", "final", "Properties", "ret", "=", "new", "Properties", "(", ")", ";", "final", "String", "value", "=", "getValue", "(", "_key", ...
Returns for given <code>OID</code> the related value as Properties. If no attribute is found an empty Properties is returned. @param _key key of searched attribute @return Properties @throws EFapsException on error @see #objectAttributes
[ "Returns", "for", "given", "<code", ">", "OID<", "/", "code", ">", "the", "related", "value", "as", "Properties", ".", "If", "no", "attribute", "is", "found", "an", "empty", "Properties", "is", "returned", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/SystemConfiguration.java#L350-L363
gallandarakhneorg/afc
advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapPolylineDrawer.java
AbstractMapPolylineDrawer.definePath
protected void definePath(ZoomableGraphicsContext gc, T element) { gc.beginPath(); final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator(); switch (pathIterator.getWindingRule()) { case EVEN_ODD: gc.setFillRule(FillRule.EVEN_ODD); break; case NON_ZERO: gc.setFillRule(FillRule.NON_ZERO); break; default: throw new IllegalStateException(); } while (pathIterator.hasNext()) { final PathElement2d pelement = pathIterator.next(); switch (pelement.getType()) { case LINE_TO: gc.lineTo(pelement.getToX(), pelement.getToY()); break; case MOVE_TO: gc.moveTo(pelement.getToX(), pelement.getToY()); break; case CLOSE: gc.closePath(); break; case CURVE_TO: gc.bezierCurveTo( pelement.getCtrlX1(), pelement.getCtrlY1(), pelement.getCtrlX2(), pelement.getCtrlY2(), pelement.getToX(), pelement.getToY()); break; case QUAD_TO: gc.quadraticCurveTo( pelement.getCtrlX1(), pelement.getCtrlY1(), pelement.getToX(), pelement.getToY()); break; case ARC_TO: //TODO: implements arcTo gc.lineTo(pelement.getToX(), pelement.getToY()); break; default: break; } } }
java
protected void definePath(ZoomableGraphicsContext gc, T element) { gc.beginPath(); final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator(); switch (pathIterator.getWindingRule()) { case EVEN_ODD: gc.setFillRule(FillRule.EVEN_ODD); break; case NON_ZERO: gc.setFillRule(FillRule.NON_ZERO); break; default: throw new IllegalStateException(); } while (pathIterator.hasNext()) { final PathElement2d pelement = pathIterator.next(); switch (pelement.getType()) { case LINE_TO: gc.lineTo(pelement.getToX(), pelement.getToY()); break; case MOVE_TO: gc.moveTo(pelement.getToX(), pelement.getToY()); break; case CLOSE: gc.closePath(); break; case CURVE_TO: gc.bezierCurveTo( pelement.getCtrlX1(), pelement.getCtrlY1(), pelement.getCtrlX2(), pelement.getCtrlY2(), pelement.getToX(), pelement.getToY()); break; case QUAD_TO: gc.quadraticCurveTo( pelement.getCtrlX1(), pelement.getCtrlY1(), pelement.getToX(), pelement.getToY()); break; case ARC_TO: //TODO: implements arcTo gc.lineTo(pelement.getToX(), pelement.getToY()); break; default: break; } } }
[ "protected", "void", "definePath", "(", "ZoomableGraphicsContext", "gc", ",", "T", "element", ")", "{", "gc", ".", "beginPath", "(", ")", ";", "final", "PathIterator2afp", "<", "PathElement2d", ">", "pathIterator", "=", "element", ".", "toPath2D", "(", ")", ...
Draw the polyline path. @param gc the graphics context that must be used for drawing. @param element the map element.
[ "Draw", "the", "polyline", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapPolylineDrawer.java#L46-L90
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java
LoadBalancersInner.createOrUpdate
public LoadBalancerInner createOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancerInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, parameters).toBlocking().last().body(); }
java
public LoadBalancerInner createOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancerInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, parameters).toBlocking().last().body(); }
[ "public", "LoadBalancerInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "LoadBalancerInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBalancerName", ","...
Creates or updates a load balancer. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param parameters Parameters supplied to the create or update load balancer operation. @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 LoadBalancerInner object if successful.
[ "Creates", "or", "updates", "a", "load", "balancer", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java#L444-L446
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java
FileWriter.writeLines
public <T> File writeLines(Collection<T> list, boolean isAppend) throws IORuntimeException { return writeLines(list, null, isAppend); }
java
public <T> File writeLines(Collection<T> list, boolean isAppend) throws IORuntimeException { return writeLines(list, null, isAppend); }
[ "public", "<", "T", ">", "File", "writeLines", "(", "Collection", "<", "T", ">", "list", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "return", "writeLines", "(", "list", ",", "null", ",", "isAppend", ")", ";", "}" ]
将列表写入文件 @param <T> 集合元素类型 @param list 列表 @param isAppend 是否追加 @return 目标文件 @throws IORuntimeException IO异常
[ "将列表写入文件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L182-L184
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRDirectLight.java
GVRDirectLight.setShadowRange
public void setShadowRange(float near, float far) { GVRSceneObject owner = getOwnerObject(); GVROrthogonalCamera shadowCam = null; if (owner == null) { throw new UnsupportedOperationException("Light must have an owner to set the shadow range"); } GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType()); if (shadowMap != null) { shadowCam = (GVROrthogonalCamera) shadowMap.getCamera(); shadowCam.setNearClippingDistance(near); shadowCam.setFarClippingDistance(far); shadowMap.setEnable(true); } else { shadowCam = GVRShadowMap.makeOrthoShadowCamera( getGVRContext().getMainScene().getMainCameraRig().getCenterCamera()); shadowCam.setNearClippingDistance(near); shadowCam.setFarClippingDistance(far); shadowMap = new GVRShadowMap(getGVRContext(), shadowCam); owner.attachComponent(shadowMap); } mCastShadow = true; }
java
public void setShadowRange(float near, float far) { GVRSceneObject owner = getOwnerObject(); GVROrthogonalCamera shadowCam = null; if (owner == null) { throw new UnsupportedOperationException("Light must have an owner to set the shadow range"); } GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType()); if (shadowMap != null) { shadowCam = (GVROrthogonalCamera) shadowMap.getCamera(); shadowCam.setNearClippingDistance(near); shadowCam.setFarClippingDistance(far); shadowMap.setEnable(true); } else { shadowCam = GVRShadowMap.makeOrthoShadowCamera( getGVRContext().getMainScene().getMainCameraRig().getCenterCamera()); shadowCam.setNearClippingDistance(near); shadowCam.setFarClippingDistance(far); shadowMap = new GVRShadowMap(getGVRContext(), shadowCam); owner.attachComponent(shadowMap); } mCastShadow = true; }
[ "public", "void", "setShadowRange", "(", "float", "near", ",", "float", "far", ")", "{", "GVRSceneObject", "owner", "=", "getOwnerObject", "(", ")", ";", "GVROrthogonalCamera", "shadowCam", "=", "null", ";", "if", "(", "owner", "==", "null", ")", "{", "thr...
Sets the near and far range of the shadow map camera. <p> This function enables shadow mapping and sets the shadow map camera near and far range, controlling which objects affect the shadow map. To modify other properties of the shadow map camera's projection, you can call {@link GVRShadowMap#getCamera} and update them. @param near near shadow camera clipping plane @param far far shadow camera clipping plane @see GVRShadowMap#getCamera()
[ "Sets", "the", "near", "and", "far", "range", "of", "the", "shadow", "map", "camera", ".", "<p", ">", "This", "function", "enables", "shadow", "mapping", "and", "sets", "the", "shadow", "map", "camera", "near", "and", "far", "range", "controlling", "which"...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRDirectLight.java#L242-L269
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java
BuildDataHelper.getCommitSHA1
@Nonnull public static ObjectId getCommitSHA1(@Nonnull Run<?, ?> build) throws IOException { List<BuildData> buildDataList = build.getActions(BuildData.class); Job<?, ?> parent = build.getParent(); BuildData buildData = calculateBuildData( parent.getName(), parent.getFullName(), buildDataList ); if (buildData == null) { throw new IOException(Messages.BuildDataHelper_NoBuildDataError()); } // buildData?.lastBuild?.marked and fall back to .revision with null check everywhere to be defensive Build b = buildData.lastBuild; if (b != null) { Revision r = b.marked; if (r == null) { r = b.revision; } if (r != null) { return r.getSha1(); } } // Nowhere to report => fail the build throw new IOException(Messages.BuildDataHelper_NoLastRevisionError()); }
java
@Nonnull public static ObjectId getCommitSHA1(@Nonnull Run<?, ?> build) throws IOException { List<BuildData> buildDataList = build.getActions(BuildData.class); Job<?, ?> parent = build.getParent(); BuildData buildData = calculateBuildData( parent.getName(), parent.getFullName(), buildDataList ); if (buildData == null) { throw new IOException(Messages.BuildDataHelper_NoBuildDataError()); } // buildData?.lastBuild?.marked and fall back to .revision with null check everywhere to be defensive Build b = buildData.lastBuild; if (b != null) { Revision r = b.marked; if (r == null) { r = b.revision; } if (r != null) { return r.getSha1(); } } // Nowhere to report => fail the build throw new IOException(Messages.BuildDataHelper_NoLastRevisionError()); }
[ "@", "Nonnull", "public", "static", "ObjectId", "getCommitSHA1", "(", "@", "Nonnull", "Run", "<", "?", ",", "?", ">", "build", ")", "throws", "IOException", "{", "List", "<", "BuildData", ">", "buildDataList", "=", "build", ".", "getActions", "(", "BuildDa...
Gets SHA1 from the build. @param build @return SHA1 of the las @throws IOException Cannot get the info about commit ID
[ "Gets", "SHA1", "from", "the", "build", "." ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java#L76-L104
Sproutigy/Java-Commons-Binary
src/main/java/com/sproutigy/commons/binary/Binary.java
Binary.toByteArray
public int toByteArray(byte[] target, int targetOffset) throws IOException { long length = length(); if ((long)targetOffset + length > Integer.MAX_VALUE) { throw new IOException("Unable to write - too big data"); } if (target.length < targetOffset + length) { throw new IOException("Insufficient target byte array size"); } if (length < 0) { length = 0; int curOffset = targetOffset; InputStream in = asStream(); try { int readbyte; while ((readbyte = in.read()) != EOF) { target[curOffset] = (byte) readbyte; curOffset++; length++; } } finally { in.close(); } } else { System.arraycopy(asByteArray(false), 0, target, targetOffset, (int)length); } return (int)length; }
java
public int toByteArray(byte[] target, int targetOffset) throws IOException { long length = length(); if ((long)targetOffset + length > Integer.MAX_VALUE) { throw new IOException("Unable to write - too big data"); } if (target.length < targetOffset + length) { throw new IOException("Insufficient target byte array size"); } if (length < 0) { length = 0; int curOffset = targetOffset; InputStream in = asStream(); try { int readbyte; while ((readbyte = in.read()) != EOF) { target[curOffset] = (byte) readbyte; curOffset++; length++; } } finally { in.close(); } } else { System.arraycopy(asByteArray(false), 0, target, targetOffset, (int)length); } return (int)length; }
[ "public", "int", "toByteArray", "(", "byte", "[", "]", "target", ",", "int", "targetOffset", ")", "throws", "IOException", "{", "long", "length", "=", "length", "(", ")", ";", "if", "(", "(", "long", ")", "targetOffset", "+", "length", ">", "Integer", ...
Writes data to some existing byte array starting from specific offset @param target byte array destination @param targetOffset destination offset to start @return length of source (written) data @throws IOException
[ "Writes", "data", "to", "some", "existing", "byte", "array", "starting", "from", "specific", "offset" ]
train
https://github.com/Sproutigy/Java-Commons-Binary/blob/547ab53d16e454d53ed5cef1d1ee514ec2d7c726/src/main/java/com/sproutigy/commons/binary/Binary.java#L264-L293
rzwitserloot/lombok
src/core/lombok/javac/HandlerLibrary.java
HandlerLibrary.loadAnnotationHandlers
@SuppressWarnings({"rawtypes", "unchecked"}) private static void loadAnnotationHandlers(HandlerLibrary lib, Trees trees) throws IOException { //No, that seemingly superfluous reference to JavacAnnotationHandler's classloader is not in fact superfluous! for (JavacAnnotationHandler handler : SpiLoadUtil.findServices(JavacAnnotationHandler.class, JavacAnnotationHandler.class.getClassLoader())) { handler.setTrees(trees); Class<? extends Annotation> annotationClass = handler.getAnnotationHandledByThisHandler(); AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass); String annotationClassName = container.annotationClass.getName().replace("$", "."); List<AnnotationHandlerContainer<?>> list = lib.annotationHandlers.get(annotationClassName); if (list == null) lib.annotationHandlers.put(annotationClassName, list = new ArrayList<AnnotationHandlerContainer<?>>(1)); list.add(container); lib.typeLibrary.addType(container.annotationClass.getName()); } }
java
@SuppressWarnings({"rawtypes", "unchecked"}) private static void loadAnnotationHandlers(HandlerLibrary lib, Trees trees) throws IOException { //No, that seemingly superfluous reference to JavacAnnotationHandler's classloader is not in fact superfluous! for (JavacAnnotationHandler handler : SpiLoadUtil.findServices(JavacAnnotationHandler.class, JavacAnnotationHandler.class.getClassLoader())) { handler.setTrees(trees); Class<? extends Annotation> annotationClass = handler.getAnnotationHandledByThisHandler(); AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass); String annotationClassName = container.annotationClass.getName().replace("$", "."); List<AnnotationHandlerContainer<?>> list = lib.annotationHandlers.get(annotationClassName); if (list == null) lib.annotationHandlers.put(annotationClassName, list = new ArrayList<AnnotationHandlerContainer<?>>(1)); list.add(container); lib.typeLibrary.addType(container.annotationClass.getName()); } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "static", "void", "loadAnnotationHandlers", "(", "HandlerLibrary", "lib", ",", "Trees", "trees", ")", "throws", "IOException", "{", "//No, that seemingly superfluous reference ...
Uses SPI Discovery to find implementations of {@link JavacAnnotationHandler}.
[ "Uses", "SPI", "Discovery", "to", "find", "implementations", "of", "{" ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/HandlerLibrary.java#L178-L191