repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optIntegerArrayList
@Nullable public static ArrayList<Integer> optIntegerArrayList(@Nullable Bundle bundle, @Nullable String key) { return optIntegerArrayList(bundle, key, new ArrayList<Integer>()); }
java
@Nullable public static ArrayList<Integer> optIntegerArrayList(@Nullable Bundle bundle, @Nullable String key) { return optIntegerArrayList(bundle, key, new ArrayList<Integer>()); }
[ "@", "Nullable", "public", "static", "ArrayList", "<", "Integer", ">", "optIntegerArrayList", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optIntegerArrayList", "(", "bundle", ",", "key", ",", "new", "...
Since Bundle#getIntegerArrayList returns concrete ArrayList type, so this method follows that implementation.
[ "Since", "Bundle#getIntegerArrayList", "returns", "concrete", "ArrayList", "type", "so", "this", "method", "follows", "that", "implementation", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L600-L603
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java
FixDependencyChecker.confirmNoFileConflicts
private static boolean confirmNoFileConflicts(Set<UpdatedFile> updatedFiles1, Set<UpdatedFile> updatedFiles2) { for (Iterator<UpdatedFile> iter1 = updatedFiles1.iterator(); iter1.hasNext();) { UpdatedFile currFile1 = iter1.next(); for (Iterator<UpdatedFile> iter2 = updatedFiles2.iterator(); iter2.hasNext();) { UpdatedFile currFile2 = iter2.next(); if (currFile1.getId().equals(currFile2.getId())) { return false; } } } return true; }
java
private static boolean confirmNoFileConflicts(Set<UpdatedFile> updatedFiles1, Set<UpdatedFile> updatedFiles2) { for (Iterator<UpdatedFile> iter1 = updatedFiles1.iterator(); iter1.hasNext();) { UpdatedFile currFile1 = iter1.next(); for (Iterator<UpdatedFile> iter2 = updatedFiles2.iterator(); iter2.hasNext();) { UpdatedFile currFile2 = iter2.next(); if (currFile1.getId().equals(currFile2.getId())) { return false; } } } return true; }
[ "private", "static", "boolean", "confirmNoFileConflicts", "(", "Set", "<", "UpdatedFile", ">", "updatedFiles1", ",", "Set", "<", "UpdatedFile", ">", "updatedFiles2", ")", "{", "for", "(", "Iterator", "<", "UpdatedFile", ">", "iter1", "=", "updatedFiles1", ".", ...
Confirms that UpdatedFile lists does not contain any common files @param updatedFiles1 @param updatedFiles2 @return Return true if there are no conflicts and return false otherwise
[ "Confirms", "that", "UpdatedFile", "lists", "does", "not", "contain", "any", "common", "files" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java#L193-L205
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/IntStream.java
IntStream.scan
@NotNull public IntStream scan(@NotNull final IntBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new IntStream(params, new IntScan(iterator, accumulator)); }
java
@NotNull public IntStream scan(@NotNull final IntBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new IntStream(params, new IntScan(iterator, accumulator)); }
[ "@", "NotNull", "public", "IntStream", "scan", "(", "@", "NotNull", "final", "IntBinaryOperator", "accumulator", ")", "{", "Objects", ".", "requireNonNull", "(", "accumulator", ")", ";", "return", "new", "IntStream", "(", "params", ",", "new", "IntScan", "(", ...
Returns a {@code IntStream} produced by iterative application of a accumulation function to reduction value and next element of the current stream. Produces a {@code IntStream} consisting of {@code value1}, {@code acc(value1, value2)}, {@code acc(acc(value1, value2), value3)}, etc. <p>This is an intermediate operation. <p>Example: <pre> accumulator: (a, b) -&gt; a + b stream: [1, 2, 3, 4, 5] result: [1, 3, 6, 10, 15] </pre> @param accumulator the accumulation function @return the new stream @throws NullPointerException if {@code accumulator} is null @since 1.1.6
[ "Returns", "a", "{", "@code", "IntStream", "}", "produced", "by", "iterative", "application", "of", "a", "accumulation", "function", "to", "reduction", "value", "and", "next", "element", "of", "the", "current", "stream", ".", "Produces", "a", "{", "@code", "...
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L705-L709
structr/structr
structr-ui/src/main/java/org/structr/web/common/FileHelper.java
FileHelper.createFile
public static <T extends File> T createFile(final SecurityContext securityContext, final byte[] fileData, final String contentType, final Class<T> t, final String name, final boolean updateMetadata) throws FrameworkException, IOException { final PropertyMap props = new PropertyMap(); props.put(AbstractNode.name, name); T newFile = (T) StructrApp.getInstance(securityContext).create(t, props); setFileData(newFile, fileData, contentType, updateMetadata); if (updateMetadata) { newFile.notifyUploadCompletion(); } return newFile; }
java
public static <T extends File> T createFile(final SecurityContext securityContext, final byte[] fileData, final String contentType, final Class<T> t, final String name, final boolean updateMetadata) throws FrameworkException, IOException { final PropertyMap props = new PropertyMap(); props.put(AbstractNode.name, name); T newFile = (T) StructrApp.getInstance(securityContext).create(t, props); setFileData(newFile, fileData, contentType, updateMetadata); if (updateMetadata) { newFile.notifyUploadCompletion(); } return newFile; }
[ "public", "static", "<", "T", "extends", "File", ">", "T", "createFile", "(", "final", "SecurityContext", "securityContext", ",", "final", "byte", "[", "]", "fileData", ",", "final", "String", "contentType", ",", "final", "Class", "<", "T", ">", "t", ",", ...
Create a new file node from the given byte array @param <T> @param securityContext @param fileData @param contentType if null, try to auto-detect content type @param t @param name @param updateMetadata @return file @throws FrameworkException @throws IOException
[ "Create", "a", "new", "file", "node", "from", "the", "given", "byte", "array" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L209-L225
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/document/json/JsonObject.java
JsonObject.fromJson
public static JsonObject fromJson(String s) { try { return CouchbaseAsyncBucket.JSON_OBJECT_TRANSCODER.stringToJsonObject(s); } catch (Exception e) { throw new IllegalArgumentException("Cannot convert string to JsonObject", e); } }
java
public static JsonObject fromJson(String s) { try { return CouchbaseAsyncBucket.JSON_OBJECT_TRANSCODER.stringToJsonObject(s); } catch (Exception e) { throw new IllegalArgumentException("Cannot convert string to JsonObject", e); } }
[ "public", "static", "JsonObject", "fromJson", "(", "String", "s", ")", "{", "try", "{", "return", "CouchbaseAsyncBucket", ".", "JSON_OBJECT_TRANSCODER", ".", "stringToJsonObject", "(", "s", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "n...
Static method to create a {@link JsonObject} from a JSON {@link String}. The string is expected to be a valid JSON object representation (eg. starting with a '{'). @param s the JSON String to convert to a {@link JsonObject}. @return the corresponding {@link JsonObject}. @throws IllegalArgumentException if the conversion cannot be done.
[ "Static", "method", "to", "create", "a", "{", "@link", "JsonObject", "}", "from", "a", "JSON", "{", "@link", "String", "}", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L186-L192
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.readCertificate
public static Certificate readCertificate(String type, InputStream in) { try { return getCertificateFactory(type).generateCertificate(in); } catch (CertificateException e) { throw new CryptoException(e); } }
java
public static Certificate readCertificate(String type, InputStream in) { try { return getCertificateFactory(type).generateCertificate(in); } catch (CertificateException e) { throw new CryptoException(e); } }
[ "public", "static", "Certificate", "readCertificate", "(", "String", "type", ",", "InputStream", "in", ")", "{", "try", "{", "return", "getCertificateFactory", "(", "type", ")", ".", "generateCertificate", "(", "in", ")", ";", "}", "catch", "(", "CertificateEx...
读取Certification文件<br> Certification为证书文件<br> see: http://snowolf.iteye.com/blog/391931 @param type 类型,例如X.509 @param in {@link InputStream} 如果想从文件读取.cer文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @return {@link Certificate}
[ "读取Certification文件<br", ">", "Certification为证书文件<br", ">", "see", ":", "http", ":", "//", "snowolf", ".", "iteye", ".", "com", "/", "blog", "/", "391931" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L693-L699
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/PatientRecordEvent.java
PatientRecordEvent.addPatientParticipantObject
public void addPatientParticipantObject(String patientId, byte[] messageId, IHETransactionEventTypeCodes transaction) { List<TypeValuePairType> tvp = new LinkedList<>(); if (messageId != null) { if (transaction.getCode().equalsIgnoreCase("ITI-44")) { // v3 message tvp.add(getTypeValuePair("II", messageId)); } else { // v2 message tvp.add(getTypeValuePair("MSH-10", messageId)); } } addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.PatientNumber(), null, null, tvp, patientId, RFC3881ParticipantObjectTypeCodes.PERSON, RFC3881ParticipantObjectTypeRoleCodes.PATIENT, null, null); }
java
public void addPatientParticipantObject(String patientId, byte[] messageId, IHETransactionEventTypeCodes transaction) { List<TypeValuePairType> tvp = new LinkedList<>(); if (messageId != null) { if (transaction.getCode().equalsIgnoreCase("ITI-44")) { // v3 message tvp.add(getTypeValuePair("II", messageId)); } else { // v2 message tvp.add(getTypeValuePair("MSH-10", messageId)); } } addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.PatientNumber(), null, null, tvp, patientId, RFC3881ParticipantObjectTypeCodes.PERSON, RFC3881ParticipantObjectTypeRoleCodes.PATIENT, null, null); }
[ "public", "void", "addPatientParticipantObject", "(", "String", "patientId", ",", "byte", "[", "]", "messageId", ",", "IHETransactionEventTypeCodes", "transaction", ")", "{", "List", "<", "TypeValuePairType", ">", "tvp", "=", "new", "LinkedList", "<>", "(", ")", ...
Adds a Participant Object Identification block that representing a patient involved in the event @param patientId Identifier of the patient involved @param messageId The message control id for this event @param transaction The transaction event
[ "Adds", "a", "Participant", "Object", "Identification", "block", "that", "representing", "a", "patient", "involved", "in", "the", "event" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/PatientRecordEvent.java#L67-L90
alkacon/opencms-core
src/org/opencms/jsp/Messages.java
Messages.getLocalizedMessage
public static String getLocalizedMessage(CmsMessageContainer container, CmsObject cms) { Locale locale; if (cms != null) { CmsRequestContext context = cms.getRequestContext(); locale = (context != null) ? context.getLocale() : Locale.getDefault(); } else { locale = Locale.getDefault(); } return container.key(locale); }
java
public static String getLocalizedMessage(CmsMessageContainer container, CmsObject cms) { Locale locale; if (cms != null) { CmsRequestContext context = cms.getRequestContext(); locale = (context != null) ? context.getLocale() : Locale.getDefault(); } else { locale = Locale.getDefault(); } return container.key(locale); }
[ "public", "static", "String", "getLocalizedMessage", "(", "CmsMessageContainer", "container", ",", "CmsObject", "cms", ")", "{", "Locale", "locale", ";", "if", "(", "cms", "!=", "null", ")", "{", "CmsRequestContext", "context", "=", "cms", ".", "getRequestContex...
Returns the String for the given CmsMessageContainer localized to the current user's locale if available or to the default locale else. <p> This method is needed for localization of non- {@link org.opencms.main.CmsException} instances that have to be thrown here due to API constraints (javax.servlet.jsp). <p> @param container A CmsMessageContainer containing the message to localize. @param cms the <code>CmsObject</code> belonging to the current user (e.g. obtained with <code>CmsFlexController.getCmsObject(ServletRequest)</code>). @return the String for the given CmsMessageContainer localized to the current user's locale if available or to the default locale else. <p>
[ "Returns", "the", "String", "for", "the", "given", "CmsMessageContainer", "localized", "to", "the", "current", "user", "s", "locale", "if", "available", "or", "to", "the", "default", "locale", "else", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/Messages.java#L286-L296
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeSequenceVectors
public static <T extends SequenceElement> void writeSequenceVectors(@NonNull SequenceVectors<T> vectors, @NonNull SequenceElementFactory<T> factory, @NonNull OutputStream stream) throws IOException { WeightLookupTable<T> lookupTable = vectors.getLookupTable(); VocabCache<T> vocabCache = vectors.getVocab(); try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream, StandardCharsets.UTF_8)))) { // at first line we save VectorsConfiguration writer.write(vectors.getConfiguration().toEncodedJson()); // now we have elements one by one for (int x = 0; x < vocabCache.numWords(); x++) { T element = vocabCache.elementAtIndex(x); String json = factory.serialize(element); INDArray d = Nd4j.create(1); double[] vector = lookupTable.vector(element.getLabel()).dup().data().asDouble(); ElementPair pair = new ElementPair(json, vector); writer.println(pair.toEncodedJson()); writer.flush(); } } }
java
public static <T extends SequenceElement> void writeSequenceVectors(@NonNull SequenceVectors<T> vectors, @NonNull SequenceElementFactory<T> factory, @NonNull OutputStream stream) throws IOException { WeightLookupTable<T> lookupTable = vectors.getLookupTable(); VocabCache<T> vocabCache = vectors.getVocab(); try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream, StandardCharsets.UTF_8)))) { // at first line we save VectorsConfiguration writer.write(vectors.getConfiguration().toEncodedJson()); // now we have elements one by one for (int x = 0; x < vocabCache.numWords(); x++) { T element = vocabCache.elementAtIndex(x); String json = factory.serialize(element); INDArray d = Nd4j.create(1); double[] vector = lookupTable.vector(element.getLabel()).dup().data().asDouble(); ElementPair pair = new ElementPair(json, vector); writer.println(pair.toEncodedJson()); writer.flush(); } } }
[ "public", "static", "<", "T", "extends", "SequenceElement", ">", "void", "writeSequenceVectors", "(", "@", "NonNull", "SequenceVectors", "<", "T", ">", "vectors", ",", "@", "NonNull", "SequenceElementFactory", "<", "T", ">", "factory", ",", "@", "NonNull", "Ou...
This method saves specified SequenceVectors model to target OutputStream @param vectors SequenceVectors model @param factory SequenceElementFactory implementation for your objects @param stream Target output stream @param <T>
[ "This", "method", "saves", "specified", "SequenceVectors", "model", "to", "target", "OutputStream" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1970-L1991
JakeWharton/NineOldAndroids
library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java
ViewPropertyAnimatorPreHC.startAnimation
private void startAnimation() { ValueAnimator animator = ValueAnimator.ofFloat(1.0f); ArrayList<NameValuesHolder> nameValueList = (ArrayList<NameValuesHolder>) mPendingAnimations.clone(); mPendingAnimations.clear(); int propertyMask = 0; int propertyCount = nameValueList.size(); for (int i = 0; i < propertyCount; ++i) { NameValuesHolder nameValuesHolder = nameValueList.get(i); propertyMask |= nameValuesHolder.mNameConstant; } mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList)); animator.addUpdateListener(mAnimatorEventListener); animator.addListener(mAnimatorEventListener); if (mStartDelaySet) { animator.setStartDelay(mStartDelay); } if (mDurationSet) { animator.setDuration(mDuration); } if (mInterpolatorSet) { animator.setInterpolator(mInterpolator); } animator.start(); }
java
private void startAnimation() { ValueAnimator animator = ValueAnimator.ofFloat(1.0f); ArrayList<NameValuesHolder> nameValueList = (ArrayList<NameValuesHolder>) mPendingAnimations.clone(); mPendingAnimations.clear(); int propertyMask = 0; int propertyCount = nameValueList.size(); for (int i = 0; i < propertyCount; ++i) { NameValuesHolder nameValuesHolder = nameValueList.get(i); propertyMask |= nameValuesHolder.mNameConstant; } mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList)); animator.addUpdateListener(mAnimatorEventListener); animator.addListener(mAnimatorEventListener); if (mStartDelaySet) { animator.setStartDelay(mStartDelay); } if (mDurationSet) { animator.setDuration(mDuration); } if (mInterpolatorSet) { animator.setInterpolator(mInterpolator); } animator.start(); }
[ "private", "void", "startAnimation", "(", ")", "{", "ValueAnimator", "animator", "=", "ValueAnimator", ".", "ofFloat", "(", "1.0f", ")", ";", "ArrayList", "<", "NameValuesHolder", ">", "nameValueList", "=", "(", "ArrayList", "<", "NameValuesHolder", ">", ")", ...
Starts the underlying Animator for a set of properties. We use a single animator that simply runs from 0 to 1, and then use that fractional value to set each property value accordingly.
[ "Starts", "the", "underlying", "Animator", "for", "a", "set", "of", "properties", ".", "We", "use", "a", "single", "animator", "that", "simply", "runs", "from", "0", "to", "1", "and", "then", "use", "that", "fractional", "value", "to", "set", "each", "pr...
train
https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java#L435-L459
schallee/alib4j
core/src/main/java/net/darkmist/alib/res/PkgRes.java
PkgRes.getStringFor
public static String getStringFor(String name, Class<?> cls) { InputStream in = null; try { if((in = getFor(name, cls))==null) throw new ResourceException("Unablet to find package resource for " + name + " and " + cls); return IOUtils.toString(in); } catch(IOException e) { throw new ResourceException("IOException reading resource " + name, e); } finally { Closer.close(in,logger,"resource InputStream for resource " + name); } }
java
public static String getStringFor(String name, Class<?> cls) { InputStream in = null; try { if((in = getFor(name, cls))==null) throw new ResourceException("Unablet to find package resource for " + name + " and " + cls); return IOUtils.toString(in); } catch(IOException e) { throw new ResourceException("IOException reading resource " + name, e); } finally { Closer.close(in,logger,"resource InputStream for resource " + name); } }
[ "public", "static", "String", "getStringFor", "(", "String", "name", ",", "Class", "<", "?", ">", "cls", ")", "{", "InputStream", "in", "=", "null", ";", "try", "{", "if", "(", "(", "in", "=", "getFor", "(", "name", ",", "cls", ")", ")", "==", "n...
Get a resource as a String. @param name The name of the resource @param cls the class to use for the package name @return The contents of the resource converted to a string with the default encoding. @throws NullPointerException if name or cls are null. ResourceException if the resource cannot be found.
[ "Get", "a", "resource", "as", "a", "String", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L284-L302
maestrano/maestrano-java
src/main/java/com/maestrano/saml/Response.java
Response.loadFromXML
public static Response loadFromXML(Sso ssoService, String xml) throws CertificateException, ParserConfigurationException, SAXException, IOException { return new Response(ssoService.getSamlSettings().getIdpCertificate(), xml); }
java
public static Response loadFromXML(Sso ssoService, String xml) throws CertificateException, ParserConfigurationException, SAXException, IOException { return new Response(ssoService.getSamlSettings().getIdpCertificate(), xml); }
[ "public", "static", "Response", "loadFromXML", "(", "Sso", "ssoService", ",", "String", "xml", ")", "throws", "CertificateException", ",", "ParserConfigurationException", ",", "SAXException", ",", "IOException", "{", "return", "new", "Response", "(", "ssoService", "...
Load the Response with the provided XML string (not base64 encoded) @param ssoService Maestrano ssOSsoService @param String xml response provided by the SAML idp
[ "Load", "the", "Response", "with", "the", "provided", "XML", "string", "(", "not", "base64", "encoded", ")" ]
train
https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/saml/Response.java#L54-L56
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/pubsub/PubSubCommandHandler.java
PubSubCommandHandler.isPubSubMessage
private static boolean isPubSubMessage(ResponseHeaderReplayOutput<?, ?> replay) { if (replay == null) { return false; } String firstElement = replay.firstElement; if (replay.multiCount != null && firstElement != null) { if (replay.multiCount == 3 && firstElement.equalsIgnoreCase(PubSubOutput.Type.message.name())) { return true; } if (replay.multiCount == 4 && firstElement.equalsIgnoreCase(PubSubOutput.Type.pmessage.name())) { return true; } } return false; }
java
private static boolean isPubSubMessage(ResponseHeaderReplayOutput<?, ?> replay) { if (replay == null) { return false; } String firstElement = replay.firstElement; if (replay.multiCount != null && firstElement != null) { if (replay.multiCount == 3 && firstElement.equalsIgnoreCase(PubSubOutput.Type.message.name())) { return true; } if (replay.multiCount == 4 && firstElement.equalsIgnoreCase(PubSubOutput.Type.pmessage.name())) { return true; } } return false; }
[ "private", "static", "boolean", "isPubSubMessage", "(", "ResponseHeaderReplayOutput", "<", "?", ",", "?", ">", "replay", ")", "{", "if", "(", "replay", "==", "null", ")", "{", "return", "false", ";", "}", "String", "firstElement", "=", "replay", ".", "firs...
Check whether {@link ResponseHeaderReplayOutput} contains a Pub/Sub message that requires Pub/Sub dispatch instead of to be used as Command output. @param replay @return
[ "Check", "whether", "{", "@link", "ResponseHeaderReplayOutput", "}", "contains", "a", "Pub", "/", "Sub", "message", "that", "requires", "Pub", "/", "Sub", "dispatch", "instead", "of", "to", "be", "used", "as", "Command", "output", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/pubsub/PubSubCommandHandler.java#L168-L187
h2oai/h2o-3
h2o-core/src/main/java/jsr166y/ForkJoinPool.java
ForkJoinPool.tryPollForAndExec
private void tryPollForAndExec(WorkQueue joiner, ForkJoinTask<?> task) { WorkQueue[] ws; if ((ws = workQueues) != null) { for (int j = 1; j < ws.length && task.status >= 0; j += 2) { WorkQueue q = ws[j]; if (q != null && q.pollFor(task)) { joiner.runSubtask(task); break; } } } }
java
private void tryPollForAndExec(WorkQueue joiner, ForkJoinTask<?> task) { WorkQueue[] ws; if ((ws = workQueues) != null) { for (int j = 1; j < ws.length && task.status >= 0; j += 2) { WorkQueue q = ws[j]; if (q != null && q.pollFor(task)) { joiner.runSubtask(task); break; } } } }
[ "private", "void", "tryPollForAndExec", "(", "WorkQueue", "joiner", ",", "ForkJoinTask", "<", "?", ">", "task", ")", "{", "WorkQueue", "[", "]", "ws", ";", "if", "(", "(", "ws", "=", "workQueues", ")", "!=", "null", ")", "{", "for", "(", "int", "j", ...
If task is at base of some steal queue, steals and executes it. @param joiner the joining worker @param task the task
[ "If", "task", "is", "at", "base", "of", "some", "steal", "queue", "steals", "and", "executes", "it", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/ForkJoinPool.java#L1733-L1744
OpenLiberty/open-liberty
dev/com.ibm.ws.opentracing.1.1/src/com/ibm/ws/opentracing/OpentracingService.java
OpentracingService.addSpanErrorInfo
public static void addSpanErrorInfo(Span span, Throwable exception) { String methodName = "addSpanErrorInfo"; span.setTag(Tags.ERROR.getKey(), true); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName + " error", Boolean.TRUE); } if (exception != null) { Map<String, Object> log = new HashMap<>(); // https://github.com/opentracing/specification/blob/master/semantic_conventions.md#log-fields-table log.put("event", "error"); // Throwable implements Serializable so all exceptions are serializable log.put("error.object", exception); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName + " adding log entry", log); } span.log(log); } }
java
public static void addSpanErrorInfo(Span span, Throwable exception) { String methodName = "addSpanErrorInfo"; span.setTag(Tags.ERROR.getKey(), true); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName + " error", Boolean.TRUE); } if (exception != null) { Map<String, Object> log = new HashMap<>(); // https://github.com/opentracing/specification/blob/master/semantic_conventions.md#log-fields-table log.put("event", "error"); // Throwable implements Serializable so all exceptions are serializable log.put("error.object", exception); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, methodName + " adding log entry", log); } span.log(log); } }
[ "public", "static", "void", "addSpanErrorInfo", "(", "Span", "span", ",", "Throwable", "exception", ")", "{", "String", "methodName", "=", "\"addSpanErrorInfo\"", ";", "span", ".", "setTag", "(", "Tags", ".", "ERROR", ".", "getKey", "(", ")", ",", "true", ...
"An Tags.ERROR tag SHOULD be added to a Span on failed operations. It means for any server error (5xx) codes. If there is an exception object available the implementation SHOULD also add logs event=error and error.object=<error object instance> to the active span." https://github.com/eclipse/microprofile-opentracing/blob/master/spec/src/main/asciidoc/microprofile-opentracing.asciidoc#server-span-tags @param span The span to add the information to. @param exception Optional exception details.
[ "An", "Tags", ".", "ERROR", "tag", "SHOULD", "be", "added", "to", "a", "Span", "on", "failed", "operations", ".", "It", "means", "for", "any", "server", "error", "(", "5xx", ")", "codes", ".", "If", "there", "is", "an", "exception", "object", "availabl...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.opentracing.1.1/src/com/ibm/ws/opentracing/OpentracingService.java#L162-L184
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getAllClassesLinkScript
public Content getAllClassesLinkScript(String id) { HtmlTree script = HtmlTree.SCRIPT(); String scriptCode = "<!--\n" + " allClassesLink = document.getElementById(\"" + id + "\");\n" + " if(window==top) {\n" + " allClassesLink.style.display = \"block\";\n" + " }\n" + " else {\n" + " allClassesLink.style.display = \"none\";\n" + " }\n" + " //-->\n"; Content scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL)); script.addContent(scriptContent); Content div = HtmlTree.DIV(script); Content div_noscript = HtmlTree.DIV(contents.noScriptMessage); Content noScript = HtmlTree.NOSCRIPT(div_noscript); div.addContent(noScript); return div; }
java
public Content getAllClassesLinkScript(String id) { HtmlTree script = HtmlTree.SCRIPT(); String scriptCode = "<!--\n" + " allClassesLink = document.getElementById(\"" + id + "\");\n" + " if(window==top) {\n" + " allClassesLink.style.display = \"block\";\n" + " }\n" + " else {\n" + " allClassesLink.style.display = \"none\";\n" + " }\n" + " //-->\n"; Content scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL)); script.addContent(scriptContent); Content div = HtmlTree.DIV(script); Content div_noscript = HtmlTree.DIV(contents.noScriptMessage); Content noScript = HtmlTree.NOSCRIPT(div_noscript); div.addContent(noScript); return div; }
[ "public", "Content", "getAllClassesLinkScript", "(", "String", "id", ")", "{", "HtmlTree", "script", "=", "HtmlTree", ".", "SCRIPT", "(", ")", ";", "String", "scriptCode", "=", "\"<!--\\n\"", "+", "\" allClassesLink = document.getElementById(\\\"\"", "+", "id", "+"...
Get the script to show or hide the All classes link. @param id id of the element to show or hide @return a content tree for the script
[ "Get", "the", "script", "to", "show", "or", "hide", "the", "All", "classes", "link", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L258-L276
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java
ServiceOperations.deploy
public static void deploy(Service service, HiveConf configuration) { init(service, configuration); start(service); }
java
public static void deploy(Service service, HiveConf configuration) { init(service, configuration); start(service); }
[ "public", "static", "void", "deploy", "(", "Service", "service", ",", "HiveConf", "configuration", ")", "{", "init", "(", "service", ",", "configuration", ")", ";", "start", "(", "service", ")", ";", "}" ]
Initialize then start a service. The service state is checked <i>before</i> the operation begins. This process is <i>not</i> thread safe. @param service a service that must be in the state {@link Service.STATE#NOTINITED} @param configuration the configuration to initialize the service with @throws RuntimeException on a state change failure @throws IllegalStateException if the service is in the wrong state
[ "Initialize", "then", "start", "a", "service", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L98-L101
PuyallupFoursquare/ccb-api-client-java
src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java
GetIndividualProfilesRequest.withLoginPassword
public GetIndividualProfilesRequest withLoginPassword(final String login, final char[] password) { this.login = login; this.password = password; this.id = 0; this.accountNumber = this.routingNumber = null; return this; }
java
public GetIndividualProfilesRequest withLoginPassword(final String login, final char[] password) { this.login = login; this.password = password; this.id = 0; this.accountNumber = this.routingNumber = null; return this; }
[ "public", "GetIndividualProfilesRequest", "withLoginPassword", "(", "final", "String", "login", ",", "final", "char", "[", "]", "password", ")", "{", "this", ".", "login", "=", "login", ";", "this", ".", "password", "=", "password", ";", "this", ".", "id", ...
Request the IndividualProfile for the given login and password. This option is mutually exclusive with {@link #withIndividualId(int)} and {@link #withMICR(String, String)}. @param login The individual's login. @param password The individual's password. @return this.
[ "Request", "the", "IndividualProfile", "for", "the", "given", "login", "and", "password", "." ]
train
https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/model/GetIndividualProfilesRequest.java#L66-L72
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/view/facelets/TagHandler.java
TagHandler.getRequiredAttribute
protected final TagAttribute getRequiredAttribute(String localName) throws TagException { TagAttribute attr = this.getAttribute(localName); if (attr == null) { throw new TagException(this.tag, "Attribute '" + localName + "' is required"); } return attr; }
java
protected final TagAttribute getRequiredAttribute(String localName) throws TagException { TagAttribute attr = this.getAttribute(localName); if (attr == null) { throw new TagException(this.tag, "Attribute '" + localName + "' is required"); } return attr; }
[ "protected", "final", "TagAttribute", "getRequiredAttribute", "(", "String", "localName", ")", "throws", "TagException", "{", "TagAttribute", "attr", "=", "this", ".", "getAttribute", "(", "localName", ")", ";", "if", "(", "attr", "==", "null", ")", "{", "thro...
Utility method for fetching a required TagAttribute @param localName name of the attribute @return TagAttribute if found, otherwise error @throws TagException if the attribute was not found
[ "Utility", "method", "for", "fetching", "a", "required", "TagAttribute" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/view/facelets/TagHandler.java#L60-L69
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/qe/AbstractQuery.java
AbstractQuery.checkSliceArguments
protected boolean checkSliceArguments(long from, Long to) { if (from < 0) { throw new IllegalArgumentException("Slice from is negative: " + from); } if (to == null) { if (from == 0) { return false; } } else if (from > to) { throw new IllegalArgumentException ("Slice from is more than to: " + from + " > " + to); } return true; }
java
protected boolean checkSliceArguments(long from, Long to) { if (from < 0) { throw new IllegalArgumentException("Slice from is negative: " + from); } if (to == null) { if (from == 0) { return false; } } else if (from > to) { throw new IllegalArgumentException ("Slice from is more than to: " + from + " > " + to); } return true; }
[ "protected", "boolean", "checkSliceArguments", "(", "long", "from", ",", "Long", "to", ")", "{", "if", "(", "from", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Slice from is negative: \"", "+", "from", ")", ";", "}", "if", "(", ...
Called by sliced fetch to ensure that arguments are valid. @return false if from is 0 and to is null @throws IllegalArgumentException if arguments are invalid @since 1.2
[ "Called", "by", "sliced", "fetch", "to", "ensure", "that", "arguments", "are", "valid", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java#L195-L208
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java
ContainerKeyCache.getTailHashes
Map<UUID, CacheBucketOffset> getTailHashes(long segmentId) { return forSegmentCache(segmentId, SegmentKeyCache::getTailBucketOffsets, Collections.emptyMap()); }
java
Map<UUID, CacheBucketOffset> getTailHashes(long segmentId) { return forSegmentCache(segmentId, SegmentKeyCache::getTailBucketOffsets, Collections.emptyMap()); }
[ "Map", "<", "UUID", ",", "CacheBucketOffset", ">", "getTailHashes", "(", "long", "segmentId", ")", "{", "return", "forSegmentCache", "(", "segmentId", ",", "SegmentKeyCache", "::", "getTailBucketOffsets", ",", "Collections", ".", "emptyMap", "(", ")", ")", ";", ...
Gets the unindexed Key Hashes, mapped to their latest offsets. @param segmentId The Id of the Segment to get Hashes for. @return The result.
[ "Gets", "the", "unindexed", "Key", "Hashes", "mapped", "to", "their", "latest", "offsets", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L264-L266
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java
ExecutionGraph.vertexFinished
void vertexFinished() { assertRunningInJobMasterMainThread(); final int numFinished = verticesFinished.incrementAndGet(); if (numFinished == numVerticesTotal) { // done :-) // check whether we are still in "RUNNING" and trigger the final cleanup if (state == JobStatus.RUNNING) { // we do the final cleanup in the I/O executor, because it may involve // some heavier work try { for (ExecutionJobVertex ejv : verticesInCreationOrder) { ejv.getJobVertex().finalizeOnMaster(getUserClassLoader()); } } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); failGlobal(new Exception("Failed to finalize execution on master", t)); return; } // if we do not make this state transition, then a concurrent // cancellation or failure happened if (transitionState(JobStatus.RUNNING, JobStatus.FINISHED)) { onTerminalState(JobStatus.FINISHED); } } } }
java
void vertexFinished() { assertRunningInJobMasterMainThread(); final int numFinished = verticesFinished.incrementAndGet(); if (numFinished == numVerticesTotal) { // done :-) // check whether we are still in "RUNNING" and trigger the final cleanup if (state == JobStatus.RUNNING) { // we do the final cleanup in the I/O executor, because it may involve // some heavier work try { for (ExecutionJobVertex ejv : verticesInCreationOrder) { ejv.getJobVertex().finalizeOnMaster(getUserClassLoader()); } } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); failGlobal(new Exception("Failed to finalize execution on master", t)); return; } // if we do not make this state transition, then a concurrent // cancellation or failure happened if (transitionState(JobStatus.RUNNING, JobStatus.FINISHED)) { onTerminalState(JobStatus.FINISHED); } } } }
[ "void", "vertexFinished", "(", ")", "{", "assertRunningInJobMasterMainThread", "(", ")", ";", "final", "int", "numFinished", "=", "verticesFinished", ".", "incrementAndGet", "(", ")", ";", "if", "(", "numFinished", "==", "numVerticesTotal", ")", "{", "// done :-)"...
Called whenever a vertex reaches state FINISHED (completed successfully). Once all vertices are in the FINISHED state, the program is successfully done.
[ "Called", "whenever", "a", "vertex", "reaches", "state", "FINISHED", "(", "completed", "successfully", ")", ".", "Once", "all", "vertices", "are", "in", "the", "FINISHED", "state", "the", "program", "is", "successfully", "done", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1384-L1413
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/util/UrlUtilities.java
UrlUtilities.createSecureBuddyIconUrl
public static String createSecureBuddyIconUrl(int iconFarm, int iconServer, String id) { return createBuddyIconUrl("https", iconFarm, iconServer, id); }
java
public static String createSecureBuddyIconUrl(int iconFarm, int iconServer, String id) { return createBuddyIconUrl("https", iconFarm, iconServer, id); }
[ "public", "static", "String", "createSecureBuddyIconUrl", "(", "int", "iconFarm", ",", "int", "iconServer", ",", "String", "id", ")", "{", "return", "createBuddyIconUrl", "(", "\"https\"", ",", "iconFarm", ",", "iconServer", ",", "id", ")", ";", "}" ]
Construct the BuddyIconUrl with {@code https} scheme. <p> If none available, return the <a href="https://www.flickr.com/images/buddyicon.jpg">default</a>, or an URL assembled from farm, iconserver and nsid. @see <a href="http://flickr.com/services/api/misc.buddyicons.html">Flickr Documentation</a> @param iconFarm @param iconServer @param id @return The BuddyIconUrl
[ "Construct", "the", "BuddyIconUrl", "with", "{", "@code", "https", "}", "scheme", ".", "<p", ">", "If", "none", "available", "return", "the", "<a", "href", "=", "https", ":", "//", "www", ".", "flickr", ".", "com", "/", "images", "/", "buddyicon", ".",...
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/UrlUtilities.java#L198-L200
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java
HELM2NotationUtils.section4
private static void section4(List<AnnotationNotation> annotations, Map<String, String> mapIds) { for (AnnotationNotation annotation : annotations) { String notation = annotation.getAnnotation(); notation = changeIDs(notation, mapIds); helm2notation.addAnnotation(new AnnotationNotation(notation)); } }
java
private static void section4(List<AnnotationNotation> annotations, Map<String, String> mapIds) { for (AnnotationNotation annotation : annotations) { String notation = annotation.getAnnotation(); notation = changeIDs(notation, mapIds); helm2notation.addAnnotation(new AnnotationNotation(notation)); } }
[ "private", "static", "void", "section4", "(", "List", "<", "AnnotationNotation", ">", "annotations", ",", "Map", "<", "String", ",", "String", ">", "mapIds", ")", "{", "for", "(", "AnnotationNotation", "annotation", ":", "annotations", ")", "{", "String", "n...
method to add annotations to the existent annotation section @param annotations new AnnotationNotations @param mapIds Map of old and new Ids
[ "method", "to", "add", "annotations", "to", "the", "existent", "annotation", "section" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L326-L332
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.aggregateStamp
private static int aggregateStamp(int stamp_a, int stamp_b) { if (stamp_a == UNSET || stamp_b == UNSET) { return UNSET; } return (stamp_a > stamp_b) ? stamp_a : stamp_b; }
java
private static int aggregateStamp(int stamp_a, int stamp_b) { if (stamp_a == UNSET || stamp_b == UNSET) { return UNSET; } return (stamp_a > stamp_b) ? stamp_a : stamp_b; }
[ "private", "static", "int", "aggregateStamp", "(", "int", "stamp_a", ",", "int", "stamp_b", ")", "{", "if", "(", "stamp_a", "==", "UNSET", "||", "stamp_b", "==", "UNSET", ")", "{", "return", "UNSET", ";", "}", "return", "(", "stamp_a", ">", "stamp_b", ...
Returns the pseudo-time-stamp for two fields, given their individual pseudo-time-stamps. If either of the fields is unset, then the aggregate is unset. Otherwise, the aggregate is the later of the two stamps.
[ "Returns", "the", "pseudo", "-", "time", "-", "stamp", "for", "two", "fields", "given", "their", "individual", "pseudo", "-", "time", "-", "stamps", ".", "If", "either", "of", "the", "fields", "is", "unset", "then", "the", "aggregate", "is", "unset", "."...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L2525-L2530
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/jetty/servlet/jmx/ConfigurationMBean.java
ConfigurationMBean.uniqueObjectName
public synchronized ObjectName uniqueObjectName(MBeanServer server, String on) { ObjectName oName=null; try{oName=new ObjectName(on+",config="+_config.getClass().getName());} catch(Exception e){log.warn(LogSupport.EXCEPTION,e);} return oName; }
java
public synchronized ObjectName uniqueObjectName(MBeanServer server, String on) { ObjectName oName=null; try{oName=new ObjectName(on+",config="+_config.getClass().getName());} catch(Exception e){log.warn(LogSupport.EXCEPTION,e);} return oName; }
[ "public", "synchronized", "ObjectName", "uniqueObjectName", "(", "MBeanServer", "server", ",", "String", "on", ")", "{", "ObjectName", "oName", "=", "null", ";", "try", "{", "oName", "=", "new", "ObjectName", "(", "on", "+", "\",config=\"", "+", "_config", "...
uniqueObjectName Make a unique jmx name for this configuration object @see org.browsermob.proxy.jetty.util.jmx.ModelMBeanImpl#uniqueObjectName(javax.management.MBeanServer, java.lang.String)
[ "uniqueObjectName", "Make", "a", "unique", "jmx", "name", "for", "this", "configuration", "object" ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/jetty/servlet/jmx/ConfigurationMBean.java#L78-L85
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java
Invariants.checkInvariant
public static <T> T checkInvariant( final T value, final ContractConditionType<T> condition) throws InvariantViolationException { return checkInvariant(value, condition.predicate(), condition.describer()); }
java
public static <T> T checkInvariant( final T value, final ContractConditionType<T> condition) throws InvariantViolationException { return checkInvariant(value, condition.predicate(), condition.describer()); }
[ "public", "static", "<", "T", ">", "T", "checkInvariant", "(", "final", "T", "value", ",", "final", "ContractConditionType", "<", "T", ">", "condition", ")", "throws", "InvariantViolationException", "{", "return", "checkInvariant", "(", "value", ",", "condition"...
<p>Evaluate the given {@code predicate} using {@code value} as input.</p> <p>The function throws {@link InvariantViolationException} if the predicate is false.</p> @param value The value @param condition The predicate @param <T> The type of values @return value @throws InvariantViolationException If the predicate is false
[ "<p", ">", "Evaluate", "the", "given", "{", "@code", "predicate", "}", "using", "{", "@code", "value", "}", "as", "input", ".", "<", "/", "p", ">" ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L180-L186
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.addTranscript
public TranscriptSequence addTranscript(AccessionID accession, int begin, int end) throws Exception { if (transcriptSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } TranscriptSequence transcriptSequence = new TranscriptSequence(this, begin, end); transcriptSequence.setAccession(accession); transcriptSequenceHashMap.put(accession.getID(), transcriptSequence); return transcriptSequence; }
java
public TranscriptSequence addTranscript(AccessionID accession, int begin, int end) throws Exception { if (transcriptSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } TranscriptSequence transcriptSequence = new TranscriptSequence(this, begin, end); transcriptSequence.setAccession(accession); transcriptSequenceHashMap.put(accession.getID(), transcriptSequence); return transcriptSequence; }
[ "public", "TranscriptSequence", "addTranscript", "(", "AccessionID", "accession", ",", "int", "begin", ",", "int", "end", ")", "throws", "Exception", "{", "if", "(", "transcriptSequenceHashMap", ".", "containsKey", "(", "accession", ".", "getID", "(", ")", ")", ...
Add a transcription sequence to a gene which describes a ProteinSequence @param accession @param begin @param end @return transcript sequence @throws Exception If the accession id is already used
[ "Add", "a", "transcription", "sequence", "to", "a", "gene", "which", "describes", "a", "ProteinSequence" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L184-L192
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/JcaServiceUtilities.java
JcaServiceUtilities.endContextClassLoader
public void endContextClassLoader(ClassLoader raClassLoader, ClassLoader previousClassLoader) { if (raClassLoader != null) { AccessController.doPrivileged(new GetAndSetContextClassLoader(previousClassLoader)); } }
java
public void endContextClassLoader(ClassLoader raClassLoader, ClassLoader previousClassLoader) { if (raClassLoader != null) { AccessController.doPrivileged(new GetAndSetContextClassLoader(previousClassLoader)); } }
[ "public", "void", "endContextClassLoader", "(", "ClassLoader", "raClassLoader", ",", "ClassLoader", "previousClassLoader", ")", "{", "if", "(", "raClassLoader", "!=", "null", ")", "{", "AccessController", ".", "doPrivileged", "(", "new", "GetAndSetContextClassLoader", ...
Restore current context class loader saved when the context class loader was set to the one for the resource adapter. @param raClassLoader @param previousClassLoader
[ "Restore", "current", "context", "class", "loader", "saved", "when", "the", "context", "class", "loader", "was", "set", "to", "the", "one", "for", "the", "resource", "adapter", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ws/jca/cm/JcaServiceUtilities.java#L37-L41
rzwitserloot/lombok
src/delombok/lombok/delombok/FormatPreferenceScanner.java
FormatPreferenceScanner.tryEasy
private FormatPreferences tryEasy(FormatPreferences preferences, boolean force) { int count = 0; for (Map.Entry<String, String> e : preferences.rawMap.entrySet()) { if (!"scan".equalsIgnoreCase(e.getValue())) count++; } if (force || count >= FormatPreferences.KEYS.size()) return preferences; return null; }
java
private FormatPreferences tryEasy(FormatPreferences preferences, boolean force) { int count = 0; for (Map.Entry<String, String> e : preferences.rawMap.entrySet()) { if (!"scan".equalsIgnoreCase(e.getValue())) count++; } if (force || count >= FormatPreferences.KEYS.size()) return preferences; return null; }
[ "private", "FormatPreferences", "tryEasy", "(", "FormatPreferences", "preferences", ",", "boolean", "force", ")", "{", "int", "count", "=", "0", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "e", ":", "preferences", ".", "rawMap"...
Checks validity of preferences, and returns with a non-null value if ALL format keys are available, thus negating the need for a scan.
[ "Checks", "validity", "of", "preferences", "and", "returns", "with", "a", "non", "-", "null", "value", "if", "ALL", "format", "keys", "are", "available", "thus", "negating", "the", "need", "for", "a", "scan", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/delombok/lombok/delombok/FormatPreferenceScanner.java#L40-L47
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.bytesToInts
public static final void bytesToInts( int[] dst, int dst_offset, byte[] src, int src_offset, int length ) { if ((src == null) || (dst == null) || ((src_offset + length) > src.length) || ((dst_offset + length) > (dst.length * 4)) || ((dst_offset % 4) != 0) || ((length % 4) != 0)) { croak("bytesToInts parameters are invalid" + " src==" + Arrays.toString(src) + " dst==" + Arrays.toString(dst) + (((src == null) || (dst == null)) ? " " : (" (src_offset+length)>src.length==" + (src_offset + length) + ">" + src.length + " (dst_offset+length)>(dst.length*4)==" + (dst_offset + length) + ">" + (dst.length * 4) + " (dst_offset%4)==" + (dst_offset % 4) + " (length%4)==" + (length % 4) + " dest.length==" + dst.length + " length==" + length))); } // Convert parameters to normal format int[] offset = new int[1]; offset[0] = src_offset; int int_dst_offset = dst_offset / 4; for( int i = 0; i < (length / 4); ++i ) { dst[int_dst_offset++] = bytesToInt(src, offset); } }
java
public static final void bytesToInts( int[] dst, int dst_offset, byte[] src, int src_offset, int length ) { if ((src == null) || (dst == null) || ((src_offset + length) > src.length) || ((dst_offset + length) > (dst.length * 4)) || ((dst_offset % 4) != 0) || ((length % 4) != 0)) { croak("bytesToInts parameters are invalid" + " src==" + Arrays.toString(src) + " dst==" + Arrays.toString(dst) + (((src == null) || (dst == null)) ? " " : (" (src_offset+length)>src.length==" + (src_offset + length) + ">" + src.length + " (dst_offset+length)>(dst.length*4)==" + (dst_offset + length) + ">" + (dst.length * 4) + " (dst_offset%4)==" + (dst_offset % 4) + " (length%4)==" + (length % 4) + " dest.length==" + dst.length + " length==" + length))); } // Convert parameters to normal format int[] offset = new int[1]; offset[0] = src_offset; int int_dst_offset = dst_offset / 4; for( int i = 0; i < (length / 4); ++i ) { dst[int_dst_offset++] = bytesToInt(src, offset); } }
[ "public", "static", "final", "void", "bytesToInts", "(", "int", "[", "]", "dst", ",", "int", "dst_offset", ",", "byte", "[", "]", "src", ",", "int", "src_offset", ",", "int", "length", ")", "{", "if", "(", "(", "src", "==", "null", ")", "||", "(", ...
Convert an array of <code>bytes</code>s into an array of <code>ints</code>. @param dst the array to write @param dst_offset the start offset in <code>dst</code>, times 4. This measures the offset as if <code>dst</code> were an array of <code>byte</code>s (rather than <code>int</code>s). @param src the array to read @param src_offset the start offset in <code>src</code> @param length the number of <code>byte</code>s to copy.
[ "Convert", "an", "array", "of", "<code", ">", "bytes<", "/", "code", ">", "s", "into", "an", "array", "of", "<code", ">", "ints<", "/", "code", ">", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L398-L421
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/util/ManifestUtil.java
ManifestUtil.getResult
private static Object getResult(Document document, String node) throws XPathExpressionException { // create an XPath object XPath xpath = XPathFactory.newInstance().newXPath(); Object result; XPathExpression expr = null; expr = xpath.compile(node); result = expr.evaluate(document, XPathConstants.NODESET); return result; }
java
private static Object getResult(Document document, String node) throws XPathExpressionException { // create an XPath object XPath xpath = XPathFactory.newInstance().newXPath(); Object result; XPathExpression expr = null; expr = xpath.compile(node); result = expr.evaluate(document, XPathConstants.NODESET); return result; }
[ "private", "static", "Object", "getResult", "(", "Document", "document", ",", "String", "node", ")", "throws", "XPathExpressionException", "{", "// create an XPath object", "XPath", "xpath", "=", "XPathFactory", ".", "newInstance", "(", ")", ".", "newXPath", "(", ...
Get the node value. @param document the document. @param node the node. @return the node value. @throws XPathExpressionException if an exception happens.
[ "Get", "the", "node", "value", "." ]
train
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/ManifestUtil.java#L113-L121
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java
ClassPathResource.getInputStreamNoCache
@Nullable public InputStream getInputStreamNoCache (@Nonnull final ClassLoader aClassLoader) { final URL aURL = getAsURLNoCache (aClassLoader); return _getInputStream (m_sPath, aURL, aClassLoader); }
java
@Nullable public InputStream getInputStreamNoCache (@Nonnull final ClassLoader aClassLoader) { final URL aURL = getAsURLNoCache (aClassLoader); return _getInputStream (m_sPath, aURL, aClassLoader); }
[ "@", "Nullable", "public", "InputStream", "getInputStreamNoCache", "(", "@", "Nonnull", "final", "ClassLoader", "aClassLoader", ")", "{", "final", "URL", "aURL", "=", "getAsURLNoCache", "(", "aClassLoader", ")", ";", "return", "_getInputStream", "(", "m_sPath", ",...
Get the input stream to the this resource, using the passed class loader only. @param aClassLoader The class loader to be used. May not be <code>null</code>. @return <code>null</code> if the path could not be resolved.
[ "Get", "the", "input", "stream", "to", "the", "this", "resource", "using", "the", "passed", "class", "loader", "only", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java#L290-L295
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.getJSONColor
public static int getJSONColor(final JSONObject json, String elementName) throws JSONException { Object raw = json.get(elementName); return convertJSONColor(raw); }
java
public static int getJSONColor(final JSONObject json, String elementName) throws JSONException { Object raw = json.get(elementName); return convertJSONColor(raw); }
[ "public", "static", "int", "getJSONColor", "(", "final", "JSONObject", "json", ",", "String", "elementName", ")", "throws", "JSONException", "{", "Object", "raw", "=", "json", ".", "get", "(", "elementName", ")", ";", "return", "convertJSONColor", "(", "raw", ...
Gets a color formatted as an integer with ARGB ordering. @param json {@link JSONObject} to get the color from @param elementName Name of the color element @return An ARGB formatted integer @throws JSONException
[ "Gets", "a", "color", "formatted", "as", "an", "integer", "with", "ARGB", "ordering", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1664-L1667
transloadit/java-sdk
src/main/java/com/transloadit/sdk/Steps.java
Steps.addStep
public void addStep(String name, String robot, Map<String, Object> options) { all.put(name, new Step(name, robot, options)); }
java
public void addStep(String name, String robot, Map<String, Object> options) { all.put(name, new Step(name, robot, options)); }
[ "public", "void", "addStep", "(", "String", "name", ",", "String", "robot", ",", "Map", "<", "String", ",", "Object", ">", "options", ")", "{", "all", ".", "put", "(", "name", ",", "new", "Step", "(", "name", ",", "robot", ",", "options", ")", ")",...
Adds a new step to the list of steps. @param name Name of the step to add. @param robot The name of the robot ot use with the step. @param options extra options required for the step.
[ "Adds", "a", "new", "step", "to", "the", "list", "of", "steps", "." ]
train
https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Steps.java#L54-L56
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java
SessionsClient.detectIntent
public final DetectIntentResponse detectIntent(SessionName session, QueryInput queryInput) { DetectIntentRequest request = DetectIntentRequest.newBuilder() .setSession(session == null ? null : session.toString()) .setQueryInput(queryInput) .build(); return detectIntent(request); }
java
public final DetectIntentResponse detectIntent(SessionName session, QueryInput queryInput) { DetectIntentRequest request = DetectIntentRequest.newBuilder() .setSession(session == null ? null : session.toString()) .setQueryInput(queryInput) .build(); return detectIntent(request); }
[ "public", "final", "DetectIntentResponse", "detectIntent", "(", "SessionName", "session", ",", "QueryInput", "queryInput", ")", "{", "DetectIntentRequest", "request", "=", "DetectIntentRequest", ".", "newBuilder", "(", ")", ".", "setSession", "(", "session", "==", "...
Processes a natural language query and returns structured, actionable data as a result. This method is not idempotent, because it may cause contexts and session entity types to be updated, which in turn might affect results of future queries. <p>Sample code: <pre><code> try (SessionsClient sessionsClient = SessionsClient.create()) { SessionName session = SessionName.of("[PROJECT]", "[SESSION]"); QueryInput queryInput = QueryInput.newBuilder().build(); DetectIntentResponse response = sessionsClient.detectIntent(session, queryInput); } </code></pre> @param session Required. The name of the session this query is sent to. Format: `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`. It's up to the API caller to choose an appropriate session ID. It can be a random number or some type of user identifier (preferably hashed). The length of the session ID must not exceed 36 bytes. @param queryInput Required. The input specification. It can be set to: <p>1. an audio config which instructs the speech recognizer how to process the speech audio, <p>2. a conversational query in the form of text, or <p>3. an event that specifies which intent to trigger. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Processes", "a", "natural", "language", "query", "and", "returns", "structured", "actionable", "data", "as", "a", "result", ".", "This", "method", "is", "not", "idempotent", "because", "it", "may", "cause", "contexts", "and", "session", "entity", "types", "to...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/SessionsClient.java#L177-L185
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addDescription
protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) { Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))); if (configuration.showModules) { si.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(pkg))); } si.setLabel(utils.getPackageName(pkg)); si.setCategory(resources.getText("doclet.Packages")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.package_); dt.addContent(" " + utils.getPackageName(pkg)); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(pkg, dd); dlTree.addContent(dd); }
java
protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) { Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))); if (configuration.showModules) { si.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(pkg))); } si.setLabel(utils.getPackageName(pkg)); si.setCategory(resources.getText("doclet.Packages")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.package_); dt.addContent(" " + utils.getPackageName(pkg)); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(pkg, dd); dlTree.addContent(dd); }
[ "protected", "void", "addDescription", "(", "PackageElement", "pkg", ",", "Content", "dlTree", ",", "SearchIndexItem", "si", ")", "{", "Content", "link", "=", "getPackageLink", "(", "pkg", ",", "new", "StringContent", "(", "utils", ".", "getPackageName", "(", ...
Add one line summary comment for the package. @param pkg the package to be documented @param dlTree the content tree to which the description will be added @param si the search index item to be updated
[ "Add", "one", "line", "summary", "comment", "for", "the", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L248-L263
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfStamper.java
PdfStamper.addFileAttachment
public void addFileAttachment(String description, PdfFileSpecification fs) throws IOException { stamper.addFileAttachment(description, fs); }
java
public void addFileAttachment(String description, PdfFileSpecification fs) throws IOException { stamper.addFileAttachment(description, fs); }
[ "public", "void", "addFileAttachment", "(", "String", "description", ",", "PdfFileSpecification", "fs", ")", "throws", "IOException", "{", "stamper", ".", "addFileAttachment", "(", "description", ",", "fs", ")", ";", "}" ]
Adds a file attachment at the document level. Existing attachments will be kept. @param description the file description @param fs the file specification
[ "Adds", "a", "file", "attachment", "at", "the", "document", "level", ".", "Existing", "attachments", "will", "be", "kept", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L511-L513
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java
HTTPBatchClientConnectionInterceptor.extractMethod
private HttpRequestBase extractMethod(RequestElements intuitRequest, URI uri) throws FMSException { String method = intuitRequest.getRequestParameters().get(RequestElements.REQ_PARAM_METHOD_TYPE); if (method.equals(MethodType.GET.toString())) { return new HttpGet(uri); } else if (method.equals(MethodType.POST.toString())) { return new HttpPost(uri); } throw new FMSException("Unexpected HTTP method"); }
java
private HttpRequestBase extractMethod(RequestElements intuitRequest, URI uri) throws FMSException { String method = intuitRequest.getRequestParameters().get(RequestElements.REQ_PARAM_METHOD_TYPE); if (method.equals(MethodType.GET.toString())) { return new HttpGet(uri); } else if (method.equals(MethodType.POST.toString())) { return new HttpPost(uri); } throw new FMSException("Unexpected HTTP method"); }
[ "private", "HttpRequestBase", "extractMethod", "(", "RequestElements", "intuitRequest", ",", "URI", "uri", ")", "throws", "FMSException", "{", "String", "method", "=", "intuitRequest", ".", "getRequestParameters", "(", ")", ".", "get", "(", "RequestElements", ".", ...
Returns instance of HttpGet or HttpPost type, depends from request parameters @param intuitRequest @param uri @return HttpRequestBase @throws FMSException
[ "Returns", "instance", "of", "HttpGet", "or", "HttpPost", "type", "depends", "from", "request", "parameters" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java#L272-L281
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.addActionError
public static void addActionError( ServletRequest request, String propertyName, String messageKey, Object[] messageArgs ) { InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, messageArgs ), request ); }
java
public static void addActionError( ServletRequest request, String propertyName, String messageKey, Object[] messageArgs ) { InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, messageArgs ), request ); }
[ "public", "static", "void", "addActionError", "(", "ServletRequest", "request", ",", "String", "propertyName", ",", "String", "messageKey", ",", "Object", "[", "]", "messageArgs", ")", "{", "InternalUtils", ".", "addActionError", "(", "propertyName", ",", "new", ...
Add a property-related message that will be shown with the Errors and Error tags. @param request the current ServletRequest. @param propertyName the name of the property with which to associate this error. @param messageKey the message-resources key for the message. @param messageArgs zero or more arguments to the message.
[ "Add", "a", "property", "-", "related", "message", "that", "will", "be", "shown", "with", "the", "Errors", "and", "Error", "tags", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1027-L1031
looly/hutool
hutool-setting/src/main/java/cn/hutool/setting/GroupedSet.java
GroupedSet.contains
public boolean contains(String group, String value, String... otherValues) { if (ArrayUtil.isNotEmpty(otherValues)) { // 需要测试多个值的情况 final List<String> valueList = Arrays.asList(otherValues); valueList.add(value); return contains(group, valueList); } else { // 测试单个值 final LinkedHashSet<String> valueSet = getValues(group); if (CollectionUtil.isEmpty(valueSet)) { return false; } return valueSet.contains(value); } }
java
public boolean contains(String group, String value, String... otherValues) { if (ArrayUtil.isNotEmpty(otherValues)) { // 需要测试多个值的情况 final List<String> valueList = Arrays.asList(otherValues); valueList.add(value); return contains(group, valueList); } else { // 测试单个值 final LinkedHashSet<String> valueSet = getValues(group); if (CollectionUtil.isEmpty(valueSet)) { return false; } return valueSet.contains(value); } }
[ "public", "boolean", "contains", "(", "String", "group", ",", "String", "value", ",", "String", "...", "otherValues", ")", "{", "if", "(", "ArrayUtil", ".", "isNotEmpty", "(", "otherValues", ")", ")", "{", "// 需要测试多个值的情况\r", "final", "List", "<", "String", ...
是否在给定分组的集合中包含指定值<br> 如果给定分组对应集合不存在,则返回false @param group 分组名 @param value 测试的值 @param otherValues 其他值 @return 是否包含
[ "是否在给定分组的集合中包含指定值<br", ">", "如果给定分组对应集合不存在,则返回false" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedSet.java#L282-L297
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRepeated.java
JSRepeated.setBounds
public void setBounds(int minOccurs, int maxOccurs) { if (minOccurs < 0 || maxOccurs < -1) throw new IllegalArgumentException("Bounds cannot be negative"); else if (maxOccurs > 0 && minOccurs > maxOccurs) throw new IllegalArgumentException("Minimum bounds less than maximum bounds"); limits = new int[] { minOccurs, maxOccurs }; }
java
public void setBounds(int minOccurs, int maxOccurs) { if (minOccurs < 0 || maxOccurs < -1) throw new IllegalArgumentException("Bounds cannot be negative"); else if (maxOccurs > 0 && minOccurs > maxOccurs) throw new IllegalArgumentException("Minimum bounds less than maximum bounds"); limits = new int[] { minOccurs, maxOccurs }; }
[ "public", "void", "setBounds", "(", "int", "minOccurs", ",", "int", "maxOccurs", ")", "{", "if", "(", "minOccurs", "<", "0", "||", "maxOccurs", "<", "-", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Bounds cannot be negative\"", ")", ";", "e...
Set the bounds (default is {0, unbounded}). Use maxOccurs=-1 to indicate "unbounded."
[ "Set", "the", "bounds", "(", "default", "is", "{", "0", "unbounded", "}", ")", ".", "Use", "maxOccurs", "=", "-", "1", "to", "indicate", "unbounded", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSRepeated.java#L71-L77
box/box-java-sdk
src/main/java/com/box/sdk/BoxInvite.java
BoxInvite.inviteUserToEnterprise
public static Info inviteUserToEnterprise(BoxAPIConnection api, String userLogin, String enterpriseID) { URL url = INVITE_CREATION_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject body = new JsonObject(); JsonObject enterprise = new JsonObject(); enterprise.add("id", enterpriseID); body.add("enterprise", enterprise); JsonObject actionableBy = new JsonObject(); actionableBy.add("login", userLogin); body.add("actionable_by", actionableBy); request.setBody(body); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxInvite invite = new BoxInvite(api, responseJSON.get("id").asString()); return invite.new Info(responseJSON); }
java
public static Info inviteUserToEnterprise(BoxAPIConnection api, String userLogin, String enterpriseID) { URL url = INVITE_CREATION_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject body = new JsonObject(); JsonObject enterprise = new JsonObject(); enterprise.add("id", enterpriseID); body.add("enterprise", enterprise); JsonObject actionableBy = new JsonObject(); actionableBy.add("login", userLogin); body.add("actionable_by", actionableBy); request.setBody(body); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxInvite invite = new BoxInvite(api, responseJSON.get("id").asString()); return invite.new Info(responseJSON); }
[ "public", "static", "Info", "inviteUserToEnterprise", "(", "BoxAPIConnection", "api", ",", "String", "userLogin", ",", "String", "enterpriseID", ")", "{", "URL", "url", "=", "INVITE_CREATION_URL_TEMPLATE", ".", "build", "(", "api", ".", "getBaseURL", "(", ")", "...
Invite a user to an enterprise. @param api the API connection to use for the request. @param userLogin the login of the user to invite. @param enterpriseID the ID of the enterprise to invite the user to. @return the invite info.
[ "Invite", "a", "user", "to", "an", "enterprise", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxInvite.java#L61-L82
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/injection/WebServiceRefBindingBuilder.java
WebServiceRefBindingBuilder.createWebServiceRefBindingFromResource
static InjectionBinding<WebServiceRef> createWebServiceRefBindingFromResource(Resource resource, ComponentNameSpaceConfiguration cnsConfig, Class<?> serviceClass, String jndiName) throws InjectionException { InjectionBinding<WebServiceRef> binding = null; WebServiceRef wsRef = createWebServiceRefFromResource(resource, serviceClass, jndiName); WebServiceRefInfo wsrInfo = WebServiceRefInfoBuilder.buildWebServiceRefInfo(wsRef, cnsConfig.getClassLoader()); wsrInfo.setClientMetaData(JaxWsMetaDataManager.getJaxWsClientMetaData(cnsConfig.getModuleMetaData())); wsrInfo.setServiceInterfaceClassName(serviceClass.getName()); binding = new WebServiceRefBinding(wsRef, cnsConfig); // register the metadata, and set a flag on the binding instance that let's us // know this binding represents metadata from an @Resource annotation ((WebServiceRefBinding) binding).setWebServiceRefInfo(wsrInfo); ((WebServiceRefBinding) binding).setResourceType(true); return binding; }
java
static InjectionBinding<WebServiceRef> createWebServiceRefBindingFromResource(Resource resource, ComponentNameSpaceConfiguration cnsConfig, Class<?> serviceClass, String jndiName) throws InjectionException { InjectionBinding<WebServiceRef> binding = null; WebServiceRef wsRef = createWebServiceRefFromResource(resource, serviceClass, jndiName); WebServiceRefInfo wsrInfo = WebServiceRefInfoBuilder.buildWebServiceRefInfo(wsRef, cnsConfig.getClassLoader()); wsrInfo.setClientMetaData(JaxWsMetaDataManager.getJaxWsClientMetaData(cnsConfig.getModuleMetaData())); wsrInfo.setServiceInterfaceClassName(serviceClass.getName()); binding = new WebServiceRefBinding(wsRef, cnsConfig); // register the metadata, and set a flag on the binding instance that let's us // know this binding represents metadata from an @Resource annotation ((WebServiceRefBinding) binding).setWebServiceRefInfo(wsrInfo); ((WebServiceRefBinding) binding).setResourceType(true); return binding; }
[ "static", "InjectionBinding", "<", "WebServiceRef", ">", "createWebServiceRefBindingFromResource", "(", "Resource", "resource", ",", "ComponentNameSpaceConfiguration", "cnsConfig", ",", "Class", "<", "?", ">", "serviceClass", ",", "String", "jndiName", ")", "throws", "I...
This method will be used to create an instance of a WebServiceRefBinding object that holds metadata obtained from an @Resource annotation. The @Resource annotation in this case would have been indicating a JAX-WS service type injection.
[ "This", "method", "will", "be", "used", "to", "create", "an", "instance", "of", "a", "WebServiceRefBinding", "object", "that", "holds", "metadata", "obtained", "from", "an" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/injection/WebServiceRefBindingBuilder.java#L167-L183
rzwitserloot/lombok
src/core/lombok/eclipse/handlers/HandleSetter.java
HandleSetter.generateSetterForField
public void generateSetterForField(EclipseNode fieldNode, EclipseNode sourceNode, AccessLevel level, List<Annotation> onMethod, List<Annotation> onParam) { if (hasAnnotation(Setter.class, fieldNode)) { //The annotation will make it happen, so we can skip it. return; } createSetterForField(level, fieldNode, sourceNode, false, onMethod, onParam); }
java
public void generateSetterForField(EclipseNode fieldNode, EclipseNode sourceNode, AccessLevel level, List<Annotation> onMethod, List<Annotation> onParam) { if (hasAnnotation(Setter.class, fieldNode)) { //The annotation will make it happen, so we can skip it. return; } createSetterForField(level, fieldNode, sourceNode, false, onMethod, onParam); }
[ "public", "void", "generateSetterForField", "(", "EclipseNode", "fieldNode", ",", "EclipseNode", "sourceNode", ",", "AccessLevel", "level", ",", "List", "<", "Annotation", ">", "onMethod", ",", "List", "<", "Annotation", ">", "onParam", ")", "{", "if", "(", "h...
Generates a setter on the stated field. Used by {@link HandleData}. The difference between this call and the handle method is as follows: If there is a {@code lombok.Setter} annotation on the field, it is used and the same rules apply (e.g. warning if the method already exists, stated access level applies). If not, the setter is still generated if it isn't already there, though there will not be a warning if its already there. The default access level is used.
[ "Generates", "a", "setter", "on", "the", "stated", "field", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/handlers/HandleSetter.java#L111-L117
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/decomposition/qr/QrUpdate_DDRM.java
QrUpdate_DDRM.deleteRow
public void deleteRow(DMatrixRMaj Q , DMatrixRMaj R , int rowIndex , boolean resizeR ) { setQR(Q,R,0); if( m - 1 < n ) { throw new IllegalArgumentException("Removing any row would make the system under determined."); } m_m = m - 1; U_tran.reshape(m,m, false); if( resizeR ) R.reshape(m_m,n, false); computeRemoveGivens(rowIndex); updateRemoveQ(rowIndex); updateRemoveR(); // discard the reference since it is no longer needed this.Q = this.R = null; }
java
public void deleteRow(DMatrixRMaj Q , DMatrixRMaj R , int rowIndex , boolean resizeR ) { setQR(Q,R,0); if( m - 1 < n ) { throw new IllegalArgumentException("Removing any row would make the system under determined."); } m_m = m - 1; U_tran.reshape(m,m, false); if( resizeR ) R.reshape(m_m,n, false); computeRemoveGivens(rowIndex); updateRemoveQ(rowIndex); updateRemoveR(); // discard the reference since it is no longer needed this.Q = this.R = null; }
[ "public", "void", "deleteRow", "(", "DMatrixRMaj", "Q", ",", "DMatrixRMaj", "R", ",", "int", "rowIndex", ",", "boolean", "resizeR", ")", "{", "setQR", "(", "Q", ",", "R", ",", "0", ")", ";", "if", "(", "m", "-", "1", "<", "n", ")", "{", "throw", ...
<p> Adjusts the values of the Q and R matrices to take in account the effects of removing a row from the 'A' matrix at the specified location. This operation requires about 6mn + O(n) flops. </p> <p> The adjustment is done by computing a series of planar Givens rotations that make the removed row in Q equal to [1 0 ... 0]. </p> @param Q The Q matrix. Is modified. @param R The R matrix. Is modified. @param rowIndex Which index of the row that is being removed. @param resizeR should the shape of R be adjusted?
[ "<p", ">", "Adjusts", "the", "values", "of", "the", "Q", "and", "R", "matrices", "to", "take", "in", "account", "the", "effects", "of", "removing", "a", "row", "from", "the", "A", "matrix", "at", "the", "specified", "location", ".", "This", "operation", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/qr/QrUpdate_DDRM.java#L187-L206
ical4j/ical4j
src/main/java/net/fortuna/ical4j/model/Dur.java
Dur.negate
public final Dur negate() { final Dur negated = new Dur(days, hours, minutes, seconds); negated.weeks = weeks; negated.negative = !negative; return negated; }
java
public final Dur negate() { final Dur negated = new Dur(days, hours, minutes, seconds); negated.weeks = weeks; negated.negative = !negative; return negated; }
[ "public", "final", "Dur", "negate", "(", ")", "{", "final", "Dur", "negated", "=", "new", "Dur", "(", "days", ",", "hours", ",", "minutes", ",", "seconds", ")", ";", "negated", ".", "weeks", "=", "weeks", ";", "negated", ".", "negative", "=", "!", ...
Provides a negation of this instance. @return a Dur instance that represents a negation of this instance
[ "Provides", "a", "negation", "of", "this", "instance", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/Dur.java#L309-L314
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/predicate/FullText.java
FullText.fullTextMatch
public static P<String> fullTextMatch(String configuration, boolean plain, final List<String> columns, final String value){ StringBuilder query=new StringBuilder(); int count=1; for (String column : columns) { query.append("\""+column+"\""); if (count++ < columns.size()) { query.append(" || ' ' || "); } } return new P<>(new FullText(configuration,query.toString(),plain),value); }
java
public static P<String> fullTextMatch(String configuration, boolean plain, final List<String> columns, final String value){ StringBuilder query=new StringBuilder(); int count=1; for (String column : columns) { query.append("\""+column+"\""); if (count++ < columns.size()) { query.append(" || ' ' || "); } } return new P<>(new FullText(configuration,query.toString(),plain),value); }
[ "public", "static", "P", "<", "String", ">", "fullTextMatch", "(", "String", "configuration", ",", "boolean", "plain", ",", "final", "List", "<", "String", ">", "columns", ",", "final", "String", "value", ")", "{", "StringBuilder", "query", "=", "new", "St...
Build full text matching predicate (use in where(...)) Uses several columns for text search. This assumes PostgreSQL and concatenates column names with a space in between just like we would by default build the index @param configuration the full text configuration to use @param plain should we use plain mode? @param columns the columns to query @param value the value to search for @return the predicate
[ "Build", "full", "text", "matching", "predicate", "(", "use", "in", "where", "(", "...", "))", "Uses", "several", "columns", "for", "text", "search", ".", "This", "assumes", "PostgreSQL", "and", "concatenates", "column", "names", "with", "a", "space", "in", ...
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/predicate/FullText.java#L79-L89
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSectionRenderer.java
WSectionRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WSection section = (WSection) component; XmlStringBuilder xml = renderContext.getWriter(); boolean renderChildren = isRenderContent(section); xml.appendTagOpen("ui:section"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (SectionMode.LAZY.equals(section.getMode())) { xml.appendOptionalAttribute("hidden", !renderChildren, "true"); } else { xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); } SectionMode mode = section.getMode(); if (mode != null) { switch (mode) { case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; default: throw new SystemException("Unknown section mode: " + section.getMode()); } } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(section, renderContext); if (renderChildren) { // Label section.getDecoratedLabel().paint(renderContext); // Content section.getContent().paint(renderContext); } xml.appendEndTag("ui:section"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WSection section = (WSection) component; XmlStringBuilder xml = renderContext.getWriter(); boolean renderChildren = isRenderContent(section); xml.appendTagOpen("ui:section"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (SectionMode.LAZY.equals(section.getMode())) { xml.appendOptionalAttribute("hidden", !renderChildren, "true"); } else { xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); } SectionMode mode = section.getMode(); if (mode != null) { switch (mode) { case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; default: throw new SystemException("Unknown section mode: " + section.getMode()); } } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(section, renderContext); if (renderChildren) { // Label section.getDecoratedLabel().paint(renderContext); // Content section.getContent().paint(renderContext); } xml.appendEndTag("ui:section"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WSection", "section", "=", "(", "WSection", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderConte...
Paints the given WSection. @param component the WSection to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WSection", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSectionRenderer.java#L25-L69
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java
WSJdbcResultSet.updateRef
public void updateRef(int columnIndex, java.sql.Ref r) throws SQLException { try { rsetImpl.updateRef(columnIndex, r); } catch (SQLException ex) { FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateRef", "4152", this); throw WSJdbcUtil.mapException(this, ex); } catch (NullPointerException nullX) { // No FFDC code needed; we might be closed. throw runtimeXIfNotClosed(nullX); } }
java
public void updateRef(int columnIndex, java.sql.Ref r) throws SQLException { try { rsetImpl.updateRef(columnIndex, r); } catch (SQLException ex) { FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateRef", "4152", this); throw WSJdbcUtil.mapException(this, ex); } catch (NullPointerException nullX) { // No FFDC code needed; we might be closed. throw runtimeXIfNotClosed(nullX); } }
[ "public", "void", "updateRef", "(", "int", "columnIndex", ",", "java", ".", "sql", ".", "Ref", "r", ")", "throws", "SQLException", "{", "try", "{", "rsetImpl", ".", "updateRef", "(", "columnIndex", ",", "r", ")", ";", "}", "catch", "(", "SQLException", ...
<p>Updates the designated column with a java.sql.Ref value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the updateRow or insertRow methods are called to update the database. </p> @param columnIndex the first column is 1, the second is 2, ... @param r the new column value @excpetion SQLException If a database access error occurs
[ "<p", ">", "Updates", "the", "designated", "column", "with", "a", "java", ".", "sql", ".", "Ref", "value", ".", "The", "updater", "methods", "are", "used", "to", "update", "column", "values", "in", "the", "current", "row", "or", "the", "insert", "row", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L4709-L4719
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.add
public static void add(ZMatrixD1 a , ZMatrixD1 b , ZMatrixD1 c ) { if( a.numCols != b.numCols || a.numRows != b.numRows || a.numCols != c.numCols || a.numRows != c.numRows ) { throw new IllegalArgumentException("The matrices are not all the same dimension."); } final int length = a.getDataLength(); for( int i = 0; i < length; i++ ) { c.data[i] = a.data[i]+b.data[i]; } }
java
public static void add(ZMatrixD1 a , ZMatrixD1 b , ZMatrixD1 c ) { if( a.numCols != b.numCols || a.numRows != b.numRows || a.numCols != c.numCols || a.numRows != c.numRows ) { throw new IllegalArgumentException("The matrices are not all the same dimension."); } final int length = a.getDataLength(); for( int i = 0; i < length; i++ ) { c.data[i] = a.data[i]+b.data[i]; } }
[ "public", "static", "void", "add", "(", "ZMatrixD1", "a", ",", "ZMatrixD1", "b", ",", "ZMatrixD1", "c", ")", "{", "if", "(", "a", ".", "numCols", "!=", "b", ".", "numCols", "||", "a", ".", "numRows", "!=", "b", ".", "numRows", "||", "a", ".", "nu...
<p>Performs the following operation:<br> <br> c = a + b <br> c<sub>ij</sub> = a<sub>ij</sub> + b<sub>ij</sub> <br> </p> <p> Matrix C can be the same instance as Matrix A and/or B. </p> @param a A Matrix. Not modified. @param b A Matrix. Not modified. @param c A Matrix where the results are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a", "+", "b", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "a<sub", ">", "ij<", "/", "sub", ">", "+", "b<sub", ">", "ij<", "/", "sub", "...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L285-L297
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
SBGNLayoutManager.createVNodes
private void createVNodes(VCompound parent,List<Glyph> glyphs) { for(Glyph glyph: glyphs ) { if (!glyphClazzOneOf(glyph, GlyphClazz.UNIT_OF_INFORMATION, GlyphClazz.STATE_VARIABLE)) { // if(glyph.getClazz().equals(GlyphClazz.PROCESS.getClazz())) // { // VCompound v = new VCompound(glyph); //TODO: v is never used; wat's the idea? // } if(!isChildless(glyph)) { VCompound v = new VCompound(glyph); idToGLyph.put(glyph.getId(), glyph); glyphToVNode.put(glyph, v); parent.children.add(v); createVNodes(v, glyph.getGlyph()); } else { VNode v = new VNode(glyph); idToGLyph.put(glyph.getId(), glyph); glyphToVNode.put(glyph, v); parent.children.add(v); } } } }
java
private void createVNodes(VCompound parent,List<Glyph> glyphs) { for(Glyph glyph: glyphs ) { if (!glyphClazzOneOf(glyph, GlyphClazz.UNIT_OF_INFORMATION, GlyphClazz.STATE_VARIABLE)) { // if(glyph.getClazz().equals(GlyphClazz.PROCESS.getClazz())) // { // VCompound v = new VCompound(glyph); //TODO: v is never used; wat's the idea? // } if(!isChildless(glyph)) { VCompound v = new VCompound(glyph); idToGLyph.put(glyph.getId(), glyph); glyphToVNode.put(glyph, v); parent.children.add(v); createVNodes(v, glyph.getGlyph()); } else { VNode v = new VNode(glyph); idToGLyph.put(glyph.getId(), glyph); glyphToVNode.put(glyph, v); parent.children.add(v); } } } }
[ "private", "void", "createVNodes", "(", "VCompound", "parent", ",", "List", "<", "Glyph", ">", "glyphs", ")", "{", "for", "(", "Glyph", "glyph", ":", "glyphs", ")", "{", "if", "(", "!", "glyphClazzOneOf", "(", "glyph", ",", "GlyphClazz", ".", "UNIT_OF_IN...
Recursively creates VNodes from Glyphs of Sbgn. @param parent Parent of the glyphs that are passed as second arguement. @param glyphs Glyphs that are child of parent which is passed as first arguement.
[ "Recursively", "creates", "VNodes", "from", "Glyphs", "of", "Sbgn", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L390-L418
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.notNull
public static Validator<Object> notNull(@NonNull final Context context, @StringRes final int resourceId) { return new NotNullValidator(context, resourceId); }
java
public static Validator<Object> notNull(@NonNull final Context context, @StringRes final int resourceId) { return new NotNullValidator(context, resourceId); }
[ "public", "static", "Validator", "<", "Object", ">", "notNull", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "return", "new", "NotNullValidator", "(", "context", ",", "resourceId", ")", ";...
Creates and returns a validator, which allows to ensure, that values are not null. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "ensure", "that", "values", "are", "not", "null", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L273-L276
jdereg/java-util
src/main/java/com/cedarsoftware/util/UrlUtilities.java
UrlUtilities.getContentFromUrl
public static byte[] getContentFromUrl(URL url, Map inCookies, Map outCookies, boolean allowAllCerts) { URLConnection c = null; try { c = getConnection(url, inCookies, true, false, false, allowAllCerts); ByteArrayOutputStream out = new ByteArrayOutputStream(16384); InputStream stream = IOUtilities.getInputStream(c); IOUtilities.transfer(stream, out); stream.close(); if (outCookies != null) { // [optional] Fetch cookies from server and update outCookie Map (pick up JSESSIONID, other headers) getCookies(c, outCookies); } return out.toByteArray(); } catch (SSLHandshakeException e) { // Don't read error response. it will just cause another exception. LOG.warn("SSL Exception occurred fetching content from url: " + url, e); return null; } catch (Exception e) { readErrorResponse(c); LOG.warn("Exception occurred fetching content from url: " + url, e); return null; } finally { if (c instanceof HttpURLConnection) { disconnect((HttpURLConnection)c); } } }
java
public static byte[] getContentFromUrl(URL url, Map inCookies, Map outCookies, boolean allowAllCerts) { URLConnection c = null; try { c = getConnection(url, inCookies, true, false, false, allowAllCerts); ByteArrayOutputStream out = new ByteArrayOutputStream(16384); InputStream stream = IOUtilities.getInputStream(c); IOUtilities.transfer(stream, out); stream.close(); if (outCookies != null) { // [optional] Fetch cookies from server and update outCookie Map (pick up JSESSIONID, other headers) getCookies(c, outCookies); } return out.toByteArray(); } catch (SSLHandshakeException e) { // Don't read error response. it will just cause another exception. LOG.warn("SSL Exception occurred fetching content from url: " + url, e); return null; } catch (Exception e) { readErrorResponse(c); LOG.warn("Exception occurred fetching content from url: " + url, e); return null; } finally { if (c instanceof HttpURLConnection) { disconnect((HttpURLConnection)c); } } }
[ "public", "static", "byte", "[", "]", "getContentFromUrl", "(", "URL", "url", ",", "Map", "inCookies", ",", "Map", "outCookies", ",", "boolean", "allowAllCerts", ")", "{", "URLConnection", "c", "=", "null", ";", "try", "{", "c", "=", "getConnection", "(", ...
Get content from the passed in URL. This code will open a connection to the passed in server, fetch the requested content, and return it as a byte[]. @param url URL to hit @param inCookies Map of session cookies (or null if not needed) @param outCookies Map of session cookies (or null if not needed) @param allowAllCerts override certificate validation? @return byte[] of content fetched from URL.
[ "Get", "content", "from", "the", "passed", "in", "URL", ".", "This", "code", "will", "open", "a", "connection", "to", "the", "passed", "in", "server", "fetch", "the", "requested", "content", "and", "return", "it", "as", "a", "byte", "[]", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/UrlUtilities.java#L521-L558
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/JwtFatActions.java
JwtFatActions.logInAndObtainJwtCookie
public Cookie logInAndObtainJwtCookie(String testName, WebClient webClient, String protectedUrl, String username, String password) throws Exception { return logInAndObtainJwtCookie(testName, webClient, protectedUrl, username, password, JwtFatConstants.DEFAULT_ISS_REGEX); }
java
public Cookie logInAndObtainJwtCookie(String testName, WebClient webClient, String protectedUrl, String username, String password) throws Exception { return logInAndObtainJwtCookie(testName, webClient, protectedUrl, username, password, JwtFatConstants.DEFAULT_ISS_REGEX); }
[ "public", "Cookie", "logInAndObtainJwtCookie", "(", "String", "testName", ",", "WebClient", "webClient", ",", "String", "protectedUrl", ",", "String", "username", ",", "String", "password", ")", "throws", "Exception", "{", "return", "logInAndObtainJwtCookie", "(", "...
Accesses the protected resource and logs in successfully, ensuring that a JWT SSO cookie is included in the result.
[ "Accesses", "the", "protected", "resource", "and", "logs", "in", "successfully", "ensuring", "that", "a", "JWT", "SSO", "cookie", "is", "included", "in", "the", "result", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/JwtFatActions.java#L36-L38
xcesco/kripton
kripton/src/main/java/com/abubusoft/kripton/AbstractContext.java
AbstractContext.getMapper
@SuppressWarnings("unchecked") static <E, M extends BinderMapper<E>> M getMapper(Class<E> cls) { M mapper = (M) OBJECT_MAPPERS.get(cls); if (mapper == null) { // The only way the mapper wouldn't already be loaded into // OBJECT_MAPPERS is if it was compiled separately, but let's handle // it anyway String beanClassName = cls.getName(); String mapperClassName = cls.getName() + KriptonBinder.MAPPER_CLASS_SUFFIX; try { Class<E> mapperClass = (Class<E>) Class.forName(mapperClassName); mapper = (M) mapperClass.newInstance(); // mapper. OBJECT_MAPPERS.put(cls, mapper); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new KriptonRuntimeException(String.format("Class '%s' does not exist. Does '%s' have @BindType annotation?", mapperClassName, beanClassName)); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } return mapper; }
java
@SuppressWarnings("unchecked") static <E, M extends BinderMapper<E>> M getMapper(Class<E> cls) { M mapper = (M) OBJECT_MAPPERS.get(cls); if (mapper == null) { // The only way the mapper wouldn't already be loaded into // OBJECT_MAPPERS is if it was compiled separately, but let's handle // it anyway String beanClassName = cls.getName(); String mapperClassName = cls.getName() + KriptonBinder.MAPPER_CLASS_SUFFIX; try { Class<E> mapperClass = (Class<E>) Class.forName(mapperClassName); mapper = (M) mapperClass.newInstance(); // mapper. OBJECT_MAPPERS.put(cls, mapper); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new KriptonRuntimeException(String.format("Class '%s' does not exist. Does '%s' have @BindType annotation?", mapperClassName, beanClassName)); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } return mapper; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "<", "E", ",", "M", "extends", "BinderMapper", "<", "E", ">", ">", "M", "getMapper", "(", "Class", "<", "E", ">", "cls", ")", "{", "M", "mapper", "=", "(", "M", ")", "OBJECT_MAPPERS", ".",...
Gets the mapper. @param <E> the element type @param <M> the generic type @param cls the cls @return the mapper
[ "Gets", "the", "mapper", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/AbstractContext.java#L96-L120
wisdom-framework/wisdom-jdbc
wisdom-jdbc-drivers/abstract-jdbc-driver/src/main/java/org/wisdom/jdbc/driver/helpers/BeanUtils.java
BeanUtils.setProperty
public static void setProperty(Object object, String name, String value) throws SQLException { Class<?> type = object.getClass(); PropertyDescriptor[] descriptors; try { descriptors = Introspector.getBeanInfo(type) .getPropertyDescriptors(); } catch (Exception ex) { throw new SQLException(ex); } List<String> names = new ArrayList<>(); for (PropertyDescriptor descriptor : descriptors) { if (descriptor.getWriteMethod() == null) { continue; } if (descriptor.getName().equals(name)) { Method method = descriptor.getWriteMethod(); Class<?> paramType = method.getParameterTypes()[0]; Object param = toBasicType(value, paramType.getName()); try { method.invoke(object, param); } catch (Exception ex) { throw new SQLException(ex); } return; } names.add(descriptor.getName()); } throw new SQLException("No such property: " + name + ", exists. Writable properties are: " + names); }
java
public static void setProperty(Object object, String name, String value) throws SQLException { Class<?> type = object.getClass(); PropertyDescriptor[] descriptors; try { descriptors = Introspector.getBeanInfo(type) .getPropertyDescriptors(); } catch (Exception ex) { throw new SQLException(ex); } List<String> names = new ArrayList<>(); for (PropertyDescriptor descriptor : descriptors) { if (descriptor.getWriteMethod() == null) { continue; } if (descriptor.getName().equals(name)) { Method method = descriptor.getWriteMethod(); Class<?> paramType = method.getParameterTypes()[0]; Object param = toBasicType(value, paramType.getName()); try { method.invoke(object, param); } catch (Exception ex) { throw new SQLException(ex); } return; } names.add(descriptor.getName()); } throw new SQLException("No such property: " + name + ", exists. Writable properties are: " + names); }
[ "public", "static", "void", "setProperty", "(", "Object", "object", ",", "String", "name", ",", "String", "value", ")", "throws", "SQLException", "{", "Class", "<", "?", ">", "type", "=", "object", ".", "getClass", "(", ")", ";", "PropertyDescriptor", "[",...
Tries to set the property 'name' to `value` in the given object. This assignation is made using a <em>setter</em> method discovered and invoked using reflection. @param object the object @param name the property name @param value the value @throws SQLException if the property cannot be set. This happens if there are no setter for the given property in the object or if the value cannot be wrapped to the type of the setter parameter.
[ "Tries", "to", "set", "the", "property", "name", "to", "value", "in", "the", "given", "object", ".", "This", "assignation", "is", "made", "using", "a", "<em", ">", "setter<", "/", "em", ">", "method", "discovered", "and", "invoked", "using", "reflection", ...
train
https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-jdbc-drivers/abstract-jdbc-driver/src/main/java/org/wisdom/jdbc/driver/helpers/BeanUtils.java#L47-L82
xwiki/xwiki-commons
xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/FormatMojo.java
FormatMojo.removeNodes
private void removeNodes(String xpathExpression, Document domdoc) { List<Node> nodes = domdoc.selectNodes(xpathExpression); for (Node node : nodes) { node.detach(); } }
java
private void removeNodes(String xpathExpression, Document domdoc) { List<Node> nodes = domdoc.selectNodes(xpathExpression); for (Node node : nodes) { node.detach(); } }
[ "private", "void", "removeNodes", "(", "String", "xpathExpression", ",", "Document", "domdoc", ")", "{", "List", "<", "Node", ">", "nodes", "=", "domdoc", ".", "selectNodes", "(", "xpathExpression", ")", ";", "for", "(", "Node", "node", ":", "nodes", ")", ...
Remove the nodes found with the xpath expression. @param xpathExpression the xpath expression of the nodes @param domdoc The DOM document
[ "Remove", "the", "nodes", "found", "with", "the", "xpath", "expression", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/FormatMojo.java#L204-L210
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessageConverter.java
JmxMessageConverter.getServiceInvocation
private ManagedBeanInvocation getServiceInvocation(Message message, JmxEndpointConfiguration endpointConfiguration) { Object payload = message.getPayload(); ManagedBeanInvocation serviceInvocation = null; if (payload != null) { if (payload instanceof ManagedBeanInvocation) { serviceInvocation = (ManagedBeanInvocation) payload; } else if (payload != null && StringUtils.hasText(message.getPayload(String.class))) { serviceInvocation = (ManagedBeanInvocation) endpointConfiguration.getMarshaller() .unmarshal(message.getPayload(Source.class)); } else { serviceInvocation = new ManagedBeanInvocation(); } } return serviceInvocation; }
java
private ManagedBeanInvocation getServiceInvocation(Message message, JmxEndpointConfiguration endpointConfiguration) { Object payload = message.getPayload(); ManagedBeanInvocation serviceInvocation = null; if (payload != null) { if (payload instanceof ManagedBeanInvocation) { serviceInvocation = (ManagedBeanInvocation) payload; } else if (payload != null && StringUtils.hasText(message.getPayload(String.class))) { serviceInvocation = (ManagedBeanInvocation) endpointConfiguration.getMarshaller() .unmarshal(message.getPayload(Source.class)); } else { serviceInvocation = new ManagedBeanInvocation(); } } return serviceInvocation; }
[ "private", "ManagedBeanInvocation", "getServiceInvocation", "(", "Message", "message", ",", "JmxEndpointConfiguration", "endpointConfiguration", ")", "{", "Object", "payload", "=", "message", ".", "getPayload", "(", ")", ";", "ManagedBeanInvocation", "serviceInvocation", ...
Reads Citrus internal RMI message model object from message payload. Either payload is actually a service invocation object or XML payload String is unmarshalled to proper object representation. @param message @param endpointConfiguration @return
[ "Reads", "Citrus", "internal", "RMI", "message", "model", "object", "from", "message", "payload", ".", "Either", "payload", "is", "actually", "a", "service", "invocation", "object", "or", "XML", "payload", "String", "is", "unmarshalled", "to", "proper", "object"...
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessageConverter.java#L116-L132
google/closure-compiler
src/com/google/javascript/jscomp/ProcessClosureProvidesAndRequires.java
ProcessClosureProvidesAndRequires.rewriteProvidesAndRequires
void rewriteProvidesAndRequires(Node externs, Node root) { checkState(!hasRewritingOccurred, "Cannot call rewriteProvidesAndRequires twice per instance"); hasRewritingOccurred = true; collectProvidedNames(externs, root); for (ProvidedName pn : providedNames.values()) { pn.replace(); } deleteNamespaceInitializationsFromPreviousProvides(); if (requiresLevel.isOn()) { for (UnrecognizedRequire r : unrecognizedRequires) { checkForLateOrMissingProvide(r); } } for (Node closureRequire : requiresToBeRemoved) { compiler.reportChangeToEnclosingScope(closureRequire); closureRequire.detach(); } for (Node forwardDeclare : forwardDeclaresToRemove) { NodeUtil.deleteNode(forwardDeclare, compiler); } }
java
void rewriteProvidesAndRequires(Node externs, Node root) { checkState(!hasRewritingOccurred, "Cannot call rewriteProvidesAndRequires twice per instance"); hasRewritingOccurred = true; collectProvidedNames(externs, root); for (ProvidedName pn : providedNames.values()) { pn.replace(); } deleteNamespaceInitializationsFromPreviousProvides(); if (requiresLevel.isOn()) { for (UnrecognizedRequire r : unrecognizedRequires) { checkForLateOrMissingProvide(r); } } for (Node closureRequire : requiresToBeRemoved) { compiler.reportChangeToEnclosingScope(closureRequire); closureRequire.detach(); } for (Node forwardDeclare : forwardDeclaresToRemove) { NodeUtil.deleteNode(forwardDeclare, compiler); } }
[ "void", "rewriteProvidesAndRequires", "(", "Node", "externs", ",", "Node", "root", ")", "{", "checkState", "(", "!", "hasRewritingOccurred", ",", "\"Cannot call rewriteProvidesAndRequires twice per instance\"", ")", ";", "hasRewritingOccurred", "=", "true", ";", "collectP...
Rewrites all provides and requires in the given namespace. <p>Call this instead of {@link #collectProvidedNames(Node, Node)} if you want rewriting.
[ "Rewrites", "all", "provides", "and", "requires", "in", "the", "given", "namespace", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ProcessClosureProvidesAndRequires.java#L111-L135
exKAZUu/GameAIArena
src/main/java/net/exkazuu/gameaiarena/api/Point2.java
Point2.sub
public Point2 sub(Point2 that) { return new Point2(x - that.x, y - that.y); }
java
public Point2 sub(Point2 that) { return new Point2(x - that.x, y - that.y); }
[ "public", "Point2", "sub", "(", "Point2", "that", ")", "{", "return", "new", "Point2", "(", "x", "-", "that", ".", "x", ",", "y", "-", "that", ".", "y", ")", ";", "}" ]
Point(this.x - that.x, this.y - that.y)となるPoint型を返します。 @param that このPoint型から減算するPoint型 @return このPoint型から引数のPoint型を減産した結果
[ "Point", "(", "this", ".", "x", "-", "that", ".", "x", "this", ".", "y", "-", "that", ".", "y", ")", "となるPoint型を返します。" ]
train
https://github.com/exKAZUu/GameAIArena/blob/66894c251569fb763174654d6c262c5176dfcf48/src/main/java/net/exkazuu/gameaiarena/api/Point2.java#L168-L170
geomajas/geomajas-project-server
api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java
AssociationValue.setImageUrlAttribute
public void setImageUrlAttribute(String name, String value) { ensureAttributes(); Attribute attribute = new ImageUrlAttribute(value); attribute.setEditable(isEditable(name)); getAllAttributes().put(name, attribute); }
java
public void setImageUrlAttribute(String name, String value) { ensureAttributes(); Attribute attribute = new ImageUrlAttribute(value); attribute.setEditable(isEditable(name)); getAllAttributes().put(name, attribute); }
[ "public", "void", "setImageUrlAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "ensureAttributes", "(", ")", ";", "Attribute", "attribute", "=", "new", "ImageUrlAttribute", "(", "value", ")", ";", "attribute", ".", "setEditable", "(", "isEd...
Sets the specified image URL attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0
[ "Sets", "the", "specified", "image", "URL", "attribute", "to", "the", "specified", "value", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L290-L296
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/util/ArrayUtils.java
ArrayUtils.concat
public static <T> T[] concat(T first, T[] others) { @SuppressWarnings("unchecked") T[] arr = (T[]) Array.newInstance(first.getClass(), 1); arr[0] = first; return concat(arr, others); }
java
public static <T> T[] concat(T first, T[] others) { @SuppressWarnings("unchecked") T[] arr = (T[]) Array.newInstance(first.getClass(), 1); arr[0] = first; return concat(arr, others); }
[ "public", "static", "<", "T", ">", "T", "[", "]", "concat", "(", "T", "first", ",", "T", "[", "]", "others", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "[", "]", "arr", "=", "(", "T", "[", "]", ")", "Array", ".", "newIns...
Create an array starting with first element and followed by others. <p> This can be useful when handling vararg parameters and when you want to force to have at least one value. <p> @param first the first element @param others the other elements @param <T> the type of each element in the array @return the combined array
[ "Create", "an", "array", "starting", "with", "first", "element", "and", "followed", "by", "others", ".", "<p", ">", "This", "can", "be", "useful", "when", "handling", "vararg", "parameters", "and", "when", "you", "want", "to", "force", "to", "have", "at", ...
train
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/util/ArrayUtils.java#L25-L30
Activiti/Activiti
activiti-engine/src/main/java/org/activiti/engine/impl/util/ReflectUtil.java
ReflectUtil.getSetter
public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) { String setterName = "set" + Character.toTitleCase(fieldName.charAt(0)) + fieldName.substring(1, fieldName.length()); try { // Using getMethods(), getMethod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); for (Method method : methods) { if (method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if (paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) { return method; } } } return null; } catch (SecurityException e) { throw new ActivitiException("Not allowed to access method " + setterName + " on class " + clazz.getCanonicalName()); } }
java
public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) { String setterName = "set" + Character.toTitleCase(fieldName.charAt(0)) + fieldName.substring(1, fieldName.length()); try { // Using getMethods(), getMethod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); for (Method method : methods) { if (method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if (paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) { return method; } } } return null; } catch (SecurityException e) { throw new ActivitiException("Not allowed to access method " + setterName + " on class " + clazz.getCanonicalName()); } }
[ "public", "static", "Method", "getSetter", "(", "String", "fieldName", ",", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "?", ">", "fieldType", ")", "{", "String", "setterName", "=", "\"set\"", "+", "Character", ".", "toTitleCase", "(", "fieldName",...
Returns the setter-method for the given field name or null if no setter exists.
[ "Returns", "the", "setter", "-", "method", "for", "the", "given", "field", "name", "or", "null", "if", "no", "setter", "exists", "." ]
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/util/ReflectUtil.java#L193-L211
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java
TransferFsImage.getFileClient
static MD5Hash getFileClient(String nnHostPort, String queryString, List<OutputStream> outputStreams, Storage dstStorage, boolean getChecksum) throws IOException { String proto = "http://"; StringBuilder str = new StringBuilder(proto+nnHostPort+"/getimage?"); str.append(queryString); LOG.info("Opening connection to " + str); // // open connection to remote server // URL url = new URL(str.toString()); return doGetUrl(url, outputStreams, dstStorage, getChecksum); }
java
static MD5Hash getFileClient(String nnHostPort, String queryString, List<OutputStream> outputStreams, Storage dstStorage, boolean getChecksum) throws IOException { String proto = "http://"; StringBuilder str = new StringBuilder(proto+nnHostPort+"/getimage?"); str.append(queryString); LOG.info("Opening connection to " + str); // // open connection to remote server // URL url = new URL(str.toString()); return doGetUrl(url, outputStreams, dstStorage, getChecksum); }
[ "static", "MD5Hash", "getFileClient", "(", "String", "nnHostPort", ",", "String", "queryString", ",", "List", "<", "OutputStream", ">", "outputStreams", ",", "Storage", "dstStorage", ",", "boolean", "getChecksum", ")", "throws", "IOException", "{", "String", "prot...
Client-side Method to fetch file from a server Copies the response from the URL to a list of local files. @param dstStorage if an error occurs writing to one of the files, this storage object will be notified. @Return a digest of the received file if getChecksum is true
[ "Client", "-", "side", "Method", "to", "fetch", "file", "from", "a", "server", "Copies", "the", "response", "from", "the", "URL", "to", "a", "list", "of", "local", "files", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java#L267-L280
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
BlobContainersInner.clearLegalHold
public LegalHoldInner clearLegalHold(String resourceGroupName, String accountName, String containerName, List<String> tags) { return clearLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body(); }
java
public LegalHoldInner clearLegalHold(String resourceGroupName, String accountName, String containerName, List<String> tags) { return clearLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body(); }
[ "public", "LegalHoldInner", "clearLegalHold", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ",", "List", "<", "String", ">", "tags", ")", "{", "return", "clearLegalHoldWithServiceResponseAsync", "(", "resourceGroupName...
Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @param tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. @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 LegalHoldInner object if successful.
[ "Clears", "legal", "hold", "tags", ".", "Clearing", "the", "same", "or", "non", "-", "existent", "tag", "results", "in", "an", "idempotent", "operation", ".", "ClearLegalHold", "clears", "out", "only", "the", "specified", "tags", "in", "the", "request", "." ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L898-L900
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteCertificateIssuerAsync
public ServiceFuture<IssuerBundle> deleteCertificateIssuerAsync(String vaultBaseUrl, String issuerName, final ServiceCallback<IssuerBundle> serviceCallback) { return ServiceFuture.fromResponse(deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName), serviceCallback); }
java
public ServiceFuture<IssuerBundle> deleteCertificateIssuerAsync(String vaultBaseUrl, String issuerName, final ServiceCallback<IssuerBundle> serviceCallback) { return ServiceFuture.fromResponse(deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName), serviceCallback); }
[ "public", "ServiceFuture", "<", "IssuerBundle", ">", "deleteCertificateIssuerAsync", "(", "String", "vaultBaseUrl", ",", "String", "issuerName", ",", "final", "ServiceCallback", "<", "IssuerBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fr...
Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This operation requires the certificates/manageissuers/deleteissuers permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param issuerName The name of the issuer. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Deletes", "the", "specified", "certificate", "issuer", ".", "The", "DeleteCertificateIssuer", "operation", "permanently", "removes", "the", "specified", "certificate", "issuer", "from", "the", "vault", ".", "This", "operation", "requires", "the", "certificates", "/",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6414-L6416
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/GetMaintenanceWindowExecutionTaskResult.java
GetMaintenanceWindowExecutionTaskResult.withTaskParameters
public GetMaintenanceWindowExecutionTaskResult withTaskParameters(java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>... taskParameters) { if (this.taskParameters == null) { setTaskParameters(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>>( taskParameters.length)); } for (java.util.Map<String, MaintenanceWindowTaskParameterValueExpression> ele : taskParameters) { this.taskParameters.add(ele); } return this; }
java
public GetMaintenanceWindowExecutionTaskResult withTaskParameters(java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>... taskParameters) { if (this.taskParameters == null) { setTaskParameters(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>>( taskParameters.length)); } for (java.util.Map<String, MaintenanceWindowTaskParameterValueExpression> ele : taskParameters) { this.taskParameters.add(ele); } return this; }
[ "public", "GetMaintenanceWindowExecutionTaskResult", "withTaskParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "MaintenanceWindowTaskParameterValueExpression", ">", "...", "taskParameters", ")", "{", "if", "(", "this", ".", "taskParameters", "==", ...
<p> The parameters passed to the task when it was run. </p> <note> <p> <code>TaskParameters</code> has been deprecated. To specify parameters to pass to a task when it runs, instead use the <code>Parameters</code> option in the <code>TaskInvocationParameters</code> structure. For information about how Systems Manager handles these options for the supported Maintenance Window task types, see <a>MaintenanceWindowTaskInvocationParameters</a>. </p> </note> <p> The map has the following format: </p> <p> Key: string, between 1 and 255 characters </p> <p> Value: an array of strings, each string is between 1 and 255 characters </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setTaskParameters(java.util.Collection)} or {@link #withTaskParameters(java.util.Collection)} if you want to override the existing values. </p> @param taskParameters The parameters passed to the task when it was run.</p> <note> <p> <code>TaskParameters</code> has been deprecated. To specify parameters to pass to a task when it runs, instead use the <code>Parameters</code> option in the <code>TaskInvocationParameters</code> structure. For information about how Systems Manager handles these options for the supported Maintenance Window task types, see <a>MaintenanceWindowTaskInvocationParameters</a>. </p> </note> <p> The map has the following format: </p> <p> Key: string, between 1 and 255 characters </p> <p> Value: an array of strings, each string is between 1 and 255 characters @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "parameters", "passed", "to", "the", "task", "when", "it", "was", "run", ".", "<", "/", "p", ">", "<note", ">", "<p", ">", "<code", ">", "TaskParameters<", "/", "code", ">", "has", "been", "deprecated", ".", "To", "specify", "parame...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/GetMaintenanceWindowExecutionTaskResult.java#L501-L510
b3log/latke
latke-core/src/main/java/org/json/JSONObject.java
JSONObject.optLong
public long optLong(String key, long defaultValue) { final Number val = this.optNumber(key, null); if (val == null) { return defaultValue; } return val.longValue(); }
java
public long optLong(String key, long defaultValue) { final Number val = this.optNumber(key, null); if (val == null) { return defaultValue; } return val.longValue(); }
[ "public", "long", "optLong", "(", "String", "key", ",", "long", "defaultValue", ")", "{", "final", "Number", "val", "=", "this", ".", "optNumber", "(", "key", ",", "null", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "defaultValue", ...
Get an optional long value associated with a key, or the default if there is no such key or if the value is not a number. If the value is a string, an attempt will be made to evaluate it as a number. @param key A key string. @param defaultValue The default. @return An object which is the value.
[ "Get", "an", "optional", "long", "value", "associated", "with", "a", "key", "or", "the", "default", "if", "there", "is", "no", "such", "key", "or", "if", "the", "value", "is", "not", "a", "number", ".", "If", "the", "value", "is", "a", "string", "an"...
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1363-L1370
apptik/JustJson
json-core/src/main/java/io/apptik/json/util/IdentityArrayList.java
IdentityArrayList.addAll
public boolean addAll(int index, Collection<? extends E> c) { rangeCheckForAdd(index); Object[] a = c.toArray(); int numNew = a.length; ensureCapacity(size + numNew); // Increments modCount int numMoved = size - index; if (numMoved > 0) { System.arraycopy(elementData, index, elementData, index + numNew, numMoved); } System.arraycopy(a, 0, elementData, index, numNew); size += numNew; return numNew != 0; }
java
public boolean addAll(int index, Collection<? extends E> c) { rangeCheckForAdd(index); Object[] a = c.toArray(); int numNew = a.length; ensureCapacity(size + numNew); // Increments modCount int numMoved = size - index; if (numMoved > 0) { System.arraycopy(elementData, index, elementData, index + numNew, numMoved); } System.arraycopy(a, 0, elementData, index, numNew); size += numNew; return numNew != 0; }
[ "public", "boolean", "addAll", "(", "int", "index", ",", "Collection", "<", "?", "extends", "E", ">", "c", ")", "{", "rangeCheckForAdd", "(", "index", ")", ";", "Object", "[", "]", "a", "=", "c", ".", "toArray", "(", ")", ";", "int", "numNew", "=",...
Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator. @param index index at which to insert the first element from the specified collection @param c collection containing elements to be added to this list @return <tt>true</tt> if this list changed as a result of the call @throws IndexOutOfBoundsException {@inheritDoc} @throws NullPointerException if the specified collection is null
[ "Inserts", "all", "of", "the", "elements", "in", "the", "specified", "collection", "into", "this", "list", "starting", "at", "the", "specified", "position", ".", "Shifts", "the", "element", "currently", "at", "that", "position", "(", "if", "any", ")", "and",...
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/util/IdentityArrayList.java#L470-L485
aoindustries/aocode-public
src/main/java/com/aoindustries/servlet/http/ServletUtil.java
ServletUtil.getAbsoluteURL
public static void getAbsoluteURL(HttpServletRequest request, String relPath, Appendable out) throws IOException { out.append(request.isSecure() ? "https://" : "http://"); out.append(request.getServerName()); int port = request.getServerPort(); if(port!=(request.isSecure() ? 443 : 80)) out.append(':').append(Integer.toString(port)); out.append(request.getContextPath()); out.append(relPath); }
java
public static void getAbsoluteURL(HttpServletRequest request, String relPath, Appendable out) throws IOException { out.append(request.isSecure() ? "https://" : "http://"); out.append(request.getServerName()); int port = request.getServerPort(); if(port!=(request.isSecure() ? 443 : 80)) out.append(':').append(Integer.toString(port)); out.append(request.getContextPath()); out.append(relPath); }
[ "public", "static", "void", "getAbsoluteURL", "(", "HttpServletRequest", "request", ",", "String", "relPath", ",", "Appendable", "out", ")", "throws", "IOException", "{", "out", ".", "append", "(", "request", ".", "isSecure", "(", ")", "?", "\"https://\"", ":"...
Gets an absolute URL for the given context-relative path. This includes protocol, port, context path, and relative path. No URL rewriting is performed.
[ "Gets", "an", "absolute", "URL", "for", "the", "given", "context", "-", "relative", "path", ".", "This", "includes", "protocol", "port", "context", "path", "and", "relative", "path", ".", "No", "URL", "rewriting", "is", "performed", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L265-L272
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java
Utils.updateProperties
public static String updateProperties( String propertiesContent, Map<String,String> keyToNewValue ) { for( Map.Entry<String,String> entry : keyToNewValue.entrySet()) { propertiesContent = propertiesContent.replaceFirst( "(?mi)^\\s*" + entry.getKey() + "\\s*[:=][^\n]*$", entry.getKey() + " = " + entry.getValue()); } return propertiesContent; }
java
public static String updateProperties( String propertiesContent, Map<String,String> keyToNewValue ) { for( Map.Entry<String,String> entry : keyToNewValue.entrySet()) { propertiesContent = propertiesContent.replaceFirst( "(?mi)^\\s*" + entry.getKey() + "\\s*[:=][^\n]*$", entry.getKey() + " = " + entry.getValue()); } return propertiesContent; }
[ "public", "static", "String", "updateProperties", "(", "String", "propertiesContent", ",", "Map", "<", "String", ",", "String", ">", "keyToNewValue", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "keyToNewValue",...
Updates string properties. @param propertiesContent the properties file as a string @param keyToNewValue the keys to update with their new values @return a non-null string
[ "Updates", "string", "properties", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L656-L665
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getPatternAnyEntityInfos
public List<PatternAnyEntityExtractor> getPatternAnyEntityInfos(UUID appId, String versionId, GetPatternAnyEntityInfosOptionalParameter getPatternAnyEntityInfosOptionalParameter) { return getPatternAnyEntityInfosWithServiceResponseAsync(appId, versionId, getPatternAnyEntityInfosOptionalParameter).toBlocking().single().body(); }
java
public List<PatternAnyEntityExtractor> getPatternAnyEntityInfos(UUID appId, String versionId, GetPatternAnyEntityInfosOptionalParameter getPatternAnyEntityInfosOptionalParameter) { return getPatternAnyEntityInfosWithServiceResponseAsync(appId, versionId, getPatternAnyEntityInfosOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "PatternAnyEntityExtractor", ">", "getPatternAnyEntityInfos", "(", "UUID", "appId", ",", "String", "versionId", ",", "GetPatternAnyEntityInfosOptionalParameter", "getPatternAnyEntityInfosOptionalParameter", ")", "{", "return", "getPatternAnyEntityInfosWithS...
Get information about the Pattern.Any entity models. @param appId The application ID. @param versionId The version ID. @param getPatternAnyEntityInfosOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;PatternAnyEntityExtractor&gt; object if successful.
[ "Get", "information", "about", "the", "Pattern", ".", "Any", "entity", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7390-L7392
bmwcarit/joynr
java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java
Utilities.isSessionEncodedInUrl
public static boolean isSessionEncodedInUrl(String encodedUrl, String sessionIdName) { int sessionIdIndex = encodedUrl.indexOf(getSessionIdSubstring(sessionIdName)); return sessionIdIndex >= 0; }
java
public static boolean isSessionEncodedInUrl(String encodedUrl, String sessionIdName) { int sessionIdIndex = encodedUrl.indexOf(getSessionIdSubstring(sessionIdName)); return sessionIdIndex >= 0; }
[ "public", "static", "boolean", "isSessionEncodedInUrl", "(", "String", "encodedUrl", ",", "String", "sessionIdName", ")", "{", "int", "sessionIdIndex", "=", "encodedUrl", ".", "indexOf", "(", "getSessionIdSubstring", "(", "sessionIdName", ")", ")", ";", "return", ...
Returns whether the session ID is encoded into the URL. @param encodedUrl the url to check @param sessionIdName the name of the session ID, e.g. jsessionid @return boolean value, true if session ID is encoded into the URL.
[ "Returns", "whether", "the", "session", "ID", "is", "encoded", "into", "the", "URL", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java#L123-L126
Activiti/Activiti
activiti-engine/src/main/java/org/activiti/engine/impl/cfg/standalone/StandaloneMybatisTransactionContext.java
StandaloneMybatisTransactionContext.fireTransactionEvent
protected void fireTransactionEvent(TransactionState transactionState, boolean executeInNewContext) { if (stateTransactionListeners==null) { return; } final List<TransactionListener> transactionListeners = stateTransactionListeners.get(transactionState); if (transactionListeners==null) { return; } if (executeInNewContext) { CommandExecutor commandExecutor = commandContext.getProcessEngineConfiguration().getCommandExecutor(); CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRES_NEW); commandExecutor.execute(commandConfig, new Command<Void>() { public Void execute(CommandContext commandContext) { executeTransactionListeners(transactionListeners, commandContext); return null; } }); } else { executeTransactionListeners(transactionListeners, commandContext); } }
java
protected void fireTransactionEvent(TransactionState transactionState, boolean executeInNewContext) { if (stateTransactionListeners==null) { return; } final List<TransactionListener> transactionListeners = stateTransactionListeners.get(transactionState); if (transactionListeners==null) { return; } if (executeInNewContext) { CommandExecutor commandExecutor = commandContext.getProcessEngineConfiguration().getCommandExecutor(); CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRES_NEW); commandExecutor.execute(commandConfig, new Command<Void>() { public Void execute(CommandContext commandContext) { executeTransactionListeners(transactionListeners, commandContext); return null; } }); } else { executeTransactionListeners(transactionListeners, commandContext); } }
[ "protected", "void", "fireTransactionEvent", "(", "TransactionState", "transactionState", ",", "boolean", "executeInNewContext", ")", "{", "if", "(", "stateTransactionListeners", "==", "null", ")", "{", "return", ";", "}", "final", "List", "<", "TransactionListener", ...
Fires the event for the provided {@link TransactionState}. @param transactionState The {@link TransactionState} for which the listeners will be called. @param executeInNewContext If true, the listeners will be called in a new command context. This is needed for example when firing the {@link TransactionState#COMMITTED} event: the transacation is already committed and executing logic in the same context could lead to strange behaviour (for example doing a {@link SqlSession#update(String)} would actually roll back the update (as the MyBatis context is already committed and the internal flags have not been correctly set).
[ "Fires", "the", "event", "for", "the", "provided", "{", "@link", "TransactionState", "}", "." ]
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/standalone/StandaloneMybatisTransactionContext.java#L82-L104
square/phrase
src/main/java/com/squareup/phrase/Phrase.java
Phrase.putOptional
public Phrase putOptional(String key, CharSequence value) { return keys.contains(key) ? put(key, value) : this; }
java
public Phrase putOptional(String key, CharSequence value) { return keys.contains(key) ? put(key, value) : this; }
[ "public", "Phrase", "putOptional", "(", "String", "key", ",", "CharSequence", "value", ")", "{", "return", "keys", ".", "contains", "(", "key", ")", "?", "put", "(", "key", ",", "value", ")", ":", "this", ";", "}" ]
Silently ignored if the key is not in the pattern. @see #put(String, CharSequence)
[ "Silently", "ignored", "if", "the", "key", "is", "not", "in", "the", "pattern", "." ]
train
https://github.com/square/phrase/blob/d91f18e80790832db11b811c462f8e5cd492d97e/src/main/java/com/squareup/phrase/Phrase.java#L179-L181
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForPolicySetDefinition
public SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); }
java
public SummarizeResultsInner summarizeForPolicySetDefinition(String subscriptionId, String policySetDefinitionName) { return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName).toBlocking().single().body(); }
[ "public", "SummarizeResultsInner", "summarizeForPolicySetDefinition", "(", "String", "subscriptionId", ",", "String", "policySetDefinitionName", ")", "{", "return", "summarizeForPolicySetDefinitionWithServiceResponseAsync", "(", "subscriptionId", ",", "policySetDefinitionName", ")"...
Summarizes policy states for the subscription level policy set definition. @param subscriptionId Microsoft Azure subscription ID. @param policySetDefinitionName Policy set definition name. @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SummarizeResultsInner object if successful.
[ "Summarizes", "policy", "states", "for", "the", "subscription", "level", "policy", "set", "definition", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L1879-L1881
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java
ManagementWsDelegate.createApplication
public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; }
java
public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; }
[ "public", "Application", "createApplication", "(", "String", "applicationName", ",", "String", "templateName", ",", "String", "templateQualifier", ")", "throws", "ManagementWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Creating application \"", "+", ...
Creates an application from a template. @param applicationName the application name @param templateName the template's name @param templateQualifier the template's qualifier @return the created application @throws ManagementWsException if a problem occurred with the applications management
[ "Creates", "an", "application", "from", "a", "template", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java#L267-L284
openwms/org.openwms
org.openwms.core.util/src/main/java/org/openwms/core/http/AbstractWebController.java
AbstractWebController.buildOKResponse
protected <T extends AbstractBase> ResponseEntity<Response<T>> buildOKResponse(T... params) { return buildResponse(HttpStatus.OK, "", "", params); }
java
protected <T extends AbstractBase> ResponseEntity<Response<T>> buildOKResponse(T... params) { return buildResponse(HttpStatus.OK, "", "", params); }
[ "protected", "<", "T", "extends", "AbstractBase", ">", "ResponseEntity", "<", "Response", "<", "T", ">", ">", "buildOKResponse", "(", "T", "...", "params", ")", "{", "return", "buildResponse", "(", "HttpStatus", ".", "OK", ",", "\"\"", ",", "\"\"", ",", ...
Build an response object that signals a success response to the caller. @param <T> Some type extending the AbstractBase entity @param params A set of Serializable objects that are passed to the caller @return A ResponseEntity with status {@link HttpStatus#OK}
[ "Build", "an", "response", "object", "that", "signals", "a", "success", "response", "to", "the", "caller", "." ]
train
https://github.com/openwms/org.openwms/blob/b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e/org.openwms.core.util/src/main/java/org/openwms/core/http/AbstractWebController.java#L173-L175
code4everything/util
src/main/java/com/zhazhapan/util/BeanUtils.java
BeanUtils.bean2Another
private static <T> T bean2Another(Object object, Class<?> clazz, T another) throws InvocationTargetException, IllegalAccessException { Method[] methods = object.getClass().getMethods(); Map<String, Method> clazzMethods = ReflectUtils.getMethodMap(clazz, "set"); for (Method method : methods) { String name = method.getName(); if (name.startsWith("get") && !"getClass".equals(name)) { String clazzMethod = "s" + name.substring(1); if (clazzMethods.containsKey(clazzMethod)) { Object value = method.invoke(object); if (Checker.isNotNull(value)) { clazzMethods.get(clazzMethod).invoke(another, value); } } } } return another; }
java
private static <T> T bean2Another(Object object, Class<?> clazz, T another) throws InvocationTargetException, IllegalAccessException { Method[] methods = object.getClass().getMethods(); Map<String, Method> clazzMethods = ReflectUtils.getMethodMap(clazz, "set"); for (Method method : methods) { String name = method.getName(); if (name.startsWith("get") && !"getClass".equals(name)) { String clazzMethod = "s" + name.substring(1); if (clazzMethods.containsKey(clazzMethod)) { Object value = method.invoke(object); if (Checker.isNotNull(value)) { clazzMethods.get(clazzMethod).invoke(another, value); } } } } return another; }
[ "private", "static", "<", "T", ">", "T", "bean2Another", "(", "Object", "object", ",", "Class", "<", "?", ">", "clazz", ",", "T", "another", ")", "throws", "InvocationTargetException", ",", "IllegalAccessException", "{", "Method", "[", "]", "methods", "=", ...
将一个Bean的数据装换到另外一个(需实现setter和getter) @param object 一个Bean @param clazz 另外一个Bean类 @param another 另一个Bean对象 @param <T> 另外Bean类型 @return {@link T} @throws IllegalAccessException 异常 @throws InvocationTargetException 异常 @since 1.1.1
[ "将一个Bean的数据装换到另外一个(需实现setter和getter)" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L105-L123
HolmesNL/kafka-spout
src/main/java/nl/minvenj/nfi/storm/kafka/util/ConfigUtils.java
ConfigUtils.getTopic
public static String getTopic(final Map<String, Object> stormConfig) { if (stormConfig.containsKey(CONFIG_TOPIC)) { // get configured topic from config as string, removing whitespace from both ends final String topic = String.valueOf(stormConfig.get(CONFIG_TOPIC)).trim(); if (topic.length() > 0) { return topic; } else { LOG.warn("configured topic found in storm config is empty, defaulting to topic '{}'", DEFAULT_TOPIC); return DEFAULT_TOPIC; } } else { LOG.warn("no configured topic found in storm config, defaulting to topic '{}'", DEFAULT_TOPIC); return DEFAULT_TOPIC; } }
java
public static String getTopic(final Map<String, Object> stormConfig) { if (stormConfig.containsKey(CONFIG_TOPIC)) { // get configured topic from config as string, removing whitespace from both ends final String topic = String.valueOf(stormConfig.get(CONFIG_TOPIC)).trim(); if (topic.length() > 0) { return topic; } else { LOG.warn("configured topic found in storm config is empty, defaulting to topic '{}'", DEFAULT_TOPIC); return DEFAULT_TOPIC; } } else { LOG.warn("no configured topic found in storm config, defaulting to topic '{}'", DEFAULT_TOPIC); return DEFAULT_TOPIC; } }
[ "public", "static", "String", "getTopic", "(", "final", "Map", "<", "String", ",", "Object", ">", "stormConfig", ")", "{", "if", "(", "stormConfig", ".", "containsKey", "(", "CONFIG_TOPIC", ")", ")", "{", "// get configured topic from config as string, removing whit...
Retrieves the topic to be consumed from storm's configuration map, or the {@link #DEFAULT_TOPIC} if no (non-empty) value was found using {@link #CONFIG_TOPIC}. @param stormConfig Storm's configuration map. @return The topic to be consumed.
[ "Retrieves", "the", "topic", "to", "be", "consumed", "from", "storm", "s", "configuration", "map", "or", "the", "{", "@link", "#DEFAULT_TOPIC", "}", "if", "no", "(", "non", "-", "empty", ")", "value", "was", "found", "using", "{", "@link", "#CONFIG_TOPIC",...
train
https://github.com/HolmesNL/kafka-spout/blob/bef626b9fab6946a7e0d3c85979ec36ae0870233/src/main/java/nl/minvenj/nfi/storm/kafka/util/ConfigUtils.java#L287-L303
OpenLiberty/open-liberty
dev/com.ibm.ws.security.registry/src/com/ibm/ws/security/registry/internal/UserRegistryServiceImpl.java
UserRegistryServiceImpl.getUserRegistryFromConfiguration
private UserRegistry getUserRegistryFromConfiguration() throws RegistryException { String[] refIds = this.refId; if (refIds == null || refIds.length == 0) { // Can look for config.source = file // If thats set, and we're missing this, we can error. // If its not set, we don't have configuration from the // file and we should try to resolve if we have one instance defined? Tr.error(tc, "USER_REGISTRY_SERVICE_CONFIG_ERROR_NO_REFID"); throw new RegistryException(TraceNLS.getFormattedMessage( this.getClass(), TraceConstants.MESSAGE_BUNDLE, "USER_REGISTRY_SERVICE_CONFIG_ERROR_NO_REFID", null, "CWWKS3000E: A configuration error has occurred. There is no configured refId parameter for the userRegistry configuration.")); } else if (refIds.length == 1) { return getUserRegistry(refIds[0]); } else { // Multiple refIds, we'll use the UserRegistryProxy. List<UserRegistry> delegates = new ArrayList<UserRegistry>(); for (String refId : refIds) { delegates.add(getUserRegistry(refId)); } return new UserRegistryProxy(realm, delegates); } }
java
private UserRegistry getUserRegistryFromConfiguration() throws RegistryException { String[] refIds = this.refId; if (refIds == null || refIds.length == 0) { // Can look for config.source = file // If thats set, and we're missing this, we can error. // If its not set, we don't have configuration from the // file and we should try to resolve if we have one instance defined? Tr.error(tc, "USER_REGISTRY_SERVICE_CONFIG_ERROR_NO_REFID"); throw new RegistryException(TraceNLS.getFormattedMessage( this.getClass(), TraceConstants.MESSAGE_BUNDLE, "USER_REGISTRY_SERVICE_CONFIG_ERROR_NO_REFID", null, "CWWKS3000E: A configuration error has occurred. There is no configured refId parameter for the userRegistry configuration.")); } else if (refIds.length == 1) { return getUserRegistry(refIds[0]); } else { // Multiple refIds, we'll use the UserRegistryProxy. List<UserRegistry> delegates = new ArrayList<UserRegistry>(); for (String refId : refIds) { delegates.add(getUserRegistry(refId)); } return new UserRegistryProxy(realm, delegates); } }
[ "private", "UserRegistry", "getUserRegistryFromConfiguration", "(", ")", "throws", "RegistryException", "{", "String", "[", "]", "refIds", "=", "this", ".", "refId", ";", "if", "(", "refIds", "==", "null", "||", "refIds", ".", "length", "==", "0", ")", "{", ...
When a configuration element is defined, use it to resolve the effective UserRegistry configuration. @return @throws RegistryException
[ "When", "a", "configuration", "element", "is", "defined", "use", "it", "to", "resolve", "the", "effective", "UserRegistry", "configuration", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.registry/src/com/ibm/ws/security/registry/internal/UserRegistryServiceImpl.java#L447-L471
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addSubList
public int addSubList(UUID appId, String versionId, UUID clEntityId, WordListObject wordListCreateObject) { return addSubListWithServiceResponseAsync(appId, versionId, clEntityId, wordListCreateObject).toBlocking().single().body(); }
java
public int addSubList(UUID appId, String versionId, UUID clEntityId, WordListObject wordListCreateObject) { return addSubListWithServiceResponseAsync(appId, versionId, clEntityId, wordListCreateObject).toBlocking().single().body(); }
[ "public", "int", "addSubList", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "WordListObject", "wordListCreateObject", ")", "{", "return", "addSubListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "clEntityId", ",...
Adds a list to an existing closed list. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list entity extractor ID. @param wordListCreateObject Words list. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the int object if successful.
[ "Adds", "a", "list", "to", "an", "existing", "closed", "list", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L5444-L5446
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java
AbstractInterfaceConfig.setParameters
public S setParameters(Map<String, String> parameters) { if (this.parameters == null) { this.parameters = new ConcurrentHashMap<String, String>(); } this.parameters.putAll(parameters); return castThis(); }
java
public S setParameters(Map<String, String> parameters) { if (this.parameters == null) { this.parameters = new ConcurrentHashMap<String, String>(); } this.parameters.putAll(parameters); return castThis(); }
[ "public", "S", "setParameters", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "if", "(", "this", ".", "parameters", "==", "null", ")", "{", "this", ".", "parameters", "=", "new", "ConcurrentHashMap", "<", "String", ",", "String",...
Sets parameters. @param parameters the parameters @return the parameters
[ "Sets", "parameters", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java#L553-L559
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java
TypeExtractionUtils.hasSuperclass
public static boolean hasSuperclass(Class<?> clazz, String superClassName) { List<Type> hierarchy = new ArrayList<>(); getTypeHierarchy(hierarchy, clazz, Object.class); for (Type t : hierarchy) { if (isClassType(t) && typeToClass(t).getName().equals(superClassName)) { return true; } } return false; }
java
public static boolean hasSuperclass(Class<?> clazz, String superClassName) { List<Type> hierarchy = new ArrayList<>(); getTypeHierarchy(hierarchy, clazz, Object.class); for (Type t : hierarchy) { if (isClassType(t) && typeToClass(t).getName().equals(superClassName)) { return true; } } return false; }
[ "public", "static", "boolean", "hasSuperclass", "(", "Class", "<", "?", ">", "clazz", ",", "String", "superClassName", ")", "{", "List", "<", "Type", ">", "hierarchy", "=", "new", "ArrayList", "<>", "(", ")", ";", "getTypeHierarchy", "(", "hierarchy", ",",...
Returns true if the given class has a superclass of given name. @param clazz class to be analyzed @param superClassName class name of the super class
[ "Returns", "true", "if", "the", "given", "class", "has", "a", "superclass", "of", "given", "name", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L311-L320
cdk/cdk
tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java
MmffAromaticTypeMapping.indexOfHetro
static int indexOfHetro(int[] cycle, int[] contribution) { int index = -1; for (int i = 0; i < cycle.length - 1; i++) { if (contribution[cycle[i]] == 2) index = index == -1 ? i : -2; } return index; }
java
static int indexOfHetro(int[] cycle, int[] contribution) { int index = -1; for (int i = 0; i < cycle.length - 1; i++) { if (contribution[cycle[i]] == 2) index = index == -1 ? i : -2; } return index; }
[ "static", "int", "indexOfHetro", "(", "int", "[", "]", "cycle", ",", "int", "[", "]", "contribution", ")", "{", "int", "index", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cycle", ".", "length", "-", "1", ";", "i", "...
Find the index of a hetroatom in a cycle. A hetroatom in MMFF is the unique atom that contributes a pi-lone-pair to the aromatic system. @param cycle aromatic cycle, |C| = 5 @param contribution vector of p electron contributions from each vertex @return index of hetroatom, if none found index is < 0.
[ "Find", "the", "index", "of", "a", "hetroatom", "in", "a", "cycle", ".", "A", "hetroatom", "in", "MMFF", "is", "the", "unique", "atom", "that", "contributes", "a", "pi", "-", "lone", "-", "pair", "to", "the", "aromatic", "system", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java#L323-L329
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/dimreduction/PCALearningExample.java
PCALearningExample.main
public static void main(String[] args) throws Exception { String indexLocation = args[0]; int numTrainVectors = Integer.parseInt(args[1]); int vectorLength = Integer.parseInt(args[2]); int numPrincipalComponents = Integer.parseInt(args[3]); boolean whitening = true; boolean compact = false; PCA pca = new PCA(numPrincipalComponents, numTrainVectors, vectorLength, whitening); pca.setCompact(compact); // load the vectors into the PCA class Linear vladArray = new Linear(vectorLength, numTrainVectors, true, indexLocation, false, true, 0); for (int i = 0; i < numTrainVectors; i++) { pca.addSample(vladArray.getVector(i)); } // now we are able to perform SVD and compute the eigenvectors System.out.println("PCA computation started!"); long start = System.currentTimeMillis(); pca.computeBasis(); long end = System.currentTimeMillis(); System.out.println("PCA computation completed in " + (end - start) + " ms"); // now we can save the PCA matrix in a file String PCAfile = indexLocation + "pca_" + numTrainVectors + "_" + numPrincipalComponents + "_" + (end - start) + "ms.txt"; pca.savePCAToFile(PCAfile); }
java
public static void main(String[] args) throws Exception { String indexLocation = args[0]; int numTrainVectors = Integer.parseInt(args[1]); int vectorLength = Integer.parseInt(args[2]); int numPrincipalComponents = Integer.parseInt(args[3]); boolean whitening = true; boolean compact = false; PCA pca = new PCA(numPrincipalComponents, numTrainVectors, vectorLength, whitening); pca.setCompact(compact); // load the vectors into the PCA class Linear vladArray = new Linear(vectorLength, numTrainVectors, true, indexLocation, false, true, 0); for (int i = 0; i < numTrainVectors; i++) { pca.addSample(vladArray.getVector(i)); } // now we are able to perform SVD and compute the eigenvectors System.out.println("PCA computation started!"); long start = System.currentTimeMillis(); pca.computeBasis(); long end = System.currentTimeMillis(); System.out.println("PCA computation completed in " + (end - start) + " ms"); // now we can save the PCA matrix in a file String PCAfile = indexLocation + "pca_" + numTrainVectors + "_" + numPrincipalComponents + "_" + (end - start) + "ms.txt"; pca.savePCAToFile(PCAfile); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "String", "indexLocation", "=", "args", "[", "0", "]", ";", "int", "numTrainVectors", "=", "Integer", ".", "parseInt", "(", "args", "[", "1", "]", ")"...
This method can be used to learn a PCA projection matrix. @param args [0] full path to the location of the BDB store which contains the training vectors (use backslashes) @param args [1] number of vectors to use for learning (the first vectors will be used), e.g. 10000 @param args [2] length of the supplied vectors, e.g. 4096 (for VLAD+SURF vectors generated using 64 centroids) @param args [3] number of first principal components to be kept, e.g. 1024 @throws Exception
[ "This", "method", "can", "be", "used", "to", "learn", "a", "PCA", "projection", "matrix", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/dimreduction/PCALearningExample.java#L27-L56
aws/aws-sdk-java
aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java
WeeklyAutoScalingSchedule.withMonday
public WeeklyAutoScalingSchedule withMonday(java.util.Map<String, String> monday) { setMonday(monday); return this; }
java
public WeeklyAutoScalingSchedule withMonday(java.util.Map<String, String> monday) { setMonday(monday); return this; }
[ "public", "WeeklyAutoScalingSchedule", "withMonday", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "monday", ")", "{", "setMonday", "(", "monday", ")", ";", "return", "this", ";", "}" ]
<p> The schedule for Monday. </p> @param monday The schedule for Monday. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "schedule", "for", "Monday", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java#L137-L140
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.neq
public SDVariable neq(SDVariable x, SDVariable y) { return neq(null, x, y); }
java
public SDVariable neq(SDVariable x, SDVariable y) { return neq(null, x, y); }
[ "public", "SDVariable", "neq", "(", "SDVariable", "x", ",", "SDVariable", "y", ")", "{", "return", "neq", "(", "null", ",", "x", ",", "y", ")", ";", "}" ]
Not equal to operation: elementwise x != y<br> If x and y arrays have equal shape, the output shape is the same as these inputs.<br> Note: supports broadcasting if x and y have different shapes and are broadcastable.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param x Input 1 @param y Input 2 @return Output SDVariable with values 0 and 1 based on where the condition is satisfied
[ "Not", "equal", "to", "operation", ":", "elementwise", "x", "!", "=", "y<br", ">", "If", "x", "and", "y", "arrays", "have", "equal", "shape", "the", "output", "shape", "is", "the", "same", "as", "these", "inputs", ".", "<br", ">", "Note", ":", "suppo...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1323-L1325
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/bond/Bond.java
Bond.getSpread
public double getSpread(double bondPrice, Curve referenceCurve, AnalyticModel model) { GoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0); while(search.getAccuracy() > 1E-11 && !search.isDone()) { double x = search.getNextPoint(); double fx=getValueWithGivenSpreadOverCurve(0.0,referenceCurve,x,model); double y = (bondPrice-fx)*(bondPrice-fx); search.setValue(y); } return search.getBestPoint(); }
java
public double getSpread(double bondPrice, Curve referenceCurve, AnalyticModel model) { GoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0); while(search.getAccuracy() > 1E-11 && !search.isDone()) { double x = search.getNextPoint(); double fx=getValueWithGivenSpreadOverCurve(0.0,referenceCurve,x,model); double y = (bondPrice-fx)*(bondPrice-fx); search.setValue(y); } return search.getBestPoint(); }
[ "public", "double", "getSpread", "(", "double", "bondPrice", ",", "Curve", "referenceCurve", ",", "AnalyticModel", "model", ")", "{", "GoldenSectionSearch", "search", "=", "new", "GoldenSectionSearch", "(", "-", "2.0", ",", "2.0", ")", ";", "while", "(", "sear...
Returns the spread value such that the sum of cash flows of the bond discounted with a given reference curve with the additional spread coincides with a given price. @param bondPrice The target price as double. @param referenceCurve The reference curve used for discounting the coupon payments. @param model The model under which the product is valued. @return The optimal spread value.
[ "Returns", "the", "spread", "value", "such", "that", "the", "sum", "of", "cash", "flows", "of", "the", "bond", "discounted", "with", "a", "given", "reference", "curve", "with", "the", "additional", "spread", "coincides", "with", "a", "given", "price", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L270-L280
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java
StringConcatenation.splitLinesAndNewLines
protected List<String> splitLinesAndNewLines(String text) { if (text == null) return Collections.emptyList(); int idx = initialSegmentSize(text); if (idx == text.length()) { return Collections.singletonList(text); } return continueSplitting(text, idx); }
java
protected List<String> splitLinesAndNewLines(String text) { if (text == null) return Collections.emptyList(); int idx = initialSegmentSize(text); if (idx == text.length()) { return Collections.singletonList(text); } return continueSplitting(text, idx); }
[ "protected", "List", "<", "String", ">", "splitLinesAndNewLines", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "return", "Collections", ".", "emptyList", "(", ")", ";", "int", "idx", "=", "initialSegmentSize", "(", "text", ")", ...
Return a list of segments where each segment is either the content of a line in the given text or a line-break according to the configured delimiter. Existing line-breaks in the text will be replaced by this's instances delimiter. @param text the to-be-splitted text. May be <code>null</code>. @return a list of segments. Is never <code>null</code>.
[ "Return", "a", "list", "of", "segments", "where", "each", "segment", "is", "either", "the", "content", "of", "a", "line", "in", "the", "given", "text", "or", "a", "line", "-", "break", "according", "to", "the", "configured", "delimiter", ".", "Existing", ...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java#L582-L591
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/MultiPointImpl.java
MultiPointImpl.add
public void add(MultiVertexGeometryImpl src, int beginIndex, int endIndex) { int endIndexC = endIndex < 0 ? src.getPointCount() : endIndex; if (beginIndex < 0 || beginIndex > src.getPointCount() || endIndexC < beginIndex) throw new IllegalArgumentException(); if (beginIndex == endIndexC) return; mergeVertexDescription(src.getDescription()); int count = endIndexC - beginIndex; int oldPointCount = m_pointCount; resize(m_pointCount + count); _verifyAllStreams(); for (int iattrib = 0, nattrib = src.getDescription() .getAttributeCount(); iattrib < nattrib; iattrib++) { int semantics = src.getDescription()._getSemanticsImpl(iattrib); int ncomps = VertexDescription.getComponentCount(semantics); AttributeStreamBase stream = getAttributeStreamRef(semantics); AttributeStreamBase srcStream = src .getAttributeStreamRef(semantics); stream.insertRange(oldPointCount * ncomps, srcStream, beginIndex * ncomps, count * ncomps, true, 1, oldPointCount * ncomps); } }
java
public void add(MultiVertexGeometryImpl src, int beginIndex, int endIndex) { int endIndexC = endIndex < 0 ? src.getPointCount() : endIndex; if (beginIndex < 0 || beginIndex > src.getPointCount() || endIndexC < beginIndex) throw new IllegalArgumentException(); if (beginIndex == endIndexC) return; mergeVertexDescription(src.getDescription()); int count = endIndexC - beginIndex; int oldPointCount = m_pointCount; resize(m_pointCount + count); _verifyAllStreams(); for (int iattrib = 0, nattrib = src.getDescription() .getAttributeCount(); iattrib < nattrib; iattrib++) { int semantics = src.getDescription()._getSemanticsImpl(iattrib); int ncomps = VertexDescription.getComponentCount(semantics); AttributeStreamBase stream = getAttributeStreamRef(semantics); AttributeStreamBase srcStream = src .getAttributeStreamRef(semantics); stream.insertRange(oldPointCount * ncomps, srcStream, beginIndex * ncomps, count * ncomps, true, 1, oldPointCount * ncomps); } }
[ "public", "void", "add", "(", "MultiVertexGeometryImpl", "src", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "int", "endIndexC", "=", "endIndex", "<", "0", "?", "src", ".", "getPointCount", "(", ")", ":", "endIndex", ";", "if", "(", "begin...
Appends points from another MultiVertexGeometryImpl at the end of this one. @param src The source MultiVertexGeometryImpl
[ "Appends", "points", "from", "another", "MultiVertexGeometryImpl", "at", "the", "end", "of", "this", "one", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/MultiPointImpl.java#L90-L114
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/ESRegistry.java
ESRegistry.validateContract
private void validateContract(final Contract contract) throws RegistrationException { final String id = getApiId(contract); try { Get get = new Get.Builder(getIndexName(), id).type("api").build(); //$NON-NLS-1$ JestResult result = getClient().execute(get); if (!result.isSucceeded()) { String apiId = contract.getApiId(); String orgId = contract.getApiOrgId(); throw new ApiNotFoundException(Messages.i18n.format("ESRegistry.ApiNotFoundInOrg", apiId, orgId)); //$NON-NLS-1$ } } catch (IOException e) { throw new RegistrationException(Messages.i18n.format("ESRegistry.ErrorValidatingClient"), e); //$NON-NLS-1$ } }
java
private void validateContract(final Contract contract) throws RegistrationException { final String id = getApiId(contract); try { Get get = new Get.Builder(getIndexName(), id).type("api").build(); //$NON-NLS-1$ JestResult result = getClient().execute(get); if (!result.isSucceeded()) { String apiId = contract.getApiId(); String orgId = contract.getApiOrgId(); throw new ApiNotFoundException(Messages.i18n.format("ESRegistry.ApiNotFoundInOrg", apiId, orgId)); //$NON-NLS-1$ } } catch (IOException e) { throw new RegistrationException(Messages.i18n.format("ESRegistry.ErrorValidatingClient"), e); //$NON-NLS-1$ } }
[ "private", "void", "validateContract", "(", "final", "Contract", "contract", ")", "throws", "RegistrationException", "{", "final", "String", "id", "=", "getApiId", "(", "contract", ")", ";", "try", "{", "Get", "get", "=", "new", "Get", ".", "Builder", "(", ...
Ensures that the api referenced by the Contract at the head of the iterator actually exists (is published). @param contract @param apiMap
[ "Ensures", "that", "the", "api", "referenced", "by", "the", "Contract", "at", "the", "head", "of", "the", "iterator", "actually", "exists", "(", "is", "published", ")", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/ESRegistry.java#L161-L176
tvesalainen/util
security/src/main/java/org/vesalainen/net/ssl/SSLServerSocketChannel.java
SSLServerSocketChannel.open
public static SSLServerSocketChannel open(SocketAddress address) throws IOException { try { return open(address, SSLContext.getDefault()); } catch (NoSuchAlgorithmException ex) { throw new IOException(ex); } }
java
public static SSLServerSocketChannel open(SocketAddress address) throws IOException { try { return open(address, SSLContext.getDefault()); } catch (NoSuchAlgorithmException ex) { throw new IOException(ex); } }
[ "public", "static", "SSLServerSocketChannel", "open", "(", "SocketAddress", "address", ")", "throws", "IOException", "{", "try", "{", "return", "open", "(", "address", ",", "SSLContext", ".", "getDefault", "(", ")", ")", ";", "}", "catch", "(", "NoSuchAlgorith...
Creates and binds SSLServerSocketChannel using default SSLContext. @param address @return @throws IOException
[ "Creates", "and", "binds", "SSLServerSocketChannel", "using", "default", "SSLContext", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/SSLServerSocketChannel.java#L76-L86
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java
JavacElements.matchAnnoToTree
private JCTree matchAnnoToTree(AnnotationMirror findme, Element e, JCTree tree) { Symbol sym = cast(Symbol.class, e); class Vis extends JCTree.Visitor { List<JCAnnotation> result = null; public void visitPackageDef(JCPackageDecl tree) { result = tree.annotations; } public void visitClassDef(JCClassDecl tree) { result = tree.mods.annotations; } public void visitMethodDef(JCMethodDecl tree) { result = tree.mods.annotations; } public void visitVarDef(JCVariableDecl tree) { result = tree.mods.annotations; } @Override public void visitTypeParameter(JCTypeParameter tree) { result = tree.annotations; } } Vis vis = new Vis(); tree.accept(vis); if (vis.result == null) return null; List<Attribute.Compound> annos = sym.getAnnotationMirrors(); return matchAnnoToTree(cast(Attribute.Compound.class, findme), annos, vis.result); }
java
private JCTree matchAnnoToTree(AnnotationMirror findme, Element e, JCTree tree) { Symbol sym = cast(Symbol.class, e); class Vis extends JCTree.Visitor { List<JCAnnotation> result = null; public void visitPackageDef(JCPackageDecl tree) { result = tree.annotations; } public void visitClassDef(JCClassDecl tree) { result = tree.mods.annotations; } public void visitMethodDef(JCMethodDecl tree) { result = tree.mods.annotations; } public void visitVarDef(JCVariableDecl tree) { result = tree.mods.annotations; } @Override public void visitTypeParameter(JCTypeParameter tree) { result = tree.annotations; } } Vis vis = new Vis(); tree.accept(vis); if (vis.result == null) return null; List<Attribute.Compound> annos = sym.getAnnotationMirrors(); return matchAnnoToTree(cast(Attribute.Compound.class, findme), annos, vis.result); }
[ "private", "JCTree", "matchAnnoToTree", "(", "AnnotationMirror", "findme", ",", "Element", "e", ",", "JCTree", "tree", ")", "{", "Symbol", "sym", "=", "cast", "(", "Symbol", ".", "class", ",", "e", ")", ";", "class", "Vis", "extends", "JCTree", ".", "Vis...
Returns the tree for an annotation given the annotated element and the element's own tree. Returns null if the tree cannot be found.
[ "Returns", "the", "tree", "for", "an", "annotation", "given", "the", "annotated", "element", "and", "the", "element", "s", "own", "tree", ".", "Returns", "null", "if", "the", "tree", "cannot", "be", "found", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java#L257-L288
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.putShort
public static int putShort(byte[] bytes, int offset, short val) { if (bytes.length - offset < SIZEOF_SHORT) { throw new IllegalArgumentException("Not enough room to put a short at" + " offset " + offset + " in a " + bytes.length + " byte array"); } bytes[offset + 1] = (byte) val; val >>= 8; bytes[offset] = (byte) val; return offset + SIZEOF_SHORT; }
java
public static int putShort(byte[] bytes, int offset, short val) { if (bytes.length - offset < SIZEOF_SHORT) { throw new IllegalArgumentException("Not enough room to put a short at" + " offset " + offset + " in a " + bytes.length + " byte array"); } bytes[offset + 1] = (byte) val; val >>= 8; bytes[offset] = (byte) val; return offset + SIZEOF_SHORT; }
[ "public", "static", "int", "putShort", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "short", "val", ")", "{", "if", "(", "bytes", ".", "length", "-", "offset", "<", "SIZEOF_SHORT", ")", "{", "throw", "new", "IllegalArgumentException", "(", ...
Put a short value out to the specified byte array position. @param bytes the byte array @param offset position in the array @param val short to write out @return incremented offset @throws IllegalArgumentException if the byte array given doesn't have enough room at the offset specified.
[ "Put", "a", "short", "value", "out", "to", "the", "specified", "byte", "array", "position", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L676-L685
airbnb/lottie-android
lottie/src/main/java/com/airbnb/lottie/TextDelegate.java
TextDelegate.setText
public void setText(String input, String output) { stringMap.put(input, output); invalidate(); }
java
public void setText(String input, String output) { stringMap.put(input, output); invalidate(); }
[ "public", "void", "setText", "(", "String", "input", ",", "String", "output", ")", "{", "stringMap", ".", "put", "(", "input", ",", "output", ")", ";", "invalidate", "(", ")", ";", "}" ]
Update the text that will be rendered for the given input text.
[ "Update", "the", "text", "that", "will", "be", "rendered", "for", "the", "given", "input", "text", "." ]
train
https://github.com/airbnb/lottie-android/blob/126dabdc9f586c87822f85fe1128cdad439d30fa/lottie/src/main/java/com/airbnb/lottie/TextDelegate.java#L54-L57
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/HTTPFaxClientSpi.java
HTTPFaxClientSpi.submitHTTPRequest
protected HTTPResponse submitHTTPRequest(FaxJob faxJob,HTTPRequest httpRequest,FaxActionType faxActionType) { HTTPResponse httpResponse=null; if(httpRequest==null) { this.throwUnsupportedException(); } else { //setup default header properties Properties headerProperties=httpRequest.getHeaderProperties(); if(headerProperties==null) { headerProperties=new Properties(); httpRequest.setHeaderProperties(headerProperties); } //setup resource if(httpRequest.getResource()==null) { String resource=this.getHTTPResource(faxActionType); httpRequest.setResource(resource); } //setup URL parameters if(httpRequest.getParametersText()==null) { httpRequest.setParametersText(this.urlParameters); } //get HTTP method HTTPMethod httpMethod=this.httpClientConfiguration.getMethod(faxActionType); //submit HTTP request httpResponse=this.submitHTTPRequestImpl(httpRequest,httpMethod); //validate response status code int statusCode=httpResponse.getStatusCode(); if(statusCode>=400) { throw new FaxException("Error while invoking HTTP request, return status code: "+statusCode); } //update fax job this.updateFaxJob(faxJob,httpResponse,faxActionType); } return httpResponse; }
java
protected HTTPResponse submitHTTPRequest(FaxJob faxJob,HTTPRequest httpRequest,FaxActionType faxActionType) { HTTPResponse httpResponse=null; if(httpRequest==null) { this.throwUnsupportedException(); } else { //setup default header properties Properties headerProperties=httpRequest.getHeaderProperties(); if(headerProperties==null) { headerProperties=new Properties(); httpRequest.setHeaderProperties(headerProperties); } //setup resource if(httpRequest.getResource()==null) { String resource=this.getHTTPResource(faxActionType); httpRequest.setResource(resource); } //setup URL parameters if(httpRequest.getParametersText()==null) { httpRequest.setParametersText(this.urlParameters); } //get HTTP method HTTPMethod httpMethod=this.httpClientConfiguration.getMethod(faxActionType); //submit HTTP request httpResponse=this.submitHTTPRequestImpl(httpRequest,httpMethod); //validate response status code int statusCode=httpResponse.getStatusCode(); if(statusCode>=400) { throw new FaxException("Error while invoking HTTP request, return status code: "+statusCode); } //update fax job this.updateFaxJob(faxJob,httpResponse,faxActionType); } return httpResponse; }
[ "protected", "HTTPResponse", "submitHTTPRequest", "(", "FaxJob", "faxJob", ",", "HTTPRequest", "httpRequest", ",", "FaxActionType", "faxActionType", ")", "{", "HTTPResponse", "httpResponse", "=", "null", ";", "if", "(", "httpRequest", "==", "null", ")", "{", "this...
Submits the HTTP request and returns the HTTP response. @param faxJob The fax job object @param httpRequest The HTTP request to send @param faxActionType The fax action type @return The HTTP response
[ "Submits", "the", "HTTP", "request", "and", "returns", "the", "HTTP", "response", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/HTTPFaxClientSpi.java#L567-L615
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.heapify
public static CpcSketch heapify(final Memory mem, final long seed) { final CompressedState state = CompressedState.importFromMemory(mem); return uncompress(state, seed); }
java
public static CpcSketch heapify(final Memory mem, final long seed) { final CompressedState state = CompressedState.importFromMemory(mem); return uncompress(state, seed); }
[ "public", "static", "CpcSketch", "heapify", "(", "final", "Memory", "mem", ",", "final", "long", "seed", ")", "{", "final", "CompressedState", "state", "=", "CompressedState", ".", "importFromMemory", "(", "mem", ")", ";", "return", "uncompress", "(", "state",...
Return the given Memory as a CpcSketch on the Java heap. @param mem the given Memory @param seed the seed used to create the original sketch from which the Memory was derived. @return the given Memory as a CpcSketch on the Java heap.
[ "Return", "the", "given", "Memory", "as", "a", "CpcSketch", "on", "the", "Java", "heap", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L232-L235
google/closure-compiler
src/com/google/javascript/jscomp/Promises.java
Promises.createAsyncReturnableType
static final JSType createAsyncReturnableType(JSTypeRegistry registry, JSType maybeThenable) { JSType unknownType = registry.getNativeType(JSTypeNative.UNKNOWN_TYPE); ObjectType iThenableType = registry.getNativeObjectType(JSTypeNative.I_THENABLE_TYPE); JSType iThenableOfUnknownType = registry.createTemplatizedType(iThenableType, unknownType); ImmutableList<JSType> alternates = maybeThenable.isUnionType() ? maybeThenable.toMaybeUnionType().getAlternates() : ImmutableList.of(maybeThenable); ImmutableList<JSType> asyncTemplateAlternates = alternates.stream() .filter((t) -> t.isSubtypeOf(iThenableOfUnknownType)) // Discard "synchronous" types. .map((t) -> getTemplateTypeOfThenable(registry, t)) // Unwrap "asynchronous" types. .collect(toImmutableList()); if (asyncTemplateAlternates.isEmpty()) { return unknownType; } JSType asyncTemplateUnion = registry.createUnionType(asyncTemplateAlternates); return registry.createUnionType( asyncTemplateUnion, registry.createTemplatizedType(iThenableType, asyncTemplateUnion)); }
java
static final JSType createAsyncReturnableType(JSTypeRegistry registry, JSType maybeThenable) { JSType unknownType = registry.getNativeType(JSTypeNative.UNKNOWN_TYPE); ObjectType iThenableType = registry.getNativeObjectType(JSTypeNative.I_THENABLE_TYPE); JSType iThenableOfUnknownType = registry.createTemplatizedType(iThenableType, unknownType); ImmutableList<JSType> alternates = maybeThenable.isUnionType() ? maybeThenable.toMaybeUnionType().getAlternates() : ImmutableList.of(maybeThenable); ImmutableList<JSType> asyncTemplateAlternates = alternates.stream() .filter((t) -> t.isSubtypeOf(iThenableOfUnknownType)) // Discard "synchronous" types. .map((t) -> getTemplateTypeOfThenable(registry, t)) // Unwrap "asynchronous" types. .collect(toImmutableList()); if (asyncTemplateAlternates.isEmpty()) { return unknownType; } JSType asyncTemplateUnion = registry.createUnionType(asyncTemplateAlternates); return registry.createUnionType( asyncTemplateUnion, registry.createTemplatizedType(iThenableType, asyncTemplateUnion)); }
[ "static", "final", "JSType", "createAsyncReturnableType", "(", "JSTypeRegistry", "registry", ",", "JSType", "maybeThenable", ")", "{", "JSType", "unknownType", "=", "registry", ".", "getNativeType", "(", "JSTypeNative", ".", "UNKNOWN_TYPE", ")", ";", "ObjectType", "...
Synthesizes a type representing the legal types of a return expression within async code (i.e.`Promise` callbacks, async functions) based on the expected return type of that code. <p>The return type will generally be a union but may not be in the case of top-like types. If the expected return type is a union, any synchronous elements will be dropped, since they can never occur. For example: <ul> <li>`!Promise<number>` => `number|!IThenable<number>` <li>`number` => `?` <li>`number|!Promise<string>` => `string|!IThenable<string>` <li>`!IThenable<number>|!Promise<string>` => `number|string|!IThenable<number|string>` <li>`!IThenable<number|string>` => `number|string|!IThenable<number|string>` <li>`?` => `?` <li>`*` => `?` </ul>
[ "Synthesizes", "a", "type", "representing", "the", "legal", "types", "of", "a", "return", "expression", "within", "async", "code", "(", "i", ".", "e", ".", "Promise", "callbacks", "async", "functions", ")", "based", "on", "the", "expected", "return", "type",...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Promises.java#L144-L167