repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
elki-project/elki
addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java
XSplitter.generateSplitSorting
private SplitSorting generateSplitSorting(int[] entrySorting, int limit) { List<SpatialEntry> sorting = new ArrayList<>(); for(int i = 0; i < node.getNumEntries(); i++) { sorting.add(node.getEntry(entrySorting[i])); } return new SplitSorting(sorting, limit, splitAxis); }
java
private SplitSorting generateSplitSorting(int[] entrySorting, int limit) { List<SpatialEntry> sorting = new ArrayList<>(); for(int i = 0; i < node.getNumEntries(); i++) { sorting.add(node.getEntry(entrySorting[i])); } return new SplitSorting(sorting, limit, splitAxis); }
[ "private", "SplitSorting", "generateSplitSorting", "(", "int", "[", "]", "entrySorting", ",", "int", "limit", ")", "{", "List", "<", "SpatialEntry", ">", "sorting", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i...
Generate the split sorting for a given sorting of entry positions using the given split position <code>limit</code>. All entries referenced by <code>entrySorting</code> from <code>0</code> to <code>limit-1</code> are put into the first list (<code>ret[0]</code>), the other entries are put into the second list (<code>ret[1]</code>). @param entrySorting entry sorting @param limit split point @return the split sorting for the given sorting and split point
[ "Generate", "the", "split", "sorting", "for", "a", "given", "sorting", "of", "entry", "positions", "using", "the", "given", "split", "position", "<code", ">", "limit<", "/", "code", ">", ".", "All", "entries", "referenced", "by", "<code", ">", "entrySorting<...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java#L606-L612
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java
StoredPaymentChannelClientStates.putChannel
private void putChannel(final StoredClientChannel channel, boolean updateWallet) { lock.lock(); try { mapChannels.put(channel.id, channel); channelTimeoutHandler.schedule(new TimerTask() { @Override public void run() { try { TransactionBroadcaster announcePeerGroup = getAnnouncePeerGroup(); removeChannel(channel); announcePeerGroup.broadcastTransaction(channel.contract); announcePeerGroup.broadcastTransaction(channel.refund); } catch (Exception e) { // Something went wrong closing the channel - we catch // here or else we take down the whole Timer. log.error("Auto-closing channel failed", e); } } // Add the difference between real time and Utils.now() so that test-cases can use a mock clock. }, new Date(channel.expiryTimeSeconds() * 1000 + (System.currentTimeMillis() - Utils.currentTimeMillis()))); } finally { lock.unlock(); } if (updateWallet) updatedChannel(channel); }
java
private void putChannel(final StoredClientChannel channel, boolean updateWallet) { lock.lock(); try { mapChannels.put(channel.id, channel); channelTimeoutHandler.schedule(new TimerTask() { @Override public void run() { try { TransactionBroadcaster announcePeerGroup = getAnnouncePeerGroup(); removeChannel(channel); announcePeerGroup.broadcastTransaction(channel.contract); announcePeerGroup.broadcastTransaction(channel.refund); } catch (Exception e) { // Something went wrong closing the channel - we catch // here or else we take down the whole Timer. log.error("Auto-closing channel failed", e); } } // Add the difference between real time and Utils.now() so that test-cases can use a mock clock. }, new Date(channel.expiryTimeSeconds() * 1000 + (System.currentTimeMillis() - Utils.currentTimeMillis()))); } finally { lock.unlock(); } if (updateWallet) updatedChannel(channel); }
[ "private", "void", "putChannel", "(", "final", "StoredClientChannel", "channel", ",", "boolean", "updateWallet", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "mapChannels", ".", "put", "(", "channel", ".", "id", ",", "channel", ")", ";", "ch...
Adds this channel and optionally notifies the wallet of an update to this extension (used during deserialize)
[ "Adds", "this", "channel", "and", "optionally", "notifies", "the", "wallet", "of", "an", "update", "to", "this", "extension", "(", "used", "during", "deserialize", ")" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L214-L239
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsNotification.java
CmsNotification.sendAlert
public void sendAlert(Type type, String message) { CmsNotificationMessage notificationMessage = new CmsNotificationMessage(Mode.BROADCAST, type, message); m_messages.add(notificationMessage); if (hasWidget()) { m_widget.addMessage(notificationMessage); } }
java
public void sendAlert(Type type, String message) { CmsNotificationMessage notificationMessage = new CmsNotificationMessage(Mode.BROADCAST, type, message); m_messages.add(notificationMessage); if (hasWidget()) { m_widget.addMessage(notificationMessage); } }
[ "public", "void", "sendAlert", "(", "Type", "type", ",", "String", "message", ")", "{", "CmsNotificationMessage", "notificationMessage", "=", "new", "CmsNotificationMessage", "(", "Mode", ".", "BROADCAST", ",", "type", ",", "message", ")", ";", "m_messages", "."...
Sends a new blocking alert notification that can be closed by the user.<p> @param type the notification type @param message the message
[ "Sends", "a", "new", "blocking", "alert", "notification", "that", "can", "be", "closed", "by", "the", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsNotification.java#L174-L181
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/meta/RescaleMetaOutlierAlgorithm.java
RescaleMetaOutlierAlgorithm.getOutlierResult
private OutlierResult getOutlierResult(ResultHierarchy hier, Result result) { List<OutlierResult> ors = ResultUtil.filterResults(hier, result, OutlierResult.class); if(!ors.isEmpty()) { return ors.get(0); } throw new IllegalStateException("Comparison algorithm expected at least one outlier result."); }
java
private OutlierResult getOutlierResult(ResultHierarchy hier, Result result) { List<OutlierResult> ors = ResultUtil.filterResults(hier, result, OutlierResult.class); if(!ors.isEmpty()) { return ors.get(0); } throw new IllegalStateException("Comparison algorithm expected at least one outlier result."); }
[ "private", "OutlierResult", "getOutlierResult", "(", "ResultHierarchy", "hier", ",", "Result", "result", ")", "{", "List", "<", "OutlierResult", ">", "ors", "=", "ResultUtil", ".", "filterResults", "(", "hier", ",", "result", ",", "OutlierResult", ".", "class", ...
Find an OutlierResult to work with. @param hier Result hierarchy @param result Result object @return Iterator to work with
[ "Find", "an", "OutlierResult", "to", "work", "with", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/meta/RescaleMetaOutlierAlgorithm.java#L126-L132
microfocus-idol/haven-search-components
idol/src/main/java/com/hp/autonomy/searchcomponents/idol/view/IdolViewServerServiceImpl.java
IdolViewServerServiceImpl.viewDocument
@Override public void viewDocument(final IdolViewRequest request, final OutputStream outputStream) throws ViewDocumentNotFoundException, IOException { final ViewConfig viewConfig = configService.getConfig().getViewConfig(); if (viewConfig.getViewingMode() == ViewingMode.UNIVERSAL) { final AciParameters viewParameters = new AciParameters(ViewActions.View.name()); parameterHandler.addViewParameters(viewParameters, request.getDocumentReference(), request); try { viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream)); return; } catch (final AciServiceException e) { throw new ViewServerErrorException(request.getDocumentReference(), e); } } // Only fetch the minimum necessary information to know if we should use View, Connector, or DRECONTENT rendering. final PrintFields printFields = new PrintFields(AUTN_IDENTIFIER, AUTN_GROUP); final String refField = viewConfig.getReferenceField(); if(StringUtils.isNotBlank(refField)) { printFields.append(refField); } final Hit document = loadDocument(request.getDocumentReference(), request.getDatabase(), printFields, null); final Optional<String> maybeUrl = readViewUrl(document); if (maybeUrl.isPresent()) { final AciParameters viewParameters = new AciParameters(ViewActions.View.name()); parameterHandler.addViewParameters(viewParameters, maybeUrl.get(), request); try { viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream)); } catch (final AciServiceException e) { throw new ViewServerErrorException(request.getDocumentReference(), e); } } else { // We need to fetch the DRECONTENT if we have to use the DRECONTENT rendering fallback. final Hit docContent = loadDocument(request.getDocumentReference(), request.getDatabase(), new PrintFields(CONTENT_FIELD), request.getHighlightExpression()); final String content = parseFieldValue(docContent, CONTENT_FIELD).orElse(""); final RawDocument rawDocument = RawDocument.builder() .reference(document.getReference()) .title(document.getTitle()) .content(content) .build(); try (final InputStream inputStream = rawContentViewer.formatRawContent(rawDocument)) { IOUtils.copy(inputStream, outputStream); } } }
java
@Override public void viewDocument(final IdolViewRequest request, final OutputStream outputStream) throws ViewDocumentNotFoundException, IOException { final ViewConfig viewConfig = configService.getConfig().getViewConfig(); if (viewConfig.getViewingMode() == ViewingMode.UNIVERSAL) { final AciParameters viewParameters = new AciParameters(ViewActions.View.name()); parameterHandler.addViewParameters(viewParameters, request.getDocumentReference(), request); try { viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream)); return; } catch (final AciServiceException e) { throw new ViewServerErrorException(request.getDocumentReference(), e); } } // Only fetch the minimum necessary information to know if we should use View, Connector, or DRECONTENT rendering. final PrintFields printFields = new PrintFields(AUTN_IDENTIFIER, AUTN_GROUP); final String refField = viewConfig.getReferenceField(); if(StringUtils.isNotBlank(refField)) { printFields.append(refField); } final Hit document = loadDocument(request.getDocumentReference(), request.getDatabase(), printFields, null); final Optional<String> maybeUrl = readViewUrl(document); if (maybeUrl.isPresent()) { final AciParameters viewParameters = new AciParameters(ViewActions.View.name()); parameterHandler.addViewParameters(viewParameters, maybeUrl.get(), request); try { viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream)); } catch (final AciServiceException e) { throw new ViewServerErrorException(request.getDocumentReference(), e); } } else { // We need to fetch the DRECONTENT if we have to use the DRECONTENT rendering fallback. final Hit docContent = loadDocument(request.getDocumentReference(), request.getDatabase(), new PrintFields(CONTENT_FIELD), request.getHighlightExpression()); final String content = parseFieldValue(docContent, CONTENT_FIELD).orElse(""); final RawDocument rawDocument = RawDocument.builder() .reference(document.getReference()) .title(document.getTitle()) .content(content) .build(); try (final InputStream inputStream = rawContentViewer.formatRawContent(rawDocument)) { IOUtils.copy(inputStream, outputStream); } } }
[ "@", "Override", "public", "void", "viewDocument", "(", "final", "IdolViewRequest", "request", ",", "final", "OutputStream", "outputStream", ")", "throws", "ViewDocumentNotFoundException", ",", "IOException", "{", "final", "ViewConfig", "viewConfig", "=", "configService...
Provides an HTML rendering of the given IDOL document reference. This first performs a GetContent to make sure the document exists, then reads the configured reference field and passes the value of the field to ViewServer. @param request options @param outputStream The ViewServer output @throws ViewDocumentNotFoundException If the given document reference does not exist in IDOL @throws ViewServerErrorException If ViewServer returns a status code outside the 200 range
[ "Provides", "an", "HTML", "rendering", "of", "the", "given", "IDOL", "document", "reference", ".", "This", "first", "performs", "a", "GetContent", "to", "make", "sure", "the", "document", "exists", "then", "reads", "the", "configured", "reference", "field", "a...
train
https://github.com/microfocus-idol/haven-search-components/blob/6f5df74ba67ec0d3f86e73bc1dd0d6edd01a8e44/idol/src/main/java/com/hp/autonomy/searchcomponents/idol/view/IdolViewServerServiceImpl.java#L93-L144
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/VarSet.java
VarSet.getVarConfigAsArray
public void getVarConfigAsArray(int configIndex, int[] putInto) { if(putInto.length != this.size()) throw new IllegalArgumentException(); int i = putInto.length - 1; for (int v=this.size()-1; v >= 0; v--) { Var var = this.get(v); putInto[i--] = configIndex % var.getNumStates(); configIndex /= var.getNumStates(); } }
java
public void getVarConfigAsArray(int configIndex, int[] putInto) { if(putInto.length != this.size()) throw new IllegalArgumentException(); int i = putInto.length - 1; for (int v=this.size()-1; v >= 0; v--) { Var var = this.get(v); putInto[i--] = configIndex % var.getNumStates(); configIndex /= var.getNumStates(); } }
[ "public", "void", "getVarConfigAsArray", "(", "int", "configIndex", ",", "int", "[", "]", "putInto", ")", "{", "if", "(", "putInto", ".", "length", "!=", "this", ".", "size", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "int"...
this is the "no-allocation" version of the non-void method of the same name.
[ "this", "is", "the", "no", "-", "allocation", "version", "of", "the", "non", "-", "void", "method", "of", "the", "same", "name", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/VarSet.java#L140-L149
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java
Activator.commitBean
public void commitBean(ContainerTx tx, BeanO bean) { bean.getActivationStrategy().atCommit(tx, bean); }
java
public void commitBean(ContainerTx tx, BeanO bean) { bean.getActivationStrategy().atCommit(tx, bean); }
[ "public", "void", "commitBean", "(", "ContainerTx", "tx", ",", "BeanO", "bean", ")", "{", "bean", ".", "getActivationStrategy", "(", ")", ".", "atCommit", "(", "tx", ",", "bean", ")", ";", "}" ]
Perform commit-time processing for the specified transaction and bean. This method should be called for each bean which was participating in a transaction which was successfully committed. The transaction-local instance of the bean is removed from the cache, and any necessary reconciliation between that instance and the master instance is done (e.g. if the bean was removed during the transaction, the master instance is also removed from the cache). <p> @param tx The transaction which just committed @param bean The BeanId of the bean
[ "Perform", "commit", "-", "time", "processing", "for", "the", "specified", "transaction", "and", "bean", ".", "This", "method", "should", "be", "called", "for", "each", "bean", "which", "was", "participating", "in", "a", "transaction", "which", "was", "success...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L387-L390
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/BinaryIntExpressionHelper.java
BinaryIntExpressionHelper.writeStdCompare
protected boolean writeStdCompare(int type, boolean simulate) { type = type-COMPARE_NOT_EQUAL; // look if really compare if (type<0||type>7) return false; if (!simulate) { MethodVisitor mv = getController().getMethodVisitor(); OperandStack operandStack = getController().getOperandStack(); // operands are on the stack already int bytecode = stdCompareCodes[type]; Label l1 = new Label(); mv.visitJumpInsn(bytecode,l1); mv.visitInsn(ICONST_1); Label l2 = new Label(); mv.visitJumpInsn(GOTO, l2); mv.visitLabel(l1); mv.visitInsn(ICONST_0); mv.visitLabel(l2); operandStack.replace(ClassHelper.boolean_TYPE, 2); } return true; }
java
protected boolean writeStdCompare(int type, boolean simulate) { type = type-COMPARE_NOT_EQUAL; // look if really compare if (type<0||type>7) return false; if (!simulate) { MethodVisitor mv = getController().getMethodVisitor(); OperandStack operandStack = getController().getOperandStack(); // operands are on the stack already int bytecode = stdCompareCodes[type]; Label l1 = new Label(); mv.visitJumpInsn(bytecode,l1); mv.visitInsn(ICONST_1); Label l2 = new Label(); mv.visitJumpInsn(GOTO, l2); mv.visitLabel(l1); mv.visitInsn(ICONST_0); mv.visitLabel(l2); operandStack.replace(ClassHelper.boolean_TYPE, 2); } return true; }
[ "protected", "boolean", "writeStdCompare", "(", "int", "type", ",", "boolean", "simulate", ")", "{", "type", "=", "type", "-", "COMPARE_NOT_EQUAL", ";", "// look if really compare", "if", "(", "type", "<", "0", "||", "type", ">", "7", ")", "return", "false",...
writes a std compare. This involves the tokens IF_ICMPEQ, IF_ICMPNE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE and IF_ICMPLT @param type the token type @return true if a successful std compare write
[ "writes", "a", "std", "compare", ".", "This", "involves", "the", "tokens", "IF_ICMPEQ", "IF_ICMPNE", "IF_ICMPEQ", "IF_ICMPNE", "IF_ICMPGE", "IF_ICMPGT", "IF_ICMPLE", "and", "IF_ICMPLT" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BinaryIntExpressionHelper.java#L145-L166
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/WhitelistingApi.java
WhitelistingApi.getWhitelist
public WhitelistResultEnvelope getWhitelist(String dtid, Integer count, Integer offset) throws ApiException { ApiResponse<WhitelistResultEnvelope> resp = getWhitelistWithHttpInfo(dtid, count, offset); return resp.getData(); }
java
public WhitelistResultEnvelope getWhitelist(String dtid, Integer count, Integer offset) throws ApiException { ApiResponse<WhitelistResultEnvelope> resp = getWhitelistWithHttpInfo(dtid, count, offset); return resp.getData(); }
[ "public", "WhitelistResultEnvelope", "getWhitelist", "(", "String", "dtid", ",", "Integer", "count", ",", "Integer", "offset", ")", "throws", "ApiException", "{", "ApiResponse", "<", "WhitelistResultEnvelope", ">", "resp", "=", "getWhitelistWithHttpInfo", "(", "dtid",...
Get whitelisted vdids of a device type. Get whitelisted vdids of a device type. @param dtid Device Type ID. (required) @param count Max results count. (optional) @param offset Result starting offset. (optional) @return WhitelistResultEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "whitelisted", "vdids", "of", "a", "device", "type", ".", "Get", "whitelisted", "vdids", "of", "a", "device", "type", "." ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/WhitelistingApi.java#L785-L788
jnr/jnr-x86asm
src/main/java/jnr/x86asm/SerializerIntrinsics.java
SerializerIntrinsics.pcmpistrm
public final void pcmpistrm(XMMRegister dst, XMMRegister src, Immediate imm8) { emitX86(INST_PCMPISTRM, dst, src, imm8); }
java
public final void pcmpistrm(XMMRegister dst, XMMRegister src, Immediate imm8) { emitX86(INST_PCMPISTRM, dst, src, imm8); }
[ "public", "final", "void", "pcmpistrm", "(", "XMMRegister", "dst", ",", "XMMRegister", "src", ",", "Immediate", "imm8", ")", "{", "emitX86", "(", "INST_PCMPISTRM", ",", "dst", ",", "src", ",", "imm8", ")", ";", "}" ]
Packed Compare Implicit Length Strings, Return Mask (SSE4.2).
[ "Packed", "Compare", "Implicit", "Length", "Strings", "Return", "Mask", "(", "SSE4", ".", "2", ")", "." ]
train
https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/SerializerIntrinsics.java#L6562-L6565
UrielCh/ovh-java-sdk
ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java
ApiOvhCaascontainers.serviceName_registry_credentials_credentialsId_PUT
public OvhRegistryCredentials serviceName_registry_credentials_credentialsId_PUT(String serviceName, String credentialsId, OvhInputCustomSsl body) throws IOException { String qPath = "/caas/containers/{serviceName}/registry/credentials/{credentialsId}"; StringBuilder sb = path(qPath, serviceName, credentialsId); String resp = exec(qPath, "PUT", sb.toString(), body); return convertTo(resp, OvhRegistryCredentials.class); }
java
public OvhRegistryCredentials serviceName_registry_credentials_credentialsId_PUT(String serviceName, String credentialsId, OvhInputCustomSsl body) throws IOException { String qPath = "/caas/containers/{serviceName}/registry/credentials/{credentialsId}"; StringBuilder sb = path(qPath, serviceName, credentialsId); String resp = exec(qPath, "PUT", sb.toString(), body); return convertTo(resp, OvhRegistryCredentials.class); }
[ "public", "OvhRegistryCredentials", "serviceName_registry_credentials_credentialsId_PUT", "(", "String", "serviceName", ",", "String", "credentialsId", ",", "OvhInputCustomSsl", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/containers/{serviceName}...
Update the registry credentials. REST: PUT /caas/containers/{serviceName}/registry/credentials/{credentialsId} @param body [required] Credentials providing authentication to an external registry @param credentialsId [required] credentials id @param serviceName [required] service name API beta
[ "Update", "the", "registry", "credentials", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java#L279-L284
headius/invokebinder
src/main/java/com/headius/invokebinder/SmartBinder.java
SmartBinder.invokeVirtual
public SmartHandle invokeVirtual(Lookup lookup, String name) throws NoSuchMethodException, IllegalAccessException { return new SmartHandle(start, binder.invokeVirtual(lookup, name)); }
java
public SmartHandle invokeVirtual(Lookup lookup, String name) throws NoSuchMethodException, IllegalAccessException { return new SmartHandle(start, binder.invokeVirtual(lookup, name)); }
[ "public", "SmartHandle", "invokeVirtual", "(", "Lookup", "lookup", ",", "String", "name", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", "{", "return", "new", "SmartHandle", "(", "start", ",", "binder", ".", "invokeVirtual", "(", "lookup", ...
Terminate this binder by looking up the named virtual method on the first argument's type. Perform the actual method lookup using the given Lookup object. @param lookup the Lookup to use for handle lookups @param name the name of the target virtual method @return a SmartHandle with this binder's starting signature, bound to the target method @throws NoSuchMethodException if the named method with current signature's types does not exist @throws IllegalAccessException if the named method is not accessible to the given Lookup
[ "Terminate", "this", "binder", "by", "looking", "up", "the", "named", "virtual", "method", "on", "the", "first", "argument", "s", "type", ".", "Perform", "the", "actual", "method", "lookup", "using", "the", "given", "Lookup", "object", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L981-L983
apache/groovy
src/main/groovy/groovy/transform/stc/ClosureSignatureHint.java
ClosureSignatureHint.findClassNode
protected ClassNode findClassNode(final SourceUnit sourceUnit, final CompilationUnit compilationUnit, final String className) { if (className.endsWith("[]")) { return findClassNode(sourceUnit, compilationUnit, className.substring(0, className.length() - 2)).makeArray(); } ClassNode cn = compilationUnit.getClassNode(className); if (cn == null) { try { cn = ClassHelper.make(Class.forName(className, false, sourceUnit.getClassLoader())); } catch (ClassNotFoundException e) { cn = ClassHelper.make(className); } } return cn; }
java
protected ClassNode findClassNode(final SourceUnit sourceUnit, final CompilationUnit compilationUnit, final String className) { if (className.endsWith("[]")) { return findClassNode(sourceUnit, compilationUnit, className.substring(0, className.length() - 2)).makeArray(); } ClassNode cn = compilationUnit.getClassNode(className); if (cn == null) { try { cn = ClassHelper.make(Class.forName(className, false, sourceUnit.getClassLoader())); } catch (ClassNotFoundException e) { cn = ClassHelper.make(className); } } return cn; }
[ "protected", "ClassNode", "findClassNode", "(", "final", "SourceUnit", "sourceUnit", ",", "final", "CompilationUnit", "compilationUnit", ",", "final", "String", "className", ")", "{", "if", "(", "className", ".", "endsWith", "(", "\"[]\"", ")", ")", "{", "return...
Finds a class node given a string representing the type. Performs a lookup in the compilation unit to check if it is done in the same source unit. @param sourceUnit source unit @param compilationUnit compilation unit @param className the name of the class we want to get a {@link org.codehaus.groovy.ast.ClassNode} for @return a ClassNode representing the type
[ "Finds", "a", "class", "node", "given", "a", "string", "representing", "the", "type", ".", "Performs", "a", "lookup", "in", "the", "compilation", "unit", "to", "check", "if", "it", "is", "done", "in", "the", "same", "source", "unit", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/transform/stc/ClosureSignatureHint.java#L129-L142
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java
ManagementEnforcer.hasNamedGroupingPolicy
public boolean hasNamedGroupingPolicy(String ptype, List<String> params) { return model.hasPolicy("g", ptype, params); }
java
public boolean hasNamedGroupingPolicy(String ptype, List<String> params) { return model.hasPolicy("g", ptype, params); }
[ "public", "boolean", "hasNamedGroupingPolicy", "(", "String", "ptype", ",", "List", "<", "String", ">", "params", ")", "{", "return", "model", ".", "hasPolicy", "(", "\"g\"", ",", "ptype", ",", "params", ")", ";", "}" ]
hasNamedGroupingPolicy determines whether a named role inheritance rule exists. @param ptype the policy type, can be "g", "g2", "g3", .. @param params the "g" policy rule. @return whether the rule exists.
[ "hasNamedGroupingPolicy", "determines", "whether", "a", "named", "role", "inheritance", "rule", "exists", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L400-L402
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java
WaveformPreviewComponent.delegatingRepaint
@SuppressWarnings("SameParameterValue") private void delegatingRepaint(int x, int y, int width, int height) { final RepaintDelegate delegate = repaintDelegate.get(); if (delegate != null) { //logger.info("Delegating repaint: " + x + ", " + y + ", " + width + ", " + height); delegate.repaint(x, y, width, height); } else { //logger.info("Normal repaint: " + x + ", " + y + ", " + width + ", " + height); repaint(x, y, width, height); } }
java
@SuppressWarnings("SameParameterValue") private void delegatingRepaint(int x, int y, int width, int height) { final RepaintDelegate delegate = repaintDelegate.get(); if (delegate != null) { //logger.info("Delegating repaint: " + x + ", " + y + ", " + width + ", " + height); delegate.repaint(x, y, width, height); } else { //logger.info("Normal repaint: " + x + ", " + y + ", " + width + ", " + height); repaint(x, y, width, height); } }
[ "@", "SuppressWarnings", "(", "\"SameParameterValue\"", ")", "private", "void", "delegatingRepaint", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "final", "RepaintDelegate", "delegate", "=", "repaintDelegate", ".", "ge...
Determine whether we should use the normal repaint process, or delegate that to another component that is hosting us in a soft-loaded manner to save memory. @param x the left edge of the region that we want to have redrawn @param y the top edge of the region that we want to have redrawn @param width the width of the region that we want to have redrawn @param height the height of the region that we want to have redrawn
[ "Determine", "whether", "we", "should", "use", "the", "normal", "repaint", "process", "or", "delegate", "that", "to", "another", "component", "that", "is", "hosting", "us", "in", "a", "soft", "-", "loaded", "manner", "to", "save", "memory", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L225-L235
super-csv/super-csv
super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java
CsvBeanReader.invokeSetter
private static void invokeSetter(final Object bean, final Method setMethod, final Object fieldValue) { try { setMethod.setAccessible(true); setMethod.invoke(bean, fieldValue); } catch(final Exception e) { throw new SuperCsvReflectionException(String.format("error invoking method %s()", setMethod.getName()), e); } }
java
private static void invokeSetter(final Object bean, final Method setMethod, final Object fieldValue) { try { setMethod.setAccessible(true); setMethod.invoke(bean, fieldValue); } catch(final Exception e) { throw new SuperCsvReflectionException(String.format("error invoking method %s()", setMethod.getName()), e); } }
[ "private", "static", "void", "invokeSetter", "(", "final", "Object", "bean", ",", "final", "Method", "setMethod", ",", "final", "Object", "fieldValue", ")", "{", "try", "{", "setMethod", ".", "setAccessible", "(", "true", ")", ";", "setMethod", ".", "invoke"...
Invokes the setter on the bean with the supplied value. @param bean the bean @param setMethod the setter method for the field @param fieldValue the field value to set @throws SuperCsvException if there was an exception invoking the setter
[ "Invokes", "the", "setter", "on", "the", "bean", "with", "the", "supplied", "value", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java#L133-L141
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tools/Tools.java
Tools.correctText
public static String correctText(String contents, JLanguageTool lt) throws IOException { List<RuleMatch> ruleMatches = lt.check(contents); if (ruleMatches.isEmpty()) { return contents; } return correctTextFromMatches(contents, ruleMatches); }
java
public static String correctText(String contents, JLanguageTool lt) throws IOException { List<RuleMatch> ruleMatches = lt.check(contents); if (ruleMatches.isEmpty()) { return contents; } return correctTextFromMatches(contents, ruleMatches); }
[ "public", "static", "String", "correctText", "(", "String", "contents", ",", "JLanguageTool", "lt", ")", "throws", "IOException", "{", "List", "<", "RuleMatch", ">", "ruleMatches", "=", "lt", ".", "check", "(", "contents", ")", ";", "if", "(", "ruleMatches",...
Automatically applies suggestions to the text, as suggested by the rules that match. Note: if there is more than one suggestion, always the first one is applied, and others are ignored silently. @param contents String to be corrected @param lt Initialized LanguageTool object @return Corrected text as String.
[ "Automatically", "applies", "suggestions", "to", "the", "text", "as", "suggested", "by", "the", "rules", "that", "match", ".", "Note", ":", "if", "there", "is", "more", "than", "one", "suggestion", "always", "the", "first", "one", "is", "applied", "and", "...
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/Tools.java#L214-L220
audit4j/audit4j-core
src/main/java/org/audit4j/core/ValidationManager.java
ValidationManager.validateConfigurations
static void validateConfigurations(Configuration conf) throws ValidationException { if (null == conf.getHandlers()) { Log.error( "Handler should not be null, One or more handler implementation shuld be configured in the configuration", ErrorGuide.getGuide(ErrorGuide.EMPTY_HANDLERS)); throw new ValidationException("Configuration error", ValidationException.VALIDATION_LEVEL_INVALID); } if (null == conf.getLayout()) { Log.error("Layout should not be null, A layout implementation shuld be configured in the configuration", ErrorGuide.getGuide(ErrorGuide.EMPTY_LAYOUT)); throw new ValidationException("Configuration error", ValidationException.VALIDATION_LEVEL_INVALID); } }
java
static void validateConfigurations(Configuration conf) throws ValidationException { if (null == conf.getHandlers()) { Log.error( "Handler should not be null, One or more handler implementation shuld be configured in the configuration", ErrorGuide.getGuide(ErrorGuide.EMPTY_HANDLERS)); throw new ValidationException("Configuration error", ValidationException.VALIDATION_LEVEL_INVALID); } if (null == conf.getLayout()) { Log.error("Layout should not be null, A layout implementation shuld be configured in the configuration", ErrorGuide.getGuide(ErrorGuide.EMPTY_LAYOUT)); throw new ValidationException("Configuration error", ValidationException.VALIDATION_LEVEL_INVALID); } }
[ "static", "void", "validateConfigurations", "(", "Configuration", "conf", ")", "throws", "ValidationException", "{", "if", "(", "null", "==", "conf", ".", "getHandlers", "(", ")", ")", "{", "Log", ".", "error", "(", "\"Handler should not be null, One or more handler...
Validate configurations. @param conf the conf @throws ValidationException the validation exception
[ "Validate", "configurations", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/ValidationManager.java#L70-L83
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.writePredecessor
private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag) { Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink(); link.setPredecessorUID(NumberHelper.getBigInteger(taskID)); link.setType(BigInteger.valueOf(type.getValue())); link.setCrossProject(Boolean.FALSE); // SF-300: required to keep P6 happy when importing MSPDI files if (lag != null && lag.getDuration() != 0) { double linkLag = lag.getDuration(); if (lag.getUnits() != TimeUnit.PERCENT && lag.getUnits() != TimeUnit.ELAPSED_PERCENT) { linkLag = 10.0 * Duration.convertUnits(linkLag, lag.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration(); } link.setLinkLag(BigInteger.valueOf((long) linkLag)); link.setLagFormat(DatatypeConverter.printDurationTimeUnits(lag.getUnits(), false)); } else { // SF-329: default required to keep Powerproject happy when importing MSPDI files link.setLinkLag(BIGINTEGER_ZERO); link.setLagFormat(DatatypeConverter.printDurationTimeUnits(m_projectFile.getProjectProperties().getDefaultDurationUnits(), false)); } return (link); }
java
private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag) { Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink(); link.setPredecessorUID(NumberHelper.getBigInteger(taskID)); link.setType(BigInteger.valueOf(type.getValue())); link.setCrossProject(Boolean.FALSE); // SF-300: required to keep P6 happy when importing MSPDI files if (lag != null && lag.getDuration() != 0) { double linkLag = lag.getDuration(); if (lag.getUnits() != TimeUnit.PERCENT && lag.getUnits() != TimeUnit.ELAPSED_PERCENT) { linkLag = 10.0 * Duration.convertUnits(linkLag, lag.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration(); } link.setLinkLag(BigInteger.valueOf((long) linkLag)); link.setLagFormat(DatatypeConverter.printDurationTimeUnits(lag.getUnits(), false)); } else { // SF-329: default required to keep Powerproject happy when importing MSPDI files link.setLinkLag(BIGINTEGER_ZERO); link.setLagFormat(DatatypeConverter.printDurationTimeUnits(m_projectFile.getProjectProperties().getDefaultDurationUnits(), false)); } return (link); }
[ "private", "Project", ".", "Tasks", ".", "Task", ".", "PredecessorLink", "writePredecessor", "(", "Integer", "taskID", ",", "RelationType", "type", ",", "Duration", "lag", ")", "{", "Project", ".", "Tasks", ".", "Task", ".", "PredecessorLink", "link", "=", "...
This method writes a single predecessor link to the MSPDI file. @param taskID The task UID @param type The predecessor type @param lag The lag duration @return A new link to be added to the MSPDI file
[ "This", "method", "writes", "a", "single", "predecessor", "link", "to", "the", "MSPDI", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1408-L1434
petergeneric/stdlib
guice/common/src/main/java/com/peterphi/std/guice/apploader/impl/GuiceInjectorBootstrap.java
GuiceInjectorBootstrap.createInjector
public static Injector createInjector(final PropertyFile configuration, final GuiceSetup setup) { return new GuiceBuilder().withConfig(configuration).withSetup(setup).build(); }
java
public static Injector createInjector(final PropertyFile configuration, final GuiceSetup setup) { return new GuiceBuilder().withConfig(configuration).withSetup(setup).build(); }
[ "public", "static", "Injector", "createInjector", "(", "final", "PropertyFile", "configuration", ",", "final", "GuiceSetup", "setup", ")", "{", "return", "new", "GuiceBuilder", "(", ")", ".", "withConfig", "(", "configuration", ")", ".", "withSetup", "(", "setup...
Creates an Injector by taking a preloaded service.properties and a pre-constructed GuiceSetup @param properties @param setup @return
[ "Creates", "an", "Injector", "by", "taking", "a", "preloaded", "service", ".", "properties", "and", "a", "pre", "-", "constructed", "GuiceSetup" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/apploader/impl/GuiceInjectorBootstrap.java#L57-L60
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipTypeHandlerImpl.java
MembershipTypeHandlerImpl.preSave
private void preSave(MembershipType type, boolean isNew) throws Exception { for (MembershipTypeEventListener listener : listeners) { listener.preSave(type, isNew); } }
java
private void preSave(MembershipType type, boolean isNew) throws Exception { for (MembershipTypeEventListener listener : listeners) { listener.preSave(type, isNew); } }
[ "private", "void", "preSave", "(", "MembershipType", "type", ",", "boolean", "isNew", ")", "throws", "Exception", "{", "for", "(", "MembershipTypeEventListener", "listener", ":", "listeners", ")", "{", "listener", ".", "preSave", "(", "type", ",", "isNew", ")"...
Notifying listeners before membership type creation. @param type the membership which is used in create operation @param isNew true, if we have a deal with new membership type, otherwise it is false which mean update operation is in progress @throws Exception if any listener failed to handle the event
[ "Notifying", "listeners", "before", "membership", "type", "creation", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipTypeHandlerImpl.java#L465-L471
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Block.java
Block.createNextBlock
@VisibleForTesting public Block createNextBlock(Address to, long version, long time, int blockHeight) { return createNextBlock(to, version, null, time, pubkeyForTesting, FIFTY_COINS, blockHeight); }
java
@VisibleForTesting public Block createNextBlock(Address to, long version, long time, int blockHeight) { return createNextBlock(to, version, null, time, pubkeyForTesting, FIFTY_COINS, blockHeight); }
[ "@", "VisibleForTesting", "public", "Block", "createNextBlock", "(", "Address", "to", ",", "long", "version", ",", "long", "time", ",", "int", "blockHeight", ")", "{", "return", "createNextBlock", "(", "to", ",", "version", ",", "null", ",", "time", ",", "...
Returns a solved block that builds on top of this one. This exists for unit tests.
[ "Returns", "a", "solved", "block", "that", "builds", "on", "top", "of", "this", "one", ".", "This", "exists", "for", "unit", "tests", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Block.java#L945-L948
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.createVariable
public Variable createVariable(Object projectIdOrPath, String key, String value, Boolean isProtected) throws GitLabApiException { return (createVariable(projectIdOrPath, key, value, isProtected, null)); }
java
public Variable createVariable(Object projectIdOrPath, String key, String value, Boolean isProtected) throws GitLabApiException { return (createVariable(projectIdOrPath, key, value, isProtected, null)); }
[ "public", "Variable", "createVariable", "(", "Object", "projectIdOrPath", ",", "String", "key", ",", "String", "value", ",", "Boolean", "isProtected", ")", "throws", "GitLabApiException", "{", "return", "(", "createVariable", "(", "projectIdOrPath", ",", "key", ",...
Create a new project variable. <pre><code>GitLab Endpoint: POST /projects/:id/variables</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 a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required @param value the value for the variable, required @param isProtected whether the variable is protected, optional @return a Variable instance with the newly created variable @throws GitLabApiException if any exception occurs during execution
[ "Create", "a", "new", "project", "variable", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2500-L2502
aws/aws-sdk-java
aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/model/GetIdentityDkimAttributesResult.java
GetIdentityDkimAttributesResult.withDkimAttributes
public GetIdentityDkimAttributesResult withDkimAttributes(java.util.Map<String, IdentityDkimAttributes> dkimAttributes) { setDkimAttributes(dkimAttributes); return this; }
java
public GetIdentityDkimAttributesResult withDkimAttributes(java.util.Map<String, IdentityDkimAttributes> dkimAttributes) { setDkimAttributes(dkimAttributes); return this; }
[ "public", "GetIdentityDkimAttributesResult", "withDkimAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "IdentityDkimAttributes", ">", "dkimAttributes", ")", "{", "setDkimAttributes", "(", "dkimAttributes", ")", ";", "return", "this", ";", "}" ]
<p> The DKIM attributes for an email address or a domain. </p> @param dkimAttributes The DKIM attributes for an email address or a domain. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "DKIM", "attributes", "for", "an", "email", "address", "or", "a", "domain", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/model/GetIdentityDkimAttributesResult.java#L76-L79
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/resource/Delay.java
Delay.randomBetween
protected static long randomBetween(long min, long max) { if (min == max) { return min; } return ThreadLocalRandom.current().nextLong(min, max); }
java
protected static long randomBetween(long min, long max) { if (min == max) { return min; } return ThreadLocalRandom.current().nextLong(min, max); }
[ "protected", "static", "long", "randomBetween", "(", "long", "min", ",", "long", "max", ")", "{", "if", "(", "min", "==", "max", ")", "{", "return", "min", ";", "}", "return", "ThreadLocalRandom", ".", "current", "(", ")", ".", "nextLong", "(", "min", ...
Generates a random long value within {@code min} and {@code max} boundaries. @param min @param max @return a random value @see ThreadLocalRandom#nextLong(long, long)
[ "Generates", "a", "random", "long", "value", "within", "{", "@code", "min", "}", "and", "{", "@code", "max", "}", "boundaries", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/resource/Delay.java#L323-L328
lets-blade/blade
src/main/java/com/blade/mvc/RouteContext.java
RouteContext.queryInt
public Integer queryInt(String paramName, Integer defaultValue) { return this.request.queryInt(paramName, defaultValue); }
java
public Integer queryInt(String paramName, Integer defaultValue) { return this.request.queryInt(paramName, defaultValue); }
[ "public", "Integer", "queryInt", "(", "String", "paramName", ",", "Integer", "defaultValue", ")", "{", "return", "this", ".", "request", ".", "queryInt", "(", "paramName", ",", "defaultValue", ")", ";", "}" ]
Returns a request parameter for a Int type @param paramName Parameter name @param defaultValue default int value @return Return Int parameter values
[ "Returns", "a", "request", "parameter", "for", "a", "Int", "type" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L194-L196
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/RequestTrackingContextValve.java
RequestTrackingContextValve.changeRequestedSessionId
private boolean changeRequestedSessionId( final Request request, final Response response ) { /* * Check for session relocation only if a session id was requested */ if ( request.getRequestedSessionId() != null ) { String newSessionId = _sessionBackupService.changeSessionIdOnTomcatFailover( request.getRequestedSessionId() ); if ( newSessionId == null ) { newSessionId = _sessionBackupService.changeSessionIdOnMemcachedFailover( request.getRequestedSessionId() ); } if ( newSessionId != null ) { request.changeSessionId( newSessionId ); return true; } } return false; }
java
private boolean changeRequestedSessionId( final Request request, final Response response ) { /* * Check for session relocation only if a session id was requested */ if ( request.getRequestedSessionId() != null ) { String newSessionId = _sessionBackupService.changeSessionIdOnTomcatFailover( request.getRequestedSessionId() ); if ( newSessionId == null ) { newSessionId = _sessionBackupService.changeSessionIdOnMemcachedFailover( request.getRequestedSessionId() ); } if ( newSessionId != null ) { request.changeSessionId( newSessionId ); return true; } } return false; }
[ "private", "boolean", "changeRequestedSessionId", "(", "final", "Request", "request", ",", "final", "Response", "response", ")", "{", "/*\n * Check for session relocation only if a session id was requested\n */", "if", "(", "request", ".", "getRequestedSessionId",...
If there's a session for a requested session id that is taken over (tomcat failover) or that will be relocated (memcached failover), the new session id will be set (via {@link Request#changeSessionId(String)}). @param request the request @param response the response @return <code>true</code> if the id of a valid session was changed. @see Request#changeSessionId(String)
[ "If", "there", "s", "a", "session", "for", "a", "requested", "session", "id", "that", "is", "taken", "over", "(", "tomcat", "failover", ")", "or", "that", "will", "be", "relocated", "(", "memcached", "failover", ")", "the", "new", "session", "id", "will"...
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/RequestTrackingContextValve.java#L120-L138
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.updateStreamingProfile
public ApiResponse updateStreamingProfile(String name, String displayName, List<Map> representations, Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<Map> serializedRepresentations; final Map params = new HashMap(); List<String> uri = Arrays.asList("streaming_profiles", name); if (representations != null) { serializedRepresentations = new ArrayList<Map>(representations.size()); for (Map t : representations) { final Object transformation = t.get("transformation"); serializedRepresentations.add(ObjectUtils.asMap("transformation", transformation.toString())); } params.put("representations", new JSONArray(serializedRepresentations.toArray())); } if (displayName != null) { params.put("display_name", displayName); } return callApi(HttpMethod.PUT, uri, params, options); }
java
public ApiResponse updateStreamingProfile(String name, String displayName, List<Map> representations, Map options) throws Exception { if (options == null) options = ObjectUtils.emptyMap(); List<Map> serializedRepresentations; final Map params = new HashMap(); List<String> uri = Arrays.asList("streaming_profiles", name); if (representations != null) { serializedRepresentations = new ArrayList<Map>(representations.size()); for (Map t : representations) { final Object transformation = t.get("transformation"); serializedRepresentations.add(ObjectUtils.asMap("transformation", transformation.toString())); } params.put("representations", new JSONArray(serializedRepresentations.toArray())); } if (displayName != null) { params.put("display_name", displayName); } return callApi(HttpMethod.PUT, uri, params, options); }
[ "public", "ApiResponse", "updateStreamingProfile", "(", "String", "name", ",", "String", "displayName", ",", "List", "<", "Map", ">", "representations", ",", "Map", "options", ")", "throws", "Exception", "{", "if", "(", "options", "==", "null", ")", "options",...
Create a new streaming profile @param name the of the profile @param displayName the display name of the profile @param representations a collection of Maps with a transformation key @param options additional options @return the new streaming profile @throws Exception an exception
[ "Create", "a", "new", "streaming", "profile" ]
train
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L450-L469
Quickhull3d/quickhull3d
src/main/java/com/github/quickhull3d/Face.java
Face.createTriangle
public static Face createTriangle(Vertex v0, Vertex v1, Vertex v2, double minArea) { Face face = new Face(); HalfEdge he0 = new HalfEdge(v0, face); HalfEdge he1 = new HalfEdge(v1, face); HalfEdge he2 = new HalfEdge(v2, face); he0.prev = he2; he0.next = he1; he1.prev = he0; he1.next = he2; he2.prev = he1; he2.next = he0; face.he0 = he0; // compute the normal and offset face.computeNormalAndCentroid(minArea); return face; }
java
public static Face createTriangle(Vertex v0, Vertex v1, Vertex v2, double minArea) { Face face = new Face(); HalfEdge he0 = new HalfEdge(v0, face); HalfEdge he1 = new HalfEdge(v1, face); HalfEdge he2 = new HalfEdge(v2, face); he0.prev = he2; he0.next = he1; he1.prev = he0; he1.next = he2; he2.prev = he1; he2.next = he0; face.he0 = he0; // compute the normal and offset face.computeNormalAndCentroid(minArea); return face; }
[ "public", "static", "Face", "createTriangle", "(", "Vertex", "v0", ",", "Vertex", "v1", ",", "Vertex", "v2", ",", "double", "minArea", ")", "{", "Face", "face", "=", "new", "Face", "(", ")", ";", "HalfEdge", "he0", "=", "new", "HalfEdge", "(", "v0", ...
Constructs a triangule Face from vertices v0, v1, and v2. @param v0 first vertex @param v1 second vertex @param v2 third vertex
[ "Constructs", "a", "triangule", "Face", "from", "vertices", "v0", "v1", "and", "v2", "." ]
train
https://github.com/Quickhull3d/quickhull3d/blob/3f80953b86c46385e84730e5d2a1745cbfa12703/src/main/java/com/github/quickhull3d/Face.java#L108-L126
javabits/yar
yar-api/src/main/java/org/javabits/yar/TimeoutException.java
TimeoutException.newTimeoutException
public static TimeoutException newTimeoutException(String message, java.util.concurrent.TimeoutException cause) { return new TimeoutException(message, cause); }
java
public static TimeoutException newTimeoutException(String message, java.util.concurrent.TimeoutException cause) { return new TimeoutException(message, cause); }
[ "public", "static", "TimeoutException", "newTimeoutException", "(", "String", "message", ",", "java", ".", "util", ".", "concurrent", ".", "TimeoutException", "cause", ")", "{", "return", "new", "TimeoutException", "(", "message", ",", "cause", ")", ";", "}" ]
Constructs a <tt>TimeoutException</tt> with the specified detail message. @param message the detail message @param cause the original {@code TimeoutException}
[ "Constructs", "a", "<tt", ">", "TimeoutException<", "/", "tt", ">", "with", "the", "specified", "detail", "message", "." ]
train
https://github.com/javabits/yar/blob/e146a86611ca4831e8334c9a98fd7086cee9c03e/yar-api/src/main/java/org/javabits/yar/TimeoutException.java#L114-L116
beanshell/beanshell
src/main/java/bsh/NameSpace.java
NameSpace.getVariable
public Object getVariable(final String name, final boolean recurse) throws UtilEvalError { final Variable var = this.getVariableImpl(name, recurse); return this.unwrapVariable(var); }
java
public Object getVariable(final String name, final boolean recurse) throws UtilEvalError { final Variable var = this.getVariableImpl(name, recurse); return this.unwrapVariable(var); }
[ "public", "Object", "getVariable", "(", "final", "String", "name", ",", "final", "boolean", "recurse", ")", "throws", "UtilEvalError", "{", "final", "Variable", "var", "=", "this", ".", "getVariableImpl", "(", "name", ",", "recurse", ")", ";", "return", "thi...
Get the specified variable in this namespace. @param name the name @param recurse If recurse is true then we recursively search through parent namespaces for the variable. <p> Note: this method is primarily intended for use internally. If you use this method outside of the bsh package you will have to use Primitive.unwrap() to get primitive values. @return The variable value or Primitive.VOID if it is not defined. @throws UtilEvalError the util eval error @see Primitive#unwrap(Object)
[ "Get", "the", "specified", "variable", "in", "this", "namespace", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/NameSpace.java#L613-L617
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/features/FilterUtilities.java
FilterUtilities.getBboxFilter
public static Filter getBboxFilter( String attribute, BoundingBox bbox ) throws CQLException { double w = bbox.getMinX(); double e = bbox.getMaxX(); double s = bbox.getMinY(); double n = bbox.getMaxY(); return getBboxFilter(attribute, w, e, s, n); }
java
public static Filter getBboxFilter( String attribute, BoundingBox bbox ) throws CQLException { double w = bbox.getMinX(); double e = bbox.getMaxX(); double s = bbox.getMinY(); double n = bbox.getMaxY(); return getBboxFilter(attribute, w, e, s, n); }
[ "public", "static", "Filter", "getBboxFilter", "(", "String", "attribute", ",", "BoundingBox", "bbox", ")", "throws", "CQLException", "{", "double", "w", "=", "bbox", ".", "getMinX", "(", ")", ";", "double", "e", "=", "bbox", ".", "getMaxX", "(", ")", ";...
Create a bounding box filter from a bounding box. @param attribute the geometry attribute or null in the case of default "the_geom". @param bbox the {@link BoundingBox}. @return the filter. @throws CQLException
[ "Create", "a", "bounding", "box", "filter", "from", "a", "bounding", "box", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/features/FilterUtilities.java#L44-L51
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.tfLogScale
@SuppressWarnings("unchecked") public static <E, C extends Counter<E>> C tfLogScale(C c, double base) { C scaled = (C) c.getFactory().create(); for (E key : c.keySet()) { double cnt = c.getCount(key); double scaledCnt = 0.0; if (cnt > 0) { scaledCnt = 1.0 + SloppyMath.log(cnt, base); } scaled.setCount(key, scaledCnt); } return scaled; }
java
@SuppressWarnings("unchecked") public static <E, C extends Counter<E>> C tfLogScale(C c, double base) { C scaled = (C) c.getFactory().create(); for (E key : c.keySet()) { double cnt = c.getCount(key); double scaledCnt = 0.0; if (cnt > 0) { scaledCnt = 1.0 + SloppyMath.log(cnt, base); } scaled.setCount(key, scaledCnt); } return scaled; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "E", ",", "C", "extends", "Counter", "<", "E", ">", ">", "C", "tfLogScale", "(", "C", "c", ",", "double", "base", ")", "{", "C", "scaled", "=", "(", "C", ")", "c", ".", ...
Returns a new Counter which is the input counter with log tf scaling @param c The counter to scale. It is not changed @param base The base of the logarithm used for tf scaling by 1 + log tf @return A new Counter which is the argument scaled by the given scale factor.
[ "Returns", "a", "new", "Counter", "which", "is", "the", "input", "counter", "with", "log", "tf", "scaling" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1549-L1561
nemerosa/ontrack
ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BranchController.java
BranchController.connectTemplateInstance
@RequestMapping(value = "branches/{branchId}/template/connect", method = RequestMethod.POST) public Branch connectTemplateInstance(@PathVariable ID branchId, @RequestBody BranchTemplateInstanceConnectRequest request) { return branchTemplateService.connectTemplateInstance(branchId, request); }
java
@RequestMapping(value = "branches/{branchId}/template/connect", method = RequestMethod.POST) public Branch connectTemplateInstance(@PathVariable ID branchId, @RequestBody BranchTemplateInstanceConnectRequest request) { return branchTemplateService.connectTemplateInstance(branchId, request); }
[ "@", "RequestMapping", "(", "value", "=", "\"branches/{branchId}/template/connect\"", ",", "method", "=", "RequestMethod", ".", "POST", ")", "public", "Branch", "connectTemplateInstance", "(", "@", "PathVariable", "ID", "branchId", ",", "@", "RequestBody", "BranchTemp...
Tries to connect an existing branch to a template @param branchId Branch to connect
[ "Tries", "to", "connect", "an", "existing", "branch", "to", "a", "template" ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BranchController.java#L461-L464
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java
ConvertDescriptors.convertNcc
public static void convertNcc( TupleDesc_F64 input , NccFeature output ) { if( input.size() != output.size() ) throw new IllegalArgumentException("Feature lengths do not match."); double mean = 0; for (int i = 0; i < input.value.length; i++) { mean += input.value[i]; } mean /= input.value.length; double variance = 0; for( int i = 0; i < input.value.length; i++ ) { double d = output.value[i] = input.value[i] - mean; variance += d*d; } variance /= output.size(); output.mean = mean; output.sigma = Math.sqrt(variance); }
java
public static void convertNcc( TupleDesc_F64 input , NccFeature output ) { if( input.size() != output.size() ) throw new IllegalArgumentException("Feature lengths do not match."); double mean = 0; for (int i = 0; i < input.value.length; i++) { mean += input.value[i]; } mean /= input.value.length; double variance = 0; for( int i = 0; i < input.value.length; i++ ) { double d = output.value[i] = input.value[i] - mean; variance += d*d; } variance /= output.size(); output.mean = mean; output.sigma = Math.sqrt(variance); }
[ "public", "static", "void", "convertNcc", "(", "TupleDesc_F64", "input", ",", "NccFeature", "output", ")", "{", "if", "(", "input", ".", "size", "(", ")", "!=", "output", ".", "size", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Featu...
Converts a regular feature description into a NCC feature description @param input Tuple descriptor. (not modified) @param output The equivalent NCC feature. (modified)
[ "Converts", "a", "regular", "feature", "description", "into", "a", "NCC", "feature", "description" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java#L80-L100
blackfizz/EazeGraph
EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java
BaseBarChart.onSizeChanged
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); // Check if the current graph is a VerticalBarChart and set the // availableScreenSize to the chartHeight mAvailableScreenSize = this instanceof VerticalBarChart ? mGraphHeight : mGraphWidth; if(getData().size() > 0) { onDataChanged(); } }
java
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); // Check if the current graph is a VerticalBarChart and set the // availableScreenSize to the chartHeight mAvailableScreenSize = this instanceof VerticalBarChart ? mGraphHeight : mGraphWidth; if(getData().size() > 0) { onDataChanged(); } }
[ "@", "Override", "protected", "void", "onSizeChanged", "(", "int", "w", ",", "int", "h", ",", "int", "oldw", ",", "int", "oldh", ")", "{", "super", ".", "onSizeChanged", "(", "w", ",", "h", ",", "oldw", ",", "oldh", ")", ";", "// Check if the current g...
This is called during layout when the size of this view has changed. If you were just added to the view hierarchy, you're called with the old values of 0. @param w Current width of this view. @param h Current height of this view. @param oldw Old width of this view. @param oldh Old height of this view.
[ "This", "is", "called", "during", "layout", "when", "the", "size", "of", "this", "view", "has", "changed", ".", "If", "you", "were", "just", "added", "to", "the", "view", "hierarchy", "you", "re", "called", "with", "the", "old", "values", "of", "0", "....
train
https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/BaseBarChart.java#L240-L250
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cql3/MultiColumnRelation.java
MultiColumnRelation.createSingleMarkerInRelation
public static MultiColumnRelation createSingleMarkerInRelation(List<ColumnIdentifier.Raw> entities, Tuples.INRaw inMarker) { return new MultiColumnRelation(entities, Operator.IN, null, null, inMarker); }
java
public static MultiColumnRelation createSingleMarkerInRelation(List<ColumnIdentifier.Raw> entities, Tuples.INRaw inMarker) { return new MultiColumnRelation(entities, Operator.IN, null, null, inMarker); }
[ "public", "static", "MultiColumnRelation", "createSingleMarkerInRelation", "(", "List", "<", "ColumnIdentifier", ".", "Raw", ">", "entities", ",", "Tuples", ".", "INRaw", "inMarker", ")", "{", "return", "new", "MultiColumnRelation", "(", "entities", ",", "Operator",...
Creates a multi-column IN relation with a marker for the IN values. For example: "SELECT ... WHERE (a, b) IN ?" @param entities the columns on the LHS of the relation @param inMarker a single IN marker
[ "Creates", "a", "multi", "-", "column", "IN", "relation", "with", "a", "marker", "for", "the", "IN", "values", ".", "For", "example", ":", "SELECT", "...", "WHERE", "(", "a", "b", ")", "IN", "?" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cql3/MultiColumnRelation.java#L82-L85
Atmosphere/wasync
wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java
TypeResolver.resolveArgument
public static <T, I extends T> Class<?> resolveArgument(Class<I> initialType, Class<T> targetType) { return resolveArgument(resolveGenericType(initialType, targetType), initialType); }
java
public static <T, I extends T> Class<?> resolveArgument(Class<I> initialType, Class<T> targetType) { return resolveArgument(resolveGenericType(initialType, targetType), initialType); }
[ "public", "static", "<", "T", ",", "I", "extends", "T", ">", "Class", "<", "?", ">", "resolveArgument", "(", "Class", "<", "I", ">", "initialType", ",", "Class", "<", "T", ">", "targetType", ")", "{", "return", "resolveArgument", "(", "resolveGenericType...
Returns the raw class representing the type argument for the {@code targetType} resolved upwards from the {@code initialType}. If no arguments can be resolved then {@code Unknown.class} is returned. @param initialType to resolve upwards from @param targetType to resolve arguments for @return type argument for {@code initialType} else {@code null} if no type arguments are declared @throws IllegalArgumentException if more or less than one type argument is resolved for the give types
[ "Returns", "the", "raw", "class", "representing", "the", "type", "argument", "for", "the", "{", "@code", "targetType", "}", "resolved", "upwards", "from", "the", "{", "@code", "initialType", "}", ".", "If", "no", "arguments", "can", "be", "resolved", "then",...
train
https://github.com/Atmosphere/wasync/blob/0146828b2f5138d4cbb4872fcbfe7d6e1887ac14/wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java#L94-L96
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java
XmlSqlInfoBuilder.buildNormalSql
public SqlInfo buildNormalSql(String fieldText, String valueText, String suffix) { Object value = ParseHelper.parseExpressWithException(valueText, context); return super.buildNormalSql(fieldText, value, suffix); }
java
public SqlInfo buildNormalSql(String fieldText, String valueText, String suffix) { Object value = ParseHelper.parseExpressWithException(valueText, context); return super.buildNormalSql(fieldText, value, suffix); }
[ "public", "SqlInfo", "buildNormalSql", "(", "String", "fieldText", ",", "String", "valueText", ",", "String", "suffix", ")", "{", "Object", "value", "=", "ParseHelper", ".", "parseExpressWithException", "(", "valueText", ",", "context", ")", ";", "return", "supe...
构建普通类型查询的sqlInfo信息. @param fieldText 字段文本值 @param valueText 参数值 @param suffix 后缀,如:大于、等于、小于等 @return 返回SqlInfo信息
[ "构建普通类型查询的sqlInfo信息", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java#L42-L45
KyoriPowered/text
api/src/main/java/net/kyori/text/KeybindComponent.java
KeybindComponent.of
public static KeybindComponent of(final @NonNull String keybind, final @Nullable TextColor color) { return of(keybind, color, Collections.emptySet()); }
java
public static KeybindComponent of(final @NonNull String keybind, final @Nullable TextColor color) { return of(keybind, color, Collections.emptySet()); }
[ "public", "static", "KeybindComponent", "of", "(", "final", "@", "NonNull", "String", "keybind", ",", "final", "@", "Nullable", "TextColor", "color", ")", "{", "return", "of", "(", "keybind", ",", "color", ",", "Collections", ".", "emptySet", "(", ")", ")"...
Creates a keybind component with content, and optional color. @param keybind the keybind @param color the color @return the keybind component
[ "Creates", "a", "keybind", "component", "with", "content", "and", "optional", "color", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/KeybindComponent.java#L85-L87
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java
Drawable.loadSpriteTiled
public static SpriteTiled loadSpriteTiled(Media media, int tileWidth, int tileHeight) { return new SpriteTiledImpl(getMediaDpi(media), tileWidth, tileHeight); }
java
public static SpriteTiled loadSpriteTiled(Media media, int tileWidth, int tileHeight) { return new SpriteTiledImpl(getMediaDpi(media), tileWidth, tileHeight); }
[ "public", "static", "SpriteTiled", "loadSpriteTiled", "(", "Media", "media", ",", "int", "tileWidth", ",", "int", "tileHeight", ")", "{", "return", "new", "SpriteTiledImpl", "(", "getMediaDpi", "(", "media", ")", ",", "tileWidth", ",", "tileHeight", ")", ";", ...
Load a tiled sprite from a file, giving tile dimension. <p> Once created, sprite must call {@link SpriteTiled#load()} before any other operations. </p> @param media The sprite media (must not be <code>null</code>). @param tileWidth The tile width (must be strictly positive). @param tileHeight The tile height (must be strictly positive). @return The loaded tiled sprite. @throws LionEngineException If arguments are invalid or image cannot be read.
[ "Load", "a", "tiled", "sprite", "from", "a", "file", "giving", "tile", "dimension", ".", "<p", ">", "Once", "created", "sprite", "must", "call", "{", "@link", "SpriteTiled#load", "()", "}", "before", "any", "other", "operations", ".", "<", "/", "p", ">" ...
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L214-L217
TakahikoKawasaki/nv-cipher
src/main/java/com/neovisionaries/security/Utils.java
Utils.toStringUTF8
public static String toStringUTF8(byte[] input) { if (input == null) { return null; } try { return new String(input, "UTF-8"); } catch (UnsupportedEncodingException e) { // This won't happen. return null; } }
java
public static String toStringUTF8(byte[] input) { if (input == null) { return null; } try { return new String(input, "UTF-8"); } catch (UnsupportedEncodingException e) { // This won't happen. return null; } }
[ "public", "static", "String", "toStringUTF8", "(", "byte", "[", "]", "input", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "new", "String", "(", "input", ",", "\"UTF-8\"", ")", ";", "}", "c...
Build a {@code String} instance by {@code new String(input, "UTF-8")}.
[ "Build", "a", "{" ]
train
https://github.com/TakahikoKawasaki/nv-cipher/blob/d01aa4f53611e2724ae03633060f55bacf549175/src/main/java/com/neovisionaries/security/Utils.java#L62-L78
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java
DatePickerSettings.setColor
public void setColor(DateArea area, Color color) { // If null was supplied, then use the default color. if (color == null) { color = area.defaultColor; } // Save the color to the color map. colors.put(area, color); // Call any "updating functions" that are appropriate for the specified area. switch (area) { case BackgroundMonthAndYearMenuLabels: case BackgroundTodayLabel: case BackgroundClearLabel: if (parentCalendarPanel != null) { parentCalendarPanel.zSetAllLabelIndicatorColorsToDefaultState(); } break; default: if (parentDatePicker != null) { parentDatePicker.zDrawTextFieldIndicators(); } zDrawIndependentCalendarPanelIfNeeded(); } }
java
public void setColor(DateArea area, Color color) { // If null was supplied, then use the default color. if (color == null) { color = area.defaultColor; } // Save the color to the color map. colors.put(area, color); // Call any "updating functions" that are appropriate for the specified area. switch (area) { case BackgroundMonthAndYearMenuLabels: case BackgroundTodayLabel: case BackgroundClearLabel: if (parentCalendarPanel != null) { parentCalendarPanel.zSetAllLabelIndicatorColorsToDefaultState(); } break; default: if (parentDatePicker != null) { parentDatePicker.zDrawTextFieldIndicators(); } zDrawIndependentCalendarPanelIfNeeded(); } }
[ "public", "void", "setColor", "(", "DateArea", "area", ",", "Color", "color", ")", "{", "// If null was supplied, then use the default color.", "if", "(", "color", "==", "null", ")", "{", "color", "=", "area", ".", "defaultColor", ";", "}", "// Save the color to t...
setColor, This sets a color for the specified area. Setting an area to null will restore the default color for that area.
[ "setColor", "This", "sets", "a", "color", "for", "the", "specified", "area", ".", "Setting", "an", "area", "to", "null", "will", "restore", "the", "default", "color", "for", "that", "area", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java#L1317-L1339
unbescape/unbescape
src/main/java/org/unbescape/csv/CsvEscape.java
CsvEscape.unescapeCsv
public static void unescapeCsv(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } CsvEscapeUtil.unescape(text, offset, len, writer); }
java
public static void unescapeCsv(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } CsvEscapeUtil.unescape(text, offset, len, writer); }
[ "public", "static", "void", "unescapeCsv", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "...
<p> Perform a CSV <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "CSV", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/csv/CsvEscape.java#L330-L351
kmbulebu/dsc-it100-java
src/main/java/com/github/kmbulebu/dsc/it100/ConfigurationBuilder.java
ConfigurationBuilder.withRemoteSocket
public ConfigurationBuilder withRemoteSocket(String host, int port) { configuration.connector = new NioSocketConnector(); configuration.address = new InetSocketAddress(host, port); return this; }
java
public ConfigurationBuilder withRemoteSocket(String host, int port) { configuration.connector = new NioSocketConnector(); configuration.address = new InetSocketAddress(host, port); return this; }
[ "public", "ConfigurationBuilder", "withRemoteSocket", "(", "String", "host", ",", "int", "port", ")", "{", "configuration", ".", "connector", "=", "new", "NioSocketConnector", "(", ")", ";", "configuration", ".", "address", "=", "new", "InetSocketAddress", "(", ...
Use a TCP connection for remotely connecting to the IT-100. Typically used with a utility such as ser2net for connecting to a remote serial port. @param host Hostname or IP address of the remote device. @param port TCP port of the remote device. @return This builder instance.
[ "Use", "a", "TCP", "connection", "for", "remotely", "connecting", "to", "the", "IT", "-", "100", "." ]
train
https://github.com/kmbulebu/dsc-it100-java/blob/69c170ba50c870cce6dbbe04b488c6b1c6a0e10f/src/main/java/com/github/kmbulebu/dsc/it100/ConfigurationBuilder.java#L38-L42
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.server/src/com/ibm/ws/jaxrs20/server/LibertyJaxRsInvoker.java
LibertyJaxRsInvoker.performInvocation
@Override protected Object performInvocation(Exchange exchange, Object serviceObject, Method m, Object[] paramArray) throws Exception { paramArray = insertExchange(m, paramArray, exchange); return this.libertyJaxRsServerFactoryBean.performInvocation(exchange, serviceObject, m, paramArray); }
java
@Override protected Object performInvocation(Exchange exchange, Object serviceObject, Method m, Object[] paramArray) throws Exception { paramArray = insertExchange(m, paramArray, exchange); return this.libertyJaxRsServerFactoryBean.performInvocation(exchange, serviceObject, m, paramArray); }
[ "@", "Override", "protected", "Object", "performInvocation", "(", "Exchange", "exchange", ",", "Object", "serviceObject", ",", "Method", "m", ",", "Object", "[", "]", "paramArray", ")", "throws", "Exception", "{", "paramArray", "=", "insertExchange", "(", "m", ...
using LibertyJaxRsServerFactoryBean.performInvocation to support POJO, EJB, CDI resource
[ "using", "LibertyJaxRsServerFactoryBean", ".", "performInvocation", "to", "support", "POJO", "EJB", "CDI", "resource" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.server/src/com/ibm/ws/jaxrs20/server/LibertyJaxRsInvoker.java#L157-L161
Tirasa/ADSDDL
src/main/java/net/tirasa/adsddl/ntsd/dacl/DACLAssertor.java
DACLAssertor.isAceExcluded
private boolean isAceExcluded(final List<AceFlag> aceFlags, final AceFlag excludedFlag) { boolean res = false; if (excludedFlag != null) { // aceFlags could be null if the ACE applies to 'this object only' and has no other flags set if (aceFlags != null && !aceFlags.isEmpty() && aceFlags.contains(excludedFlag)) { res = true; } } LOG.debug("isAceExcluded, result: {}", res); return res; }
java
private boolean isAceExcluded(final List<AceFlag> aceFlags, final AceFlag excludedFlag) { boolean res = false; if (excludedFlag != null) { // aceFlags could be null if the ACE applies to 'this object only' and has no other flags set if (aceFlags != null && !aceFlags.isEmpty() && aceFlags.contains(excludedFlag)) { res = true; } } LOG.debug("isAceExcluded, result: {}", res); return res; }
[ "private", "boolean", "isAceExcluded", "(", "final", "List", "<", "AceFlag", ">", "aceFlags", ",", "final", "AceFlag", "excludedFlag", ")", "{", "boolean", "res", "=", "false", ";", "if", "(", "excludedFlag", "!=", "null", ")", "{", "// aceFlags could be null ...
Checks whether the AceFlags attribute of the ACE contains the given AceFlag of the AceAssertion. If the {@code excludedFlag} is null, or the {@code aceFlags} are null (or empty), or are non-null and do DO NOT contain the excluded flag, a false result is returned. Otherwise, a true result is returned. @param aceFlags list of AceFlags from the ACE @param excludedFlag AceFlag disallowed by the AceAssertion (e.g., {@code AceFlag.INHERIT_ONLY_ACE}) @return true if AceFlags is excluded, false if not
[ "Checks", "whether", "the", "AceFlags", "attribute", "of", "the", "ACE", "contains", "the", "given", "AceFlag", "of", "the", "AceAssertion", ".", "If", "the", "{", "@code", "excludedFlag", "}", "is", "null", "or", "the", "{", "@code", "aceFlags", "}", "are...
train
https://github.com/Tirasa/ADSDDL/blob/16dad53e1222c7faa904c64394af94ba18f6d09c/src/main/java/net/tirasa/adsddl/ntsd/dacl/DACLAssertor.java#L481-L491
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeFromStream
public static File writeFromStream(InputStream in, String fullFilePath) throws IORuntimeException { return writeFromStream(in, touch(fullFilePath)); }
java
public static File writeFromStream(InputStream in, String fullFilePath) throws IORuntimeException { return writeFromStream(in, touch(fullFilePath)); }
[ "public", "static", "File", "writeFromStream", "(", "InputStream", "in", ",", "String", "fullFilePath", ")", "throws", "IORuntimeException", "{", "return", "writeFromStream", "(", "in", ",", "touch", "(", "fullFilePath", ")", ")", ";", "}" ]
将流的内容写入文件<br> @param in 输入流 @param fullFilePath 文件绝对路径 @return 目标文件 @throws IORuntimeException IO异常
[ "将流的内容写入文件<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3165-L3167
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DatabaseHelper.java
DatabaseHelper.setReadOnly
public void setReadOnly(WSRdbManagedConnectionImpl managedConn, boolean readOnly, boolean externalCall) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setReadOnly", managedConn, readOnly, externalCall); managedConn.setReadOnly(readOnly); }
java
public void setReadOnly(WSRdbManagedConnectionImpl managedConn, boolean readOnly, boolean externalCall) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setReadOnly", managedConn, readOnly, externalCall); managedConn.setReadOnly(readOnly); }
[ "public", "void", "setReadOnly", "(", "WSRdbManagedConnectionImpl", "managedConn", ",", "boolean", "readOnly", ",", "boolean", "externalCall", ")", "throws", "SQLException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "...
<p>This method is used to do special handling for readOnly when method setReadOnly is called.</p> @param managedConn WSRdbManagedConnectionImpl object @param readOnly The readOnly value going to be set @param externalCall indicates if the call is done by WAS, or by the user application.
[ "<p", ">", "This", "method", "is", "used", "to", "do", "special", "handling", "for", "readOnly", "when", "method", "setReadOnly", "is", "called", ".", "<", "/", "p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DatabaseHelper.java#L534-L539
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/BatchStatusValidator.java
BatchStatusValidator.validateStatusAtExecutionRestart
public static void validateStatusAtExecutionRestart(long previousExecutionId, Properties restartJobParameters) throws JobRestartException, JobExecutionNotMostRecentException, JobExecutionAlreadyCompleteException { Helper helper = new Helper(previousExecutionId, restartJobParameters); helper.validateRestartableFalseJobsDoNotRestart(); helper.validateJobExecutionIsMostRecent(); helper.validateJobNotCompleteOrAbandonded(); helper.validateJobInstanceFailedOrStopped(); //Added starting since execution is now created on the Dispatcher helper.validateJobExecutionFailedOrStoppedOrStarting(); helper.validateStepsAndPartitionsInNonFinalStates(); }
java
public static void validateStatusAtExecutionRestart(long previousExecutionId, Properties restartJobParameters) throws JobRestartException, JobExecutionNotMostRecentException, JobExecutionAlreadyCompleteException { Helper helper = new Helper(previousExecutionId, restartJobParameters); helper.validateRestartableFalseJobsDoNotRestart(); helper.validateJobExecutionIsMostRecent(); helper.validateJobNotCompleteOrAbandonded(); helper.validateJobInstanceFailedOrStopped(); //Added starting since execution is now created on the Dispatcher helper.validateJobExecutionFailedOrStoppedOrStarting(); helper.validateStepsAndPartitionsInNonFinalStates(); }
[ "public", "static", "void", "validateStatusAtExecutionRestart", "(", "long", "previousExecutionId", ",", "Properties", "restartJobParameters", ")", "throws", "JobRestartException", ",", "JobExecutionNotMostRecentException", ",", "JobExecutionAlreadyCompleteException", "{", "Helpe...
/* validates job is restart-able, jobExecution is most recent, validates the jobExecutions and stepExecutions in non-final states
[ "/", "*", "validates", "job", "is", "restart", "-", "able", "jobExecution", "is", "most", "recent", "validates", "the", "jobExecutions", "and", "stepExecutions", "in", "non", "-", "final", "states" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/BatchStatusValidator.java#L64-L74
VoltDB/voltdb
src/frontend/org/voltdb/NonVoltDBBackend.java
NonVoltDBBackend.isVarcharColumn
private boolean isVarcharColumn(String columnName, List<String> tableNames, boolean debugPrint) { List<String> varcharColumnTypes = Arrays.asList("VARCHAR"); return isColumnType(varcharColumnTypes, columnName, tableNames, debugPrint); }
java
private boolean isVarcharColumn(String columnName, List<String> tableNames, boolean debugPrint) { List<String> varcharColumnTypes = Arrays.asList("VARCHAR"); return isColumnType(varcharColumnTypes, columnName, tableNames, debugPrint); }
[ "private", "boolean", "isVarcharColumn", "(", "String", "columnName", ",", "List", "<", "String", ">", "tableNames", ",", "boolean", "debugPrint", ")", "{", "List", "<", "String", ">", "varcharColumnTypes", "=", "Arrays", ".", "asList", "(", "\"VARCHAR\"", ")"...
Returns true if the <i>columnName</i> is a VARCHAR column type, of any size, or equivalents in a comparison, non-VoltDB database; false otherwise.
[ "Returns", "true", "if", "the", "<i", ">", "columnName<", "/", "i", ">", "is", "a", "VARCHAR", "column", "type", "of", "any", "size", "or", "equivalents", "in", "a", "comparison", "non", "-", "VoltDB", "database", ";", "false", "otherwise", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/NonVoltDBBackend.java#L563-L566
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/ProgramUtils.java
ProgramUtils.executeCommand
public static int executeCommand( final Logger logger, final List<String> command, final File workingDir, final Map<String,String> environmentVars, final String applicationName, final String scopedInstanceName) throws IOException, InterruptedException { return executeCommand( logger, command.toArray( new String[ 0 ]), workingDir, environmentVars, applicationName, scopedInstanceName); }
java
public static int executeCommand( final Logger logger, final List<String> command, final File workingDir, final Map<String,String> environmentVars, final String applicationName, final String scopedInstanceName) throws IOException, InterruptedException { return executeCommand( logger, command.toArray( new String[ 0 ]), workingDir, environmentVars, applicationName, scopedInstanceName); }
[ "public", "static", "int", "executeCommand", "(", "final", "Logger", "logger", ",", "final", "List", "<", "String", ">", "command", ",", "final", "File", "workingDir", ",", "final", "Map", "<", "String", ",", "String", ">", "environmentVars", ",", "final", ...
Executes a command on the VM and prints on the console its output. @param command a command to execute (not null, not empty) @param environmentVars a map containing environment variables (can be null) @param logger a logger (not null) @throws IOException if a new process could not be created @throws InterruptedException if the new process encountered a process
[ "Executes", "a", "command", "on", "the", "VM", "and", "prints", "on", "the", "console", "its", "output", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/ProgramUtils.java#L165-L175
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java
IntentUtils.isAppInstalled
public static boolean isAppInstalled(final Context context, final String packageName){ try { context.getPackageManager().getPackageInfo(packageName, 0); return true; } catch (Exception e) { return false; } }
java
public static boolean isAppInstalled(final Context context, final String packageName){ try { context.getPackageManager().getPackageInfo(packageName, 0); return true; } catch (Exception e) { return false; } }
[ "public", "static", "boolean", "isAppInstalled", "(", "final", "Context", "context", ",", "final", "String", "packageName", ")", "{", "try", "{", "context", ".", "getPackageManager", "(", ")", ".", "getPackageInfo", "(", "packageName", ",", "0", ")", ";", "r...
Check if app for the given package name is installed on this device.
[ "Check", "if", "app", "for", "the", "given", "package", "name", "is", "installed", "on", "this", "device", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/IntentUtils.java#L54-L61
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentInsertAction.java
SegmentInsertAction.perform
@Override public Set<DataSegment> perform(Task task, TaskActionToolbox toolbox) { return new SegmentTransactionalInsertAction(segments, null, null).perform(task, toolbox).getSegments(); }
java
@Override public Set<DataSegment> perform(Task task, TaskActionToolbox toolbox) { return new SegmentTransactionalInsertAction(segments, null, null).perform(task, toolbox).getSegments(); }
[ "@", "Override", "public", "Set", "<", "DataSegment", ">", "perform", "(", "Task", "task", ",", "TaskActionToolbox", "toolbox", ")", "{", "return", "new", "SegmentTransactionalInsertAction", "(", "segments", ",", "null", ",", "null", ")", ".", "perform", "(", ...
Behaves similarly to {@link org.apache.druid.indexing.overlord.IndexerMetadataStorageCoordinator#announceHistoricalSegments}, with startMetadata and endMetadata both null.
[ "Behaves", "similarly", "to", "{" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentInsertAction.java#L71-L75
intellimate/Izou
src/main/java/org/intellimate/izou/events/EventDistributor.java
EventDistributor.registerEventListener
@SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"}) public void registerEventListener(EventModel event, EventListenerModel eventListener) throws IllegalIDException { registerEventListener(event.getAllInformations(), eventListener); }
java
@SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"}) public void registerEventListener(EventModel event, EventListenerModel eventListener) throws IllegalIDException { registerEventListener(event.getAllInformations(), eventListener); }
[ "@", "SuppressWarnings", "(", "{", "\"SynchronizationOnLocalVariableOrMethodParameter\"", "}", ")", "public", "void", "registerEventListener", "(", "EventModel", "event", ",", "EventListenerModel", "eventListener", ")", "throws", "IllegalIDException", "{", "registerEventListe...
Adds an listener for events. <p> Be careful with this method, it will register the listener for ALL the informations found in the Event. If your event-type is a common event type, it will fire EACH time!. It will also register for all Descriptors individually! It will also ignore if this listener is already listening to an Event. Method is thread-safe. </p> @param event the Event to listen to (it will listen to all descriptors individually!) @param eventListener the ActivatorEventListener-interface for receiving activator events @throws IllegalIDException not yet implemented
[ "Adds", "an", "listener", "for", "events", ".", "<p", ">", "Be", "careful", "with", "this", "method", "it", "will", "register", "the", "listener", "for", "ALL", "the", "informations", "found", "in", "the", "Event", ".", "If", "your", "event", "-", "type"...
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/events/EventDistributor.java#L116-L119
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java
RequestQueue.addMarker
public <R extends RequestQueue> R addMarker(String tag, Object... args) { Marker marker = new Marker(tag, Thread.currentThread().getId(), Thread.currentThread().getName(), System.nanoTime()); for (RequestListener.MarkerListener markerListener : markerListeners) { markerListener.onMarker(marker, args); } return (R) this; }
java
public <R extends RequestQueue> R addMarker(String tag, Object... args) { Marker marker = new Marker(tag, Thread.currentThread().getId(), Thread.currentThread().getName(), System.nanoTime()); for (RequestListener.MarkerListener markerListener : markerListeners) { markerListener.onMarker(marker, args); } return (R) this; }
[ "public", "<", "R", "extends", "RequestQueue", ">", "R", "addMarker", "(", "String", "tag", ",", "Object", "...", "args", ")", "{", "Marker", "marker", "=", "new", "Marker", "(", "tag", ",", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ...
Adds a marker for the {@link RequestQueue} @param tag @param args @param <R> @return
[ "Adds", "a", "marker", "for", "the", "{" ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java#L305-L314
nmdp-bioinformatics/ngs
align/src/main/java/org/nmdp/ngs/align/HighScoringPair.java
HighScoringPair.valueOf
public static HighScoringPair valueOf(final String value) { checkNotNull(value); List<String> tokens = Splitter.on("\t").trimResults().splitToList(value); if (tokens.size() != 12) { throw new IllegalArgumentException("value must have twelve fields"); } String source = tokens.get(0).trim(); String target = tokens.get(1).trim(); double percentIdentity = Double.parseDouble(tokens.get(2).trim()); long alignmentLength = Long.parseLong(tokens.get(3).trim()); int mismatches = Integer.parseInt(tokens.get(4).trim()); int gapOpens = Integer.parseInt(tokens.get(5).trim()); long sourceStart = Long.parseLong(tokens.get(6).trim()); long sourceEnd = Long.parseLong(tokens.get(7).trim()); long targetStart = Long.parseLong(tokens.get(8).trim()); long targetEnd = Long.parseLong(tokens.get(9).trim()); double evalue = Double.parseDouble(tokens.get(10).trim()); double bitScore = Double.parseDouble(tokens.get(11).trim()); return new HighScoringPair(source, target, percentIdentity, alignmentLength, mismatches, gapOpens, sourceStart, sourceEnd, targetStart, targetEnd, evalue, bitScore); }
java
public static HighScoringPair valueOf(final String value) { checkNotNull(value); List<String> tokens = Splitter.on("\t").trimResults().splitToList(value); if (tokens.size() != 12) { throw new IllegalArgumentException("value must have twelve fields"); } String source = tokens.get(0).trim(); String target = tokens.get(1).trim(); double percentIdentity = Double.parseDouble(tokens.get(2).trim()); long alignmentLength = Long.parseLong(tokens.get(3).trim()); int mismatches = Integer.parseInt(tokens.get(4).trim()); int gapOpens = Integer.parseInt(tokens.get(5).trim()); long sourceStart = Long.parseLong(tokens.get(6).trim()); long sourceEnd = Long.parseLong(tokens.get(7).trim()); long targetStart = Long.parseLong(tokens.get(8).trim()); long targetEnd = Long.parseLong(tokens.get(9).trim()); double evalue = Double.parseDouble(tokens.get(10).trim()); double bitScore = Double.parseDouble(tokens.get(11).trim()); return new HighScoringPair(source, target, percentIdentity, alignmentLength, mismatches, gapOpens, sourceStart, sourceEnd, targetStart, targetEnd, evalue, bitScore); }
[ "public", "static", "HighScoringPair", "valueOf", "(", "final", "String", "value", ")", "{", "checkNotNull", "(", "value", ")", ";", "List", "<", "String", ">", "tokens", "=", "Splitter", ".", "on", "(", "\"\\t\"", ")", ".", "trimResults", "(", ")", ".",...
Return a new high scoring pair parsed from the specified value. @param value value to parse, must not be null @return a new high scoring pair parsed from the specified value @throws IllegalArgumentException if the value is not valid high scoring pair format @throws NumberFormatException if a number valued field cannot be parsed as a number
[ "Return", "a", "new", "high", "scoring", "pair", "parsed", "from", "the", "specified", "value", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/align/src/main/java/org/nmdp/ngs/align/HighScoringPair.java#L241-L261
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java
ArrayHelper.getFirst
@Nullable @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE getFirst (@Nullable final ELEMENTTYPE... aArray) { return getFirst (aArray, null); }
java
@Nullable @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE getFirst (@Nullable final ELEMENTTYPE... aArray) { return getFirst (aArray, null); }
[ "@", "Nullable", "@", "SafeVarargs", "public", "static", "<", "ELEMENTTYPE", ">", "ELEMENTTYPE", "getFirst", "(", "@", "Nullable", "final", "ELEMENTTYPE", "...", "aArray", ")", "{", "return", "getFirst", "(", "aArray", ",", "null", ")", ";", "}" ]
Get the first element of the array or <code>null</code> if the passed array is empty. @param <ELEMENTTYPE> Array element type @param aArray The array who's first element is to be retrieved. May be <code>null</code> or empty. @return <code>null</code> if the passed array is <code>null</code> or empty - the first element otherwise (may also be <code>null</code>).
[ "Get", "the", "first", "element", "of", "the", "array", "or", "<code", ">", "null<", "/", "code", ">", "if", "the", "passed", "array", "is", "empty", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L1080-L1085
flex-oss/flex-fruit
fruit-jpa/src/main/java/org/cdlflex/fruit/jpa/QueryFactory.java
QueryFactory.count
public TypedQuery<Long> count(Filter filter) { CriteriaQuery<Long> query = cb.createQuery(Long.class); Root<T> from = query.from(getEntityClass()); if (filter != null) { Predicate where = new CriteriaMapper(from, cb).create(filter); query.where(where); } return getEntityManager().createQuery(query.select(cb.count(from))); }
java
public TypedQuery<Long> count(Filter filter) { CriteriaQuery<Long> query = cb.createQuery(Long.class); Root<T> from = query.from(getEntityClass()); if (filter != null) { Predicate where = new CriteriaMapper(from, cb).create(filter); query.where(where); } return getEntityManager().createQuery(query.select(cb.count(from))); }
[ "public", "TypedQuery", "<", "Long", ">", "count", "(", "Filter", "filter", ")", "{", "CriteriaQuery", "<", "Long", ">", "query", "=", "cb", ".", "createQuery", "(", "Long", ".", "class", ")", ";", "Root", "<", "T", ">", "from", "=", "query", ".", ...
Creates a new TypedQuery that queries the amount of entities of the entity class of this QueryFactory, that a query for the given Filter would return. @param filter the filter @return a query
[ "Creates", "a", "new", "TypedQuery", "that", "queries", "the", "amount", "of", "entities", "of", "the", "entity", "class", "of", "this", "QueryFactory", "that", "a", "query", "for", "the", "given", "Filter", "would", "return", "." ]
train
https://github.com/flex-oss/flex-fruit/blob/30d7eca5ee796b829f96c9932a95b259ca9738d9/fruit-jpa/src/main/java/org/cdlflex/fruit/jpa/QueryFactory.java#L61-L71
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeConfigurationException.java
DatatypeConfigurationException.printStackTrace
public void printStackTrace() { if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) { printStackTrace0(new PrintWriter(System.err, true)); } else { super.printStackTrace(); } }
java
public void printStackTrace() { if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) { printStackTrace0(new PrintWriter(System.err, true)); } else { super.printStackTrace(); } }
[ "public", "void", "printStackTrace", "(", ")", "{", "if", "(", "!", "isJDK14OrAbove", "&&", "causeOnJDK13OrBelow", "!=", "null", ")", "{", "printStackTrace0", "(", "new", "PrintWriter", "(", "System", ".", "err", ",", "true", ")", ")", ";", "}", "else", ...
Print the the trace of methods from where the error originated. This will trace all nested exception objects, as well as this object.
[ "Print", "the", "the", "trace", "of", "methods", "from", "where", "the", "error", "originated", ".", "This", "will", "trace", "all", "nested", "exception", "objects", "as", "well", "as", "this", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeConfigurationException.java#L96-L103
igniterealtime/Smack
smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java
OpenPgpPubSubUtil.getOpenLeafNode
@SuppressWarnings("unchecked") public static LeafNode getOpenLeafNode(PubSubManager pubSubManager, String nodeName) throws PubSubException.NotALeafNodeException { try { // Get access to the PubSubManager's nodeMap Field field = pubSubManager.getClass().getDeclaredField("nodeMap"); field.setAccessible(true); Map<String, Node> nodeMap = (Map) field.get(pubSubManager); // Check, if the node already exists Node existingNode = nodeMap.get(nodeName); if (existingNode != null) { if (existingNode instanceof LeafNode) { // We already know that node return (LeafNode) existingNode; } else { // Throw a new NotALeafNodeException, as the node is not a LeafNode. // Again use reflections to access the exceptions constructor. Constructor<PubSubException.NotALeafNodeException> exceptionConstructor = PubSubException.NotALeafNodeException.class.getDeclaredConstructor(String.class, BareJid.class); exceptionConstructor.setAccessible(true); throw exceptionConstructor.newInstance(nodeName, pubSubManager.getServiceJid()); } } // Node does not exist. Create the node Constructor<LeafNode> constructor; constructor = LeafNode.class.getDeclaredConstructor(PubSubManager.class, String.class); constructor.setAccessible(true); LeafNode node = constructor.newInstance(pubSubManager, nodeName); // Add it to the node map nodeMap.put(nodeName, node); // And return return node; } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException | NoSuchFieldException e) { LOGGER.log(Level.SEVERE, "Using reflections to create a LeafNode and put it into PubSubManagers nodeMap failed.", e); throw new AssertionError(e); } }
java
@SuppressWarnings("unchecked") public static LeafNode getOpenLeafNode(PubSubManager pubSubManager, String nodeName) throws PubSubException.NotALeafNodeException { try { // Get access to the PubSubManager's nodeMap Field field = pubSubManager.getClass().getDeclaredField("nodeMap"); field.setAccessible(true); Map<String, Node> nodeMap = (Map) field.get(pubSubManager); // Check, if the node already exists Node existingNode = nodeMap.get(nodeName); if (existingNode != null) { if (existingNode instanceof LeafNode) { // We already know that node return (LeafNode) existingNode; } else { // Throw a new NotALeafNodeException, as the node is not a LeafNode. // Again use reflections to access the exceptions constructor. Constructor<PubSubException.NotALeafNodeException> exceptionConstructor = PubSubException.NotALeafNodeException.class.getDeclaredConstructor(String.class, BareJid.class); exceptionConstructor.setAccessible(true); throw exceptionConstructor.newInstance(nodeName, pubSubManager.getServiceJid()); } } // Node does not exist. Create the node Constructor<LeafNode> constructor; constructor = LeafNode.class.getDeclaredConstructor(PubSubManager.class, String.class); constructor.setAccessible(true); LeafNode node = constructor.newInstance(pubSubManager, nodeName); // Add it to the node map nodeMap.put(nodeName, node); // And return return node; } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException | NoSuchFieldException e) { LOGGER.log(Level.SEVERE, "Using reflections to create a LeafNode and put it into PubSubManagers nodeMap failed.", e); throw new AssertionError(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "LeafNode", "getOpenLeafNode", "(", "PubSubManager", "pubSubManager", ",", "String", "nodeName", ")", "throws", "PubSubException", ".", "NotALeafNodeException", "{", "try", "{", "// Get access to th...
Use reflection magic to get a {@link LeafNode} without doing a disco#info query. This method is useful for fetching nodes that are configured with the access model 'open', since some servers that announce support for that access model do not allow disco#info queries from contacts which are not subscribed to the node owner. Therefore this method fetches the node directly and puts it into the {@link PubSubManager}s node map. Note: Due to the alck of a disco#info query, it might happen, that the node doesn't exist on the server, even though we add it to the node map. @see <a href="https://github.com/processone/ejabberd/issues/2483">Ejabberd bug tracker about the issue</a> @see <a href="https://mail.jabber.org/pipermail/standards/2018-June/035206.html"> Topic on the standards mailing list</a> @param pubSubManager pubsub manager @param nodeName name of the node @return leafNode @throws PubSubException.NotALeafNodeException in case we already have the node cached, but it is not a LeafNode.
[ "Use", "reflection", "magic", "to", "get", "a", "{", "@link", "LeafNode", "}", "without", "doing", "a", "disco#info", "query", ".", "This", "method", "is", "useful", "for", "fetching", "nodes", "that", "are", "configured", "with", "the", "access", "model", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java#L423-L469
FXMisc/Flowless
src/main/java/org/fxmisc/flowless/CellPositioner.java
CellPositioner.placeEndFromStart
public C placeEndFromStart(int itemIndex, double endOffStart) { C cell = getSizedCell(itemIndex); relocate(cell, 0, endOffStart - orientation.length(cell)); cell.getNode().setVisible(true); return cell; }
java
public C placeEndFromStart(int itemIndex, double endOffStart) { C cell = getSizedCell(itemIndex); relocate(cell, 0, endOffStart - orientation.length(cell)); cell.getNode().setVisible(true); return cell; }
[ "public", "C", "placeEndFromStart", "(", "int", "itemIndex", ",", "double", "endOffStart", ")", "{", "C", "cell", "=", "getSizedCell", "(", "itemIndex", ")", ";", "relocate", "(", "cell", ",", "0", ",", "endOffStart", "-", "orientation", ".", "length", "("...
Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by {@code endOffStart}, so that the node's <em>top</em> edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge. See {@link OrientationHelper}'s javadoc for more explanation on what quoted terms mean. <pre><code> |--------- top of cell's node if endOffStart is negative | | |_________ "bottom edge" of viewport / top of cell's node if endOffStart = 0 --------- top of cell's node if endOffStart is positive </code></pre> @param itemIndex the index of the item in the list of all (not currently visible) cells @param endOffStart the amount by which to offset the "layoutY" value of the cell's node
[ "Properly", "resizes", "the", "cell", "s", "node", "and", "sets", "its", "layoutY", "value", "so", "that", "is", "the", "last", "visible", "node", "in", "the", "viewport", "and", "further", "offsets", "this", "value", "by", "{", "@code", "endOffStart", "}"...
train
https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/CellPositioner.java#L152-L157
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java
TopicAccessManager.checkAccessTopicFromControllers
boolean checkAccessTopicFromControllers(UserContext ctx, String topic, Iterable<JsTopicAccessController> accessControls) throws IllegalAccessException { logger.debug("Looking for accessController for topic '{}' : '{}'", topic, accessControls); boolean tacPresent = false; if (null != accessControls) { for (JsTopicAccessController accessControl : accessControls) { accessControl.checkAccess(ctx, topic); tacPresent = true; } } return tacPresent; }
java
boolean checkAccessTopicFromControllers(UserContext ctx, String topic, Iterable<JsTopicAccessController> accessControls) throws IllegalAccessException { logger.debug("Looking for accessController for topic '{}' : '{}'", topic, accessControls); boolean tacPresent = false; if (null != accessControls) { for (JsTopicAccessController accessControl : accessControls) { accessControl.checkAccess(ctx, topic); tacPresent = true; } } return tacPresent; }
[ "boolean", "checkAccessTopicFromControllers", "(", "UserContext", "ctx", ",", "String", "topic", ",", "Iterable", "<", "JsTopicAccessController", ">", "accessControls", ")", "throws", "IllegalAccessException", "{", "logger", ".", "debug", "(", "\"Looking for accessControl...
Check if access topic is granted by accessControls @param ctx @param topic @param accessControls @return @throws IllegalAccessException
[ "Check", "if", "access", "topic", "is", "granted", "by", "accessControls" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L153-L163
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassTranslator.java
ClassTranslator.translate
public ClassFile translate(ClassFile cf, Map<Object,Object> translations) { ClassFile cf2 = (ClassFile) translations.get(cf); if (cf2 == null) { ConstantPool constant_pool2 = translate(cf.constant_pool, translations); Field[] fields2 = translate(cf.fields, cf.constant_pool, translations); Method[] methods2 = translateMethods(cf.methods, cf.constant_pool, translations); Attributes attributes2 = translateAttributes(cf.attributes, cf.constant_pool, translations); if (constant_pool2 == cf.constant_pool && fields2 == cf.fields && methods2 == cf.methods && attributes2 == cf.attributes) cf2 = cf; else cf2 = new ClassFile( cf.magic, cf.minor_version, cf.major_version, constant_pool2, cf.access_flags, cf.this_class, cf.super_class, cf.interfaces, fields2, methods2, attributes2); translations.put(cf, cf2); } return cf2; }
java
public ClassFile translate(ClassFile cf, Map<Object,Object> translations) { ClassFile cf2 = (ClassFile) translations.get(cf); if (cf2 == null) { ConstantPool constant_pool2 = translate(cf.constant_pool, translations); Field[] fields2 = translate(cf.fields, cf.constant_pool, translations); Method[] methods2 = translateMethods(cf.methods, cf.constant_pool, translations); Attributes attributes2 = translateAttributes(cf.attributes, cf.constant_pool, translations); if (constant_pool2 == cf.constant_pool && fields2 == cf.fields && methods2 == cf.methods && attributes2 == cf.attributes) cf2 = cf; else cf2 = new ClassFile( cf.magic, cf.minor_version, cf.major_version, constant_pool2, cf.access_flags, cf.this_class, cf.super_class, cf.interfaces, fields2, methods2, attributes2); translations.put(cf, cf2); } return cf2; }
[ "public", "ClassFile", "translate", "(", "ClassFile", "cf", ",", "Map", "<", "Object", ",", "Object", ">", "translations", ")", "{", "ClassFile", "cf2", "=", "(", "ClassFile", ")", "translations", ".", "get", "(", "cf", ")", ";", "if", "(", "cf2", "=="...
Create a new ClassFile from {@code cf}, such that for all entries {@code k&nbsp;-\&gt;&nbsp;v} in {@code translations}, each occurrence of {@code k} in {@code cf} will be replaced by {@code v}. in @param cf the class file to be processed @param translations the set of translations to be applied @return a copy of {@code} with the values in {@code translations} substituted
[ "Create", "a", "new", "ClassFile", "from", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassTranslator.java#L67-L97
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java
URLConnection.getHeaderFieldInt
public int getHeaderFieldInt(String name, int Default) { String value = getHeaderField(name); try { return Integer.parseInt(value); } catch (Exception e) { } return Default; }
java
public int getHeaderFieldInt(String name, int Default) { String value = getHeaderField(name); try { return Integer.parseInt(value); } catch (Exception e) { } return Default; }
[ "public", "int", "getHeaderFieldInt", "(", "String", "name", ",", "int", "Default", ")", "{", "String", "value", "=", "getHeaderField", "(", "name", ")", ";", "try", "{", "return", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "catch", "(", ...
Returns the value of the named field parsed as a number. <p> This form of <code>getHeaderField</code> exists because some connection types (e.g., <code>http-ng</code>) have pre-parsed headers. Classes for that connection type can override this method and short-circuit the parsing. @param name the name of the header field. @param Default the default value. @return the value of the named field, parsed as an integer. The <code>Default</code> value is returned if the field is missing or malformed.
[ "Returns", "the", "value", "of", "the", "named", "field", "parsed", "as", "a", "number", ".", "<p", ">", "This", "form", "of", "<code", ">", "getHeaderField<", "/", "code", ">", "exists", "because", "some", "connection", "types", "(", "e", ".", "g", "....
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L602-L608
lordcodes/SnackbarBuilder
snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/SnackbarWrapper.java
SnackbarWrapper.setAction
@NonNull @SuppressWarnings("WeakerAccess") public SnackbarWrapper setAction(@StringRes int actionText, OnClickListener actionClickListener) { snackbar.setAction(actionText, actionClickListener); return this; }
java
@NonNull @SuppressWarnings("WeakerAccess") public SnackbarWrapper setAction(@StringRes int actionText, OnClickListener actionClickListener) { snackbar.setAction(actionText, actionClickListener); return this; }
[ "@", "NonNull", "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "SnackbarWrapper", "setAction", "(", "@", "StringRes", "int", "actionText", ",", "OnClickListener", "actionClickListener", ")", "{", "snackbar", ".", "setAction", "(", "actionText", ","...
Set the action to be displayed in the Snackbar and the callback to invoke when the action is clicked. @param actionText String resource to display as an action. @param actionClickListener Callback to be invoked when the action is clicked. @return This instance.
[ "Set", "the", "action", "to", "be", "displayed", "in", "the", "Snackbar", "and", "the", "callback", "to", "invoke", "when", "the", "action", "is", "clicked", "." ]
train
https://github.com/lordcodes/SnackbarBuilder/blob/a104a753c78ed66940c19d295e141a521cf81d73/snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/SnackbarWrapper.java#L148-L153
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java
SyncAgentsInner.createOrUpdate
public SyncAgentInner createOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().last().body(); }
java
public SyncAgentInner createOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().last().body(); }
[ "public", "SyncAgentInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "syncAgentName", ",", "String", "syncDatabaseId", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "se...
Creates or updates a sync agent. @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 on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @param syncDatabaseId ARM resource id of the sync database in the sync agent. @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 SyncAgentInner object if successful.
[ "Creates", "or", "updates", "a", "sync", "agent", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java#L289-L291
Wikidata/Wikidata-Toolkit
wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WbEditingAction.java
WbEditingAction.wbSetClaim
public JsonNode wbSetClaim(String statement, boolean bot, long baserevid, String summary) throws IOException, MediaWikiApiErrorException { Validate.notNull(statement, "Statement parameter cannot be null when adding or changing a statement"); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("claim", statement); return performAPIAction("wbsetclaim", null, null, null, null, parameters, summary, baserevid, bot); }
java
public JsonNode wbSetClaim(String statement, boolean bot, long baserevid, String summary) throws IOException, MediaWikiApiErrorException { Validate.notNull(statement, "Statement parameter cannot be null when adding or changing a statement"); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("claim", statement); return performAPIAction("wbsetclaim", null, null, null, null, parameters, summary, baserevid, bot); }
[ "public", "JsonNode", "wbSetClaim", "(", "String", "statement", ",", "boolean", "bot", ",", "long", "baserevid", ",", "String", "summary", ")", "throws", "IOException", ",", "MediaWikiApiErrorException", "{", "Validate", ".", "notNull", "(", "statement", ",", "\...
Executes the API action "wbsetclaim" for the given parameters. @param statement the JSON serialization of claim to add or delete. @param bot if true, edits will be flagged as "bot edits" provided that the logged in user is in the bot group; for regular users, the flag will just be ignored @param baserevid the revision of the data that the edit refers to or 0 if this should not be submitted; when used, the site will ensure that no edit has happened since this revision to detect edit conflicts; it is recommended to use this whenever in all operations where the outcome depends on the state of the online data @param summary summary for the edit; will be prepended by an automatically generated comment; the length limit of the autocomment together with the summary is 260 characters: everything above that limit will be cut off @return the JSON response from the API @throws IOException if there was an IO problem. such as missing network connection @throws MediaWikiApiErrorException if the API returns an error @throws IOException @throws MediaWikiApiErrorException
[ "Executes", "the", "API", "action", "wbsetclaim", "for", "the", "given", "parameters", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/WbEditingAction.java#L540-L551
alamkanak/Android-Week-View
library/src/main/java/com/alamkanak/weekview/WeekView.java
WeekView.isTimeAfterOrEquals
private boolean isTimeAfterOrEquals(Calendar time1, Calendar time2) { return !(time1 == null || time2 == null) && time1.getTimeInMillis() >= time2.getTimeInMillis(); }
java
private boolean isTimeAfterOrEquals(Calendar time1, Calendar time2) { return !(time1 == null || time2 == null) && time1.getTimeInMillis() >= time2.getTimeInMillis(); }
[ "private", "boolean", "isTimeAfterOrEquals", "(", "Calendar", "time1", ",", "Calendar", "time2", ")", "{", "return", "!", "(", "time1", "==", "null", "||", "time2", "==", "null", ")", "&&", "time1", ".", "getTimeInMillis", "(", ")", ">=", "time2", ".", "...
Checks if time1 occurs after (or at the same time) time2. @param time1 The time to check. @param time2 The time to check against. @return true if time1 and time2 are equal or if time1 is after time2. Otherwise false.
[ "Checks", "if", "time1", "occurs", "after", "(", "or", "at", "the", "same", "time", ")", "time2", "." ]
train
https://github.com/alamkanak/Android-Week-View/blob/dc3f97d65d44785d1a761b52b58527c86c4eee1b/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1209-L1211
box/box-java-sdk
src/main/java/com/box/sdk/BoxFile.java
BoxFile.canUploadVersion
public boolean canUploadVersion(String name, long fileSize) { URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS"); JsonObject preflightInfo = new JsonObject(); if (name != null) { preflightInfo.add("name", name); } preflightInfo.add("size", fileSize); request.setBody(preflightInfo.toString()); try { BoxAPIResponse response = request.send(); return response.getResponseCode() == 200; } catch (BoxAPIException ex) { if (ex.getResponseCode() >= 400 && ex.getResponseCode() < 500) { // This looks like an error response, menaing the upload would fail return false; } else { // This looks like a network error or server error, rethrow exception throw ex; } } }
java
public boolean canUploadVersion(String name, long fileSize) { URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS"); JsonObject preflightInfo = new JsonObject(); if (name != null) { preflightInfo.add("name", name); } preflightInfo.add("size", fileSize); request.setBody(preflightInfo.toString()); try { BoxAPIResponse response = request.send(); return response.getResponseCode() == 200; } catch (BoxAPIException ex) { if (ex.getResponseCode() >= 400 && ex.getResponseCode() < 500) { // This looks like an error response, menaing the upload would fail return false; } else { // This looks like a network error or server error, rethrow exception throw ex; } } }
[ "public", "boolean", "canUploadVersion", "(", "String", "name", ",", "long", "fileSize", ")", "{", "URL", "url", "=", "CONTENT_URL_TEMPLATE", ".", "build", "(", "this", ".", "getAPI", "(", ")", ".", "getBaseURL", "(", ")", ",", "this", ".", "getID", "(",...
Checks if a new version of the file can be uploaded with the specified name and size. @param name the new name for the file. @param fileSize the size of the new version content in bytes. @return whether or not the file version can be uploaded.
[ "Checks", "if", "a", "new", "version", "of", "the", "file", "can", "be", "uploaded", "with", "the", "specified", "name", "and", "size", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L688-L715
pravega/pravega
client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java
ModelHelper.decode
public static final StreamConfig decode(String scope, String streamName, final StreamConfiguration configModel) { Preconditions.checkNotNull(configModel, "configModel"); final StreamConfig.Builder builder = StreamConfig.newBuilder() .setStreamInfo(createStreamInfo(scope, streamName)) .setScalingPolicy(decode(configModel.getScalingPolicy())); if (configModel.getRetentionPolicy() != null) { builder.setRetentionPolicy(decode(configModel.getRetentionPolicy())); } return builder.build(); }
java
public static final StreamConfig decode(String scope, String streamName, final StreamConfiguration configModel) { Preconditions.checkNotNull(configModel, "configModel"); final StreamConfig.Builder builder = StreamConfig.newBuilder() .setStreamInfo(createStreamInfo(scope, streamName)) .setScalingPolicy(decode(configModel.getScalingPolicy())); if (configModel.getRetentionPolicy() != null) { builder.setRetentionPolicy(decode(configModel.getRetentionPolicy())); } return builder.build(); }
[ "public", "static", "final", "StreamConfig", "decode", "(", "String", "scope", ",", "String", "streamName", ",", "final", "StreamConfiguration", "configModel", ")", "{", "Preconditions", ".", "checkNotNull", "(", "configModel", ",", "\"configModel\"", ")", ";", "f...
Converts StreamConfiguration into StreamConfig. @param scope the stream's scope @param streamName The Stream Name @param configModel The stream configuration. @return StreamConfig instance.
[ "Converts", "StreamConfiguration", "into", "StreamConfig", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ModelHelper.java#L291-L300
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java
ProviderList.getServices
public List<Service> getServices(String type, String algorithm) { return new ServiceList(type, algorithm); }
java
public List<Service> getServices(String type, String algorithm) { return new ServiceList(type, algorithm); }
[ "public", "List", "<", "Service", ">", "getServices", "(", "String", "type", ",", "String", "algorithm", ")", "{", "return", "new", "ServiceList", "(", "type", ",", "algorithm", ")", ";", "}" ]
Return a List containing all the Services describing implementations of the specified algorithms in precedence order. If no implementation exists, this method returns an empty List. The elements of this list are determined lazily on demand. The List returned is NOT thread safe.
[ "Return", "a", "List", "containing", "all", "the", "Services", "describing", "implementations", "of", "the", "specified", "algorithms", "in", "precedence", "order", ".", "If", "no", "implementation", "exists", "this", "method", "returns", "an", "empty", "List", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java#L355-L357
Codearte/catch-exception
catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java
CatchException.catchException
public static void catchException(ThrowingCallable actor, Class<? extends Exception> clazz) { validateArguments(actor, clazz); catchException(actor, clazz, false); }
java
public static void catchException(ThrowingCallable actor, Class<? extends Exception> clazz) { validateArguments(actor, clazz); catchException(actor, clazz, false); }
[ "public", "static", "void", "catchException", "(", "ThrowingCallable", "actor", ",", "Class", "<", "?", "extends", "Exception", ">", "clazz", ")", "{", "validateArguments", "(", "actor", ",", "clazz", ")", ";", "catchException", "(", "actor", ",", "clazz", "...
Use it to catch an exception of a specific type and to get access to the thrown exception (for further verifications). In the following example you catch exceptions of type MyException that are thrown by obj.doX(): <code>catchException(obj, MyException.class).doX(); // catch if (caughtException() != null) { assert "foobar".equals(caughtException().getMessage()); // further analysis }</code> If <code>doX()</code> throws a <code>MyException</code>, then {@link #caughtException()} will return the caught exception. If <code>doX()</code> does not throw a <code>MyException</code>, then {@link #caughtException()} will return <code>null</code>. If <code>doX()</code> throws an exception of another type, i.e. not a subclass but another class, then this exception is not thrown and {@link #caughtException()} will return <code>null</code>. @param actor The instance that shall be proxied. Must not be <code>null</code>. @param clazz The type of the exception that shall be caught. Must not be <code>null</code>.
[ "Use", "it", "to", "catch", "an", "exception", "of", "a", "specific", "type", "and", "to", "get", "access", "to", "the", "thrown", "exception", "(", "for", "further", "verifications", ")", "." ]
train
https://github.com/Codearte/catch-exception/blob/8cfb1c0a68661ef622011484ff0061b41796b165/catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java#L319-L322
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java
PathHelper.getOutputStream
@Nullable public static OutputStream getOutputStream (@Nonnull final Path aFile, @Nonnull final EAppend eAppend) { ValueEnforcer.notNull (aFile, "Path"); ValueEnforcer.notNull (eAppend, "Append"); // OK, parent is present and writable try { return Files.newOutputStream (aFile, eAppend.getAsOpenOptions ()); } catch (final IOException ex) { return null; } }
java
@Nullable public static OutputStream getOutputStream (@Nonnull final Path aFile, @Nonnull final EAppend eAppend) { ValueEnforcer.notNull (aFile, "Path"); ValueEnforcer.notNull (eAppend, "Append"); // OK, parent is present and writable try { return Files.newOutputStream (aFile, eAppend.getAsOpenOptions ()); } catch (final IOException ex) { return null; } }
[ "@", "Nullable", "public", "static", "OutputStream", "getOutputStream", "(", "@", "Nonnull", "final", "Path", "aFile", ",", "@", "Nonnull", "final", "EAppend", "eAppend", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aFile", ",", "\"Path\"", ")", ";", "Va...
Get an output stream for writing to a file. @param aFile The file to write to. May not be <code>null</code>. @param eAppend Appending mode. May not be <code>null</code>. @return <code>null</code> if the file could not be opened
[ "Get", "an", "output", "stream", "for", "writing", "to", "a", "file", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java#L345-L360
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.getGroupName
public GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags) { final Stream<String> suffixPath = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) // Only retain int keys. .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) // Sort by int key. .map(Map.Entry::getValue) .map(value -> value.mapCombine(b -> b.toString(), i -> i.toString(), Function.identity())); final SimpleGroupPath path = SimpleGroupPath.valueOf(Stream.concat(prefixPath.stream(), suffixPath).collect(Collectors.toList())); final Map<String, MetricValue> tags = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) // Only retain string keys. .collect(Collectors.toMap(entry -> entry.getKey().getRight().get(), entry -> entry.getValue().mapCombine(MetricValue::fromBoolean, MetricValue::fromIntValue, MetricValue::fromStrValue))); tags.putAll(extraTags); return GroupName.valueOf(path, tags); }
java
public GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags) { final Stream<String> suffixPath = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) // Only retain int keys. .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) // Sort by int key. .map(Map.Entry::getValue) .map(value -> value.mapCombine(b -> b.toString(), i -> i.toString(), Function.identity())); final SimpleGroupPath path = SimpleGroupPath.valueOf(Stream.concat(prefixPath.stream(), suffixPath).collect(Collectors.toList())); final Map<String, MetricValue> tags = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) // Only retain string keys. .collect(Collectors.toMap(entry -> entry.getKey().getRight().get(), entry -> entry.getValue().mapCombine(MetricValue::fromBoolean, MetricValue::fromIntValue, MetricValue::fromStrValue))); tags.putAll(extraTags); return GroupName.valueOf(path, tags); }
[ "public", "GroupName", "getGroupName", "(", "@", "NonNull", "List", "<", "String", ">", "prefixPath", ",", "@", "NonNull", "Map", "<", "String", ",", "MetricValue", ">", "extraTags", ")", "{", "final", "Stream", "<", "String", ">", "suffixPath", "=", "data...
Create a GroupName from this NamedResolverMap. @param prefixPath Additional path elements to put in front of the returned path. @param extraTags Additional tags to put in the tag set. The extraTags argument will override any values present in the NamedResolverMap. @return A group name derived from this NamedResolverMap and the supplied arguments.
[ "Create", "a", "GroupName", "from", "this", "NamedResolverMap", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L240-L253
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java
SVGUtil.svgWaitIcon
public static Element svgWaitIcon(Document document, double x, double y, double w, double h) { Element g = SVGUtil.svgElement(document, SVGConstants.SVG_G_TAG); setAtt(g, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, "translate(" + x + " " + y + ") scale(" + w + " " + h + ")"); Element thro = SVGUtil.svgElement(document, SVGConstants.SVG_PATH_TAG); setAtt(thro, SVGConstants.SVG_D_ATTRIBUTE, THROBBER_PATH); setStyle(thro, THROBBER_STYLE); Element anim = SVGUtil.svgElement(document, SVGConstants.SVG_ANIMATE_TRANSFORM_TAG); setAtt(anim, SVGConstants.SVG_ATTRIBUTE_NAME_ATTRIBUTE, SVGConstants.SVG_TRANSFORM_ATTRIBUTE); setAtt(anim, SVGConstants.SVG_ATTRIBUTE_TYPE_ATTRIBUTE, "XML"); setAtt(anim, SVGConstants.SVG_TYPE_ATTRIBUTE, SVGConstants.SVG_ROTATE_ATTRIBUTE); setAtt(anim, SVGConstants.SVG_FROM_ATTRIBUTE, "0 .5 .5"); setAtt(anim, SVGConstants.SVG_TO_ATTRIBUTE, "360 .5 .5"); setAtt(anim, SVGConstants.SVG_BEGIN_ATTRIBUTE, fmt(Math.random() * 2) + "s"); setAtt(anim, SVGConstants.SVG_DUR_ATTRIBUTE, "2s"); setAtt(anim, SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE, "indefinite"); setAtt(anim, SVGConstants.SVG_FILL_ATTRIBUTE, "freeze"); thro.appendChild(anim); g.appendChild(thro); return g; }
java
public static Element svgWaitIcon(Document document, double x, double y, double w, double h) { Element g = SVGUtil.svgElement(document, SVGConstants.SVG_G_TAG); setAtt(g, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, "translate(" + x + " " + y + ") scale(" + w + " " + h + ")"); Element thro = SVGUtil.svgElement(document, SVGConstants.SVG_PATH_TAG); setAtt(thro, SVGConstants.SVG_D_ATTRIBUTE, THROBBER_PATH); setStyle(thro, THROBBER_STYLE); Element anim = SVGUtil.svgElement(document, SVGConstants.SVG_ANIMATE_TRANSFORM_TAG); setAtt(anim, SVGConstants.SVG_ATTRIBUTE_NAME_ATTRIBUTE, SVGConstants.SVG_TRANSFORM_ATTRIBUTE); setAtt(anim, SVGConstants.SVG_ATTRIBUTE_TYPE_ATTRIBUTE, "XML"); setAtt(anim, SVGConstants.SVG_TYPE_ATTRIBUTE, SVGConstants.SVG_ROTATE_ATTRIBUTE); setAtt(anim, SVGConstants.SVG_FROM_ATTRIBUTE, "0 .5 .5"); setAtt(anim, SVGConstants.SVG_TO_ATTRIBUTE, "360 .5 .5"); setAtt(anim, SVGConstants.SVG_BEGIN_ATTRIBUTE, fmt(Math.random() * 2) + "s"); setAtt(anim, SVGConstants.SVG_DUR_ATTRIBUTE, "2s"); setAtt(anim, SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE, "indefinite"); setAtt(anim, SVGConstants.SVG_FILL_ATTRIBUTE, "freeze"); thro.appendChild(anim); g.appendChild(thro); return g; }
[ "public", "static", "Element", "svgWaitIcon", "(", "Document", "document", ",", "double", "x", ",", "double", "y", ",", "double", "w", ",", "double", "h", ")", "{", "Element", "g", "=", "SVGUtil", ".", "svgElement", "(", "document", ",", "SVGConstants", ...
Draw a simple "please wait" icon (in-progress) as placeholder for running renderings. @param document Document. @param x Left @param y Top @param w Width @param h Height @return New element (currently a {@link SVGConstants#SVG_PATH_TAG})
[ "Draw", "a", "simple", "please", "wait", "icon", "(", "in", "-", "progress", ")", "as", "placeholder", "for", "running", "renderings", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L501-L520
threerings/narya
tools/src/main/java/com/threerings/presents/tools/GenTask.java
GenTask.mergeTemplate
protected String mergeTemplate (String template, Map<String, Object> data) throws IOException { Reader reader = new InputStreamReader(getClass().getClassLoader().getResourceAsStream(template), UTF_8); return convertEols(Mustache.compiler().escapeHTML(false).compile(reader).execute(data)); }
java
protected String mergeTemplate (String template, Map<String, Object> data) throws IOException { Reader reader = new InputStreamReader(getClass().getClassLoader().getResourceAsStream(template), UTF_8); return convertEols(Mustache.compiler().escapeHTML(false).compile(reader).execute(data)); }
[ "protected", "String", "mergeTemplate", "(", "String", "template", ",", "Map", "<", "String", ",", "Object", ">", "data", ")", "throws", "IOException", "{", "Reader", "reader", "=", "new", "InputStreamReader", "(", "getClass", "(", ")", ".", "getClassLoader", ...
Merges the specified template using the supplied mapping of string keys to objects. @return a string containing the merged text.
[ "Merges", "the", "specified", "template", "using", "the", "supplied", "mapping", "of", "string", "keys", "to", "objects", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/GenTask.java#L217-L223
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.createImagesFromPredictions
public ImageCreateSummary createImagesFromPredictions(UUID projectId, ImageIdCreateBatch batch) { return createImagesFromPredictionsWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); }
java
public ImageCreateSummary createImagesFromPredictions(UUID projectId, ImageIdCreateBatch batch) { return createImagesFromPredictionsWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); }
[ "public", "ImageCreateSummary", "createImagesFromPredictions", "(", "UUID", "projectId", ",", "ImageIdCreateBatch", "batch", ")", "{", "return", "createImagesFromPredictionsWithServiceResponseAsync", "(", "projectId", ",", "batch", ")", ".", "toBlocking", "(", ")", ".", ...
Add the specified predicted images to the set of training images. This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. @param projectId The project id @param batch Image and tag ids. Limted to 64 images and 20 tags per batch @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 ImageCreateSummary object if successful.
[ "Add", "the", "specified", "predicted", "images", "to", "the", "set", "of", "training", "images", ".", "This", "API", "creates", "a", "batch", "of", "images", "from", "predicted", "images", "specified", ".", "There", "is", "a", "limit", "of", "64", "images...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3752-L3754
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java
CudaAffinityManager.tagLocation
@Override public void tagLocation(DataBuffer buffer, Location location) { if (location == Location.HOST) AtomicAllocator.getInstance().getAllocationPoint(buffer).tickHostWrite(); else if (location == Location.DEVICE) AtomicAllocator.getInstance().getAllocationPoint(buffer).tickDeviceWrite(); else if (location == Location.EVERYWHERE) { AtomicAllocator.getInstance().getAllocationPoint(buffer).tickDeviceWrite(); AtomicAllocator.getInstance().getAllocationPoint(buffer).tickHostRead(); } }
java
@Override public void tagLocation(DataBuffer buffer, Location location) { if (location == Location.HOST) AtomicAllocator.getInstance().getAllocationPoint(buffer).tickHostWrite(); else if (location == Location.DEVICE) AtomicAllocator.getInstance().getAllocationPoint(buffer).tickDeviceWrite(); else if (location == Location.EVERYWHERE) { AtomicAllocator.getInstance().getAllocationPoint(buffer).tickDeviceWrite(); AtomicAllocator.getInstance().getAllocationPoint(buffer).tickHostRead(); } }
[ "@", "Override", "public", "void", "tagLocation", "(", "DataBuffer", "buffer", ",", "Location", "location", ")", "{", "if", "(", "location", "==", "Location", ".", "HOST", ")", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "getAllocationPoint", "(", ...
This method marks given DataBuffer as actual in specific location (either host, device, or both) @param buffer @param location
[ "This", "method", "marks", "given", "DataBuffer", "as", "actual", "in", "specific", "location", "(", "either", "host", "device", "or", "both", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java#L357-L367
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendBinaryBlocking
public static void sendBinaryBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException { sendBlockingInternal(pooledData, WebSocketFrameType.BINARY, wsChannel); }
java
public static void sendBinaryBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException { sendBlockingInternal(pooledData, WebSocketFrameType.BINARY, wsChannel); }
[ "public", "static", "void", "sendBinaryBlocking", "(", "final", "PooledByteBuffer", "pooledData", ",", "final", "WebSocketChannel", "wsChannel", ")", "throws", "IOException", "{", "sendBlockingInternal", "(", "pooledData", ",", "WebSocketFrameType", ".", "BINARY", ",", ...
Sends a complete binary message using blocking IO Automatically frees the pooled byte buffer when done. @param pooledData The data to send, it will be freed when done @param wsChannel The web socket channel
[ "Sends", "a", "complete", "binary", "message", "using", "blocking", "IO", "Automatically", "frees", "the", "pooled", "byte", "buffer", "when", "done", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L757-L759
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java
BinarySerde.writeArrayToOutputStream
public static void writeArrayToOutputStream(INDArray arr, OutputStream outputStream) { ByteBuffer buffer = BinarySerde.toByteBuffer(arr); try (WritableByteChannel channel = Channels.newChannel(outputStream)) { channel.write(buffer); } catch (IOException e) { e.printStackTrace(); } }
java
public static void writeArrayToOutputStream(INDArray arr, OutputStream outputStream) { ByteBuffer buffer = BinarySerde.toByteBuffer(arr); try (WritableByteChannel channel = Channels.newChannel(outputStream)) { channel.write(buffer); } catch (IOException e) { e.printStackTrace(); } }
[ "public", "static", "void", "writeArrayToOutputStream", "(", "INDArray", "arr", ",", "OutputStream", "outputStream", ")", "{", "ByteBuffer", "buffer", "=", "BinarySerde", ".", "toByteBuffer", "(", "arr", ")", ";", "try", "(", "WritableByteChannel", "channel", "=",...
Write an array to an output stream. @param arr the array to write @param outputStream the output stream to write to
[ "Write", "an", "array", "to", "an", "output", "stream", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L260-L267
alibaba/canal
dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java
RowsLogBuffer.nextValue
public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta) { return nextValue(columName, columnIndex, type, meta, false); }
java
public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta) { return nextValue(columName, columnIndex, type, meta, false); }
[ "public", "final", "Serializable", "nextValue", "(", "final", "String", "columName", ",", "final", "int", "columnIndex", ",", "final", "int", "type", ",", "final", "int", "meta", ")", "{", "return", "nextValue", "(", "columName", ",", "columnIndex", ",", "ty...
Extracting next field value from packed buffer. @see mysql-5.1.60/sql/log_event.cc - Rows_log_event::print_verbose_one_row
[ "Extracting", "next", "field", "value", "from", "packed", "buffer", "." ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java#L104-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java
CATMainConsumer.requestMsgs
public void requestMsgs(int requestNumber, int receiveBytes, int requestedBytes) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "requestMsgs", new Object[] { requestNumber, receiveBytes, requestedBytes }); if (subConsumer != null) { subConsumer.requestMsgs(requestNumber, receiveBytes, requestedBytes); } else { super.requestMsgs(requestNumber, receiveBytes, requestedBytes); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "requestMsgs"); }
java
public void requestMsgs(int requestNumber, int receiveBytes, int requestedBytes) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "requestMsgs", new Object[] { requestNumber, receiveBytes, requestedBytes }); if (subConsumer != null) { subConsumer.requestMsgs(requestNumber, receiveBytes, requestedBytes); } else { super.requestMsgs(requestNumber, receiveBytes, requestedBytes); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "requestMsgs"); }
[ "public", "void", "requestMsgs", "(", "int", "requestNumber", ",", "int", "receiveBytes", ",", "int", "requestedBytes", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", "....
Requests more messages for this consumer. This call is delegated to the sub consumer if one exists or the <code>CATConsumer</code> version is used. @param requestNumber The request number which replies should be sent to. @param receiveBytes @param requestedBytes
[ "Requests", "more", "messages", "for", "this", "consumer", ".", "This", "call", "is", "delegated", "to", "the", "sub", "consumer", "if", "one", "exists", "or", "the", "<code", ">", "CATConsumer<", "/", "code", ">", "version", "is", "used", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java#L1032-L1052
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.rightShiftUnsigned
public static Number rightShiftUnsigned(Number self, Number operand) { return NumberMath.rightShiftUnsigned(self, operand); }
java
public static Number rightShiftUnsigned(Number self, Number operand) { return NumberMath.rightShiftUnsigned(self, operand); }
[ "public", "static", "Number", "rightShiftUnsigned", "(", "Number", "self", ",", "Number", "operand", ")", "{", "return", "NumberMath", ".", "rightShiftUnsigned", "(", "self", ",", "operand", ")", ";", "}" ]
Implementation of the right shift (unsigned) operator for integral types. Non integral Number types throw UnsupportedOperationException. @param self a Number object @param operand the shift distance by which to right shift (unsigned) the number @return the resulting number @since 1.5.0
[ "Implementation", "of", "the", "right", "shift", "(", "unsigned", ")", "operator", "for", "integral", "types", ".", "Non", "integral", "Number", "types", "throw", "UnsupportedOperationException", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13595-L13597
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.getChar
public static char getChar(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 2)) { return segments[0].getChar(offset); } else { return getCharMultiSegments(segments, offset); } }
java
public static char getChar(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 2)) { return segments[0].getChar(offset); } else { return getCharMultiSegments(segments, offset); } }
[ "public", "static", "char", "getChar", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "2", ")", ")", "{", "return", "segments", "[", "0", "]", ".", "getChar"...
get char from segments. @param segments target segments. @param offset value offset.
[ "get", "char", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L956-L962
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDNmTokenAttr.java
DTDNmTokenAttr.validateDefault
@Override public void validateDefault(InputProblemReporter rep, boolean normalize) throws XMLStreamException { String def = validateDefaultNmToken(rep, normalize); if (normalize) { mDefValue.setValue(def); } }
java
@Override public void validateDefault(InputProblemReporter rep, boolean normalize) throws XMLStreamException { String def = validateDefaultNmToken(rep, normalize); if (normalize) { mDefValue.setValue(def); } }
[ "@", "Override", "public", "void", "validateDefault", "(", "InputProblemReporter", "rep", ",", "boolean", "normalize", ")", "throws", "XMLStreamException", "{", "String", "def", "=", "validateDefaultNmToken", "(", "rep", ",", "normalize", ")", ";", "if", "(", "n...
Method called by the validator to ask attribute to verify that the default it has (if any) is valid for such type.
[ "Method", "called", "by", "the", "validator", "to", "ask", "attribute", "to", "verify", "that", "the", "default", "it", "has", "(", "if", "any", ")", "is", "valid", "for", "such", "type", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDNmTokenAttr.java#L103-L111
OpenTSDB/opentsdb
src/tsd/StatsRpc.java
StatsRpc.printRegionClientStats
private void printRegionClientStats(final TSDB tsdb, final HttpQuery query) { final List<RegionClientStats> region_stats = tsdb.getClient().regionStats(); final List<Map<String, Object>> stats = new ArrayList<Map<String, Object>>(region_stats.size()); for (final RegionClientStats rcs : region_stats) { final Map<String, Object> stat_map = new HashMap<String, Object>(8); stat_map.put("rpcsSent", rcs.rpcsSent()); stat_map.put("rpcsInFlight", rcs.inflightRPCs()); stat_map.put("pendingRPCs", rcs.pendingRPCs()); stat_map.put("pendingBatchedRPCs", rcs.pendingBatchedRPCs()); stat_map.put("dead", rcs.isDead()); stat_map.put("rpcid", rcs.rpcID()); stat_map.put("endpoint", rcs.remoteEndpoint()); stat_map.put("rpcsTimedout", rcs.rpcsTimedout()); stat_map.put("rpcResponsesTimedout", rcs.rpcResponsesTimedout()); stat_map.put("rpcResponsesUnknown", rcs.rpcResponsesUnknown()); stat_map.put("inflightBreached", rcs.inflightBreached()); stat_map.put("pendingBreached", rcs.pendingBreached()); stat_map.put("writesBlocked", rcs.writesBlocked()); stats.add(stat_map); } query.sendReply(query.serializer().formatRegionStatsV1(stats)); }
java
private void printRegionClientStats(final TSDB tsdb, final HttpQuery query) { final List<RegionClientStats> region_stats = tsdb.getClient().regionStats(); final List<Map<String, Object>> stats = new ArrayList<Map<String, Object>>(region_stats.size()); for (final RegionClientStats rcs : region_stats) { final Map<String, Object> stat_map = new HashMap<String, Object>(8); stat_map.put("rpcsSent", rcs.rpcsSent()); stat_map.put("rpcsInFlight", rcs.inflightRPCs()); stat_map.put("pendingRPCs", rcs.pendingRPCs()); stat_map.put("pendingBatchedRPCs", rcs.pendingBatchedRPCs()); stat_map.put("dead", rcs.isDead()); stat_map.put("rpcid", rcs.rpcID()); stat_map.put("endpoint", rcs.remoteEndpoint()); stat_map.put("rpcsTimedout", rcs.rpcsTimedout()); stat_map.put("rpcResponsesTimedout", rcs.rpcResponsesTimedout()); stat_map.put("rpcResponsesUnknown", rcs.rpcResponsesUnknown()); stat_map.put("inflightBreached", rcs.inflightBreached()); stat_map.put("pendingBreached", rcs.pendingBreached()); stat_map.put("writesBlocked", rcs.writesBlocked()); stats.add(stat_map); } query.sendReply(query.serializer().formatRegionStatsV1(stats)); }
[ "private", "void", "printRegionClientStats", "(", "final", "TSDB", "tsdb", ",", "final", "HttpQuery", "query", ")", "{", "final", "List", "<", "RegionClientStats", ">", "region_stats", "=", "tsdb", ".", "getClient", "(", ")", ".", "regionStats", "(", ")", ";...
Display stats for each region client @param tsdb The TSDB to use for fetching stats @param query The query to respond to
[ "Display", "stats", "for", "each", "region", "client" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/StatsRpc.java#L153-L176
buschmais/extended-objects
api/src/main/java/com/buschmais/xo/api/bootstrap/osgi/XOSGi.java
XOSGi.createXOManagerFactory
public static XOManagerFactory createXOManagerFactory(String name) { if (OSGiUtil.isXOLoadedAsOSGiBundle()) { try { BundleContext bundleContext = FrameworkUtil.getBundle(XOSGi.class).getBundleContext(); String filterString = "(name=" + name + ")"; Collection<ServiceReference<XOManagerFactory>> xoManagerFactoryServices = bundleContext.getServiceReferences(XOManagerFactory.class, filterString); for (ServiceReference<XOManagerFactory> xoManagerFactoryService : xoManagerFactoryServices) { XOManagerFactory xoManagerFactory = bundleContext.getService(xoManagerFactoryService); if (xoManagerFactory != null) { xoManagerFactory.addCloseListener(new CloseAdapter() { @Override public void onAfterClose() { bundleContext.ungetService(xoManagerFactoryService); } }); return xoManagerFactory; } } } catch (InvalidSyntaxException e) { throw new XOException("Cannot bootstrap XO implementation.", e); } } throw new XOException("Cannot bootstrap XO implementation."); }
java
public static XOManagerFactory createXOManagerFactory(String name) { if (OSGiUtil.isXOLoadedAsOSGiBundle()) { try { BundleContext bundleContext = FrameworkUtil.getBundle(XOSGi.class).getBundleContext(); String filterString = "(name=" + name + ")"; Collection<ServiceReference<XOManagerFactory>> xoManagerFactoryServices = bundleContext.getServiceReferences(XOManagerFactory.class, filterString); for (ServiceReference<XOManagerFactory> xoManagerFactoryService : xoManagerFactoryServices) { XOManagerFactory xoManagerFactory = bundleContext.getService(xoManagerFactoryService); if (xoManagerFactory != null) { xoManagerFactory.addCloseListener(new CloseAdapter() { @Override public void onAfterClose() { bundleContext.ungetService(xoManagerFactoryService); } }); return xoManagerFactory; } } } catch (InvalidSyntaxException e) { throw new XOException("Cannot bootstrap XO implementation.", e); } } throw new XOException("Cannot bootstrap XO implementation."); }
[ "public", "static", "XOManagerFactory", "createXOManagerFactory", "(", "String", "name", ")", "{", "if", "(", "OSGiUtil", ".", "isXOLoadedAsOSGiBundle", "(", ")", ")", "{", "try", "{", "BundleContext", "bundleContext", "=", "FrameworkUtil", ".", "getBundle", "(", ...
Create a {@link com.buschmais.xo.api.XOManagerFactory} for the XO unit identified by name. <p> Internally it performs a lookup in the OSGi service registry to retrieve the XOManagerFactory service that is bound to the given XO unit name. The bundle providing this XO unit must be processed by the OSGi bundle listener. </p> @param name The name of the XO unit. @return The {@link com.buschmais.xo.api.XOManagerFactory}. @see com.buschmais.xo.impl.bootstrap.osgi.XOUnitBundleListener
[ "Create", "a", "{", "@link", "com", ".", "buschmais", ".", "xo", ".", "api", ".", "XOManagerFactory", "}", "for", "the", "XO", "unit", "identified", "by", "name", ".", "<p", ">", "Internally", "it", "performs", "a", "lookup", "in", "the", "OSGi", "serv...
train
https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/api/src/main/java/com/buschmais/xo/api/bootstrap/osgi/XOSGi.java#L37-L63
sevensource/html-email-service
src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java
DefaultEmailModel.addTo
public void addTo(String address, String personal) throws AddressException { if(to == null) { to = new ArrayList<>(); } to.add( toInternetAddress(address, personal) ); }
java
public void addTo(String address, String personal) throws AddressException { if(to == null) { to = new ArrayList<>(); } to.add( toInternetAddress(address, personal) ); }
[ "public", "void", "addTo", "(", "String", "address", ",", "String", "personal", ")", "throws", "AddressException", "{", "if", "(", "to", "==", "null", ")", "{", "to", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "to", ".", "add", "(", "toIntern...
adds a recipient (To) @param address a valid email address @param personal the real world name of the sender (can be null) @throws AddressException in case of an invalid email address
[ "adds", "a", "recipient", "(", "To", ")" ]
train
https://github.com/sevensource/html-email-service/blob/a55d9ef1a2173917cb5f870854bc24e5aaebd182/src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java#L93-L98
mangstadt/biweekly
src/main/java/biweekly/component/VJournal.java
VJournal.setOrganizer
public Organizer setOrganizer(String email) { Organizer prop = (email == null) ? null : new Organizer(null, email); setOrganizer(prop); return prop; }
java
public Organizer setOrganizer(String email) { Organizer prop = (email == null) ? null : new Organizer(null, email); setOrganizer(prop); return prop; }
[ "public", "Organizer", "setOrganizer", "(", "String", "email", ")", "{", "Organizer", "prop", "=", "(", "email", "==", "null", ")", "?", "null", ":", "new", "Organizer", "(", "null", ",", "email", ")", ";", "setOrganizer", "(", "prop", ")", ";", "retur...
Sets the organizer of the journal entry. @param email the organizer's email address (e.g. "johndoe@example.com") or null to remove @return the property that was created @see <a href="http://tools.ietf.org/html/rfc5545#page-111">RFC 5545 p.111-2</a> @see <a href="http://tools.ietf.org/html/rfc2445#page-106">RFC 2445 p.106-7</a>
[ "Sets", "the", "organizer", "of", "the", "journal", "entry", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/VJournal.java#L429-L433
jmeter-maven-plugin/jmeter-maven-plugin
src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java
PropertiesFile.loadProvidedPropertiesIfAvailable
public void loadProvidedPropertiesIfAvailable(File providedPropertiesFile, boolean replaceAllProperties) throws MojoExecutionException { if (providedPropertiesFile.exists()) { Properties providedPropertySet = loadPropertiesFile(providedPropertiesFile); if (replaceAllProperties) { this.properties = providedPropertySet; } else { this.properties.putAll(providedPropertySet); } } }
java
public void loadProvidedPropertiesIfAvailable(File providedPropertiesFile, boolean replaceAllProperties) throws MojoExecutionException { if (providedPropertiesFile.exists()) { Properties providedPropertySet = loadPropertiesFile(providedPropertiesFile); if (replaceAllProperties) { this.properties = providedPropertySet; } else { this.properties.putAll(providedPropertySet); } } }
[ "public", "void", "loadProvidedPropertiesIfAvailable", "(", "File", "providedPropertiesFile", ",", "boolean", "replaceAllProperties", ")", "throws", "MojoExecutionException", "{", "if", "(", "providedPropertiesFile", ".", "exists", "(", ")", ")", "{", "Properties", "pro...
Check if a file exists. If it does calculate if we need to merge it with existing properties, or replace all existing properties. @param providedPropertiesFile A properties file that will be check to see if it exists @param replaceAllProperties If we should replace all properties, or just merge them @throws MojoExecutionException MojoExecutionException
[ "Check", "if", "a", "file", "exists", ".", "If", "it", "does", "calculate", "if", "we", "need", "to", "merge", "it", "with", "existing", "properties", "or", "replace", "all", "existing", "properties", "." ]
train
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java#L82-L91
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPanelRenderer.java
WPanelRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WPanel panel = (WPanel) component; XmlStringBuilder xml = renderContext.getWriter(); WButton submitButton = panel.getDefaultSubmitButton(); String submitId = submitButton == null ? null : submitButton.getId(); String titleText = panel.getTitleText(); boolean renderChildren = isRenderContent(panel); xml.appendTagOpen("ui:panel"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (PanelMode.LAZY.equals(panel.getMode())) { xml.appendOptionalAttribute("hidden", !renderChildren, "true"); } else { xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); } xml.appendOptionalAttribute("buttonId", submitId); xml.appendOptionalAttribute("title", titleText); xml.appendOptionalAttribute("accessKey", Util.upperCase(panel.getAccessKeyAsString())); xml.appendOptionalAttribute("type", getPanelType(panel)); xml.appendOptionalAttribute("mode", getPanelMode(panel)); xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(panel, renderContext); if (renderChildren) { renderChildren(panel, renderContext); } else { // Content will be loaded via AJAX xml.append("<ui:content/>"); } xml.appendEndTag("ui:panel"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WPanel panel = (WPanel) component; XmlStringBuilder xml = renderContext.getWriter(); WButton submitButton = panel.getDefaultSubmitButton(); String submitId = submitButton == null ? null : submitButton.getId(); String titleText = panel.getTitleText(); boolean renderChildren = isRenderContent(panel); xml.appendTagOpen("ui:panel"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (PanelMode.LAZY.equals(panel.getMode())) { xml.appendOptionalAttribute("hidden", !renderChildren, "true"); } else { xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); } xml.appendOptionalAttribute("buttonId", submitId); xml.appendOptionalAttribute("title", titleText); xml.appendOptionalAttribute("accessKey", Util.upperCase(panel.getAccessKeyAsString())); xml.appendOptionalAttribute("type", getPanelType(panel)); xml.appendOptionalAttribute("mode", getPanelMode(panel)); xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(panel, renderContext); if (renderChildren) { renderChildren(panel, renderContext); } else { // Content will be loaded via AJAX xml.append("<ui:content/>"); } xml.appendEndTag("ui:panel"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WPanel", "panel", "=", "(", "WPanel", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ...
Paints the given container. @param component the container to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "container", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPanelRenderer.java#L28-L66
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java
PostConditionException.validateLesserThan
public static void validateLesserThan( long value, long limit, String identifier ) throws PostConditionException { if( value < limit ) { return; } throw new PostConditionException( identifier + " was not lesser than " + limit + ". Was: " + value ); }
java
public static void validateLesserThan( long value, long limit, String identifier ) throws PostConditionException { if( value < limit ) { return; } throw new PostConditionException( identifier + " was not lesser than " + limit + ". Was: " + value ); }
[ "public", "static", "void", "validateLesserThan", "(", "long", "value", ",", "long", "limit", ",", "String", "identifier", ")", "throws", "PostConditionException", "{", "if", "(", "value", "<", "limit", ")", "{", "return", ";", "}", "throw", "new", "PostCond...
Validates that the value is lesser than a limit. This method ensures that <code>value < limit</code>. @param identifier The name of the object. @param limit The limit that the value must be smaller than. @param value The value to be tested. @throws PostConditionException if the condition is not met.
[ "Validates", "that", "the", "value", "is", "lesser", "than", "a", "limit", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L149-L157
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_doc_image.java
mps_doc_image.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { mps_doc_image_responses result = (mps_doc_image_responses) service.get_payload_formatter().string_to_resource(mps_doc_image_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.mps_doc_image_response_array); } mps_doc_image[] result_mps_doc_image = new mps_doc_image[result.mps_doc_image_response_array.length]; for(int i = 0; i < result.mps_doc_image_response_array.length; i++) { result_mps_doc_image[i] = result.mps_doc_image_response_array[i].mps_doc_image[0]; } return result_mps_doc_image; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { mps_doc_image_responses result = (mps_doc_image_responses) service.get_payload_formatter().string_to_resource(mps_doc_image_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.mps_doc_image_response_array); } mps_doc_image[] result_mps_doc_image = new mps_doc_image[result.mps_doc_image_response_array.length]; for(int i = 0; i < result.mps_doc_image_response_array.length; i++) { result_mps_doc_image[i] = result.mps_doc_image_response_array[i].mps_doc_image[0]; } return result_mps_doc_image; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "mps_doc_image_responses", "result", "=", "(", "mps_doc_image_responses", ")", "service", ".", "get_payload_fo...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_doc_image.java#L265-L282
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.biFunction
public static <T, U, R> BiFunction<T, U, R> biFunction(CheckedBiFunction<T, U, R> function, Consumer<Throwable> handler) { return (t, u) -> { try { return function.apply(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static <T, U, R> BiFunction<T, U, R> biFunction(CheckedBiFunction<T, U, R> function, Consumer<Throwable> handler) { return (t, u) -> { try { return function.apply(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "<", "T", ",", "U", ",", "R", ">", "BiFunction", "<", "T", ",", "U", ",", "R", ">", "biFunction", "(", "CheckedBiFunction", "<", "T", ",", "U", ",", "R", ">", "function", ",", "Consumer", "<", "Throwable", ">", "handler", ")", ...
Wrap a {@link CheckedBiFunction} in a {@link BiFunction} with a custom handler for checked exceptions. <p> Example: <code><pre> map.computeIfPresent("key", Unchecked.biFunction( (k, v) -> { if (k == null || v == null) throw new Exception("No nulls allowed in map"); return 42; }, e -> { throw new IllegalStateException(e); } )); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedBiFunction", "}", "in", "a", "{", "@link", "BiFunction", "}", "with", "a", "custom", "handler", "for", "checked", "exceptions", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "map", ".", "computeIfPresent", ...
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L351-L362
belaban/JGroups
src/org/jgroups/blocks/ReplicatedHashMap.java
ReplicatedHashMap.put
public V put(K key, V value) { V prev_val=get(key); try { MethodCall call=new MethodCall(PUT, key, value); disp.callRemoteMethods(null, call, call_options); } catch(Exception e) { throw new RuntimeException("put(" + key + ", " + value + ") failed", e); } return prev_val; }
java
public V put(K key, V value) { V prev_val=get(key); try { MethodCall call=new MethodCall(PUT, key, value); disp.callRemoteMethods(null, call, call_options); } catch(Exception e) { throw new RuntimeException("put(" + key + ", " + value + ") failed", e); } return prev_val; }
[ "public", "V", "put", "(", "K", "key", ",", "V", "value", ")", "{", "V", "prev_val", "=", "get", "(", "key", ")", ";", "try", "{", "MethodCall", "call", "=", "new", "MethodCall", "(", "PUT", ",", "key", ",", "value", ")", ";", "disp", ".", "cal...
Maps the specified key to the specified value in this table. Neither the key nor the value can be null. <p/> <p> The value can be retrieved by calling the <tt>get</tt> method with a key that is equal to the original key. @param key key with which the specified value is to be associated @param value value to be associated with the specified key @return the previous value associated with <tt>key</tt>, or <tt>null</tt> if there was no mapping for <tt>key</tt> @throws NullPointerException if the specified key or value is null
[ "Maps", "the", "specified", "key", "to", "the", "specified", "value", "in", "this", "table", ".", "Neither", "the", "key", "nor", "the", "value", "can", "be", "null", ".", "<p", "/", ">", "<p", ">", "The", "value", "can", "be", "retrieved", "by", "ca...
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/ReplicatedHashMap.java#L218-L228
di2e/Argo
PluginFramework/src/main/java/ws/argo/probe/Probe.java
Probe.frameProbeFrom
public static Probe frameProbeFrom(Probe p) throws ProbeSenderException { Probe fp = null; try { fp = new Probe(p.getProbeWrapper().getRespondToPayloadType()); } catch (UnsupportedPayloadType e1) { throw new ProbeSenderException("Error in creating frame probe.", e1); } fp.setHopLimit(p.getHopLimit()); fp.setClientID(p.getClientID()); for (RespondToURL respondTo : p.getProbeWrapper().getRespondToURLs()) { try { fp.addRespondToURL(respondTo.getLabel(), respondTo.getUrl()); } catch (MalformedURLException e) { throw new ProbeSenderException("Error in creating frame probe.", e); } } return fp; }
java
public static Probe frameProbeFrom(Probe p) throws ProbeSenderException { Probe fp = null; try { fp = new Probe(p.getProbeWrapper().getRespondToPayloadType()); } catch (UnsupportedPayloadType e1) { throw new ProbeSenderException("Error in creating frame probe.", e1); } fp.setHopLimit(p.getHopLimit()); fp.setClientID(p.getClientID()); for (RespondToURL respondTo : p.getProbeWrapper().getRespondToURLs()) { try { fp.addRespondToURL(respondTo.getLabel(), respondTo.getUrl()); } catch (MalformedURLException e) { throw new ProbeSenderException("Error in creating frame probe.", e); } } return fp; }
[ "public", "static", "Probe", "frameProbeFrom", "(", "Probe", "p", ")", "throws", "ProbeSenderException", "{", "Probe", "fp", "=", "null", ";", "try", "{", "fp", "=", "new", "Probe", "(", "p", ".", "getProbeWrapper", "(", ")", ".", "getRespondToPayloadType", ...
Create a new probe from the argument that includes all the frame stuff (payload type, respondTo addr, etc) but don't include any of the contract or service ids. This method is a helper method for splitting over sized probes into smaller probes so that the packets are not too big for the network. @param p the source probe @return the probe frame @throws ProbeSenderException if something went wrong
[ "Create", "a", "new", "probe", "from", "the", "argument", "that", "includes", "all", "the", "frame", "stuff", "(", "payload", "type", "respondTo", "addr", "etc", ")", "but", "don", "t", "include", "any", "of", "the", "contract", "or", "service", "ids", "...
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/PluginFramework/src/main/java/ws/argo/probe/Probe.java#L60-L79
elki-project/elki
elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/deliclu/DeLiCluNode.java
DeLiCluNode.integrityCheckParameters
@Override protected void integrityCheckParameters(DeLiCluNode parent, int index) { super.integrityCheckParameters(parent, index); // test if hasHandled and hasUnhandled flag are correctly set DeLiCluEntry entry = parent.getEntry(index); boolean hasHandled = hasHandled(); boolean hasUnhandled = hasUnhandled(); if(entry.hasHandled() != hasHandled) { String soll = Boolean.toString(hasHandled); String ist = Boolean.toString(entry.hasHandled()); throw new RuntimeException("Wrong hasHandled in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist); } if(entry.hasUnhandled() != hasUnhandled) { String soll = Boolean.toString(hasUnhandled); String ist = Boolean.toString(entry.hasUnhandled()); throw new RuntimeException("Wrong hasUnhandled in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist); } }
java
@Override protected void integrityCheckParameters(DeLiCluNode parent, int index) { super.integrityCheckParameters(parent, index); // test if hasHandled and hasUnhandled flag are correctly set DeLiCluEntry entry = parent.getEntry(index); boolean hasHandled = hasHandled(); boolean hasUnhandled = hasUnhandled(); if(entry.hasHandled() != hasHandled) { String soll = Boolean.toString(hasHandled); String ist = Boolean.toString(entry.hasHandled()); throw new RuntimeException("Wrong hasHandled in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist); } if(entry.hasUnhandled() != hasUnhandled) { String soll = Boolean.toString(hasUnhandled); String ist = Boolean.toString(entry.hasUnhandled()); throw new RuntimeException("Wrong hasUnhandled in node " + parent.getPageID() + " at index " + index + " (child " + entry + ")" + "\nsoll: " + soll + ",\n ist: " + ist); } }
[ "@", "Override", "protected", "void", "integrityCheckParameters", "(", "DeLiCluNode", "parent", ",", "int", "index", ")", "{", "super", ".", "integrityCheckParameters", "(", "parent", ",", "index", ")", ";", "// test if hasHandled and hasUnhandled flag are correctly set",...
Tests, if the parameters of the entry representing this node, are correctly set. Subclasses may need to overwrite this method. @param parent the parent holding the entry representing this node @param index the index of the entry in the parents child array
[ "Tests", "if", "the", "parameters", "of", "the", "entry", "representing", "this", "node", "are", "correctly", "set", ".", "Subclasses", "may", "need", "to", "overwrite", "this", "method", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/deliclu/DeLiCluNode.java#L106-L123
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processFaultyGuiStrings
private void processFaultyGuiStrings() { FQMethod methodInfo = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()); Integer parmIndex = displayTextMethods.get(methodInfo); if ((parmIndex != null) && (stack.getStackDepth() > parmIndex.intValue())) { OpcodeStack.Item item = stack.getStackItem(parmIndex.intValue()); if (item.getConstant() != null) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NON_TRANSLATABLE_STRING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); } else if (S508UserValue.APPENDED_STRING == item.getUserValue()) { bugReporter.reportBug( new BugInstance(this, BugType.S508C_APPENDED_STRING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); } } }
java
private void processFaultyGuiStrings() { FQMethod methodInfo = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()); Integer parmIndex = displayTextMethods.get(methodInfo); if ((parmIndex != null) && (stack.getStackDepth() > parmIndex.intValue())) { OpcodeStack.Item item = stack.getStackItem(parmIndex.intValue()); if (item.getConstant() != null) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NON_TRANSLATABLE_STRING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); } else if (S508UserValue.APPENDED_STRING == item.getUserValue()) { bugReporter.reportBug( new BugInstance(this, BugType.S508C_APPENDED_STRING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); } } }
[ "private", "void", "processFaultyGuiStrings", "(", ")", "{", "FQMethod", "methodInfo", "=", "new", "FQMethod", "(", "getClassConstantOperand", "(", ")", ",", "getNameConstantOperand", "(", ")", ",", "getSigConstantOperand", "(", ")", ")", ";", "Integer", "parmInde...
looks for calls to set a readable string that is generated from a static constant, as these strings are not translatable. also looks for setting readable strings that are appended together. This is likely not to be internationalizable.
[ "looks", "for", "calls", "to", "set", "a", "readable", "string", "that", "is", "generated", "from", "a", "static", "constant", "as", "these", "strings", "are", "not", "translatable", ".", "also", "looks", "for", "setting", "readable", "strings", "that", "are...
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L343-L357
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitionsConfig.java
TransitionsConfig.exportTiles
private static void exportTiles(Xml nodeTransition, Collection<TileRef> tilesRef) { for (final TileRef tileRef : tilesRef) { final Xml nodeTileRef = TileConfig.exports(tileRef); nodeTransition.add(nodeTileRef); } }
java
private static void exportTiles(Xml nodeTransition, Collection<TileRef> tilesRef) { for (final TileRef tileRef : tilesRef) { final Xml nodeTileRef = TileConfig.exports(tileRef); nodeTransition.add(nodeTileRef); } }
[ "private", "static", "void", "exportTiles", "(", "Xml", "nodeTransition", ",", "Collection", "<", "TileRef", ">", "tilesRef", ")", "{", "for", "(", "final", "TileRef", "tileRef", ":", "tilesRef", ")", "{", "final", "Xml", "nodeTileRef", "=", "TileConfig", "....
Export all tiles for the transition. @param nodeTransition The transition node (must not be <code>null</code>). @param tilesRef The transition tiles ref (must not be <code>null</code>).
[ "Export", "all", "tiles", "for", "the", "transition", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitionsConfig.java#L164-L171