repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java | CommerceNotificationAttachmentPersistenceImpl.findByUuid | @Override
public List<CommerceNotificationAttachment> findByUuid(String uuid,
int start, int end,
OrderByComparator<CommerceNotificationAttachment> orderByComparator) {
return findByUuid(uuid, start, end, orderByComparator, true);
} | java | @Override
public List<CommerceNotificationAttachment> findByUuid(String uuid,
int start, int end,
OrderByComparator<CommerceNotificationAttachment> orderByComparator) {
return findByUuid(uuid, start, end, orderByComparator, true);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationAttachment",
">",
"findByUuid",
"(",
"String",
"uuid",
",",
"int",
"start",
",",
"int",
"end",
",",
"OrderByComparator",
"<",
"CommerceNotificationAttachment",
">",
"orderByComparator",
")",
"{",
"return",... | Returns an ordered range of all the commerce notification attachments where uuid = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationAttachmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param uuid the uuid
@param start the lower bound of the range of commerce notification attachments
@param end the upper bound of the range of commerce notification attachments (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching commerce notification attachments | [
"Returns",
"an",
"ordered",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"attachments",
"where",
"uuid",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L164-L169 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java | CmsContainerpageHandler.openEditorForElement | public void openEditorForElement(final CmsContainerPageElementPanel element, boolean inline, boolean wasNew) {
if (element.isNew()) {
//openEditorForElement will be called again asynchronously when the RPC for creating the element has finished
m_controller.createAndEditNewElement(element, inline);
return;
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(element.getNoEditReason())) {
CmsNotification.get().send(
CmsNotification.Type.WARNING,
"should be deactivated: " + element.getNoEditReason());
return;
}
if (CmsDomUtil.hasClass(CmsContainerElement.CLASS_GROUP_CONTAINER_ELEMENT_MARKER, element.getElement())) {
openGroupEditor((CmsGroupContainerElementPanel)element);
} else {
m_controller.setContentEditing(true);
m_controller.disableInlineEditing(element);
m_controller.getContentEditorHandler().openDialog(element, inline, wasNew);
element.removeHighlighting();
}
} | java | public void openEditorForElement(final CmsContainerPageElementPanel element, boolean inline, boolean wasNew) {
if (element.isNew()) {
//openEditorForElement will be called again asynchronously when the RPC for creating the element has finished
m_controller.createAndEditNewElement(element, inline);
return;
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(element.getNoEditReason())) {
CmsNotification.get().send(
CmsNotification.Type.WARNING,
"should be deactivated: " + element.getNoEditReason());
return;
}
if (CmsDomUtil.hasClass(CmsContainerElement.CLASS_GROUP_CONTAINER_ELEMENT_MARKER, element.getElement())) {
openGroupEditor((CmsGroupContainerElementPanel)element);
} else {
m_controller.setContentEditing(true);
m_controller.disableInlineEditing(element);
m_controller.getContentEditorHandler().openDialog(element, inline, wasNew);
element.removeHighlighting();
}
} | [
"public",
"void",
"openEditorForElement",
"(",
"final",
"CmsContainerPageElementPanel",
"element",
",",
"boolean",
"inline",
",",
"boolean",
"wasNew",
")",
"{",
"if",
"(",
"element",
".",
"isNew",
"(",
")",
")",
"{",
"//openEditorForElement will be called again asynch... | Opens the edit dialog for the specified element.<p>
@param element the element to edit
@param inline <code>true</code> to open the inline editor for the given element if available
@param wasNew <code>true</code> in case this is a newly created element not previously edited | [
"Opens",
"the",
"edit",
"dialog",
"for",
"the",
"specified",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java#L765-L788 |
hawkular/hawkular-apm | api/src/main/java/org/hawkular/apm/api/utils/NodeUtil.java | NodeUtil.findNodes | @SuppressWarnings("unchecked")
public static <T extends Node> void findNodes(List<Node> nodes, Class<T> cls, List<T> results) {
for (Node n : nodes) {
if (n instanceof ContainerNode) {
findNodes(((ContainerNode) n).getNodes(), cls, results);
}
if (cls == n.getClass()) {
results.add((T) n);
}
}
} | java | @SuppressWarnings("unchecked")
public static <T extends Node> void findNodes(List<Node> nodes, Class<T> cls, List<T> results) {
for (Node n : nodes) {
if (n instanceof ContainerNode) {
findNodes(((ContainerNode) n).getNodes(), cls, results);
}
if (cls == n.getClass()) {
results.add((T) n);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Node",
">",
"void",
"findNodes",
"(",
"List",
"<",
"Node",
">",
"nodes",
",",
"Class",
"<",
"T",
">",
"cls",
",",
"List",
"<",
"T",
">",
"results",
")",
"{"... | This method recursively scans a node hierarchy to locate instances of a particular
type.
@param nodes The nodes to scan
@param cls The class of the node to be returned
@param results The list of nodes found | [
"This",
"method",
"recursively",
"scans",
"a",
"node",
"hierarchy",
"to",
"locate",
"instances",
"of",
"a",
"particular",
"type",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/utils/NodeUtil.java#L236-L247 |
alkacon/opencms-core | src/org/opencms/workflow/CmsExtendedWorkflowManager.java | CmsExtendedWorkflowManager.checkNewParentsInList | protected void checkNewParentsInList(CmsObject userCms, List<CmsResource> resources) throws CmsException {
Map<String, CmsResource> resourcesByPath = new HashMap<String, CmsResource>();
CmsObject rootCms = OpenCms.initCmsObject(m_adminCms);
rootCms.getRequestContext().setCurrentProject(userCms.getRequestContext().getCurrentProject());
rootCms.getRequestContext().setSiteRoot("");
for (CmsResource resource : resources) {
resourcesByPath.put(resource.getRootPath(), resource);
}
for (CmsResource resource : resources) {
if (resource.getState().isNew()) {
String parentPath = CmsResource.getParentFolder(resource.getRootPath());
CmsResource parent = resourcesByPath.get(parentPath);
if (parent == null) {
parent = rootCms.readResource(parentPath);
if (parent.getState().isNew()) {
throw new CmsNewParentNotInWorkflowException(
Messages.get().container(
Messages.ERR_NEW_PARENT_NOT_IN_WORKFLOW_1,
resource.getRootPath()));
}
}
}
}
} | java | protected void checkNewParentsInList(CmsObject userCms, List<CmsResource> resources) throws CmsException {
Map<String, CmsResource> resourcesByPath = new HashMap<String, CmsResource>();
CmsObject rootCms = OpenCms.initCmsObject(m_adminCms);
rootCms.getRequestContext().setCurrentProject(userCms.getRequestContext().getCurrentProject());
rootCms.getRequestContext().setSiteRoot("");
for (CmsResource resource : resources) {
resourcesByPath.put(resource.getRootPath(), resource);
}
for (CmsResource resource : resources) {
if (resource.getState().isNew()) {
String parentPath = CmsResource.getParentFolder(resource.getRootPath());
CmsResource parent = resourcesByPath.get(parentPath);
if (parent == null) {
parent = rootCms.readResource(parentPath);
if (parent.getState().isNew()) {
throw new CmsNewParentNotInWorkflowException(
Messages.get().container(
Messages.ERR_NEW_PARENT_NOT_IN_WORKFLOW_1,
resource.getRootPath()));
}
}
}
}
} | [
"protected",
"void",
"checkNewParentsInList",
"(",
"CmsObject",
"userCms",
",",
"List",
"<",
"CmsResource",
">",
"resources",
")",
"throws",
"CmsException",
"{",
"Map",
"<",
"String",
",",
"CmsResource",
">",
"resourcesByPath",
"=",
"new",
"HashMap",
"<",
"Strin... | Checks that the parent folders of new resources which are released are either not new or are also released.<p>
@param userCms the user CMS context
@param resources the resources to check
@throws CmsException if the check fails | [
"Checks",
"that",
"the",
"parent",
"folders",
"of",
"new",
"resources",
"which",
"are",
"released",
"are",
"either",
"not",
"new",
"or",
"are",
"also",
"released",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsExtendedWorkflowManager.java#L368-L392 |
fuwjax/ev-oss | funco/src/main/java/org/fuwjax/oss/util/assertion/Assert2.java | Assert2.assertByteEquals | public static void assertByteEquals(final Path sub, final Path expected, final Path actual) throws IOException {
final int length = 4096;
final byte[] hereBuffer = new byte[length];
final byte[] thereBuffer = new byte[length];
long hereLimit = 0;
long thereLimit = 0;
try(InputStream hereStream = newInputStream(expected); InputStream thereStream = newInputStream(actual)) {
int line = 1;
int ch = 0;
for(long i = 0; i < Files.size(expected); i++) {
if(i >= hereLimit) {
hereLimit += read(hereStream, hereBuffer, hereLimit);
}
if(i >= thereLimit) {
thereLimit += read(thereStream, thereBuffer, thereLimit);
}
final int c = hereBuffer[(int) (i % length)];
assertThat(thereBuffer[(int) (i % length)], asserts(message(sub, i, line, ch), t -> t == c));
if(c == '\n') {
ch = 0;
line++;
} else {
ch++;
}
}
}
} | java | public static void assertByteEquals(final Path sub, final Path expected, final Path actual) throws IOException {
final int length = 4096;
final byte[] hereBuffer = new byte[length];
final byte[] thereBuffer = new byte[length];
long hereLimit = 0;
long thereLimit = 0;
try(InputStream hereStream = newInputStream(expected); InputStream thereStream = newInputStream(actual)) {
int line = 1;
int ch = 0;
for(long i = 0; i < Files.size(expected); i++) {
if(i >= hereLimit) {
hereLimit += read(hereStream, hereBuffer, hereLimit);
}
if(i >= thereLimit) {
thereLimit += read(thereStream, thereBuffer, thereLimit);
}
final int c = hereBuffer[(int) (i % length)];
assertThat(thereBuffer[(int) (i % length)], asserts(message(sub, i, line, ch), t -> t == c));
if(c == '\n') {
ch = 0;
line++;
} else {
ch++;
}
}
}
} | [
"public",
"static",
"void",
"assertByteEquals",
"(",
"final",
"Path",
"sub",
",",
"final",
"Path",
"expected",
",",
"final",
"Path",
"actual",
")",
"throws",
"IOException",
"{",
"final",
"int",
"length",
"=",
"4096",
";",
"final",
"byte",
"[",
"]",
"hereBu... | Asserts that two paths are byte-equivalent.
@param sub the shared portion of the two paths
@param expected the expected path
@param actual the actual path
@throws IOException if the paths cannot be opened and consumed | [
"Asserts",
"that",
"two",
"paths",
"are",
"byte",
"-",
"equivalent",
"."
] | train | https://github.com/fuwjax/ev-oss/blob/cbd88592e9b2fa9547c3bdd41e52e790061a2253/funco/src/main/java/org/fuwjax/oss/util/assertion/Assert2.java#L152-L178 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Getter.java | Getter.getView | public View getView(int id, int index, int timeout){
return waiter.waitForView(id, index, timeout);
} | java | public View getView(int id, int index, int timeout){
return waiter.waitForView(id, index, timeout);
} | [
"public",
"View",
"getView",
"(",
"int",
"id",
",",
"int",
"index",
",",
"int",
"timeout",
")",
"{",
"return",
"waiter",
".",
"waitForView",
"(",
"id",
",",
"index",
",",
"timeout",
")",
";",
"}"
] | Returns a {@code View} with a given id.
@param id the R.id of the {@code View} to be returned
@param index the index of the {@link View}. {@code 0} if only one is available
@param timeout the timeout in milliseconds
@return a {@code View} with a given id | [
"Returns",
"a",
"{",
"@code",
"View",
"}",
"with",
"a",
"given",
"id",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Getter.java#L116-L118 |
protostuff/protostuff | protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java | JsonIOUtil.mergeFrom | public static <T> void mergeFrom(JsonParser parser, T message, Schema<T> schema,
boolean numeric) throws IOException
{
if (parser.nextToken() != JsonToken.START_OBJECT)
{
throw new JsonInputException("Expected token: { but was " +
parser.getCurrentToken() + " on message " +
schema.messageFullName());
}
schema.mergeFrom(new JsonInput(parser, numeric), message);
if (parser.getCurrentToken() != JsonToken.END_OBJECT)
{
throw new JsonInputException("Expected token: } but was " +
parser.getCurrentToken() + " on message " +
schema.messageFullName());
}
} | java | public static <T> void mergeFrom(JsonParser parser, T message, Schema<T> schema,
boolean numeric) throws IOException
{
if (parser.nextToken() != JsonToken.START_OBJECT)
{
throw new JsonInputException("Expected token: { but was " +
parser.getCurrentToken() + " on message " +
schema.messageFullName());
}
schema.mergeFrom(new JsonInput(parser, numeric), message);
if (parser.getCurrentToken() != JsonToken.END_OBJECT)
{
throw new JsonInputException("Expected token: } but was " +
parser.getCurrentToken() + " on message " +
schema.messageFullName());
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"mergeFrom",
"(",
"JsonParser",
"parser",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"boolean",
"numeric",
")",
"throws",
"IOException",
"{",
"if",
"(",
"parser",
".",
"nextToken",
"(",
... | Merges the {@code message} from the JsonParser using the given {@code schema}. | [
"Merges",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java#L327-L345 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.