repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
wkgcass/Style | src/main/java/net/cassite/style/reflect/Reflect.java | Reflect.readOnly | public static <R> R readOnly(R toReadOnly) {
return proxy((p, m, args) -> If((Method) $($.readOnlyToSearch).forEach(s -> {
if (m.getName().contains(s))
return BreakWithResult(m);
else
return null;
}), rm -> {
if (rm.isAnnotationPresent(ReadOnly.class))
return m.invoke(toReadOnly, args);
else
throw new ModifyReadOnlyException(toReadOnly, m);
}).Else(() -> {
if (m.isAnnotationPresent(Writable.class))
throw new ModifyReadOnlyException(toReadOnly, m);
else
return m.invoke(toReadOnly, args);
}), toReadOnly);
} | java | public static <R> R readOnly(R toReadOnly) {
return proxy((p, m, args) -> If((Method) $($.readOnlyToSearch).forEach(s -> {
if (m.getName().contains(s))
return BreakWithResult(m);
else
return null;
}), rm -> {
if (rm.isAnnotationPresent(ReadOnly.class))
return m.invoke(toReadOnly, args);
else
throw new ModifyReadOnlyException(toReadOnly, m);
}).Else(() -> {
if (m.isAnnotationPresent(Writable.class))
throw new ModifyReadOnlyException(toReadOnly, m);
else
return m.invoke(toReadOnly, args);
}), toReadOnly);
} | [
"public",
"static",
"<",
"R",
">",
"R",
"readOnly",
"(",
"R",
"toReadOnly",
")",
"{",
"return",
"proxy",
"(",
"(",
"p",
",",
"m",
",",
"args",
")",
"->",
"If",
"(",
"(",
"Method",
")",
"$",
"(",
"$",
".",
"readOnlyToSearch",
")",
".",
"forEach",
... | Make an object which has interfaces to a read-only one.<br>
When an invocation comes, the InvocatinHandler will check the method.
<p>
<pre>
if methodName.contains elements in $.readOnlyToSearch
Check whether the method has ReadOnly annotation
if has
do invoking
else
throw an exception(ModifyReadOnlyException)
else
Check whether the method has Writable annotation
if has
throw an exception(ModifyReadOnlyException)
else
do invoking
</pre>
@param toReadOnly the object to be readonly
@return read-only object(dynamic proxy supported) | [
"Make",
"an",
"object",
"which",
"has",
"interfaces",
"to",
"a",
"read",
"-",
"only",
"one",
".",
"<br",
">",
"When",
"an",
"invocation",
"comes",
"the",
"InvocatinHandler",
"will",
"check",
"the",
"method",
".",
"<p",
">",
"<pre",
">",
"if",
"methodName... | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/reflect/Reflect.java#L138-L155 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java | UnsafeOperations.putLong | public final void putLong(Object parent, long offset, long value) {
THE_UNSAFE.putLong(parent, offset, value);
} | java | public final void putLong(Object parent, long offset, long value) {
THE_UNSAFE.putLong(parent, offset, value);
} | [
"public",
"final",
"void",
"putLong",
"(",
"Object",
"parent",
",",
"long",
"offset",
",",
"long",
"value",
")",
"{",
"THE_UNSAFE",
".",
"putLong",
"(",
"parent",
",",
"offset",
",",
"value",
")",
";",
"}"
] | Puts the value at the given offset of the supplied parent object
@param parent The Object's parent
@param offset The offset
@param value long to be put | [
"Puts",
"the",
"value",
"at",
"the",
"given",
"offset",
"of",
"the",
"supplied",
"parent",
"object"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L993-L995 |
mguymon/naether | src/main/java/com/tobedevoured/naether/util/Notation.java | Notation.getLocalPaths | public static List<String> getLocalPaths( String localRepoPath, List<String> notations ) throws NaetherException {
DefaultServiceLocator locator = new DefaultServiceLocator();
SimpleLocalRepositoryManagerFactory factory = new SimpleLocalRepositoryManagerFactory();
factory.initService( locator );
LocalRepository localRepo = new LocalRepository(localRepoPath);
LocalRepositoryManager manager = null;
try {
manager = factory.newInstance( localRepo );
} catch (NoLocalRepositoryManagerException e) {
throw new NaetherException( "Failed to initial local repository manage", e );
}
List<String> localPaths = new ArrayList<String>();
for ( String notation : notations ) {
Dependency dependency = new Dependency(new DefaultArtifact(notation), "compile");
File path = new File( localRepo.getBasedir(), manager.getPathForLocalArtifact( dependency.getArtifact() ) );
localPaths.add( path.toString() );
}
return localPaths;
} | java | public static List<String> getLocalPaths( String localRepoPath, List<String> notations ) throws NaetherException {
DefaultServiceLocator locator = new DefaultServiceLocator();
SimpleLocalRepositoryManagerFactory factory = new SimpleLocalRepositoryManagerFactory();
factory.initService( locator );
LocalRepository localRepo = new LocalRepository(localRepoPath);
LocalRepositoryManager manager = null;
try {
manager = factory.newInstance( localRepo );
} catch (NoLocalRepositoryManagerException e) {
throw new NaetherException( "Failed to initial local repository manage", e );
}
List<String> localPaths = new ArrayList<String>();
for ( String notation : notations ) {
Dependency dependency = new Dependency(new DefaultArtifact(notation), "compile");
File path = new File( localRepo.getBasedir(), manager.getPathForLocalArtifact( dependency.getArtifact() ) );
localPaths.add( path.toString() );
}
return localPaths;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getLocalPaths",
"(",
"String",
"localRepoPath",
",",
"List",
"<",
"String",
">",
"notations",
")",
"throws",
"NaetherException",
"{",
"DefaultServiceLocator",
"locator",
"=",
"new",
"DefaultServiceLocator",
"(",
")"... | Get local paths for notations
@param localRepoPath String path
@param notations List of notations
@return List of paths
@throws NaetherException exception | [
"Get",
"local",
"paths",
"for",
"notations"
] | train | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/java/com/tobedevoured/naether/util/Notation.java#L211-L233 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/PriorityQueue.java | PriorityQueue.siftDown | private void siftDown(int k, E x) {
if (comparator != null)
siftDownUsingComparator(k, x);
else
siftDownComparable(k, x);
} | java | private void siftDown(int k, E x) {
if (comparator != null)
siftDownUsingComparator(k, x);
else
siftDownComparable(k, x);
} | [
"private",
"void",
"siftDown",
"(",
"int",
"k",
",",
"E",
"x",
")",
"{",
"if",
"(",
"comparator",
"!=",
"null",
")",
"siftDownUsingComparator",
"(",
"k",
",",
"x",
")",
";",
"else",
"siftDownComparable",
"(",
"k",
",",
"x",
")",
";",
"}"
] | Inserts item x at position k, maintaining heap invariant by
demoting x down the tree repeatedly until it is less than or
equal to its children or is a leaf.
@param k the position to fill
@param x the item to insert | [
"Inserts",
"item",
"x",
"at",
"position",
"k",
"maintaining",
"heap",
"invariant",
"by",
"demoting",
"x",
"down",
"the",
"tree",
"repeatedly",
"until",
"it",
"is",
"less",
"than",
"or",
"equal",
"to",
"its",
"children",
"or",
"is",
"a",
"leaf",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/PriorityQueue.java#L685-L690 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java | FunctionsInner.retrieveDefaultDefinition | public FunctionInner retrieveDefaultDefinition(String resourceGroupName, String jobName, String functionName) {
return retrieveDefaultDefinitionWithServiceResponseAsync(resourceGroupName, jobName, functionName).toBlocking().single().body();
} | java | public FunctionInner retrieveDefaultDefinition(String resourceGroupName, String jobName, String functionName) {
return retrieveDefaultDefinitionWithServiceResponseAsync(resourceGroupName, jobName, functionName).toBlocking().single().body();
} | [
"public",
"FunctionInner",
"retrieveDefaultDefinition",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"functionName",
")",
"{",
"return",
"retrieveDefaultDefinitionWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
",",
"func... | Retrieves the default definition of a function based on the parameters specified.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param functionName The name of the function.
@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 FunctionInner object if successful. | [
"Retrieves",
"the",
"default",
"definition",
"of",
"a",
"function",
"based",
"on",
"the",
"parameters",
"specified",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java#L1300-L1302 |
liferay/com-liferay-commerce | commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java | CommerceCurrencyPersistenceImpl.fetchByG_C | @Override
public CommerceCurrency fetchByG_C(long groupId, String code) {
return fetchByG_C(groupId, code, true);
} | java | @Override
public CommerceCurrency fetchByG_C(long groupId, String code) {
return fetchByG_C(groupId, code, true);
} | [
"@",
"Override",
"public",
"CommerceCurrency",
"fetchByG_C",
"(",
"long",
"groupId",
",",
"String",
"code",
")",
"{",
"return",
"fetchByG_C",
"(",
"groupId",
",",
"code",
",",
"true",
")",
";",
"}"
] | Returns the commerce currency where groupId = ? and code = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param groupId the group ID
@param code the code
@return the matching commerce currency, or <code>null</code> if a matching commerce currency could not be found | [
"Returns",
"the",
"commerce",
"currency",
"where",
"groupId",
"=",
"?",
";",
"and",
"code",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L2046-L2049 |
jhy/jsoup | src/main/java/org/jsoup/parser/Parser.java | Parser.parseBodyFragment | public static Document parseBodyFragment(String bodyHtml, String baseUri) {
Document doc = Document.createShell(baseUri);
Element body = doc.body();
List<Node> nodeList = parseFragment(bodyHtml, body, baseUri);
Node[] nodes = nodeList.toArray(new Node[0]); // the node list gets modified when re-parented
for (int i = nodes.length - 1; i > 0; i--) {
nodes[i].remove();
}
for (Node node : nodes) {
body.appendChild(node);
}
return doc;
} | java | public static Document parseBodyFragment(String bodyHtml, String baseUri) {
Document doc = Document.createShell(baseUri);
Element body = doc.body();
List<Node> nodeList = parseFragment(bodyHtml, body, baseUri);
Node[] nodes = nodeList.toArray(new Node[0]); // the node list gets modified when re-parented
for (int i = nodes.length - 1; i > 0; i--) {
nodes[i].remove();
}
for (Node node : nodes) {
body.appendChild(node);
}
return doc;
} | [
"public",
"static",
"Document",
"parseBodyFragment",
"(",
"String",
"bodyHtml",
",",
"String",
"baseUri",
")",
"{",
"Document",
"doc",
"=",
"Document",
".",
"createShell",
"(",
"baseUri",
")",
";",
"Element",
"body",
"=",
"doc",
".",
"body",
"(",
")",
";",... | Parse a fragment of HTML into the {@code body} of a Document.
@param bodyHtml fragment of HTML
@param baseUri base URI of document (i.e. original fetch location), for resolving relative URLs.
@return Document, with empty head, and HTML parsed into body | [
"Parse",
"a",
"fragment",
"of",
"HTML",
"into",
"the",
"{",
"@code",
"body",
"}",
"of",
"a",
"Document",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/Parser.java#L163-L175 |
apache/incubator-druid | extensions-contrib/graphite-emitter/src/main/java/org/apache/druid/emitter/graphite/WhiteListBasedConverter.java | WhiteListBasedConverter.getPrefixKey | private String getPrefixKey(String key, SortedMap<String, ?> whiteList)
{
String prefixKey = null;
if (whiteList.containsKey(key)) {
return key;
}
SortedMap<String, ?> headMap = whiteList.headMap(key);
if (!headMap.isEmpty() && key.startsWith(headMap.lastKey())) {
prefixKey = headMap.lastKey();
}
return prefixKey;
} | java | private String getPrefixKey(String key, SortedMap<String, ?> whiteList)
{
String prefixKey = null;
if (whiteList.containsKey(key)) {
return key;
}
SortedMap<String, ?> headMap = whiteList.headMap(key);
if (!headMap.isEmpty() && key.startsWith(headMap.lastKey())) {
prefixKey = headMap.lastKey();
}
return prefixKey;
} | [
"private",
"String",
"getPrefixKey",
"(",
"String",
"key",
",",
"SortedMap",
"<",
"String",
",",
"?",
">",
"whiteList",
")",
"{",
"String",
"prefixKey",
"=",
"null",
";",
"if",
"(",
"whiteList",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
... | @param key the metric name to lookup
@param whiteList
@return <tt>null</tt> if the key does not match with any of the prefixes keys in @code metricsWhiteList,
or the prefix in @code whiteListDimsMapper | [
"@param",
"key",
"the",
"metric",
"name",
"to",
"lookup",
"@param",
"whiteList"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-contrib/graphite-emitter/src/main/java/org/apache/druid/emitter/graphite/WhiteListBasedConverter.java#L141-L152 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomDataWriter.java | AtomDataWriter.marshallPrimitive | private void marshallPrimitive(Object value, PrimitiveType primitiveType) throws XMLStreamException {
LOG.trace("Primitive value: {} of type: {}", value, primitiveType);
if (value != null) {
xmlWriter.writeCharacters(value.toString());
}
} | java | private void marshallPrimitive(Object value, PrimitiveType primitiveType) throws XMLStreamException {
LOG.trace("Primitive value: {} of type: {}", value, primitiveType);
if (value != null) {
xmlWriter.writeCharacters(value.toString());
}
} | [
"private",
"void",
"marshallPrimitive",
"(",
"Object",
"value",
",",
"PrimitiveType",
"primitiveType",
")",
"throws",
"XMLStreamException",
"{",
"LOG",
".",
"trace",
"(",
"\"Primitive value: {} of type: {}\"",
",",
"value",
",",
"primitiveType",
")",
";",
"if",
"(",... | Marshall a primitive value.
@param value The value to marshall. Can be {@code null}.
@param primitiveType The OData primitive type. | [
"Marshall",
"a",
"primitive",
"value",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomDataWriter.java#L143-L149 |
alkacon/opencms-core | src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java | CmsContentEditor.registerClonedEntity | public void registerClonedEntity(String sourceEntityId, String targetEntityId) {
CmsEntityBackend.getInstance().getEntity(sourceEntityId).createDeepCopy(targetEntityId);
} | java | public void registerClonedEntity(String sourceEntityId, String targetEntityId) {
CmsEntityBackend.getInstance().getEntity(sourceEntityId).createDeepCopy(targetEntityId);
} | [
"public",
"void",
"registerClonedEntity",
"(",
"String",
"sourceEntityId",
",",
"String",
"targetEntityId",
")",
"{",
"CmsEntityBackend",
".",
"getInstance",
"(",
")",
".",
"getEntity",
"(",
"sourceEntityId",
")",
".",
"createDeepCopy",
"(",
"targetEntityId",
")",
... | Registers a deep copy of the source entity with the given target entity id.<p>
@param sourceEntityId the source entity id
@param targetEntityId the target entity id | [
"Registers",
"a",
"deep",
"copy",
"of",
"the",
"source",
"entity",
"with",
"the",
"given",
"target",
"entity",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java#L985-L988 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java | OmemoService.createOmemoMessage | OmemoMessage.Sent createOmemoMessage(OmemoManager.LoggedInOmemoManager managerGuard,
Set<OmemoDevice> contactsDevices,
String message)
throws InterruptedException, UndecidedOmemoIdentityException, CryptoFailedException,
SmackException.NotConnectedException, SmackException.NoResponseException {
byte[] key, iv;
iv = OmemoMessageBuilder.generateIv();
try {
key = OmemoMessageBuilder.generateKey(KEYTYPE, KEYLENGTH);
} catch (NoSuchAlgorithmException e) {
throw new CryptoFailedException(e);
}
return encrypt(managerGuard, contactsDevices, key, iv, message);
} | java | OmemoMessage.Sent createOmemoMessage(OmemoManager.LoggedInOmemoManager managerGuard,
Set<OmemoDevice> contactsDevices,
String message)
throws InterruptedException, UndecidedOmemoIdentityException, CryptoFailedException,
SmackException.NotConnectedException, SmackException.NoResponseException {
byte[] key, iv;
iv = OmemoMessageBuilder.generateIv();
try {
key = OmemoMessageBuilder.generateKey(KEYTYPE, KEYLENGTH);
} catch (NoSuchAlgorithmException e) {
throw new CryptoFailedException(e);
}
return encrypt(managerGuard, contactsDevices, key, iv, message);
} | [
"OmemoMessage",
".",
"Sent",
"createOmemoMessage",
"(",
"OmemoManager",
".",
"LoggedInOmemoManager",
"managerGuard",
",",
"Set",
"<",
"OmemoDevice",
">",
"contactsDevices",
",",
"String",
"message",
")",
"throws",
"InterruptedException",
",",
"UndecidedOmemoIdentityExcept... | Create an OmemoMessage.
@param managerGuard initialized OmemoManager
@param contactsDevices set of recipient devices
@param message message we want to send
@return encrypted OmemoMessage
@throws InterruptedException
@throws UndecidedOmemoIdentityException if the list of recipient devices contains an undecided device.
@throws CryptoFailedException if we are lacking some cryptographic algorithms
@throws SmackException.NotConnectedException
@throws SmackException.NoResponseException | [
"Create",
"an",
"OmemoMessage",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L521-L537 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/PropertyMetadata.java | PropertyMetadata.initializeMapper | private Mapper initializeMapper() {
try {
return MapperFactory.getInstance().getMapper(field);
} catch (NoSuitableMapperException exp) {
String message = String.format(
"No suitable mapper found or error occurred creating a mapper for field %s in class %s",
field.getName(), field.getDeclaringClass().getName());
throw new NoSuitableMapperException(message, exp);
}
} | java | private Mapper initializeMapper() {
try {
return MapperFactory.getInstance().getMapper(field);
} catch (NoSuitableMapperException exp) {
String message = String.format(
"No suitable mapper found or error occurred creating a mapper for field %s in class %s",
field.getName(), field.getDeclaringClass().getName());
throw new NoSuitableMapperException(message, exp);
}
} | [
"private",
"Mapper",
"initializeMapper",
"(",
")",
"{",
"try",
"{",
"return",
"MapperFactory",
".",
"getInstance",
"(",
")",
".",
"getMapper",
"(",
"field",
")",
";",
"}",
"catch",
"(",
"NoSuitableMapperException",
"exp",
")",
"{",
"String",
"message",
"=",
... | Initializes the {@link Mapper} for this field.
@return the {@link Mapper} for the field represented by this metadata | [
"Initializes",
"the",
"{",
"@link",
"Mapper",
"}",
"for",
"this",
"field",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/PropertyMetadata.java#L245-L254 |
algolia/instantsearch-android | core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java | Searcher.create | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public static Searcher create(@NonNull final Searchable index, @NonNull String variant) {
Searcher instance = instances.get(variant);
if (instance == null || instance.getSearchable() != index) {
instance = new Searcher(index, variant);
instances.put(variant, instance);
}
return instance;
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public static Searcher create(@NonNull final Searchable index, @NonNull String variant) {
Searcher instance = instances.get(variant);
if (instance == null || instance.getSearchable() != index) {
instance = new Searcher(index, variant);
instances.put(variant, instance);
}
return instance;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"static",
"Searcher",
"create",
"(",
"@",
"NonNull",
"final",
"Searchable",
"index",
",",
"@",
"NonNull",
"String",
"variant",
")",
"{",
"Search... | Constructs the Searcher from an existing {@link Index}, eventually replacing the existing searcher for {@code variant}.
@param variant an identifier to differentiate this Searcher from eventual others using the same index. Defaults to the index's name.
@param index an Index initialized and eventually configured.
@return the new instance. | [
"Constructs",
"the",
"Searcher",
"from",
"an",
"existing",
"{",
"@link",
"Index",
"}",
"eventually",
"replacing",
"the",
"existing",
"searcher",
"for",
"{",
"@code",
"variant",
"}",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L227-L235 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.fromFuture | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> fromFuture(Future<? extends T> future) {
ObjectHelper.requireNonNull(future, "future is null");
return RxJavaPlugins.onAssembly(new FlowableFromFuture<T>(future, 0L, null));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> fromFuture(Future<? extends T> future) {
ObjectHelper.requireNonNull(future, "future is null");
return RxJavaPlugins.onAssembly(new FlowableFromFuture<T>(future, 0L, null));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"static",
"<",
"T",
">",
"Flowable",
"<",
"T",
">",
"fromFuture",
"(",
"Future",
"<",
... | Converts a {@link Future} into a Publisher.
<p>
<img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/from.Future.png" alt="">
<p>
You can convert any object that supports the {@link Future} interface into a Publisher that emits the
return value of the {@link Future#get} method of that object by passing the object into the {@code from}
method.
<p>
<em>Important note:</em> This Publisher is blocking on the thread it gets subscribed on; you cannot cancel it.
<p>
Unlike 1.x, canceling the Flowable won't cancel the future. If necessary, one can use composition to achieve the
cancellation effect: {@code futurePublisher.doOnCancel(() -> future.cancel(true));}.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param future
the source {@link Future}
@param <T>
the type of object that the {@link Future} returns, and also the type of item to be emitted by
the resulting Publisher
@return a Flowable that emits the item from the source {@link Future}
@see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> | [
"Converts",
"a",
"{",
"@link",
"Future",
"}",
"into",
"a",
"Publisher",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"315",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L2012-L2018 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java | SqlGeneratorDefaultImpl.getPreparedInsertStatement | public SqlStatement getPreparedInsertStatement(ClassDescriptor cld)
{
SqlStatement sql;
SqlForClass sfc = getSqlForClass(cld);
sql = sfc.getInsertSql();
if(sql == null)
{
ProcedureDescriptor pd = cld.getInsertProcedure();
if(pd == null)
{
sql = new SqlInsertStatement(cld, logger);
}
else
{
sql = new SqlProcedureStatement(pd, logger);
}
// set the sql string
sfc.setInsertSql(sql);
if(logger.isDebugEnabled())
{
logger.debug("SQL:" + sql.getStatement());
}
}
return sql;
} | java | public SqlStatement getPreparedInsertStatement(ClassDescriptor cld)
{
SqlStatement sql;
SqlForClass sfc = getSqlForClass(cld);
sql = sfc.getInsertSql();
if(sql == null)
{
ProcedureDescriptor pd = cld.getInsertProcedure();
if(pd == null)
{
sql = new SqlInsertStatement(cld, logger);
}
else
{
sql = new SqlProcedureStatement(pd, logger);
}
// set the sql string
sfc.setInsertSql(sql);
if(logger.isDebugEnabled())
{
logger.debug("SQL:" + sql.getStatement());
}
}
return sql;
} | [
"public",
"SqlStatement",
"getPreparedInsertStatement",
"(",
"ClassDescriptor",
"cld",
")",
"{",
"SqlStatement",
"sql",
";",
"SqlForClass",
"sfc",
"=",
"getSqlForClass",
"(",
"cld",
")",
";",
"sql",
"=",
"sfc",
".",
"getInsertSql",
"(",
")",
";",
"if",
"(",
... | generate a prepared INSERT-Statement for the Class
described by cld.
@param cld the ClassDescriptor | [
"generate",
"a",
"prepared",
"INSERT",
"-",
"Statement",
"for",
"the",
"Class",
"described",
"by",
"cld",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L108-L134 |
zxing/zxing | android/src/com/google/zxing/client/android/result/ResultHandler.java | ResultHandler.searchMap | final void searchMap(String address) {
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(address))));
} | java | final void searchMap(String address) {
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(address))));
} | [
"final",
"void",
"searchMap",
"(",
"String",
"address",
")",
"{",
"launchIntent",
"(",
"new",
"Intent",
"(",
"Intent",
".",
"ACTION_VIEW",
",",
"Uri",
".",
"parse",
"(",
"\"geo:0,0?q=\"",
"+",
"Uri",
".",
"encode",
"(",
"address",
")",
")",
")",
")",
"... | Do a geo search using the address as the query.
@param address The address to find | [
"Do",
"a",
"geo",
"search",
"using",
"the",
"address",
"as",
"the",
"query",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/ResultHandler.java#L405-L407 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java | JsJmsMapMessageImpl.setShort | public void setShort(String name, short value) throws UnsupportedEncodingException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setShort", Short.valueOf(value));
getBodyMap().put(name, Short.valueOf(value));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setShort");
} | java | public void setShort(String name, short value) throws UnsupportedEncodingException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setShort", Short.valueOf(value));
getBodyMap().put(name, Short.valueOf(value));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setShort");
} | [
"public",
"void",
"setShort",
"(",
"String",
"name",
",",
"short",
"value",
")",
"throws",
"UnsupportedEncodingException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
... | /*
Set a short value with the given name, into the Map.
Javadoc description supplied by JsJmsMessage interface. | [
"/",
"*",
"Set",
"a",
"short",
"value",
"with",
"the",
"given",
"name",
"into",
"the",
"Map",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java#L294-L298 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.backupCertificateAsync | public ServiceFuture<BackupCertificateResult> backupCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<BackupCertificateResult> serviceCallback) {
return ServiceFuture.fromResponse(backupCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | java | public ServiceFuture<BackupCertificateResult> backupCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<BackupCertificateResult> serviceCallback) {
return ServiceFuture.fromResponse(backupCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"BackupCertificateResult",
">",
"backupCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"final",
"ServiceCallback",
"<",
"BackupCertificateResult",
">",
"serviceCallback",
")",
"{",
"return",
"Service... | Backs up the specified certificate.
Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate will be downloaded. This operation requires the certificates/backup permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Backs",
"up",
"the",
"specified",
"certificate",
".",
"Requests",
"that",
"a",
"backup",
"of",
"the",
"specified",
"certificate",
"be",
"downloaded",
"to",
"the",
"client",
".",
"All",
"versions",
"of",
"the",
"certificate",
"will",
"be",
"downloaded",
".",
... | 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#L8129-L8131 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/http/AbstractMfClientHttpRequestFactoryWrapper.java | AbstractMfClientHttpRequestFactoryWrapper.createRequest | public final ClientHttpRequest createRequest(
final URI uri,
final HttpMethod httpMethod) throws IOException {
if (uri.getScheme() == null || uri.getScheme().equals("file") ||
this.matchers.matches(uri, httpMethod)) {
return createRequest(uri, httpMethod, this.wrappedFactory);
} else if (this.failIfNotMatch) {
throw new IllegalArgumentException(uri + " is denied.");
} else {
return this.wrappedFactory.createRequest(uri, httpMethod);
}
} | java | public final ClientHttpRequest createRequest(
final URI uri,
final HttpMethod httpMethod) throws IOException {
if (uri.getScheme() == null || uri.getScheme().equals("file") ||
this.matchers.matches(uri, httpMethod)) {
return createRequest(uri, httpMethod, this.wrappedFactory);
} else if (this.failIfNotMatch) {
throw new IllegalArgumentException(uri + " is denied.");
} else {
return this.wrappedFactory.createRequest(uri, httpMethod);
}
} | [
"public",
"final",
"ClientHttpRequest",
"createRequest",
"(",
"final",
"URI",
"uri",
",",
"final",
"HttpMethod",
"httpMethod",
")",
"throws",
"IOException",
"{",
"if",
"(",
"uri",
".",
"getScheme",
"(",
")",
"==",
"null",
"||",
"uri",
".",
"getScheme",
"(",
... | This implementation simply calls {@link #createRequest(URI, HttpMethod, MfClientHttpRequestFactory)}
(if the matchers are OK) with the wrapped request factory provided to the {@linkplain
#AbstractMfClientHttpRequestFactoryWrapper(MfClientHttpRequestFactory, UriMatchers, boolean)
constructor}.
@param uri the URI to create a request for
@param httpMethod the HTTP method to execute | [
"This",
"implementation",
"simply",
"calls",
"{",
"@link",
"#createRequest",
"(",
"URI",
"HttpMethod",
"MfClientHttpRequestFactory",
")",
"}",
"(",
"if",
"the",
"matchers",
"are",
"OK",
")",
"with",
"the",
"wrapped",
"request",
"factory",
"provided",
"to",
"the"... | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/http/AbstractMfClientHttpRequestFactoryWrapper.java#L48-L59 |
threerings/narya | core/src/main/java/com/threerings/presents/client/Client.java | Client.moveToServer | public void moveToServer (String hostname, int[] ports, InvocationService.ConfirmListener obs)
{
moveToServer(hostname, ports, new int[0], obs);
} | java | public void moveToServer (String hostname, int[] ports, InvocationService.ConfirmListener obs)
{
moveToServer(hostname, ports, new int[0], obs);
} | [
"public",
"void",
"moveToServer",
"(",
"String",
"hostname",
",",
"int",
"[",
"]",
"ports",
",",
"InvocationService",
".",
"ConfirmListener",
"obs",
")",
"{",
"moveToServer",
"(",
"hostname",
",",
"ports",
",",
"new",
"int",
"[",
"0",
"]",
",",
"obs",
")... | Transitions a logged on client from its current server to the specified new server.
Currently this simply logs the client off of its current server (if it is logged on) and
logs it onto the new server, but in the future we may aim to do something fancier.
<p> If we fail to connect to the new server, the client <em>will not</em> be automatically
reconnected to the old server. It will be in a logged off state. However, it will be
reconfigured with the hostname and ports of the old server so that the caller can notify the
user of the failure and then simply call {@link #logon} to attempt to reconnect to the old
server.
@param obs an observer that will be notified when we have successfully logged onto the
other server, or if the move failed. | [
"Transitions",
"a",
"logged",
"on",
"client",
"from",
"its",
"current",
"server",
"to",
"the",
"specified",
"new",
"server",
".",
"Currently",
"this",
"simply",
"logs",
"the",
"client",
"off",
"of",
"its",
"current",
"server",
"(",
"if",
"it",
"is",
"logge... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/Client.java#L553-L556 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java | vpnintranetapplication.get | public static vpnintranetapplication get(nitro_service service, String intranetapplication) throws Exception{
vpnintranetapplication obj = new vpnintranetapplication();
obj.set_intranetapplication(intranetapplication);
vpnintranetapplication response = (vpnintranetapplication) obj.get_resource(service);
return response;
} | java | public static vpnintranetapplication get(nitro_service service, String intranetapplication) throws Exception{
vpnintranetapplication obj = new vpnintranetapplication();
obj.set_intranetapplication(intranetapplication);
vpnintranetapplication response = (vpnintranetapplication) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpnintranetapplication",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"intranetapplication",
")",
"throws",
"Exception",
"{",
"vpnintranetapplication",
"obj",
"=",
"new",
"vpnintranetapplication",
"(",
")",
";",
"obj",
".",
"set_intranet... | Use this API to fetch vpnintranetapplication resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnintranetapplication",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java#L437-L442 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cli/CliClient.java | CliClient.executeAddKeySpace | private void executeAddKeySpace(Tree statement)
{
if (!CliMain.isConnected())
return;
// first value is the keyspace name, after that it is all key=value
String keyspaceName = CliUtils.unescapeSQLString(statement.getChild(0).getText());
KsDef ksDef = new KsDef(keyspaceName, DEFAULT_PLACEMENT_STRATEGY, new LinkedList<CfDef>());
try
{
String mySchemaVersion = thriftClient.system_add_keyspace(updateKsDefAttributes(statement, ksDef));
sessionState.out.println(mySchemaVersion);
keyspacesMap.put(keyspaceName, thriftClient.describe_keyspace(keyspaceName));
}
catch (InvalidRequestException e)
{
throw new RuntimeException(e);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
} | java | private void executeAddKeySpace(Tree statement)
{
if (!CliMain.isConnected())
return;
// first value is the keyspace name, after that it is all key=value
String keyspaceName = CliUtils.unescapeSQLString(statement.getChild(0).getText());
KsDef ksDef = new KsDef(keyspaceName, DEFAULT_PLACEMENT_STRATEGY, new LinkedList<CfDef>());
try
{
String mySchemaVersion = thriftClient.system_add_keyspace(updateKsDefAttributes(statement, ksDef));
sessionState.out.println(mySchemaVersion);
keyspacesMap.put(keyspaceName, thriftClient.describe_keyspace(keyspaceName));
}
catch (InvalidRequestException e)
{
throw new RuntimeException(e);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
} | [
"private",
"void",
"executeAddKeySpace",
"(",
"Tree",
"statement",
")",
"{",
"if",
"(",
"!",
"CliMain",
".",
"isConnected",
"(",
")",
")",
"return",
";",
"// first value is the keyspace name, after that it is all key=value",
"String",
"keyspaceName",
"=",
"CliUtils",
... | Add a keyspace
@param statement - a token tree representing current statement | [
"Add",
"a",
"keyspace"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L1073-L1098 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/service/api/SwaggerAnnotationsReader.java | SwaggerAnnotationsReader.read | public static void read(Swagger swagger, Set<Class<?>> classes) {
final SwaggerAnnotationsReader reader = new SwaggerAnnotationsReader(swagger);
for (Class<?> cls : classes) {
final ReaderContext context = new ReaderContext(swagger, cls, "", null, false, new ArrayList<>(),
new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
reader.read(context);
}
} | java | public static void read(Swagger swagger, Set<Class<?>> classes) {
final SwaggerAnnotationsReader reader = new SwaggerAnnotationsReader(swagger);
for (Class<?> cls : classes) {
final ReaderContext context = new ReaderContext(swagger, cls, "", null, false, new ArrayList<>(),
new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
reader.read(context);
}
} | [
"public",
"static",
"void",
"read",
"(",
"Swagger",
"swagger",
",",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
")",
"{",
"final",
"SwaggerAnnotationsReader",
"reader",
"=",
"new",
"SwaggerAnnotationsReader",
"(",
"swagger",
")",
";",
"for",
"(",
"... | Scans a set of classes for Swagger annotations.
@param swagger is the Swagger instance
@param classes are a set of classes to scan | [
"Scans",
"a",
"set",
"of",
"classes",
"for",
"Swagger",
"annotations",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/api/SwaggerAnnotationsReader.java#L65-L72 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.updateInstances | public OperationStatusResponseInner updateInstances(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body();
} | java | public OperationStatusResponseInner updateInstances(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body();
} | [
"public",
"OperationStatusResponseInner",
"updateInstances",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"List",
"<",
"String",
">",
"instanceIds",
")",
"{",
"return",
"updateInstancesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceIds The virtual machine scale set instance ids.
@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 OperationStatusResponseInner object if successful. | [
"Upgrades",
"one",
"or",
"more",
"virtual",
"machines",
"to",
"the",
"latest",
"SKU",
"set",
"in",
"the",
"VM",
"scale",
"set",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L2714-L2716 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/mojo/ConfigureJMeterMojo.java | ConfigureJMeterMojo.copyTransitiveRuntimeDependenciesToLibDirectory | private void copyTransitiveRuntimeDependenciesToLibDirectory(Artifact artifact, boolean getDependenciesOfDependency) throws MojoExecutionException {
copyTransitiveRuntimeDependenciesToLibDirectory(new Dependency(artifact, DEPENDENCIES_DEFAULT_SEARCH_SCOPE), getDependenciesOfDependency);
} | java | private void copyTransitiveRuntimeDependenciesToLibDirectory(Artifact artifact, boolean getDependenciesOfDependency) throws MojoExecutionException {
copyTransitiveRuntimeDependenciesToLibDirectory(new Dependency(artifact, DEPENDENCIES_DEFAULT_SEARCH_SCOPE), getDependenciesOfDependency);
} | [
"private",
"void",
"copyTransitiveRuntimeDependenciesToLibDirectory",
"(",
"Artifact",
"artifact",
",",
"boolean",
"getDependenciesOfDependency",
")",
"throws",
"MojoExecutionException",
"{",
"copyTransitiveRuntimeDependenciesToLibDirectory",
"(",
"new",
"Dependency",
"(",
"artif... | Collate a list of transitive runtime dependencies that need to be copied to the /lib directory and then copy them there.
@param artifact The artifact that is a transitive dependency
@param getDependenciesOfDependency get dependencies of dependency
@throws MojoExecutionException MojoExecutionException | [
"Collate",
"a",
"list",
"of",
"transitive",
"runtime",
"dependencies",
"that",
"need",
"to",
"be",
"copied",
"to",
"the",
"/",
"lib",
"directory",
"and",
"then",
"copy",
"them",
"there",
"."
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/mojo/ConfigureJMeterMojo.java#L536-L538 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.deleteTag | public void deleteTag(UUID projectId, UUID tagId) {
deleteTagWithServiceResponseAsync(projectId, tagId).toBlocking().single().body();
} | java | public void deleteTag(UUID projectId, UUID tagId) {
deleteTagWithServiceResponseAsync(projectId, tagId).toBlocking().single().body();
} | [
"public",
"void",
"deleteTag",
"(",
"UUID",
"projectId",
",",
"UUID",
"tagId",
")",
"{",
"deleteTagWithServiceResponseAsync",
"(",
"projectId",
",",
"tagId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Delete a tag from the project.
@param projectId The project id
@param tagId Id of the tag to be deleted
@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 | [
"Delete",
"a",
"tag",
"from",
"the",
"project",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L692-L694 |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/JSONReader.java | JSONReader._with | protected JSONReader _with(int features,
ValueReaderLocator td, TreeCodec tc, CollectionBuilder lb, MapBuilder mb)
{
if (getClass() != JSONReader.class) { // sanity check
throw new IllegalStateException("Sub-classes MUST override _with(...)");
}
return new JSONReader(features, td, tc, lb, mb);
} | java | protected JSONReader _with(int features,
ValueReaderLocator td, TreeCodec tc, CollectionBuilder lb, MapBuilder mb)
{
if (getClass() != JSONReader.class) { // sanity check
throw new IllegalStateException("Sub-classes MUST override _with(...)");
}
return new JSONReader(features, td, tc, lb, mb);
} | [
"protected",
"JSONReader",
"_with",
"(",
"int",
"features",
",",
"ValueReaderLocator",
"td",
",",
"TreeCodec",
"tc",
",",
"CollectionBuilder",
"lb",
",",
"MapBuilder",
"mb",
")",
"{",
"if",
"(",
"getClass",
"(",
")",
"!=",
"JSONReader",
".",
"class",
")",
... | Overridable method that all mutant factories call if a new instance
is to be constructed | [
"Overridable",
"method",
"that",
"all",
"mutant",
"factories",
"call",
"if",
"a",
"new",
"instance",
"is",
"to",
"be",
"constructed"
] | train | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/JSONReader.java#L121-L128 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FuncSystemProperty.java | FuncSystemProperty.loadPropertyFile | public void loadPropertyFile(String file, Properties target)
{
try
{
// Use SecuritySupport class to provide priveleged access to property file
SecuritySupport ss = SecuritySupport.getInstance();
InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
// get a buffered version
BufferedInputStream bis = new BufferedInputStream(is);
target.load(bis); // and load up the property bag from this
bis.close(); // close out after reading
}
catch (Exception ex)
{
// ex.printStackTrace();
throw new org.apache.xml.utils.WrappedRuntimeException(ex);
}
} | java | public void loadPropertyFile(String file, Properties target)
{
try
{
// Use SecuritySupport class to provide priveleged access to property file
SecuritySupport ss = SecuritySupport.getInstance();
InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
// get a buffered version
BufferedInputStream bis = new BufferedInputStream(is);
target.load(bis); // and load up the property bag from this
bis.close(); // close out after reading
}
catch (Exception ex)
{
// ex.printStackTrace();
throw new org.apache.xml.utils.WrappedRuntimeException(ex);
}
} | [
"public",
"void",
"loadPropertyFile",
"(",
"String",
"file",
",",
"Properties",
"target",
")",
"{",
"try",
"{",
"// Use SecuritySupport class to provide priveleged access to property file",
"SecuritySupport",
"ss",
"=",
"SecuritySupport",
".",
"getInstance",
"(",
")",
";"... | Retrieve a propery bundle from a specified file
@param file The string name of the property file. The name
should already be fully qualified as path/filename
@param target The target property bag the file will be placed into. | [
"Retrieve",
"a",
"propery",
"bundle",
"from",
"a",
"specified",
"file"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FuncSystemProperty.java#L176-L197 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/struct/flow/ImageFlow.java | ImageFlow.reshape | public void reshape( int width , int height ) {
int N = width*height;
if( data.length < N ) {
D tmp[] = new D[N];
System.arraycopy(data,0,tmp,0,data.length);
for( int i = data.length; i < N; i++ )
tmp[i] = new D();
data = tmp;
}
this.width = width;
this.height = height;
} | java | public void reshape( int width , int height ) {
int N = width*height;
if( data.length < N ) {
D tmp[] = new D[N];
System.arraycopy(data,0,tmp,0,data.length);
for( int i = data.length; i < N; i++ )
tmp[i] = new D();
data = tmp;
}
this.width = width;
this.height = height;
} | [
"public",
"void",
"reshape",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"int",
"N",
"=",
"width",
"*",
"height",
";",
"if",
"(",
"data",
".",
"length",
"<",
"N",
")",
"{",
"D",
"tmp",
"[",
"]",
"=",
"new",
"D",
"[",
"N",
"]",
";",
... | Changes the shape to match the specified dimension. Memory will only be created/destroyed if the requested
size is larger than any previously requested size
@param width New image width
@param height new image height | [
"Changes",
"the",
"shape",
"to",
"match",
"the",
"specified",
"dimension",
".",
"Memory",
"will",
"only",
"be",
"created",
"/",
"destroyed",
"if",
"the",
"requested",
"size",
"is",
"larger",
"than",
"any",
"previously",
"requested",
"size"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/struct/flow/ImageFlow.java#L44-L56 |
zafarkhaja/jsemver | src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java | ExpressionParser.parseVersion | private Version parseVersion() {
int major = intOf(consumeNextToken(NUMERIC).lexeme);
int minor = 0;
if (tokens.positiveLookahead(DOT)) {
tokens.consume();
minor = intOf(consumeNextToken(NUMERIC).lexeme);
}
int patch = 0;
if (tokens.positiveLookahead(DOT)) {
tokens.consume();
patch = intOf(consumeNextToken(NUMERIC).lexeme);
}
return versionFor(major, minor, patch);
} | java | private Version parseVersion() {
int major = intOf(consumeNextToken(NUMERIC).lexeme);
int minor = 0;
if (tokens.positiveLookahead(DOT)) {
tokens.consume();
minor = intOf(consumeNextToken(NUMERIC).lexeme);
}
int patch = 0;
if (tokens.positiveLookahead(DOT)) {
tokens.consume();
patch = intOf(consumeNextToken(NUMERIC).lexeme);
}
return versionFor(major, minor, patch);
} | [
"private",
"Version",
"parseVersion",
"(",
")",
"{",
"int",
"major",
"=",
"intOf",
"(",
"consumeNextToken",
"(",
"NUMERIC",
")",
".",
"lexeme",
")",
";",
"int",
"minor",
"=",
"0",
";",
"if",
"(",
"tokens",
".",
"positiveLookahead",
"(",
"DOT",
")",
")"... | Parses the {@literal <version>} non-terminal.
<pre>
{@literal
<version> ::= <major>
| <major> "." <minor>
| <major> "." <minor> "." <patch>
}
</pre>
@return the parsed version | [
"Parses",
"the",
"{",
"@literal",
"<version",
">",
"}",
"non",
"-",
"terminal",
"."
] | train | https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L412-L425 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java | LayoutParser.parseAction | private void parseAction(Element node, LayoutTrigger parent) {
new LayoutTriggerAction(parent, getDefinition(null, node));
} | java | private void parseAction(Element node, LayoutTrigger parent) {
new LayoutTriggerAction(parent, getDefinition(null, node));
} | [
"private",
"void",
"parseAction",
"(",
"Element",
"node",
",",
"LayoutTrigger",
"parent",
")",
"{",
"new",
"LayoutTriggerAction",
"(",
"parent",
",",
"getDefinition",
"(",
"null",
",",
"node",
")",
")",
";",
"}"
] | Parse a trigger action node.
@param node The DOM node.
@param parent The parent layout trigger. | [
"Parse",
"a",
"trigger",
"action",
"node",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L324-L326 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/temporal/IntervalUtils.java | IntervalUtils.minus | public static Interval minus(final Interval interval, final Period period) {
return new Interval(interval.getStart().minus(period),
interval.getEnd().minus(period));
} | java | public static Interval minus(final Interval interval, final Period period) {
return new Interval(interval.getStart().minus(period),
interval.getEnd().minus(period));
} | [
"public",
"static",
"Interval",
"minus",
"(",
"final",
"Interval",
"interval",
",",
"final",
"Period",
"period",
")",
"{",
"return",
"new",
"Interval",
"(",
"interval",
".",
"getStart",
"(",
")",
".",
"minus",
"(",
"period",
")",
",",
"interval",
".",
"g... | Move both the start and end of an {@link Interval} into the past by the duration of
{@code period}. | [
"Move",
"both",
"the",
"start",
"and",
"end",
"of",
"an",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/temporal/IntervalUtils.java#L19-L22 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/render/GuiRenderer.java | GuiRenderer.drawItemStack | public void drawItemStack(ItemStack itemStack, int x, int y, String label)
{
drawItemStack(itemStack, x, y, label, null, true);
} | java | public void drawItemStack(ItemStack itemStack, int x, int y, String label)
{
drawItemStack(itemStack, x, y, label, null, true);
} | [
"public",
"void",
"drawItemStack",
"(",
"ItemStack",
"itemStack",
",",
"int",
"x",
",",
"int",
"y",
",",
"String",
"label",
")",
"{",
"drawItemStack",
"(",
"itemStack",
",",
"x",
",",
"y",
",",
"label",
",",
"null",
",",
"true",
")",
";",
"}"
] | Draws an itemStack to the GUI at the specified coordinates with a custom label.
@param itemStack the item stack
@param x the x
@param y the y
@param label the label | [
"Draws",
"an",
"itemStack",
"to",
"the",
"GUI",
"at",
"the",
"specified",
"coordinates",
"with",
"a",
"custom",
"label",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/render/GuiRenderer.java#L398-L401 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java | DrizzlePreparedStatement.setURL | public void setURL(final int parameterIndex, final URL x) throws SQLException {
setParameter(parameterIndex, new StringParameter(x.toString()));
} | java | public void setURL(final int parameterIndex, final URL x) throws SQLException {
setParameter(parameterIndex, new StringParameter(x.toString()));
} | [
"public",
"void",
"setURL",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"URL",
"x",
")",
"throws",
"SQLException",
"{",
"setParameter",
"(",
"parameterIndex",
",",
"new",
"StringParameter",
"(",
"x",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Sets the designated parameter to the given <code>java.net.URL</code> value. The driver converts this to an SQL
<code>DATALINK</code> value when it sends it to the database.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param x the <code>java.net.URL</code> object to be set
@throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement;
if a database access error occurs or this method is called on a closed
<code>PreparedStatement</code>
@throws java.sql.SQLFeatureNotSupportedException
if the JDBC driver does not support this method
@since 1.4 | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"<code",
">",
"java",
".",
"net",
".",
"URL<",
"/",
"code",
">",
"value",
".",
"The",
"driver",
"converts",
"this",
"to",
"an",
"SQL",
"<code",
">",
"DATALINK<",
"/",
"code",
">",
"value",... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L466-L468 |
xmlunit/xmlunit | xmlunit-core/src/main/java/org/xmlunit/diff/XPathContext.java | XPathContext.appendChildren | public void appendChildren(Iterable<? extends NodeInfo> children) {
Level current = path.getLast();
int comments, pis, texts;
comments = pis = texts = 0;
Map<String, Integer> elements = new HashMap<String, Integer>();
for (Level l : current.children) {
String childName = l.expression;
if (childName.startsWith(COMMENT)) {
comments++;
} else if (childName.startsWith(PI)) {
pis++;
} else if (childName.startsWith(TEXT)) {
texts++;
} else {
childName = childName.substring(0, childName.indexOf(OPEN));
add1OrIncrement(childName, elements);
}
}
for (NodeInfo child : children) {
Level l;
switch (child.getType()) {
case Node.COMMENT_NODE:
l = new Level(COMMENT + OPEN + (++comments) + CLOSE);
break;
case Node.PROCESSING_INSTRUCTION_NODE:
l = new Level(PI + OPEN + (++pis) + CLOSE);
break;
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE:
l = new Level(TEXT + OPEN + (++texts) + CLOSE);
break;
case Node.ELEMENT_NODE:
String name = getName(child.getName());
l = new Level(name + OPEN + add1OrIncrement(name, elements)
+ CLOSE);
break;
default:
// more or less ignore
// FIXME: is this a good thing?
l = new Level(EMPTY);
break;
}
current.children.add(l);
}
} | java | public void appendChildren(Iterable<? extends NodeInfo> children) {
Level current = path.getLast();
int comments, pis, texts;
comments = pis = texts = 0;
Map<String, Integer> elements = new HashMap<String, Integer>();
for (Level l : current.children) {
String childName = l.expression;
if (childName.startsWith(COMMENT)) {
comments++;
} else if (childName.startsWith(PI)) {
pis++;
} else if (childName.startsWith(TEXT)) {
texts++;
} else {
childName = childName.substring(0, childName.indexOf(OPEN));
add1OrIncrement(childName, elements);
}
}
for (NodeInfo child : children) {
Level l;
switch (child.getType()) {
case Node.COMMENT_NODE:
l = new Level(COMMENT + OPEN + (++comments) + CLOSE);
break;
case Node.PROCESSING_INSTRUCTION_NODE:
l = new Level(PI + OPEN + (++pis) + CLOSE);
break;
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE:
l = new Level(TEXT + OPEN + (++texts) + CLOSE);
break;
case Node.ELEMENT_NODE:
String name = getName(child.getName());
l = new Level(name + OPEN + add1OrIncrement(name, elements)
+ CLOSE);
break;
default:
// more or less ignore
// FIXME: is this a good thing?
l = new Level(EMPTY);
break;
}
current.children.add(l);
}
} | [
"public",
"void",
"appendChildren",
"(",
"Iterable",
"<",
"?",
"extends",
"NodeInfo",
">",
"children",
")",
"{",
"Level",
"current",
"=",
"path",
".",
"getLast",
"(",
")",
";",
"int",
"comments",
",",
"pis",
",",
"texts",
";",
"comments",
"=",
"pis",
"... | Adds knowledge about the current node's children appending to
the knowledge already present. | [
"Adds",
"knowledge",
"about",
"the",
"current",
"node",
"s",
"children",
"appending",
"to",
"the",
"knowledge",
"already",
"present",
"."
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/XPathContext.java#L145-L191 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java | AuthorizationRequestManager.startHandleChallenges | private void startHandleChallenges(JSONObject jsonChallenges, Response response) {
ArrayList<String> challenges = getRealmsFromJson(jsonChallenges);
MCAAuthorizationManager authManager = (MCAAuthorizationManager) BMSClient.getInstance().getAuthorizationManager();
if (isAuthorizationRequired(response)) {
setExpectedAnswers(challenges);
}
for (String realm : challenges) {
ChallengeHandler handler = authManager.getChallengeHandler(realm);
if (handler != null) {
JSONObject challenge = jsonChallenges.optJSONObject(realm);
handler.handleChallenge(this, challenge, context);
} else {
throw new RuntimeException("Challenge handler for realm is not found: " + realm);
}
}
} | java | private void startHandleChallenges(JSONObject jsonChallenges, Response response) {
ArrayList<String> challenges = getRealmsFromJson(jsonChallenges);
MCAAuthorizationManager authManager = (MCAAuthorizationManager) BMSClient.getInstance().getAuthorizationManager();
if (isAuthorizationRequired(response)) {
setExpectedAnswers(challenges);
}
for (String realm : challenges) {
ChallengeHandler handler = authManager.getChallengeHandler(realm);
if (handler != null) {
JSONObject challenge = jsonChallenges.optJSONObject(realm);
handler.handleChallenge(this, challenge, context);
} else {
throw new RuntimeException("Challenge handler for realm is not found: " + realm);
}
}
} | [
"private",
"void",
"startHandleChallenges",
"(",
"JSONObject",
"jsonChallenges",
",",
"Response",
"response",
")",
"{",
"ArrayList",
"<",
"String",
">",
"challenges",
"=",
"getRealmsFromJson",
"(",
"jsonChallenges",
")",
";",
"MCAAuthorizationManager",
"authManager",
... | Handles authentication challenges.
@param jsonChallenges Collection of challenges.
@param response Server response. | [
"Handles",
"authentication",
"challenges",
"."
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java#L413-L431 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java | MethodBuilder.buildTagInfo | public void buildTagInfo(XMLNode node, Content methodDocTree) {
writer.addTags((MethodDoc) methods.get(currentMethodIndex),
methodDocTree);
} | java | public void buildTagInfo(XMLNode node, Content methodDocTree) {
writer.addTags((MethodDoc) methods.get(currentMethodIndex),
methodDocTree);
} | [
"public",
"void",
"buildTagInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"methodDocTree",
")",
"{",
"writer",
".",
"addTags",
"(",
"(",
"MethodDoc",
")",
"methods",
".",
"get",
"(",
"currentMethodIndex",
")",
",",
"methodDocTree",
")",
";",
"}"
] | Build the tag information.
@param node the XML element that specifies which components to document
@param methodDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"tag",
"information",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java#L229-L232 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setHost | @Deprecated
public static void setHost(HttpMessage message, String value) {
message.headers().set(HttpHeaderNames.HOST, value);
} | java | @Deprecated
public static void setHost(HttpMessage message, String value) {
message.headers().set(HttpHeaderNames.HOST, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setHost",
"(",
"HttpMessage",
"message",
",",
"String",
"value",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"HttpHeaderNames",
".",
"HOST",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #set(CharSequence, Object)} instead.
@see #setHost(HttpMessage, CharSequence) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1024-L1027 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/IOUtils.java | IOUtils.copyBytes | public static void copyBytes(final InputStream in, final OutputStream out, final boolean close) throws IOException {
copyBytes(in, out, BLOCKSIZE, close);
} | java | public static void copyBytes(final InputStream in, final OutputStream out, final boolean close) throws IOException {
copyBytes(in, out, BLOCKSIZE, close);
} | [
"public",
"static",
"void",
"copyBytes",
"(",
"final",
"InputStream",
"in",
",",
"final",
"OutputStream",
"out",
",",
"final",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"copyBytes",
"(",
"in",
",",
"out",
",",
"BLOCKSIZE",
",",
"close",
")",
"... | Copies from one stream to another.
@param in
InputStream to read from
@param out
OutputStream to write to
@param close
whether or not close the InputStream and OutputStream at the
end. The streams are closed in the finally clause.
@throws IOException
thrown if an I/O error occurs while copying | [
"Copies",
"from",
"one",
"stream",
"to",
"another",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L107-L109 |
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BytesUtils.java | BytesUtils.byteArrayToInt | public static int byteArrayToInt(final byte[] byteArray, final int startPos, final int length) {
if (byteArray == null) {
throw new IllegalArgumentException("Parameter 'byteArray' cannot be null");
}
if (length <= 0 || length > 4) {
throw new IllegalArgumentException("Length must be between 1 and 4. Length = " + length);
}
if (startPos < 0 || byteArray.length < startPos + length) {
throw new IllegalArgumentException("Length or startPos not valid");
}
int value = 0;
for (int i = 0; i < length; i++) {
value += (byteArray[startPos + i] & 0xFF) << 8 * (length - i - 1);
}
return value;
} | java | public static int byteArrayToInt(final byte[] byteArray, final int startPos, final int length) {
if (byteArray == null) {
throw new IllegalArgumentException("Parameter 'byteArray' cannot be null");
}
if (length <= 0 || length > 4) {
throw new IllegalArgumentException("Length must be between 1 and 4. Length = " + length);
}
if (startPos < 0 || byteArray.length < startPos + length) {
throw new IllegalArgumentException("Length or startPos not valid");
}
int value = 0;
for (int i = 0; i < length; i++) {
value += (byteArray[startPos + i] & 0xFF) << 8 * (length - i - 1);
}
return value;
} | [
"public",
"static",
"int",
"byteArrayToInt",
"(",
"final",
"byte",
"[",
"]",
"byteArray",
",",
"final",
"int",
"startPos",
",",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"byteArray",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Method used to convert byte array to int
@param byteArray
byte array to convert
@param startPos
start position in array in the
@param length
length of data
@return int value of byte array | [
"Method",
"used",
"to",
"convert",
"byte",
"array",
"to",
"int"
] | train | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BytesUtils.java#L85-L100 |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/apache/log4j/rule/NotEqualsRule.java | NotEqualsRule.getRule | public static Rule getRule(final Stack stack) {
if (stack.size() < 2) {
throw new IllegalArgumentException(
"Invalid NOT EQUALS rule - expected two parameters but received "
+ stack.size());
}
String p2 = stack.pop().toString();
String p1 = stack.pop().toString();
if (p1.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) {
return NotLevelEqualsRule.getRule(p2);
} else {
return new NotEqualsRule(p1, p2);
}
} | java | public static Rule getRule(final Stack stack) {
if (stack.size() < 2) {
throw new IllegalArgumentException(
"Invalid NOT EQUALS rule - expected two parameters but received "
+ stack.size());
}
String p2 = stack.pop().toString();
String p1 = stack.pop().toString();
if (p1.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) {
return NotLevelEqualsRule.getRule(p2);
} else {
return new NotEqualsRule(p1, p2);
}
} | [
"public",
"static",
"Rule",
"getRule",
"(",
"final",
"Stack",
"stack",
")",
"{",
"if",
"(",
"stack",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid NOT EQUALS rule - expected two parameters but received \"",
... | Get new instance from top two elements of stack.
@param stack stack.
@return new instance. | [
"Get",
"new",
"instance",
"from",
"top",
"two",
"elements",
"of",
"stack",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/NotEqualsRule.java#L88-L103 |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/bootbox/client/options/DialogOptions.java | DialogOptions.addButton | public final void addButton(String label, String className, SimpleCallback callback) {
addButton(BUTTON_PREFIX + BUTTON_INDEX++, label, className,
callback != null ? callback : SimpleCallback.DEFAULT_SIMPLE_CALLBACK);
} | java | public final void addButton(String label, String className, SimpleCallback callback) {
addButton(BUTTON_PREFIX + BUTTON_INDEX++, label, className,
callback != null ? callback : SimpleCallback.DEFAULT_SIMPLE_CALLBACK);
} | [
"public",
"final",
"void",
"addButton",
"(",
"String",
"label",
",",
"String",
"className",
",",
"SimpleCallback",
"callback",
")",
"{",
"addButton",
"(",
"BUTTON_PREFIX",
"+",
"BUTTON_INDEX",
"++",
",",
"label",
",",
"className",
",",
"callback",
"!=",
"null"... | Adds a custom button with a class name and a callback.
@param label
@param className
@param callback | [
"Adds",
"a",
"custom",
"button",
"with",
"a",
"class",
"name",
"and",
"a",
"callback",
"."
] | train | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/bootbox/client/options/DialogOptions.java#L211-L214 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.purchaseReservedVolume | public void purchaseReservedVolume(String volumeId, int reservationLength, String reservationTimeUnit) {
this.purchaseReservedVolume(new PurchaseReservedVolumeRequest()
.withVolumeId(volumeId)
.withBilling(new Billing().withReservation(new Reservation()
.withReservationLength(reservationLength)
.withReservationTimeUnit(reservationTimeUnit))));
} | java | public void purchaseReservedVolume(String volumeId, int reservationLength, String reservationTimeUnit) {
this.purchaseReservedVolume(new PurchaseReservedVolumeRequest()
.withVolumeId(volumeId)
.withBilling(new Billing().withReservation(new Reservation()
.withReservationLength(reservationLength)
.withReservationTimeUnit(reservationTimeUnit))));
} | [
"public",
"void",
"purchaseReservedVolume",
"(",
"String",
"volumeId",
",",
"int",
"reservationLength",
",",
"String",
"reservationTimeUnit",
")",
"{",
"this",
".",
"purchaseReservedVolume",
"(",
"new",
"PurchaseReservedVolumeRequest",
"(",
")",
".",
"withVolumeId",
"... | PurchaseReserved the instance with fixed duration.
You can not purchaseReserved the instance which is resizing.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getVolume(String)}
@param volumeId The id of volume which will be renew.
@param reservationLength The fixed duration to renew,available is [1,2,3,4,5,6,7,8,9,12,24,36]
@param reservationTimeUnit The timeUnit to renew the instance,only support "month" now. | [
"PurchaseReserved",
"the",
"instance",
"with",
"fixed",
"duration",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1159-L1165 |
Impetus/Kundera | src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/DefaultCouchbaseDataHandler.java | DefaultCouchbaseDataHandler.iterateAndPopulateEntity | private void iterateAndPopulateEntity(Object entity, JsonObject obj, Iterator<Attribute> iterator)
{
while (iterator.hasNext())
{
Attribute attribute = iterator.next();
Field field = (Field) attribute.getJavaMember();
String colName = ((AbstractAttribute) attribute).getJPAColumnName();
if (!colName.equalsIgnoreCase(CouchbaseConstants.KUNDERA_ENTITY) && obj.get(colName) != null)
{
Object value = ConvertUtils.convert(obj.get(colName), field.getType());
PropertyAccessorHelper.set(entity, field, value);
}
}
} | java | private void iterateAndPopulateEntity(Object entity, JsonObject obj, Iterator<Attribute> iterator)
{
while (iterator.hasNext())
{
Attribute attribute = iterator.next();
Field field = (Field) attribute.getJavaMember();
String colName = ((AbstractAttribute) attribute).getJPAColumnName();
if (!colName.equalsIgnoreCase(CouchbaseConstants.KUNDERA_ENTITY) && obj.get(colName) != null)
{
Object value = ConvertUtils.convert(obj.get(colName), field.getType());
PropertyAccessorHelper.set(entity, field, value);
}
}
} | [
"private",
"void",
"iterateAndPopulateEntity",
"(",
"Object",
"entity",
",",
"JsonObject",
"obj",
",",
"Iterator",
"<",
"Attribute",
">",
"iterator",
")",
"{",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Attribute",
"attribute",
"=",
"iter... | Iterate and populate entity.
@param entity
the entity
@param obj
the obj
@param iterator
the iterator | [
"Iterate",
"and",
"populate",
"entity",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/DefaultCouchbaseDataHandler.java#L82-L97 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/operations/common/OrderedChildTypesAttachment.java | OrderedChildTypesAttachment.addOrderedChildResourceTypes | public void addOrderedChildResourceTypes(PathAddress resourceAddress, Resource resource) {
Set<String> orderedChildTypes = resource.getOrderedChildTypes();
if (orderedChildTypes.size() > 0) {
orderedChildren.put(resourceAddress, resource.getOrderedChildTypes());
}
} | java | public void addOrderedChildResourceTypes(PathAddress resourceAddress, Resource resource) {
Set<String> orderedChildTypes = resource.getOrderedChildTypes();
if (orderedChildTypes.size() > 0) {
orderedChildren.put(resourceAddress, resource.getOrderedChildTypes());
}
} | [
"public",
"void",
"addOrderedChildResourceTypes",
"(",
"PathAddress",
"resourceAddress",
",",
"Resource",
"resource",
")",
"{",
"Set",
"<",
"String",
">",
"orderedChildTypes",
"=",
"resource",
".",
"getOrderedChildTypes",
"(",
")",
";",
"if",
"(",
"orderedChildTypes... | If the resource has ordered child types, those child types will be stored in the attachment. If there are no
ordered child types, this method is a no-op.
@param resourceAddress the address of the resource
@param resource the resource which may or may not have ordered children. | [
"If",
"the",
"resource",
"has",
"ordered",
"child",
"types",
"those",
"child",
"types",
"will",
"be",
"stored",
"in",
"the",
"attachment",
".",
"If",
"there",
"are",
"no",
"ordered",
"child",
"types",
"this",
"method",
"is",
"a",
"no",
"-",
"op",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/common/OrderedChildTypesAttachment.java#L32-L37 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.findOptionalInt | public @NotNull OptionalInt findOptionalInt(@NotNull @SQL String sql, Object... args) {
return findOptionalInt(SqlQuery.query(sql, args));
} | java | public @NotNull OptionalInt findOptionalInt(@NotNull @SQL String sql, Object... args) {
return findOptionalInt(SqlQuery.query(sql, args));
} | [
"public",
"@",
"NotNull",
"OptionalInt",
"findOptionalInt",
"(",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"findOptionalInt",
"(",
"SqlQuery",
".",
"query",
"(",
"sql",
",",
"args",
")",
")",
";",
"}"
... | Finds a unique result from database, converting the database row to int using default mechanisms.
Returns empty if there are no results or if single null result is returned.
@throws NonUniqueResultException if there are multiple result rows | [
"Finds",
"a",
"unique",
"result",
"from",
"database",
"converting",
"the",
"database",
"row",
"to",
"int",
"using",
"default",
"mechanisms",
".",
"Returns",
"empty",
"if",
"there",
"are",
"no",
"results",
"or",
"if",
"single",
"null",
"result",
"is",
"return... | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L412-L414 |
microfocus-idol/java-content-parameter-api | src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java | FieldTextBuilder.WHEN | @Override
public FieldTextBuilder WHEN(final int depth, final FieldText fieldText) {
Validate.isTrue(depth >= 1, "Depth must be at least 1");
Validate.notNull(fieldText, "FieldText should not be null");
Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1");
if(size() < 1) {
throw new IllegalStateException("Size must be greater than or equal to 1");
}
// We omit this 'optimization' because for large n it doesn't work, X WHENn A => 0, even if X = A
//if (fieldText == this || toString().equals(fieldText.toString())) {
// return this;
//}
if(fieldText == this) {
return binaryOperation("WHEN" + depth, new FieldTextWrapper(this));
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING);
}
return binaryOperation("WHEN" + depth, fieldText);
} | java | @Override
public FieldTextBuilder WHEN(final int depth, final FieldText fieldText) {
Validate.isTrue(depth >= 1, "Depth must be at least 1");
Validate.notNull(fieldText, "FieldText should not be null");
Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1");
if(size() < 1) {
throw new IllegalStateException("Size must be greater than or equal to 1");
}
// We omit this 'optimization' because for large n it doesn't work, X WHENn A => 0, even if X = A
//if (fieldText == this || toString().equals(fieldText.toString())) {
// return this;
//}
if(fieldText == this) {
return binaryOperation("WHEN" + depth, new FieldTextWrapper(this));
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING);
}
return binaryOperation("WHEN" + depth, fieldText);
} | [
"@",
"Override",
"public",
"FieldTextBuilder",
"WHEN",
"(",
"final",
"int",
"depth",
",",
"final",
"FieldText",
"fieldText",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"depth",
">=",
"1",
",",
"\"Depth must be at least 1\"",
")",
";",
"Validate",
".",
"notNull"... | Appends the specified fieldtext onto the builder using the WHEN<i>n</i> operator.
@param depth The <i>n</i> in WHEN<i>n</i>
@param fieldText A fieldtext expression or specifier.
@return {@code this}. | [
"Appends",
"the",
"specified",
"fieldtext",
"onto",
"the",
"builder",
"using",
"the",
"WHEN<i",
">",
"n<",
"/",
"i",
">",
"operator",
"."
] | train | https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java#L256-L280 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-core/src/main/java/org/ops4j/pax/swissbox/core/BundleClassLoader.java | BundleClassLoader.newPriviledged | public static BundleClassLoader newPriviledged( final Bundle bundle, final ClassLoader parent )
{
return AccessController.doPrivileged( new PrivilegedAction<BundleClassLoader>()
{
public BundleClassLoader run()
{
return new BundleClassLoader( bundle, parent );
}
} );
} | java | public static BundleClassLoader newPriviledged( final Bundle bundle, final ClassLoader parent )
{
return AccessController.doPrivileged( new PrivilegedAction<BundleClassLoader>()
{
public BundleClassLoader run()
{
return new BundleClassLoader( bundle, parent );
}
} );
} | [
"public",
"static",
"BundleClassLoader",
"newPriviledged",
"(",
"final",
"Bundle",
"bundle",
",",
"final",
"ClassLoader",
"parent",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"BundleClassLoader",
">",
"(",
")",
... | Privileged factory method.
@param bundle bundle to be used for class loading. Cannot be null.
@param parent parent class loader
@return created bundle class loader
@see BundleClassLoader#BundleClassLoader(Bundle,ClassLoader) | [
"Privileged",
"factory",
"method",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-core/src/main/java/org/ops4j/pax/swissbox/core/BundleClassLoader.java#L85-L94 |
usc/wechat-mp-sdk | wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java | JsonRtnUtil.parseJsonRtn | public static <T extends JsonRtn> T parseJsonRtn(String jsonRtn, Class<T> jsonRtnClazz) {
T rtn = JSONObject.parseObject(jsonRtn, jsonRtnClazz);
appendErrorHumanMsg(rtn);
return rtn;
} | java | public static <T extends JsonRtn> T parseJsonRtn(String jsonRtn, Class<T> jsonRtnClazz) {
T rtn = JSONObject.parseObject(jsonRtn, jsonRtnClazz);
appendErrorHumanMsg(rtn);
return rtn;
} | [
"public",
"static",
"<",
"T",
"extends",
"JsonRtn",
">",
"T",
"parseJsonRtn",
"(",
"String",
"jsonRtn",
",",
"Class",
"<",
"T",
">",
"jsonRtnClazz",
")",
"{",
"T",
"rtn",
"=",
"JSONObject",
".",
"parseObject",
"(",
"jsonRtn",
",",
"jsonRtnClazz",
")",
";... | parse json text to specified class
@param jsonRtn
@param jsonRtnClazz
@return | [
"parse",
"json",
"text",
"to",
"specified",
"class"
] | train | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java#L33-L37 |
twitter/hraven | hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserFactory.java | JobHistoryFileParserFactory.getVersion | public static HadoopVersion getVersion(byte[] historyFileContents) {
if(historyFileContents.length > HADOOP2_VERSION_LENGTH) {
// the first 10 bytes in a hadoop2.0 history file contain Avro-Json
String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH);
if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) {
return HadoopVersion.TWO;
}
}
// throw an exception if we did not find any matching version
throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents);
} | java | public static HadoopVersion getVersion(byte[] historyFileContents) {
if(historyFileContents.length > HADOOP2_VERSION_LENGTH) {
// the first 10 bytes in a hadoop2.0 history file contain Avro-Json
String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH);
if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) {
return HadoopVersion.TWO;
}
}
// throw an exception if we did not find any matching version
throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents);
} | [
"public",
"static",
"HadoopVersion",
"getVersion",
"(",
"byte",
"[",
"]",
"historyFileContents",
")",
"{",
"if",
"(",
"historyFileContents",
".",
"length",
">",
"HADOOP2_VERSION_LENGTH",
")",
"{",
"// the first 10 bytes in a hadoop2.0 history file contain Avro-Json",
"Strin... | determines the verison of hadoop that the history file belongs to
@return
returns 1 for hadoop 1 (pre MAPREDUCE-1016)
returns 2 for newer job history files
(newer job history files have "AVRO-JSON" as the signature at the start of the file,
REFERENCE: https://issues.apache.org/jira/browse/MAPREDUCE-1016? \
focusedCommentId=12763160& \ page=com.atlassian.jira.plugin.system
.issuetabpanels:comment-tabpanel#comment-12763160
@throws IllegalArgumentException if neither match | [
"determines",
"the",
"verison",
"of",
"hadoop",
"that",
"the",
"history",
"file",
"belongs",
"to"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserFactory.java#L50-L60 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.pressImage | public static void pressImage(File srcImageFile, File destImageFile, Image pressImg, int x, int y, float alpha) {
pressImage(read(srcImageFile), destImageFile, pressImg, x, y, alpha);
} | java | public static void pressImage(File srcImageFile, File destImageFile, Image pressImg, int x, int y, float alpha) {
pressImage(read(srcImageFile), destImageFile, pressImg, x, y, alpha);
} | [
"public",
"static",
"void",
"pressImage",
"(",
"File",
"srcImageFile",
",",
"File",
"destImageFile",
",",
"Image",
"pressImg",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"{",
"pressImage",
"(",
"read",
"(",
"srcImageFile",
")",
",",
"d... | 给图片添加图片水印
@param srcImageFile 源图像文件
@param destImageFile 目标图像文件
@param pressImg 水印图片
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 | [
"给图片添加图片水印"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L876-L878 |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/model/ManagedBeanDefinition.java | ManagedBeanDefinition.createObjectName | public ObjectName createObjectName() {
try {
if (StringUtils.hasText(objectName)) {
return new ObjectName(objectDomain + ":" + objectName);
}
if (type != null) {
if (StringUtils.hasText(objectDomain)) {
return new ObjectName(objectDomain, "type", type.getSimpleName());
}
return new ObjectName(type.getPackage().getName(), "type", type.getSimpleName());
}
return new ObjectName(objectDomain, "name", name);
} catch (NullPointerException | MalformedObjectNameException e) {
throw new CitrusRuntimeException("Failed to create proper object name for managed bean", e);
}
} | java | public ObjectName createObjectName() {
try {
if (StringUtils.hasText(objectName)) {
return new ObjectName(objectDomain + ":" + objectName);
}
if (type != null) {
if (StringUtils.hasText(objectDomain)) {
return new ObjectName(objectDomain, "type", type.getSimpleName());
}
return new ObjectName(type.getPackage().getName(), "type", type.getSimpleName());
}
return new ObjectName(objectDomain, "name", name);
} catch (NullPointerException | MalformedObjectNameException e) {
throw new CitrusRuntimeException("Failed to create proper object name for managed bean", e);
}
} | [
"public",
"ObjectName",
"createObjectName",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"objectName",
")",
")",
"{",
"return",
"new",
"ObjectName",
"(",
"objectDomain",
"+",
"\":\"",
"+",
"objectName",
")",
";",
"}",
"if",
"... | Constructs proper object name either from given domain and name property or
by evaluating the mbean type class information.
@return | [
"Constructs",
"proper",
"object",
"name",
"either",
"from",
"given",
"domain",
"and",
"name",
"property",
"or",
"by",
"evaluating",
"the",
"mbean",
"type",
"class",
"information",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/model/ManagedBeanDefinition.java#L51-L69 |
aws/aws-sdk-java | aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/StartOutboundVoiceContactRequest.java | StartOutboundVoiceContactRequest.withAttributes | public StartOutboundVoiceContactRequest withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public StartOutboundVoiceContactRequest withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"StartOutboundVoiceContactRequest",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Specify a custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes,
and can be accessed in contact flows just like any other contact attributes.
</p>
<p>
There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include only
alphanumeric, dash, and underscore characters.
</p>
<p>
For example, if you want play a greeting when the customer answers the call, you can pass the customer name in
attributes similar to the following:
</p>
@param attributes
Specify a custom key-value pair using an attribute map. The attributes are standard Amazon Connect
attributes, and can be accessed in contact flows just like any other contact attributes.</p>
<p>
There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include
only alphanumeric, dash, and underscore characters.
</p>
<p>
For example, if you want play a greeting when the customer answers the call, you can pass the customer
name in attributes similar to the following:
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Specify",
"a",
"custom",
"key",
"-",
"value",
"pair",
"using",
"an",
"attribute",
"map",
".",
"The",
"attributes",
"are",
"standard",
"Amazon",
"Connect",
"attributes",
"and",
"can",
"be",
"accessed",
"in",
"contact",
"flows",
"just",
"like",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/StartOutboundVoiceContactRequest.java#L533-L536 |
dbracewell/mango | src/main/java/com/davidbracewell/json/JsonWriter.java | JsonWriter.value | public JsonWriter value(Map<String, ?> map) throws IOException {
if (map == null) {
nullValue();
} else {
boolean inObject = inObject();
if (!inObject) beginObject();
for (Map.Entry<String, ?> entry : map.entrySet()) {
property(entry.getKey(), entry.getValue());
}
if (!inObject) endObject();
}
popIf(JsonTokenType.NAME);
return this;
} | java | public JsonWriter value(Map<String, ?> map) throws IOException {
if (map == null) {
nullValue();
} else {
boolean inObject = inObject();
if (!inObject) beginObject();
for (Map.Entry<String, ?> entry : map.entrySet()) {
property(entry.getKey(), entry.getValue());
}
if (!inObject) endObject();
}
popIf(JsonTokenType.NAME);
return this;
} | [
"public",
"JsonWriter",
"value",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"map",
")",
"throws",
"IOException",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"nullValue",
"(",
")",
";",
"}",
"else",
"{",
"boolean",
"inObject",
"=",
"inObject",
"(",
... | Writes a map
@param map the map to be written
@return This structured writer
@throws IOException Something went wrong writing | [
"Writes",
"a",
"map"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonWriter.java#L403-L416 |
alkacon/opencms-core | src/org/opencms/i18n/CmsLocaleManager.java | CmsLocaleManager.getDefaultLocale | public Locale getDefaultLocale(CmsObject cms, String resourceName) {
List<Locale> defaultLocales = getDefaultLocales(cms, resourceName);
Locale result;
if (defaultLocales.size() > 0) {
result = defaultLocales.get(0);
} else {
result = getDefaultLocale();
}
return result;
} | java | public Locale getDefaultLocale(CmsObject cms, String resourceName) {
List<Locale> defaultLocales = getDefaultLocales(cms, resourceName);
Locale result;
if (defaultLocales.size() > 0) {
result = defaultLocales.get(0);
} else {
result = getDefaultLocale();
}
return result;
} | [
"public",
"Locale",
"getDefaultLocale",
"(",
"CmsObject",
"cms",
",",
"String",
"resourceName",
")",
"{",
"List",
"<",
"Locale",
">",
"defaultLocales",
"=",
"getDefaultLocales",
"(",
"cms",
",",
"resourceName",
")",
";",
"Locale",
"result",
";",
"if",
"(",
"... | Returns the "the" default locale for the given resource.<p>
It's possible to override the system default (see {@link #getDefaultLocale()}) by setting the property
<code>{@link CmsPropertyDefinition#PROPERTY_LOCALE}</code> to a comma separated list of locale names.
This property is inherited from the parent folders.
This method will return the first locale from that list.<p>
The default locale must be contained in the set of configured available locales,
see {@link #getAvailableLocales()}.
In case an invalid locale has been set with the property, this locale is ignored and the
same result as {@link #getDefaultLocale()} is returned.<p>
In case the property <code>{@link CmsPropertyDefinition#PROPERTY_LOCALE}</code> has not been set
on the resource or a parent folder,
this method returns the same result as {@link #getDefaultLocale()}.<p>
@param cms the current cms permission object
@param resourceName the name of the resource
@return an array of default locale names
@see #getDefaultLocales()
@see #getDefaultLocales(CmsObject, String) | [
"Returns",
"the",
"the",
"default",
"locale",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsLocaleManager.java#L764-L774 |
BioPAX/Paxtools | sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java | SBGNLayoutManager.populateCompartmentOccurencesMap | private void populateCompartmentOccurencesMap(Glyph targetGlyph, HashMap<String, Integer> compartmentIDandOccurenceMap)
{
String rootID = "root";
// if compartment ref of targetGlyph node is not null, increment its occurence by 1
if(targetGlyph.getCompartmentRef() != null)
{
Glyph containerCompartment = (Glyph)targetGlyph.getCompartmentRef();
String compartmentID = containerCompartment.getId();
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(compartmentID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(compartmentID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(compartmentID, 1);
}
// else targetGlyph is in root graph so increment root graphs counter value by 1
else
{
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(rootID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(rootID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(rootID, 1);
}
} | java | private void populateCompartmentOccurencesMap(Glyph targetGlyph, HashMap<String, Integer> compartmentIDandOccurenceMap)
{
String rootID = "root";
// if compartment ref of targetGlyph node is not null, increment its occurence by 1
if(targetGlyph.getCompartmentRef() != null)
{
Glyph containerCompartment = (Glyph)targetGlyph.getCompartmentRef();
String compartmentID = containerCompartment.getId();
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(compartmentID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(compartmentID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(compartmentID, 1);
}
// else targetGlyph is in root graph so increment root graphs counter value by 1
else
{
Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(rootID);
if( compartmentOccurrenceValue != null)
{
compartmentIDandOccurenceMap.put(rootID, compartmentOccurrenceValue + 1);
}
else
compartmentIDandOccurenceMap.put(rootID, 1);
}
} | [
"private",
"void",
"populateCompartmentOccurencesMap",
"(",
"Glyph",
"targetGlyph",
",",
"HashMap",
"<",
"String",
",",
"Integer",
">",
"compartmentIDandOccurenceMap",
")",
"{",
"String",
"rootID",
"=",
"\"root\"",
";",
"// if compartment ref of targetGlyph node is not null... | Updates a hashmap by incrementing the number of nodes in the compartment glyph that includes targetGlyph.
It is assumed that given hashmap includes compartment ids' as keys and number of nodes as values.This method
is an utility method that will be used to populate a hashmap while determining the compartment node of a process
node by majority rule.
@param targetGlyph glyph whose occurence will be updated in the given hashmap.
@param compartmentIDandOccurenceMap Map that references number of nodes in a compartment by compartment ids . | [
"Updates",
"a",
"hashmap",
"by",
"incrementing",
"the",
"number",
"of",
"nodes",
"in",
"the",
"compartment",
"glyph",
"that",
"includes",
"targetGlyph",
".",
"It",
"is",
"assumed",
"that",
"given",
"hashmap",
"includes",
"compartment",
"ids",
"as",
"keys",
"an... | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L311-L341 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderNoteUrl.java | OrderNoteUrl.deleteOrderNoteUrl | public static MozuUrl deleteOrderNoteUrl(String noteId, String orderId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/notes/{noteId}");
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("orderId", orderId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteOrderNoteUrl(String noteId, String orderId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/notes/{noteId}");
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("orderId", orderId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteOrderNoteUrl",
"(",
"String",
"noteId",
",",
"String",
"orderId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/orders/{orderId}/notes/{noteId}\"",
")",
";",
"formatter",
".",
"formatUrl",
... | Get Resource Url for DeleteOrderNote
@param noteId Unique identifier of a particular note to retrieve.
@param orderId Unique identifier of the order.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteOrderNote"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderNoteUrl.java#L80-L86 |
sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/PGPMessageSigner.java | PGPMessageSigner.signMessage | @Override
public boolean signMessage(InputStream privateKeyOfSender, final String userIdForPrivateKey, String passwordOfPrivateKey, InputStream message, OutputStream signature) {
LOGGER.trace("signMessage(InputStream, String, String, InputStream, OutputStream)");
LOGGER.trace("Private Key: {}, User ID: {}, Password: {}, Data: {}, Signature: {}",
privateKeyOfSender == null ? "not set" : "set", userIdForPrivateKey, passwordOfPrivateKey == null ? "not set" : "********",
message == null ? "not set" : "set", signature == null ? "not set" : "set");
boolean result = false;
try {
LOGGER.debug("Retrieving Private Key");
PGPPrivateKey privateKey = findPrivateKey(privateKeyOfSender, passwordOfPrivateKey, new KeyFilter<PGPSecretKey>() {
@Override
public boolean accept(PGPSecretKey secretKey) {
boolean result = secretKey.isSigningKey();
if( result ) {
Iterator<String> userIdIterator = secretKey.getUserIDs();
boolean containsUserId = false;
while( userIdIterator.hasNext() && !containsUserId ) {
containsUserId |= userIdForPrivateKey.equals(userIdIterator.next());
}
}
return result;
}
});
LOGGER.debug("Initializing signature generator");
final PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuilder(privateKey.getPublicKeyPacket().getAlgorithm(), HashAlgorithmTags.SHA256));
signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey);
LOGGER.debug("Wrapping signature stream in ArmoredOutputStream and PGOutputStream");
try( BCPGOutputStream outputStream = new BCPGOutputStream( new ArmoredOutputStream(signature)) ) {
IOUtils.process(message, new IOUtils.StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
signatureGenerator.update(buffer, offset, length);
}
});
LOGGER.info("Writing signature out");
signatureGenerator.generate().encode(outputStream);
}
result = true;
} catch (IOException | PGPException e) {
result &= false;
LOGGER.error("{}", e.getMessage());
}
return result;
} | java | @Override
public boolean signMessage(InputStream privateKeyOfSender, final String userIdForPrivateKey, String passwordOfPrivateKey, InputStream message, OutputStream signature) {
LOGGER.trace("signMessage(InputStream, String, String, InputStream, OutputStream)");
LOGGER.trace("Private Key: {}, User ID: {}, Password: {}, Data: {}, Signature: {}",
privateKeyOfSender == null ? "not set" : "set", userIdForPrivateKey, passwordOfPrivateKey == null ? "not set" : "********",
message == null ? "not set" : "set", signature == null ? "not set" : "set");
boolean result = false;
try {
LOGGER.debug("Retrieving Private Key");
PGPPrivateKey privateKey = findPrivateKey(privateKeyOfSender, passwordOfPrivateKey, new KeyFilter<PGPSecretKey>() {
@Override
public boolean accept(PGPSecretKey secretKey) {
boolean result = secretKey.isSigningKey();
if( result ) {
Iterator<String> userIdIterator = secretKey.getUserIDs();
boolean containsUserId = false;
while( userIdIterator.hasNext() && !containsUserId ) {
containsUserId |= userIdForPrivateKey.equals(userIdIterator.next());
}
}
return result;
}
});
LOGGER.debug("Initializing signature generator");
final PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuilder(privateKey.getPublicKeyPacket().getAlgorithm(), HashAlgorithmTags.SHA256));
signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey);
LOGGER.debug("Wrapping signature stream in ArmoredOutputStream and PGOutputStream");
try( BCPGOutputStream outputStream = new BCPGOutputStream( new ArmoredOutputStream(signature)) ) {
IOUtils.process(message, new IOUtils.StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
signatureGenerator.update(buffer, offset, length);
}
});
LOGGER.info("Writing signature out");
signatureGenerator.generate().encode(outputStream);
}
result = true;
} catch (IOException | PGPException e) {
result &= false;
LOGGER.error("{}", e.getMessage());
}
return result;
} | [
"@",
"Override",
"public",
"boolean",
"signMessage",
"(",
"InputStream",
"privateKeyOfSender",
",",
"final",
"String",
"userIdForPrivateKey",
",",
"String",
"passwordOfPrivateKey",
",",
"InputStream",
"message",
",",
"OutputStream",
"signature",
")",
"{",
"LOGGER",
".... | @see MessageSigner#signMessage(InputStream, String, String, InputStream, OutputStream)
@param privateKeyOfSender
the private key of the sender
@param userIdForPrivateKey
the user id of the sender
@param passwordOfPrivateKey
the password for the private key
@param message
the message / data to verify
@param signature
the (detached) signature
@return | [
"@see",
"MessageSigner#signMessage",
"(",
"InputStream",
"String",
"String",
"InputStream",
"OutputStream",
")"
] | train | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/PGPMessageSigner.java#L106-L152 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java | Utils.composeMembershipId | String composeMembershipId(Node groupNode, Node refUserNode, Node refTypeNode) throws RepositoryException
{
return groupNode.getUUID()
+ ','
+ refUserNode.getName()
+ ','
+ (refTypeNode.getName().equals(JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY)
? MembershipTypeHandler.ANY_MEMBERSHIP_TYPE : refTypeNode.getName());
} | java | String composeMembershipId(Node groupNode, Node refUserNode, Node refTypeNode) throws RepositoryException
{
return groupNode.getUUID()
+ ','
+ refUserNode.getName()
+ ','
+ (refTypeNode.getName().equals(JCROrganizationServiceImpl.JOS_MEMBERSHIP_TYPE_ANY)
? MembershipTypeHandler.ANY_MEMBERSHIP_TYPE : refTypeNode.getName());
} | [
"String",
"composeMembershipId",
"(",
"Node",
"groupNode",
",",
"Node",
"refUserNode",
",",
"Node",
"refTypeNode",
")",
"throws",
"RepositoryException",
"{",
"return",
"groupNode",
".",
"getUUID",
"(",
")",
"+",
"'",
"'",
"+",
"refUserNode",
".",
"getName",
"(... | Compose membership identifier. For more information see {@link MembershipImpl} | [
"Compose",
"membership",
"identifier",
".",
"For",
"more",
"information",
"see",
"{"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/Utils.java#L118-L126 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java | MappedParametrizedObjectEntry.getParameterLong | public Long getParameterLong(String name) throws RepositoryConfigurationException
{
try
{
return StringNumberParser.parseLong(getParameterValue(name));
}
catch (NumberFormatException e)
{
throw new RepositoryConfigurationException(name + ": unparseable Long. " + e, e);
}
} | java | public Long getParameterLong(String name) throws RepositoryConfigurationException
{
try
{
return StringNumberParser.parseLong(getParameterValue(name));
}
catch (NumberFormatException e)
{
throw new RepositoryConfigurationException(name + ": unparseable Long. " + e, e);
}
} | [
"public",
"Long",
"getParameterLong",
"(",
"String",
"name",
")",
"throws",
"RepositoryConfigurationException",
"{",
"try",
"{",
"return",
"StringNumberParser",
".",
"parseLong",
"(",
"getParameterValue",
"(",
"name",
")",
")",
";",
"}",
"catch",
"(",
"NumberForma... | Parse named parameter as Long.
@param name
parameter name
@return Long value
@throws RepositoryConfigurationException | [
"Parse",
"named",
"parameter",
"as",
"Long",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L226-L236 |
Red5/red5-io | src/main/java/org/red5/io/amf/Output.java | Output.putString | public static void putString(IoBuffer buf, String string) {
final byte[] encoded = encodeString(string);
if (encoded.length < AMF.LONG_STRING_LENGTH) {
// write unsigned short
buf.put((byte) ((encoded.length >> 8) & 0xff));
buf.put((byte) (encoded.length & 0xff));
} else {
buf.putInt(encoded.length);
}
buf.put(encoded);
} | java | public static void putString(IoBuffer buf, String string) {
final byte[] encoded = encodeString(string);
if (encoded.length < AMF.LONG_STRING_LENGTH) {
// write unsigned short
buf.put((byte) ((encoded.length >> 8) & 0xff));
buf.put((byte) (encoded.length & 0xff));
} else {
buf.putInt(encoded.length);
}
buf.put(encoded);
} | [
"public",
"static",
"void",
"putString",
"(",
"IoBuffer",
"buf",
",",
"String",
"string",
")",
"{",
"final",
"byte",
"[",
"]",
"encoded",
"=",
"encodeString",
"(",
"string",
")",
";",
"if",
"(",
"encoded",
".",
"length",
"<",
"AMF",
".",
"LONG_STRING_LEN... | Write out string
@param buf
Byte buffer to write to
@param string
String to write | [
"Write",
"out",
"string"
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Output.java#L546-L556 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.number_specificNumbers_GET | public ArrayList<OvhSpecificNumber> number_specificNumbers_GET(OvhNumberCountryEnum country, String range, OvhNumberTypeEnum type, String zone) throws IOException {
String qPath = "/telephony/number/specificNumbers";
StringBuilder sb = path(qPath);
query(sb, "country", country);
query(sb, "range", range);
query(sb, "type", type);
query(sb, "zone", zone);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t22);
} | java | public ArrayList<OvhSpecificNumber> number_specificNumbers_GET(OvhNumberCountryEnum country, String range, OvhNumberTypeEnum type, String zone) throws IOException {
String qPath = "/telephony/number/specificNumbers";
StringBuilder sb = path(qPath);
query(sb, "country", country);
query(sb, "range", range);
query(sb, "type", type);
query(sb, "zone", zone);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t22);
} | [
"public",
"ArrayList",
"<",
"OvhSpecificNumber",
">",
"number_specificNumbers_GET",
"(",
"OvhNumberCountryEnum",
"country",
",",
"String",
"range",
",",
"OvhNumberTypeEnum",
"type",
",",
"String",
"zone",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\... | Get all available specific number from a country
REST: GET /telephony/number/specificNumbers
@param type [required] The type of number
@param country [required] The country
@param zone [required] The zone (geographic number)
@param range [required] The range (special number) | [
"Get",
"all",
"available",
"specific",
"number",
"from",
"a",
"country"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8662-L8671 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java | WebUtilities.percentEncodeUrl | public static String percentEncodeUrl(final String urlStr) {
if (Util.empty(urlStr)) {
return urlStr;
}
try {
// Avoid double encoding
String decode = URIUtil.decode(urlStr);
URI uri = new URI(decode, false);
return uri.getEscapedURIReference();
} catch (Exception e) {
return urlStr;
}
} | java | public static String percentEncodeUrl(final String urlStr) {
if (Util.empty(urlStr)) {
return urlStr;
}
try {
// Avoid double encoding
String decode = URIUtil.decode(urlStr);
URI uri = new URI(decode, false);
return uri.getEscapedURIReference();
} catch (Exception e) {
return urlStr;
}
} | [
"public",
"static",
"String",
"percentEncodeUrl",
"(",
"final",
"String",
"urlStr",
")",
"{",
"if",
"(",
"Util",
".",
"empty",
"(",
"urlStr",
")",
")",
"{",
"return",
"urlStr",
";",
"}",
"try",
"{",
"// Avoid double encoding",
"String",
"decode",
"=",
"URI... | Percent encode a URL to include in HTML.
@param urlStr the URL to escape
@return the URL percent encoded | [
"Percent",
"encode",
"a",
"URL",
"to",
"include",
"in",
"HTML",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java#L300-L313 |
baratine/baratine | web/src/main/java/com/caucho/v5/web/webapp/MultiMapImpl.java | MultiMapImpl.add | public void add(K key, V value)
{
if (key == null) {
return;
}
K []keys = _keys;
final int size = _size;
for (int i = size - 1; i >= 0; i--) {
if (key.equals(keys[i])) {
_values[i].add(value);
return;
}
}
if (! ensureCapacity(size)) {
return;
}
_keys[size] = key;
_values[size] = new ArrayList<V>();
_values[size].add(value);
_size = size + 1;
} | java | public void add(K key, V value)
{
if (key == null) {
return;
}
K []keys = _keys;
final int size = _size;
for (int i = size - 1; i >= 0; i--) {
if (key.equals(keys[i])) {
_values[i].add(value);
return;
}
}
if (! ensureCapacity(size)) {
return;
}
_keys[size] = key;
_values[size] = new ArrayList<V>();
_values[size].add(value);
_size = size + 1;
} | [
"public",
"void",
"add",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
";",
"}",
"K",
"[",
"]",
"keys",
"=",
"_keys",
";",
"final",
"int",
"size",
"=",
"_size",
";",
"for",
"(",
"int",
"i",
... | Puts a new item in the cache.
@param key key to store data
@param value value to be stored
@return old value stored under the key | [
"Puts",
"a",
"new",
"item",
"in",
"the",
"cache",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/web/webapp/MultiMapImpl.java#L153-L178 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/TextCharacter.java | TextCharacter.withoutModifier | public TextCharacter withoutModifier(SGR modifier) {
if(!modifiers.contains(modifier)) {
return this;
}
EnumSet<SGR> newSet = EnumSet.copyOf(this.modifiers);
newSet.remove(modifier);
return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
} | java | public TextCharacter withoutModifier(SGR modifier) {
if(!modifiers.contains(modifier)) {
return this;
}
EnumSet<SGR> newSet = EnumSet.copyOf(this.modifiers);
newSet.remove(modifier);
return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
} | [
"public",
"TextCharacter",
"withoutModifier",
"(",
"SGR",
"modifier",
")",
"{",
"if",
"(",
"!",
"modifiers",
".",
"contains",
"(",
"modifier",
")",
")",
"{",
"return",
"this",
";",
"}",
"EnumSet",
"<",
"SGR",
">",
"newSet",
"=",
"EnumSet",
".",
"copyOf",... | Returns a copy of this TextCharacter with an SGR modifier removed. All of the currently active SGR codes
will be carried over to the copy, except for the one specified. If the current TextCharacter doesn't have the
SGR specified, it will return itself.
@param modifier SGR modifiers the copy should not have
@return Copy of the TextCharacter without the SGR modifier | [
"Returns",
"a",
"copy",
"of",
"this",
"TextCharacter",
"with",
"an",
"SGR",
"modifier",
"removed",
".",
"All",
"of",
"the",
"currently",
"active",
"SGR",
"codes",
"will",
"be",
"carried",
"over",
"to",
"the",
"copy",
"except",
"for",
"the",
"one",
"specifi... | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TextCharacter.java#L280-L287 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.saveDraft | @ObjectiveCName("saveDraftWithPeer:withDraft:")
public void saveDraft(Peer peer, String draft) {
modules.getMessagesModule().saveDraft(peer, draft);
} | java | @ObjectiveCName("saveDraftWithPeer:withDraft:")
public void saveDraft(Peer peer, String draft) {
modules.getMessagesModule().saveDraft(peer, draft);
} | [
"@",
"ObjectiveCName",
"(",
"\"saveDraftWithPeer:withDraft:\"",
")",
"public",
"void",
"saveDraft",
"(",
"Peer",
"peer",
",",
"String",
"draft",
")",
"{",
"modules",
".",
"getMessagesModule",
"(",
")",
".",
"saveDraft",
"(",
"peer",
",",
"draft",
")",
";",
"... | Save message draft
@param peer destination peer
@param draft message draft | [
"Save",
"message",
"draft"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1097-L1100 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.getContractionsAndExpansions | public void getContractionsAndExpansions(UnicodeSet contractions, UnicodeSet expansions, boolean addPrefixes)
throws Exception {
if (contractions != null) {
contractions.clear();
}
if (expansions != null) {
expansions.clear();
}
new ContractionsAndExpansions(contractions, expansions, null, addPrefixes).forData(data);
} | java | public void getContractionsAndExpansions(UnicodeSet contractions, UnicodeSet expansions, boolean addPrefixes)
throws Exception {
if (contractions != null) {
contractions.clear();
}
if (expansions != null) {
expansions.clear();
}
new ContractionsAndExpansions(contractions, expansions, null, addPrefixes).forData(data);
} | [
"public",
"void",
"getContractionsAndExpansions",
"(",
"UnicodeSet",
"contractions",
",",
"UnicodeSet",
"expansions",
",",
"boolean",
"addPrefixes",
")",
"throws",
"Exception",
"{",
"if",
"(",
"contractions",
"!=",
"null",
")",
"{",
"contractions",
".",
"clear",
"... | Gets unicode sets containing contractions and/or expansions of a collator
@param contractions
if not null, set to contain contractions
@param expansions
if not null, set to contain expansions
@param addPrefixes
add the prefix contextual elements to contractions
@throws Exception
Throws an exception if any errors occurs. | [
"Gets",
"unicode",
"sets",
"containing",
"contractions",
"and",
"/",
"or",
"expansions",
"of",
"a",
"collator"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L989-L998 |
spring-projects/spring-security-oauth | spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/client/CoreOAuthConsumerSupport.java | CoreOAuthConsumerSupport.configureURLForProtectedAccess | public URL configureURLForProtectedAccess(URL url, OAuthConsumerToken accessToken, String httpMethod, Map<String, String> additionalParameters) throws OAuthRequestFailedException {
return configureURLForProtectedAccess(url, accessToken, getProtectedResourceDetailsService().loadProtectedResourceDetailsById(accessToken.getResourceId()), httpMethod, additionalParameters);
} | java | public URL configureURLForProtectedAccess(URL url, OAuthConsumerToken accessToken, String httpMethod, Map<String, String> additionalParameters) throws OAuthRequestFailedException {
return configureURLForProtectedAccess(url, accessToken, getProtectedResourceDetailsService().loadProtectedResourceDetailsById(accessToken.getResourceId()), httpMethod, additionalParameters);
} | [
"public",
"URL",
"configureURLForProtectedAccess",
"(",
"URL",
"url",
",",
"OAuthConsumerToken",
"accessToken",
",",
"String",
"httpMethod",
",",
"Map",
"<",
"String",
",",
"String",
">",
"additionalParameters",
")",
"throws",
"OAuthRequestFailedException",
"{",
"retu... | Create a configured URL. If the HTTP method to access the resource is "POST" or "PUT" and the "Authorization"
header isn't supported, then the OAuth parameters will be expected to be sent in the body of the request. Otherwise,
you can assume that the given URL is ready to be used without further work.
@param url The base URL.
@param accessToken The access token.
@param httpMethod The HTTP method.
@param additionalParameters Any additional request parameters.
@return The configured URL. | [
"Create",
"a",
"configured",
"URL",
".",
"If",
"the",
"HTTP",
"method",
"to",
"access",
"the",
"resource",
"is",
"POST",
"or",
"PUT",
"and",
"the",
"Authorization",
"header",
"isn",
"t",
"supported",
"then",
"the",
"OAuth",
"parameters",
"will",
"be",
"exp... | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/client/CoreOAuthConsumerSupport.java#L258-L260 |
FXMisc/WellBehavedFX | src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java | InputMapTemplate.consumeUnless | public static <S, T extends Event, U extends T> InputMapTemplate<S, U> consumeUnless(
EventPattern<? super T, ? extends U> eventPattern,
Predicate<? super S> condition,
BiConsumer<? super S, ? super U> action) {
return consumeWhen(eventPattern, condition.negate(), action);
} | java | public static <S, T extends Event, U extends T> InputMapTemplate<S, U> consumeUnless(
EventPattern<? super T, ? extends U> eventPattern,
Predicate<? super S> condition,
BiConsumer<? super S, ? super U> action) {
return consumeWhen(eventPattern, condition.negate(), action);
} | [
"public",
"static",
"<",
"S",
",",
"T",
"extends",
"Event",
",",
"U",
"extends",
"T",
">",
"InputMapTemplate",
"<",
"S",
",",
"U",
">",
"consumeUnless",
"(",
"EventPattern",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"U",
">",
"eventPattern",
",",
... | If the given {@link EventPattern} matches the given event type and {@code condition} is false,
consumes the event and does not attempt to match additional
{@code InputMap}s (if they exist). If {@code condition} is true, continues to try to pattern match
the event type with the next {@code InputMap} (if one exists). | [
"If",
"the",
"given",
"{"
] | train | https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L292-L297 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.signParams | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) {
if (MapUtil.isEmpty(params)) {
return null;
}
final String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull);
return new Digester(digestAlgorithm).digestHex(paramsStr);
} | java | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) {
if (MapUtil.isEmpty(params)) {
return null;
}
final String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull);
return new Digester(digestAlgorithm).digestHex(paramsStr);
} | [
"public",
"static",
"String",
"signParams",
"(",
"DigestAlgorithm",
"digestAlgorithm",
",",
"Map",
"<",
"?",
",",
"?",
">",
"params",
",",
"String",
"separator",
",",
"String",
"keyValueSeparator",
",",
"boolean",
"isIgnoreNull",
")",
"{",
"if",
"(",
"MapUtil"... | 对参数做签名<br>
参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串
@param digestAlgorithm 摘要算法
@param params 参数
@param separator entry之间的连接符
@param keyValueSeparator kv之间的连接符
@param isIgnoreNull 是否忽略null的键和值
@return 签名
@since 4.0.1 | [
"对参数做签名<br",
">",
"参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L920-L926 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_resiliate_POST | public OvhResiliationFollowUpDetail serviceName_resiliate_POST(String serviceName, Date resiliationDate, OvhResiliationSurvey resiliationSurvey) throws IOException {
String qPath = "/xdsl/{serviceName}/resiliate";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "resiliationDate", resiliationDate);
addBody(o, "resiliationSurvey", resiliationSurvey);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhResiliationFollowUpDetail.class);
} | java | public OvhResiliationFollowUpDetail serviceName_resiliate_POST(String serviceName, Date resiliationDate, OvhResiliationSurvey resiliationSurvey) throws IOException {
String qPath = "/xdsl/{serviceName}/resiliate";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "resiliationDate", resiliationDate);
addBody(o, "resiliationSurvey", resiliationSurvey);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhResiliationFollowUpDetail.class);
} | [
"public",
"OvhResiliationFollowUpDetail",
"serviceName_resiliate_POST",
"(",
"String",
"serviceName",
",",
"Date",
"resiliationDate",
",",
"OvhResiliationSurvey",
"resiliationSurvey",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/resiliate\""... | Resiliate the access
REST: POST /xdsl/{serviceName}/resiliate
@param resiliationSurvey [required] Comment about resiliation reasons
@param resiliationDate [required] The desired resiliation date
@param serviceName [required] The internal name of your XDSL offer | [
"Resiliate",
"the",
"access"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L626-L634 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java | ImageLoader.asMatrix | public INDArray asMatrix(InputStream inputStream) throws IOException {
if (channels == 3)
return toBgr(inputStream);
try {
BufferedImage image = ImageIO.read(inputStream);
return asMatrix(image);
} catch (IOException e) {
throw new IOException("Unable to load image", e);
}
} | java | public INDArray asMatrix(InputStream inputStream) throws IOException {
if (channels == 3)
return toBgr(inputStream);
try {
BufferedImage image = ImageIO.read(inputStream);
return asMatrix(image);
} catch (IOException e) {
throw new IOException("Unable to load image", e);
}
} | [
"public",
"INDArray",
"asMatrix",
"(",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"channels",
"==",
"3",
")",
"return",
"toBgr",
"(",
"inputStream",
")",
";",
"try",
"{",
"BufferedImage",
"image",
"=",
"ImageIO",
".",
"read",... | Convert an input stream to a matrix
@param inputStream the input stream to convert
@return the input stream to convert | [
"Convert",
"an",
"input",
"stream",
"to",
"a",
"matrix"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java#L261-L270 |
arnaudroger/SimpleFlatMapper | sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/ConnectedCrud.java | ConnectedCrud.create | public <RH extends CheckedConsumer<? super K>> RH create(final T value, final RH keyConsumer) throws SQLException {
transactionTemplate
.doInTransaction(new SQLFunction<Connection, Object>() {
@Override
public Object apply(Connection connection) throws SQLException {
delegate.create(connection, value, keyConsumer);
return null;
}
});
return keyConsumer;
} | java | public <RH extends CheckedConsumer<? super K>> RH create(final T value, final RH keyConsumer) throws SQLException {
transactionTemplate
.doInTransaction(new SQLFunction<Connection, Object>() {
@Override
public Object apply(Connection connection) throws SQLException {
delegate.create(connection, value, keyConsumer);
return null;
}
});
return keyConsumer;
} | [
"public",
"<",
"RH",
"extends",
"CheckedConsumer",
"<",
"?",
"super",
"K",
">",
">",
"RH",
"create",
"(",
"final",
"T",
"value",
",",
"final",
"RH",
"keyConsumer",
")",
"throws",
"SQLException",
"{",
"transactionTemplate",
".",
"doInTransaction",
"(",
"new",... | insert value into the db through the specified connection.
Callback keyConsumer with the generated key if one was.
@param value the value
@param keyConsumer the key consumer
@param <RH> the type of keyConsumer
@return the keyConsumer
@throws SQLException | [
"insert",
"value",
"into",
"the",
"db",
"through",
"the",
"specified",
"connection",
".",
"Callback",
"keyConsumer",
"with",
"the",
"generated",
"key",
"if",
"one",
"was",
"."
] | train | https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/ConnectedCrud.java#L70-L80 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/Parser.java | Parser.processArgs | public void processArgs(Option opt, ListIterator<String> iter) throws ParseException
{
// loop until an option is found
while (iter.hasNext())
{
String str = iter.next();
// found an Option, not an argument
if (getOptions().hasOption(str) && str.startsWith("-"))
{
iter.previous();
break;
}
// found a value
try
{
opt.addValueForProcessing(Util.stripLeadingAndTrailingQuotes(str));
}
catch (RuntimeException exp)
{
iter.previous();
break;
}
}
if (opt.getValues() == null && !opt.hasOptionalArg())
{
throw new MissingArgumentException(opt);
}
} | java | public void processArgs(Option opt, ListIterator<String> iter) throws ParseException
{
// loop until an option is found
while (iter.hasNext())
{
String str = iter.next();
// found an Option, not an argument
if (getOptions().hasOption(str) && str.startsWith("-"))
{
iter.previous();
break;
}
// found a value
try
{
opt.addValueForProcessing(Util.stripLeadingAndTrailingQuotes(str));
}
catch (RuntimeException exp)
{
iter.previous();
break;
}
}
if (opt.getValues() == null && !opt.hasOptionalArg())
{
throw new MissingArgumentException(opt);
}
} | [
"public",
"void",
"processArgs",
"(",
"Option",
"opt",
",",
"ListIterator",
"<",
"String",
">",
"iter",
")",
"throws",
"ParseException",
"{",
"// loop until an option is found",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"str",
"=",
... | Process the argument values for the specified Option
<code>opt</code> using the values retrieved from the
specified iterator <code>iter</code>.
@param opt The current Option
@param iter The iterator over the flattened command line Options.
@throws ParseException if an argument value is required
and it is has not been found. | [
"Process",
"the",
"argument",
"values",
"for",
"the",
"specified",
"Option",
"<code",
">",
"opt<",
"/",
"code",
">",
"using",
"the",
"values",
"retrieved",
"from",
"the",
"specified",
"iterator",
"<code",
">",
"iter<",
"/",
"code",
">",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/Parser.java#L335-L365 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java | MapMessage.with | @SuppressWarnings("unchecked")
public M with(final String key, final short value) {
validate(key, value);
data.putValue(key, value);
return (M) this;
} | java | @SuppressWarnings("unchecked")
public M with(final String key, final short value) {
validate(key, value);
data.putValue(key, value);
return (M) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"M",
"with",
"(",
"final",
"String",
"key",
",",
"final",
"short",
"value",
")",
"{",
"validate",
"(",
"key",
",",
"value",
")",
";",
"data",
".",
"putValue",
"(",
"key",
",",
"value",
")",
... | Adds an item to the data Map.
@param key The name of the data item.
@param value The value of the data item.
@return this object
@since 2.9 | [
"Adds",
"an",
"item",
"to",
"the",
"data",
"Map",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L652-L657 |
killbill/killbill | payment/src/main/java/org/killbill/billing/payment/core/PaymentRefresher.java | PaymentRefresher.toPayment | private Payment toPayment(final PaymentModelDao paymentModelDao, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context, final InternalTenantContext tenantContext) throws PaymentApiException {
final PaymentPluginApi plugin = getPaymentProviderPlugin(paymentModelDao.getPaymentMethodId(), true, tenantContext);
final List<PaymentTransactionInfoPlugin> pluginTransactions = withPluginInfo ? getPaymentTransactionInfoPlugins(plugin, paymentModelDao, properties, context) : null;
return toPayment(paymentModelDao, pluginTransactions, withAttempts, tenantContext);
} | java | private Payment toPayment(final PaymentModelDao paymentModelDao, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context, final InternalTenantContext tenantContext) throws PaymentApiException {
final PaymentPluginApi plugin = getPaymentProviderPlugin(paymentModelDao.getPaymentMethodId(), true, tenantContext);
final List<PaymentTransactionInfoPlugin> pluginTransactions = withPluginInfo ? getPaymentTransactionInfoPlugins(plugin, paymentModelDao, properties, context) : null;
return toPayment(paymentModelDao, pluginTransactions, withAttempts, tenantContext);
} | [
"private",
"Payment",
"toPayment",
"(",
"final",
"PaymentModelDao",
"paymentModelDao",
",",
"final",
"boolean",
"withPluginInfo",
",",
"final",
"boolean",
"withAttempts",
",",
"final",
"Iterable",
"<",
"PluginProperty",
">",
"properties",
",",
"final",
"TenantContext"... | Used in single get APIs (getPayment / getPaymentByExternalKey) | [
"Used",
"in",
"single",
"get",
"APIs",
"(",
"getPayment",
"/",
"getPaymentByExternalKey",
")"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/payment/src/main/java/org/killbill/billing/payment/core/PaymentRefresher.java#L388-L393 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createPartialMock | public static synchronized <T> T createPartialMock(Class<T> type, String methodNameToMock,
Class<?> firstArgumentType, Class<?>... additionalArgumentTypes) {
return doMockSpecific(type, new DefaultMockStrategy(), new String[]{methodNameToMock}, null,
mergeArgumentTypes(firstArgumentType, additionalArgumentTypes));
} | java | public static synchronized <T> T createPartialMock(Class<T> type, String methodNameToMock,
Class<?> firstArgumentType, Class<?>... additionalArgumentTypes) {
return doMockSpecific(type, new DefaultMockStrategy(), new String[]{methodNameToMock}, null,
mergeArgumentTypes(firstArgumentType, additionalArgumentTypes));
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"createPartialMock",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"methodNameToMock",
",",
"Class",
"<",
"?",
">",
"firstArgumentType",
",",
"Class",
"<",
"?",
">",
"...",
"additionalArgumentType... | Mock a single specific method. Use this to handle overloaded methods.
@param <T> The type of the mock.
@param type The type that'll be used to create a mock instance.
@param methodNameToMock The name of the method to mock
@param firstArgumentType The type of the first parameter of the method to mock
@param additionalArgumentTypes Optionally more parameter types that defines the method. Note
that this is only needed to separate overloaded methods.
@return A mock object of type <T>. | [
"Mock",
"a",
"single",
"specific",
"method",
".",
"Use",
"this",
"to",
"handle",
"overloaded",
"methods",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L467-L471 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.isPrefixPath | public static boolean isPrefixPath(String firstPath, String secondPath) {
firstPath = CmsStringUtil.joinPaths(firstPath, "/");
secondPath = CmsStringUtil.joinPaths(secondPath, "/");
return secondPath.startsWith(firstPath);
} | java | public static boolean isPrefixPath(String firstPath, String secondPath) {
firstPath = CmsStringUtil.joinPaths(firstPath, "/");
secondPath = CmsStringUtil.joinPaths(secondPath, "/");
return secondPath.startsWith(firstPath);
} | [
"public",
"static",
"boolean",
"isPrefixPath",
"(",
"String",
"firstPath",
",",
"String",
"secondPath",
")",
"{",
"firstPath",
"=",
"CmsStringUtil",
".",
"joinPaths",
"(",
"firstPath",
",",
"\"/\"",
")",
";",
"secondPath",
"=",
"CmsStringUtil",
".",
"joinPaths",... | Checks if the first path is a prefix of the second path.<p>
This method is different compared to {@link String#startsWith},
because it considers <code>/foo/bar</code> to
be a prefix path of <code>/foo/bar/baz</code>,
but not of <code>/foo/bar42</code>.
<b>Directly exposed for JSP EL</b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p>
@param firstPath the first path
@param secondPath the second path
@return true if the first path is a prefix path of the second path | [
"Checks",
"if",
"the",
"first",
"path",
"is",
"a",
"prefix",
"of",
"the",
"second",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1099-L1104 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java | InstanceClient.setTagsInstance | @BetaApi
public final Operation setTagsInstance(ProjectZoneInstanceName instance, Tags tagsResource) {
SetTagsInstanceHttpRequest request =
SetTagsInstanceHttpRequest.newBuilder()
.setInstance(instance == null ? null : instance.toString())
.setTagsResource(tagsResource)
.build();
return setTagsInstance(request);
} | java | @BetaApi
public final Operation setTagsInstance(ProjectZoneInstanceName instance, Tags tagsResource) {
SetTagsInstanceHttpRequest request =
SetTagsInstanceHttpRequest.newBuilder()
.setInstance(instance == null ? null : instance.toString())
.setTagsResource(tagsResource)
.build();
return setTagsInstance(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"setTagsInstance",
"(",
"ProjectZoneInstanceName",
"instance",
",",
"Tags",
"tagsResource",
")",
"{",
"SetTagsInstanceHttpRequest",
"request",
"=",
"SetTagsInstanceHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setInstan... | Sets network tags for the specified instance to the data included in the request.
<p>Sample code:
<pre><code>
try (InstanceClient instanceClient = InstanceClient.create()) {
ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
Tags tagsResource = Tags.newBuilder().build();
Operation response = instanceClient.setTagsInstance(instance, tagsResource);
}
</code></pre>
@param instance Name of the instance scoping this request.
@param tagsResource A set of instance tags.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Sets",
"network",
"tags",
"for",
"the",
"specified",
"instance",
"to",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java#L3132-L3141 |
Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java | TaskGroup.invokeAfterPostRunAsync | private Observable<Indexable> invokeAfterPostRunAsync(final TaskGroupEntry<TaskItem> entry,
final InvocationContext context) {
return Observable.defer(new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
final ProxyTaskItem proxyTaskItem = (ProxyTaskItem) entry.data();
if (proxyTaskItem == null) {
return Observable.empty();
}
final boolean isFaulted = entry.hasFaultedDescentDependencyTasks() || isGroupCancelled.get();
Observable<Indexable> postRunObservable = proxyTaskItem.invokeAfterPostRunAsync(isFaulted).toObservable();
Func1<Throwable, Observable<Indexable>> onError = new Func1<Throwable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Throwable error) {
return processFaultedTaskAsync(entry, error, context);
}
};
Func0<Observable<Indexable>> onComplete = new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
if (isFaulted) {
if (entry.hasFaultedDescentDependencyTasks()) {
return processFaultedTaskAsync(entry, new ErroredDependencyTaskException(), context);
} else {
return processFaultedTaskAsync(entry, taskCancelledException, context);
}
} else {
return Observable.concat(Observable.just(proxyTaskItem.result()),
processCompletedTaskAsync(entry, context));
}
}
};
return postRunObservable.flatMap(null, // no onNext call as stream is created from Completable.
onError,
onComplete);
}
});
} | java | private Observable<Indexable> invokeAfterPostRunAsync(final TaskGroupEntry<TaskItem> entry,
final InvocationContext context) {
return Observable.defer(new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
final ProxyTaskItem proxyTaskItem = (ProxyTaskItem) entry.data();
if (proxyTaskItem == null) {
return Observable.empty();
}
final boolean isFaulted = entry.hasFaultedDescentDependencyTasks() || isGroupCancelled.get();
Observable<Indexable> postRunObservable = proxyTaskItem.invokeAfterPostRunAsync(isFaulted).toObservable();
Func1<Throwable, Observable<Indexable>> onError = new Func1<Throwable, Observable<Indexable>>() {
@Override
public Observable<Indexable> call(final Throwable error) {
return processFaultedTaskAsync(entry, error, context);
}
};
Func0<Observable<Indexable>> onComplete = new Func0<Observable<Indexable>>() {
@Override
public Observable<Indexable> call() {
if (isFaulted) {
if (entry.hasFaultedDescentDependencyTasks()) {
return processFaultedTaskAsync(entry, new ErroredDependencyTaskException(), context);
} else {
return processFaultedTaskAsync(entry, taskCancelledException, context);
}
} else {
return Observable.concat(Observable.just(proxyTaskItem.result()),
processCompletedTaskAsync(entry, context));
}
}
};
return postRunObservable.flatMap(null, // no onNext call as stream is created from Completable.
onError,
onComplete);
}
});
} | [
"private",
"Observable",
"<",
"Indexable",
">",
"invokeAfterPostRunAsync",
"(",
"final",
"TaskGroupEntry",
"<",
"TaskItem",
">",
"entry",
",",
"final",
"InvocationContext",
"context",
")",
"{",
"return",
"Observable",
".",
"defer",
"(",
"new",
"Func0",
"<",
"Obs... | Invokes the {@link TaskItem#invokeAfterPostRunAsync(boolean)} method of an actual TaskItem
if the given entry holds a ProxyTaskItem.
@param entry the entry holding a ProxyTaskItem
@param context a group level shared context
@return An Observable that represents asynchronous work started by
{@link TaskItem#invokeAfterPostRunAsync(boolean)} method of actual TaskItem and result of subset
of tasks which gets scheduled after proxy task. If group was not in faulted state and
{@link TaskItem#invokeAfterPostRunAsync(boolean)} emits no error then stream also includes
result produced by actual TaskItem. | [
"Invokes",
"the",
"{",
"@link",
"TaskItem#invokeAfterPostRunAsync",
"(",
"boolean",
")",
"}",
"method",
"of",
"an",
"actual",
"TaskItem",
"if",
"the",
"given",
"entry",
"holds",
"a",
"ProxyTaskItem",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/TaskGroup.java#L433-L471 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/FontUtils.java | FontUtils.getFont | public static Font getFont (int style, Size size) {
return getFont(getDefaultFont(), size).deriveFont(style);
} | java | public static Font getFont (int style, Size size) {
return getFont(getDefaultFont(), size).deriveFont(style);
} | [
"public",
"static",
"Font",
"getFont",
"(",
"int",
"style",
",",
"Size",
"size",
")",
"{",
"return",
"getFont",
"(",
"getDefaultFont",
"(",
")",
",",
"size",
")",
".",
"deriveFont",
"(",
"style",
")",
";",
"}"
] | Gets the default font with the specified style and size, correctly scaled
@param style
@param size
@return | [
"Gets",
"the",
"default",
"font",
"with",
"the",
"specified",
"style",
"and",
"size",
"correctly",
"scaled"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/FontUtils.java#L179-L181 |
jenkinsci/jenkins | core/src/main/java/hudson/model/LargeText.java | LargeText.doProgressText | public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException {
rsp.setContentType("text/plain");
rsp.setStatus(HttpServletResponse.SC_OK);
if(!source.exists()) {
// file doesn't exist yet
rsp.addHeader("X-Text-Size","0");
rsp.addHeader("X-More-Data","true");
return;
}
long start = 0;
String s = req.getParameter("start");
if(s!=null)
start = Long.parseLong(s);
if(source.length() < start )
start = 0; // text rolled over
CharSpool spool = new CharSpool();
long r = writeLogTo(start,spool);
rsp.addHeader("X-Text-Size",String.valueOf(r));
if(!completed)
rsp.addHeader("X-More-Data","true");
// when sending big text, try compression. don't bother if it's small
Writer w;
if(r-start>4096)
w = rsp.getCompressedWriter(req);
else
w = rsp.getWriter();
spool.writeTo(new LineEndNormalizingWriter(w));
w.close();
} | java | public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException {
rsp.setContentType("text/plain");
rsp.setStatus(HttpServletResponse.SC_OK);
if(!source.exists()) {
// file doesn't exist yet
rsp.addHeader("X-Text-Size","0");
rsp.addHeader("X-More-Data","true");
return;
}
long start = 0;
String s = req.getParameter("start");
if(s!=null)
start = Long.parseLong(s);
if(source.length() < start )
start = 0; // text rolled over
CharSpool spool = new CharSpool();
long r = writeLogTo(start,spool);
rsp.addHeader("X-Text-Size",String.valueOf(r));
if(!completed)
rsp.addHeader("X-More-Data","true");
// when sending big text, try compression. don't bother if it's small
Writer w;
if(r-start>4096)
w = rsp.getCompressedWriter(req);
else
w = rsp.getWriter();
spool.writeTo(new LineEndNormalizingWriter(w));
w.close();
} | [
"public",
"void",
"doProgressText",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
"{",
"rsp",
".",
"setContentType",
"(",
"\"text/plain\"",
")",
";",
"rsp",
".",
"setStatus",
"(",
"HttpServletResponse",
".",
"SC_OK",
... | Implements the progressive text handling.
This method is used as a "web method" with progressiveText.jelly. | [
"Implements",
"the",
"progressive",
"text",
"handling",
".",
"This",
"method",
"is",
"used",
"as",
"a",
"web",
"method",
"with",
"progressiveText",
".",
"jelly",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/LargeText.java#L178-L213 |
perwendel/spark | src/main/java/spark/staticfiles/StaticFilesConfiguration.java | StaticFilesConfiguration.configureExternal | public synchronized void configureExternal(String folder) {
Assert.notNull(folder, "'folder' must not be null");
if (!externalStaticResourcesSet) {
try {
ExternalResource resource = new ExternalResource(folder);
if (!resource.getFile().isDirectory()) {
LOG.error("External Static resource location must be a folder");
return;
}
if (staticResourceHandlers == null) {
staticResourceHandlers = new ArrayList<>();
}
staticResourceHandlers.add(new ExternalResourceHandler(folder, "index.html"));
LOG.info("External StaticResourceHandler configured with folder = " + folder);
} catch (IOException e) {
LOG.error("Error when creating external StaticResourceHandler", e);
}
externalStaticResourcesSet = true;
}
} | java | public synchronized void configureExternal(String folder) {
Assert.notNull(folder, "'folder' must not be null");
if (!externalStaticResourcesSet) {
try {
ExternalResource resource = new ExternalResource(folder);
if (!resource.getFile().isDirectory()) {
LOG.error("External Static resource location must be a folder");
return;
}
if (staticResourceHandlers == null) {
staticResourceHandlers = new ArrayList<>();
}
staticResourceHandlers.add(new ExternalResourceHandler(folder, "index.html"));
LOG.info("External StaticResourceHandler configured with folder = " + folder);
} catch (IOException e) {
LOG.error("Error when creating external StaticResourceHandler", e);
}
externalStaticResourcesSet = true;
}
} | [
"public",
"synchronized",
"void",
"configureExternal",
"(",
"String",
"folder",
")",
"{",
"Assert",
".",
"notNull",
"(",
"folder",
",",
"\"'folder' must not be null\"",
")",
";",
"if",
"(",
"!",
"externalStaticResourcesSet",
")",
"{",
"try",
"{",
"ExternalResource... | Configures location for static resources
@param folder the location | [
"Configures",
"location",
"for",
"static",
"resources"
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/staticfiles/StaticFilesConfiguration.java#L160-L182 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/LoggerOnThread.java | LoggerOnThread.renameFile | private void renameFile(File source, File target) {
if (!source.exists()) {
// don't do anything if the source file doesn't exist
return;
}
if (target.exists()) {
target.delete();
}
boolean rc = source.renameTo(target);
if (!rc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, getFileName() + ": Unable to rename " + source + " to " + target);
}
}
} | java | private void renameFile(File source, File target) {
if (!source.exists()) {
// don't do anything if the source file doesn't exist
return;
}
if (target.exists()) {
target.delete();
}
boolean rc = source.renameTo(target);
if (!rc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, getFileName() + ": Unable to rename " + source + " to " + target);
}
}
} | [
"private",
"void",
"renameFile",
"(",
"File",
"source",
",",
"File",
"target",
")",
"{",
"if",
"(",
"!",
"source",
".",
"exists",
"(",
")",
")",
"{",
"// don't do anything if the source file doesn't exist",
"return",
";",
"}",
"if",
"(",
"target",
".",
"exis... | Rename the source file into the target file, deleting the target if
necessary.
@param source
@param target | [
"Rename",
"the",
"source",
"file",
"into",
"the",
"target",
"file",
"deleting",
"the",
"target",
"if",
"necessary",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/LoggerOnThread.java#L347-L361 |
Netflix/spectator | spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java | Evaluator.addGroupSubscriptions | public Evaluator addGroupSubscriptions(String group, List<Subscription> subs) {
List<Subscription> oldSubs = subscriptions.put(group, subs);
if (oldSubs == null) {
LOGGER.debug("added group {} with {} subscriptions", group, subs.size());
} else {
LOGGER.debug("updated group {}, {} subscriptions before, {} subscriptions now",
group, oldSubs.size(), subs.size());
}
return this;
} | java | public Evaluator addGroupSubscriptions(String group, List<Subscription> subs) {
List<Subscription> oldSubs = subscriptions.put(group, subs);
if (oldSubs == null) {
LOGGER.debug("added group {} with {} subscriptions", group, subs.size());
} else {
LOGGER.debug("updated group {}, {} subscriptions before, {} subscriptions now",
group, oldSubs.size(), subs.size());
}
return this;
} | [
"public",
"Evaluator",
"addGroupSubscriptions",
"(",
"String",
"group",
",",
"List",
"<",
"Subscription",
">",
"subs",
")",
"{",
"List",
"<",
"Subscription",
">",
"oldSubs",
"=",
"subscriptions",
".",
"put",
"(",
"group",
",",
"subs",
")",
";",
"if",
"(",
... | Add subscriptions for a given group.
@param group
Name of the group. At Netflix this is typically the cluster that includes
the instance reporting data.
@param subs
Set of subscriptions for the group.
@return
This instance for chaining of update operations. | [
"Add",
"subscriptions",
"for",
"a",
"given",
"group",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java#L69-L78 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/SearchHelper.java | SearchHelper.setFilterExists | public void setFilterExists( final Set<String> attributeNames )
{
final StringBuilder sb = new StringBuilder();
sb.append( "(&" );
for ( final String name : attributeNames )
{
sb.append( "(" );
sb.append( new FilterSequence( name, "*", FilterSequence.MatchingRuleEnum.EQUALS ) );
sb.append( ")" );
}
sb.append( ")" );
filter = sb.toString();
} | java | public void setFilterExists( final Set<String> attributeNames )
{
final StringBuilder sb = new StringBuilder();
sb.append( "(&" );
for ( final String name : attributeNames )
{
sb.append( "(" );
sb.append( new FilterSequence( name, "*", FilterSequence.MatchingRuleEnum.EQUALS ) );
sb.append( ")" );
}
sb.append( ")" );
filter = sb.toString();
} | [
"public",
"void",
"setFilterExists",
"(",
"final",
"Set",
"<",
"String",
">",
"attributeNames",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"(&\"",
")",
";",
"for",
"(",
"final",
"Stri... | Set up an exists filter for attribute name. Consider the following example.
<table border="1"><caption>Example Values</caption>
<tr><td><b>Value</b></td></tr>
<tr><td>givenName</td></tr>
<tr><td>sn</td></tr>
</table>
<p><i>Result</i></p>
<code>(&(givenName=*)(sn=*))</code>
@param attributeNames A valid set of attribute names | [
"Set",
"up",
"an",
"exists",
"filter",
"for",
"attribute",
"name",
".",
"Consider",
"the",
"following",
"example",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/SearchHelper.java#L545-L560 |
deephacks/confit | core/src/main/java/org/deephacks/confit/internal/core/property/typesafe/impl/AbstractConfigObject.java | AbstractConfigObject.peekPath | AbstractConfigValue peekPath(Path path) {
try {
return peekPath(this, path, null);
} catch (NotPossibleToResolve e) {
throw new BugOrBroken(
"NotPossibleToResolve happened though we had no ResolveContext in peekPath");
}
} | java | AbstractConfigValue peekPath(Path path) {
try {
return peekPath(this, path, null);
} catch (NotPossibleToResolve e) {
throw new BugOrBroken(
"NotPossibleToResolve happened though we had no ResolveContext in peekPath");
}
} | [
"AbstractConfigValue",
"peekPath",
"(",
"Path",
"path",
")",
"{",
"try",
"{",
"return",
"peekPath",
"(",
"this",
",",
"path",
",",
"null",
")",
";",
"}",
"catch",
"(",
"NotPossibleToResolve",
"e",
")",
"{",
"throw",
"new",
"BugOrBroken",
"(",
"\"NotPossibl... | Looks up the path. Doesn't do any resolution, will throw if any is
needed. | [
"Looks",
"up",
"the",
"path",
".",
"Doesn",
"t",
"do",
"any",
"resolution",
"will",
"throw",
"if",
"any",
"is",
"needed",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/core/src/main/java/org/deephacks/confit/internal/core/property/typesafe/impl/AbstractConfigObject.java#L103-L110 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.toByteArray | public static byte[] toByteArray(String value) {
if (value == null) {
return null;
}
try {
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder().onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
ByteBuffer buf = encoder.encode(CharBuffer.wrap(value));
// don't use ByteBuffer.array(), as it returns internal, and
// possibly larger, byte array
byte[] res = new byte[buf.remaining()];
buf.get(res);
return res;
} catch (CharacterCodingException e) {
throw new RuntimeException("Unexpected exception", e);
}
} | java | public static byte[] toByteArray(String value) {
if (value == null) {
return null;
}
try {
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder().onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
ByteBuffer buf = encoder.encode(CharBuffer.wrap(value));
// don't use ByteBuffer.array(), as it returns internal, and
// possibly larger, byte array
byte[] res = new byte[buf.remaining()];
buf.get(res);
return res;
} catch (CharacterCodingException e) {
throw new RuntimeException("Unexpected exception", e);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"CharsetEncoder",
"encoder",
"=",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")... | Encodes the given string in UTF-8.
@param value
the string to encode.
@return A newly allocated array containing the encoding result. | [
"Encodes",
"the",
"given",
"string",
"in",
"UTF",
"-",
"8",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L164-L180 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java | WindowManager.restoreState | @SuppressWarnings("unchecked")
public void restoreState(Map<String, Serializable> state) {
LOG.info("Restoring window manager state");
//restore eviction policy state
if (state.get(EVICTION_STATE_KEY) != null) {
((EvictionPolicy) evictionPolicy).restoreState(state.get(EVICTION_STATE_KEY));
}
// restore trigger policy state
if (state.get(TRIGGER_STATE_KEY) != null) {
((TriggerPolicy) triggerPolicy).restoreState(state.get(TRIGGER_STATE_KEY));
}
// restore all pending events to the queue
this.queue.addAll((Collection<Event<T>>) state.get(QUEUE));
// restore all expired events
this.expiredEvents.addAll((List<T>) state.get(EXPIRED_EVENTS));
// restore all prevWindowEvents
this.prevWindowEvents.addAll((Set<Event<T>>) state.get(PRE_WINDOW_EVENTS));
// restore the count of the number events since last expiry
this.eventsSinceLastExpiry.set((int) state.get(EVENTS_SINCE_LAST_EXPIRY));
} | java | @SuppressWarnings("unchecked")
public void restoreState(Map<String, Serializable> state) {
LOG.info("Restoring window manager state");
//restore eviction policy state
if (state.get(EVICTION_STATE_KEY) != null) {
((EvictionPolicy) evictionPolicy).restoreState(state.get(EVICTION_STATE_KEY));
}
// restore trigger policy state
if (state.get(TRIGGER_STATE_KEY) != null) {
((TriggerPolicy) triggerPolicy).restoreState(state.get(TRIGGER_STATE_KEY));
}
// restore all pending events to the queue
this.queue.addAll((Collection<Event<T>>) state.get(QUEUE));
// restore all expired events
this.expiredEvents.addAll((List<T>) state.get(EXPIRED_EVENTS));
// restore all prevWindowEvents
this.prevWindowEvents.addAll((Set<Event<T>>) state.get(PRE_WINDOW_EVENTS));
// restore the count of the number events since last expiry
this.eventsSinceLastExpiry.set((int) state.get(EVENTS_SINCE_LAST_EXPIRY));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"restoreState",
"(",
"Map",
"<",
"String",
",",
"Serializable",
">",
"state",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Restoring window manager state\"",
")",
";",
"//restore eviction policy state",
... | Restore state associated with the window manager
@param state | [
"Restore",
"state",
"associated",
"with",
"the",
"window",
"manager"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java#L315-L340 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.createHttpRequestFromHttp2Headers | public static HttpRequest createHttpRequestFromHttp2Headers(Http2Headers http2Headers, int streamId)
throws Http2Exception {
String method = Constants.HTTP_GET_METHOD;
if (http2Headers.method() != null) {
method = http2Headers.getAndRemove(Constants.HTTP2_METHOD).toString();
}
String path = Constants.DEFAULT_BASE_PATH;
if (http2Headers.path() != null) {
path = http2Headers.getAndRemove(Constants.HTTP2_PATH).toString();
}
// Remove PseudoHeaderNames from headers
http2Headers.getAndRemove(Constants.HTTP2_AUTHORITY);
http2Headers.getAndRemove(Constants.HTTP2_SCHEME);
HttpVersion version = new HttpVersion(Constants.HTTP_VERSION_2_0, true);
// Construct new HTTP Carbon Request
HttpRequest httpRequest = new DefaultHttpRequest(version, HttpMethod.valueOf(method), path);
// Convert Http2Headers to HttpHeaders
HttpConversionUtil.addHttp2ToHttpHeaders(
streamId, http2Headers, httpRequest.headers(), version, false, true);
return httpRequest;
} | java | public static HttpRequest createHttpRequestFromHttp2Headers(Http2Headers http2Headers, int streamId)
throws Http2Exception {
String method = Constants.HTTP_GET_METHOD;
if (http2Headers.method() != null) {
method = http2Headers.getAndRemove(Constants.HTTP2_METHOD).toString();
}
String path = Constants.DEFAULT_BASE_PATH;
if (http2Headers.path() != null) {
path = http2Headers.getAndRemove(Constants.HTTP2_PATH).toString();
}
// Remove PseudoHeaderNames from headers
http2Headers.getAndRemove(Constants.HTTP2_AUTHORITY);
http2Headers.getAndRemove(Constants.HTTP2_SCHEME);
HttpVersion version = new HttpVersion(Constants.HTTP_VERSION_2_0, true);
// Construct new HTTP Carbon Request
HttpRequest httpRequest = new DefaultHttpRequest(version, HttpMethod.valueOf(method), path);
// Convert Http2Headers to HttpHeaders
HttpConversionUtil.addHttp2ToHttpHeaders(
streamId, http2Headers, httpRequest.headers(), version, false, true);
return httpRequest;
} | [
"public",
"static",
"HttpRequest",
"createHttpRequestFromHttp2Headers",
"(",
"Http2Headers",
"http2Headers",
",",
"int",
"streamId",
")",
"throws",
"Http2Exception",
"{",
"String",
"method",
"=",
"Constants",
".",
"HTTP_GET_METHOD",
";",
"if",
"(",
"http2Headers",
"."... | Creates a {@link HttpRequest} using a {@link Http2Headers} received over a particular HTTP/2 stream.
@param http2Headers the Http2Headers received over a HTTP/2 stream
@param streamId the stream id
@return the HttpRequest formed using the HttpHeaders
@throws Http2Exception if an error occurs while converting headers from HTTP/2 to HTTP | [
"Creates",
"a",
"{",
"@link",
"HttpRequest",
"}",
"using",
"a",
"{",
"@link",
"Http2Headers",
"}",
"received",
"over",
"a",
"particular",
"HTTP",
"/",
"2",
"stream",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L244-L265 |
phxql/argon2-jvm | src/main/java/de/mkammerer/argon2/Argon2Factory.java | Argon2Factory.createAdvanced | public static Argon2Advanced createAdvanced(Argon2Types type) {
return createInternal(type, Argon2Constants.DEFAULT_SALT_LENGTH, Argon2Constants.DEFAULT_HASH_LENGTH);
} | java | public static Argon2Advanced createAdvanced(Argon2Types type) {
return createInternal(type, Argon2Constants.DEFAULT_SALT_LENGTH, Argon2Constants.DEFAULT_HASH_LENGTH);
} | [
"public",
"static",
"Argon2Advanced",
"createAdvanced",
"(",
"Argon2Types",
"type",
")",
"{",
"return",
"createInternal",
"(",
"type",
",",
"Argon2Constants",
".",
"DEFAULT_SALT_LENGTH",
",",
"Argon2Constants",
".",
"DEFAULT_HASH_LENGTH",
")",
";",
"}"
] | Creates a new {@link Argon2Advanced} instance with the given type.
@param type Argon2 type.
@return Argon2Advanced instance. | [
"Creates",
"a",
"new",
"{",
"@link",
"Argon2Advanced",
"}",
"instance",
"with",
"the",
"given",
"type",
"."
] | train | https://github.com/phxql/argon2-jvm/blob/27a13907729e67e98cca53eba279e109b60f04f1/src/main/java/de/mkammerer/argon2/Argon2Factory.java#L71-L73 |
h2oai/h2o-3 | h2o-core/src/main/java/jsr166y/ForkJoinTask.java | ForkJoinTask.invokeAll | public static void invokeAll(ForkJoinTask<?> t1, ForkJoinTask<?> t2) {
int s1, s2;
t2.fork();
if ((s1 = t1.doInvoke() & DONE_MASK) != NORMAL)
t1.reportException(s1);
if ((s2 = t2.doJoin() & DONE_MASK) != NORMAL)
t2.reportException(s2);
} | java | public static void invokeAll(ForkJoinTask<?> t1, ForkJoinTask<?> t2) {
int s1, s2;
t2.fork();
if ((s1 = t1.doInvoke() & DONE_MASK) != NORMAL)
t1.reportException(s1);
if ((s2 = t2.doJoin() & DONE_MASK) != NORMAL)
t2.reportException(s2);
} | [
"public",
"static",
"void",
"invokeAll",
"(",
"ForkJoinTask",
"<",
"?",
">",
"t1",
",",
"ForkJoinTask",
"<",
"?",
">",
"t2",
")",
"{",
"int",
"s1",
",",
"s2",
";",
"t2",
".",
"fork",
"(",
")",
";",
"if",
"(",
"(",
"s1",
"=",
"t1",
".",
"doInvok... | Forks the given tasks, returning when {@code isDone} holds for
each task or an (unchecked) exception is encountered, in which
case the exception is rethrown. If more than one task
encounters an exception, then this method throws any one of
these exceptions. If any task encounters an exception, the
other may be cancelled. However, the execution status of
individual tasks is not guaranteed upon exceptional return. The
status of each task may be obtained using {@link
#getException()} and related methods to check if they have been
cancelled, completed normally or exceptionally, or left
unprocessed.
<p>This method may be invoked only from within {@code
ForkJoinPool} computations (as may be determined using method
{@link #inForkJoinPool}). Attempts to invoke in other contexts
result in exceptions or errors, possibly including {@code
ClassCastException}.
@param t1 the first task
@param t2 the second task
@throws NullPointerException if any task is null | [
"Forks",
"the",
"given",
"tasks",
"returning",
"when",
"{",
"@code",
"isDone",
"}",
"holds",
"for",
"each",
"task",
"or",
"an",
"(",
"unchecked",
")",
"exception",
"is",
"encountered",
"in",
"which",
"case",
"the",
"exception",
"is",
"rethrown",
".",
"If",... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/ForkJoinTask.java#L700-L707 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.accessRestriction_u2f_POST | public OvhU2FRegisterChallenge accessRestriction_u2f_POST() throws IOException {
String qPath = "/me/accessRestriction/u2f";
StringBuilder sb = path(qPath);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhU2FRegisterChallenge.class);
} | java | public OvhU2FRegisterChallenge accessRestriction_u2f_POST() throws IOException {
String qPath = "/me/accessRestriction/u2f";
StringBuilder sb = path(qPath);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhU2FRegisterChallenge.class);
} | [
"public",
"OvhU2FRegisterChallenge",
"accessRestriction_u2f_POST",
"(",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/accessRestriction/u2f\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
... | Add a U2F access restriction
REST: POST /me/accessRestriction/u2f | [
"Add",
"a",
"U2F",
"access",
"restriction"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4166-L4171 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java | ScopedServletUtils.renameScope | public static void renameScope( Object oldScopeKey, Object newScopeKey, HttpServletRequest request )
{
assert ! ( request instanceof ScopedRequest );
String requestAttr = getScopedName( OVERRIDE_REQUEST_ATTR, oldScopeKey );
String responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, oldScopeKey );
ScopedRequest scopedRequest = ( ScopedRequest ) request.getAttribute( requestAttr );
ScopedResponse scopedResponse = ( ScopedResponse ) request.getAttribute( responseAttr );
if ( scopedRequest != null )
{
scopedRequest.renameScope( newScopeKey );
request.removeAttribute( requestAttr );
requestAttr = getScopedName( OVERRIDE_REQUEST_ATTR, newScopeKey );
request.setAttribute( requestAttr, scopedRequest );
}
else
{
ScopedRequestImpl.renameSessionScope( oldScopeKey, newScopeKey, request );
}
if ( scopedResponse != null )
{
request.removeAttribute( responseAttr );
responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, newScopeKey );
request.setAttribute( responseAttr, scopedResponse );
}
} | java | public static void renameScope( Object oldScopeKey, Object newScopeKey, HttpServletRequest request )
{
assert ! ( request instanceof ScopedRequest );
String requestAttr = getScopedName( OVERRIDE_REQUEST_ATTR, oldScopeKey );
String responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, oldScopeKey );
ScopedRequest scopedRequest = ( ScopedRequest ) request.getAttribute( requestAttr );
ScopedResponse scopedResponse = ( ScopedResponse ) request.getAttribute( responseAttr );
if ( scopedRequest != null )
{
scopedRequest.renameScope( newScopeKey );
request.removeAttribute( requestAttr );
requestAttr = getScopedName( OVERRIDE_REQUEST_ATTR, newScopeKey );
request.setAttribute( requestAttr, scopedRequest );
}
else
{
ScopedRequestImpl.renameSessionScope( oldScopeKey, newScopeKey, request );
}
if ( scopedResponse != null )
{
request.removeAttribute( responseAttr );
responseAttr = getScopedName( OVERRIDE_RESPONSE_ATTR, newScopeKey );
request.setAttribute( responseAttr, scopedResponse );
}
} | [
"public",
"static",
"void",
"renameScope",
"(",
"Object",
"oldScopeKey",
",",
"Object",
"newScopeKey",
",",
"HttpServletRequest",
"request",
")",
"{",
"assert",
"!",
"(",
"request",
"instanceof",
"ScopedRequest",
")",
";",
"String",
"requestAttr",
"=",
"getScopedN... | Find all scoped objects ({@link ScopedRequest}, {@link ScopedResponse})
which have a certain scope-key, replaces this scope-key with the new one, and re-caches the objects
the new scope-key.
@param oldScopeKey
@param newScopeKey
@param request the real (outer) request, where the scoped objects are cached. | [
"Find",
"all",
"scoped",
"objects",
"(",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L147-L174 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_game_ipOnGame_rule_POST | public OvhGameMitigationRule ip_game_ipOnGame_rule_POST(String ip, String ipOnGame, OvhRange<Long> ports, OvhGameMitigationRuleProtocolEnum protocol) throws IOException {
String qPath = "/ip/{ip}/game/{ipOnGame}/rule";
StringBuilder sb = path(qPath, ip, ipOnGame);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ports", ports);
addBody(o, "protocol", protocol);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhGameMitigationRule.class);
} | java | public OvhGameMitigationRule ip_game_ipOnGame_rule_POST(String ip, String ipOnGame, OvhRange<Long> ports, OvhGameMitigationRuleProtocolEnum protocol) throws IOException {
String qPath = "/ip/{ip}/game/{ipOnGame}/rule";
StringBuilder sb = path(qPath, ip, ipOnGame);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ports", ports);
addBody(o, "protocol", protocol);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhGameMitigationRule.class);
} | [
"public",
"OvhGameMitigationRule",
"ip_game_ipOnGame_rule_POST",
"(",
"String",
"ip",
",",
"String",
"ipOnGame",
",",
"OvhRange",
"<",
"Long",
">",
"ports",
",",
"OvhGameMitigationRuleProtocolEnum",
"protocol",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"="... | Add new rule on your IP
REST: POST /ip/{ip}/game/{ipOnGame}/rule
@param protocol [required] The protocol running behind the given port
@param ports [required] The UDP port range to apply the rule on
@param ip [required]
@param ipOnGame [required] | [
"Add",
"new",
"rule",
"on",
"your",
"IP"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L374-L382 |
VoltDB/voltdb | src/frontend/org/voltdb/expressions/ExpressionUtil.java | ExpressionUtil.guessParameterType | private static String guessParameterType(Database db, VoltXMLElement elm) {
if (! isParameterized(elm) || ! elm.name.equals("operation")) {
return "";
} else {
final ExpressionType op = mapOfVoltXMLOpType.get(elm.attributes.get("optype"));
assert op != null;
switch (op) {
case CONJUNCTION_OR:
case CONJUNCTION_AND:
case OPERATOR_NOT:
return "boolean";
case COMPARE_GREATERTHAN: // For these 2 operator-ops, the type is what the non-parameterized part gets set to.
case COMPARE_LESSTHAN:
case COMPARE_EQUAL:
case COMPARE_NOTEQUAL:
case COMPARE_GREATERTHANOREQUALTO:
case COMPARE_LESSTHANOREQUALTO:
case OPERATOR_PLUS:
case OPERATOR_MINUS:
case OPERATOR_MULTIPLY:
case OPERATOR_DIVIDE:
case OPERATOR_CONCAT:
case OPERATOR_MOD:
case COMPARE_IN:
final VoltXMLElement left = elm.children.get(0), right = elm.children.get(1);
return isParameterized(left) ? getType(db, right) : getType(db, left);
case OPERATOR_UNARY_MINUS:
return "integer";
case OPERATOR_IS_NULL:
case OPERATOR_EXISTS:
return "";
default:
assert false;
return "";
}
}
} | java | private static String guessParameterType(Database db, VoltXMLElement elm) {
if (! isParameterized(elm) || ! elm.name.equals("operation")) {
return "";
} else {
final ExpressionType op = mapOfVoltXMLOpType.get(elm.attributes.get("optype"));
assert op != null;
switch (op) {
case CONJUNCTION_OR:
case CONJUNCTION_AND:
case OPERATOR_NOT:
return "boolean";
case COMPARE_GREATERTHAN: // For these 2 operator-ops, the type is what the non-parameterized part gets set to.
case COMPARE_LESSTHAN:
case COMPARE_EQUAL:
case COMPARE_NOTEQUAL:
case COMPARE_GREATERTHANOREQUALTO:
case COMPARE_LESSTHANOREQUALTO:
case OPERATOR_PLUS:
case OPERATOR_MINUS:
case OPERATOR_MULTIPLY:
case OPERATOR_DIVIDE:
case OPERATOR_CONCAT:
case OPERATOR_MOD:
case COMPARE_IN:
final VoltXMLElement left = elm.children.get(0), right = elm.children.get(1);
return isParameterized(left) ? getType(db, right) : getType(db, left);
case OPERATOR_UNARY_MINUS:
return "integer";
case OPERATOR_IS_NULL:
case OPERATOR_EXISTS:
return "";
default:
assert false;
return "";
}
}
} | [
"private",
"static",
"String",
"guessParameterType",
"(",
"Database",
"db",
",",
"VoltXMLElement",
"elm",
")",
"{",
"if",
"(",
"!",
"isParameterized",
"(",
"elm",
")",
"||",
"!",
"elm",
".",
"name",
".",
"equals",
"(",
"\"operation\"",
")",
")",
"{",
"re... | Guess from a parent node what are the parameter type of its child node, should one of its child node
contain parameter.
@param db catalog
@param elm node under inspection
@return string representation of the type of its child node. | [
"Guess",
"from",
"a",
"parent",
"node",
"what",
"are",
"the",
"parameter",
"type",
"of",
"its",
"child",
"node",
"should",
"one",
"of",
"its",
"child",
"node",
"contain",
"parameter",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ExpressionUtil.java#L149-L185 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/KeyTable.java | KeyTable.getNodeSetDTMByKey | public XNodeSet getNodeSetDTMByKey(QName name, XMLString ref)
{
XNodeSet refNodes = (XNodeSet) getRefsTable().get(ref);
// clone wiht reset the node set
try
{
if (refNodes != null)
{
refNodes = (XNodeSet) refNodes.cloneWithReset();
}
}
catch (CloneNotSupportedException e)
{
refNodes = null;
}
if (refNodes == null) {
// create an empty XNodeSet
KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter();
XPathContext xctxt = ki.getXPathContext();
refNodes = new XNodeSet(xctxt.getDTMManager()) {
public void setRoot(int nodeHandle, Object environment) {
// Root cannot be set on non-iterated node sets. Ignore it.
}
};
refNodes.reset();
}
return refNodes;
} | java | public XNodeSet getNodeSetDTMByKey(QName name, XMLString ref)
{
XNodeSet refNodes = (XNodeSet) getRefsTable().get(ref);
// clone wiht reset the node set
try
{
if (refNodes != null)
{
refNodes = (XNodeSet) refNodes.cloneWithReset();
}
}
catch (CloneNotSupportedException e)
{
refNodes = null;
}
if (refNodes == null) {
// create an empty XNodeSet
KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter();
XPathContext xctxt = ki.getXPathContext();
refNodes = new XNodeSet(xctxt.getDTMManager()) {
public void setRoot(int nodeHandle, Object environment) {
// Root cannot be set on non-iterated node sets. Ignore it.
}
};
refNodes.reset();
}
return refNodes;
} | [
"public",
"XNodeSet",
"getNodeSetDTMByKey",
"(",
"QName",
"name",
",",
"XMLString",
"ref",
")",
"{",
"XNodeSet",
"refNodes",
"=",
"(",
"XNodeSet",
")",
"getRefsTable",
"(",
")",
".",
"get",
"(",
"ref",
")",
";",
"// clone wiht reset the node set",
"try",
"{",
... | Given a valid element key, return the corresponding node list.
@param name The name of the key, which must match the 'name' attribute on xsl:key.
@param ref The value that must match the value found by the 'match' attribute on xsl:key.
@return a set of nodes referenced by the key named <CODE>name</CODE> and the reference <CODE>ref</CODE>. If no node is referenced by this key, an empty node set is returned. | [
"Given",
"a",
"valid",
"element",
"key",
"return",
"the",
"corresponding",
"node",
"list",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/KeyTable.java#L115-L145 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/BucketPath.java | BucketPath.replaceShorthand | @Deprecated
public static String replaceShorthand(char c, Map<String, String> headers) {
return replaceShorthand(c, headers, false, 0, 0);
} | java | @Deprecated
public static String replaceShorthand(char c, Map<String, String> headers) {
return replaceShorthand(c, headers, false, 0, 0);
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"replaceShorthand",
"(",
"char",
"c",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"return",
"replaceShorthand",
"(",
"c",
",",
"headers",
",",
"false",
",",
"0",
",",
"0",
")",
";... | Hardcoded lookups for %x style escape replacement. Add your own!
All shorthands are Date format strings, currently.
Returns the empty string if an escape is not recognized.
Dates follow the same format as unix date, with a few exceptions.
<p>This static method will be REMOVED in a future version of Flume</p> | [
"Hardcoded",
"lookups",
"for",
"%x",
"style",
"escape",
"replacement",
".",
"Add",
"your",
"own!"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/BucketPath.java#L124-L127 |
dbracewell/mango | src/main/java/com/davidbracewell/string/StringUtils.java | StringUtils.randomString | public static String randomString(int length, @NonNull CharMatcher validChar) {
return randomString(length, 0, Integer.MAX_VALUE, validChar);
} | java | public static String randomString(int length, @NonNull CharMatcher validChar) {
return randomString(length, 0, Integer.MAX_VALUE, validChar);
} | [
"public",
"static",
"String",
"randomString",
"(",
"int",
"length",
",",
"@",
"NonNull",
"CharMatcher",
"validChar",
")",
"{",
"return",
"randomString",
"(",
"length",
",",
"0",
",",
"Integer",
".",
"MAX_VALUE",
",",
"validChar",
")",
";",
"}"
] | Generates a random string of a given length
@param length The length of the string
@param validChar CharPredicate that must match for a character to be returned in the string
@return A string of random characters | [
"Generates",
"a",
"random",
"string",
"of",
"a",
"given",
"length"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/string/StringUtils.java#L388-L390 |
overturetool/overture | ide/debug/src/main/java/org/overture/ide/debug/core/launching/VdmLaunchConfigurationDelegate.java | VdmLaunchConfigurationDelegate.prepareCustomOvertureProperties | public static File prepareCustomOvertureProperties(IVdmProject project,
ILaunchConfiguration configuration) throws CoreException
{
List<String> properties = new Vector<String>();
if (VdmDebugPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DBGP_ENABLE_EXPERIMENTAL_MODELCHECKER))
{
properties.add(getProbHomeProperty());
}
return writePropertyFile(project, "overture.properties", properties);
} | java | public static File prepareCustomOvertureProperties(IVdmProject project,
ILaunchConfiguration configuration) throws CoreException
{
List<String> properties = new Vector<String>();
if (VdmDebugPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DBGP_ENABLE_EXPERIMENTAL_MODELCHECKER))
{
properties.add(getProbHomeProperty());
}
return writePropertyFile(project, "overture.properties", properties);
} | [
"public",
"static",
"File",
"prepareCustomOvertureProperties",
"(",
"IVdmProject",
"project",
",",
"ILaunchConfiguration",
"configuration",
")",
"throws",
"CoreException",
"{",
"List",
"<",
"String",
">",
"properties",
"=",
"new",
"Vector",
"<",
"String",
">",
"(",
... | Create the custom overture.properties file loaded by the debugger
@param project
@param configuration a configuration or null
@return
@throws CoreException | [
"Create",
"the",
"custom",
"overture",
".",
"properties",
"file",
"loaded",
"by",
"the",
"debugger"
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/core/launching/VdmLaunchConfigurationDelegate.java#L370-L381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.