repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java
TrustedIdProvidersInner.createOrUpdate
public TrustedIdProviderInner createOrUpdate(String resourceGroupName, String accountName, String trustedIdProviderName, CreateOrUpdateTrustedIdProviderParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).toBlocking().single().body(); }
java
public TrustedIdProviderInner createOrUpdate(String resourceGroupName, String accountName, String trustedIdProviderName, CreateOrUpdateTrustedIdProviderParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, trustedIdProviderName, parameters).toBlocking().single().body(); }
[ "public", "TrustedIdProviderInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "trustedIdProviderName", ",", "CreateOrUpdateTrustedIdProviderParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAs...
Creates or updates the specified trusted identity provider. During update, the trusted identity provider with the specified name will be replaced with this new provider. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param trustedIdProviderName The name of the trusted identity provider. This is used for differentiation of providers in the account. @param parameters Parameters supplied to create or replace the trusted identity provider. @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 TrustedIdProviderInner object if successful.
[ "Creates", "or", "updates", "the", "specified", "trusted", "identity", "provider", ".", "During", "update", "the", "trusted", "identity", "provider", "with", "the", "specified", "name", "will", "be", "replaced", "with", "this", "new", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java#L228-L230
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionGroupConfig.java
CollisionGroupConfig.imports
public static CollisionGroupConfig imports(Xml root, MapTileCollision map) { Check.notNull(root); Check.notNull(map); final Collection<Xml> childrenCollision = root.getChildren(NODE_COLLISION); final Map<String, CollisionGroup> groups = new HashMap<>(childrenCollision.size()); for (final Xml node : childrenCollision) { final Collection<Xml> childrenFormula = node.getChildren(CollisionFormulaConfig.NODE_FORMULA); final Collection<CollisionFormula> formulas = new ArrayList<>(childrenFormula.size()); for (final Xml formula : childrenFormula) { final String formulaName = formula.getText(); formulas.add(map.getCollisionFormula(formulaName)); } final String groupName = node.readString(ATT_GROUP); final CollisionGroup collision = new CollisionGroup(groupName, formulas); groups.put(groupName, collision); } return new CollisionGroupConfig(groups); }
java
public static CollisionGroupConfig imports(Xml root, MapTileCollision map) { Check.notNull(root); Check.notNull(map); final Collection<Xml> childrenCollision = root.getChildren(NODE_COLLISION); final Map<String, CollisionGroup> groups = new HashMap<>(childrenCollision.size()); for (final Xml node : childrenCollision) { final Collection<Xml> childrenFormula = node.getChildren(CollisionFormulaConfig.NODE_FORMULA); final Collection<CollisionFormula> formulas = new ArrayList<>(childrenFormula.size()); for (final Xml formula : childrenFormula) { final String formulaName = formula.getText(); formulas.add(map.getCollisionFormula(formulaName)); } final String groupName = node.readString(ATT_GROUP); final CollisionGroup collision = new CollisionGroup(groupName, formulas); groups.put(groupName, collision); } return new CollisionGroupConfig(groups); }
[ "public", "static", "CollisionGroupConfig", "imports", "(", "Xml", "root", ",", "MapTileCollision", "map", ")", "{", "Check", ".", "notNull", "(", "root", ")", ";", "Check", ".", "notNull", "(", "map", ")", ";", "final", "Collection", "<", "Xml", ">", "c...
Create the collision group data from node. @param root The node root reference (must not be <code>null</code>). @param map The map reference (must not be <code>null</code>). @return The collisions group data. @throws LionEngineException If unable to read node.
[ "Create", "the", "collision", "group", "data", "from", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionGroupConfig.java#L92-L117
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/managers/MessageMgr.java
MessageMgr.createWarningMessage
public static Message5WH createWarningMessage(String what, Object ... obj){ return new Message5WH_Builder().addWhat(FormattingTupleWrapper.create(what, obj)).setType(E_MessageType.WARNING).build(); }
java
public static Message5WH createWarningMessage(String what, Object ... obj){ return new Message5WH_Builder().addWhat(FormattingTupleWrapper.create(what, obj)).setType(E_MessageType.WARNING).build(); }
[ "public", "static", "Message5WH", "createWarningMessage", "(", "String", "what", ",", "Object", "...", "obj", ")", "{", "return", "new", "Message5WH_Builder", "(", ")", ".", "addWhat", "(", "FormattingTupleWrapper", ".", "create", "(", "what", ",", "obj", ")",...
Creates a new warning message. @param what the what part of the message (what has happened) @param obj objects to add to the message @return new information message
[ "Creates", "a", "new", "warning", "message", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/managers/MessageMgr.java#L112-L114
paymill/paymill-java
src/main/java/com/paymill/services/TransactionService.java
TransactionService.createWithPaymentAndClient
public Transaction createWithPaymentAndClient( String paymentId, String clientId, Integer amount, String currency, String description ) { return this.createWithPaymentAndClient( new Payment( paymentId ), new Client( clientId ), amount, currency, description ); }
java
public Transaction createWithPaymentAndClient( String paymentId, String clientId, Integer amount, String currency, String description ) { return this.createWithPaymentAndClient( new Payment( paymentId ), new Client( clientId ), amount, currency, description ); }
[ "public", "Transaction", "createWithPaymentAndClient", "(", "String", "paymentId", ",", "String", "clientId", ",", "Integer", "amount", ",", "String", "currency", ",", "String", "description", ")", "{", "return", "this", ".", "createWithPaymentAndClient", "(", "new"...
Executes a {@link Transaction} with {@link Payment} for the given amount in the given currency. @param paymentId The Id of a PAYMILL {@link Payment} representing credit card or direct debit. @param clientId The Id of a PAYMILL {@link Client} which have to be charged. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @param description A short description for the transaction. @return {@link Transaction} object indicating whether a the call was successful or not.
[ "Executes", "a", "{" ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L325-L327
optimaize/anythingworks
client/rest/src/main/java/com/optimaize/anythingworks/client/rest/http/RestHttpClientImpl.java
RestHttpClientImpl.deserializeResult
private <T> T deserializeResult(Response response, @Nullable String envelopeFieldName, TypeRef returnType) throws WebApplicationException { String contentType = readContentType(response); String body = readBody(response); if (contentType.startsWith("application/json")) { try { if (envelopeFieldName!=null) { return jsonMarshaller.deserializeEnveloped(body, envelopeFieldName, returnType); } else { return jsonMarshaller.deserialize(body, returnType); } } catch (JsonMarshallingException e) { String msg = "Failed unmarshalling JSON data from server to object: "+e.getMessage(); // throw new ClientErrorException(Response.Status.BAD_REQUEST, e); Retry retry; if (response.getStatusInfo().getFamily() == Response.Status.Family.SERVER_ERROR) { //it is likely that the server can handle it next time, and there won't be an error at all. //then there won't be a problem unmarshalling the error info either. retry = Retry.now(); } else { //success: no, because it's unlikely the server sends a different response next time. //client error: no, because the client's data is wrong anyway, we just can't understand the detail // why it's wrong, but it's still wrong next time. // this could happen when the client uses an outdated protocol. server rejects it, and // the client can't even understand (the detail of) the response. retry = Retry.no(); } throw new ClientServiceException( new RestFaultInfo( "Protocol", Blame.CLIENT, msg, ""+ErrorCodes.Client.UNMARSHALLING_FAILED.getCode(), null, retry, retry, response.getStatusInfo().getStatusCode(), response.getStatusInfo().getReasonPhrase() ), e ); } } else if (returnType.getType().equals(String.class)) { // Expecting string, return the raw response body. return (T) body; } else { String msg = "Client requested content type >>>"+ACCEPT+"<<< but server sent >>>\"" + contentType + "\"<<< and that is not supported for type: " + returnType.getType(); // throw new NotSupportedException(msg); throw new BadResponseServiceException( new RestFaultInfo("BadResponse", Blame.SERVER, msg, ""+ErrorCodes.Server.BAD_RESPONSE.getCode(), null, Retry.no(), Retry.no(), response.getStatusInfo().getStatusCode(), response.getStatusInfo().getReasonPhrase() ) ); } }
java
private <T> T deserializeResult(Response response, @Nullable String envelopeFieldName, TypeRef returnType) throws WebApplicationException { String contentType = readContentType(response); String body = readBody(response); if (contentType.startsWith("application/json")) { try { if (envelopeFieldName!=null) { return jsonMarshaller.deserializeEnveloped(body, envelopeFieldName, returnType); } else { return jsonMarshaller.deserialize(body, returnType); } } catch (JsonMarshallingException e) { String msg = "Failed unmarshalling JSON data from server to object: "+e.getMessage(); // throw new ClientErrorException(Response.Status.BAD_REQUEST, e); Retry retry; if (response.getStatusInfo().getFamily() == Response.Status.Family.SERVER_ERROR) { //it is likely that the server can handle it next time, and there won't be an error at all. //then there won't be a problem unmarshalling the error info either. retry = Retry.now(); } else { //success: no, because it's unlikely the server sends a different response next time. //client error: no, because the client's data is wrong anyway, we just can't understand the detail // why it's wrong, but it's still wrong next time. // this could happen when the client uses an outdated protocol. server rejects it, and // the client can't even understand (the detail of) the response. retry = Retry.no(); } throw new ClientServiceException( new RestFaultInfo( "Protocol", Blame.CLIENT, msg, ""+ErrorCodes.Client.UNMARSHALLING_FAILED.getCode(), null, retry, retry, response.getStatusInfo().getStatusCode(), response.getStatusInfo().getReasonPhrase() ), e ); } } else if (returnType.getType().equals(String.class)) { // Expecting string, return the raw response body. return (T) body; } else { String msg = "Client requested content type >>>"+ACCEPT+"<<< but server sent >>>\"" + contentType + "\"<<< and that is not supported for type: " + returnType.getType(); // throw new NotSupportedException(msg); throw new BadResponseServiceException( new RestFaultInfo("BadResponse", Blame.SERVER, msg, ""+ErrorCodes.Server.BAD_RESPONSE.getCode(), null, Retry.no(), Retry.no(), response.getStatusInfo().getStatusCode(), response.getStatusInfo().getReasonPhrase() ) ); } }
[ "private", "<", "T", ">", "T", "deserializeResult", "(", "Response", "response", ",", "@", "Nullable", "String", "envelopeFieldName", ",", "TypeRef", "returnType", ")", "throws", "WebApplicationException", "{", "String", "contentType", "=", "readContentType", "(", ...
Deserialize response body as received from the server to Java object according to the Content-Type (only JSON is supported for now).
[ "Deserialize", "response", "body", "as", "received", "from", "the", "server", "to", "Java", "object", "according", "to", "the", "Content", "-", "Type", "(", "only", "JSON", "is", "supported", "for", "now", ")", "." ]
train
https://github.com/optimaize/anythingworks/blob/23e5f1c63cd56d935afaac4ad033c7996b32a1f2/client/rest/src/main/java/com/optimaize/anythingworks/client/rest/http/RestHttpClientImpl.java#L249-L304
looly/hutool
hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java
ThreadUtil.newExecutor
public static ThreadPoolExecutor newExecutor(int corePoolSize, int maximumPoolSize) { return ExecutorBuilder.create().setCorePoolSize(corePoolSize).setMaxPoolSize(maximumPoolSize).build(); }
java
public static ThreadPoolExecutor newExecutor(int corePoolSize, int maximumPoolSize) { return ExecutorBuilder.create().setCorePoolSize(corePoolSize).setMaxPoolSize(maximumPoolSize).build(); }
[ "public", "static", "ThreadPoolExecutor", "newExecutor", "(", "int", "corePoolSize", ",", "int", "maximumPoolSize", ")", "{", "return", "ExecutorBuilder", ".", "create", "(", ")", ".", "setCorePoolSize", "(", "corePoolSize", ")", ".", "setMaxPoolSize", "(", "maxim...
获得一个新的线程池<br> 如果maximumPoolSize =》 corePoolSize,在没有新任务加入的情况下,多出的线程将最多保留60s @param corePoolSize 初始线程池大小 @param maximumPoolSize 最大线程池大小 @return {@link ThreadPoolExecutor}
[ "获得一个新的线程池<br", ">", "如果maximumPoolSize", "=", "》", "corePoolSize,在没有新任务加入的情况下,多出的线程将最多保留60s" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L59-L61
iipc/webarchive-commons
src/main/java/org/archive/io/GenerationFileHandler.java
GenerationFileHandler.rotate
public GenerationFileHandler rotate(String storeSuffix, String activeSuffix) throws IOException { return rotate(storeSuffix, activeSuffix, false); }
java
public GenerationFileHandler rotate(String storeSuffix, String activeSuffix) throws IOException { return rotate(storeSuffix, activeSuffix, false); }
[ "public", "GenerationFileHandler", "rotate", "(", "String", "storeSuffix", ",", "String", "activeSuffix", ")", "throws", "IOException", "{", "return", "rotate", "(", "storeSuffix", ",", "activeSuffix", ",", "false", ")", ";", "}" ]
Move the current file to a new filename with the storeSuffix in place of the activeSuffix; continuing logging to a new file under the original filename. @param storeSuffix Suffix to put in place of <code>activeSuffix</code> @param activeSuffix Suffix to replace with <code>storeSuffix</code>. @return GenerationFileHandler instance. @throws IOException
[ "Move", "the", "current", "file", "to", "a", "new", "filename", "with", "the", "storeSuffix", "in", "place", "of", "the", "activeSuffix", ";", "continuing", "logging", "to", "a", "new", "file", "under", "the", "original", "filename", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/GenerationFileHandler.java#L91-L95
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java
SourceLineAnnotation.createUnknown
@Nonnull public static SourceLineAnnotation createUnknown(@DottedClassName String className, String sourceFile, int startBytecode, int endBytecode) { SourceLineAnnotation result = new SourceLineAnnotation(className, sourceFile, -1, -1, startBytecode, endBytecode); // result.setDescription("SOURCE_LINE_UNKNOWN"); return result; }
java
@Nonnull public static SourceLineAnnotation createUnknown(@DottedClassName String className, String sourceFile, int startBytecode, int endBytecode) { SourceLineAnnotation result = new SourceLineAnnotation(className, sourceFile, -1, -1, startBytecode, endBytecode); // result.setDescription("SOURCE_LINE_UNKNOWN"); return result; }
[ "@", "Nonnull", "public", "static", "SourceLineAnnotation", "createUnknown", "(", "@", "DottedClassName", "String", "className", ",", "String", "sourceFile", ",", "int", "startBytecode", ",", "int", "endBytecode", ")", "{", "SourceLineAnnotation", "result", "=", "ne...
Factory method to create an unknown source line annotation. This variant is used when bytecode offsets are known, but not source lines. @param className the class name @param sourceFile the source file name @return the SourceLineAnnotation
[ "Factory", "method", "to", "create", "an", "unknown", "source", "line", "annotation", ".", "This", "variant", "is", "used", "when", "bytecode", "offsets", "are", "known", "but", "not", "source", "lines", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L206-L211
anotheria/configureme
src/main/java/org/configureme/util/StringUtils.java
StringUtils.replaceOnce
public static String replaceOnce(final String src, final String toReplace, final String with) { final int index = src.indexOf(toReplace); if (index == -1) return src; String s = src.substring(0, index); s += with; s += src.substring(index + toReplace.length(), src.length()); return s; }
java
public static String replaceOnce(final String src, final String toReplace, final String with) { final int index = src.indexOf(toReplace); if (index == -1) return src; String s = src.substring(0, index); s += with; s += src.substring(index + toReplace.length(), src.length()); return s; }
[ "public", "static", "String", "replaceOnce", "(", "final", "String", "src", ",", "final", "String", "toReplace", ",", "final", "String", "with", ")", "{", "final", "int", "index", "=", "src", ".", "indexOf", "(", "toReplace", ")", ";", "if", "(", "index"...
Replace once in source {@link java.lang.String} some {@link java.lang.String} with new {@link java.lang.String}. @param src source string @param toReplace string to replace @param with new string @return {@link java.lang.String} after replacement
[ "Replace", "once", "in", "source", "{", "@link", "java", ".", "lang", ".", "String", "}", "some", "{", "@link", "java", ".", "lang", ".", "String", "}", "with", "new", "{", "@link", "java", ".", "lang", ".", "String", "}", "." ]
train
https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/util/StringUtils.java#L307-L316
alkacon/opencms-core
src/org/opencms/configuration/CmsElementWithSubElementsParamConfigHelper.java
CmsElementWithSubElementsParamConfigHelper.addRules
public void addRules(Digester digester) { digester.addRule(m_basePath, new Rule() { @SuppressWarnings("synthetic-access") @Override public void begin(String namespace, String name, Attributes attributes) throws Exception { I_CmsConfigurationParameterHandler config = (I_CmsConfigurationParameterHandler)(m_class.newInstance()); config.initConfiguration(); getDigester().push(config); } @Override public void end(String namespace, String name) throws Exception { getDigester().pop(); } }); for (String elem : m_subElements) { digester.addRule(m_basePath + "/" + elem, new Rule() { @Override public void body(String namespace, String name, String text) throws Exception { I_CmsConfigurationParameterHandler handler = (I_CmsConfigurationParameterHandler)(getDigester().peek()); handler.addConfigurationParameter(name, text); } }); } }
java
public void addRules(Digester digester) { digester.addRule(m_basePath, new Rule() { @SuppressWarnings("synthetic-access") @Override public void begin(String namespace, String name, Attributes attributes) throws Exception { I_CmsConfigurationParameterHandler config = (I_CmsConfigurationParameterHandler)(m_class.newInstance()); config.initConfiguration(); getDigester().push(config); } @Override public void end(String namespace, String name) throws Exception { getDigester().pop(); } }); for (String elem : m_subElements) { digester.addRule(m_basePath + "/" + elem, new Rule() { @Override public void body(String namespace, String name, String text) throws Exception { I_CmsConfigurationParameterHandler handler = (I_CmsConfigurationParameterHandler)(getDigester().peek()); handler.addConfigurationParameter(name, text); } }); } }
[ "public", "void", "addRules", "(", "Digester", "digester", ")", "{", "digester", ".", "addRule", "(", "m_basePath", ",", "new", "Rule", "(", ")", "{", "@", "SuppressWarnings", "(", "\"synthetic-access\"", ")", "@", "Override", "public", "void", "begin", "(",...
Adds the configuration parsing rules to the digester.<p> @param digester the digester to which the rules should be added
[ "Adds", "the", "configuration", "parsing", "rules", "to", "the", "digester", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsElementWithSubElementsParamConfigHelper.java#L78-L110
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java
BatchKernelImpl.createJobInstance
@Override public WSJobInstance createJobInstance(String appName, String jobXMLName, String submitter, String jsl, String correlationId) { JobInstanceEntity retMe = null; retMe = getPersistenceManagerService().createJobInstance(appName, jobXMLName, jsl, submitter, new Date()); publishEvent(retMe, BatchEventsPublisher.TOPIC_INSTANCE_SUBMITTED, correlationId); return retMe; }
java
@Override public WSJobInstance createJobInstance(String appName, String jobXMLName, String submitter, String jsl, String correlationId) { JobInstanceEntity retMe = null; retMe = getPersistenceManagerService().createJobInstance(appName, jobXMLName, jsl, submitter, new Date()); publishEvent(retMe, BatchEventsPublisher.TOPIC_INSTANCE_SUBMITTED, correlationId); return retMe; }
[ "@", "Override", "public", "WSJobInstance", "createJobInstance", "(", "String", "appName", ",", "String", "jobXMLName", ",", "String", "submitter", ",", "String", "jsl", ",", "String", "correlationId", ")", "{", "JobInstanceEntity", "retMe", "=", "null", ";", "r...
@return a new JobInstance for the given appName and JSL file. Note: Inline JSL takes precedence over JSL within .war
[ "@return", "a", "new", "JobInstance", "for", "the", "given", "appName", "and", "JSL", "file", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java#L272-L286
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/entry/sequence/Sequence.java
Sequence.getSequence
@Deprecated @Override public String getSequence(Long beginPosition, Long endPosition) { if (beginPosition == null || endPosition == null || (beginPosition > endPosition) || beginPosition < 1 || endPosition >getLength()) { return null; } int length = (int) (endPosition.longValue() - beginPosition.longValue()) + 1; int offset = beginPosition.intValue() - 1; String subSequence=null; try{ subSequence= ByteBufferUtils.string(getSequenceBuffer(), offset, length); } catch(Exception e) { e.printStackTrace(); return subSequence; } return subSequence; /*// note begin:1 end:4 has length 4 byte[] subsequence = new byte[length]; synchronized (sequence) { sequence.position(offset); sequence.get(subsequence, 0, length); } String string = new String(subsequence); return string;*/ }
java
@Deprecated @Override public String getSequence(Long beginPosition, Long endPosition) { if (beginPosition == null || endPosition == null || (beginPosition > endPosition) || beginPosition < 1 || endPosition >getLength()) { return null; } int length = (int) (endPosition.longValue() - beginPosition.longValue()) + 1; int offset = beginPosition.intValue() - 1; String subSequence=null; try{ subSequence= ByteBufferUtils.string(getSequenceBuffer(), offset, length); } catch(Exception e) { e.printStackTrace(); return subSequence; } return subSequence; /*// note begin:1 end:4 has length 4 byte[] subsequence = new byte[length]; synchronized (sequence) { sequence.position(offset); sequence.get(subsequence, 0, length); } String string = new String(subsequence); return string;*/ }
[ "@", "Deprecated", "@", "Override", "public", "String", "getSequence", "(", "Long", "beginPosition", ",", "Long", "endPosition", ")", "{", "if", "(", "beginPosition", "==", "null", "||", "endPosition", "==", "null", "||", "(", "beginPosition", ">", "endPositio...
Overridden so we can create appropriate sized buffer before making string. @see uk.ac.ebi.embl.api.entry.sequence.AbstractSequence#getSequence(java.lang.Long, java.lang.Long)
[ "Overridden", "so", "we", "can", "create", "appropriate", "sized", "buffer", "before", "making", "string", "." ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/entry/sequence/Sequence.java#L137-L173
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/cookie/CookieFlagsDetector.java
CookieFlagsDetector.getCookieInstructionLocation
private Location getCookieInstructionLocation(ConstantPoolGen cpg, Location startLocation, int objectStackLocation, String invokeInstruction) { Location location = startLocation; InstructionHandle handle = location.getHandle(); int loadedStackValue = 0; // Loop until we find the setSecure call for this cookie while (handle.getNext() != null) { handle = handle.getNext(); Instruction nextInst = handle.getInstruction(); // We check if the index of the cookie used for this invoke is the same as the one provided if (nextInst instanceof ALOAD) { ALOAD loadInst = (ALOAD)nextInst; loadedStackValue = loadInst.getIndex(); } if (nextInst instanceof INVOKEVIRTUAL && loadedStackValue == objectStackLocation) { INVOKEVIRTUAL invoke = (INVOKEVIRTUAL) nextInst; String methodNameWithSignature = invoke.getClassName(cpg) + "." + invoke.getMethodName(cpg); if (methodNameWithSignature.equals(invokeInstruction)) { Integer val = ByteCode.getConstantInt(handle.getPrev()); if (val != null && val == TRUE_INT_VALUE) { return new Location(handle, location.getBasicBlock()); } } } } return null; }
java
private Location getCookieInstructionLocation(ConstantPoolGen cpg, Location startLocation, int objectStackLocation, String invokeInstruction) { Location location = startLocation; InstructionHandle handle = location.getHandle(); int loadedStackValue = 0; // Loop until we find the setSecure call for this cookie while (handle.getNext() != null) { handle = handle.getNext(); Instruction nextInst = handle.getInstruction(); // We check if the index of the cookie used for this invoke is the same as the one provided if (nextInst instanceof ALOAD) { ALOAD loadInst = (ALOAD)nextInst; loadedStackValue = loadInst.getIndex(); } if (nextInst instanceof INVOKEVIRTUAL && loadedStackValue == objectStackLocation) { INVOKEVIRTUAL invoke = (INVOKEVIRTUAL) nextInst; String methodNameWithSignature = invoke.getClassName(cpg) + "." + invoke.getMethodName(cpg); if (methodNameWithSignature.equals(invokeInstruction)) { Integer val = ByteCode.getConstantInt(handle.getPrev()); if (val != null && val == TRUE_INT_VALUE) { return new Location(handle, location.getBasicBlock()); } } } } return null; }
[ "private", "Location", "getCookieInstructionLocation", "(", "ConstantPoolGen", "cpg", ",", "Location", "startLocation", ",", "int", "objectStackLocation", ",", "String", "invokeInstruction", ")", "{", "Location", "location", "=", "startLocation", ";", "InstructionHandle",...
This method is used to track calls made on a specific object. For instance, this could be used to track if "setHttpOnly(true)" was executed on a specific cookie object. This allows the detector to find interchanged calls like this Cookie cookie1 = new Cookie("f", "foo"); <- This cookie is unsafe Cookie cookie2 = new Cookie("b", "bar"); <- This cookie is safe cookie1.setHttpOnly(false); cookie2.setHttpOnly(true); @param cpg ConstantPoolGen @param startLocation The Location of the cookie initialization call. @param objectStackLocation The index of the cookie on the stack. @param invokeInstruction The instruction we want to detect.s @return The location of the invoke instruction provided for the cookie at a specific index on the stack.
[ "This", "method", "is", "used", "to", "track", "calls", "made", "on", "a", "specific", "object", ".", "For", "instance", "this", "could", "be", "used", "to", "track", "if", "setHttpOnly", "(", "true", ")", "was", "executed", "on", "a", "specific", "cooki...
train
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/cookie/CookieFlagsDetector.java#L135-L170
Azure/azure-sdk-for-java
signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java
SignalRsInner.getByResourceGroupAsync
public Observable<SignalRResourceInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
java
public Observable<SignalRResourceInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SignalRResourceInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".",...
Get the SignalR service and its properties. @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 resourceName The name of the SignalR resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SignalRResourceInner object
[ "Get", "the", "SignalR", "service", "and", "its", "properties", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L935-L942
knowm/Sundial
src/main/java/org/quartz/core/RAMJobStore.java
RAMJobStore.storeTrigger
@Override public void storeTrigger(OperableTrigger newTrigger, boolean replaceExisting) throws JobPersistenceException { TriggerWrapper tw = new TriggerWrapper((OperableTrigger) newTrigger.clone()); synchronized (lock) { if (wrappedTriggersByKey.get(tw.key) != null) { if (!replaceExisting) { throw new ObjectAlreadyExistsException(newTrigger); } removeTrigger(newTrigger.getName()); } if (retrieveJob(newTrigger.getJobName()) == null) { throw new JobPersistenceException( "The job (" + newTrigger.getJobName() + ") referenced by the trigger does not exist."); } // add to triggers array wrappedTriggers.add(tw); // add to triggers by FQN map wrappedTriggersByKey.put(tw.key, tw); if (blockedJobs.contains(tw.jobKey)) { tw.state = TriggerWrapper.STATE_BLOCKED; } else { timeWrappedTriggers.add(tw); } } }
java
@Override public void storeTrigger(OperableTrigger newTrigger, boolean replaceExisting) throws JobPersistenceException { TriggerWrapper tw = new TriggerWrapper((OperableTrigger) newTrigger.clone()); synchronized (lock) { if (wrappedTriggersByKey.get(tw.key) != null) { if (!replaceExisting) { throw new ObjectAlreadyExistsException(newTrigger); } removeTrigger(newTrigger.getName()); } if (retrieveJob(newTrigger.getJobName()) == null) { throw new JobPersistenceException( "The job (" + newTrigger.getJobName() + ") referenced by the trigger does not exist."); } // add to triggers array wrappedTriggers.add(tw); // add to triggers by FQN map wrappedTriggersByKey.put(tw.key, tw); if (blockedJobs.contains(tw.jobKey)) { tw.state = TriggerWrapper.STATE_BLOCKED; } else { timeWrappedTriggers.add(tw); } } }
[ "@", "Override", "public", "void", "storeTrigger", "(", "OperableTrigger", "newTrigger", ",", "boolean", "replaceExisting", ")", "throws", "JobPersistenceException", "{", "TriggerWrapper", "tw", "=", "new", "TriggerWrapper", "(", "(", "OperableTrigger", ")", "newTrigg...
Store the given <code>{@link org.quartz.triggers.Trigger}</code>. @param newTrigger The <code>Trigger</code> to be stored. @param replaceExisting If <code>true</code>, any <code>Trigger</code> existing in the <code> JobStore</code> with the same name & group should be over-written. @throws ObjectAlreadyExistsException if a <code>Trigger</code> with the same name/group already exists, and replaceExisting is set to false. @see #pauseTriggerGroup(SchedulingContext, String)
[ "Store", "the", "given", "<code", ">", "{", "@link", "org", ".", "quartz", ".", "triggers", ".", "Trigger", "}", "<", "/", "code", ">", "." ]
train
https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/quartz/core/RAMJobStore.java#L205-L237
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.uploadCertificate
public UploadCertificateResponseInner uploadCertificate(String deviceName, String resourceGroupName, UploadCertificateRequest parameters) { return uploadCertificateWithServiceResponseAsync(deviceName, resourceGroupName, parameters).toBlocking().single().body(); }
java
public UploadCertificateResponseInner uploadCertificate(String deviceName, String resourceGroupName, UploadCertificateRequest parameters) { return uploadCertificateWithServiceResponseAsync(deviceName, resourceGroupName, parameters).toBlocking().single().body(); }
[ "public", "UploadCertificateResponseInner", "uploadCertificate", "(", "String", "deviceName", ",", "String", "resourceGroupName", ",", "UploadCertificateRequest", "parameters", ")", "{", "return", "uploadCertificateWithServiceResponseAsync", "(", "deviceName", ",", "resourceGro...
Uploads registration certificate for the device. @param deviceName The device name. @param resourceGroupName The resource group name. @param parameters The upload certificate request. @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 UploadCertificateResponseInner object if successful.
[ "Uploads", "registration", "certificate", "for", "the", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L2098-L2100
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRActivity.java
LRActivity.addRelatedObject
public boolean addRelatedObject(String objectType, String id, String content) { Map<String, Object> container = new HashMap<String, Object>(); if (objectType != null) { container.put("objectType", objectType); } else { return false; } if (id != null) { container.put("id", id); } if (content != null) { container.put("content", content); } related.add(container); return true; }
java
public boolean addRelatedObject(String objectType, String id, String content) { Map<String, Object> container = new HashMap<String, Object>(); if (objectType != null) { container.put("objectType", objectType); } else { return false; } if (id != null) { container.put("id", id); } if (content != null) { container.put("content", content); } related.add(container); return true; }
[ "public", "boolean", "addRelatedObject", "(", "String", "objectType", ",", "String", "id", ",", "String", "content", ")", "{", "Map", "<", "String", ",", "Object", ">", "container", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";",...
Add a related object to this activity @param objectType The type of the object (required) @param id Id of the ojbect @param content String describing the content of the object @return True if added, false if not (due to missing required fields)
[ "Add", "a", "related", "object", "to", "this", "activity" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L403-L426
ical4j/ical4j
src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java
CalendarParserImpl.assertToken
private int assertToken(final StreamTokenizer tokeniser, Reader in, final String token) throws IOException, ParserException { return assertToken(tokeniser, in, token, false, false); }
java
private int assertToken(final StreamTokenizer tokeniser, Reader in, final String token) throws IOException, ParserException { return assertToken(tokeniser, in, token, false, false); }
[ "private", "int", "assertToken", "(", "final", "StreamTokenizer", "tokeniser", ",", "Reader", "in", ",", "final", "String", "token", ")", "throws", "IOException", ",", "ParserException", "{", "return", "assertToken", "(", "tokeniser", ",", "in", ",", "token", ...
Asserts that the next token in the stream matches the specified token. This method is case-sensitive. @param tokeniser @param token @return int value of the ttype field of the tokeniser @throws IOException @throws ParserException
[ "Asserts", "that", "the", "next", "token", "in", "the", "stream", "matches", "the", "specified", "token", ".", "This", "method", "is", "case", "-", "sensitive", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java#L485-L488
matomo-org/piwik-java-tracker
src/main/java/org/piwik/java/tracking/PiwikTracker.java
PiwikTracker.getHttpClient
protected HttpClient getHttpClient(){ HttpClientBuilder builder = HttpClientBuilder.create(); if(proxyHost != null && proxyPort != 0) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy); builder.setRoutePlanner(routePlanner); } RequestConfig.Builder config = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout); builder.setDefaultRequestConfig(config.build()); return builder.build(); }
java
protected HttpClient getHttpClient(){ HttpClientBuilder builder = HttpClientBuilder.create(); if(proxyHost != null && proxyPort != 0) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy); builder.setRoutePlanner(routePlanner); } RequestConfig.Builder config = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout); builder.setDefaultRequestConfig(config.build()); return builder.build(); }
[ "protected", "HttpClient", "getHttpClient", "(", ")", "{", "HttpClientBuilder", "builder", "=", "HttpClientBuilder", ".", "create", "(", ")", ";", "if", "(", "proxyHost", "!=", "null", "&&", "proxyPort", "!=", "0", ")", "{", "HttpHost", "proxy", "=", "new", ...
Get a HTTP client. With proxy if a proxy is provided in the constructor. @return a HTTP client
[ "Get", "a", "HTTP", "client", ".", "With", "proxy", "if", "a", "proxy", "is", "provided", "in", "the", "constructor", "." ]
train
https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikTracker.java#L153-L171
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/provider/ProviderRegistry.java
ProviderRegistry.getDynamicVariableTranslator
public VariableTranslator getDynamicVariableTranslator(String className, ClassLoader parentLoader) { try { Class<?> clazz = CompiledJavaCache.getClassFromAssetName(parentLoader, className); if (clazz != null) return (VariableTranslator) (clazz).newInstance(); } catch (Exception ex) { logger.trace("Dynamic VariableTranslatorProvider not found: " + className); } return null; }
java
public VariableTranslator getDynamicVariableTranslator(String className, ClassLoader parentLoader) { try { Class<?> clazz = CompiledJavaCache.getClassFromAssetName(parentLoader, className); if (clazz != null) return (VariableTranslator) (clazz).newInstance(); } catch (Exception ex) { logger.trace("Dynamic VariableTranslatorProvider not found: " + className); } return null; }
[ "public", "VariableTranslator", "getDynamicVariableTranslator", "(", "String", "className", ",", "ClassLoader", "parentLoader", ")", "{", "try", "{", "Class", "<", "?", ">", "clazz", "=", "CompiledJavaCache", ".", "getClassFromAssetName", "(", "parentLoader", ",", "...
To get dynamic java variable translator @param translatorClass @param classLoader @return
[ "To", "get", "dynamic", "java", "variable", "translator" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/provider/ProviderRegistry.java#L92-L102
finmath/finmath-lib
src/main/java/net/finmath/time/FloatingpointDate.java
FloatingpointDate.getDateFromFloatingPointDate
public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate) { if(referenceDate == null) { return null; } Duration duration = Duration.ofSeconds(Math.round(floatingPointDate * SECONDS_PER_DAY)); return referenceDate.plus(duration); }
java
public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate) { if(referenceDate == null) { return null; } Duration duration = Duration.ofSeconds(Math.round(floatingPointDate * SECONDS_PER_DAY)); return referenceDate.plus(duration); }
[ "public", "static", "LocalDateTime", "getDateFromFloatingPointDate", "(", "LocalDateTime", "referenceDate", ",", "double", "floatingPointDate", ")", "{", "if", "(", "referenceDate", "==", "null", ")", "{", "return", "null", ";", "}", "Duration", "duration", "=", "...
Convert a floating point date to a LocalDateTime. Note: This method currently performs a rounding to the next second. If referenceDate is null, the method returns null. @param referenceDate The reference date associated with \( t=0 \). @param floatingPointDate The value to the time offset \( t \). @return The date resulting from adding Math.round(fixingTime*SECONDS_PER_DAY) seconds to referenceDate, where one day has SECONDS_PER_DAY seconds and SECONDS_PER_DAY is a constant 365*24*60*60
[ "Convert", "a", "floating", "point", "date", "to", "a", "LocalDateTime", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/FloatingpointDate.java#L67-L74
cdk/cdk
descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java
Tanimoto.calculate
public static float calculate(BitSet bitset1, BitSet bitset2) throws CDKException { float _bitset1_cardinality = bitset1.cardinality(); float _bitset2_cardinality = bitset2.cardinality(); if (bitset1.size() != bitset2.size()) { throw new CDKException("Bitsets must have the same bit length"); } BitSet one_and_two = (BitSet) bitset1.clone(); one_and_two.and(bitset2); float _common_bit_count = one_and_two.cardinality(); return _common_bit_count / (_bitset1_cardinality + _bitset2_cardinality - _common_bit_count); }
java
public static float calculate(BitSet bitset1, BitSet bitset2) throws CDKException { float _bitset1_cardinality = bitset1.cardinality(); float _bitset2_cardinality = bitset2.cardinality(); if (bitset1.size() != bitset2.size()) { throw new CDKException("Bitsets must have the same bit length"); } BitSet one_and_two = (BitSet) bitset1.clone(); one_and_two.and(bitset2); float _common_bit_count = one_and_two.cardinality(); return _common_bit_count / (_bitset1_cardinality + _bitset2_cardinality - _common_bit_count); }
[ "public", "static", "float", "calculate", "(", "BitSet", "bitset1", ",", "BitSet", "bitset2", ")", "throws", "CDKException", "{", "float", "_bitset1_cardinality", "=", "bitset1", ".", "cardinality", "(", ")", ";", "float", "_bitset2_cardinality", "=", "bitset2", ...
Evaluates Tanimoto coefficient for two bit sets. <p> @param bitset1 A bitset (such as a fingerprint) for the first molecule @param bitset2 A bitset (such as a fingerprint) for the second molecule @return The Tanimoto coefficient @throws org.openscience.cdk.exception.CDKException if bitsets are not of the same length
[ "Evaluates", "Tanimoto", "coefficient", "for", "two", "bit", "sets", ".", "<p", ">" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java#L78-L88
sagiegurari/fax4j
src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java
LogFaxClientSpiInterceptor.preMethodInvocation
public final void preMethodInvocation(Method method,Object[] arguments) { this.logEvent(FaxClientSpiProxyEventType.PRE_EVENT_TYPE,method,arguments,null,null); }
java
public final void preMethodInvocation(Method method,Object[] arguments) { this.logEvent(FaxClientSpiProxyEventType.PRE_EVENT_TYPE,method,arguments,null,null); }
[ "public", "final", "void", "preMethodInvocation", "(", "Method", "method", ",", "Object", "[", "]", "arguments", ")", "{", "this", ".", "logEvent", "(", "FaxClientSpiProxyEventType", ".", "PRE_EVENT_TYPE", ",", "method", ",", "arguments", ",", "null", ",", "nu...
This function is invoked by the fax client SPI proxy before invoking the method in the fax client SPI itself. @param method The method invoked @param arguments The method arguments
[ "This", "function", "is", "invoked", "by", "the", "fax", "client", "SPI", "proxy", "before", "invoking", "the", "method", "in", "the", "fax", "client", "SPI", "itself", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java#L159-L162
basho/riak-java-client
src/main/java/com/basho/riak/client/api/convert/Converter.java
Converter.toDomain
public T toDomain(RiakObject obj, Location location) { T domainObject; if (obj.isDeleted()) { domainObject = newDomainInstance(); } else { domainObject = toDomain(obj.getValue(), obj.getContentType()); AnnotationUtil.populateIndexes(obj.getIndexes(), domainObject); AnnotationUtil.populateLinks(obj.getLinks(), domainObject); AnnotationUtil.populateUsermeta(obj.getUserMeta(), domainObject); AnnotationUtil.setContentType(domainObject, obj.getContentType()); AnnotationUtil.setVTag(domainObject, obj.getVTag()); } AnnotationUtil.setKey(domainObject, location.getKey()); AnnotationUtil.setBucketName(domainObject, location.getNamespace().getBucketName()); AnnotationUtil.setBucketType(domainObject, location.getNamespace().getBucketType()); AnnotationUtil.setVClock(domainObject, obj.getVClock()); AnnotationUtil.setTombstone(domainObject, obj.isDeleted()); AnnotationUtil.setLastModified(domainObject, obj.getLastModified()); return domainObject; }
java
public T toDomain(RiakObject obj, Location location) { T domainObject; if (obj.isDeleted()) { domainObject = newDomainInstance(); } else { domainObject = toDomain(obj.getValue(), obj.getContentType()); AnnotationUtil.populateIndexes(obj.getIndexes(), domainObject); AnnotationUtil.populateLinks(obj.getLinks(), domainObject); AnnotationUtil.populateUsermeta(obj.getUserMeta(), domainObject); AnnotationUtil.setContentType(domainObject, obj.getContentType()); AnnotationUtil.setVTag(domainObject, obj.getVTag()); } AnnotationUtil.setKey(domainObject, location.getKey()); AnnotationUtil.setBucketName(domainObject, location.getNamespace().getBucketName()); AnnotationUtil.setBucketType(domainObject, location.getNamespace().getBucketType()); AnnotationUtil.setVClock(domainObject, obj.getVClock()); AnnotationUtil.setTombstone(domainObject, obj.isDeleted()); AnnotationUtil.setLastModified(domainObject, obj.getLastModified()); return domainObject; }
[ "public", "T", "toDomain", "(", "RiakObject", "obj", ",", "Location", "location", ")", "{", "T", "domainObject", ";", "if", "(", "obj", ".", "isDeleted", "(", ")", ")", "{", "domainObject", "=", "newDomainInstance", "(", ")", ";", "}", "else", "{", "do...
Converts from a RiakObject to a domain object. @param obj the RiakObject to be converted @param location The location of this RiakObject in Riak @return an instance of the domain type T
[ "Converts", "from", "a", "RiakObject", "to", "a", "domain", "object", "." ]
train
https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/Converter.java#L74-L101
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/IncludeActionRule.java
IncludeActionRule.newInstance
public static IncludeActionRule newInstance(String id, String transletName, String method, Boolean hidden) throws IllegalRuleException { if (transletName == null) { throw new IllegalRuleException("The 'include' element requires a 'translet' attribute"); } MethodType methodType = MethodType.resolve(method); if (method != null && methodType == null) { throw new IllegalRuleException("No request method type for '" + method + "'"); } IncludeActionRule includeActionRule = new IncludeActionRule(); includeActionRule.setActionId(id); includeActionRule.setTransletName(transletName); includeActionRule.setMethodType(methodType); includeActionRule.setHidden(hidden); return includeActionRule; }
java
public static IncludeActionRule newInstance(String id, String transletName, String method, Boolean hidden) throws IllegalRuleException { if (transletName == null) { throw new IllegalRuleException("The 'include' element requires a 'translet' attribute"); } MethodType methodType = MethodType.resolve(method); if (method != null && methodType == null) { throw new IllegalRuleException("No request method type for '" + method + "'"); } IncludeActionRule includeActionRule = new IncludeActionRule(); includeActionRule.setActionId(id); includeActionRule.setTransletName(transletName); includeActionRule.setMethodType(methodType); includeActionRule.setHidden(hidden); return includeActionRule; }
[ "public", "static", "IncludeActionRule", "newInstance", "(", "String", "id", ",", "String", "transletName", ",", "String", "method", ",", "Boolean", "hidden", ")", "throws", "IllegalRuleException", "{", "if", "(", "transletName", "==", "null", ")", "{", "throw",...
Returns a new instance of IncludeActionRule. @param id the action id @param transletName the translet name @param method the request method type @param hidden whether to hide result of the action @return the include action rule @throws IllegalRuleException if an illegal rule is found
[ "Returns", "a", "new", "instance", "of", "IncludeActionRule", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/IncludeActionRule.java#L223-L240
shrinkwrap/resolver
maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/SettingsManager.java
SettingsManager.configureSettingsFromFile
public void configureSettingsFromFile(File globalSettings, File userSettings) throws InvalidConfigurationFileException { SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); if (globalSettings != null) { request.setGlobalSettingsFile(globalSettings); } if (userSettings != null) { request.setUserSettingsFile(userSettings); } request.setSystemProperties(SecurityActions.getProperties()); MavenSettingsBuilder builder = new MavenSettingsBuilder(); this.settings = builder.buildSettings(request); // ensure we keep offline(boolean) if previously set propagateProgrammaticOfflineIntoSettings(); }
java
public void configureSettingsFromFile(File globalSettings, File userSettings) throws InvalidConfigurationFileException { SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); if (globalSettings != null) { request.setGlobalSettingsFile(globalSettings); } if (userSettings != null) { request.setUserSettingsFile(userSettings); } request.setSystemProperties(SecurityActions.getProperties()); MavenSettingsBuilder builder = new MavenSettingsBuilder(); this.settings = builder.buildSettings(request); // ensure we keep offline(boolean) if previously set propagateProgrammaticOfflineIntoSettings(); }
[ "public", "void", "configureSettingsFromFile", "(", "File", "globalSettings", ",", "File", "userSettings", ")", "throws", "InvalidConfigurationFileException", "{", "SettingsBuildingRequest", "request", "=", "new", "DefaultSettingsBuildingRequest", "(", ")", ";", "if", "("...
Crates an instance of {@link Settings} and configures it from the given file. @param globalSettings path to global settings file @param userSettings path to user settings file
[ "Crates", "an", "instance", "of", "{", "@link", "Settings", "}", "and", "configures", "it", "from", "the", "given", "file", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/SettingsManager.java#L49-L66
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/MorphShape.java
MorphShape.equalShapes
private boolean equalShapes(Shape a, Shape b) { a.checkPoints(); b.checkPoints(); for (int i=0;i<a.points.length;i++) { if (a.points[i] != b.points[i]) { return false; } } return true; }
java
private boolean equalShapes(Shape a, Shape b) { a.checkPoints(); b.checkPoints(); for (int i=0;i<a.points.length;i++) { if (a.points[i] != b.points[i]) { return false; } } return true; }
[ "private", "boolean", "equalShapes", "(", "Shape", "a", ",", "Shape", "b", ")", "{", "a", ".", "checkPoints", "(", ")", ";", "b", ".", "checkPoints", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "points", ".", "leng...
Check if the shape's points are all equal @param a The first shape to compare @param b The second shape to compare @return True if the shapes are equal
[ "Check", "if", "the", "shape", "s", "points", "are", "all", "equal" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/MorphShape.java#L64-L75
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientOptions.java
ClientOptions.getOrElse
public <T> T getOrElse(ClientOption<T> option, T defaultValue) { return getOrElse0(option, defaultValue); }
java
public <T> T getOrElse(ClientOption<T> option, T defaultValue) { return getOrElse0(option, defaultValue); }
[ "public", "<", "T", ">", "T", "getOrElse", "(", "ClientOption", "<", "T", ">", "option", ",", "T", "defaultValue", ")", "{", "return", "getOrElse0", "(", "option", ",", "defaultValue", ")", ";", "}" ]
Returns the value of the specified {@link ClientOption}. @return the value of the {@link ClientOption}, or {@code defaultValue} if the specified {@link ClientOption} is not set.
[ "Returns", "the", "value", "of", "the", "specified", "{", "@link", "ClientOption", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientOptions.java#L205-L207
javagl/CommonUI
src/main/java/de/javagl/common/ui/JTrees.java
JTrees.findNode
public static DefaultMutableTreeNode findNode( TreeModel treeModel, Object userObject) { return findNode(treeModel, treeModel.getRoot(), userObject); }
java
public static DefaultMutableTreeNode findNode( TreeModel treeModel, Object userObject) { return findNode(treeModel, treeModel.getRoot(), userObject); }
[ "public", "static", "DefaultMutableTreeNode", "findNode", "(", "TreeModel", "treeModel", ",", "Object", "userObject", ")", "{", "return", "findNode", "(", "treeModel", ",", "treeModel", ".", "getRoot", "(", ")", ",", "userObject", ")", ";", "}" ]
Returns the first node with the given user object in the tree with the given model. This assumes that the user object is stored in a DefaultMutableTreeNode. Returns <code>null</code> if no matching node is found. @param treeModel The tree model @param userObject The user object @return The node with the given user object, or <code>null</code>
[ "Returns", "the", "first", "node", "with", "the", "given", "user", "object", "in", "the", "tree", "with", "the", "given", "model", ".", "This", "assumes", "that", "the", "user", "object", "is", "stored", "in", "a", "DefaultMutableTreeNode", ".", "Returns", ...
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTrees.java#L214-L218
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/PdfUtilities.java
PdfUtilities.mergePdf
public static void mergePdf(File[] inputPdfFiles, File outputPdfFile) { if (PDFBOX.equals(System.getProperty(PDF_LIBRARY))) { PdfBoxUtilities.mergePdf(inputPdfFiles, outputPdfFile); } else { try { PdfGsUtilities.mergePdf(inputPdfFiles, outputPdfFile); } catch (Exception e) { System.setProperty(PDF_LIBRARY, PDFBOX); mergePdf(inputPdfFiles, outputPdfFile); } } }
java
public static void mergePdf(File[] inputPdfFiles, File outputPdfFile) { if (PDFBOX.equals(System.getProperty(PDF_LIBRARY))) { PdfBoxUtilities.mergePdf(inputPdfFiles, outputPdfFile); } else { try { PdfGsUtilities.mergePdf(inputPdfFiles, outputPdfFile); } catch (Exception e) { System.setProperty(PDF_LIBRARY, PDFBOX); mergePdf(inputPdfFiles, outputPdfFile); } } }
[ "public", "static", "void", "mergePdf", "(", "File", "[", "]", "inputPdfFiles", ",", "File", "outputPdfFile", ")", "{", "if", "(", "PDFBOX", ".", "equals", "(", "System", ".", "getProperty", "(", "PDF_LIBRARY", ")", ")", ")", "{", "PdfBoxUtilities", ".", ...
Merges PDF files. @param inputPdfFiles array of input files @param outputPdfFile output file
[ "Merges", "PDF", "files", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/PdfUtilities.java#L151-L162
eclipse/hawkbit
hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpDeadletterProperties.java
AmqpDeadletterProperties.createDeadletterQueue
public Queue createDeadletterQueue(final String queueName) { return new Queue(queueName, true, false, false, getTTLArgs()); }
java
public Queue createDeadletterQueue(final String queueName) { return new Queue(queueName, true, false, false, getTTLArgs()); }
[ "public", "Queue", "createDeadletterQueue", "(", "final", "String", "queueName", ")", "{", "return", "new", "Queue", "(", "queueName", ",", "true", ",", "false", ",", "false", ",", "getTTLArgs", "(", ")", ")", ";", "}" ]
Create a deadletter queue with ttl for messages @param queueName the deadlette queue name @return the deadletter queue
[ "Create", "a", "deadletter", "queue", "with", "ttl", "for", "messages" ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpDeadletterProperties.java#L53-L55
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.getFlowLogStatus
public FlowLogInformationInner getFlowLogStatus(String resourceGroupName, String networkWatcherName, String targetResourceId) { return getFlowLogStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).toBlocking().last().body(); }
java
public FlowLogInformationInner getFlowLogStatus(String resourceGroupName, String networkWatcherName, String targetResourceId) { return getFlowLogStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).toBlocking().last().body(); }
[ "public", "FlowLogInformationInner", "getFlowLogStatus", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "targetResourceId", ")", "{", "return", "getFlowLogStatusWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherNam...
Queries status of flow log on a specified resource. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param targetResourceId The target resource where getting the flow logging status. @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 FlowLogInformationInner object if successful.
[ "Queries", "status", "of", "flow", "log", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1970-L1972
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withFieldAdded
public Period withFieldAdded(DurationFieldType field, int value) { if (field == null) { throw new IllegalArgumentException("Field must not be null"); } if (value == 0) { return this; } int[] newValues = getValues(); // cloned super.addFieldInto(newValues, field, value); return new Period(newValues, getPeriodType()); }
java
public Period withFieldAdded(DurationFieldType field, int value) { if (field == null) { throw new IllegalArgumentException("Field must not be null"); } if (value == 0) { return this; } int[] newValues = getValues(); // cloned super.addFieldInto(newValues, field, value); return new Period(newValues, getPeriodType()); }
[ "public", "Period", "withFieldAdded", "(", "DurationFieldType", "field", ",", "int", "value", ")", "{", "if", "(", "field", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field must not be null\"", ")", ";", "}", "if", "(", "value"...
Creates a new Period instance with the valueToAdd added to the specified field. <p> This period instance is immutable and unaffected by this method call. @param field the field to set, not null @param value the value to add @return the new period instance @throws IllegalArgumentException if the field type is null or unsupported
[ "Creates", "a", "new", "Period", "instance", "with", "the", "valueToAdd", "added", "to", "the", "specified", "field", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L892-L902
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java
EnaValidator.prepareReader
private void prepareReader(BufferedReader fileReader, String fileId) { switch (fileType) { case EMBL: EmblEntryReader emblReader = new EmblEntryReader( fileReader, EmblEntryReader.Format.EMBL_FORMAT,fileId); emblReader.setCheckBlockCounts(lineCount); reader = emblReader; break; case GENBANK: reader = new GenbankEntryReader(fileReader,fileId); break; case GFF3: reader = new GFF3FlatFileEntryReader(fileReader); break; case FASTA: reader = new FastaFileReader(new FastaLineReader(fileReader)); break; case AGP: reader= new AGPFileReader(new AGPLineReader(fileReader)); break; default: System.exit(0); break; } }
java
private void prepareReader(BufferedReader fileReader, String fileId) { switch (fileType) { case EMBL: EmblEntryReader emblReader = new EmblEntryReader( fileReader, EmblEntryReader.Format.EMBL_FORMAT,fileId); emblReader.setCheckBlockCounts(lineCount); reader = emblReader; break; case GENBANK: reader = new GenbankEntryReader(fileReader,fileId); break; case GFF3: reader = new GFF3FlatFileEntryReader(fileReader); break; case FASTA: reader = new FastaFileReader(new FastaLineReader(fileReader)); break; case AGP: reader= new AGPFileReader(new AGPLineReader(fileReader)); break; default: System.exit(0); break; } }
[ "private", "void", "prepareReader", "(", "BufferedReader", "fileReader", ",", "String", "fileId", ")", "{", "switch", "(", "fileType", ")", "{", "case", "EMBL", ":", "EmblEntryReader", "emblReader", "=", "new", "EmblEntryReader", "(", "fileReader", ",", "EmblEnt...
Prepare reader. @param fileReader the file reader @param fileId the file name
[ "Prepare", "reader", "." ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java#L545-L571
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java
AbstractEventSpace.doEmit
protected void doEmit(Event event, Scope<? super Address> scope) { assert scope != null; assert event != null; final UniqueAddressParticipantRepository<Address> particips = getParticipantInternalDataStructure(); final SynchronizedCollection<EventListener> listeners = particips.getListeners(); synchronized (listeners.mutex()) { for (final EventListener listener : listeners) { final Address adr = getAddress(listener); if (scope.matches(adr)) { this.executorService.submit(new AsyncRunner(listener, event)); } } } }
java
protected void doEmit(Event event, Scope<? super Address> scope) { assert scope != null; assert event != null; final UniqueAddressParticipantRepository<Address> particips = getParticipantInternalDataStructure(); final SynchronizedCollection<EventListener> listeners = particips.getListeners(); synchronized (listeners.mutex()) { for (final EventListener listener : listeners) { final Address adr = getAddress(listener); if (scope.matches(adr)) { this.executorService.submit(new AsyncRunner(listener, event)); } } } }
[ "protected", "void", "doEmit", "(", "Event", "event", ",", "Scope", "<", "?", "super", "Address", ">", "scope", ")", "{", "assert", "scope", "!=", "null", ";", "assert", "event", "!=", "null", ";", "final", "UniqueAddressParticipantRepository", "<", "Address...
Do the emission of the event. <p>This function emits the event <strong>only on the internal event bus</strong> of the agents. @param event the event to emit. @param scope description of the scope of the event, i.e. the receivers of the event.
[ "Do", "the", "emission", "of", "the", "event", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/space/AbstractEventSpace.java#L172-L185
tango-controls/JTango
client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java
TypeConversionUtil.getWritePart
public static Object getWritePart(final Object array, final AttrWriteType writeType) { if (writeType.equals(AttrWriteType.READ_WRITE)) { return Array.get(array, 1); } else { return Array.get(array, 0); } }
java
public static Object getWritePart(final Object array, final AttrWriteType writeType) { if (writeType.equals(AttrWriteType.READ_WRITE)) { return Array.get(array, 1); } else { return Array.get(array, 0); } }
[ "public", "static", "Object", "getWritePart", "(", "final", "Object", "array", ",", "final", "AttrWriteType", "writeType", ")", "{", "if", "(", "writeType", ".", "equals", "(", "AttrWriteType", ".", "READ_WRITE", ")", ")", "{", "return", "Array", ".", "get",...
Extract the write part of a scalar attribute @param array @param writeType @return
[ "Extract", "the", "write", "part", "of", "a", "scalar", "attribute" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java#L35-L41
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ed25519/math/GroupElement.java
GroupElement.dbl
public org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement dbl() { switch (this.repr) { case P2: case P3: // Ignore T for P3 representation FieldElement XX, YY, B, A, AA, Yn, Zn; XX = this.X.square(); YY = this.Y.square(); B = this.Z.squareAndDouble(); A = this.X.add(this.Y); AA = A.square(); Yn = YY.add(XX); Zn = YY.subtract(XX); return p1p1(this.curve, AA.subtract(Yn), Yn, Zn, B.subtract(Zn)); default: throw new UnsupportedOperationException(); } }
java
public org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement dbl() { switch (this.repr) { case P2: case P3: // Ignore T for P3 representation FieldElement XX, YY, B, A, AA, Yn, Zn; XX = this.X.square(); YY = this.Y.square(); B = this.Z.squareAndDouble(); A = this.X.add(this.Y); AA = A.square(); Yn = YY.add(XX); Zn = YY.subtract(XX); return p1p1(this.curve, AA.subtract(Yn), Yn, Zn, B.subtract(Zn)); default: throw new UnsupportedOperationException(); } }
[ "public", "org", ".", "mariadb", ".", "jdbc", ".", "internal", ".", "com", ".", "send", ".", "authentication", ".", "ed25519", ".", "math", ".", "GroupElement", "dbl", "(", ")", "{", "switch", "(", "this", ".", "repr", ")", "{", "case", "P2", ":", ...
Doubles a given group element $p$ in $P^2$ or $P^3$ representation and returns the result in $P \times P$ representation. $r = 2 * p$ where $p = (X : Y : Z)$ or $p = (X : Y : Z : T)$ <p> $r$ in $P \times P$ representation: <p> $r = ((X' : Z'), (Y' : T'))$ where </p><ul> <li>$X' = (X + Y)^2 - (Y^2 + X^2)$ <li>$Y' = Y^2 + X^2$ <li>$Z' = y^2 - X^2$ <li>$T' = 2 * Z^2 - (y^2 - X^2)$ </ul><p> $r$ converted from $P \times P$ to $P^2$ representation: <p> $r = (X'' : Y'' : Z'')$ where </p><ul> <li>$X'' = X' * Z' = ((X + Y)^2 - Y^2 - X^2) * (2 * Z^2 - (y^2 - X^2))$ <li>$Y'' = Y' * T' = (Y^2 + X^2) * (2 * Z^2 - (y^2 - X^2))$ <li>$Z'' = Z' * T' = (y^2 - X^2) * (2 * Z^2 - (y^2 - X^2))$ </ul><p> Formula for the $P^2$ representation is in agreement with the formula given in [4] page 12 (with $a = -1$) up to a common factor -1 which does not matter: <p> $$ B = (X + Y)^2; C = X^2; D = Y^2; E = -C = -X^2; F := E + D = Y^2 - X^2; H = Z^2; J = F − 2 * H; \\ X3 = (B − C − D) · J = X' * (-T'); \\ Y3 = F · (E − D) = Z' * (-Y'); \\ Z3 = F · J = Z' * (-T'). $$ @return The P1P1 representation
[ "Doubles", "a", "given", "group", "element", "$p$", "in", "$P^2$", "or", "$P^3$", "representation", "and", "returns", "the", "result", "in", "$P", "\\", "times", "P$", "representation", ".", "$r", "=", "2", "*", "p$", "where", "$p", "=", "(", "X", ":",...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ed25519/math/GroupElement.java#L591-L607
guardtime/ksi-java-sdk
ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java
ContextAwarePolicyAdapter.createDefaultPolicy
public static ContextAwarePolicy createDefaultPolicy(PublicationsHandler handler, Extender extender) { Util.notNull(handler, "Publications handler"); return new ContextAwarePolicyAdapter(new DefaultVerificationPolicy(), new PolicyContext(handler, extender != null ? extender.getExtendingService() : null)); }
java
public static ContextAwarePolicy createDefaultPolicy(PublicationsHandler handler, Extender extender) { Util.notNull(handler, "Publications handler"); return new ContextAwarePolicyAdapter(new DefaultVerificationPolicy(), new PolicyContext(handler, extender != null ? extender.getExtendingService() : null)); }
[ "public", "static", "ContextAwarePolicy", "createDefaultPolicy", "(", "PublicationsHandler", "handler", ",", "Extender", "extender", ")", "{", "Util", ".", "notNull", "(", "handler", ",", "\"Publications handler\"", ")", ";", "return", "new", "ContextAwarePolicyAdapter"...
Creates context aware policy using {@link DefaultVerificationPolicy} for verification. If extender is set, signature is extended within verification process. @param handler Publications handler. @param extender Extender. @return Context aware verification policy for default verification.
[ "Creates", "context", "aware", "policy", "using", "{", "@link", "DefaultVerificationPolicy", "}", "for", "verification", ".", "If", "extender", "is", "set", "signature", "is", "extended", "within", "verification", "process", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L144-L148
j-easy/easy-batch
easybatch-extensions/easybatch-quartz/src/main/java/org/easybatch/extensions/quartz/JobScheduler.java
JobScheduler.scheduleAtWithInterval
public void scheduleAtWithInterval(final org.easybatch.core.job.Job job, final Date startTime, final int interval) throws JobSchedulerException { checkNotNull(job, "job"); checkNotNull(startTime, "startTime"); String name = job.getName(); String jobName = JOB_NAME_PREFIX + name; String triggerName = TRIGGER_NAME_PREFIX + name; SimpleScheduleBuilder scheduleBuilder = simpleSchedule() .withIntervalInSeconds(interval) .repeatForever(); Trigger trigger = newTrigger() .withIdentity(triggerName) .startAt(startTime) .withSchedule(scheduleBuilder) .forJob(jobName) .build(); JobDetail jobDetail = getJobDetail(job, jobName); try { LOGGER.info("Scheduling job ''{}'' to start at {} and every {} second(s)", name, startTime, interval); scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException e) { throw new JobSchedulerException(format("Unable to schedule job '%s'", name), e); } }
java
public void scheduleAtWithInterval(final org.easybatch.core.job.Job job, final Date startTime, final int interval) throws JobSchedulerException { checkNotNull(job, "job"); checkNotNull(startTime, "startTime"); String name = job.getName(); String jobName = JOB_NAME_PREFIX + name; String triggerName = TRIGGER_NAME_PREFIX + name; SimpleScheduleBuilder scheduleBuilder = simpleSchedule() .withIntervalInSeconds(interval) .repeatForever(); Trigger trigger = newTrigger() .withIdentity(triggerName) .startAt(startTime) .withSchedule(scheduleBuilder) .forJob(jobName) .build(); JobDetail jobDetail = getJobDetail(job, jobName); try { LOGGER.info("Scheduling job ''{}'' to start at {} and every {} second(s)", name, startTime, interval); scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException e) { throw new JobSchedulerException(format("Unable to schedule job '%s'", name), e); } }
[ "public", "void", "scheduleAtWithInterval", "(", "final", "org", ".", "easybatch", ".", "core", ".", "job", ".", "Job", "job", ",", "final", "Date", "startTime", ",", "final", "int", "interval", ")", "throws", "JobSchedulerException", "{", "checkNotNull", "(",...
Schedule a job to start at a fixed point of time and repeat with interval period. @param job the job to schedule @param startTime the start time @param interval the repeat interval in seconds
[ "Schedule", "a", "job", "to", "start", "at", "a", "fixed", "point", "of", "time", "and", "repeat", "with", "interval", "period", "." ]
train
https://github.com/j-easy/easy-batch/blob/46286e1091dae1206674e2a30e0609c31feae36c/easybatch-extensions/easybatch-quartz/src/main/java/org/easybatch/extensions/quartz/JobScheduler.java#L174-L201
googleapis/cloud-bigtable-client
bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Import.java
Import.filterKv
public static Cell filterKv(Filter filter, Cell kv) throws IOException { // apply the filter and skip this kv if the filter doesn't apply if (filter != null) { Filter.ReturnCode code = filter.filterKeyValue(kv); if (LOG.isTraceEnabled()) { LOG.trace("Filter returned:" + code + " for the key value:" + kv); } // if its not an accept type, then skip this kv if (!(code.equals(Filter.ReturnCode.INCLUDE) || code .equals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL))) { return null; } } return kv; }
java
public static Cell filterKv(Filter filter, Cell kv) throws IOException { // apply the filter and skip this kv if the filter doesn't apply if (filter != null) { Filter.ReturnCode code = filter.filterKeyValue(kv); if (LOG.isTraceEnabled()) { LOG.trace("Filter returned:" + code + " for the key value:" + kv); } // if its not an accept type, then skip this kv if (!(code.equals(Filter.ReturnCode.INCLUDE) || code .equals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL))) { return null; } } return kv; }
[ "public", "static", "Cell", "filterKv", "(", "Filter", "filter", ",", "Cell", "kv", ")", "throws", "IOException", "{", "// apply the filter and skip this kv if the filter doesn't apply", "if", "(", "filter", "!=", "null", ")", "{", "Filter", ".", "ReturnCode", "code...
Attempt to filter out the keyvalue @param kv {@link org.apache.hadoop.hbase.KeyValue} on which to apply the filter @return <tt>null</tt> if the key should not be written, otherwise returns the original {@link org.apache.hadoop.hbase.KeyValue} @param filter a {@link org.apache.hadoop.hbase.filter.Filter} object. @throws java.io.IOException if any.
[ "Attempt", "to", "filter", "out", "the", "keyvalue" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Import.java#L289-L303
googleapis/google-cloud-java
google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/ApplicationServiceClient.java
ApplicationServiceClient.createApplication
public final Application createApplication(String parent, Application application) { CreateApplicationRequest request = CreateApplicationRequest.newBuilder().setParent(parent).setApplication(application).build(); return createApplication(request); }
java
public final Application createApplication(String parent, Application application) { CreateApplicationRequest request = CreateApplicationRequest.newBuilder().setParent(parent).setApplication(application).build(); return createApplication(request); }
[ "public", "final", "Application", "createApplication", "(", "String", "parent", ",", "Application", "application", ")", "{", "CreateApplicationRequest", "request", "=", "CreateApplicationRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", "....
Creates a new application entity. <p>Sample code: <pre><code> try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) { ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]"); Application application = Application.newBuilder().build(); Application response = applicationServiceClient.createApplication(parent.toString(), application); } </code></pre> @param parent Required. <p>Resource name of the profile under which the application is created. <p>The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for example, "projects/test-project/tenants/test-tenant/profiles/test-profile". @param application Required. <p>The application to be created. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "application", "entity", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/ApplicationServiceClient.java#L214-L219
jakenjarvis/Android-OrmLiteContentProvider
ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java
OrmLiteDefaultContentProvider.onInsertCompleted
protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) { this.getContext().getContentResolver().notifyChange(result, null); }
java
protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) { this.getContext().getContentResolver().notifyChange(result, null); }
[ "protected", "void", "onInsertCompleted", "(", "Uri", "result", ",", "Uri", "uri", ",", "MatcherPattern", "target", ",", "InsertParameters", "parameter", ")", "{", "this", ".", "getContext", "(", ")", ".", "getContentResolver", "(", ")", ".", "notifyChange", "...
This method is called after the onInsert processing has been handled. If you're a need, you can override this method. @param result This is the return value of onInsert method. @param uri This is the Uri of target. @param target This is identical to the argument of onInsert method. It is MatcherPattern objects that match to evaluate Uri by UriMatcher. You can access information in the tables and columns, ContentUri, MimeType etc. @param parameter This is identical to the argument of onInsert method. Arguments passed to the insert() method. @since 1.0.4
[ "This", "method", "is", "called", "after", "the", "onInsert", "processing", "has", "been", "handled", ".", "If", "you", "re", "a", "need", "you", "can", "override", "this", "method", "." ]
train
https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L238-L240
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.expectStrictNew
public static synchronized <T> IExpectationSetters<T> expectStrictNew(Class<T> type, Object... arguments) throws Exception { return doExpectNew(type, new StrictMockStrategy(), null, arguments); }
java
public static synchronized <T> IExpectationSetters<T> expectStrictNew(Class<T> type, Object... arguments) throws Exception { return doExpectNew(type, new StrictMockStrategy(), null, arguments); }
[ "public", "static", "synchronized", "<", "T", ">", "IExpectationSetters", "<", "T", ">", "expectStrictNew", "(", "Class", "<", "T", ">", "type", ",", "Object", "...", "arguments", ")", "throws", "Exception", "{", "return", "doExpectNew", "(", "type", ",", ...
Allows specifying expectations on new invocations. For example you might want to throw an exception or return a mock. <p/> This method checks the order of constructor invocations. <p/> Note that you must replay the class when using this method since this behavior is part of the class mock.
[ "Allows", "specifying", "expectations", "on", "new", "invocations", ".", "For", "example", "you", "might", "want", "to", "throw", "an", "exception", "or", "return", "a", "mock", ".", "<p", "/", ">", "This", "method", "checks", "the", "order", "of", "constr...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1697-L1700
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/dynamic/JarXtractor.java
JarXtractor.extract
public static boolean extract(File jarFile, File newJar, String[] includePrefixes, String[] excludePrefixes) throws IOException { boolean isSomethingExtracted = false; if (!jarFile.exists()) { Log.w("Jar file does not exists at: " + jarFile.getAbsolutePath()); return isSomethingExtracted; } ZipInputStream zis = new ZipInputStream(new FileInputStream(jarFile)); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(newJar)); for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) { String name = entry.getName().replaceAll("/", ".").replace(".class", ""); boolean isStartsWith = startsWith(name, includePrefixes) && !startsWith(name, excludePrefixes); isSomethingExtracted = isSomethingExtracted || isStartsWith; if (isStartsWith || name.startsWith("META-INF")) { zos.putNextEntry(new ZipEntry(entry.getName())); int data; while ((data = zis.read()) != -1) { zos.write(data); } zos.closeEntry(); } } zis.close(); try { zos.close(); } catch (ZipException e) { System.out.println("No classes in the original jar matched the prefix"); } return isSomethingExtracted; }
java
public static boolean extract(File jarFile, File newJar, String[] includePrefixes, String[] excludePrefixes) throws IOException { boolean isSomethingExtracted = false; if (!jarFile.exists()) { Log.w("Jar file does not exists at: " + jarFile.getAbsolutePath()); return isSomethingExtracted; } ZipInputStream zis = new ZipInputStream(new FileInputStream(jarFile)); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(newJar)); for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) { String name = entry.getName().replaceAll("/", ".").replace(".class", ""); boolean isStartsWith = startsWith(name, includePrefixes) && !startsWith(name, excludePrefixes); isSomethingExtracted = isSomethingExtracted || isStartsWith; if (isStartsWith || name.startsWith("META-INF")) { zos.putNextEntry(new ZipEntry(entry.getName())); int data; while ((data = zis.read()) != -1) { zos.write(data); } zos.closeEntry(); } } zis.close(); try { zos.close(); } catch (ZipException e) { System.out.println("No classes in the original jar matched the prefix"); } return isSomethingExtracted; }
[ "public", "static", "boolean", "extract", "(", "File", "jarFile", ",", "File", "newJar", ",", "String", "[", "]", "includePrefixes", ",", "String", "[", "]", "excludePrefixes", ")", "throws", "IOException", "{", "boolean", "isSomethingExtracted", "=", "false", ...
Creates a jar file that contains only classes with specified prefix. Note that new jar is created in the same directory as the original jar (hopefully the user has write permission). Returns true if classes with the given prefix are detected. @throws IOException if a file is not found or there is some error during read/write operations
[ "Creates", "a", "jar", "file", "that", "contains", "only", "classes", "with", "specified", "prefix", ".", "Note", "that", "new", "jar", "is", "created", "in", "the", "same", "directory", "as", "the", "original", "jar", "(", "hopefully", "the", "user", "has...
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/dynamic/JarXtractor.java#L55-L84
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/utils/DbcHelper.java
DbcHelper.getConnection
public static Connection getConnection(String dataSourceName, boolean startTransaction) throws SQLException { Map<String, OpenConnStats> statsMap = openConnStats.get(); OpenConnStats connStats = statsMap.get(dataSourceName); Connection conn; if (connStats == null) { // no existing connection, obtain a new one DataSource ds = getJdbcDataSource(dataSourceName); conn = ds != null ? ds.getConnection() : null; if (conn == null) { return null; } openConnDsName.get().put(conn, dataSourceName); connStats = new OpenConnStats(); connStats.conn = conn; // connStats.dsName = dataSourceName; statsMap.put(dataSourceName, connStats); if (!startTransaction) { connStats.inTransaction = false; conn.setAutoCommit(true); } } else { conn = connStats.conn; } connStats.counter.incrementAndGet(); if (startTransaction) { startTransaction(conn); } return conn; }
java
public static Connection getConnection(String dataSourceName, boolean startTransaction) throws SQLException { Map<String, OpenConnStats> statsMap = openConnStats.get(); OpenConnStats connStats = statsMap.get(dataSourceName); Connection conn; if (connStats == null) { // no existing connection, obtain a new one DataSource ds = getJdbcDataSource(dataSourceName); conn = ds != null ? ds.getConnection() : null; if (conn == null) { return null; } openConnDsName.get().put(conn, dataSourceName); connStats = new OpenConnStats(); connStats.conn = conn; // connStats.dsName = dataSourceName; statsMap.put(dataSourceName, connStats); if (!startTransaction) { connStats.inTransaction = false; conn.setAutoCommit(true); } } else { conn = connStats.conn; } connStats.counter.incrementAndGet(); if (startTransaction) { startTransaction(conn); } return conn; }
[ "public", "static", "Connection", "getConnection", "(", "String", "dataSourceName", ",", "boolean", "startTransaction", ")", "throws", "SQLException", "{", "Map", "<", "String", ",", "OpenConnStats", ">", "statsMap", "=", "openConnStats", ".", "get", "(", ")", "...
Obtains a JDBC connection from a named data-source (start a new transaction if specified). <p> Note: call {@link #returnConnection(Connection)} to return the connection back to the pool. Do NOT use {@code Connection.clode()}. </p> @param dataSourceName @param startTransaction @return @throws SQLException
[ "Obtains", "a", "JDBC", "connection", "from", "a", "named", "data", "-", "source", "(", "start", "a", "new", "transaction", "if", "specified", ")", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/utils/DbcHelper.java#L117-L151
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Treap.java
Treap.addElement
public int addElement(int element, int treap) { int treap_; if (treap == -1) { if (m_defaultTreap == nullNode()) m_defaultTreap = createTreap(-1); treap_ = m_defaultTreap; } else { treap_ = treap; } return addElement_(element, 0, treap_); }
java
public int addElement(int element, int treap) { int treap_; if (treap == -1) { if (m_defaultTreap == nullNode()) m_defaultTreap = createTreap(-1); treap_ = m_defaultTreap; } else { treap_ = treap; } return addElement_(element, 0, treap_); }
[ "public", "int", "addElement", "(", "int", "element", ",", "int", "treap", ")", "{", "int", "treap_", ";", "if", "(", "treap", "==", "-", "1", ")", "{", "if", "(", "m_defaultTreap", "==", "nullNode", "(", ")", ")", "m_defaultTreap", "=", "createTreap",...
Adds new element to the treap. Allows duplicates to be added.
[ "Adds", "new", "element", "to", "the", "treap", ".", "Allows", "duplicates", "to", "be", "added", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Treap.java#L128-L139
JOML-CI/JOML
src/org/joml/Vector3d.java
Vector3d.set
public Vector3d set(int index, ByteBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
java
public Vector3d set(int index, ByteBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
[ "public", "Vector3d", "set", "(", "int", "index", ",", "ByteBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "get", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "this", ";", "}" ]
Read this vector from the supplied {@link ByteBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given ByteBuffer. @param index the absolute position into the ByteBuffer @param buffer values will be read in <code>x, y, z</code> order @return this
[ "Read", "this", "vector", "from", "the", "supplied", "{", "@link", "ByteBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", ".", "<p", ">", "This", "method", "will", "not", "increment", "the", "position", "of",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3d.java#L390-L393
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java
AttributeValidator.validateMappedBy
private static void validateMappedBy(Attribute attr, Attribute mappedByAttr) { if (mappedByAttr != null) { if (!isSingleReferenceType(mappedByAttr)) { throw new MolgenisDataException( format( "Invalid mappedBy attribute [%s] data type [%s].", mappedByAttr.getName(), mappedByAttr.getDataType())); } Attribute refAttr = attr.getRefEntity().getAttribute(mappedByAttr.getName()); if (refAttr == null) { throw new MolgenisDataException( format( "mappedBy attribute [%s] is not part of entity [%s].", mappedByAttr.getName(), attr.getRefEntity().getId())); } } }
java
private static void validateMappedBy(Attribute attr, Attribute mappedByAttr) { if (mappedByAttr != null) { if (!isSingleReferenceType(mappedByAttr)) { throw new MolgenisDataException( format( "Invalid mappedBy attribute [%s] data type [%s].", mappedByAttr.getName(), mappedByAttr.getDataType())); } Attribute refAttr = attr.getRefEntity().getAttribute(mappedByAttr.getName()); if (refAttr == null) { throw new MolgenisDataException( format( "mappedBy attribute [%s] is not part of entity [%s].", mappedByAttr.getName(), attr.getRefEntity().getId())); } } }
[ "private", "static", "void", "validateMappedBy", "(", "Attribute", "attr", ",", "Attribute", "mappedByAttr", ")", "{", "if", "(", "mappedByAttr", "!=", "null", ")", "{", "if", "(", "!", "isSingleReferenceType", "(", "mappedByAttr", ")", ")", "{", "throw", "n...
Validate whether the mappedBy attribute is part of the referenced entity. @param attr attribute @param mappedByAttr mappedBy attribute @throws MolgenisDataException if mappedBy is an attribute that is not part of the referenced entity
[ "Validate", "whether", "the", "mappedBy", "attribute", "is", "part", "of", "the", "referenced", "entity", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java#L296-L313
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/PostParameterHelper.java
PostParameterHelper.saveToSession
private void saveToSession(HttpServletRequest req, String reqURL, Map params) { HttpSession postparamsession = req.getSession(true); if (postparamsession != null && params != null && !params.isEmpty()) { postparamsession.setAttribute(INITIAL_URL, reqURL); postparamsession.setAttribute(PARAM_NAMES, null); postparamsession.setAttribute(PARAM_VALUES, params); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "URL saved: " + reqURL.toString()); } } }
java
private void saveToSession(HttpServletRequest req, String reqURL, Map params) { HttpSession postparamsession = req.getSession(true); if (postparamsession != null && params != null && !params.isEmpty()) { postparamsession.setAttribute(INITIAL_URL, reqURL); postparamsession.setAttribute(PARAM_NAMES, null); postparamsession.setAttribute(PARAM_VALUES, params); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "URL saved: " + reqURL.toString()); } } }
[ "private", "void", "saveToSession", "(", "HttpServletRequest", "req", ",", "String", "reqURL", ",", "Map", "params", ")", "{", "HttpSession", "postparamsession", "=", "req", ".", "getSession", "(", "true", ")", ";", "if", "(", "postparamsession", "!=", "null",...
Save POST parameters (reqURL, parameters) to a session @param req @param reqURL @param params
[ "Save", "POST", "parameters", "(", "reqURL", "parameters", ")", "to", "a", "session" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/PostParameterHelper.java#L168-L178
prestodb/presto
presto-raptor/src/main/java/com/facebook/presto/raptor/storage/FileStorageService.java
FileStorageService.getFileSystemPath
public static File getFileSystemPath(File base, UUID shardUuid) { String uuid = shardUuid.toString().toLowerCase(ENGLISH); return base.toPath() .resolve(uuid.substring(0, 2)) .resolve(uuid.substring(2, 4)) .resolve(uuid + FILE_EXTENSION) .toFile(); }
java
public static File getFileSystemPath(File base, UUID shardUuid) { String uuid = shardUuid.toString().toLowerCase(ENGLISH); return base.toPath() .resolve(uuid.substring(0, 2)) .resolve(uuid.substring(2, 4)) .resolve(uuid + FILE_EXTENSION) .toFile(); }
[ "public", "static", "File", "getFileSystemPath", "(", "File", "base", ",", "UUID", "shardUuid", ")", "{", "String", "uuid", "=", "shardUuid", ".", "toString", "(", ")", ".", "toLowerCase", "(", "ENGLISH", ")", ";", "return", "base", ".", "toPath", "(", "...
Generate a file system path for a shard UUID. This creates a three level deep directory structure where the first two levels each contain two hex digits (lowercase) of the UUID and the final level contains the full UUID. Example: <pre> UUID: 701e1a79-74f7-4f56-b438-b41e8e7d019d Path: /base/70/1e/701e1a79-74f7-4f56-b438-b41e8e7d019d.orc </pre> This ensures that files are spread out evenly through the tree while a path can still be easily navigated by a human being.
[ "Generate", "a", "file", "system", "path", "for", "a", "shard", "UUID", ".", "This", "creates", "a", "three", "level", "deep", "directory", "structure", "where", "the", "first", "two", "levels", "each", "contain", "two", "hex", "digits", "(", "lowercase", ...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/storage/FileStorageService.java#L145-L153
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/env/Diagnostics.java
Diagnostics.runtimeInfo
public static void runtimeInfo(final Map<String, Object> infos) { infos.put("runtime.vm", RUNTIME_BEAN.getVmVendor() + "/" + RUNTIME_BEAN.getVmName() + ": " + RUNTIME_BEAN.getVmVersion()); infos.put("runtime.startTime", RUNTIME_BEAN.getStartTime()); infos.put("runtime.uptime", RUNTIME_BEAN.getUptime()); infos.put("runtime.name", RUNTIME_BEAN.getName()); infos.put("runtime.spec", RUNTIME_BEAN.getSpecVendor() + "/" + RUNTIME_BEAN.getSpecName() + ": " + RUNTIME_BEAN.getSpecVersion()); infos.put("runtime.sysProperties", RUNTIME_BEAN.getSystemProperties()); }
java
public static void runtimeInfo(final Map<String, Object> infos) { infos.put("runtime.vm", RUNTIME_BEAN.getVmVendor() + "/" + RUNTIME_BEAN.getVmName() + ": " + RUNTIME_BEAN.getVmVersion()); infos.put("runtime.startTime", RUNTIME_BEAN.getStartTime()); infos.put("runtime.uptime", RUNTIME_BEAN.getUptime()); infos.put("runtime.name", RUNTIME_BEAN.getName()); infos.put("runtime.spec", RUNTIME_BEAN.getSpecVendor() + "/" + RUNTIME_BEAN.getSpecName() + ": " + RUNTIME_BEAN.getSpecVersion()); infos.put("runtime.sysProperties", RUNTIME_BEAN.getSystemProperties()); }
[ "public", "static", "void", "runtimeInfo", "(", "final", "Map", "<", "String", ",", "Object", ">", "infos", ")", "{", "infos", ".", "put", "(", "\"runtime.vm\"", ",", "RUNTIME_BEAN", ".", "getVmVendor", "(", ")", "+", "\"/\"", "+", "RUNTIME_BEAN", ".", "...
Collects system information as delivered from the {@link RuntimeMXBean}. @param infos a map where the infos are passed in.
[ "Collects", "system", "information", "as", "delivered", "from", "the", "{", "@link", "RuntimeMXBean", "}", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L109-L118
mongodb/stitch-android-sdk
core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/Assertions.java
Assertions.keyPresent
public static void keyPresent(final String key, final Map<String, ?> map) { if (!map.containsKey(key)) { throw new IllegalStateException( String.format("expected %s to be present", key)); } }
java
public static void keyPresent(final String key, final Map<String, ?> map) { if (!map.containsKey(key)) { throw new IllegalStateException( String.format("expected %s to be present", key)); } }
[ "public", "static", "void", "keyPresent", "(", "final", "String", "key", ",", "final", "Map", "<", "String", ",", "?", ">", "map", ")", "{", "if", "(", "!", "map", ".", "containsKey", "(", "key", ")", ")", "{", "throw", "new", "IllegalStateException", ...
Throw IllegalStateException if key is not present in map. @param key the key to expect. @param map the map to search. @throws IllegalArgumentException if key is not in map.
[ "Throw", "IllegalStateException", "if", "key", "is", "not", "present", "in", "map", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/Assertions.java#L42-L47
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/SummaryExtractor.java
SummaryExtractor.getSummaryFromString
public String getSummaryFromString(String doc, int length) throws IOException { return getSummary(new StringReader(doc), length); }
java
public String getSummaryFromString(String doc, int length) throws IOException { return getSummary(new StringReader(doc), length); }
[ "public", "String", "getSummaryFromString", "(", "String", "doc", ",", "int", "length", ")", "throws", "IOException", "{", "return", "getSummary", "(", "new", "StringReader", "(", "doc", ")", ",", "length", ")", ";", "}" ]
get document summary from a string @param doc @param length @return String @throws IOException
[ "get", "document", "summary", "from", "a", "string" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/extractor/SummaryExtractor.java#L83-L86
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/client/ProviderInfo.java
ProviderInfo.setStaticAttr
public ProviderInfo setStaticAttr(String staticAttrKey, String staticAttrValue) { if (staticAttrValue == null) { staticAttrs.remove(staticAttrKey); } else { staticAttrs.put(staticAttrKey, staticAttrValue); } return this; }
java
public ProviderInfo setStaticAttr(String staticAttrKey, String staticAttrValue) { if (staticAttrValue == null) { staticAttrs.remove(staticAttrKey); } else { staticAttrs.put(staticAttrKey, staticAttrValue); } return this; }
[ "public", "ProviderInfo", "setStaticAttr", "(", "String", "staticAttrKey", ",", "String", "staticAttrValue", ")", "{", "if", "(", "staticAttrValue", "==", "null", ")", "{", "staticAttrs", ".", "remove", "(", "staticAttrKey", ")", ";", "}", "else", "{", "static...
Sets static attribute. @param staticAttrKey the static attribute key @param staticAttrValue the static attribute value @return the static attribute
[ "Sets", "static", "attribute", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/client/ProviderInfo.java#L456-L463
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java
SharesInner.refreshAsync
public Observable<Void> refreshAsync(String deviceName, String name, String resourceGroupName) { return refreshWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> refreshAsync(String deviceName, String name, String resourceGroupName) { return refreshWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "refreshAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ")", "{", "return", "refreshWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName", ")", ...
Refreshes the share metadata with the data from the cloud. @param deviceName The device name. @param name The share name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Refreshes", "the", "share", "metadata", "with", "the", "data", "from", "the", "cloud", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java#L711-L718
strator-dev/greenpepper-open
confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/utils/MacroParametersUtils.java
MacroParametersUtils.extractParameter
public static String extractParameter(String name, Map parameters) { Object value = parameters.get(name); return (value != null) ? xssEscape(value.toString()) : ""; }
java
public static String extractParameter(String name, Map parameters) { Object value = parameters.get(name); return (value != null) ? xssEscape(value.toString()) : ""; }
[ "public", "static", "String", "extractParameter", "(", "String", "name", ",", "Map", "parameters", ")", "{", "Object", "value", "=", "parameters", ".", "get", "(", "name", ")", ";", "return", "(", "value", "!=", "null", ")", "?", "xssEscape", "(", "value...
<p>extractParameter.</p> @param name a {@link java.lang.String} object. @param parameters a {@link java.util.Map} object. @return a {@link java.lang.String} object.
[ "<p", ">", "extractParameter", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/utils/MacroParametersUtils.java#L24-L27
sniggle/simple-pgp
simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java
IOUtils.copy
public static void copy(InputStream inputStream, OutputStream outputStream, byte[] buffer) throws IOException { LOGGER.trace("copy(InputStream, OutputStream, byte[])"); copy(inputStream, outputStream, buffer, null); }
java
public static void copy(InputStream inputStream, OutputStream outputStream, byte[] buffer) throws IOException { LOGGER.trace("copy(InputStream, OutputStream, byte[])"); copy(inputStream, outputStream, buffer, null); }
[ "public", "static", "void", "copy", "(", "InputStream", "inputStream", ",", "OutputStream", "outputStream", ",", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "LOGGER", ".", "trace", "(", "\"copy(InputStream, OutputStream, byte[])\"", ")", ";", "c...
copies the input stream to the output stream using a custom buffer size @param inputStream the source stream @param outputStream the target strem @param buffer the custom buffer @throws IOException
[ "copies", "the", "input", "stream", "to", "the", "output", "stream", "using", "a", "custom", "buffer", "size" ]
train
https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L70-L73
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java
EndianNumbers.toLELong
@Pure public static long toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) { return ((b8 & 0xFF) << 56) + ((b7 & 0xFF) << 48) + ((b6 & 0xFF) << 40) + ((b5 & 0xFF) << 32) + ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF); }
java
@Pure public static long toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) { return ((b8 & 0xFF) << 56) + ((b7 & 0xFF) << 48) + ((b6 & 0xFF) << 40) + ((b5 & 0xFF) << 32) + ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF); }
[ "@", "Pure", "public", "static", "long", "toLELong", "(", "int", "b1", ",", "int", "b2", ",", "int", "b3", ",", "int", "b4", ",", "int", "b5", ",", "int", "b6", ",", "int", "b7", ",", "int", "b8", ")", "{", "return", "(", "(", "b8", "&", "0xF...
Converting eight bytes to a Little Endian integer. @param b1 the first byte. @param b2 the second byte. @param b3 the third byte. @param b4 the fourth byte. @param b5 the fifth byte. @param b6 the sixth byte. @param b7 the seventh byte. @param b8 the eighth byte. @return the conversion result
[ "Converting", "eight", "bytes", "to", "a", "Little", "Endian", "integer", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L107-L111
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/listeners/AddResourcesListener.java
AddResourcesListener.addMetaTags
private void addMetaTags(UIViewRoot root, FacesContext context) { // Check context-param String viewportParam = BsfUtils.getInitParam(C.P_VIEWPORT, context); viewportParam = evalELIfPossible(viewportParam); String content = "width=device-width, initial-scale=1"; if (!viewportParam.isEmpty() && isFalseOrNo(viewportParam)) return; if (!viewportParam.isEmpty() && !isTrueOrYes(viewportParam)) content = viewportParam; // Otherwise String viewportMeta = "<meta name=\"viewport\" content=\"" + content + "\"/>"; UIOutput viewport = new UIOutput(); viewport.setRendererType("javax.faces.Text"); viewport.getAttributes().put("escape", false); viewport.setValue(viewportMeta); UIComponent header = findHeader(root); if (header != null) { header.getChildren().add(0, viewport); } }
java
private void addMetaTags(UIViewRoot root, FacesContext context) { // Check context-param String viewportParam = BsfUtils.getInitParam(C.P_VIEWPORT, context); viewportParam = evalELIfPossible(viewportParam); String content = "width=device-width, initial-scale=1"; if (!viewportParam.isEmpty() && isFalseOrNo(viewportParam)) return; if (!viewportParam.isEmpty() && !isTrueOrYes(viewportParam)) content = viewportParam; // Otherwise String viewportMeta = "<meta name=\"viewport\" content=\"" + content + "\"/>"; UIOutput viewport = new UIOutput(); viewport.setRendererType("javax.faces.Text"); viewport.getAttributes().put("escape", false); viewport.setValue(viewportMeta); UIComponent header = findHeader(root); if (header != null) { header.getChildren().add(0, viewport); } }
[ "private", "void", "addMetaTags", "(", "UIViewRoot", "root", ",", "FacesContext", "context", ")", "{", "// Check context-param", "String", "viewportParam", "=", "BsfUtils", ".", "getInitParam", "(", "C", ".", "P_VIEWPORT", ",", "context", ")", ";", "viewportParam"...
Add the viewport meta tag if not disabled from context-param @param root @param context @param isProduction
[ "Add", "the", "viewport", "meta", "tag", "if", "not", "disabled", "from", "context", "-", "param" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/listeners/AddResourcesListener.java#L204-L226
netty/netty
buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java
CompositeByteBuf.addComponent
public CompositeByteBuf addComponent(boolean increaseWriterIndex, int cIndex, ByteBuf buffer) { checkNotNull(buffer, "buffer"); addComponent0(increaseWriterIndex, cIndex, buffer); consolidateIfNeeded(); return this; }
java
public CompositeByteBuf addComponent(boolean increaseWriterIndex, int cIndex, ByteBuf buffer) { checkNotNull(buffer, "buffer"); addComponent0(increaseWriterIndex, cIndex, buffer); consolidateIfNeeded(); return this; }
[ "public", "CompositeByteBuf", "addComponent", "(", "boolean", "increaseWriterIndex", ",", "int", "cIndex", ",", "ByteBuf", "buffer", ")", "{", "checkNotNull", "(", "buffer", ",", "\"buffer\"", ")", ";", "addComponent0", "(", "increaseWriterIndex", ",", "cIndex", "...
Add the given {@link ByteBuf} on the specific index and increase the {@code writerIndex} if {@code increaseWriterIndex} is {@code true}. {@link ByteBuf#release()} ownership of {@code buffer} is transferred to this {@link CompositeByteBuf}. @param cIndex the index on which the {@link ByteBuf} will be added. @param buffer the {@link ByteBuf} to add. {@link ByteBuf#release()} ownership is transferred to this {@link CompositeByteBuf}.
[ "Add", "the", "given", "{", "@link", "ByteBuf", "}", "on", "the", "specific", "index", "and", "increase", "the", "{", "@code", "writerIndex", "}", "if", "{", "@code", "increaseWriterIndex", "}", "is", "{", "@code", "true", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L263-L268
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHMessages.java
XPATHMessages.createXPATHMessage
public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception { // BEGIN android-changed // don't localize exception messages return createXPATHMsg(XPATHBundle, msgKey, args); // END android-changed }
java
public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception { // BEGIN android-changed // don't localize exception messages return createXPATHMsg(XPATHBundle, msgKey, args); // END android-changed }
[ "public", "static", "final", "String", "createXPATHMessage", "(", "String", "msgKey", ",", "Object", "args", "[", "]", ")", "//throws Exception ", "{", "// BEGIN android-changed", "// don't localize exception messages", "return", "createXPATHMsg", "(", "XPATHBundle", ...
Creates a message from the specified key and replacement arguments, localized to the given locale. @param msgKey The key for the message text. @param args The arguments to be used as replacement text in the message created. @return The formatted message string.
[ "Creates", "a", "message", "from", "the", "specified", "key", "and", "replacement", "arguments", "localized", "to", "the", "given", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHMessages.java#L50-L56
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/PhoneIntents.java
PhoneIntents.newSmsIntent
public static Intent newSmsIntent(Context context, String body) { return newSmsIntent(context, body, (String[]) null); }
java
public static Intent newSmsIntent(Context context, String body) { return newSmsIntent(context, body, (String[]) null); }
[ "public", "static", "Intent", "newSmsIntent", "(", "Context", "context", ",", "String", "body", ")", "{", "return", "newSmsIntent", "(", "context", ",", "body", ",", "(", "String", "[", "]", ")", "null", ")", ";", "}" ]
Creates an intent that will allow to send an SMS without specifying the phone number @param body The text to send @return the intent
[ "Creates", "an", "intent", "that", "will", "allow", "to", "send", "an", "SMS", "without", "specifying", "the", "phone", "number" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L71-L73
square/spoon
spoon-runner/src/main/java/com/squareup/spoon/misc/StackTrace.java
StackTrace.from
public static StackTrace from(Throwable exception) { checkNotNull(exception); StackTrace cause = null; Throwable realCause = exception.getCause(); if (realCause != null && realCause != exception) { cause = from(realCause); } Deque<Element> elements = new ArrayDeque<>(); for (StackTraceElement element : exception.getStackTrace()) { elements.add(Element.from(element)); } String className = exception.getClass().getCanonicalName(); String message = exception.getMessage(); return new StackTrace(className, message, elements, cause); }
java
public static StackTrace from(Throwable exception) { checkNotNull(exception); StackTrace cause = null; Throwable realCause = exception.getCause(); if (realCause != null && realCause != exception) { cause = from(realCause); } Deque<Element> elements = new ArrayDeque<>(); for (StackTraceElement element : exception.getStackTrace()) { elements.add(Element.from(element)); } String className = exception.getClass().getCanonicalName(); String message = exception.getMessage(); return new StackTrace(className, message, elements, cause); }
[ "public", "static", "StackTrace", "from", "(", "Throwable", "exception", ")", "{", "checkNotNull", "(", "exception", ")", ";", "StackTrace", "cause", "=", "null", ";", "Throwable", "realCause", "=", "exception", ".", "getCause", "(", ")", ";", "if", "(", "...
Convert a {@link Throwable} to its equivalent {@link StackTrace}.
[ "Convert", "a", "{" ]
train
https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/misc/StackTrace.java#L21-L38
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java
GeoJsonToAssembler.createPolygon
private Polygon createPolygon(double[][][] coordinates, CrsId crsId) { LinearRing[] rings = new LinearRing[coordinates.length]; for (int i = 0; i < coordinates.length; i++) { rings[i] = new LinearRing(createPointSequence(coordinates[i], crsId)); } return new Polygon(rings); }
java
private Polygon createPolygon(double[][][] coordinates, CrsId crsId) { LinearRing[] rings = new LinearRing[coordinates.length]; for (int i = 0; i < coordinates.length; i++) { rings[i] = new LinearRing(createPointSequence(coordinates[i], crsId)); } return new Polygon(rings); }
[ "private", "Polygon", "createPolygon", "(", "double", "[", "]", "[", "]", "[", "]", "coordinates", ",", "CrsId", "crsId", ")", "{", "LinearRing", "[", "]", "rings", "=", "new", "LinearRing", "[", "coordinates", ".", "length", "]", ";", "for", "(", "int...
Creates a polygon starting from its geojson coordinate array @param coordinates the geojson coordinate array @param crsId the srid of the crs to use @return a geolatte polygon instance
[ "Creates", "a", "polygon", "starting", "from", "its", "geojson", "coordinate", "array" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L446-L452
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java
Duration.ofNanos
public static Duration ofNanos(long nanos) { long secs = nanos / NANOS_PER_SECOND; int nos = (int) (nanos % NANOS_PER_SECOND); if (nos < 0) { nos += NANOS_PER_SECOND; secs--; } return create(secs, nos); }
java
public static Duration ofNanos(long nanos) { long secs = nanos / NANOS_PER_SECOND; int nos = (int) (nanos % NANOS_PER_SECOND); if (nos < 0) { nos += NANOS_PER_SECOND; secs--; } return create(secs, nos); }
[ "public", "static", "Duration", "ofNanos", "(", "long", "nanos", ")", "{", "long", "secs", "=", "nanos", "/", "NANOS_PER_SECOND", ";", "int", "nos", "=", "(", "int", ")", "(", "nanos", "%", "NANOS_PER_SECOND", ")", ";", "if", "(", "nos", "<", "0", ")...
Obtains a {@code Duration} representing a number of nanoseconds. <p> The seconds and nanoseconds are extracted from the specified nanoseconds. @param nanos the number of nanoseconds, positive or negative @return a {@code Duration}, not null
[ "Obtains", "a", "{", "@code", "Duration", "}", "representing", "a", "number", "of", "nanoseconds", ".", "<p", ">", "The", "seconds", "and", "nanoseconds", "are", "extracted", "from", "the", "specified", "nanoseconds", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java#L272-L280
Omertron/api-omdb
src/main/java/com/omertron/omdbapi/tools/OmdbUrlBuilder.java
OmdbUrlBuilder.generateUrl
public static URL generateUrl(final String url) throws OMDBException { try { return new URL(url); } catch (MalformedURLException ex) { throw new OMDBException(ApiExceptionType.INVALID_URL, "Failed to create URL", url, ex); } }
java
public static URL generateUrl(final String url) throws OMDBException { try { return new URL(url); } catch (MalformedURLException ex) { throw new OMDBException(ApiExceptionType.INVALID_URL, "Failed to create URL", url, ex); } }
[ "public", "static", "URL", "generateUrl", "(", "final", "String", "url", ")", "throws", "OMDBException", "{", "try", "{", "return", "new", "URL", "(", "url", ")", ";", "}", "catch", "(", "MalformedURLException", "ex", ")", "{", "throw", "new", "OMDBExcepti...
Generate a URL object from a String URL @param url @return @throws OMDBException
[ "Generate", "a", "URL", "object", "from", "a", "String", "URL" ]
train
https://github.com/Omertron/api-omdb/blob/acb506ded2d7b8a4159b48161ffab8cb5b7bad44/src/main/java/com/omertron/omdbapi/tools/OmdbUrlBuilder.java#L134-L140
JoeKerouac/utils
src/main/java/com/joe/utils/reflect/BeanUtils.java
BeanUtils.copy
public static <E> E copy(Object source, Class<E> targetClass) { if (source == null || targetClass == null) { return null; } E target; String targetClassName = targetClass.getName(); log.debug("生成{}的实例", targetClassName); try { // 没有权限访问该类或者该类(为接口、抽象类)不能实例化时将抛出异常 target = targetClass.newInstance(); } catch (Exception e) { log.error("target生成失败,请检查代码;失败原因:", e); return null; } return copy(target, source); }
java
public static <E> E copy(Object source, Class<E> targetClass) { if (source == null || targetClass == null) { return null; } E target; String targetClassName = targetClass.getName(); log.debug("生成{}的实例", targetClassName); try { // 没有权限访问该类或者该类(为接口、抽象类)不能实例化时将抛出异常 target = targetClass.newInstance(); } catch (Exception e) { log.error("target生成失败,请检查代码;失败原因:", e); return null; } return copy(target, source); }
[ "public", "static", "<", "E", ">", "E", "copy", "(", "Object", "source", ",", "Class", "<", "E", ">", "targetClass", ")", "{", "if", "(", "source", "==", "null", "||", "targetClass", "==", "null", ")", "{", "return", "null", ";", "}", "E", "target"...
将source中与targetClass同名的字段从source中复制到targetClass的实例中,source中的{@link Alias Alias}注解将会生效,需要注 意的是source中的Alias注解不要对应dest中的多个字段,否则会发生不可预测错误 @param source 被复制的源对象 @param targetClass 要复制的目标对象的class对象 @param <E> 目标对象的实际类型 @return targetClass的实例,当targetClass或者source的class为接口、抽象类或者不是public时返回null
[ "将source中与targetClass同名的字段从source中复制到targetClass的实例中,source中的", "{", "@link", "Alias", "Alias", "}", "注解将会生效,需要注", "意的是source中的Alias注解不要对应dest中的多个字段,否则会发生不可预测错误" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/BeanUtils.java#L140-L156
Trilarion/java-vorbis-support
src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java
VorbisAudioFileReader.getAudioFileFormat
@Override public AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException { LOG.log(Level.FINE, "getAudioFileFormat(InputStream inputStream)"); try { if (!inputStream.markSupported()) { inputStream = new BufferedInputStream(inputStream); } inputStream.mark(MARK_LIMIT); return getAudioFileFormat(inputStream, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED); } finally { inputStream.reset(); } }
java
@Override public AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException { LOG.log(Level.FINE, "getAudioFileFormat(InputStream inputStream)"); try { if (!inputStream.markSupported()) { inputStream = new BufferedInputStream(inputStream); } inputStream.mark(MARK_LIMIT); return getAudioFileFormat(inputStream, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED); } finally { inputStream.reset(); } }
[ "@", "Override", "public", "AudioFileFormat", "getAudioFileFormat", "(", "InputStream", "inputStream", ")", "throws", "UnsupportedAudioFileException", ",", "IOException", "{", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"getAudioFileFormat(InputStream inputStream...
Return the AudioFileFormat from the given InputStream. @return @throws javax.sound.sampled.UnsupportedAudioFileException @throws java.io.IOException
[ "Return", "the", "AudioFileFormat", "from", "the", "given", "InputStream", "." ]
train
https://github.com/Trilarion/java-vorbis-support/blob/f72aba7d97167fe0ff20b1b719fdb5bb662ff736/src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java#L138-L150
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.getPathAndNode
public static PathAndNode getPathAndNode(String path) { PathUtils.validatePath(path); int i = path.lastIndexOf(PATH_SEPARATOR); if ( i < 0 ) { return new PathAndNode(path, ""); } if ( (i + 1) >= path.length() ) { return new PathAndNode(PATH_SEPARATOR, ""); } String node = path.substring(i + 1); String parentPath = (i > 0) ? path.substring(0, i) : PATH_SEPARATOR; return new PathAndNode(parentPath, node); }
java
public static PathAndNode getPathAndNode(String path) { PathUtils.validatePath(path); int i = path.lastIndexOf(PATH_SEPARATOR); if ( i < 0 ) { return new PathAndNode(path, ""); } if ( (i + 1) >= path.length() ) { return new PathAndNode(PATH_SEPARATOR, ""); } String node = path.substring(i + 1); String parentPath = (i > 0) ? path.substring(0, i) : PATH_SEPARATOR; return new PathAndNode(parentPath, node); }
[ "public", "static", "PathAndNode", "getPathAndNode", "(", "String", "path", ")", "{", "PathUtils", ".", "validatePath", "(", "path", ")", ";", "int", "i", "=", "path", ".", "lastIndexOf", "(", "PATH_SEPARATOR", ")", ";", "if", "(", "i", "<", "0", ")", ...
Given a full path, return the node name and its path. i.e. "/one/two/three" will return {"/one/two", "three"} @param path the path @return the node
[ "Given", "a", "full", "path", "return", "the", "node", "name", "and", "its", "path", ".", "i", ".", "e", ".", "/", "one", "/", "two", "/", "three", "will", "return", "{", "/", "one", "/", "two", "three", "}" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L163-L178
lucasr/probe
library/src/main/java/org/lucasr/probe/Interceptor.java
Interceptor.invokeDraw
protected final void invokeDraw(View view, Canvas canvas) { final ViewProxy proxy = (ViewProxy) view; proxy.invokeDraw(canvas); }
java
protected final void invokeDraw(View view, Canvas canvas) { final ViewProxy proxy = (ViewProxy) view; proxy.invokeDraw(canvas); }
[ "protected", "final", "void", "invokeDraw", "(", "View", "view", ",", "Canvas", "canvas", ")", "{", "final", "ViewProxy", "proxy", "=", "(", "ViewProxy", ")", "view", ";", "proxy", ".", "invokeDraw", "(", "canvas", ")", ";", "}" ]
Performs a {@link View#draw(Canvas)} call on the given {@link View}.
[ "Performs", "a", "{" ]
train
https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/Interceptor.java#L91-L94
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccesspolicy_binding.java
vpnclientlessaccesspolicy_binding.get
public static vpnclientlessaccesspolicy_binding get(nitro_service service, String name) throws Exception{ vpnclientlessaccesspolicy_binding obj = new vpnclientlessaccesspolicy_binding(); obj.set_name(name); vpnclientlessaccesspolicy_binding response = (vpnclientlessaccesspolicy_binding) obj.get_resource(service); return response; }
java
public static vpnclientlessaccesspolicy_binding get(nitro_service service, String name) throws Exception{ vpnclientlessaccesspolicy_binding obj = new vpnclientlessaccesspolicy_binding(); obj.set_name(name); vpnclientlessaccesspolicy_binding response = (vpnclientlessaccesspolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "vpnclientlessaccesspolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "vpnclientlessaccesspolicy_binding", "obj", "=", "new", "vpnclientlessaccesspolicy_binding", "(", ")", ";", "obj", "....
Use this API to fetch vpnclientlessaccesspolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "vpnclientlessaccesspolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnclientlessaccesspolicy_binding.java#L114-L119
apache/flink
flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java
AbstractYarnClusterDescriptor.getYarnFilesDir
private Path getYarnFilesDir(final ApplicationId appId) throws IOException { final FileSystem fileSystem = FileSystem.get(yarnConfiguration); final Path homeDir = fileSystem.getHomeDirectory(); return new Path(homeDir, ".flink/" + appId + '/'); }
java
private Path getYarnFilesDir(final ApplicationId appId) throws IOException { final FileSystem fileSystem = FileSystem.get(yarnConfiguration); final Path homeDir = fileSystem.getHomeDirectory(); return new Path(homeDir, ".flink/" + appId + '/'); }
[ "private", "Path", "getYarnFilesDir", "(", "final", "ApplicationId", "appId", ")", "throws", "IOException", "{", "final", "FileSystem", "fileSystem", "=", "FileSystem", ".", "get", "(", "yarnConfiguration", ")", ";", "final", "Path", "homeDir", "=", "fileSystem", ...
Returns the Path where the YARN application files should be uploaded to. @param appId YARN application id
[ "Returns", "the", "Path", "where", "the", "YARN", "application", "files", "should", "be", "uploaded", "to", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java#L1059-L1063
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/AbstractMapBasedMultimap.java
AbstractMapBasedMultimap.wrapCollection
Collection<V> wrapCollection(@Nullable K key, Collection<V> collection) { // We don't deal with NavigableSet here yet for GWT reasons -- instead, // non-GWT TreeMultimap explicitly overrides this and uses NavigableSet. if (collection instanceof SortedSet) { return new WrappedSortedSet(key, (SortedSet<V>) collection, null); } else if (collection instanceof Set) { return new WrappedSet(key, (Set<V>) collection); } else if (collection instanceof List) { return wrapList(key, (List<V>) collection, null); } else { return new WrappedCollection(key, collection, null); } }
java
Collection<V> wrapCollection(@Nullable K key, Collection<V> collection) { // We don't deal with NavigableSet here yet for GWT reasons -- instead, // non-GWT TreeMultimap explicitly overrides this and uses NavigableSet. if (collection instanceof SortedSet) { return new WrappedSortedSet(key, (SortedSet<V>) collection, null); } else if (collection instanceof Set) { return new WrappedSet(key, (Set<V>) collection); } else if (collection instanceof List) { return wrapList(key, (List<V>) collection, null); } else { return new WrappedCollection(key, collection, null); } }
[ "Collection", "<", "V", ">", "wrapCollection", "(", "@", "Nullable", "K", "key", ",", "Collection", "<", "V", ">", "collection", ")", "{", "// We don't deal with NavigableSet here yet for GWT reasons -- instead,", "// non-GWT TreeMultimap explicitly overrides this and uses Navi...
Generates a decorated collection that remains consistent with the values in the multimap for the provided key. Changes to the multimap may alter the returned collection, and vice versa.
[ "Generates", "a", "decorated", "collection", "that", "remains", "consistent", "with", "the", "values", "in", "the", "multimap", "for", "the", "provided", "key", ".", "Changes", "to", "the", "multimap", "may", "alter", "the", "returned", "collection", "and", "v...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/AbstractMapBasedMultimap.java#L315-L327
aoindustries/semanticcms-core-taglib
src/main/java/com/semanticcms/core/taglib/ElementTag.java
ElementTag.evaluateAttributes
protected void evaluateAttributes(E element, ELContext elContext) throws JspTagException, IOException { String idStr = nullIfEmpty(resolveValue(id, String.class, elContext)); if(idStr != null) element.setId(idStr); }
java
protected void evaluateAttributes(E element, ELContext elContext) throws JspTagException, IOException { String idStr = nullIfEmpty(resolveValue(id, String.class, elContext)); if(idStr != null) element.setId(idStr); }
[ "protected", "void", "evaluateAttributes", "(", "E", "element", ",", "ELContext", "elContext", ")", "throws", "JspTagException", ",", "IOException", "{", "String", "idStr", "=", "nullIfEmpty", "(", "resolveValue", "(", "id", ",", "String", ".", "class", ",", "...
Resolves all attributes, setting into the created element as appropriate, This is only called for captureLevel >= META. Attributes are resolved before the element is added to any parent node. Typically, deferred expressions will be evaluated here. Overriding methods must call this implementation.
[ "Resolves", "all", "attributes", "setting", "into", "the", "created", "element", "as", "appropriate", "This", "is", "only", "called", "for", "captureLevel", ">", "=", "META", ".", "Attributes", "are", "resolved", "before", "the", "element", "is", "added", "to"...
train
https://github.com/aoindustries/semanticcms-core-taglib/blob/2e6c5dd3b1299c6cc6a87a335302460c5c69c539/src/main/java/com/semanticcms/core/taglib/ElementTag.java#L179-L182
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/ConfigValidation.java
ConfigValidation.listFv
public static NestableFieldValidator listFv(Class cls, boolean nullAllowed) { return listFv(fv(cls, false), nullAllowed); }
java
public static NestableFieldValidator listFv(Class cls, boolean nullAllowed) { return listFv(fv(cls, false), nullAllowed); }
[ "public", "static", "NestableFieldValidator", "listFv", "(", "Class", "cls", ",", "boolean", "nullAllowed", ")", "{", "return", "listFv", "(", "fv", "(", "cls", ",", "false", ")", ",", "nullAllowed", ")", ";", "}" ]
Returns a new NestableFieldValidator for a List of the given Class. @param cls the Class of elements composing the list @param nullAllowed whether or not a value of null is valid @return a NestableFieldValidator for a list of the given class
[ "Returns", "a", "new", "NestableFieldValidator", "for", "a", "List", "of", "the", "given", "Class", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/ConfigValidation.java#L89-L91
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/PropertyClient.java
PropertyClient.scanProperties
public void scanProperties(final boolean allProperties, final Consumer<Description> consumer) throws KNXException, InterruptedException { for (int index = 0; scan(index, allProperties, consumer) > 0; ++index); }
java
public void scanProperties(final boolean allProperties, final Consumer<Description> consumer) throws KNXException, InterruptedException { for (int index = 0; scan(index, allProperties, consumer) > 0; ++index); }
[ "public", "void", "scanProperties", "(", "final", "boolean", "allProperties", ",", "final", "Consumer", "<", "Description", ">", "consumer", ")", "throws", "KNXException", ",", "InterruptedException", "{", "for", "(", "int", "index", "=", "0", ";", "scan", "("...
Does a property description scan of the properties in all interface objects. @param allProperties <code>true</code> to scan all property descriptions in the interface objects, <code>false</code> to only scan the object type descriptions, i.e., {@link PropertyAccess.PID#OBJECT_TYPE} @param consumer invoked on every property read during the scan, taking a property {@link Description} argument @throws KNXException on adapter errors while querying the descriptions @throws InterruptedException on thread interrupt
[ "Does", "a", "property", "description", "scan", "of", "the", "properties", "in", "all", "interface", "objects", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/PropertyClient.java#L619-L623
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Entity.java
Entity.getRelation
<T extends Entity> T getRelation(Class<T> valuesClass, String name) { return getRelation(valuesClass, name, true); }
java
<T extends Entity> T getRelation(Class<T> valuesClass, String name) { return getRelation(valuesClass, name, true); }
[ "<", "T", "extends", "Entity", ">", "T", "getRelation", "(", "Class", "<", "T", ">", "valuesClass", ",", "String", "name", ")", "{", "return", "getRelation", "(", "valuesClass", ",", "name", ",", "true", ")", ";", "}" ]
Get a relation by name for this entity. @param valuesClass Class type of T. @param name Name of the relation attribute. @return The related asset.
[ "Get", "a", "relation", "by", "name", "for", "this", "entity", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Entity.java#L206-L208
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/thread_pool/ThreadPoolManager.java
ThreadPoolManager.scheduleAtFixedRate
public static ScheduledFuture scheduleAtFixedRate(Runnable runnable, long periodInMilli) { /** 我们默认设定一个runnable生命周期与一个msgId一一对应 */ Runnable proxied = wrapRunnable(runnable, null); return newSingleThreadScheduler().scheduleAtFixedRate(proxied, 0, periodInMilli, TimeUnit.MILLISECONDS); }
java
public static ScheduledFuture scheduleAtFixedRate(Runnable runnable, long periodInMilli) { /** 我们默认设定一个runnable生命周期与一个msgId一一对应 */ Runnable proxied = wrapRunnable(runnable, null); return newSingleThreadScheduler().scheduleAtFixedRate(proxied, 0, periodInMilli, TimeUnit.MILLISECONDS); }
[ "public", "static", "ScheduledFuture", "scheduleAtFixedRate", "(", "Runnable", "runnable", ",", "long", "periodInMilli", ")", "{", "/** 我们默认设定一个runnable生命周期与一个msgId一一对应 */", "Runnable", "proxied", "=", "wrapRunnable", "(", "runnable", ",", "null", ")", ";", "return", ...
轻量级的定时任务执行器。 任务之间不会并行执行,任何时刻都至多只会有一个任务在执行。 如果下一个任务执行时间已经到了,但是前一个还没有执行完毕,那么下个任务等待直到前一个执行完,然后再马上开始. @param runnable 执行的任务 @param periodInMilli 任务启动固定间隔,单位毫秒
[ "轻量级的定时任务执行器。", "任务之间不会并行执行,任何时刻都至多只会有一个任务在执行。", "如果下一个任务执行时间已经到了,但是前一个还没有执行完毕,那么下个任务等待直到前一个执行完,然后再马上开始", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/thread_pool/ThreadPoolManager.java#L253-L257
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.updateSharedAccess
public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess, AccountsApi.UpdateSharedAccessOptions options) throws ApiException { Object localVarPostBody = accountSharedAccess; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling updateSharedAccess"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/shared_access".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "item_type", options.itemType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_ids", options.userIds)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<AccountSharedAccess> localVarReturnType = new GenericType<AccountSharedAccess>() {}; return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess, AccountsApi.UpdateSharedAccessOptions options) throws ApiException { Object localVarPostBody = accountSharedAccess; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling updateSharedAccess"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/shared_access".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "item_type", options.itemType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_ids", options.userIds)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<AccountSharedAccess> localVarReturnType = new GenericType<AccountSharedAccess>() {}; return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "AccountSharedAccess", "updateSharedAccess", "(", "String", "accountId", ",", "AccountSharedAccess", "accountSharedAccess", ",", "AccountsApi", ".", "UpdateSharedAccessOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "acc...
Reserved: Sets the shared access information for users. Reserved: Sets the shared access information for one or more users. @param accountId The external account number (int) or account ID Guid. (required) @param accountSharedAccess (optional) @param options for modifying the method behavior. @return AccountSharedAccess @throws ApiException if fails to make API call
[ "Reserved", ":", "Sets", "the", "shared", "access", "information", "for", "users", ".", "Reserved", ":", "Sets", "the", "shared", "access", "information", "for", "one", "or", "more", "users", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L3056-L3093
f2prateek/rx-preferences
rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java
RxSharedPreferences.getBoolean
@CheckResult @NonNull public Preference<Boolean> getBoolean(@NonNull String key) { return getBoolean(key, DEFAULT_BOOLEAN); }
java
@CheckResult @NonNull public Preference<Boolean> getBoolean(@NonNull String key) { return getBoolean(key, DEFAULT_BOOLEAN); }
[ "@", "CheckResult", "@", "NonNull", "public", "Preference", "<", "Boolean", ">", "getBoolean", "(", "@", "NonNull", "String", "key", ")", "{", "return", "getBoolean", "(", "key", ",", "DEFAULT_BOOLEAN", ")", ";", "}" ]
Create a boolean preference for {@code key}. Default is {@code false}.
[ "Create", "a", "boolean", "preference", "for", "{" ]
train
https://github.com/f2prateek/rx-preferences/blob/e338b4e6cee9c0c7b850be86ab41ed7b39a3637e/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java#L62-L65
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java
MethodProvider.getMethod
public static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes) { Method[] methods = type.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(name) && Arrays.equals(method.getParameterTypes(), parameterTypes)) { return Optional.of(method); } } Class<?> superClass = type.getSuperclass(); if (superClass != null && !superClass.equals(Object.class)) { return getMethod(superClass, name, parameterTypes); } else { return Optional.absent(); } }
java
public static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes) { Method[] methods = type.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(name) && Arrays.equals(method.getParameterTypes(), parameterTypes)) { return Optional.of(method); } } Class<?> superClass = type.getSuperclass(); if (superClass != null && !superClass.equals(Object.class)) { return getMethod(superClass, name, parameterTypes); } else { return Optional.absent(); } }
[ "public", "static", "Optional", "<", "Method", ">", "getMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "Method", "[", "]", "methods", "=", "type", ".", "getDeclaredMe...
Gets method by name and parameters types using reflection, if the given type doesn't contain required method then continue applying this method for all super classes up to Object class. @param type the type to search method @param name the method name @param parameterTypes the parameters types @return Some if method exists otherwise None
[ "Gets", "method", "by", "name", "and", "parameters", "types", "using", "reflection", "if", "the", "given", "type", "doesn", "t", "contain", "required", "method", "then", "continue", "applying", "this", "method", "for", "all", "super", "classes", "up", "to", ...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java#L207-L220
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_scheduler_serviceName_events_uid_GET
public OvhSchedulerEvent billingAccount_scheduler_serviceName_events_uid_GET(String billingAccount, String serviceName, String uid) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}"; StringBuilder sb = path(qPath, billingAccount, serviceName, uid); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSchedulerEvent.class); }
java
public OvhSchedulerEvent billingAccount_scheduler_serviceName_events_uid_GET(String billingAccount, String serviceName, String uid) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}"; StringBuilder sb = path(qPath, billingAccount, serviceName, uid); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSchedulerEvent.class); }
[ "public", "OvhSchedulerEvent", "billingAccount_scheduler_serviceName_events_uid_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "uid", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/scheduler/{servic...
Get this object properties REST: GET /telephony/{billingAccount}/scheduler/{serviceName}/events/{uid} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param uid [required] The unique ICS event identifier
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L627-L632
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java
RecoverableUnitIdTable.reserveId
public final synchronized boolean reserveId(long id, Object obj) { if (tc.isEntryEnabled()) Tr.entry(tc, "reserveId", new Object[] {new Long(id), obj}); boolean reserved = false; // The id can only be reserved if it // isn't already in the map if (_idMap.get(id) == null) { _idMap.put(id, obj); reserved = true; } if (tc.isEntryEnabled()) Tr.exit(tc, "reserveId", new Boolean(reserved)); return reserved; }
java
public final synchronized boolean reserveId(long id, Object obj) { if (tc.isEntryEnabled()) Tr.entry(tc, "reserveId", new Object[] {new Long(id), obj}); boolean reserved = false; // The id can only be reserved if it // isn't already in the map if (_idMap.get(id) == null) { _idMap.put(id, obj); reserved = true; } if (tc.isEntryEnabled()) Tr.exit(tc, "reserveId", new Boolean(reserved)); return reserved; }
[ "public", "final", "synchronized", "boolean", "reserveId", "(", "long", "id", ",", "Object", "obj", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"reserveId\"", ",", "new", "Object", "[", "]", ...
Reserve the given id and associate it with the given object. This method should be used during recovery when there is a requirement to create a new object with a specific id rather than the one that is next available. @return true if the id was successfully reserved. @param id The value of the id to be reserved @param obj The object that requires the id
[ "Reserve", "the", "given", "id", "and", "associate", "it", "with", "the", "given", "object", ".", "This", "method", "should", "be", "used", "during", "recovery", "when", "there", "is", "a", "requirement", "to", "create", "a", "new", "object", "with", "a", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java#L83-L100
mikepenz/FastAdapter
library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/utils/AdapterUtil.java
AdapterUtil.restoreSubItemSelectionStatesForAlternativeStateManagement
public static <Item extends IItem> void restoreSubItemSelectionStatesForAlternativeStateManagement(Item item, List<String> selectedItems) { if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) { List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems(); for (int i = 0, size = subItems.size(); i < size; i++) { Item subItem = subItems.get(i); String id = String.valueOf(subItem.getIdentifier()); if (selectedItems != null && selectedItems.contains(id)) { subItem.withSetSelected(true); } restoreSubItemSelectionStatesForAlternativeStateManagement(subItem, selectedItems); } } }
java
public static <Item extends IItem> void restoreSubItemSelectionStatesForAlternativeStateManagement(Item item, List<String> selectedItems) { if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) { List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems(); for (int i = 0, size = subItems.size(); i < size; i++) { Item subItem = subItems.get(i); String id = String.valueOf(subItem.getIdentifier()); if (selectedItems != null && selectedItems.contains(id)) { subItem.withSetSelected(true); } restoreSubItemSelectionStatesForAlternativeStateManagement(subItem, selectedItems); } } }
[ "public", "static", "<", "Item", "extends", "IItem", ">", "void", "restoreSubItemSelectionStatesForAlternativeStateManagement", "(", "Item", "item", ",", "List", "<", "String", ">", "selectedItems", ")", "{", "if", "(", "item", "instanceof", "IExpandable", "&&", "...
internal method to restore the selection state of subItems @param item the parent item @param selectedItems the list of selectedItems from the savedInstanceState
[ "internal", "method", "to", "restore", "the", "selection", "state", "of", "subItems" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/utils/AdapterUtil.java#L20-L32
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AnderbergHierarchicalClustering.java
AnderbergHierarchicalClustering.initializeNNCache
private static void initializeNNCache(double[] scratch, double[] bestd, int[] besti) { final int size = bestd.length; Arrays.fill(bestd, Double.POSITIVE_INFINITY); Arrays.fill(besti, -1); for(int x = 0, p = 0; x < size; x++) { assert (p == MatrixParadigm.triangleSize(x)); double bestdx = Double.POSITIVE_INFINITY; int bestix = -1; for(int y = 0; y < x; y++, p++) { final double v = scratch[p]; if(v < bestd[y]) { bestd[y] = v; besti[y] = x; } if(v < bestdx) { bestdx = v; bestix = y; } } bestd[x] = bestdx; besti[x] = bestix; } }
java
private static void initializeNNCache(double[] scratch, double[] bestd, int[] besti) { final int size = bestd.length; Arrays.fill(bestd, Double.POSITIVE_INFINITY); Arrays.fill(besti, -1); for(int x = 0, p = 0; x < size; x++) { assert (p == MatrixParadigm.triangleSize(x)); double bestdx = Double.POSITIVE_INFINITY; int bestix = -1; for(int y = 0; y < x; y++, p++) { final double v = scratch[p]; if(v < bestd[y]) { bestd[y] = v; besti[y] = x; } if(v < bestdx) { bestdx = v; bestix = y; } } bestd[x] = bestdx; besti[x] = bestix; } }
[ "private", "static", "void", "initializeNNCache", "(", "double", "[", "]", "scratch", ",", "double", "[", "]", "bestd", ",", "int", "[", "]", "besti", ")", "{", "final", "int", "size", "=", "bestd", ".", "length", ";", "Arrays", ".", "fill", "(", "be...
Initialize the NN cache. @param scratch Scratch space @param bestd Best distance @param besti Best index
[ "Initialize", "the", "NN", "cache", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AnderbergHierarchicalClustering.java#L149-L171
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/io/FileIO.java
FileIO.getRemoteFile
public static File getRemoteFile(URL url, boolean keepAlive) throws IOException { File downloadedFile = File.createTempFile("downloaded-", ".bytes"); URLConnection conn = url.openConnection(); if (keepAlive) { conn.setRequestProperty("connection", "Keep-Alive"); } conn.setUseCaches(false); try (ReadableByteChannel inputChannel = Channels.newChannel(conn.getInputStream())) { try (WritableByteChannel outputChannel = Channels.newChannel(new FileOutputStream(downloadedFile))) { fastChannelCopy(inputChannel, outputChannel); } } return downloadedFile; }
java
public static File getRemoteFile(URL url, boolean keepAlive) throws IOException { File downloadedFile = File.createTempFile("downloaded-", ".bytes"); URLConnection conn = url.openConnection(); if (keepAlive) { conn.setRequestProperty("connection", "Keep-Alive"); } conn.setUseCaches(false); try (ReadableByteChannel inputChannel = Channels.newChannel(conn.getInputStream())) { try (WritableByteChannel outputChannel = Channels.newChannel(new FileOutputStream(downloadedFile))) { fastChannelCopy(inputChannel, outputChannel); } } return downloadedFile; }
[ "public", "static", "File", "getRemoteFile", "(", "URL", "url", ",", "boolean", "keepAlive", ")", "throws", "IOException", "{", "File", "downloadedFile", "=", "File", ".", "createTempFile", "(", "\"downloaded-\"", ",", "\".bytes\"", ")", ";", "URLConnection", "c...
Retrieves file from a remote location identified by a URL. <p> @param url @return @throws IOException
[ "Retrieves", "file", "from", "a", "remote", "location", "identified", "by", "a", "URL", ".", "<p", ">" ]
train
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/io/FileIO.java#L221-L236
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/AtsUtils.java
AtsUtils.download
public static File download(String url, File toDir) throws AlipayApiException { toDir.mkdirs(); HttpURLConnection conn = null; OutputStream output = null; File file = null; try { conn = getConnection(new URL(url)); String ctype = conn.getContentType(); if (CTYPE_OCTET.equals(ctype)) { String fileName = getFileName(conn); file = new File(toDir, fileName); output = new FileOutputStream(file); copy(conn.getInputStream(), output); } else { String rsp = WebUtils.getResponseAsString(conn); throw new AlipayApiException(rsp); } } catch (IOException e) { throw new AlipayApiException(e.getMessage()); } finally { closeQuietly(output); if (conn != null) { conn.disconnect(); } } return file; }
java
public static File download(String url, File toDir) throws AlipayApiException { toDir.mkdirs(); HttpURLConnection conn = null; OutputStream output = null; File file = null; try { conn = getConnection(new URL(url)); String ctype = conn.getContentType(); if (CTYPE_OCTET.equals(ctype)) { String fileName = getFileName(conn); file = new File(toDir, fileName); output = new FileOutputStream(file); copy(conn.getInputStream(), output); } else { String rsp = WebUtils.getResponseAsString(conn); throw new AlipayApiException(rsp); } } catch (IOException e) { throw new AlipayApiException(e.getMessage()); } finally { closeQuietly(output); if (conn != null) { conn.disconnect(); } } return file; }
[ "public", "static", "File", "download", "(", "String", "url", ",", "File", "toDir", ")", "throws", "AlipayApiException", "{", "toDir", ".", "mkdirs", "(", ")", ";", "HttpURLConnection", "conn", "=", "null", ";", "OutputStream", "output", "=", "null", ";", ...
通过HTTP GET方式下载文件到指定的目录。 @param url 需要下载的URL @param toDir 需要下载到的目录 @return 下载后的文件
[ "通过HTTP", "GET方式下载文件到指定的目录。" ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/AtsUtils.java#L114-L140
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java
Aggregations.doubleMin
public static <Key, Value> Aggregation<Key, Double, Double> doubleMin() { return new AggregationAdapter(new DoubleMinAggregation<Key, Value>()); }
java
public static <Key, Value> Aggregation<Key, Double, Double> doubleMin() { return new AggregationAdapter(new DoubleMinAggregation<Key, Value>()); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Aggregation", "<", "Key", ",", "Double", ",", "Double", ">", "doubleMin", "(", ")", "{", "return", "new", "AggregationAdapter", "(", "new", "DoubleMinAggregation", "<", "Key", ",", "Value", ">", "(", ")...
Returns an aggregation to find the double minimum of all supplied values.<br/> This aggregation is similar to: <pre>SELECT MIN(value) FROM x</pre> @param <Key> the input key type @param <Value> the supplied value type @return the minimum value over all supplied values
[ "Returns", "an", "aggregation", "to", "find", "the", "double", "minimum", "of", "all", "supplied", "values", ".", "<br", "/", ">", "This", "aggregation", "is", "similar", "to", ":", "<pre", ">", "SELECT", "MIN", "(", "value", ")", "FROM", "x<", "/", "p...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L222-L224
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/CmsSearchWidgetDialog.java
CmsSearchWidgetDialog.initWorkplaceRequestValues
@SuppressWarnings({"unchecked", "rawtypes"}) @Override protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { super.initWorkplaceRequestValues(settings, request); Map dialogMap = (Map)getDialogObject(); if (dialogMap != null) { dialogMap.put(PARAM_SEARCH_PARAMS, m_searchParams); dialogMap.put(PARAM_SEARCH_OBJECT, m_search); } }
java
@SuppressWarnings({"unchecked", "rawtypes"}) @Override protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { super.initWorkplaceRequestValues(settings, request); Map dialogMap = (Map)getDialogObject(); if (dialogMap != null) { dialogMap.put(PARAM_SEARCH_PARAMS, m_searchParams); dialogMap.put(PARAM_SEARCH_OBJECT, m_search); } }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "@", "Override", "protected", "void", "initWorkplaceRequestValues", "(", "CmsWorkplaceSettings", "settings", ",", "HttpServletRequest", "request", ")", "{", "super", ".", "initWorkplace...
Additionally saves <code>{@link #PARAM_SEARCH_PARAMS}</code> to the dialog object map.<p> @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
[ "Additionally", "saves", "<code", ">", "{", "@link", "#PARAM_SEARCH_PARAMS", "}", "<", "/", "code", ">", "to", "the", "dialog", "object", "map", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsSearchWidgetDialog.java#L515-L525
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/DistributionSetInfoPanel.java
DistributionSetInfoPanel.getSWModlabel
private Label getSWModlabel(final String labelName, final SoftwareModule swModule) { return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion()); }
java
private Label getSWModlabel(final String labelName, final SoftwareModule swModule) { return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion()); }
[ "private", "Label", "getSWModlabel", "(", "final", "String", "labelName", ",", "final", "SoftwareModule", "swModule", ")", "{", "return", "SPUIComponentProvider", ".", "createNameValueLabel", "(", "labelName", "+", "\" : \"", ",", "swModule", ".", "getName", "(", ...
Create Label for SW Module. @param labelName as Name @param swModule as Module (JVM|OS|AH) @return Label as UI
[ "Create", "Label", "for", "SW", "Module", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/DistributionSetInfoPanel.java#L90-L92
arquillian/arquillian-cube
openshift/api/src/main/java/org/arquillian/cube/openshift/api/Tools.java
Tools.loadProperties
public static Properties loadProperties(Class<?> clazz, String fileName) throws IOException { Properties properties = new Properties(); try (InputStream is = clazz.getClassLoader().getResourceAsStream(fileName)) { properties.load(is); } return properties; }
java
public static Properties loadProperties(Class<?> clazz, String fileName) throws IOException { Properties properties = new Properties(); try (InputStream is = clazz.getClassLoader().getResourceAsStream(fileName)) { properties.load(is); } return properties; }
[ "public", "static", "Properties", "loadProperties", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fileName", ")", "throws", "IOException", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "try", "(", "InputStream", "is", "=",...
Load properties. @param clazz the class from classpath where the properties are @param fileName properties file name @return properties @throws IOException for any error
[ "Load", "properties", "." ]
train
https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/openshift/api/src/main/java/org/arquillian/cube/openshift/api/Tools.java#L63-L69
michel-kraemer/citeproc-java
citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java
CSL.getRunner
private static ScriptRunner getRunner() throws IOException { if (sharedRunner.get() == null) { //create JavaScript runner ScriptRunner runner = ScriptRunnerFactory.createRunner(); //load bundled scripts try { runner.loadScript(CSL.class.getResource("dump.js")); runner.loadScript(CSL.class.getResource("citeproc.js")); runner.loadScript(CSL.class.getResource("formats.js")); runner.loadScript(CSL.class.getResource("loadsys.js")); } catch (ScriptRunnerException e) { //should never happen because bundled JavaScript files //should be OK indeed throw new RuntimeException("Invalid bundled javascript file", e); } sharedRunner.set(runner); } return sharedRunner.get(); }
java
private static ScriptRunner getRunner() throws IOException { if (sharedRunner.get() == null) { //create JavaScript runner ScriptRunner runner = ScriptRunnerFactory.createRunner(); //load bundled scripts try { runner.loadScript(CSL.class.getResource("dump.js")); runner.loadScript(CSL.class.getResource("citeproc.js")); runner.loadScript(CSL.class.getResource("formats.js")); runner.loadScript(CSL.class.getResource("loadsys.js")); } catch (ScriptRunnerException e) { //should never happen because bundled JavaScript files //should be OK indeed throw new RuntimeException("Invalid bundled javascript file", e); } sharedRunner.set(runner); } return sharedRunner.get(); }
[ "private", "static", "ScriptRunner", "getRunner", "(", ")", "throws", "IOException", "{", "if", "(", "sharedRunner", ".", "get", "(", ")", "==", "null", ")", "{", "//create JavaScript runner", "ScriptRunner", "runner", "=", "ScriptRunnerFactory", ".", "createRunne...
Gets or initializes the shared script runner {@link #sharedRunner} @return the runner @throws IOException if bundles scripts could not be loaded
[ "Gets", "or", "initializes", "the", "shared", "script", "runner", "{" ]
train
https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java#L405-L425
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java
ProjectiveStructureByFactorization.setDepths
public void setDepths( int view , double featureDepths[] ) { if( featureDepths.length < depths.numCols ) throw new IllegalArgumentException("Pixel count must be constant and match "+pixels.numCols); int N = depths.numCols; for (int i = 0; i < N; i++) { depths.set(view,i, featureDepths[i]); } }
java
public void setDepths( int view , double featureDepths[] ) { if( featureDepths.length < depths.numCols ) throw new IllegalArgumentException("Pixel count must be constant and match "+pixels.numCols); int N = depths.numCols; for (int i = 0; i < N; i++) { depths.set(view,i, featureDepths[i]); } }
[ "public", "void", "setDepths", "(", "int", "view", ",", "double", "featureDepths", "[", "]", ")", "{", "if", "(", "featureDepths", ".", "length", "<", "depths", ".", "numCols", ")", "throw", "new", "IllegalArgumentException", "(", "\"Pixel count must be constant...
Sets depths for a particular value to the values in the passed in array @param view @param featureDepths
[ "Sets", "depths", "for", "a", "particular", "value", "to", "the", "values", "in", "the", "passed", "in", "array" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java#L135-L143
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.codePointCount
public static int codePointCount(CharSequence seq, int beginIndex, int endIndex) { int length = seq.length(); if (beginIndex < 0 || endIndex > length || beginIndex > endIndex) { throw new IndexOutOfBoundsException(); } int n = endIndex - beginIndex; for (int i = beginIndex; i < endIndex; ) { if (isHighSurrogate(seq.charAt(i++)) && i < endIndex && isLowSurrogate(seq.charAt(i))) { n--; i++; } } return n; }
java
public static int codePointCount(CharSequence seq, int beginIndex, int endIndex) { int length = seq.length(); if (beginIndex < 0 || endIndex > length || beginIndex > endIndex) { throw new IndexOutOfBoundsException(); } int n = endIndex - beginIndex; for (int i = beginIndex; i < endIndex; ) { if (isHighSurrogate(seq.charAt(i++)) && i < endIndex && isLowSurrogate(seq.charAt(i))) { n--; i++; } } return n; }
[ "public", "static", "int", "codePointCount", "(", "CharSequence", "seq", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "int", "length", "=", "seq", ".", "length", "(", ")", ";", "if", "(", "beginIndex", "<", "0", "||", "endIndex", ">", "l...
Returns the number of Unicode code points in the text range of the specified char sequence. The text range begins at the specified {@code beginIndex} and extends to the {@code char} at index {@code endIndex - 1}. Thus the length (in {@code char}s) of the text range is {@code endIndex-beginIndex}. Unpaired surrogates within the text range count as one code point each. @param seq the char sequence @param beginIndex the index to the first {@code char} of the text range. @param endIndex the index after the last {@code char} of the text range. @return the number of Unicode code points in the specified text range @exception NullPointerException if {@code seq} is null. @exception IndexOutOfBoundsException if the {@code beginIndex} is negative, or {@code endIndex} is larger than the length of the given sequence, or {@code beginIndex} is larger than {@code endIndex}. @since 1.5
[ "Returns", "the", "number", "of", "Unicode", "code", "points", "in", "the", "text", "range", "of", "the", "specified", "char", "sequence", ".", "The", "text", "range", "begins", "at", "the", "specified", "{", "@code", "beginIndex", "}", "and", "extends", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5266-L5280
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java
TrajectoryUtil.getTrajectoryByID
public static Trajectory getTrajectoryByID(List<? extends Trajectory> t, int id){ Trajectory track = null; for(int i = 0; i < t.size() ; i++){ if(t.get(i).getID()==id){ track = t.get(i); break; } } return track; }
java
public static Trajectory getTrajectoryByID(List<? extends Trajectory> t, int id){ Trajectory track = null; for(int i = 0; i < t.size() ; i++){ if(t.get(i).getID()==id){ track = t.get(i); break; } } return track; }
[ "public", "static", "Trajectory", "getTrajectoryByID", "(", "List", "<", "?", "extends", "Trajectory", ">", "t", ",", "int", "id", ")", "{", "Trajectory", "track", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "t", ".", "size", ...
Finds trajectory by ID @param t List of Trajectories @param id ID of the trajectorie @return Trajectory with ID=id
[ "Finds", "trajectory", "by", "ID" ]
train
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java#L164-L173
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java
DoubleIntIndex.setKey
public synchronized void setKey(int i, int key) { if (i < 0 || i >= count) { throw new IndexOutOfBoundsException(); } if (!sortOnValues) { sorted = false; } keys[i] = key; }
java
public synchronized void setKey(int i, int key) { if (i < 0 || i >= count) { throw new IndexOutOfBoundsException(); } if (!sortOnValues) { sorted = false; } keys[i] = key; }
[ "public", "synchronized", "void", "setKey", "(", "int", "i", ",", "int", "key", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "count", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "if", "(", "!", "sortOnValues", ...
Modifies an existing pair. @param i the index @param key the key
[ "Modifies", "an", "existing", "pair", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java#L99-L110
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/InvalidFormulaInContextException.java
InvalidFormulaInContextException.fromThrowable
public static InvalidFormulaInContextException fromThrowable(String message, Throwable cause) { return (cause instanceof InvalidFormulaInContextException && Objects.equals(message, cause.getMessage())) ? (InvalidFormulaInContextException) cause : new InvalidFormulaInContextException(message, cause); }
java
public static InvalidFormulaInContextException fromThrowable(String message, Throwable cause) { return (cause instanceof InvalidFormulaInContextException && Objects.equals(message, cause.getMessage())) ? (InvalidFormulaInContextException) cause : new InvalidFormulaInContextException(message, cause); }
[ "public", "static", "InvalidFormulaInContextException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "InvalidFormulaInContextException", "&&", "Objects", ".", "equals", "(", "message", ",", "caus...
Converts a Throwable to a InvalidFormulaInContextException with the specified detail message. If the Throwable is a InvalidFormulaInContextException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new InvalidFormulaInContextException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a InvalidFormulaInContextException
[ "Converts", "a", "Throwable", "to", "a", "InvalidFormulaInContextException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "InvalidFormulaInContextException", "and", "if", "the", "Throwable", "s", "message", "is", "identi...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/InvalidFormulaInContextException.java#L63-L67
google/j2objc
jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java
TextUtils.substring
public static String substring(CharSequence source, int start, int end) { if (source instanceof String) return ((String) source).substring(start, end); if (source instanceof StringBuilder) return ((StringBuilder) source).substring(start, end); if (source instanceof StringBuffer) return ((StringBuffer) source).substring(start, end); char[] temp = obtain(end - start); getChars(source, start, end, temp, 0); String ret = new String(temp, 0, end - start); recycle(temp); return ret; }
java
public static String substring(CharSequence source, int start, int end) { if (source instanceof String) return ((String) source).substring(start, end); if (source instanceof StringBuilder) return ((StringBuilder) source).substring(start, end); if (source instanceof StringBuffer) return ((StringBuffer) source).substring(start, end); char[] temp = obtain(end - start); getChars(source, start, end, temp, 0); String ret = new String(temp, 0, end - start); recycle(temp); return ret; }
[ "public", "static", "String", "substring", "(", "CharSequence", "source", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "source", "instanceof", "String", ")", "return", "(", "(", "String", ")", "source", ")", ".", "substring", "(", "start"...
Create a new String object containing the given range of characters from the source string. This is different than simply calling {@link CharSequence#subSequence(int, int) CharSequence.subSequence} in that it does not preserve any style runs in the source sequence, allowing a more efficient implementation.
[ "Create", "a", "new", "String", "object", "containing", "the", "given", "range", "of", "characters", "from", "the", "source", "string", ".", "This", "is", "different", "than", "simply", "calling", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L224-L238
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setObject
@Override public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { checkParameterBounds(parameterIndex); switch(targetSqlType) { case Types.TINYINT: setByte(parameterIndex, ((Byte)x).byteValue()); break; case Types.SMALLINT: setShort(parameterIndex, ((Short)x).shortValue()); break; case Types.INTEGER: setInt(parameterIndex, ((Integer)x).intValue()); break; case Types.BIGINT: setLong(parameterIndex, ((Long)x).longValue()); break; case Types.DOUBLE: setDouble(parameterIndex, ((Double)x).doubleValue()); break; case Types.DECIMAL: setBigDecimal(parameterIndex, (BigDecimal)x); break; case Types.TIMESTAMP: setTimestamp(parameterIndex, (Timestamp)x); break; case Types.VARBINARY: case Types.VARCHAR: case Types.NVARCHAR: setString(parameterIndex, (String)x); break; case Types.OTHER: setObject(parameterIndex, x); break; default: throw SQLError.get(SQLError.ILLEGAL_ARGUMENT); } }
java
@Override public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { checkParameterBounds(parameterIndex); switch(targetSqlType) { case Types.TINYINT: setByte(parameterIndex, ((Byte)x).byteValue()); break; case Types.SMALLINT: setShort(parameterIndex, ((Short)x).shortValue()); break; case Types.INTEGER: setInt(parameterIndex, ((Integer)x).intValue()); break; case Types.BIGINT: setLong(parameterIndex, ((Long)x).longValue()); break; case Types.DOUBLE: setDouble(parameterIndex, ((Double)x).doubleValue()); break; case Types.DECIMAL: setBigDecimal(parameterIndex, (BigDecimal)x); break; case Types.TIMESTAMP: setTimestamp(parameterIndex, (Timestamp)x); break; case Types.VARBINARY: case Types.VARCHAR: case Types.NVARCHAR: setString(parameterIndex, (String)x); break; case Types.OTHER: setObject(parameterIndex, x); break; default: throw SQLError.get(SQLError.ILLEGAL_ARGUMENT); } }
[ "@", "Override", "public", "void", "setObject", "(", "int", "parameterIndex", ",", "Object", "x", ",", "int", "targetSqlType", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "switch", "(", "targetSqlType", ")", "{", ...
Sets the value of the designated parameter with the given object.
[ "Sets", "the", "value", "of", "the", "designated", "parameter", "with", "the", "given", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L469-L507
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.UByteArray
public JBBPDslBuilder UByteArray(final String name, final String sizeExpression) { final Item item = new Item(BinType.UBYTE_ARRAY, name, this.byteOrder); item.sizeExpression = assertExpressionChars(sizeExpression); this.addItem(item); return this; }
java
public JBBPDslBuilder UByteArray(final String name, final String sizeExpression) { final Item item = new Item(BinType.UBYTE_ARRAY, name, this.byteOrder); item.sizeExpression = assertExpressionChars(sizeExpression); this.addItem(item); return this; }
[ "public", "JBBPDslBuilder", "UByteArray", "(", "final", "String", "name", ",", "final", "String", "sizeExpression", ")", "{", "final", "Item", "item", "=", "new", "Item", "(", "BinType", ".", "UBYTE_ARRAY", ",", "name", ",", "this", ".", "byteOrder", ")", ...
Add named unsigned byte array which size calculated through expression. @param name name of the field, it can be null for anonymous one @param sizeExpression expression to calculate array size, must ot be null or empty. @return the builder instance, must not be null
[ "Add", "named", "unsigned", "byte", "array", "which", "size", "calculated", "through", "expression", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L937-L942